ecore_wl2: add functions for finding window by surface
authorDoyoun Kang <doyoun.kang@samsung.com>
Fri, 10 Nov 2017 01:49:31 +0000 (10:49 +0900)
committerJiyoun Park <jy0703.park@samsung.com>
Tue, 19 Dec 2017 05:13:54 +0000 (14:13 +0900)
- ecore_wl2_window_surface_find
- ecore_wl2_display_window_find_by_surface

Change-Id: I9e3ed6f59b75b6bfeafd82dfd55c66c9872516e8

src/lib/ecore_wl2/Ecore_Wl2.h
src/lib/ecore_wl2/ecore_wl2_display.c
src/lib/ecore_wl2/ecore_wl2_window.c

index 7b7cd12..0ae5fd4 100644 (file)
@@ -827,6 +827,10 @@ EAPI Ecore_Wl2_Input *ecore_wl2_display_input_find_by_name(const Ecore_Wl2_Displ
  */
 EAPI Ecore_Wl2_Window *ecore_wl2_display_window_find(Ecore_Wl2_Display *display, unsigned int id);
 
+// TIZEN_ONLY(20171110)
+EAPI Ecore_Wl2_Window *ecore_wl2_display_window_find_by_surface(Ecore_Wl2_Display *display, struct wl_surface *surface);
+//
+
 /**
  * Retrieves the Wayland Registry used for the current Wayland display.
  *
@@ -994,6 +998,7 @@ EAPI void ecore_wl2_window_resize(Ecore_Wl2_Window *window, Ecore_Wl2_Input *inp
 EAPI void ecore_wl2_window_raise(Ecore_Wl2_Window *window);
 
 // TIZEN_ONLY(20171108): tizen window function
+EAPI Ecore_Wl2_Window *ecore_wl2_window_surface_find(struct wl_surface *surface);
 EAPI void ecore_wl2_window_lower(Ecore_Wl2_Window *window);
 EAPI void ecore_wl2_window_activate(Ecore_Wl2_Window *window);
 EAPI void ecore_wl2_window_parent_set(Ecore_Wl2_Window *window, Ecore_Wl2_Window *parent);
index 7f9e3e0..96c90d5 100644 (file)
@@ -1316,6 +1316,21 @@ ecore_wl2_display_window_find(Ecore_Wl2_Display *display, unsigned int id)
    return NULL;
 }
 
+// TIZEN_ONLY(20171110)
+EAPI Ecore_Wl2_Window *
+ecore_wl2_display_window_find_by_surface(Ecore_Wl2_Display *display, struct wl_surface *surface)
+{
+   Ecore_Wl2_Window *window;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(display, NULL);
+
+   EINA_INLIST_FOREACH(display->windows, window)
+     if (window->surface == surface) return window;
+
+   return NULL;
+}
+//
+
 EAPI struct wl_registry *
 ecore_wl2_display_registry_get(Ecore_Wl2_Display *display)
 {
index a63d8f3..5e62f7a 100644 (file)
@@ -692,6 +692,21 @@ ecore_wl2_window_raise(Ecore_Wl2_Window *window)
 }
 
 // TIZEN_ONLY(20171108): lower window function from ecore_wayland to ecore_wl2
+EAPI Ecore_Wl2_Window *
+ecore_wl2_window_surface_find(struct wl_surface *surface)
+{
+   Ecore_Wl2_Display *ewd;
+   Ecore_Wl2_Window *window;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(surface, NULL);
+
+   ewd = ecore_wl2_connected_display_get(NULL);
+   if (!ewd) return NULL;
+
+   window = ecore_wl2_display_window_find_by_surface(ewd, surface);
+   return window;
+}
+
 EAPI void
 ecore_wl2_window_lower(Ecore_Wl2_Window *window)
 {