devilhorns pushed a commit to branch master.

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

commit 3999e3996266fd3402e0e2f2ac32af5b58c4cd89
Author: vivek <vivek.el...@samsung.com>
Date:   Mon Sep 8 08:14:38 2014 -0400

    wl_desktop_shell: Added shell_surface_destroy API for destroying all 
surfaces
    
    Summary:
    shell_surface_destroy function is a common destroy function to destroy all 
type of surfaces and to remove redundancy in code
    
    Signed-off-by: vivek <vivek.el...@samsung.com>
    
    Reviewers: devilhorns
    
    Reviewed By: devilhorns
    
    Subscribers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D1421
---
 src/modules/wl_desktop_shell/e_mod_main.c | 54 +++++++++++--------------------
 1 file changed, 19 insertions(+), 35 deletions(-)

diff --git a/src/modules/wl_desktop_shell/e_mod_main.c 
b/src/modules/wl_desktop_shell/e_mod_main.c
index 535e5d2..7438c41 100644
--- a/src/modules/wl_desktop_shell/e_mod_main.c
+++ b/src/modules/wl_desktop_shell/e_mod_main.c
@@ -92,8 +92,8 @@ _e_shell_surface_mouse_down_helper(E_Client *ec, 
E_Binding_Event_Mouse_Button *e
    e_focus_event_mouse_down(ec);
 }
 
-static void 
-_e_shell_surface_cb_destroy(struct wl_resource *resource)
+static void
+_e_shell_surface_destroy(struct wl_resource *resource)
 {
    E_Client *ec;
 
@@ -112,13 +112,26 @@ _e_shell_surface_cb_destroy(struct wl_resource *resource)
                       (ec->comp_data->shell.unmap))
                     ec->comp_data->shell.unmap(ec->comp_data->shell.surface);
                }
-
+             if (ec->parent)
+               {
+                  ec->parent->transients =
+                    eina_list_remove(ec->parent->transients, ec);
+               }
+             wl_resource_destroy(ec->comp_data->shell.surface);
              ec->comp_data->shell.surface = NULL;
           }
      }
 }
 
-static void 
+static void
+_e_shell_surface_cb_destroy(struct wl_resource *resource)
+{
+   /* DBG("Shell Surface Destroy: %d", wl_resource_get_id(resource)); */
+
+   _e_shell_surface_destroy(resource);
+}
+
+static void
 _e_shell_surface_cb_pong(struct wl_client *client EINA_UNUSED, struct 
wl_resource *resource, uint32_t serial EINA_UNUSED)
 {
    E_Client *ec;
@@ -621,17 +634,9 @@ _e_shell_cb_shell_surface_get(struct wl_client *client, 
struct wl_resource *reso
 static void 
 _e_xdg_shell_surface_cb_destroy(struct wl_client *client EINA_UNUSED, struct 
wl_resource *resource)
 {
-   E_Client *ec;
-
    /* DBG("XDG_SHELL: Surface Destroy"); */
 
-   if ((ec = wl_resource_get_user_data(resource)))
-     {
-        /* eina_stringshare_del(ec->icccm.title); */
-        /* eina_stringshare_del(ec->icccm.class); */
-        wl_resource_destroy(ec->comp_data->shell.surface);
-        ec->comp_data->shell.surface = NULL;
-     }
+   _e_shell_surface_destroy(resource);
 }
 
 static void 
@@ -1233,30 +1238,9 @@ _e_xdg_shell_cb_surface_get(struct wl_client *client, 
struct wl_resource *resour
 static void 
 _e_xdg_shell_popup_cb_destroy(struct wl_client *client EINA_UNUSED, struct 
wl_resource *resource)
 {
-   E_Client *ec;
-
    /* DBG("XDG_SHELL: Popup Destroy"); */
-   if ((ec = wl_resource_get_user_data(resource)))
-     {
-        if (ec->comp_data)
-          {
-             if (ec->comp_data->mapped)
-               {
-                  if ((ec->comp_data->shell.surface) && 
-                      (ec->comp_data->shell.unmap))
-                    ec->comp_data->shell.unmap(ec->comp_data->shell.surface);
-               }
-
-             if (ec->parent)
-               {
-                  ec->parent->transients = 
-                    eina_list_remove(ec->parent->transients, ec);
-               }
 
-             wl_resource_destroy(ec->comp_data->shell.surface);
-             ec->comp_data->shell.surface = NULL;
-          }
-     }
+   _e_shell_surface_destroy(resource);
 }
 
 static const struct xdg_popup_interface _e_xdg_popup_interface = 

-- 


Reply via email to