devilhorns pushed a commit to branch master.

commit 37e2134cf745cc2f5e443508c6769ca9d26f4850
Author: Chris Michael <[email protected]>
Date:   Tue Aug 13 14:49:30 2013 +0100

    Fix crash when trying to move wayland client applications.
    Add callbacks for e_desktop_shell interface functions (cannot be NULL
    anymore).
    When we bind the wl_shell, we will create the e_desktop_shell.
    
    NB: The e_desktop_shell was not being created or bound to the display
    globals.
    
    Signed-off-by: Chris Michael <[email protected]>
---
 src/modules/wl_desktop_shell/e_mod_main.c | 73 +++++++++++++++++++++++++------
 1 file changed, 60 insertions(+), 13 deletions(-)

diff --git a/src/modules/wl_desktop_shell/e_mod_main.c 
b/src/modules/wl_desktop_shell/e_mod_main.c
index b734650..7818d09 100644
--- a/src/modules/wl_desktop_shell/e_mod_main.c
+++ b/src/modules/wl_desktop_shell/e_mod_main.c
@@ -6,8 +6,8 @@
 
 /* shell function prototypes */
 static void _e_wl_shell_cb_destroy(struct wl_listener *listener, void *data 
EINA_UNUSED);
-static void _e_wl_shell_cb_bind(struct wl_client *client, void *data, unsigned 
int version, unsigned int id);
-static void _e_wl_shell_cb_bind_desktop(struct wl_client *client, void *data, 
unsigned int version, unsigned int id);
+static void _e_wl_shell_cb_bind(struct wl_client *client, void *data, unsigned 
int version EINA_UNUSED, unsigned int id);
+static void _e_wl_shell_cb_bind_desktop(struct wl_client *client, void *data, 
unsigned int version EINA_UNUSED, unsigned int id);
 static void _e_wl_shell_cb_ping(E_Wayland_Surface *ews, unsigned int serial);
 static void _e_wl_shell_cb_pointer_focus(struct wl_listener *listener 
EINA_UNUSED, void *data);
 
@@ -22,7 +22,12 @@ static void _e_wl_shell_cb_shell_surface_get(struct 
wl_client *client, struct wl
 static void _e_wl_desktop_shell_cb_unbind(struct wl_resource *resource);
 
 /* desktop shell interface prototypes */
+static void _e_wl_desktop_shell_cb_background_set(struct wl_client *client 
EINA_UNUSED, struct wl_resource *resource EINA_UNUSED, struct wl_resource 
*output_resource EINA_UNUSED, struct wl_resource *surface_resource EINA_UNUSED);
+static void _e_wl_desktop_shell_cb_panel_set(struct wl_client *client 
EINA_UNUSED, struct wl_resource *resource EINA_UNUSED, struct wl_resource 
*output_resource EINA_UNUSED, struct wl_resource *surface_resource EINA_UNUSED);
+static void _e_wl_desktop_shell_cb_lock_surface_set(struct wl_client *client 
EINA_UNUSED, struct wl_resource *resource EINA_UNUSED, struct wl_resource 
*surface_resource EINA_UNUSED);
+static void _e_wl_desktop_shell_cb_unlock(struct wl_client *client 
EINA_UNUSED, struct wl_resource *resource EINA_UNUSED);
 static void _e_wl_desktop_shell_cb_shell_grab_surface_set(struct wl_client 
*client EINA_UNUSED, struct wl_resource *resource, struct wl_resource 
*surface_resource);
+static void _e_wl_desktop_shell_cb_ready(struct wl_client *client EINA_UNUSED, 
struct wl_resource *resource EINA_UNUSED);
 
 /* shell surface function prototypes */
 static E_Wayland_Shell_Surface *_e_wl_shell_shell_surface_create(void *shell, 
E_Wayland_Surface *ews, const void *client EINA_UNUSED);
@@ -97,12 +102,12 @@ static const struct wl_shell_interface _e_shell_interface =
 
 static const struct e_desktop_shell_interface _e_desktop_shell_interface = 
 {
-   NULL, // desktop_background_set,
-   NULL, // desktop_panel_set
-   NULL, // desktop_lock_surface_set
-   NULL, // desktop_unlock
+   _e_wl_desktop_shell_cb_background_set,
+   _e_wl_desktop_shell_cb_panel_set,
+   _e_wl_desktop_shell_cb_lock_surface_set,
+   _e_wl_desktop_shell_cb_unlock,
    _e_wl_desktop_shell_cb_shell_grab_surface_set,
-   NULL // desktop_ready
+   _e_wl_desktop_shell_cb_ready
 };
 
 static const struct wl_shell_surface_interface _e_shell_surface_interface = 
@@ -250,7 +255,7 @@ _e_wl_shell_cb_destroy(struct wl_listener *listener, void 
*data EINA_UNUSED)
 }
 
 static void 
