wlserver: Treat XKB_KEY_XF86PowerOff as a forbidden key

This commit is contained in:
Joshua Ashton 2023-02-04 06:21:00 +00:00
parent b4aff264e4
commit 8a3fa88c7d

View file

@ -214,7 +214,11 @@ static void wlserver_handle_key(struct wl_listener *listener, void *data)
return; return;
} }
if ( ( event->state == WL_KEYBOARD_KEY_STATE_PRESSED || event->state == WL_KEYBOARD_KEY_STATE_RELEASED ) && ( keysym == XKB_KEY_XF86AudioLowerVolume || keysym == XKB_KEY_XF86AudioRaiseVolume ) ) bool forbidden_key =
keysym == XKB_KEY_XF86AudioLowerVolume ||
keysym == XKB_KEY_XF86AudioRaiseVolume ||
keysym == XKB_KEY_XF86PowerOff;
if ( ( event->state == WL_KEYBOARD_KEY_STATE_PRESSED || event->state == WL_KEYBOARD_KEY_STATE_RELEASED ) && forbidden_key )
{ {
// Always send volume+/- to root server only, to avoid it reaching the game. // Always send volume+/- to root server only, to avoid it reaching the game.
struct wlr_surface *old_kb_surf = wlserver.kb_focus_surface; struct wlr_surface *old_kb_surf = wlserver.kb_focus_surface;