shell/global: Expose MetaContext as property

We'll likely have to interact a bit with the newly added Meta.Context
object, so add a convenience property that gives us direct access
instead of getting it from the display every time we need it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1917>
This commit is contained in:
Florian Müllner 2021-07-16 20:58:27 +02:00
parent 733a5e1acb
commit e726527604

View File

@ -20,6 +20,7 @@
#include <gio/gio.h>
#include <girepository.h>
#include <meta/meta-backend.h>
#include <meta/meta-context.h>
#include <meta/display.h>
#include <meta/util.h>
#include <meta/meta-shaped-texture.h>
@ -52,6 +53,7 @@ struct _ShellGlobal {
ClutterStage *stage;
MetaBackend *backend;
MetaContext *meta_context;
MetaDisplay *meta_display;
MetaWorkspaceManager *workspace_manager;
Display *xdisplay;
@ -91,6 +93,7 @@ enum {
PROP_SESSION_MODE,
PROP_BACKEND,
PROP_CONTEXT,
PROP_DISPLAY,
PROP_WORKSPACE_MANAGER,
PROP_SCREEN_WIDTH,
@ -234,6 +237,9 @@ shell_global_get_property(GObject *object,
case PROP_BACKEND:
g_value_set_object (value, global->backend);
break;
case PROP_CONTEXT:
g_value_set_object (value, global->meta_context);
break;
case PROP_DISPLAY:
g_value_set_object (value, global->meta_display);
break;
@ -513,6 +519,13 @@ shell_global_class_init (ShellGlobalClass *klass)
"MetaBackend object",
META_TYPE_BACKEND,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_CONTEXT,
g_param_spec_object ("context",
"Context",
"MetaContext object",
META_TYPE_CONTEXT,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class,
PROP_DISPLAY,
g_param_spec_object ("display",
@ -995,6 +1008,7 @@ _shell_global_set_plugin (ShellGlobal *global,
display = meta_plugin_get_display (plugin);
global->meta_display = display;
global->meta_context = meta_display_get_context (display);
global->workspace_manager = meta_display_get_workspace_manager (display);
global->stage = CLUTTER_STAGE (meta_get_stage_for_display (display));