forked from enlightenment/efl
ecore-wl2: redo Ecore_Wl2_Event_Window_Configure entirely
this is an event representing the "new" state of the surface after a configure event. it must contain the exact states which could potentially have changed in the configure in order to ensure synchronization between csd states and window size. ecore events for xdg-shell configures must be sent only upon receiving a configure event since states are set by the compositor and not by the client @fix #hoorayforbeta
This commit is contained in:
parent
6a1c466136
commit
5292b3de05
|
@ -122,10 +122,18 @@ typedef struct _Ecore_Wl2_Event_Selection_Data_Ready
|
|||
Eina_Bool done;
|
||||
} Ecore_Wl2_Event_Selection_Data_Ready;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ECORE_WL2_WINDOW_STATE_NONE = 0,
|
||||
ECORE_WL2_WINDOW_STATE_FULLSCREEN = (1 << 0),
|
||||
ECORE_WL2_WINDOW_STATE_MAXIMIZED = (1 << 1),
|
||||
} Ecore_Wl2_Window_States;
|
||||
|
||||
typedef struct _Ecore_Wl2_Event_Window_Configure
|
||||
{
|
||||
unsigned int win, event_win, edges;
|
||||
int x, y, w, h;
|
||||
unsigned int w, h;
|
||||
unsigned int states;
|
||||
} Ecore_Wl2_Event_Window_Configure;
|
||||
|
||||
typedef struct _Ecore_Wl2_Event_Sync_Done
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "ecore_wl2_private.h"
|
||||
|
||||
static void
|
||||
_ecore_wl2_window_configure_send(Ecore_Wl2_Window *window, int w, int h, unsigned int edges)
|
||||
_ecore_wl2_window_configure_send(Ecore_Wl2_Window *window, int w, int h, unsigned int edges, Eina_Bool fs, Eina_Bool max)
|
||||
{
|
||||
Ecore_Wl2_Event_Window_Configure *ev;
|
||||
|
||||
|
@ -14,11 +14,13 @@ _ecore_wl2_window_configure_send(Ecore_Wl2_Window *window, int w, int h, unsigne
|
|||
|
||||
ev->win = window->id;
|
||||
ev->event_win = window->id;
|
||||
ev->x = window->geometry.x;
|
||||
ev->y = window->geometry.y;
|
||||
ev->w = w;
|
||||
ev->h = h;
|
||||
ev->edges = edges;
|
||||
if (fs)
|
||||
ev->states |= ECORE_WL2_WINDOW_STATE_FULLSCREEN;
|
||||
if (max)
|
||||
ev->states |= ECORE_WL2_WINDOW_STATE_MAXIMIZED;
|
||||
|
||||
ecore_event_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, ev, NULL, NULL);
|
||||
}
|
||||
|
@ -32,14 +34,9 @@ _wl_shell_surface_cb_ping(void *data EINA_UNUSED, struct wl_shell_surface *shell
|
|||
static void
|
||||
_wl_shell_surface_cb_configure(void *data, struct wl_shell_surface *shell_surface EINA_UNUSED, unsigned int edges, int w, int h)
|
||||
{
|
||||
Ecore_Wl2_Window *win;
|
||||
Ecore_Wl2_Window *win = data;
|
||||
|
||||
win = data;
|
||||
if (!win) return;
|
||||
|
||||
if ((w <= 0) || (h <= 0)) return;
|
||||
if ((w > 0) && (h > 0))
|
||||
_ecore_wl2_window_configure_send(win, w, h, edges);
|
||||
_ecore_wl2_window_configure_send(win, w, h, edges, win->fullscreen, win->maximized);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -79,11 +76,15 @@ static const struct xdg_popup_listener _xdg_popup_listener =
|
|||
static void
|
||||
_xdg_surface_cb_configure(void *data, struct xdg_surface *xdg_surface EINA_UNUSED, int32_t w, int32_t h, struct wl_array *states, uint32_t serial)
|
||||
{
|
||||
Ecore_Wl2_Window *win;
|
||||
Ecore_Wl2_Window *win = data;
|
||||
uint32_t *s;
|
||||
Eina_Bool fs, max;
|
||||
|
||||
win = data;
|
||||
if (!win) return;
|
||||
if ((!win->maximized) && (!win->fullscreen))
|
||||
win->saved = win->geometry;
|
||||
|
||||
fs = win->fullscreen;
|
||||
max = win->maximized;
|
||||
|
||||
win->minimized = EINA_FALSE;
|
||||
win->maximized = EINA_FALSE;
|
||||
|
@ -115,8 +116,11 @@ _xdg_surface_cb_configure(void *data, struct xdg_surface *xdg_surface EINA_UNUSE
|
|||
win->configure_serial = serial;
|
||||
if ((win->geometry.w == w) && (win->geometry.h == h))
|
||||
w = h = 0;
|
||||
else if ((!w) && (!h) &&
|
||||
(!win->fullscreen) && (!win->maximized) && ((win->fullscreen != fs) || (win->maximized != max)))
|
||||
w = win->saved.w, h = win->saved.h;
|
||||
|
||||
_ecore_wl2_window_configure_send(win, w, h, 0);
|
||||
_ecore_wl2_window_configure_send(win, w, h, !!win->resizing, win->fullscreen, win->maximized);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -668,7 +672,8 @@ ecore_wl2_window_maximized_set(Ecore_Wl2_Window *window, Eina_Bool maximized)
|
|||
maximized = !!maximized;
|
||||
if (prev == maximized) return;
|
||||
|
||||
window->maximized = maximized;
|
||||
if (window->wl_shell_surface)
|
||||
window->maximized = maximized;
|
||||
|
||||
if (maximized)
|
||||
{
|
||||
|
@ -684,10 +689,12 @@ ecore_wl2_window_maximized_set(Ecore_Wl2_Window *window, Eina_Bool maximized)
|
|||
if (window->xdg_surface)
|
||||
xdg_surface_unset_maximized(window->xdg_surface);
|
||||
else if (window->wl_shell_surface)
|
||||
wl_shell_surface_set_toplevel(window->wl_shell_surface);
|
||||
{
|
||||
wl_shell_surface_set_toplevel(window->wl_shell_surface);
|
||||
|
||||
_ecore_wl2_window_configure_send(window, window->saved.w,
|
||||
window->saved.h, 0);
|
||||
_ecore_wl2_window_configure_send(window, window->saved.w,
|
||||
window->saved.h, 0, window->fullscreen, window->maximized);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -710,7 +717,8 @@ ecore_wl2_window_fullscreen_set(Ecore_Wl2_Window *window, Eina_Bool fullscreen)
|
|||
fullscreen = !!fullscreen;
|
||||
if (prev == fullscreen) return;
|
||||
|
||||
window->fullscreen = fullscreen;
|
||||
if (window->wl_shell_surface)
|
||||
window->fullscreen = fullscreen;
|
||||
|
||||
if (fullscreen)
|
||||
{
|
||||
|
@ -728,10 +736,12 @@ ecore_wl2_window_fullscreen_set(Ecore_Wl2_Window *window, Eina_Bool fullscreen)
|
|||
if (window->xdg_surface)
|
||||
xdg_surface_unset_fullscreen(window->xdg_surface);
|
||||
else if (window->wl_shell_surface)
|
||||
wl_shell_surface_set_toplevel(window->wl_shell_surface);
|
||||
{
|
||||
wl_shell_surface_set_toplevel(window->wl_shell_surface);
|
||||
|
||||
_ecore_wl2_window_configure_send(window, window->saved.w,
|
||||
window->saved.h, 0);
|
||||
_ecore_wl2_window_configure_send(window, window->saved.w,
|
||||
window->saved.h, 0, window->fullscreen, window->maximized);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -182,8 +182,8 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_
|
|||
|
||||
prev_max = ee->prop.maximized;
|
||||
prev_full = ee->prop.fullscreen;
|
||||
ee->prop.maximized = ecore_wl2_window_maximized_get(wdata->win);
|
||||
ee->prop.fullscreen = ecore_wl2_window_fullscreen_get(wdata->win);
|
||||
ee->prop.maximized = (ev->states & ECORE_WL2_WINDOW_STATE_MAXIMIZED) == ECORE_WL2_WINDOW_STATE_MAXIMIZED;
|
||||
ee->prop.fullscreen = (ev->states & ECORE_WL2_WINDOW_STATE_FULLSCREEN) == ECORE_WL2_WINDOW_STATE_FULLSCREEN;
|
||||
|
||||
nw = ev->w;
|
||||
nh = ev->h;
|
||||
|
|
Loading…
Reference in New Issue