diff --git a/BasiliskII/src/SDL/video_sdl2.cpp b/BasiliskII/src/SDL/video_sdl2.cpp index 77f53fa9..a23f0495 100644 --- a/BasiliskII/src/SDL/video_sdl2.cpp +++ b/BasiliskII/src/SDL/video_sdl2.cpp @@ -2055,19 +2055,13 @@ static bool is_hotkey_down(SDL_Keysym const & ks) (cmd_down || (ks.mod & KMOD_GUI) || !(hotkey & 4)); } -static int modify_opt_cmd(int code) { +static bool swap_opt_cmd() { static bool f, c; if (!f) { f = true; c = PrefsFindBool("swap_opt_cmd"); } - if (c) { - switch (code) { - case 0x37: return 0x3a; - case 0x3a: return 0x37; - } - } - return code; + return c; } /* @@ -2144,8 +2138,8 @@ static int kc_decode(SDL_Keysym const & ks, bool key_down) case SDLK_RCTRL: return 0x36; case SDLK_LSHIFT: return 0x38; case SDLK_RSHIFT: return 0x38; - case SDLK_LALT: case SDLK_RALT: return 0x3a; - case SDLK_LGUI: case SDLK_RGUI: return 0x37; + case SDLK_LALT: case SDLK_RALT: return swap_opt_cmd() ? 0x37 : 0x3a; + case SDLK_LGUI: case SDLK_RGUI: return swap_opt_cmd() ? 0x3a : 0x37; case SDLK_MENU: return 0x32; case SDLK_CAPSLOCK: return 0x39; case SDLK_NUMLOCKCLEAR: return 0x47; @@ -2356,7 +2350,6 @@ static void handle_events(void) code = event2keycode(event.key, true); if (code >= 0) { if (!emul_suspended) { - code = modify_opt_cmd(code); #ifdef __MACOSX__ ADBKeyDown(code); #else @@ -2367,9 +2360,9 @@ static void handle_events(void) #endif if (code == 0x36) ctrl_down = true; - if (code == 0x3a) + if (code == (swap_opt_cmd() ? 0x37 : 0x3a)) opt_down = true; - if (code == 0x37) + if (code == (swap_opt_cmd() ? 0x3a : 0x37)) cmd_down = true; } else { @@ -2386,7 +2379,6 @@ static void handle_events(void) if (code == CODE_INVALID) code = event2keycode(event.key, false); if (code >= 0) { - code = modify_opt_cmd(code); #ifdef __MACOSX__ ADBKeyUp(code); #else @@ -2395,9 +2387,9 @@ static void handle_events(void) #endif if (code == 0x36) ctrl_down = false; - if (code == 0x3a) + if (code == (swap_opt_cmd() ? 0x37 : 0x3a)) opt_down = false; - if (code == 0x37) + if (code == (swap_opt_cmd() ? 0x3a : 0x37)) cmd_down = false; } break;