From b259d944eea6bdd513dd0bfa09439532c8e8a188 Mon Sep 17 00:00:00 2001 From: Rafael Antognolli Date: Wed, 8 May 2013 19:18:55 -0300 Subject: [PATCH] ecore_evas/wayland: Implement borderless_set engine method. It is needed to set the engine internal borderless property. Also update the border (frame) object, showing/hiding it as needed, and updating the framespace size when the frame object is handled by the engine. --- .../wayland/ecore_evas_wayland_common.c | 54 +++++++++++++++++++ .../engines/wayland/ecore_evas_wayland_egl.c | 2 +- .../wayland/ecore_evas_wayland_private.h | 2 + .../engines/wayland/ecore_evas_wayland_shm.c | 2 +- 4 files changed, 58 insertions(+), 2 deletions(-) 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 d4a60a501f..172b8f371e 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 @@ -41,6 +41,7 @@ void _ecore_evas_wl_common_render_updates(void *data, Evas *evas EINA_UNUSED, vo static void _rotation_do(Ecore_Evas *ee, int rotation, int resize); static void _ecore_evas_wayland_alpha_do(Ecore_Evas *ee, int alpha); static void _ecore_evas_wayland_transparent_do(Ecore_Evas *ee, int transparent); +static void _ecore_evas_wl_common_border_update(Ecore_Evas *ee); /* Frame listener */ static void _ecore_evas_wl_frame_complete(void *data, struct wl_callback *callback, uint32_t tm); @@ -194,6 +195,9 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_ { if (ee->func.fn_state_change) ee->func.fn_state_change(ee); + + if (prev_full != ee->prop.fullscreen) + _ecore_evas_wl_common_border_update(ee); } if (ee->prop.fullscreen) @@ -809,6 +813,20 @@ _ecore_evas_wl_common_frame_border_size_set(Evas_Object *obj, int fx, int fy, in evas_object_raise(sd->text); } +void +_ecore_evas_wl_common_frame_border_size_get(Evas_Object *obj, int *fx, int *fy, int *fw, int *fh) +{ + EE_Wl_Smart_Data *sd; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!(sd = evas_object_smart_data_get(obj))) return; + + if (fx) *fx = sd->border_size[2]; + if (fy) *fy = sd->border_size[0]; + if (fw) *fw = sd->border_size[2] + sd->border_size[3]; + if (fh) *fh = sd->border_size[0] + sd->border_size[1]; +} + void _ecore_evas_wl_common_raise(Ecore_Evas *ee) { @@ -989,6 +1007,42 @@ _ecore_evas_wl_common_iconified_set(Ecore_Evas *ee, int iconify) /* FIXME: Implement this in Wayland someshow */ } +static void +_ecore_evas_wl_common_border_update(Ecore_Evas *ee) +{ + Ecore_Evas_Engine_Wl_Data *wdata; + + wdata = ee->engine.data; + if (!wdata->frame) + return; + + if (ee->prop.borderless || ee->prop.fullscreen) + { + evas_object_hide(wdata->frame); + evas_output_framespace_set(ee->evas, 0, 0, 0, 0); + } + else + { + int fx, fy, fw, fh; + evas_object_show(wdata->frame); + _ecore_evas_wl_common_frame_border_size_get(wdata->frame, + &fx, &fy, &fw, &fh); + evas_output_framespace_set(ee->evas, fx, fy, fw, fh); + } +} + +void +_ecore_evas_wl_common_borderless_set(Ecore_Evas *ee, int borderless) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ee) return; + if (ee->prop.borderless == borderless) return; + ee->prop.borderless = borderless; + + _ecore_evas_wl_common_border_update(ee); +} + void _ecore_evas_wl_common_maximized_set(Ecore_Evas *ee, int max) { 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 9d0b6e2992..3aa60bffde 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 @@ -55,7 +55,7 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func = _ecore_evas_wl_common_layer_set, NULL, // focus set _ecore_evas_wl_common_iconified_set, - NULL, // borderless set + _ecore_evas_wl_common_borderless_set, NULL, // override set _ecore_evas_wl_common_maximized_set, _ecore_evas_wl_common_fullscreen_set, 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 6774db80de..5abc4665b1 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 @@ -31,6 +31,7 @@ struct _Ecore_Evas_Engine_Wl_Data { Ecore_Wl_Window *parent, *win; Evas_Object *frame; + int fx, fy, fw, fh; }; Ecore_Evas_Interface_Wayland *_ecore_evas_wl_interface_new(void); @@ -68,6 +69,7 @@ void _ecore_evas_wl_common_screen_geometry_get(const Ecore_Evas *ee, int *x, int void _ecore_evas_wl_common_screen_dpi_get(const Ecore_Evas *ee, int *xdpi, int *ydpi); 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); +void _ecore_evas_wl_common_borderless_set(Ecore_Evas *ee, int borderless); Evas_Object * _ecore_evas_wl_common_frame_add(Evas *evas); void _ecore_evas_wl_common_frame_border_size_set(Evas_Object *obj, int fx, int fy, int fw, int fh); 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 871b796572..2bac6f1d1a 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 @@ -56,7 +56,7 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func = _ecore_evas_wl_common_layer_set, NULL, // focus set _ecore_evas_wl_common_iconified_set, - NULL, // borderless set + _ecore_evas_wl_common_borderless_set, NULL, // override set _ecore_evas_wl_common_maximized_set, _ecore_evas_wl_common_fullscreen_set,