UWP: Use Windows.UI.Core.CoreDispatcher.AcceleratorKeyActivated event for keyboard
Only in this case we can see Left Alt and Right Alt keys. Stole the idea from DirectXTK12 repo: https://github.com/microsoft/DirectXTK12/blob/main/Src/Keyboard.cpp
This commit is contained in:
committed by
Sam Lantinga
parent
309ea2d5f9
commit
9a206adbee
@@ -296,11 +296,8 @@ void SDL_WinRTApp::SetWindow(CoreWindow ^ window)
|
||||
ref new TypedEventHandler<MouseDevice ^, MouseEventArgs ^>(this, &SDL_WinRTApp::OnMouseMoved);
|
||||
#endif
|
||||
|
||||
window->KeyDown +=
|
||||
ref new TypedEventHandler<CoreWindow ^, KeyEventArgs ^>(this, &SDL_WinRTApp::OnKeyDown);
|
||||
|
||||
window->KeyUp +=
|
||||
ref new TypedEventHandler<CoreWindow ^, KeyEventArgs ^>(this, &SDL_WinRTApp::OnKeyUp);
|
||||
window->Dispatcher->AcceleratorKeyActivated +=
|
||||
ref new TypedEventHandler<CoreDispatcher ^, AcceleratorKeyEventArgs ^>(this, &SDL_WinRTApp::OnAcceleratorKeyActivated);
|
||||
|
||||
window->CharacterReceived +=
|
||||
ref new TypedEventHandler<CoreWindow ^, CharacterReceivedEventArgs ^>(this, &SDL_WinRTApp::OnCharacterReceived);
|
||||
@@ -720,14 +717,9 @@ void SDL_WinRTApp::OnMouseMoved(MouseDevice ^ mouseDevice, MouseEventArgs ^ args
|
||||
WINRT_ProcessMouseMovedEvent(WINRT_GlobalSDLWindow, args);
|
||||
}
|
||||
|
||||
void SDL_WinRTApp::OnKeyDown(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::KeyEventArgs ^ args)
|
||||
void SDL_WinRTApp::OnAcceleratorKeyActivated(Windows::UI::Core::CoreDispatcher ^ sender, Windows::UI::Core::AcceleratorKeyEventArgs ^ args)
|
||||
{
|
||||
WINRT_ProcessKeyDownEvent(args);
|
||||
}
|
||||
|
||||
void SDL_WinRTApp::OnKeyUp(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::KeyEventArgs ^ args)
|
||||
{
|
||||
WINRT_ProcessKeyUpEvent(args);
|
||||
WINRT_ProcessAcceleratorKeyActivated(args);
|
||||
}
|
||||
|
||||
void SDL_WinRTApp::OnCharacterReceived(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::CharacterReceivedEventArgs ^ args)
|
||||
|
||||
@@ -71,8 +71,7 @@ ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFramewo
|
||||
void OnPointerEntered(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args);
|
||||
void OnPointerExited(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args);
|
||||
void OnMouseMoved(Windows::Devices::Input::MouseDevice ^ mouseDevice, Windows::Devices::Input::MouseEventArgs ^ args);
|
||||
void OnKeyDown(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::KeyEventArgs ^ args);
|
||||
void OnKeyUp(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::KeyEventArgs ^ args);
|
||||
void OnAcceleratorKeyActivated(Windows::UI::Core::CoreDispatcher ^ sender, Windows::UI::Core::AcceleratorKeyEventArgs ^ args);
|
||||
void OnCharacterReceived(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::CharacterReceivedEventArgs ^ args);
|
||||
|
||||
#if NTDDI_VERSION >= NTDDI_WIN10
|
||||
|
||||
Reference in New Issue
Block a user