forked from ublue-os/bazzite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Correct control+1/control+2 input in gamescope (Thanks @hhd-dev)
- Loading branch information
Showing
2 changed files
with
46 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
spec_files/gamescope/v2-0001-always-send-ctrl-1-2-to-steam-s-wayland-session.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
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 | ||
|