From feaaa187462c1089e1be06d4eb2c48164c636ccf Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 9 Nov 2011 04:41:27 +0000 Subject: [PATCH] notifications now display on the correct screen thx to devilhorns and jeffdameth for e internals nonsense SVN revision: 64968 --- src/modules/notification/e_mod_main.h | 1 + src/modules/notification/e_mod_popup.c | 38 +++++++++++++++++++------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/modules/notification/e_mod_main.h b/src/modules/notification/e_mod_main.h index 46d3063a4..e232c730c 100644 --- a/src/modules/notification/e_mod_main.h +++ b/src/modules/notification/e_mod_main.h @@ -117,6 +117,7 @@ struct _Popup_Data const char *app_name; Evas_Object *app_icon; Ecore_Timer *timer; + E_Zone *zone; }; diff --git a/src/modules/notification/e_mod_popup.c b/src/modules/notification/e_mod_popup.c index 89da07c67..5d3579756 100644 --- a/src/modules/notification/e_mod_popup.c +++ b/src/modules/notification/e_mod_popup.c @@ -253,6 +253,9 @@ _notification_popup_new(E_Notification *n) E_Container *con; Popup_Data *popup; char buf[PATH_MAX]; + const Eina_List *l, *screens; + E_Screen *scr; + E_Zone *zone; if (popups_displayed > POPUP_LIMIT) return 0; popup = E_NEW(Popup_Data, 1); @@ -261,9 +264,27 @@ _notification_popup_new(E_Notification *n) popup->notif = n; con = e_container_current_get(e_manager_current_get()); + screens = e_xinerama_screens_get(); + if (notification_cfg->dual_screen && + ((notification_cfg->corner == CORNER_BR) || + (notification_cfg->corner == CORNER_TR))) + l = eina_list_last(screens); + else + l = screens; + if (l) + { + scr = eina_list_data_get(l); + EINA_SAFETY_ON_NULL_GOTO(scr, error); + EINA_LIST_FOREACH(con->zones, l, zone) + if ((int)zone->num == scr->screen) break; + if ((int)zone->num != scr->screen) goto error; + } + else + zone = e_zone_current_get(con); + popup->zone = zone; /* Create the popup window */ - popup->win = e_popup_new(e_zone_current_get(con), 0, 0, 0, 0); + popup->win = e_popup_new(zone, 0, 0, 0, 0); e_popup_edje_bg_object_set(popup->win, popup->theme); popup->e = popup->win->evas; @@ -297,6 +318,10 @@ _notification_popup_new(E_Notification *n) popups_displayed++; return popup; +error: + free(popup); + e_notification_unref(n); + return NULL; } static int @@ -306,16 +331,9 @@ _notification_popup_place(Popup_Data *popup, int w, h, sw, sh; int gap = 10; int to_edge = 15; - E_Container *con; - if (notification_cfg->dual_screen) - { - con = e_container_current_get(e_manager_current_get()); - sw = con->w; - sh = con->h; - } - else - ecore_x_randr_screen_current_size_get(e_manager_current_get()->root, &sw, &sh, NULL, NULL); + sw = popup->zone->w; + sh = popup->zone->h; evas_object_geometry_get(popup->theme, NULL, NULL, &w, &h); /* XXX for now ignore placement requests */