@@ -25,7 +25,7 @@ WayfireAutohidingWindow::WayfireAutohidingWindow(WayfireOutput *output,
2525
2626 gtk_layer_init_for_window (this ->gobj ());
2727 gtk_layer_set_monitor (this ->gobj (), output->monitor ->gobj ());
28- gtk_layer_set_namespace (this ->gobj (), " $unfocus panel" );
28+ gtk_layer_set_namespace (this ->gobj (), " panel" );
2929
3030 this ->position .set_callback ([=] () { this ->update_position (); });
3131 this ->update_position ();
@@ -379,8 +379,18 @@ void WayfireAutohidingWindow::set_active_popover(WayfireMenuButton& button)
379379 [this , &button] () { unset_active_popover (button); });
380380 }
381381
382- bool should_grab_focus = this ->active_button ->is_keyboard_interactive ();
383- gtk_layer_set_keyboard_interactivity (this ->gobj (), should_grab_focus);
382+ const bool should_grab_focus = this ->active_button ->is_keyboard_interactive ();
383+
384+ if (should_grab_focus)
385+ {
386+ // First, set exclusive mode to grab input
387+ gtk_layer_set_keyboard_mode (this ->gobj (), GTK_LAYER_SHELL_KEYBOARD_MODE_EXCLUSIVE );
388+ wl_surface_commit (get_wl_surface ());
389+
390+ // Next, allow releasing of focus when clicking outside of the panel
391+ gtk_layer_set_keyboard_mode (this ->gobj (), GTK_LAYER_SHELL_KEYBOARD_MODE_ON_DEMAND );
392+ }
393+
384394 this ->active_button ->set_has_focus (should_grab_focus);
385395 schedule_show (0 );
386396}
@@ -398,7 +408,7 @@ void WayfireAutohidingWindow::unset_active_popover(WayfireMenuButton& button)
398408 this ->active_button = nullptr ;
399409 this ->popover_hide .disconnect ();
400410
401- gtk_layer_set_keyboard_interactivity (this ->gobj (), false );
411+ gtk_layer_set_keyboard_mode (this ->gobj (), GTK_LAYER_SHELL_KEYBOARD_MODE_NONE );
402412
403413 if (should_autohide ())
404414 {
0 commit comments