Skip to content

Commit

Permalink
fix: Correct control+1/control+2 input in gamescope (Thanks @hhd-dev)
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleGospo committed Jul 19, 2024
1 parent 810b84e commit 6ef9d14
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
11 changes: 6 additions & 5 deletions spec_files/gamescope/gamescope.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Name: gamescope
Version: 100.%{gamescope_tag}
Release: 15.bazzite
Release: 16.bazzite
Summary: Micro-compositor for video games on Wayland

License: BSD
Expand All @@ -19,14 +19,15 @@ Source0: stb.pc
Patch0: chimeraos.patch
# https://hhd.dev/
Patch1: disable-steam-touch-click-atom.patch
Patch2: v2-0001-always-send-ctrl-1-2-to-steam-s-wayland-session.patch
# https://github.com/ValveSoftware/gamescope/pull/1281
Patch2: deckhd.patch
Patch3: deckhd.patch
# https://github.com/ValveSoftware/gamescope/issues/1398
Patch3: drm-Separate-BOE-and-SDC-OLED-Deck-panel-rates.patch
Patch4: drm-Separate-BOE-and-SDC-OLED-Deck-panel-rates.patch
# https://github.com/ValveSoftware/gamescope/issues/1369
Patch4: revert-299bc34.patch
Patch5: revert-299bc34.patch
# https://github.com/ValveSoftware/gamescope/pull/1231
Patch5: 1231.patch
Patch6: 1231.patch

BuildRequires: meson >= 0.54.0
BuildRequires: ninja-build
Expand Down
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

0 comments on commit 6ef9d14

Please sign in to comment.