From 33761eb2afd165c7ccd48c3f4a385e598775d366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 10 Feb 2025 20:56:50 +0100 Subject: [PATCH] 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: --- clutter/clutter/clutter-stage.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c index a09dab3ba..074f5fe4d 100644 --- a/clutter/clutter/clutter-stage.c +++ b/clutter/clutter/clutter-stage.c @@ -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