From 18048d52bd1af2725cfe6f0ab1ab4064bbbc7f39 Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Thu, 30 Jun 2016 13:13:44 +0900 Subject: [PATCH] ecore_wayland: Add API ecore_wl_window_geometry_get() and use it on event handler of configure. The geometry of ecore_wl_window can be reconfigured by both of server and client. Before, we passed its geometry as a Ecore Event in order to notify ecore_evas, But in this case we cannot gaurantee coherence. Thus, it would be better to give the geometry by the API on event handler. Change-Id: Iad4ff888ab7c79ef446a083bbfe4cd362c0cb551 --- src/lib/ecore_wayland/Ecore_Wayland.h | 1 + src/lib/ecore_wayland/ecore_wl_window.c | 12 ++++++++++++ .../ecore_evas/engines/wayland/ecore_evas_wayland_common.c | 11 +++++------ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h b/src/lib/ecore_wayland/Ecore_Wayland.h index 11b3c8f..3773d95 100644 --- a/src/lib/ecore_wayland/Ecore_Wayland.h +++ b/src/lib/ecore_wayland/Ecore_Wayland.h @@ -1254,6 +1254,7 @@ EAPI void ecore_wl_window_aux_hint_change(Ecore_Wl_Window *win, int id, const ch EAPI void ecore_wl_window_aux_hint_del(Ecore_Wl_Window *win, int id); EAPI void ecore_wl_window_floating_mode_set(Ecore_Wl_Window *win, Eina_Bool floating); +EAPI void ecore_wl_window_geometry_get(Ecore_Wl_Window *win, int *x, int *y, int *w, int *h); #ifdef __cplusplus } diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c index c3e3446..edf4c7f 100644 --- a/src/lib/ecore_wayland/ecore_wl_window.c +++ b/src/lib/ecore_wayland/ecore_wl_window.c @@ -2095,3 +2095,15 @@ ecore_wl_window_floating_mode_set(Ecore_Wl_Window *win, Eina_Bool floating) win->surface); } } + +EAPI void +ecore_wl_window_geometry_get(Ecore_Wl_Window *win, int *x, int *y, int *w, int *h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!win) return; + + if (x) *x = win->allocation.x; + if (y) *y = win->allocation.y; + if (w) *w = win->configured.w; + if (h) *h = win->configured.h; +} diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c index 8dce1e1..d72f015 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c @@ -167,7 +167,7 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_ Ecore_Evas *ee; Ecore_Evas_Engine_Wl_Data *wdata; Ecore_Wl_Event_Window_Configure *ev; - int nw = 0, nh = 0; + int nx = 0, ny = 0, nw = 0, nh = 0; Eina_Bool prev_max, prev_full; LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -185,8 +185,7 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_ ee->prop.maximized = ecore_wl_window_maximized_get(wdata->win); ee->prop.fullscreen = ecore_wl_window_fullscreen_get(wdata->win); - nw = ev->w; - nh = ev->h; + ecore_wl_window_geometry_get(wdata->win, &nx, &ny, &nw, &nh); if (nw < 1) nw = 1; if (nh < 1) nh = 1; @@ -195,7 +194,7 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_ if (ee->prop.fullscreen) { - _ecore_evas_wl_common_move(ee, ev->x, ev->y); + _ecore_evas_wl_common_move(ee, nx, ny); _ecore_evas_wl_common_resize(ee, nw, nh); if (prev_full != ee->prop.fullscreen) @@ -204,8 +203,8 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_ return ECORE_CALLBACK_PASS_ON; } - if ((ee->x != ev->x) || (ee->y != ev->y)) - _ecore_evas_wl_common_move(ee, ev->x, ev->y); + if ((ee->x != nx) || (ee->y != ny)) + _ecore_evas_wl_common_move(ee, nx, ny); if ((ee->req.w != nw) || (ee->req.h != nh)) _ecore_evas_wl_common_resize(ee, nw, nh); -- 2.7.4