summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Zesch <[email protected]>2013-01-20 13:53:58 -0500
committerSteve Zesch <[email protected]>2013-01-20 13:53:58 -0500
commit193ba3d4a28b7930bf66bf51ca2e9a0ecfc61edf (patch)
tree1beb0a58cc49c7be6f0f3dcdd29b400c3e8a03ab
parent5618708514ac34257e9ba93af96e9ef32a4ad0c2 (diff)
downloadmate-notification-daemon-193ba3d4a28b7930bf66bf51ca2e9a0ecfc61edf.tar.bz2
mate-notification-daemon-193ba3d4a28b7930bf66bf51ca2e9a0ecfc61edf.tar.xz
Backend now supports selecting which monitor to display a notification on.
-rw-r--r--src/daemon/daemon.c18
-rw-r--r--src/daemon/daemon.h2
2 files changed, 17 insertions, 3 deletions
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index a0e1a50..d43c241 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -1511,9 +1511,21 @@ gboolean notify_daemon_notify_handler(NotifyDaemon* daemon, const char* app_name
theme_set_notification_arrow (nw, FALSE, 0, 0);
- gdk_display_get_pointer (gdk_display_get_default (), &screen, &x, &y, NULL);
- screen_num = gdk_screen_get_number (screen);
- monitor_num = gdk_screen_get_monitor_at_point (screen, x, y);
+ // If the "use-active-monitor" gsettings key is set to TRUE, then
+ // get the monitor the pointer is at. Otherwise, get the monitor
+ // number the user has set in gsettings.
+ if (g_settings_get_boolean(daemon->gsettings, GSETTINGS_KEY_USE_ACTIVE))
+ {
+ gdk_display_get_pointer (gdk_display_get_default (), &screen, &x, &y, NULL);
+ screen_num = gdk_screen_get_number (screen);
+ monitor_num = gdk_screen_get_monitor_at_point (screen, x, y);
+ }
+ else
+ {
+ screen = gdk_display_get_default_screen(gdk_display_get_default());
+ screen_num = gdk_screen_get_number(screen);
+ monitor_num = g_settings_get_int(daemon->gsettings, GSETTINGS_KEY_MONITOR_NUMBER);
+ }
if (monitor_num >= priv->screens[screen_num]->n_stacks)
{
diff --git a/src/daemon/daemon.h b/src/daemon/daemon.h
index b405fad..6cbb6b3 100644
--- a/src/daemon/daemon.h
+++ b/src/daemon/daemon.h
@@ -36,6 +36,8 @@
#define GSETTINGS_KEY_POPUP_LOCATION "popup-location"
#define GSETTINGS_KEY_SOUND_ENABLED "sound-enabled"
#define GSETTINGS_KEY_DEFAULT_SOUND "default-sound"
+#define GSETTINGS_KEY_MONITOR_NUMBER "monitor-number"
+#define GSETTINGS_KEY_USE_ACTIVE "use-active-monitor"
#define NOTIFY_TYPE_DAEMON (notify_daemon_get_type())
#define NOTIFY_DAEMON(obj) \