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
This commit is contained in:
Gustavo Sverzut Barbieri 2009-06-21 21:18:44 +00:00
parent 248ba9cebc
commit 413729a142
3 changed files with 10 additions and 3 deletions

View 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)
{

View 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);

View 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);