mirror of
https://github.com/brl/mutter.git
synced 2024-12-27 21:32:14 +00:00
stage: Mark stage as active on wayland when it has key-focus
The "activate" and "deactivate" signals on ClutterStage are used by Cally to track the key-focus when the user is interacting with shell UI. key-focus only gets tracked while the stage is activated. Wayland has no concept of the stage receiving focus or not, so right now the activation state is bound to whether there's a focus_window in meta_display_sync_wayland_input_focus(). Since display->focus_window is set pretty much all the time, this effectively binds activation state to whether the stage holds a grab or not. This is almost good enough, but it misses cases where key-focus is on the stage without a grab, for example when keyboard-navigating the panel after using Ctrl+Alt+Tab. It seems to make more sense to bind the activation state to whether key-focus is set to an actor or to NULL, so let's do that instead. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2329>
This commit is contained in:
parent
ed516dde89
commit
84396baafb
@ -331,6 +331,22 @@ meta_stage_class_init (MetaStageClass *klass)
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
key_focus_actor_changed (ClutterStage *stage,
|
||||
GParamSpec *param,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterActor *key_focus = clutter_stage_get_key_focus (stage);
|
||||
|
||||
/* If there's no explicit key focus, clutter_stage_get_key_focus()
|
||||
* returns the stage.
|
||||
*/
|
||||
if (key_focus == CLUTTER_ACTOR (stage))
|
||||
key_focus = NULL;
|
||||
|
||||
meta_stage_set_active (META_STAGE (stage), key_focus != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_stage_init (MetaStage *stage)
|
||||
{
|
||||
@ -338,6 +354,13 @@ meta_stage_init (MetaStage *stage)
|
||||
|
||||
for (i = 0; i < N_WATCH_MODES; i++)
|
||||
stage->watchers[i] = g_ptr_array_new_with_free_func (g_free);
|
||||
|
||||
if (meta_is_wayland_compositor ())
|
||||
{
|
||||
g_signal_connect (stage,
|
||||
"notify::key-focus",
|
||||
G_CALLBACK (key_focus_actor_changed), NULL);
|
||||
}
|
||||
}
|
||||
|
||||
ClutterActor *
|
||||
|
@ -1443,7 +1443,6 @@ meta_display_sync_wayland_input_focus (MetaDisplay *display)
|
||||
else
|
||||
meta_topic (META_DEBUG_FOCUS, "Focus change has no effect, because there is no matching wayland surface");
|
||||
|
||||
meta_stage_set_active (stage, focus_window == NULL);
|
||||
meta_wayland_compositor_set_input_focus (compositor, focus_window);
|
||||
|
||||
clutter_stage_repick_device (CLUTTER_STAGE (stage),
|
||||
|
Loading…
Reference in New Issue
Block a user