Skip to content

Commit

Permalink
NativeApp: minor updates to hot key handling
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Apr 11, 2023
1 parent fb0f127 commit 6ddabbe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 6 additions & 6 deletions NativeApp/include/AppBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@
namespace Diligent
{

/// Flags to handle default hotkeys
/// Hot key handling flags.
enum HOT_KEY_FLAGS : Uint32
{
/// App doesn't react on default hotkeys
/// Disable all hot keys.
HOT_KEY_FLAG_NONE = 0,

/// App will exit by pressing Escape
/// Allow exiting the app on Esc key.
HOT_KEY_FLAG_ALLOW_EXIT_ON_ESC = 1 << 0,

/// App will change fullscreen mode on Shift+Enter (only in UWP)
/// Allow switching between full screen and windowed mode.
HOT_KEY_FLAG_ALLOW_FULL_SCREEN_SWITCH = 1 << 1,

/// Enables all default hotkeys
/// Enable all default hotkeys.
HOT_KEY_FLAG_ALL = ~0u
};
DEFINE_FLAG_ENUM_OPERATORS(HOT_KEY_FLAGS)
Expand Down Expand Up @@ -177,7 +177,7 @@ class AppBase
return false;
}

/// Returns default hotkeys handling flags
/// Returns the hot key handling flags
virtual HOT_KEY_FLAGS GetHotKeyFlags() const
{
return HOT_KEY_FLAG_ALL;
Expand Down
5 changes: 4 additions & 1 deletion NativeApp/src/Linux/LinuxMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,10 @@ int xcb_main(int argc, const char* const* argv)
{
# define KEY_ESCAPE 0x9
case KEY_ESCAPE:
Quit = true;
if ((TheApp->GetHotKeyFlags() & HOT_KEY_FLAG_ALLOW_EXIT_ON_ESC))
{
Quit = true;
}
break;
}
}
Expand Down

0 comments on commit 6ddabbe

Please sign in to comment.