devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=f5741f1cb4878889915e26d3c0324e2d7201dd6f

commit f5741f1cb4878889915e26d3c0324e2d7201dd6f
Author: Chris Michael <cp.mich...@samsung.com>
Date:   Mon Dec 7 09:46:11 2015 -0500

    Fix using global ewd variable by making it part of e_comp_wl
    
    ref T2919
    
    Signed-off-by: Chris Michael <cp.mich...@samsung.com>
---
 src/bin/e_comp_wl.c                     | 11 +++++------
 src/bin/e_comp_wl.h                     |  4 ++--
 src/bin/e_grabinput.c                   | 26 +++++++++++++++++---------
 src/modules/wl_weekeyboard/e_mod_main.c |  6 +++---
 4 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c
index 068d8d6..06e886a 100644
--- a/src/bin/e_comp_wl.c
+++ b/src/bin/e_comp_wl.c
@@ -9,7 +9,6 @@
 #define COMPOSITOR_VERSION 3
 
 E_API int E_EVENT_WAYLAND_GLOBAL_ADD = -1;
-E_API Ecore_Wl2_Display *ewd = NULL;
 
 #include "session-recovery-server-protocol.h"
 
@@ -2466,15 +2465,15 @@ _e_comp_wl_compositor_create(void)
    /* wl_log_set_handler_server(_e_comp_wl_log_cb_print); */
 
    /* try to create an ecore_wl2 display */
-   ewd = ecore_wl2_display_create(NULL);
-   if (!ewd)
+   cdata->ewd = ecore_wl2_display_create(NULL);
+   if (!cdata->ewd)
      {
         ERR("Could not create a Wayland display: %m");
         free(cdata);
         return EINA_FALSE;
      }
 
-   cdata->wl.disp = ecore_wl2_display_get(ewd);
+   cdata->wl.disp = ecore_wl2_display_get(cdata->ewd);
    if (!cdata->wl.disp)
      {
         ERR("Could not create a Wayland display: %m");
@@ -2602,7 +2601,7 @@ data_err:
 comp_global_err:
    /* e_env_unset("WAYLAND_DISPLAY"); */
 /* sock_err: */
-   ecore_wl2_display_destroy(ewd);
+   ecore_wl2_display_destroy(cdata->ewd);
 disp_err:
    free(cdata);
    return EINA_FALSE;
@@ -2764,7 +2763,7 @@ e_comp_wl_shutdown(void)
    if (e_comp_wl->wl.shm) wl_shm_destroy(e_comp_wl->wl.shm);
    _e_comp_wl_gl_shutdown();
 
-   ecore_wl2_display_destroy(ewd);
+   ecore_wl2_display_destroy(e_comp_wl->ewd);
 
    /* shutdown ecore_wayland */
    ecore_wl2_shutdown();
diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h
index e60ae9e..814d061 100644
--- a/src/bin/e_comp_wl.h
+++ b/src/bin/e_comp_wl.h
@@ -98,6 +98,8 @@ struct _E_Comp_Wl_Subsurf_Data
 
 struct _E_Comp_Wl_Data
 {
+   Ecore_Wl2_Display *ewd;
+
    struct
      {
         struct wl_display *disp;
@@ -341,8 +343,6 @@ E_API Eina_Bool e_comp_wl_evas_handle_mouse_button(E_Client 
*ec, uint32_t timest
 
 E_API extern int E_EVENT_WAYLAND_GLOBAL_ADD;
 
-E_API extern Ecore_Wl2_Display *ewd;
-
 # ifndef HAVE_WAYLAND_ONLY
 EINTERN void e_comp_wl_xwayland_client_queue(E_Client *ec);
 static inline E_Comp_X_Client_Data *
diff --git a/src/bin/e_grabinput.c b/src/bin/e_grabinput.c
index fdc8647..ff764f1 100644
--- a/src/bin/e_grabinput.c
+++ b/src/bin/e_grabinput.c
@@ -40,7 +40,9 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, 
Ecore_Window key_win)
           {
              Ecore_Wl2_Window *wl_win;
 
-             if ((wl_win = ecore_wl2_display_window_find(ewd, grab_mouse_win)))
+             wl_win =
+               ecore_wl2_display_window_find(e_comp_wl->ewd, grab_mouse_win);
+             if (wl_win)
                ecore_wl2_input_ungrab(ecore_wl2_window_input_get(wl_win),
                                       wl_win, 0);
           }
@@ -58,7 +60,9 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, 
Ecore_Window key_win)
           {
              Ecore_Wl2_Window *wl_win;
 
-             if ((wl_win = ecore_wl2_display_window_find(ewd, grab_key_win)))
+             wl_win =
+               ecore_wl2_display_window_find(e_comp_wl->ewd, grab_key_win);
+             if (wl_win)
                ecore_wl2_input_ungrab(ecore_wl2_window_input_get(wl_win),
                                       wl_win, 0);
           }
@@ -84,7 +88,8 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, 
Ecore_Window key_win)
           {
              Ecore_Wl2_Window *wl_win;
 
-             if ((wl_win = ecore_wl2_display_window_find(ewd, mouse_win)))
+             wl_win = ecore_wl2_display_window_find(e_comp_wl->ewd, mouse_win);
+             if (wl_win)
                ecore_wl2_input_grab(ecore_wl2_window_input_get(wl_win),
                                     wl_win, 0);
           }
@@ -114,7 +119,8 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, 
Ecore_Window key_win)
           {
              Ecore_Wl2_Window *wl_win;
 
-             if ((wl_win = ecore_wl2_display_window_find(key_win)))
+             wl_win = ecore_wl2_display_window_find(e_comp_wl->ewd, key_win);
+             if (wl_win)
                ecore_wl2_input_grab(ecore_wl2_window_input_get(wl_win),
                                     wl_win, 0);
           }
