core: Setup and use ownership chains

As with other parts, make objects have the ability to walk up the
ownership chain to the context, to get things like the Wayland
compositor or backend instances.

Contains these squashed commits:

display: Don't get backend from singleton

window: Don't get backend from singleton

keybindings: Don't get backend from singleton

workspace: Don't get backend from singleton

display: Don't get Wayland compositor from singleton

selection: Add display getter

context/main: Get backend directly from the context

clipboard-manager: Don't get display from singleton

stack-tracker: Don't use singleton MetaLater API

startup-notification: Hook up sequences and activations to display

This allows using context aware API directly.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2718>
This commit is contained in:
Jonas Ådahl
2022-05-27 22:27:07 +02:00
committed by Robert Mader
parent 0e8aaebc00
commit dd2beae6a8
18 changed files with 243 additions and 97 deletions

View File

@ -49,6 +49,7 @@ enum
enum
{
PROP_SEQ_0,
PROP_SEQ_DISPLAY,
PROP_SEQ_ID,
PROP_SEQ_TIMESTAMP,
PROP_SEQ_ICON_NAME,
@ -93,7 +94,10 @@ struct _MetaStartupNotification
guint startup_sequence_timeout_id;
};
typedef struct {
typedef struct
{
MetaDisplay *display;
char *wmclass;
char *name;
char *application_id;
@ -183,6 +187,9 @@ meta_startup_sequence_set_property (GObject *object,
switch (prop_id)
{
case PROP_SEQ_DISPLAY:
priv->display = g_value_get_object (value);
break;
case PROP_SEQ_ID:
priv->id = g_value_dup_string (value);
break;
@ -224,6 +231,9 @@ meta_startup_sequence_get_property (GObject *object,
switch (prop_id)
{
case PROP_SEQ_DISPLAY:
g_value_set_object (value, priv->display);
break;
case PROP_SEQ_ID:
g_value_set_string (value, priv->id);
break;
@ -275,6 +285,13 @@ meta_startup_sequence_class_init (MetaStartupSequenceClass *klass)
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
seq_props[PROP_SEQ_DISPLAY] =
g_param_spec_object ("display",
"Display",
"Display",
META_TYPE_DISPLAY,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
seq_props[PROP_SEQ_ID] =
g_param_spec_string ("id",
"ID",
@ -455,6 +472,17 @@ meta_startup_sequence_get_wmclass (MetaStartupSequence *seq)
return priv->wmclass;
}
MetaDisplay *
meta_startup_sequence_get_display (MetaStartupSequence *seq)
{
MetaStartupSequencePrivate *priv;
g_return_val_if_fail (META_IS_STARTUP_SEQUENCE (seq), NULL);
priv = meta_startup_sequence_get_instance_private (seq);
return priv->display;
}
static void
on_sequence_completed (MetaStartupSequence *seq,
MetaStartupNotification *sn)