Skip to content

Commit

Permalink
SDLBackend: Simplify shortcut consuming
Browse files Browse the repository at this point in the history
  • Loading branch information
nullprop committed Jan 14, 2025
1 parent 48fbaad commit 1ccf22e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Backends/SDLBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,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 )
{
Expand All @@ -724,7 +724,7 @@ namespace gamescope
default:
break;
}
if ( handled )
if ( shortcut != GAMESCOPE_SHORTCUT_NONE )
{
break;
}
Expand Down
5 changes: 1 addition & 4 deletions src/shortcut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace gamescope
return GAMESCOPE_SHORTCUT_NONE;
}

bool ShortcutHandler::HandleShortcut( GamescopeShortcut shortcut )
void ShortcutHandler::HandleShortcut( GamescopeShortcut shortcut )
{
switch ( shortcut )
{
Expand Down Expand Up @@ -82,11 +82,8 @@ namespace gamescope
g_bGrabbed = !g_bGrabbed;
break;
default:
return false;
break;
}

return true;
}

static const char* ShortcutNames[GAMESCOPE_SHORTCUT_COUNT] = {
Expand Down
2 changes: 1 addition & 1 deletion src/shortcut.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace gamescope

GamescopeShortcut GetShortcut( uint32_t key );

bool HandleShortcut( GamescopeShortcut shortcut );
void HandleShortcut( GamescopeShortcut shortcut );

private:
std::map<uint32_t, GamescopeShortcut> m_binds;
Expand Down

0 comments on commit 1ccf22e

Please sign in to comment.