[gnome-flashback] shell: accept connector to restrict OSD to one monitor



commit 49f814a4331084781d7b90a3582214acd97da66b
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Apr 12 13:43:41 2019 +0300

    shell: accept connector to restrict OSD to one monitor

 gnome-flashback/libshell/flashback-osd.c   | 16 +++++++++++-----
 gnome-flashback/libshell/flashback-osd.h   |  9 +++++----
 gnome-flashback/libshell/flashback-shell.c |  2 +-
 3 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/gnome-flashback/libshell/flashback-osd.c b/gnome-flashback/libshell/flashback-osd.c
index cbad3a2..3602261 100644
--- a/gnome-flashback/libshell/flashback-osd.c
+++ b/gnome-flashback/libshell/flashback-osd.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Alberts Muktupāvels
+ * Copyright (C) 2015-2019 Alberts Muktupāvels
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -114,14 +114,16 @@ flashback_osd_new (void)
 }
 
 void
-flashback_osd_show (FlashbackOsd *osd,
-                    GVariant     *params)
+flashback_osd_show (FlashbackOsd     *osd,
+                    GfMonitorManager *monitor_manager,
+                    GVariant         *params)
 {
   GVariantDict dict;
   const gchar *icon_name;
   const gchar *label;
   GIcon *icon;
   gint level;
+  const gchar *connector;
   gint monitor;
   gint i;
 
@@ -136,8 +138,12 @@ flashback_osd_show (FlashbackOsd *osd,
   if (!g_variant_dict_lookup (&dict, "level", "i", &level))
     level = -1;
 
-  if (!g_variant_dict_lookup (&dict, "monitor", "i", &monitor))
-    monitor = -1;
+  if (!g_variant_dict_lookup (&dict, "connector", "&s", &connector))
+    connector = NULL;
+
+  monitor = -1;
+  if (connector != NULL)
+    monitor = gf_monitor_manager_get_monitor_for_connector (monitor_manager, connector);
 
   icon = NULL;
   if (icon_name)
diff --git a/gnome-flashback/libshell/flashback-osd.h b/gnome-flashback/libshell/flashback-osd.h
index ffa3dba..a88e577 100644
--- a/gnome-flashback/libshell/flashback-osd.h
+++ b/gnome-flashback/libshell/flashback-osd.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Alberts Muktupāvels
+ * Copyright (C) 2015-2019 Alberts Muktupāvels
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
 #ifndef FLASHBACK_OSD_H
 #define FLASHBACK_OSD_H
 
-#include <glib-object.h>
+#include "flashback-shell.h"
 
 G_BEGIN_DECLS
 
@@ -27,8 +27,9 @@ G_DECLARE_FINAL_TYPE (FlashbackOsd, flashback_osd, FLASHBACK, OSD, GObject)
 
 FlashbackOsd *flashback_osd_new  (void);
 
-void          flashback_osd_show (FlashbackOsd *osd,
-                                  GVariant     *params);
+void          flashback_osd_show (FlashbackOsd     *osd,
+                                  GfMonitorManager *monitor_manager,
+                                  GVariant         *params);
 
 G_END_DECLS
 
diff --git a/gnome-flashback/libshell/flashback-shell.c b/gnome-flashback/libshell/flashback-shell.c
index 8c5966c..a3eb49b 100644
--- a/gnome-flashback/libshell/flashback-shell.c
+++ b/gnome-flashback/libshell/flashback-shell.c
@@ -215,7 +215,7 @@ handle_show_osd (FlashbackDBusShell    *dbus_shell,
 
   shell = FLASHBACK_SHELL (user_data);
 
-  flashback_osd_show (shell->osd, params);
+  flashback_osd_show (shell->osd, shell->monitor_manager, params);
 
   flashback_dbus_shell_complete_show_osd (dbus_shell, invocation);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]