From 987192c54d1f2b9f8b4bbd883cfff579187b2ee6 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Sat, 6 Jun 2009 23:40:58 +0000 Subject: [PATCH] fix bugs of gadgets using incorrect zones. I found strange behavior in my configuration (xinerama - two screens with two zones). When i select a Enlightenment->Restart from menu the popups for gadgets on desktop doesn't appear or appear wrongly. After some time i've found that this depends on on from what screen i am choosing this enlightenment->restart :) After some debugging i figured it out: When restarting enlightenment some gadgets (i.e. calendar) are calling e_gadgon_popup_new(). Inside that function, zone for popup window (this zone was used later in ecore_evas_move_resize) is calculated like that: {{{ zone = e_util_zone_current_get(e_manager_current_get()); and in e_manager_current_get is: ecore_x_pointer_xy_get() }}} ... so - i have my answer why restaring from one screen (cursor was on that screen) and from second screen i have different results... In other words: during initializing module like calendar - created zone for popup is assigned depending on current cursor position. In my patch i've chage this to obtain zone using the gadget position instead. But it solves the problem partialy. Next thing - in function: e_gadget_popup_show() (which is called later) when calculating popup position coordinates was calculated using zone: {{{ pop->gcc->gadcon->zone }}} which in my case was always the first (initial) zone - (of course it was wrong, because i put a gadgets on different screens for testing). so i changed it to zone of popup window (which was calculated before, in e_gadgon_popup_new()) and after that everythings works ok :) Zones for popups are correctly assigned and popups calculation are also ok - even after restaring enlightenment (tested with cursor on both screens). By: manio SVN revision: 40927 --- src/bin/e_gadcon_popup.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/bin/e_gadcon_popup.c b/src/bin/e_gadcon_popup.c index f8ba4059a..9848008ca 100644 --- a/src/bin/e_gadcon_popup.c +++ b/src/bin/e_gadcon_popup.c @@ -18,10 +18,12 @@ e_gadcon_popup_new(E_Gadcon_Client *gcc, void (*resize_func) (Evas_Object *obj, 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; - zone = e_util_zone_current_get(e_manager_current_get()); + 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); pop->win = e_popup_new(zone, 0, 0, 0, 0); e_popup_layer_set(pop->win, 255); @@ -172,10 +174,10 @@ _e_gadcon_popup_position(E_Gadcon_Popup *pop) /* Popup positioning */ e_gadcon_client_geometry_get(pop->gcc, &gx, &gy, &gw, &gh); - zx = pop->gcc->gadcon->zone->x; - zy = pop->gcc->gadcon->zone->y; - zw = pop->gcc->gadcon->zone->w; - zh = pop->gcc->gadcon->zone->h; + zx = pop->win->zone->x; + zy = pop->win->zone->y; + zw = pop->win->zone->w; + zh = pop->win->zone->h; switch (pop->gcc->gadcon->orient) { case E_GADCON_ORIENT_CORNER_RT: