discomfitor pushed a commit to branch enlightenment-0.20. http://git.enlightenment.org/core/enlightenment.git/commit/?id=0565f5aa5b979201097c337d6c54e23864b04021
commit 0565f5aa5b979201097c337d6c54e23864b04021 Author: Mike Blumenkrantz <zm...@osg.samsung.com> Date: Mon Apr 18 15:37:22 2016 -0400 redo wl (xdg)shell surface ping - remove (wrong) global variables which tracked client-specific resources - start ping upon creating a shell surface - track client-specific shell resources on a per-client basis --- src/bin/e_comp_wl.c | 2 -- src/bin/e_comp_wl.h | 6 ----- src/modules/wl_desktop_shell/e_mod_main.c | 40 +++++++++++++++++++++---------- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index 2b610d8..71a850e 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -661,7 +661,6 @@ _e_comp_wl_evas_cb_delete_request(void *data, Evas_Object *obj EINA_UNUSED, void if (!e_client_has_xwindow(ec)) { - if (ec->netwm.ping) e_client_ping(ec); if (ec->internal_elm_win) E_FREE_FUNC(ec->internal_elm_win, evas_object_del); e_object_del(E_OBJECT(ec)); @@ -676,7 +675,6 @@ _e_comp_wl_evas_cb_kill_request(void *data, Evas_Object *obj EINA_UNUSED, void * E_Client *ec; if (!(ec = data)) return; - /* if (ec->netwm.ping) e_client_ping(ec); */ e_comp_ignore_win_del(E_PIXMAP_TYPE_WL, e_pixmap_window_get(ec->pixmap)); diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h index 0819278..d697954 100644 --- a/src/bin/e_comp_wl.h +++ b/src/bin/e_comp_wl.h @@ -137,12 +137,6 @@ struct _E_Comp_Wl_Data struct { - struct wl_resource *shell; - struct wl_resource *xdg_shell; - } shell_interface; - - struct - { Eina_List *resources; Eina_List *focused; Eina_Bool enabled : 1; diff --git a/src/modules/wl_desktop_shell/e_mod_main.c b/src/modules/wl_desktop_shell/e_mod_main.c index f29a936..f5594d2 100644 --- a/src/modules/wl_desktop_shell/e_mod_main.c +++ b/src/modules/wl_desktop_shell/e_mod_main.c @@ -15,6 +15,9 @@ struct E_Shell_Data Eina_Bool activated : 1; }; +static Eina_Hash *shell_resources; +static Eina_Hash *xdg_shell_resources; + static void _e_shell_surface_parent_set(E_Client *ec, struct wl_resource *parent_resource) { @@ -588,6 +591,8 @@ _e_shell_cb_shell_surface_get(struct wl_client *client, struct wl_resource *reso cdata->shell.ping = _e_shell_surface_ping; cdata->shell.map = _e_shell_surface_map; cdata->shell.unmap = _e_shell_surface_unmap; + if (!ec->internal) + e_client_ping(ec); } static void @@ -1013,6 +1018,8 @@ _e_xdg_shell_surface_ping(struct wl_resource *resource) { E_Client *ec; uint32_t serial; + struct wl_client *client; + struct wl_resource *xdg_shell; /* get the client for this resource */ if (!(ec = wl_resource_get_user_data(resource))) @@ -1022,12 +1029,12 @@ _e_xdg_shell_surface_ping(struct wl_resource *resource) "No Client For Shell Surface"); return; } + client = wl_resource_get_client(resource); + xdg_shell = eina_hash_find(xdg_shell_resources, &client); - if (e_comp_wl->shell_interface.xdg_shell) - { - serial = wl_display_next_serial(e_comp_wl->wl.disp); - xdg_shell_send_ping(e_comp_wl->shell_interface.xdg_shell, serial); - } + if (!xdg_shell) return; + serial = wl_display_next_serial(e_comp_wl->wl.disp); + xdg_shell_send_ping(xdg_shell, serial); } static void @@ -1155,6 +1162,8 @@ _e_xdg_shell_cb_surface_get(struct wl_client *client, struct wl_resource *resour if (ec->internal_elm_win && evas_object_visible_get(ec->internal_elm_win)) _e_xdg_shell_surface_map(surface_resource); + if (!ec->internal) + e_client_ping(ec); } static void @@ -1289,9 +1298,10 @@ static const struct xdg_shell_interface _e_xdg_shell_interface = }; static void -_e_xdg_shell_cb_unbind(struct wl_resource *resource EINA_UNUSED) +_e_xdg_shell_cb_unbind(struct wl_resource *resource) { - e_comp_wl->shell_interface.xdg_shell = NULL; + struct wl_client *client = wl_resource_get_client(resource); + eina_hash_set(shell_resources, &client, NULL); } static int @@ -1318,16 +1328,16 @@ _e_xdg_shell_cb_dispatch(const void *implementation EINA_UNUSED, void *target, u } wl_resource_set_implementation(res, &_e_xdg_shell_interface, - e_comp->wl_comp_data, - _e_xdg_shell_cb_unbind); + NULL, _e_xdg_shell_cb_unbind); return 1; } static void -_e_shell_cb_unbind(struct wl_resource *resource EINA_UNUSED) +_e_shell_cb_unbind(struct wl_resource *resource) { - e_comp_wl->shell_interface.shell = NULL; + struct wl_client *client = wl_resource_get_client(resource); + eina_hash_set(shell_resources, &client, NULL); } static void @@ -1341,7 +1351,7 @@ _e_shell_cb_bind(struct wl_client *client, void *data EINA_UNUSED, uint32_t vers return; } - e_comp_wl->shell_interface.shell = res; + eina_hash_set(shell_resources, &client, res); wl_resource_set_implementation(res, &_e_shell_interface, NULL, _e_shell_cb_unbind); } @@ -1357,7 +1367,7 @@ _e_xdg_shell_cb_bind(struct wl_client *client, void *data EINA_UNUSED, uint32_t return; } - e_comp_wl->shell_interface.xdg_shell = res; + eina_hash_set(xdg_shell_resources, &client, res); wl_resource_set_dispatcher(res, _e_xdg_shell_cb_dispatch, NULL, NULL, NULL); } @@ -1392,6 +1402,8 @@ e_modapi_init(E_Module *m) #endif e_startup(); + shell_resources = eina_hash_pointer_new(NULL); + xdg_shell_resources = eina_hash_pointer_new(NULL); return m; } @@ -1400,6 +1412,8 @@ E_API int e_modapi_shutdown(E_Module *m EINA_UNUSED) { e_input_panel_shutdown(); + eina_hash_free(shell_resources); + eina_hash_free(xdg_shell_resources); return 1; } --