@@ -140,7 +146,8 @@ e_grabinput_release(Ecore_Window mouse_win, Ecore_Window 
key_win)
           {
              Ecore_Wl2_Window *wl_win;
 
-             if ((wl_win = ecore_wl2_display_window_find(ewd, mouse_win)))
+             wl_win = ecore_wl2_display_window_find(e_comp_wl->ewd, mouse_win);
+             if (wl_win)
                ecore_wl2_input_ungrab(ecore_wl2_window_input_get(wl_win),
                                       wl_win, 0);
           }
@@ -158,7 +165,8 @@ e_grabinput_release(Ecore_Window mouse_win, Ecore_Window 
key_win)
           {
              Ecore_Wl2_Window *wl_win;
 
-             if ((wl_win = ecore_wl2_display_window_find(key_win)))
+             wl_win = ecore_wl2_display_window_find(e_comp_wl->ewd, key_win);
+             if (wl_win)
                ecore_wl2_input_grab(ecore_wl2_window_input_get(wl_win),
                                     wl_win, 0);
           }
@@ -239,7 +247,7 @@ _e_grabinput_focus_do(Ecore_Window win, E_Focus_Method 
method)
 #ifdef HAVE_WAYLAND
         if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
           {
-             if ((wl_win = ecore_wl2_display_window_find(ewd, win)))
+             if ((wl_win = ecore_wl2_display_window_find(e_comp_wl->ewd, win)))
                {
                   /* FIXME: Need to add an ecore_wl_window_focus function */
                }
@@ -254,7 +262,7 @@ _e_grabinput_focus_do(Ecore_Window win, E_Focus_Method 
method)
 #else
         if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
           {
-             if ((wl_win = ecore_wl2_display_window_find(ewd, win)))
+             if ((wl_win = ecore_wl2_display_window_find(e_comp_wl->ewd, win)))
                {
                   /* FIXME: Need to add an ecore_wl_window_focus function */
                }
@@ -269,7 +277,7 @@ _e_grabinput_focus_do(Ecore_Window win, E_Focus_Method 
method)
 #else
         if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
           {
-             if ((wl_win = ecore_wl2_display_window_find(ewd, win)))
+             if ((wl_win = ecore_wl2_display_window_find(e_comp_wl->ewd, win)))
                {
                   /* FIXME: Need to add an ecore_wl_window_focus function */
                }
diff --git a/src/modules/wl_weekeyboard/e_mod_main.c 
b/src/modules/wl_weekeyboard/e_mod_main.c
index 060a5a7..5a45aea 100644
--- a/src/modules/wl_weekeyboard/e_mod_main.c
+++ b/src/modules/wl_weekeyboard/e_mod_main.c
@@ -250,7 +250,7 @@ _wkb_ui_setup(struct weekeyboard *wkb)
 
    if (eina_streq(wkb->theme, "default"))
      {
-        ecore_wl2_display_screen_size_get(ewd, &w, &h);
+        ecore_wl2_display_screen_size_get(e_comp_wl->ewd, &w, &h);
         DBG("Screen size: w=%d, h=%d", w, h);
         if (w >= 1080)
           w = 1080;
@@ -507,8 +507,8 @@ _wkb_setup(struct weekeyboard *wkb)
    struct wl_input_panel_surface *ips;
    void *data;
 
-   registry = e_comp_wl->wl.registry ?: ecore_wl2_display_registry_get(ewd);
-   itr = ecore_wl2_display_globals_get(ewd);
+   registry = e_comp_wl->wl.registry ?: 
ecore_wl2_display_registry_get(e_comp_wl->ewd);
+   itr = ecore_wl2_display_globals_get(e_comp_wl->ewd);
    EINA_ITERATOR_FOREACH(itr, data)
      {
         global = (Ecore_Wl2_Global *)data;

-- 


Reply via email to