-_e_wl_shell_cb_bind(struct wl_client *client, void *data, unsigned int 
version, unsigned int id)
+_e_wl_shell_cb_bind(struct wl_client *client, void *data, unsigned int version 
EINA_UNUSED, unsigned int id)
 {
    E_Wayland_Desktop_Shell *shell = NULL;
    struct wl_resource *res = NULL;
@@ -261,11 +266,24 @@ _e_wl_shell_cb_bind(struct wl_client *client, void *data, 
unsigned int version,
    /* try to add the shell to the client */
    res = wl_resource_create(client, &wl_shell_interface, 1, id);
    if (res)
-     wl_resource_set_implementation(res, &_e_shell_interface, shell, NULL);
+     {
+        struct wl_resource *dres = NULL;
+
+        wl_resource_set_implementation(res, &_e_shell_interface, shell, NULL);
+
+        dres = wl_resource_create(client, &e_desktop_shell_interface, -1, 0);
+        if (dres)
+          {
+             wl_resource_set_implementation(dres, &_e_desktop_shell_interface, 
+                                            shell, 
_e_wl_desktop_shell_cb_unbind);
+
+             shell->wl.resource = dres;
+          }
+     }
 }
 
 static void 
-_e_wl_shell_cb_bind_desktop(struct wl_client *client, void *data, unsigned int 
version, unsigned int id)
+_e_wl_shell_cb_bind_desktop(struct wl_client *client, void *data, unsigned int 
version EINA_UNUSED, unsigned int id)
 {
    E_Wayland_Desktop_Shell *shell = NULL;
    struct wl_resource *res = NULL;
@@ -274,8 +292,7 @@ _e_wl_shell_cb_bind_desktop(struct wl_client *client, void 
*data, unsigned int v
    if (!(shell = data)) return;
 
    /* try to add the shell to the client */
-   res = wl_resource_create(client, &e_desktop_shell_interface, 
-                            MIN(version, 2), id);
+   res = wl_resource_create(client, &e_desktop_shell_interface, 2, id);
    if (res)
      {
         wl_resource_set_implementation(res, &_e_desktop_shell_interface, 
@@ -379,7 +396,7 @@ _e_wl_shell_grab_start(E_Wayland_Shell_Grab *grab, 
E_Wayland_Shell_Surface *ewss
    /* safety check */
    if ((!grab) || (!ewss)) return;
 
-   shell = ewss->shell;
+   shell = (E_Wayland_Desktop_Shell *)ewss->shell;
 
    /* end any popup grabs */
    _e_wl_shell_popup_grab_end(pointer);
@@ -483,6 +500,30 @@ _e_wl_desktop_shell_cb_unbind(struct wl_resource *resource)
 
 /* desktop shell interface functions */
 static void 
+_e_wl_desktop_shell_cb_background_set(struct wl_client *client EINA_UNUSED, 
struct wl_resource *resource EINA_UNUSED, struct wl_resource *output_resource 
EINA_UNUSED, struct wl_resource *surface_resource EINA_UNUSED)
+{
+
+}
+
+static void 
+_e_wl_desktop_shell_cb_panel_set(struct wl_client *client EINA_UNUSED, struct 
wl_resource *resource EINA_UNUSED, struct wl_resource *output_resource 
EINA_UNUSED, struct wl_resource *surface_resource EINA_UNUSED)
+{
+
+}
+
+static void 
+_e_wl_desktop_shell_cb_lock_surface_set(struct wl_client *client EINA_UNUSED, 
struct wl_resource *resource EINA_UNUSED, struct wl_resource *surface_resource 
EINA_UNUSED)
+{
+
+}
+
+static void 
+_e_wl_desktop_shell_cb_unlock(struct wl_client *client EINA_UNUSED, struct 
wl_resource *resource EINA_UNUSED)
+{
+
+}
+
+static void 
 _e_wl_desktop_shell_cb_shell_grab_surface_set(struct wl_client *client 
EINA_UNUSED, struct wl_resource *resource, struct wl_resource *surface_resource)
 {
    E_Wayland_Desktop_Shell *shell = NULL;
@@ -494,6 +535,12 @@ _e_wl_desktop_shell_cb_shell_grab_surface_set(struct 
wl_client *client EINA_UNUS
    shell->grab_surface = wl_resource_get_user_data(surface_resource);
 }
 
+static void 
+_e_wl_desktop_shell_cb_ready(struct wl_client *client EINA_UNUSED, struct 
wl_resource *resource EINA_UNUSED)
+{
+
+}
+
 /* shell surface functions */
 static E_Wayland_Shell_Surface *
 _e_wl_shell_shell_surface_create(void *shell, E_Wayland_Surface *ews, const 
void *client EINA_UNUSED)

-- 

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk

Reply via email to