From 079953c3ee396ca5dccd38e6a36e85c355f3e109 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 28 Feb 2011 13:50:19 +0100 Subject: [PATCH] Switch to using the mutter primary monitor APIs https://bugzilla.gnome.org/show_bug.cgi?id=609258 --- js/ui/chrome.js | 4 ++-- js/ui/main.js | 2 +- js/ui/messageTray.js | 2 +- src/shell-global.c | 38 +++----------------------------------- 4 files changed, 7 insertions(+), 39 deletions(-) diff --git a/js/ui/chrome.js b/js/ui/chrome.js index addc9ac7d..32b8f04f4 100644 --- a/js/ui/chrome.js +++ b/js/ui/chrome.js @@ -36,8 +36,8 @@ Chrome.prototype = { this._trackedActors = []; - global.gdk_screen.connect('monitors-changed', - Lang.bind(this, this._monitorsChanged)); + global.screen.connect('monitors-changed', + Lang.bind(this, this._monitorsChanged)); global.screen.connect('restacked', Lang.bind(this, this._windowsRestacked)); diff --git a/js/ui/main.js b/js/ui/main.js index 3c3763bfb..2b4c20f46 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -192,7 +192,7 @@ function start() { // Attempt to become a PolicyKit authentication agent PolkitAuthenticationAgent.init() - global.gdk_screen.connect('monitors-changed', _relayout); + global.screen.connect('monitors-changed', _relayout); ExtensionSystem.init(); ExtensionSystem.loadExtensions(); diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index c105d4df6..5f707d400 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -1066,7 +1066,7 @@ MessageTray.prototype = { Main.chrome.trackActor(this._notificationBin); Main.chrome.trackActor(this._summaryBoxPointer.actor); - global.gdk_screen.connect('monitors-changed', Lang.bind(this, this._setSizePosition)); + global.screen.connect('monitors-changed', Lang.bind(this, this._setSizePosition)); this._setSizePosition(); diff --git a/src/shell-global.c b/src/shell-global.c index ab112cc0f..2d55033fa 100644 --- a/src/shell-global.c +++ b/src/shell-global.c @@ -1400,44 +1400,12 @@ shell_global_get_monitors (ShellGlobal *global) MetaRectangle * shell_global_get_primary_monitor (ShellGlobal *global) { - GdkScreen *screen = shell_global_get_gdk_screen (global); - GdkRectangle gdk_rect; + MetaScreen *screen = shell_global_get_screen (global); MetaRectangle rect; gint primary = 0; - /* gdk_screen_get_primary_monitor is only present in gtk-2.20+ - * and is in a useable state (supports heuristics and fallback modes) - * starting with 2.20.1 - */ -#if !GTK_CHECK_VERSION (2, 20, 1) - gint i; - gchar *output_name = NULL; - gint num_monitors = gdk_screen_get_n_monitors (screen); - - for (i = 0; i < num_monitors; i++) - { - /* Prefer the laptop's internal screen if present */ - output_name = gdk_screen_get_monitor_plug_name (screen, i); - if (output_name) - { - gboolean is_lvds = g_ascii_strncasecmp (output_name, "LVDS", 4) == 0; - g_free (output_name); - if (is_lvds) - { - primary = i; - break; - } - } - } -#else - primary = gdk_screen_get_primary_monitor (screen); -#endif - - gdk_screen_get_monitor_geometry (screen, primary, &gdk_rect); - rect.x = gdk_rect.x; - rect.y = gdk_rect.y; - rect.width = gdk_rect.width; - rect.height = gdk_rect.height; + primary = meta_screen_get_primary_monitor (screen); + meta_screen_get_monitor_geometry (screen, primary, &rect); return meta_rectangle_copy (&rect); }