From 413729a142b519c52479596b9626807ef96fda33 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Sun, 21 Jun 2009 21:18:44 +0000 Subject: [PATCH] get zone from gadcon. The old code that query the zone based on x,y was causing me segfaults. When battery module was in a hidden shelf, the position was outside any zone and then segmentation fault. As far as I understand, gcc->gadcon->zone should always exist and always be correct, but I don't have xinerama setup now to confirm that. If you know this is wrong, let me know! SVN revision: 41147 --- src/bin/e_gadcon.c | 8 ++++++++ src/bin/e_gadcon.h | 1 + src/bin/e_gadcon_popup.c | 4 +--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c index 1dd080b..9e079c4 100644 --- a/src/bin/e_gadcon.c +++ b/src/bin/e_gadcon.c @@ -1249,6 +1249,14 @@ e_gadcon_client_geometry_get(E_Gadcon_Client *gcc, int *x, int *y, int *w, int * return 1; } +EAPI E_Zone * +e_gadcon_client_zone_get(E_Gadcon_Client *gcc) +{ + E_OBJECT_CHECK_RETURN(gcc, NULL); + E_OBJECT_TYPE_CHECK_RETURN(gcc, E_GADCON_CLIENT_TYPE, NULL); + return e_gadcon_zone_get(gcc->gadcon); +} + EAPI void e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu, int flags) { diff --git a/src/bin/e_gadcon.h b/src/bin/e_gadcon.h index e331b0b..2d8ffd9 100644 --- a/src/bin/e_gadcon.h +++ b/src/bin/e_gadcon.h @@ -251,6 +251,7 @@ EAPI void e_gadcon_client_autoscroll_update(E_Gadcon_Client *gcc, in EAPI void e_gadcon_client_autoscroll_cb_set(E_Gadcon_Client *gcc, void (*func)(void *data), void *data); EAPI void e_gadcon_client_resizable_set(E_Gadcon_Client *gcc, int resizable); EAPI int e_gadcon_client_geometry_get(E_Gadcon_Client *gcc, int *x, int *y, int *w, int *h); +EAPI E_Zone *e_gadcon_client_zone_get(E_Gadcon_Client *gcc); EAPI void e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu, int flags); EAPI void e_gadcon_client_util_menu_attach(E_Gadcon_Client *gcc); EAPI void e_gadcon_locked_set(E_Gadcon *gc, int lock); diff --git a/src/bin/e_gadcon_popup.c b/src/bin/e_gadcon_popup.c index 1d075cc..eb50eeb 100644 --- a/src/bin/e_gadcon_popup.c +++ b/src/bin/e_gadcon_popup.c @@ -18,12 +18,10 @@ e_gadcon_popup_new(E_Gadcon_Client *gcc) E_Gadcon_Popup *pop; Evas_Object *o; E_Zone *zone; - Evas_Coord gx, gy; pop = E_OBJECT_ALLOC(E_Gadcon_Popup, E_GADCON_POPUP_TYPE, _e_gadcon_popup_free); if (!pop) return NULL; - e_gadcon_client_geometry_get(gcc, &gx, &gy, NULL, NULL); - zone = e_container_zone_at_point_get(e_container_current_get(e_manager_current_get()), gx, gy); + zone = e_gadcon_client_zone_get(gcc); pop->win = e_popup_new(zone, 0, 0, 0, 0); e_popup_layer_set(pop->win, 255); -- 2.7.4