40 lines
1.8 KiB
Diff
40 lines
1.8 KiB
Diff
From 35e001dc59a44227d670c667a85a6ef5472eee58 Mon Sep 17 00:00:00 2001
|
|
From: antheas <git@antheas.dev>
|
|
Date: Sat, 20 Jul 2024 01:23:19 +0300
|
|
Subject: [PATCH v2] always send ctrl+1/2 to steam's wayland session
|
|
|
|
---
|
|
src/wlserver.cpp | 10 +++++++++-
|
|
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/wlserver.cpp b/src/wlserver.cpp
|
|
index 1852be9..7de737d 100644
|
|
--- a/src/wlserver.cpp
|
|
+++ b/src/wlserver.cpp
|
|
@@ -369,7 +369,12 @@ static void wlserver_handle_key(struct wl_listener *listener, void *data)
|
|
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 )
|
|
+
|
|
+ // Check for steam keys (ctrl + 1/2)
|
|
+ bool is_steamshortcut = (keyboard->wlr->modifiers.depressed & WLR_MODIFIER_CTRL) && (keysym == XKB_KEY_1 ||
|
|
+ keysym == XKB_KEY_2);
|
|
+
|
|
+ if ( ( event->state == WL_KEYBOARD_KEY_STATE_PRESSED || event->state == WL_KEYBOARD_KEY_STATE_RELEASED ) && (forbidden_key || is_steamshortcut) )
|
|
{
|
|
// Always send volume+/- to root server only, to avoid it reaching the game.
|
|
struct wlr_surface *old_kb_surf = wlserver.kb_focus_surface;
|
|
@@ -378,6 +383,9 @@ static void wlserver_handle_key(struct wl_listener *listener, void *data)
|
|
{
|
|
wlserver_keyboardfocus( new_kb_surf, false );
|
|
wlr_seat_set_keyboard( wlserver.wlr.seat, keyboard->wlr );
|
|
+ // Send modifiers to steam for it to work
|
|
+ if (is_steamshortcut)
|
|
+ wlr_seat_keyboard_notify_modifiers(wlserver.wlr.seat, &keyboard->wlr->modifiers);
|
|
wlr_seat_keyboard_notify_key( wlserver.wlr.seat, event->time_msec, event->keycode, event->state );
|
|
wlserver_keyboardfocus( old_kb_surf, false );
|
|
return;
|
|
--
|
|
2.45.2
|