shell-global: add a "display" property

and update callers to fetch that rather than doing
"global.screen.get_display()"

https://bugzilla.gnome.org/show_bug.cgi?id=654639
This commit is contained in:
Dan Winship
2011-07-13 12:34:31 -04:00
parent b262a42458
commit aed50e2a39
11 changed files with 35 additions and 22 deletions

View File

@ -93,6 +93,7 @@ enum {
PROP_OVERLAY_GROUP,
PROP_SCREEN,
PROP_GDK_SCREEN,
PROP_DISPLAY,
PROP_SCREEN_WIDTH,
PROP_SCREEN_HEIGHT,
PROP_STAGE,
@ -160,6 +161,9 @@ shell_global_get_property(GObject *object,
case PROP_GDK_SCREEN:
g_value_set_object (value, global->gdk_screen);
break;
case PROP_DISPLAY:
g_value_set_object (value, global->meta_display);
break;
case PROP_SCREEN_WIDTH:
{
int width, height;
@ -364,6 +368,14 @@ shell_global_class_init (ShellGlobalClass *klass)
"Screen height, in pixels",
0, G_MAXINT, 1,
G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
PROP_DISPLAY,
g_param_spec_object ("display",
"Display",
"Metacity display object for the shell",
META_TYPE_DISPLAY,
G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
PROP_STAGE,
g_param_spec_object ("stage",
@ -667,6 +679,17 @@ shell_global_get_gdk_screen (ShellGlobal *global)
return global->gdk_screen;
}
/**
* shell_global_get_display:
*
* Return value: (transfer none): The default #MetaDisplay
*/
MetaDisplay *
shell_global_get_display (ShellGlobal *global)
{
return global->meta_display;
}
/**
* shell_global_get_window_actors:
*

View File

@ -31,6 +31,7 @@ ShellGlobal *shell_global_get (void);
MetaScreen *shell_global_get_screen (ShellGlobal *global);
GdkScreen *shell_global_get_gdk_screen (ShellGlobal *global);
MetaDisplay *shell_global_get_display (ShellGlobal *global);
GList *shell_global_get_window_actors (ShellGlobal *global);
GSettings *shell_global_get_settings (ShellGlobal *global);
guint32 shell_global_get_current_time (ShellGlobal *global);

View File

@ -418,7 +418,7 @@ update_focus_app (ShellWindowTracker *self)
MetaWindow *new_focus_win;
ShellApp *new_focus_app;
new_focus_win = meta_display_get_focus_window (meta_screen_get_display (shell_global_get_screen (shell_global_get ())));
new_focus_win = meta_display_get_focus_window (shell_global_get_display (shell_global_get ()));
new_focus_app = new_focus_win ? shell_window_tracker_get_window_app (self, new_focus_win) : NULL;
set_focus_app (self, new_focus_app);