From 1aa4f5aed88d59e3090d26d97e2781dddfe9586f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Bonithon?= <gael@xfce.org> Date: Tue, 31 Dec 2024 16:35:14 +0100 Subject: [PATCH] wayland: libxfce4panel: Set kbd interact to on-demand for popup windows The implementation of the on-demand mode has evolved favorably in both wayfire and labwc, so it no longer seems necessary to use exclusive mode to ensure keyboard focus. As a result, closing the popup window when the focus is lost (by clicking anywhere else) works better. Fixes: #895 --- libxfce4panel/xfce-panel-plugin.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c index 20069c275..3847657fe 100644 --- a/libxfce4panel/xfce-panel-plugin.c +++ b/libxfce4panel/xfce-panel-plugin.c @@ -3042,16 +3042,12 @@ xfce_panel_plugin_popup_window (XfcePanelPlugin *plugin, gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_BOTTOM, FALSE); gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_LEFT, TRUE); gtk_layer_set_anchor (window, GTK_LAYER_SHELL_EDGE_RIGHT, FALSE); + gtk_layer_set_keyboard_mode (GTK_WINDOW (window), GTK_LAYER_SHELL_KEYBOARD_MODE_ON_DEMAND); - /* this ensures, if the compositor implements it correctly, that at least the Esc key will - * hide the window, because the grab below does not always work correctly, even when it - * claims to have succeeded (especially for external plugins) */ - gtk_layer_set_keyboard_mode (GTK_WINDOW (window), GTK_LAYER_SHELL_KEYBOARD_MODE_EXCLUSIVE); - - /* also necessary for the above to work in general since external plugins are on overlay */ + /* necessary to gain keyboard focus in general since external plugins are on overlay */ gtk_layer_set_layer (GTK_WINDOW (window), GTK_LAYER_SHELL_LAYER_OVERLAY); - /* still useful, even in exlusive mode above, for example during an Alt-TAB */ + /* still useful, even we were in exlusive mode above, for example during an Alt-TAB */ g_signal_connect (window, "notify::has-toplevel-focus", G_CALLBACK (xfce_panel_plugin_popup_window_has_toplevel_focus), plugin); } -- GitLab