diff options
| author | Simon Steinbeiss <simon.steinbeiss@elfenbeinturm.at> | 2017-04-07 23:55:18 +0200 |
|---|---|---|
| committer | Simon Steinbeiss <simon.steinbeiss@elfenbeinturm.at> | 2017-04-07 23:55:18 +0200 |
| commit | 18df47092dbe6ec45f13e288356153c5f53d9229 (patch) | |
| tree | 1bbd7831b4dc7ea805f58468034d3f8144348e19 | |
| parent | 1fc7b285b56ad56b33efebdcc582caa367309aa9 (diff) | |
| download | xfce4-panel-18df47092dbe6ec45f13e288356153c5f53d9229.tar.gz | |
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.
| -rw-r--r-- | panel/panel-preferences-dialog.c | 5 | ||||
| -rw-r--r-- | panel/panel-window.c | 14 |
2 files changed, 15 insertions, 4 deletions
diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c index 29d3610..5d5ddfc 100644 --- a/panel/panel-preferences-dialog.c +++ b/panel/panel-preferences-dialog.c @@ -488,8 +488,11 @@ 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); + 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)) { gtk_combo_box_set_active_iter (GTK_COMBO_BOX (object), &iter); 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 |