[Xfce4-commits] [xfce/xfce4-panel] 01/01: Add support for XRandR's primary monitor feature (Bug #9338)

noreply at xfce.org noreply at xfce.org
Mon Oct 9 21:32:53 CEST 2017


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       x   f   c   e   -   4   .   1   2   
   in repository xfce/xfce4-panel.

commit cc453ea2402167d48ddff8da75fd026e3c2dc26e
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Fri Apr 7 23:55:18 2017 +0200

    Add support for XRandR's primary monitor feature (Bug #9338)
    
    If there is no output name set in xfconf it behaves like before,
    i.e. "Automatic" mode.
    However if the driver does not return a monitor name it now falls
    back to the primary display.
---
 panel/panel-preferences-dialog.c | 15 ++++++++++++---
 panel/panel-window.c             | 14 +++++++++++---
 2 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c
index 29d3610..584b1e8 100644
--- a/panel/panel-preferences-dialog.c
+++ b/panel/panel-preferences-dialog.c
@@ -488,11 +488,20 @@ panel_preferences_dialog_bindings_update (PanelPreferencesDialog *dialog)
       || !exo_str_is_empty (output_name))
     {
       gtk_list_store_insert_with_values (GTK_LIST_STORE (store), &iter, n++,
-                                         OUTPUT_NAME, NULL,
+                                         OUTPUT_NAME, "Automatic",
                                          OUTPUT_TITLE, _("Automatic"), -1);
-      if (exo_str_is_empty (output_name))
+      if (g_strcmp0 (output_name, "Automatic") == 0) {
+        gtk_combo_box_set_active_iter (GTK_COMBO_BOX (object), &iter);
+        output_selected = TRUE;
+        span_monitors_sensitive = TRUE;
+      }
+      gtk_list_store_insert_with_values (GTK_LIST_STORE (store), &iter, n++,
+                                         OUTPUT_NAME, "Primary",
+                                         OUTPUT_TITLE, _("Primary"), -1);
+      if (exo_str_is_empty (output_name) ||
+          g_strcmp0 (output_name, "Primary") == 0)
         {
-          gtk_combo_box_set_active_iter  (GTK_COMBO_BOX (object), &iter);
+          gtk_combo_box_set_active_iter (GTK_COMBO_BOX (object), &iter);
           output_selected = TRUE;
           span_monitors_sensitive = TRUE;
         }
diff --git a/panel/panel-window.c b/panel/panel-window.c
index c21aac3..561cd08 100644
--- a/panel/panel-window.c
+++ b/panel/panel-window.c
@@ -2009,16 +2009,24 @@ panel_window_screen_layout_changed (GdkScreen   *screen,
     }
   else
     {
-      if (exo_str_is_empty (window->output_name))
+      if (g_strcmp0 (window->output_name, "Automatic") == 0
+          || window->output_name == NULL)
         {
-          normal_monitor_positioning:
-
           /* get the monitor geometry based on the panel position */
           monitor_num = gdk_screen_get_monitor_at_point (screen, window->base_x,
                                                          window->base_y);
           gdk_screen_get_monitor_geometry (screen, monitor_num, &a);
           panel_return_if_fail (a.width > 0 && a.height > 0);
         }
+      else if (g_strcmp0 (window->output_name, "Primary") == 0)
+        {
+          normal_monitor_positioning:
+          /* get the primary monitor */
+          monitor_num = gdk_screen_get_primary_monitor (screen);
+
+          gdk_screen_get_monitor_geometry (screen, monitor_num, &a);
+          panel_return_if_fail (a.width > 0 && a.height > 0);
+        }
       else
         {
           /* check if we've stored the monitor number in the config or

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list