clutter/stage: Warn when setting stage key focus to stage

While the `get_key_focus()` method returned the stage itself when
no explicit focus was set, it made sense for the corresponding
setter to accept the stage as synonym for NULL.

But now that the getter always returns the property value, it
makes more sense to expect NULL to unset the key focus.

Keep the current behavior of normalizing the key focus to NULL
in that case to minimize breakage, but print a warning to
use NULL instead.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4256>
This commit is contained in:
Florian Müllner 2025-02-10 20:56:50 +01:00
parent 897cc303cb
commit 33761eb2af

View File

@ -2110,7 +2110,11 @@ clutter_stage_set_key_focus (ClutterStage *stage,
/* normalize the key focus. NULL == stage */
if (actor == CLUTTER_ACTOR (stage))
actor = NULL;
{
g_warning ("Stage key focus was set to stage itself, "
"unsetting focus instead");
actor = NULL;
}
/* avoid emitting signals and notifications if we're setting the same
* actor as the key focus