shell: Specify G_PARAM_EXPLICIT_NOTIFY where appropriate

Like we did in ST, opt out of g_object_set()'s implicit change
notifications, so that notify is only emitted when a property
*actually* changes.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2168>
This commit is contained in:
Florian Müllner 2022-02-09 18:37:44 +01:00 committed by Marge Bot
parent 17719352f3
commit 9a2505f18c
4 changed files with 28 additions and 10 deletions

View File

@ -776,14 +776,14 @@ shell_blur_effect_class_init (ShellBlurEffectClass *klass)
"Sigma",
"Sigma",
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
properties[PROP_BRIGHTNESS] =
g_param_spec_float ("brightness",
"Brightness",
"Brightness",
0.f, 1.f, 1.f,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
properties[PROP_MODE] =
g_param_spec_enum ("mode",
@ -791,7 +791,7 @@ shell_blur_effect_class_init (ShellBlurEffectClass *klass)
"Blur mode",
SHELL_TYPE_BLUR_MODE,
SHELL_BLUR_MODE_ACTOR,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (object_class, N_PROPS, properties);
}

View File

@ -213,10 +213,26 @@ shell_global_set_property(GObject *object,
global->session_mode = g_ascii_strdown (g_value_get_string (value), -1);
break;
case PROP_FRAME_TIMESTAMPS:
global->frame_timestamps = g_value_get_boolean (value);
{
gboolean enable = g_value_get_boolean (value);
if (global->frame_timestamps != enable)
{
global->frame_timestamps = enable;
g_object_notify_by_pspec (object, props[PROP_FRAME_TIMESTAMPS]);
}
}
break;
case PROP_FRAME_FINISH_TIMESTAMP:
global->frame_finish_timestamp = g_value_get_boolean (value);
{
gboolean enable = g_value_get_boolean (value);
if (global->frame_finish_timestamp != enable)
{
global->frame_finish_timestamp = enable;
g_object_notify_by_pspec (object, props[PROP_FRAME_FINISH_TIMESTAMP]);
}
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -609,14 +625,14 @@ shell_global_class_init (ShellGlobalClass *klass)
"Frame Timestamps",
"Whether to log frame timestamps in the performance log",
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
props[PROP_FRAME_FINISH_TIMESTAMP] =
g_param_spec_boolean ("frame-finish-timestamp",
"Frame Finish Timestamps",
"Whether at the end of a frame to call glFinish and log paintCompletedTimestamp",
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
props[PROP_SWITCHEROO_CONTROL] =
g_param_spec_object ("switcheroo-control",

View File

@ -405,7 +405,7 @@ shell_keyring_prompt_class_init (ShellKeyringPromptClass *klass)
"Password actor",
"Text field for password",
CLUTTER_TYPE_TEXT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
/**
* ShellKeyringPrompt:confirm-actor:
@ -417,7 +417,7 @@ shell_keyring_prompt_class_init (ShellKeyringPromptClass *klass)
"Confirm actor",
"Text field for confirming password",
CLUTTER_TYPE_TEXT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (gobject_class, N_PROPS, props);

View File

@ -53,7 +53,8 @@ shell_window_preview_set_property (GObject *gobject,
switch (property_id)
{
case PROP_WINDOW_CONTAINER:
g_set_object (&self->window_container, g_value_get_object (value));
if (g_set_object (&self->window_container, g_value_get_object (value)))
g_object_notify_by_pspec (gobject, obj_props[PROP_WINDOW_CONTAINER]);
break;
default:
@ -169,6 +170,7 @@ shell_window_preview_class_init (ShellWindowPreviewClass *klass)
"window-container",
CLUTTER_TYPE_ACTOR,
G_PARAM_READWRITE |
G_PARAM_EXPLICIT_NOTIFY |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);