antognolli pushed a commit to branch master.
commit 1f58a59a61804b21915e29595d5565c2487f7bac
Author: Rafael Antognolli <[email protected]>
Date: Tue Apr 30 16:29:00 2013 -0300
ecore_evas/wayland: Remove hack for changed state.
Since we don't have a changed state callback on Wayland, just call the
changed_state callback of Ecore_Evas from the configure callback.
There's no need to add the Ecore_Job that will send the event later.
This makes the code cleaner, simpler, and will call the callback when
the configure event is received, which is a good place to check for the
changes.
---
src/lib/ecore_wayland/Ecore_Wayland.h | 4 --
src/lib/ecore_wayland/ecore_wl_window.c | 52 ----------------------
.../engines/wayland/ecore_evas_wayland_common.c | 28 +++++++-----
.../engines/wayland/ecore_evas_wayland_egl.c | 1 -
.../engines/wayland/ecore_evas_wayland_private.h | 1 -
.../engines/wayland/ecore_evas_wayland_shm.c | 2 -
6 files changed, 17 insertions(+), 71 deletions(-)
diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h
b/src/lib/ecore_wayland/Ecore_Wayland.h
index f9a12ef..07de5e6 100644
--- a/src/lib/ecore_wayland/Ecore_Wayland.h
+++ b/src/lib/ecore_wayland/Ecore_Wayland.h
@@ -225,9 +225,6 @@ struct _Ecore_Wl_Window
/* FIXME: Shouldn't these attributes be private to the Ecore_Wl_Window? */
Eina_Bool frame_pending;
struct wl_callback *frame_callback;
- void (*state_changed_cb)(void *);
- void *state_changed_cb_data;
- Ecore_Job *state_changed_job;
/* FIXME: Ideally we should record the cursor name for this window
* so we can compare and avoid unnecessary cursor set calls to wayland */
@@ -634,7 +631,6 @@ EAPI void ecore_wl_window_pointer_set(Ecore_Wl_Window *win,
struct wl_surface *s
EAPI void ecore_wl_window_cursor_from_name_set(Ecore_Wl_Window *win, const
char *cursor_name);
EAPI void ecore_wl_window_cursor_default_restore(Ecore_Wl_Window *win);
EAPI void ecore_wl_window_parent_set(Ecore_Wl_Window *win, Ecore_Wl_Window
*parent);
-EAPI void ecore_wl_window_state_changed_cb_set(Ecore_Wl_Window *win, void
(*cb)(void *), void *cb_data);
/** @since 1.7 */
EAPI Eina_Bool ecore_wl_dnd_set_selection(Ecore_Wl_Dnd *dnd, const char
**types_offered);
diff --git a/src/lib/ecore_wayland/ecore_wl_window.c
b/src/lib/ecore_wayland/ecore_wl_window.c
index 6b4720c..163761b 100644
--- a/src/lib/ecore_wayland/ecore_wl_window.c
+++ b/src/lib/ecore_wayland/ecore_wl_window.c
@@ -12,7 +12,6 @@ static void _ecore_wl_window_cb_surface_enter(void *data,
struct wl_surface *sur
static void _ecore_wl_window_cb_surface_leave(void *data, struct wl_surface
*surface, struct wl_output *output EINA_UNUSED);
static void _ecore_wl_window_configure_send(Ecore_Wl_Window *win, int w, int
h);
static char *_ecore_wl_window_id_str_get(unsigned int win_id);
-static void _ecore_wl_window_state_changed(Ecore_Wl_Window *win);
/* local variables */
static Eina_Hash *_windows = NULL;
@@ -110,12 +109,6 @@ ecore_wl_window_free(Ecore_Wl_Window *win)
if (win->surface) wl_surface_destroy(win->surface);
win->surface = NULL;
- if (win->state_changed_job)
- {
- ecore_job_del(win->state_changed_job);
- win->state_changed_job = NULL;
- }
-
/* HMMM, why was this disabled ? */
free(win);
}
@@ -323,8 +316,6 @@ ecore_wl_window_show(Ecore_Wl_Window *win)
break;
}
- _ecore_wl_window_state_changed(win);
-
/* if (win->type != ECORE_WL_WINDOW_TYPE_FULLSCREEN) */
/* { */
/* win->region.input = */
@@ -352,7 +343,6 @@ ecore_wl_window_hide(Ecore_Wl_Window *win)
win->shell_surface = NULL;
if (win->surface) wl_surface_destroy(win->surface);
win->surface = NULL;
- _ecore_wl_window_state_changed(win);
}
EAPI void
@@ -363,7 +353,6 @@ ecore_wl_window_raise(Ecore_Wl_Window *win)
if (!win) return;
if (win->shell_surface)
wl_shell_surface_set_toplevel(win->shell_surface);
- _ecore_wl_window_state_changed(win);
}
EAPI void
@@ -390,7 +379,6 @@ ecore_wl_window_maximized_set(Ecore_Wl_Window *win,
Eina_Bool maximized)
win->saved_allocation.h);
}
win->edges = 0;
- _ecore_wl_window_state_changed(win);
}
EAPI Eina_Bool
@@ -431,7 +419,6 @@ ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win,
Eina_Bool fullscreen)
win->saved_allocation.h);
}
win->edges = 0;
- _ecore_wl_window_state_changed(win);
}
EAPI Eina_Bool
@@ -463,7 +450,6 @@ ecore_wl_window_transparent_set(Ecore_Wl_Window *win,
Eina_Bool transparent)
wl_region_add(win->region.opaque, win->allocation.x,
win->allocation.y,
win->allocation.w, win->allocation.h);
}
- _ecore_wl_window_state_changed(win);
}
EAPI Eina_Bool
@@ -590,21 +576,6 @@ ecore_wl_window_parent_set(Ecore_Wl_Window *win,
Ecore_Wl_Window *parent)
win->parent = parent;
}
-/* @since 1.8 */
-EAPI void
-ecore_wl_window_state_changed_cb_set(Ecore_Wl_Window *win, void (*cb)(void *),
void *cb_data)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- if (!win) return;
-
- win->state_changed_cb = cb;
- if (cb)
- win->state_changed_cb_data = cb_data;
- else
- win->state_changed_cb_data = NULL;
-}
-
/* local functions */
static void
_ecore_wl_window_cb_ping(void *data EINA_UNUSED, struct wl_shell_surface
*shell_surface, unsigned int serial)
@@ -709,26 +680,3 @@ _ecore_wl_window_id_str_get(unsigned int win_id)
return id;
}
-
-static void
-_ecore_wl_window_state_changed_job(void *data)
-{
- Ecore_Wl_Window *win = data;
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- if (win->state_changed_cb)
- win->state_changed_cb(win->state_changed_cb_data);
-
- win->state_changed_job = NULL;
-}
-
-static void
-_ecore_wl_window_state_changed(Ecore_Wl_Window *win)
-{
- if (win->state_changed_job)
- return;
-
- win->state_changed_job =
- ecore_job_add(_ecore_wl_window_state_changed_job, win);
-}
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 2003911..9e9a416 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
@@ -162,8 +162,10 @@ static Eina_Bool
_ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type
EINA_UNUSED, void *event)
{
Ecore_Evas *ee;
+ Ecore_Evas_Engine_Wl_Data *wdata;
Ecore_Wl_Event_Window_Configure *ev;
int nw = 0, nh = 0;
+ Eina_Bool prev_max, prev_full;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -172,6 +174,21 @@ _ecore_evas_wl_common_cb_window_configure(void *data
EINA_UNUSED, int type EINA_
if (!ee) return ECORE_CALLBACK_PASS_ON;
if (ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+ wdata = ee->engine.data;
+ if (!wdata) return ECORE_CALLBACK_PASS_ON;
+
+ prev_max = ee->prop.maximized;
+ prev_full = ee->prop.fullscreen;
+ ee->prop.maximized = ecore_wl_window_maximized_get(wdata->win);
+ ee->prop.fullscreen = ecore_wl_window_fullscreen_get(wdata->win);
+
+ if ((prev_max != ee->prop.maximized) ||
+ (prev_full != ee->prop.fullscreen))
+ {
+ if (ee->func.fn_state_change)
+ ee->func.fn_state_change(ee);
+ }
+
if (ee->prop.fullscreen)
{
_ecore_evas_wl_common_move(ee, ev->x, ev->y);
@@ -957,7 +974,6 @@ _ecore_evas_wl_common_maximized_set(Ecore_Evas *ee, int max)
if (!ee) return;
wdata = ee->engine.data;
if (ee->prop.maximized == max) return;
- ee->prop.maximized = max;
ecore_wl_window_maximized_set(wdata->win, max);
}
@@ -971,7 +987,6 @@ _ecore_evas_wl_common_fullscreen_set(Ecore_Evas *ee, int
full)
if (!ee) return;
if (ee->prop.fullscreen == full) return;
wdata = ee->engine.data;
- ee->prop.fullscreen = full;
ecore_wl_window_fullscreen_set(wdata->win, full);
}
@@ -1225,12 +1240,3 @@ _ecore_evas_wl_interface_new(void)
return iface;
}
-
-void
-_ecore_evas_wl_common_state_change(void *data)
-{
- Ecore_Evas *ee = data;
-
- if (ee->func.fn_state_change)
- ee->func.fn_state_change(ee);
-}
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
index 919adf3..658c4c4 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
@@ -183,7 +183,6 @@ ecore_evas_wayland_egl_new_internal(const char *disp_name,
unsigned int parent,
wdata->win =
ecore_wl_window_new(p, x, y, w, h,
ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW);
ee->prop.window = wdata->win->id;
- ecore_wl_window_state_changed_cb_set(wdata->win,
_ecore_evas_wl_common_state_change, ee);
if ((einfo = (Evas_Engine_Info_Wayland_Egl
*)evas_engine_info_get(ee->evas)))
{
diff --git
a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h
b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h
index df6957f..7722f11 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h
@@ -66,7 +66,6 @@ void _ecore_evas_wl_common_post_render(Ecore_Evas *ee);
int _ecore_evas_wl_common_render(Ecore_Evas *ee);
void _ecore_evas_wl_common_screen_geometry_get(const Ecore_Evas *ee, int *x,
int *y, int *w, int *h);
void _ecore_evas_wl_common_screen_dpi_get(const Ecore_Evas *ee, int *xdpi, int
*ydpi);
-void _ecore_evas_wl_common_state_change(void *data);
void _ecore_evas_wl_common_render_updates(void *data, Evas *evas, void *event);
void _ecore_evas_wl_common_rotation_set(Ecore_Evas *ee, int rotation, int
resize);
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
index 080b9ed..5749c23 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
@@ -189,8 +189,6 @@ ecore_evas_wayland_shm_new_internal(const char *disp_name,
unsigned int parent,
wdata->win =
ecore_wl_window_new(p, x, y, w, h, ECORE_WL_WINDOW_BUFFER_TYPE_SHM);
ee->prop.window = wdata->win->id;
- ecore_wl_window_state_changed_cb_set(wdata->win,
- _ecore_evas_wl_common_state_change,
ee);
if ((einfo = (Evas_Engine_Info_Wayland_Shm
*)evas_engine_info_get(ee->evas)))
{
--
------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1