mirror of https://github.com/stella-emu/stella.git
fixed problem with QWERTZ keys
This commit is contained in:
parent
a7eb6d2696
commit
6b46f85fc9
|
@ -38,7 +38,7 @@ class EventHandlerSDL2 : public EventHandler
|
||||||
explicit EventHandlerSDL2(OSystem& osystem);
|
explicit EventHandlerSDL2(OSystem& osystem);
|
||||||
~EventHandlerSDL2() override;
|
~EventHandlerSDL2() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
Enable/disable text events (distinct from single-key events).
|
Enable/disable text events (distinct from single-key events).
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -102,6 +102,15 @@ void PhysicalKeyboardHandler::setDefaultKey(EventMapping map, Event::Type event,
|
||||||
// Otherwise, only reset the given event
|
// Otherwise, only reset the given event
|
||||||
bool eraseAll = !updateDefaults && (event == Event::NoType);
|
bool eraseAll = !updateDefaults && (event == Event::NoType);
|
||||||
|
|
||||||
|
// Swap Y and Z for QWERTZ keyboards
|
||||||
|
if(mode == EventMode::kEditMode && myHandler.isQwertz())
|
||||||
|
{
|
||||||
|
if(map.key == KBDK_Z)
|
||||||
|
map.key = KBDK_Y;
|
||||||
|
else if(map.key == KBDK_Y)
|
||||||
|
map.key = KBDK_Z;
|
||||||
|
}
|
||||||
|
|
||||||
if (updateDefaults)
|
if (updateDefaults)
|
||||||
{
|
{
|
||||||
// if there is no existing mapping for the event and
|
// if there is no existing mapping for the event and
|
||||||
|
@ -678,7 +687,7 @@ PhysicalKeyboardHandler::EventMappingArray PhysicalKeyboardHandler::FixedEditMap
|
||||||
{Event::Delete, KBDK_DELETE},
|
{Event::Delete, KBDK_DELETE},
|
||||||
{Event::DeleteChar, KBDK_D, KBDM_CTRL},
|
{Event::DeleteChar, KBDK_D, KBDM_CTRL},
|
||||||
{Event::DeleteWord, KBDK_W, KBDM_CTRL},
|
{Event::DeleteWord, KBDK_W, KBDM_CTRL},
|
||||||
{Event::DeleteWord, KBDK_BACKSPACE, OPTION},
|
{Event::DeleteWord, KBDK_BACKSPACE, KBDM_CTRL},
|
||||||
{Event::DeleteHome, KBDK_U, KBDM_CTRL},
|
{Event::DeleteHome, KBDK_U, KBDM_CTRL},
|
||||||
{Event::DeleteHome, KBDK_BACKSPACE, CMD},
|
{Event::DeleteHome, KBDK_BACKSPACE, CMD},
|
||||||
{Event::DeleteEnd, KBDK_K, KBDM_CTRL},
|
{Event::DeleteEnd, KBDK_K, KBDM_CTRL},
|
||||||
|
|
|
@ -69,16 +69,6 @@ using namespace std::placeholders;
|
||||||
EventHandler::EventHandler(OSystem& osystem)
|
EventHandler::EventHandler(OSystem& osystem)
|
||||||
: myOSystem(osystem)
|
: myOSystem(osystem)
|
||||||
{
|
{
|
||||||
// Create keyboard handler (to handle all physical keyboard functionality)
|
|
||||||
myPKeyHandler = make_unique<PhysicalKeyboardHandler>(osystem, *this);
|
|
||||||
|
|
||||||
// Create joystick handler (to handle all physical joystick functionality)
|
|
||||||
myPJoyHandler = make_unique<PhysicalJoystickHandler>(osystem, *this);
|
|
||||||
|
|
||||||
// Erase the 'combo' array
|
|
||||||
for(int i = 0; i < COMBO_SIZE; ++i)
|
|
||||||
for(int j = 0; j < EVENTS_PER_COMBO; ++j)
|
|
||||||
myComboTable[i][j] = Event::NoType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -89,6 +79,17 @@ EventHandler::~EventHandler()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EventHandler::initialize()
|
void EventHandler::initialize()
|
||||||
{
|
{
|
||||||
|
// Create keyboard handler (to handle all physical keyboard functionality)
|
||||||
|
myPKeyHandler = make_unique<PhysicalKeyboardHandler>(myOSystem, *this);
|
||||||
|
|
||||||
|
// Create joystick handler (to handle all physical joystick functionality)
|
||||||
|
myPJoyHandler = make_unique<PhysicalJoystickHandler>(myOSystem, *this);
|
||||||
|
|
||||||
|
// Erase the 'combo' array
|
||||||
|
for(int i = 0; i < COMBO_SIZE; ++i)
|
||||||
|
for(int j = 0; j < EVENTS_PER_COMBO; ++j)
|
||||||
|
myComboTable[i][j] = Event::NoType;
|
||||||
|
|
||||||
// Make sure the event/action mappings are correctly set,
|
// Make sure the event/action mappings are correctly set,
|
||||||
// and fill the ActionList structure with valid values
|
// and fill the ActionList structure with valid values
|
||||||
setComboMap();
|
setComboMap();
|
||||||
|
|
|
@ -249,7 +249,7 @@ bool EditableWidget::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
|
|
||||||
myUndoHandler->endChars(_editString);
|
myUndoHandler->endChars(_editString);
|
||||||
// Reverse Y and Z for QWERTZ keyboards
|
// Reverse Y and Z for QWERTZ keyboards
|
||||||
if(event == Event::Redo != instance().eventHandler().isQwertz())
|
if(event == Event::Redo)
|
||||||
handled = myUndoHandler->redo(_editString);
|
handled = myUndoHandler->redo(_editString);
|
||||||
else
|
else
|
||||||
handled = myUndoHandler->undo(_editString);
|
handled = myUndoHandler->undo(_editString);
|
||||||
|
|
Loading…
Reference in New Issue