From 8834afd79e19e196c85e98a54d604f387f0984d1 Mon Sep 17 00:00:00 2001 From: nullprop Date: Tue, 14 Jan 2025 19:19:03 +0200 Subject: [PATCH] SDLBackend: Simplify shortcut consuming --- src/Backends/SDLBackend.cpp | 4 ++-- src/shortcut.cpp | 5 +---- src/shortcut.h | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Backends/SDLBackend.cpp b/src/Backends/SDLBackend.cpp index 9e746db4c..f0f34a6f8 100644 --- a/src/Backends/SDLBackend.cpp +++ b/src/Backends/SDLBackend.cpp @@ -745,7 +745,7 @@ namespace gamescope if ( event.type == SDL_KEYUP && ( event.key.keysym.mod & KMOD_LGUI ) ) { auto shortcut = g_shortcutHandler.GetShortcut( key ); - bool handled = g_shortcutHandler.HandleShortcut( shortcut ); + g_shortcutHandler.HandleShortcut( shortcut ); switch ( shortcut ) { @@ -763,7 +763,7 @@ namespace gamescope default: break; } - if ( handled ) + if ( shortcut != GAMESCOPE_SHORTCUT_NONE ) { break; } diff --git a/src/shortcut.cpp b/src/shortcut.cpp index e7c95fb9d..ddaf69996 100644 --- a/src/shortcut.cpp +++ b/src/shortcut.cpp @@ -51,7 +51,7 @@ namespace gamescope return GAMESCOPE_SHORTCUT_NONE; } - bool ShortcutHandler::HandleShortcut( GamescopeShortcut shortcut ) + void ShortcutHandler::HandleShortcut( GamescopeShortcut shortcut ) { switch ( shortcut ) { @@ -82,11 +82,8 @@ namespace gamescope g_bGrabbed = !g_bGrabbed; break; default: - return false; break; } - - return true; } static const char* ShortcutNames[GAMESCOPE_SHORTCUT_COUNT] = { diff --git a/src/shortcut.h b/src/shortcut.h index f6359dc9e..1a4236405 100644 --- a/src/shortcut.h +++ b/src/shortcut.h @@ -34,7 +34,7 @@ namespace gamescope GamescopeShortcut GetShortcut( uint32_t key ); - bool HandleShortcut( GamescopeShortcut shortcut ); + void HandleShortcut( GamescopeShortcut shortcut ); private: std::map m_binds;