get zone from gadcon.
authorGustavo Sverzut Barbieri <barbieri@gmail.com>
Sun, 21 Jun 2009 21:18:44 +0000 (21:18 +0000)
committerGustavo Sverzut Barbieri <barbieri@gmail.com>
Sun, 21 Jun 2009 21:18:44 +0000 (21:18 +0000)
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
src/bin/e_gadcon.h
src/bin/e_gadcon_popup.c

index 1dd080b..9e079c4 100644 (file)
@@ -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)
 {
index e331b0b..2d8ffd9 100644 (file)
@@ -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);
index 1d075cc..eb50eeb 100644 (file)
@@ -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);