mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Fix Shift/Ctrl/Alt key handling on Linux
On native Linux builds, due to weird key modifier handling, key modifiers often worked backwards. Now modifer key handling is streamlined and is not mode-dependent.
This commit is contained in:
@@ -681,6 +681,13 @@ eu07_application::on_key( int const Key, int const Scancode, int const Action, i
|
||||
|
||||
if( m_modestack.empty() ) { return; }
|
||||
|
||||
if (Key == GLFW_KEY_LEFT_SHIFT || Key == GLFW_KEY_RIGHT_SHIFT)
|
||||
Global.shiftState = Action == GLFW_PRESS;
|
||||
if (Key == GLFW_KEY_LEFT_CONTROL || Key == GLFW_KEY_RIGHT_CONTROL)
|
||||
Global.ctrlState = Action == GLFW_PRESS;
|
||||
if (Key == GLFW_KEY_LEFT_ALT || Key == GLFW_KEY_RIGHT_ALT)
|
||||
Global.altState = Action == GLFW_PRESS;
|
||||
|
||||
m_modes[ m_modestack.top() ]->on_key( Key, Scancode, Action, Mods );
|
||||
}
|
||||
|
||||
|
||||
@@ -431,10 +431,6 @@ driver_mode::exit() {
|
||||
void
|
||||
driver_mode::on_key( int const Key, int const Scancode, int const Action, int const Mods ) {
|
||||
|
||||
Global.shiftState = ( Mods & GLFW_MOD_SHIFT ) ? true : false;
|
||||
Global.ctrlState = ( Mods & GLFW_MOD_CONTROL ) ? true : false;
|
||||
Global.altState = ( Mods & GLFW_MOD_ALT ) ? true : false;
|
||||
|
||||
bool anyModifier = Mods & (GLFW_MOD_SHIFT | GLFW_MOD_CONTROL | GLFW_MOD_ALT);
|
||||
|
||||
// give the ui first shot at the input processing...
|
||||
|
||||
@@ -155,10 +155,6 @@ editor_mode::exit() {
|
||||
void
|
||||
editor_mode::on_key( int const Key, int const Scancode, int const Action, int const Mods ) {
|
||||
|
||||
Global.shiftState = ( Mods & GLFW_MOD_SHIFT ) ? true : false;
|
||||
Global.ctrlState = ( Mods & GLFW_MOD_CONTROL ) ? true : false;
|
||||
Global.altState = ( Mods & GLFW_MOD_ALT ) ? true : false;
|
||||
|
||||
bool anyModifier = Mods & (GLFW_MOD_SHIFT | GLFW_MOD_CONTROL | GLFW_MOD_ALT);
|
||||
|
||||
// give the ui first shot at the input processing...
|
||||
|
||||
@@ -36,7 +36,5 @@ void launcher_mode::exit()
|
||||
|
||||
void launcher_mode::on_key(const int Key, const int Scancode, const int Action, const int Mods)
|
||||
{
|
||||
Global.shiftState = ( Mods & GLFW_MOD_SHIFT ) ? true : false;
|
||||
Global.ctrlState = ( Mods & GLFW_MOD_CONTROL ) ? true : false;
|
||||
m_userinterface->on_key(Key, Action);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user