[gnome-shell] Switch to using the mutter primary monitor APIs
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Switch to using the mutter primary monitor APIs
- Date: Wed, 16 Mar 2011 19:34:08 +0000 (UTC)
commit 079953c3ee396ca5dccd38e6a36e85c355f3e109
Author: Alexander Larsson <alexl redhat com>
Date: Mon Feb 28 13:50:19 2011 +0100
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 addc9ac..32b8f04 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 3c3763b..2b4c20f 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 c105d4d..5f707d4 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 ab112cc..2d55033 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]