forked from enlightenment/efl
Ecore_Win32: add the API ecore_win32_window_maximized_set()
Summary: ecore_evas win32 engine is updated to support it. This fixes the "maximized/unmaximized" elm "windows states" test. Test Plan: elm_test Reviewers: raster, jptiz, felipealmeida Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12177
This commit is contained in:
parent
b9df223fa2
commit
25e64a9a4e
|
@ -625,6 +625,8 @@ EAPI void ecore_win32_window_iconified_set(Ecore_Win32_Window *window,
|
|||
|
||||
EAPI void ecore_win32_window_borderless_set(Ecore_Win32_Window *window,
|
||||
Eina_Bool on);
|
||||
EAPI void ecore_win32_window_maximized_set(Ecore_Win32_Window *window,
|
||||
Eina_Bool on);
|
||||
|
||||
EAPI void ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window,
|
||||
Eina_Bool on);
|
||||
|
|
|
@ -104,6 +104,7 @@ struct _Ecore_Win32_Window
|
|||
unsigned int pointer_is_in : 1;
|
||||
unsigned int borderless : 1;
|
||||
unsigned int iconified : 1;
|
||||
unsigned int maximized : 1;
|
||||
unsigned int fullscreen : 1;
|
||||
|
||||
struct {
|
||||
|
|
|
@ -146,6 +146,7 @@ _ecore_win32_window_internal_new(Ecore_Win32_Window *parent,
|
|||
w->pointer_is_in = 0;
|
||||
w->borderless = 0;
|
||||
w->iconified = 0;
|
||||
w->maximized = 0;
|
||||
w->fullscreen = 0;
|
||||
|
||||
w->drag.x = x;
|
||||
|
@ -1359,6 +1360,37 @@ ecore_win32_window_borderless_set(Ecore_Win32_Window *window,
|
|||
window->borderless = on;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Maximize or restore the given window.
|
||||
*
|
||||
* @param window The window.
|
||||
* @param on @c EINA_TRUE for maximized window, @c EINA_FALSE to
|
||||
* restore it.
|
||||
*
|
||||
* This function maximizes @p window if @p on is set
|
||||
* to @c EINA_TRUE, or restores the window if it is set to
|
||||
* @c EINA_FALSE. If @p window is @c NULL or if the state
|
||||
* does not change (like setting to fullscreenmaximized the window is already
|
||||
* maximized), this function does nothing.
|
||||
*
|
||||
* @since 1.26
|
||||
*/
|
||||
EAPI void
|
||||
ecore_win32_window_maximized_set(Ecore_Win32_Window *window,
|
||||
Eina_Bool on)
|
||||
{
|
||||
if (!window) return;
|
||||
|
||||
if (((window->maximized) && (on)) ||
|
||||
((!window->maximized) && (!on)))
|
||||
return;
|
||||
|
||||
INF("maximizing window: %s", on ? "yes" : "no");
|
||||
|
||||
ShowWindow(window->window, on ? SW_MAXIMIZE : SW_RESTORE);
|
||||
window->maximized = on;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the given window to fullscreen.
|
||||
*
|
||||
|
@ -1525,8 +1557,7 @@ ecore_win32_window_state_set(Ecore_Win32_Window *window,
|
|||
window->state.maximized_horz = 1;
|
||||
break;
|
||||
case ECORE_WIN32_WINDOW_STATE_MAXIMIZED:
|
||||
window->state.maximized_horz = 1;
|
||||
window->state.maximized_vert = 1;
|
||||
window->state.maximized = 1;
|
||||
break;
|
||||
case ECORE_WIN32_WINDOW_STATE_SHADED:
|
||||
window->state.shaded = 1;
|
||||
|
|
|
@ -73,6 +73,7 @@ struct _Ecore_Evas_Engine_Data_Win32
|
|||
{
|
||||
unsigned char region : 1;
|
||||
unsigned char fullscreen : 1;
|
||||
unsigned char maximized : 1;
|
||||
} state;
|
||||
};
|
||||
|
||||
|
@ -434,9 +435,11 @@ _ecore_evas_win32_event_window_property_change(void *data EINA_UNUSED, int type
|
|||
{
|
||||
struct {
|
||||
struct {
|
||||
unsigned char maximized : 1;
|
||||
unsigned char fullscreen : 1;
|
||||
} win32;
|
||||
struct {
|
||||
Eina_Bool maximized : 1;
|
||||
Eina_Bool fullscreen : 1;
|
||||
} prop;
|
||||
} prev;
|
||||
|
@ -456,12 +459,16 @@ _ecore_evas_win32_event_window_property_change(void *data EINA_UNUSED, int type
|
|||
wdata = ee->engine.data;
|
||||
|
||||
prev.win32.fullscreen = wdata->state.fullscreen;
|
||||
prev.win32.maximized = wdata->state.maximized;
|
||||
|
||||
prev.prop.fullscreen = ee->prop.fullscreen;
|
||||
prev.prop.maximized = ee->prop.maximized;
|
||||
|
||||
wdata->state.fullscreen = 0;
|
||||
wdata->state.maximized = 0;
|
||||
|
||||
ee->prop.fullscreen = EINA_FALSE;
|
||||
ee->prop.maximized = EINA_FALSE;
|
||||
|
||||
/* we get the states status */
|
||||
ecore_win32_window_state_get(e->window, &state, &num);
|
||||
|
@ -475,6 +482,10 @@ _ecore_evas_win32_event_window_property_change(void *data EINA_UNUSED, int type
|
|||
ee->prop.fullscreen = 1;
|
||||
wdata->state.fullscreen = 1;
|
||||
break;
|
||||
case ECORE_WIN32_WINDOW_STATE_MAXIMIZED:
|
||||
ee->prop.maximized = 1;
|
||||
wdata->state.maximized = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -483,7 +494,9 @@ _ecore_evas_win32_event_window_property_change(void *data EINA_UNUSED, int type
|
|||
}
|
||||
|
||||
if ((prev.win32.fullscreen != wdata->state.fullscreen) ||
|
||||
(prev.prop.fullscreen != ee->prop.fullscreen))
|
||||
(prev.prop.fullscreen != ee->prop.fullscreen) ||
|
||||
(prev.win32.maximized != wdata->state.maximized) ||
|
||||
(prev.prop.maximized != ee->prop.maximized))
|
||||
{
|
||||
if (ee->func.fn_state_change)
|
||||
ee->func.fn_state_change(ee);
|
||||
|
@ -508,6 +521,8 @@ _ecore_evas_win32_state_update(Ecore_Evas *ee)
|
|||
state[num++] = ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT;
|
||||
if (ee->prop.maximized)
|
||||
state[num++] = ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ;
|
||||
if (ee->prop.maximized)
|
||||
state[num++] = ECORE_WIN32_WINDOW_STATE_MAXIMIZED;
|
||||
// if (bd->client.netwm.state.shaded)
|
||||
// state[num++] = ECORE_WIN32_WINDOW_STATE_SHADED;
|
||||
/* if (ee->prop.focus_skip) */
|
||||
|
@ -832,7 +847,7 @@ _ecore_evas_win32_activate(Ecore_Evas *ee)
|
|||
INF("ecore evas activate");
|
||||
|
||||
ecore_evas_show(ee);
|
||||
ecore_win32_window_activate(ee->prop.window);
|
||||
ecore_win32_window_activate((Ecore_Win32_Window *)ee->prop.window);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -974,6 +989,30 @@ _ecore_evas_win32_override_set(Ecore_Evas *ee, Eina_Bool on)
|
|||
ee->prop.override = on;
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_evas_win32_maximized_set(Ecore_Evas *ee, Eina_Bool on)
|
||||
{
|
||||
Ecore_Evas_Engine_Data_Win32 *wdata = ee->engine.data;
|
||||
|
||||
INF("ecore evas maximized set");
|
||||
|
||||
wdata->state.maximized = !!on;
|
||||
if (ee->should_be_visible)
|
||||
{
|
||||
struct _Ecore_Win32_Window *window;
|
||||
|
||||
window = (Ecore_Win32_Window *)ee->prop.window;
|
||||
ecore_win32_window_maximized_set(window, on);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ee->prop.maximized == on) return;
|
||||
ee->prop.maximized = on;
|
||||
wdata->state.maximized = on;
|
||||
_ecore_evas_win32_state_update(ee);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_ecore_evas_win32_fullscreen_set(Ecore_Evas *ee, Eina_Bool on)
|
||||
{
|
||||
|
@ -1373,7 +1412,7 @@ static Ecore_Evas_Engine_Func _ecore_win32_engine_func =
|
|||
_ecore_evas_win32_iconified_set,
|
||||
_ecore_evas_win32_borderless_set,
|
||||
_ecore_evas_win32_override_set,
|
||||
NULL, /* _ecore_evas_x_maximize_set */
|
||||
_ecore_evas_win32_maximized_set,
|
||||
_ecore_evas_win32_fullscreen_set,
|
||||
NULL, /* _ecore_evas_x_avoid_damage_set */
|
||||
NULL, /* _ecore_evas_x_withdrawn_set */
|
||||
|
|
Loading…
Reference in New Issue