diff options
author | 2017-01-11 18:32:02 -0500 | |
---|---|---|
committer | 2017-01-11 18:32:02 -0500 | |
commit | 8f8facffe95eefe067b0e7af3a7b07d6c795d0cc (patch) | |
tree | 9c2afc9fa319aefff174e22eb0a9824c64bf9202 | |
parent | 36301281fee21da65f3a7c1eec5ce2a36dbf4e9b (diff) |
UWP: Fix alt key input (nw)
-rw-r--r-- | src/osd/modules/input/input_uwp.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/osd/modules/input/input_uwp.cpp b/src/osd/modules/input/input_uwp.cpp index ece01a41662..2130d000fea 100644 --- a/src/osd/modules/input/input_uwp.cpp +++ b/src/osd/modules/input/input_uwp.cpp @@ -221,6 +221,7 @@ internal: keyboard({{0}}), m_coreWindow(coreWindow) { + coreWindow->Dispatcher->AcceleratorKeyActivated += ref new TypedEventHandler<CoreDispatcher^, AcceleratorKeyEventArgs^>(this, &UwpKeyboardDevice::OnAcceleratorKeyActivated); coreWindow->KeyDown += ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &UwpKeyboardDevice::OnKeyDown); coreWindow->KeyUp += ref new TypedEventHandler<CoreWindow^, KeyEventArgs^>(this, &UwpKeyboardDevice::OnKeyUp); coreWindow->CharacterReceived += ref new TypedEventHandler<CoreWindow^, CharacterReceivedEventArgs^>(this, &UwpKeyboardDevice::OnCharacterReceived); @@ -274,6 +275,20 @@ internal: { this->Machine.ui_input().push_char_event(osd_common_t::s_window_list.front()->target(), args->KeyCode); } + + void OnAcceleratorKeyActivated(CoreDispatcher ^sender, AcceleratorKeyEventArgs ^args) + { + std::lock_guard<std::mutex> scope_lock(m_state_lock); + auto eventType = args->EventType; + if (eventType == CoreAcceleratorKeyEventType::SystemKeyDown || + eventType == CoreAcceleratorKeyEventType::SystemKeyUp) + { + CorePhysicalKeyStatus status = args->KeyStatus; + int discancode = (status.ScanCode & 0x7f) | (status.IsExtendedKey ? 0x80 : 0x00); + keyboard.state[discancode] = + eventType == CoreAcceleratorKeyEventType::SystemKeyDown ? 0x80 : 0; + } + } }; //============================================================ @@ -632,4 +647,3 @@ MODULE_NOT_SUPPORTED(uwp_joystick_module, OSD_JOYSTICKINPUT_PROVIDER, "uwp") MODULE_DEFINITION(KEYBOARDINPUT_UWP, uwp_keyboard_module) MODULE_DEFINITION(JOYSTICKINPUT_UWP, uwp_joystick_module) - |