Switch to using the mutter primary monitor APIs
https://bugzilla.gnome.org/show_bug.cgi?id=609258
This commit is contained in:
parent
fea8b6da2f
commit
079953c3ee
@ -36,7 +36,7 @@ Chrome.prototype = {
|
|||||||
|
|
||||||
this._trackedActors = [];
|
this._trackedActors = [];
|
||||||
|
|
||||||
global.gdk_screen.connect('monitors-changed',
|
global.screen.connect('monitors-changed',
|
||||||
Lang.bind(this, this._monitorsChanged));
|
Lang.bind(this, this._monitorsChanged));
|
||||||
global.screen.connect('restacked',
|
global.screen.connect('restacked',
|
||||||
Lang.bind(this, this._windowsRestacked));
|
Lang.bind(this, this._windowsRestacked));
|
||||||
|
@ -192,7 +192,7 @@ function start() {
|
|||||||
// Attempt to become a PolicyKit authentication agent
|
// Attempt to become a PolicyKit authentication agent
|
||||||
PolkitAuthenticationAgent.init()
|
PolkitAuthenticationAgent.init()
|
||||||
|
|
||||||
global.gdk_screen.connect('monitors-changed', _relayout);
|
global.screen.connect('monitors-changed', _relayout);
|
||||||
|
|
||||||
ExtensionSystem.init();
|
ExtensionSystem.init();
|
||||||
ExtensionSystem.loadExtensions();
|
ExtensionSystem.loadExtensions();
|
||||||
|
@ -1066,7 +1066,7 @@ MessageTray.prototype = {
|
|||||||
Main.chrome.trackActor(this._notificationBin);
|
Main.chrome.trackActor(this._notificationBin);
|
||||||
Main.chrome.trackActor(this._summaryBoxPointer.actor);
|
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();
|
this._setSizePosition();
|
||||||
|
|
||||||
|
@ -1400,44 +1400,12 @@ shell_global_get_monitors (ShellGlobal *global)
|
|||||||
MetaRectangle *
|
MetaRectangle *
|
||||||
shell_global_get_primary_monitor (ShellGlobal *global)
|
shell_global_get_primary_monitor (ShellGlobal *global)
|
||||||
{
|
{
|
||||||
GdkScreen *screen = shell_global_get_gdk_screen (global);
|
MetaScreen *screen = shell_global_get_screen (global);
|
||||||
GdkRectangle gdk_rect;
|
|
||||||
MetaRectangle rect;
|
MetaRectangle rect;
|
||||||
gint primary = 0;
|
gint primary = 0;
|
||||||
|
|
||||||
/* gdk_screen_get_primary_monitor is only present in gtk-2.20+
|
primary = meta_screen_get_primary_monitor (screen);
|
||||||
* and is in a useable state (supports heuristics and fallback modes)
|
meta_screen_get_monitor_geometry (screen, primary, &rect);
|
||||||
* 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;
|
|
||||||
|
|
||||||
return meta_rectangle_copy (&rect);
|
return meta_rectangle_copy (&rect);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user