From b291d514995651d113819faf87c6b67907a9a6f4 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Fri, 10 Nov 2017 14:02:51 +0900 Subject: [PATCH] ecore_wl2: input rect set/add/sub Change-Id: Ic889b9a92fa415e8613cf6e1d0f5aea953e4e7c0 --- src/lib/ecore_evas/Ecore_Evas.h | 6 ++ src/lib/ecore_evas/ecore_evas.c | 56 +++++++++++++++++ src/lib/ecore_evas/ecore_evas_wayland.h | 5 ++ src/lib/ecore_wl2/Ecore_Wl2.h | 6 ++ src/lib/ecore_wl2/ecore_wl2_private.h | 3 + src/lib/ecore_wl2/ecore_wl2_window.c | 72 ++++++++++++++++++++++ .../engines/wayland/ecore_evas_wayland_common.c | 37 +++++++++++ 7 files changed, 185 insertions(+) diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h index 662ec7a..4096d7d 100644 --- a/src/lib/ecore_evas/Ecore_Evas.h +++ b/src/lib/ecore_evas/Ecore_Evas.h @@ -970,6 +970,12 @@ EAPI const char *ecore_evas_aux_hint_val_get(const Ecore_Evas *ee, int id); */ EAPI int ecore_evas_aux_hint_id_get(const Ecore_Evas *ee, const char *hint); +// TIZEN_ONLY(20160201) : support to handle input rectangle +EAPI void ecore_evas_input_rect_set(Ecore_Evas *ee, Eina_Rectangle *input_rect); +EAPI void ecore_evas_input_rect_add(Ecore_Evas *ee, Eina_Rectangle *input_rect); +EAPI void ecore_evas_input_rect_subtract(Ecore_Evas *ee, Eina_Rectangle *input_rect); +// + /** * @brief Sends message to parent ecore. * diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index d714efd..89a8409 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -2471,6 +2471,62 @@ ecore_evas_aux_hint_id_get(const Ecore_Evas *ee, const char *hint) return -1; } +// TIZEN_ONLY(20160201) : support to handle input rectangle +EAPI void +ecore_evas_input_rect_set(Ecore_Evas *ee, Eina_Rectangle *input_rect) +{ + ECORE_EVAS_CHECK(ee); + + if (!strncmp(ee->driver, "wayland", 7)) + { + Ecore_Evas_Interface_Wayland *iface; + iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland"); + EINA_SAFETY_ON_NULL_RETURN(iface); + + if (iface->input_rect_set) + iface->input_rect_set(ee, input_rect); + + return; + } +} + +EAPI void +ecore_evas_input_rect_add(Ecore_Evas *ee, Eina_Rectangle *input_rect) +{ + ECORE_EVAS_CHECK(ee); + + if (!strncmp(ee->driver, "wayland", 7)) + { + Ecore_Evas_Interface_Wayland *iface; + iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland"); + EINA_SAFETY_ON_NULL_RETURN(iface); + + if (iface->input_rect_add) + iface->input_rect_add(ee, input_rect); + + return; + } +} + +EAPI void +ecore_evas_input_rect_subtract(Ecore_Evas *ee, Eina_Rectangle *input_rect) +{ + ECORE_EVAS_CHECK(ee); + + if (!strncmp(ee->driver, "wayland", 7)) + { + Ecore_Evas_Interface_Wayland *iface; + iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland"); + EINA_SAFETY_ON_NULL_RETURN(iface); + + if (iface->input_rect_subtract) + iface->input_rect_subtract(ee, input_rect); + + return; + } +} +// + EAPI void ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on) { diff --git a/src/lib/ecore_evas/ecore_evas_wayland.h b/src/lib/ecore_evas/ecore_evas_wayland.h index 2d6faa2..3039a17 100644 --- a/src/lib/ecore_evas/ecore_evas_wayland.h +++ b/src/lib/ecore_evas/ecore_evas_wayland.h @@ -17,6 +17,11 @@ struct _Ecore_Evas_Interface_Wayland void (*aux_hint_add)(Ecore_Evas *ee, int id, const char *hint, const char *val); void (*aux_hint_change)(Ecore_Evas *ee, int id, const char *val); void (*aux_hint_del)(Ecore_Evas *ee, int id); + // TIZEN_ONLY(20160201) : support to handle input rectangle + void (*input_rect_set)(Ecore_Evas *ee, Eina_Rectangle *input_rect); + void (*input_rect_add)(Ecore_Evas *ee, Eina_Rectangle *input_rect); + void (*input_rect_subtract)(Ecore_Evas *ee, Eina_Rectangle *input_rect); + // }; #endif diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index 2809eea..408524f 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -1088,6 +1088,12 @@ EAPI Eina_Bool ecore_wl2_window_transparent_get(Ecore_Wl2_Window *window); */ EAPI void ecore_wl2_window_opaque_region_set(Ecore_Wl2_Window *window, int x, int y, int w, int h); +// TIZEN_ONLY(20160201) : support to handle input rectangle +EAPI void ecore_wl2_window_input_rect_set(Ecore_Wl2_Window *win, Eina_Rectangle *input_rect); +EAPI void ecore_wl2_window_input_rect_add(Ecore_Wl2_Window *win, Eina_Rectangle *input_rect); +EAPI void ecore_wl2_window_input_rect_subtract(Ecore_Wl2_Window *win, Eina_Rectangle *input_rect); +// + /** * Set the input region of the Ecore_Wl2_Window. * diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h index 4a004ad..ae1b5ee 100644 --- a/src/lib/ecore_wl2/ecore_wl2_private.h +++ b/src/lib/ecore_wl2/ecore_wl2_private.h @@ -214,6 +214,9 @@ struct _Ecore_Wl2_Window Eina_Rectangle saved; Eina_Rectangle opaque; Eina_Rectangle input_rect; + // TIZEN_ONLY(20160201) : support to handle input rectangle + struct wl_region *input_region; + // // TIZEN_ONLY(20160323) struct diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c index 01a451f..48d2b1b 100644 --- a/src/lib/ecore_wl2/ecore_wl2_window.c +++ b/src/lib/ecore_wl2/ecore_wl2_window.c @@ -633,6 +633,10 @@ ecore_wl2_window_free(Ecore_Wl2_Window *window) if (window->title) eina_stringshare_del(window->title); if (window->class) eina_stringshare_del(window->class); if (window->role) eina_stringshare_del(window->role); + // TIZEN_ONLY(20160201) : support to handle input rectangle + if (window->input_region) wl_region_destroy(window->input_region); + window->input_region = NULL; + // display->windows = eina_inlist_remove(display->windows, EINA_INLIST_GET(window)); @@ -865,6 +869,74 @@ ecore_wl2_window_opaque_region_set(Ecore_Wl2_Window *window, int x, int y, int w window->pending.opaque = EINA_TRUE; } +// TIZEN_ONLY(20160201) : support to handle input rectangle +EAPI void +ecore_wl2_window_input_rect_set(Ecore_Wl2_Window *win, Eina_Rectangle *input_rect) +{ + if (!win) return; + if (!input_rect) return; + if (win->input_region) + { + wl_region_destroy(win->input_region); + win->input_region = NULL; + } + + win->input_rect.x = input_rect->x; + win->input_rect.y = input_rect->y; + win->input_rect.w = input_rect->w; + win->input_rect.h = input_rect->h; + + if (win->type != ECORE_WL2_WINDOW_TYPE_DND) + { + struct wl_region *region; + region = wl_compositor_create_region(win->display->wl.compositor); + if (!region) return; + + wl_region_add(region, input_rect->x, input_rect->y, input_rect->w, input_rect->h); + wl_surface_set_input_region(win->surface, region); + wl_region_destroy(region); + } +} + +EAPI void +ecore_wl2_window_input_rect_add(Ecore_Wl2_Window *win, Eina_Rectangle *input_rect) +{ + if (!win) return; + if (!input_rect) return; + if (input_rect->x < 0 || input_rect->y < 0) return; + + if (win->type != ECORE_WL2_WINDOW_TYPE_DND) + { + if (!win->input_region) + { + struct wl_region *region; + region = wl_compositor_create_region(win->display->wl.compositor); + if (!region) return; + + win->input_region = region; + } + + wl_region_add(win->input_region, input_rect->x, input_rect->y, input_rect->w, input_rect->h); + wl_surface_set_input_region(win->surface, win->input_region); + } +} + +EAPI void +ecore_wl2_window_input_rect_subtract(Ecore_Wl2_Window *win, Eina_Rectangle *input_rect) +{ + if (!win) return; + if (!input_rect) return; + if (input_rect->x < 0 || input_rect->y < 0) return; + if (!win->input_region) return; + + if (win->type != ECORE_WL2_WINDOW_TYPE_DND) + { + wl_region_subtract(win->input_region, input_rect->x, input_rect->y, input_rect->w, input_rect->h); + wl_surface_set_input_region(win->surface, win->input_region); + } +} +// + EAPI void ecore_wl2_window_input_region_set(Ecore_Wl2_Window *window, int x, int y, int w, int 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 d48be36..59389a6 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 @@ -2232,6 +2232,38 @@ _ecore_evas_wayland_aux_hint_del(Ecore_Evas *ee, int id) ecore_wl2_window_aux_hint_del(wdata->win, id); } +// TIZEN_ONLY(20160201) : support to handle input rectangle +static void +_ecore_evas_wayland_input_rect_set(Ecore_Evas *ee, Eina_Rectangle *input_rect) +{ + Ecore_Evas_Engine_Wl_Data *wdata; + + if (!ee) return; + wdata = ee->engine.data; + ecore_wl2_window_input_rect_set(wdata->win, input_rect); +} + +static void +_ecore_evas_wayland_input_rect_add(Ecore_Evas *ee, Eina_Rectangle *input_rect) +{ + Ecore_Evas_Engine_Wl_Data *wdata; + + if (!ee) return; + wdata = ee->engine.data; + ecore_wl2_window_input_rect_add(wdata->win, input_rect); +} + +static void +_ecore_evas_wayland_input_rect_subtract(Ecore_Evas *ee, Eina_Rectangle *input_rect) +{ + Ecore_Evas_Engine_Wl_Data *wdata; + + if (!ee) return; + wdata = ee->engine.data; + ecore_wl2_window_input_rect_subtract(wdata->win, input_rect); +} +// + static Ecore_Evas_Interface_Wayland * _ecore_evas_wl_interface_new(void) { @@ -2251,6 +2283,11 @@ _ecore_evas_wl_interface_new(void) iface->aux_hint_add = _ecore_evas_wayland_aux_hint_add; iface->aux_hint_change = _ecore_evas_wayland_aux_hint_change; iface->aux_hint_del = _ecore_evas_wayland_aux_hint_del; + // TIZEN_ONLY(20160201) : support to handle input rectangle + iface->input_rect_set = _ecore_evas_wayland_input_rect_set; + iface->input_rect_add = _ecore_evas_wayland_input_rect_add; + iface->input_rect_subtract = _ecore_evas_wayland_input_rect_subtract; + // return iface; } -- 2.7.4