Avoid wxGetKeyState since it asserts on Linux with wayland GTK

Only modifier keys are allowed, but we used it to test for Escape
This commit is contained in:
Exzap 2023-10-17 13:06:36 +02:00
parent c440ecdf36
commit 66711529be
3 changed files with 6 additions and 2 deletions

View File

@ -191,7 +191,6 @@ int CemuApp::FilterEvent(wxEvent& event)
if(event.GetEventType() == wxEVT_KEY_DOWN)
{
const auto& key_event = (wxKeyEvent&)event;
wxGetKeyState(wxKeyCode::WXK_F17);
g_window_info.set_keystate(fix_raw_keycode(key_event.GetRawKeyCode(), key_event.GetRawKeyFlags()), true);
}
else if(event.GetEventType() == wxEVT_KEY_UP)

View File

@ -41,18 +41,22 @@ enum struct PlatformKeyCodes : uint32
LCONTROL = VK_LCONTROL,
RCONTROL = VK_RCONTROL,
TAB = VK_TAB,
ESCAPE = VK_ESCAPE,
#elif BOOST_OS_LINUX
LCONTROL = GDK_KEY_Control_L,
RCONTROL = GDK_KEY_Control_R,
TAB = GDK_KEY_Tab,
ESCAPE = GDK_KEY_Escape,
#elif BOOST_OS_MACOS
LCONTROL = kVK_Control,
RCONTROL = kVK_RightControl,
TAB = kVK_Tab,
ESCAPE = kVK_Escape,
#else
LCONTROL = 0,
RCONTROL = 0,
TAB = 0,
ESCAPE = 0,
#endif
};

View File

@ -1,3 +1,4 @@
#include "gui/guiWrapper.h"
#include "gui/input/panels/InputPanel.h"
#include <wx/textctrl.h>
@ -26,7 +27,7 @@ void InputPanel::on_timer(const EmulatedControllerPtr& emulated_controller, cons
const auto mapping = reinterpret_cast<uint64>(element->GetClientData());
// reset mapping
if(std::exchange(m_right_down, false) || wxGetKeyState(WXK_ESCAPE))
if(std::exchange(m_right_down, false) || gui_isKeyDown(PlatformKeyCodes::ESCAPE))
{
element->SetBackgroundColour(kKeyColourNormalMode);
m_color_backup[element->GetId()] = kKeyColourNormalMode;