mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-03 16:33:47 +00:00
Revert "SDL2: Stop hotkey commands accepting both Alt and Super when swap_opt_cmd = true"
The previous revert failed.
This reverts commit e28a9fc3a9
.
This commit is contained in:
parent
4c1c549ed6
commit
249dfc84ae
@ -120,8 +120,8 @@ static const bool use_vosf = false; // VOSF not possible
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool ctrl_down = false; // Flag: Ctrl key pressed (for use with hotkeys)
|
static bool ctrl_down = false; // Flag: Ctrl key pressed (for use with hotkeys)
|
||||||
static bool alt_down = false; // Flag: Alt/Opt key pressed (for use with hotkeys)
|
static bool opt_down = false; // Flag: Opt/Alt key pressed (for use with hotkeys)
|
||||||
static bool super_down = false; // Flag: Super/Cmd/Win key pressed (for use with hotkeys)
|
static bool cmd_down = false; // Flag: Cmd/Super/Win key pressed (for use with hotkeys)
|
||||||
static bool caps_on = false; // Flag: Caps Lock on
|
static bool caps_on = false; // Flag: Caps Lock on
|
||||||
static bool quit_full_screen = false; // Flag: DGA close requested from redraw thread
|
static bool quit_full_screen = false; // Flag: DGA close requested from redraw thread
|
||||||
static bool emerg_quit = false; // Flag: Ctrl-Esc pressed, emergency quit requested from MacOS thread
|
static bool emerg_quit = false; // Flag: Ctrl-Esc pressed, emergency quit requested from MacOS thread
|
||||||
@ -1638,8 +1638,8 @@ static bool is_hotkey_down(SDL_keysym const & ks)
|
|||||||
int hotkey = PrefsFindInt32("hotkey");
|
int hotkey = PrefsFindInt32("hotkey");
|
||||||
if (!hotkey) hotkey = 1;
|
if (!hotkey) hotkey = 1;
|
||||||
return (ctrl_down || (ks.mod & KMOD_CTRL) || !(hotkey & 1)) &&
|
return (ctrl_down || (ks.mod & KMOD_CTRL) || !(hotkey & 1)) &&
|
||||||
(alt_down || (ks.mod & KMOD_ALT) || !(hotkey & 2)) &&
|
(opt_down || (ks.mod & KMOD_ALT) || !(hotkey & 2)) &&
|
||||||
(super_down || (ks.mod & KMOD_META) || !(hotkey & 4));
|
(cmd_down || (ks.mod & KMOD_META) || !(hotkey & 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int modify_opt_cmd(int code) {
|
static int modify_opt_cmd(int code) {
|
||||||
@ -1875,10 +1875,10 @@ static void handle_events(void)
|
|||||||
if (code == 0x36) {
|
if (code == 0x36) {
|
||||||
ctrl_down = true;
|
ctrl_down = true;
|
||||||
} else if (code == 0x3a) {
|
} else if (code == 0x3a) {
|
||||||
alt_down = true;
|
opt_down = true;
|
||||||
code = modify_opt_cmd(code);
|
code = modify_opt_cmd(code);
|
||||||
} else if (code == 0x37) {
|
} else if (code == 0x37) {
|
||||||
super_down = true;
|
cmd_down = true;
|
||||||
code = modify_opt_cmd(code);
|
code = modify_opt_cmd(code);
|
||||||
}
|
}
|
||||||
if (code == 0x39) { // Caps Lock pressed
|
if (code == 0x39) { // Caps Lock pressed
|
||||||
@ -1909,10 +1909,10 @@ static void handle_events(void)
|
|||||||
if (code == 0x36) {
|
if (code == 0x36) {
|
||||||
ctrl_down = false;
|
ctrl_down = false;
|
||||||
} else if (code == 0x3a) {
|
} else if (code == 0x3a) {
|
||||||
alt_down = false;
|
opt_down = false;
|
||||||
code = modify_opt_cmd(code);
|
code = modify_opt_cmd(code);
|
||||||
} else if (code == 0x37) {
|
} else if (code == 0x37) {
|
||||||
super_down = false;
|
cmd_down = false;
|
||||||
code = modify_opt_cmd(code);
|
code = modify_opt_cmd(code);
|
||||||
}
|
}
|
||||||
if (code == 0x39) { // Caps Lock released
|
if (code == 0x39) { // Caps Lock released
|
||||||
|
@ -128,9 +128,9 @@ static bool use_vosf = false; // Flag: VOSF enabled
|
|||||||
static const bool use_vosf = false; // VOSF not possible
|
static const bool use_vosf = false; // VOSF not possible
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool ctrl_down = false; // Flag: Ctrl key pressed (for use with hotkeys)
|
static bool ctrl_down = false; // Flag: Ctrl key pressed
|
||||||
static bool alt_down = false; // Flag: Alt/Opt key pressed (for use with hotkeys)
|
static bool opt_down = false; // Flag: Opt key pressed
|
||||||
static bool super_down = false; // Flag: Super/Cmd/Win key pressed (for use with hotkeys)
|
static bool cmd_down = false; // Flag: Cmd key pressed
|
||||||
static bool quit_full_screen = false; // Flag: DGA close requested from redraw thread
|
static bool quit_full_screen = false; // Flag: DGA close requested from redraw thread
|
||||||
static bool emerg_quit = false; // Flag: Ctrl-Esc pressed, emergency quit requested from MacOS thread
|
static bool emerg_quit = false; // Flag: Ctrl-Esc pressed, emergency quit requested from MacOS thread
|
||||||
static bool emul_suspended = false; // Flag: Emulator suspended
|
static bool emul_suspended = false; // Flag: Emulator suspended
|
||||||
@ -2053,8 +2053,8 @@ static bool is_hotkey_down(SDL_Keysym const & ks)
|
|||||||
int hotkey = PrefsFindInt32("hotkey");
|
int hotkey = PrefsFindInt32("hotkey");
|
||||||
if (!hotkey) hotkey = 1;
|
if (!hotkey) hotkey = 1;
|
||||||
return (ctrl_down || (ks.mod & KMOD_CTRL) || !(hotkey & 1)) &&
|
return (ctrl_down || (ks.mod & KMOD_CTRL) || !(hotkey & 1)) &&
|
||||||
(alt_down || (ks.mod & KMOD_ALT) || !(hotkey & 2)) &&
|
(opt_down || (ks.mod & KMOD_ALT) || !(hotkey & 2)) &&
|
||||||
(super_down || (ks.mod & KMOD_GUI) || !(hotkey & 4));
|
(cmd_down || (ks.mod & KMOD_GUI) || !(hotkey & 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int modify_opt_cmd(int code) {
|
static int modify_opt_cmd(int code) {
|
||||||
@ -2357,19 +2357,17 @@ static void handle_events(void)
|
|||||||
code = event2keycode(event.key, true);
|
code = event2keycode(event.key, true);
|
||||||
if (code >= 0) {
|
if (code >= 0) {
|
||||||
if (!emul_suspended) {
|
if (!emul_suspended) {
|
||||||
if (code == 0x36) {
|
code = modify_opt_cmd(code);
|
||||||
ctrl_down = true;
|
if (code == 0x39)
|
||||||
} else if (code == 0x3a) {
|
|
||||||
alt_down = true;
|
|
||||||
code = modify_opt_cmd(code);
|
|
||||||
} else if (code == 0x37) {
|
|
||||||
super_down = true;
|
|
||||||
code = modify_opt_cmd(code);
|
|
||||||
}
|
|
||||||
if (code == 0x39) {
|
|
||||||
(SDL_GetModState() & KMOD_CAPS ? ADBKeyDown : ADBKeyUp)(code);
|
(SDL_GetModState() & KMOD_CAPS ? ADBKeyDown : ADBKeyUp)(code);
|
||||||
} else
|
} else
|
||||||
ADBKeyDown(code);
|
ADBKeyDown(code);
|
||||||
|
if (code == 0x36)
|
||||||
|
ctrl_down = true;
|
||||||
|
if (code == 0x3a)
|
||||||
|
opt_down = true;
|
||||||
|
if (code == 0x37)
|
||||||
|
cmd_down = true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (code == 0x31)
|
if (code == 0x31)
|
||||||
@ -2385,17 +2383,15 @@ static void handle_events(void)
|
|||||||
if (code == CODE_INVALID)
|
if (code == CODE_INVALID)
|
||||||
code = event2keycode(event.key, false);
|
code = event2keycode(event.key, false);
|
||||||
if (code >= 0) {
|
if (code >= 0) {
|
||||||
if (code == 0x36) {
|
code = modify_opt_cmd(code);
|
||||||
ctrl_down = false;
|
|
||||||
} else if (code == 0x3a) {
|
|
||||||
alt_down = false;
|
|
||||||
code = modify_opt_cmd(code);
|
|
||||||
} else if (code == 0x37) {
|
|
||||||
super_down = false;
|
|
||||||
code = modify_opt_cmd(code);
|
|
||||||
}
|
|
||||||
if (code != 0x39)
|
if (code != 0x39)
|
||||||
ADBKeyUp(code);
|
ADBKeyUp(code);
|
||||||
|
if (code == 0x36)
|
||||||
|
ctrl_down = false;
|
||||||
|
if (code == 0x3a)
|
||||||
|
opt_down = false;
|
||||||
|
if (code == 0x37)
|
||||||
|
cmd_down = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -114,9 +114,9 @@ static bool use_vosf = true; // Flag: VOSF enabled
|
|||||||
static const bool use_vosf = false; // VOSF not possible
|
static const bool use_vosf = false; // VOSF not possible
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool ctrl_down = false; // Flag: Ctrl key pressed
|
static bool ctrl_down = false; // Flag: Ctrl key pressed (for use with hotkeys)
|
||||||
static bool super_down = false; // Flag: Super key pressed
|
static bool opt_down = false; // Flag: Opt/Alt key pressed (for use with hotkeys)
|
||||||
static bool alt_down = false; // Flag: Alt key pressed
|
static bool cmd_down = false; // Flag: Cmd/Super/Win key pressed (for use with hotkeys)
|
||||||
static bool caps_on = false; // Flag: Caps Lock on
|
static bool caps_on = false; // Flag: Caps Lock on
|
||||||
static bool quit_full_screen = false; // Flag: DGA close requested from redraw thread
|
static bool quit_full_screen = false; // Flag: DGA close requested from redraw thread
|
||||||
static bool emerg_quit = false; // Flag: Ctrl-Esc pressed, emergency quit requested from MacOS thread
|
static bool emerg_quit = false; // Flag: Ctrl-Esc pressed, emergency quit requested from MacOS thread
|
||||||
@ -234,8 +234,8 @@ static bool is_hotkey_down()
|
|||||||
int hotkey = PrefsFindInt32("hotkey");
|
int hotkey = PrefsFindInt32("hotkey");
|
||||||
if (!hotkey) hotkey = 1;
|
if (!hotkey) hotkey = 1;
|
||||||
return (ctrl_down || !(hotkey & 1)) &&
|
return (ctrl_down || !(hotkey & 1)) &&
|
||||||
(alt_down || !(hotkey & 2)) &&
|
(opt_down || !(hotkey & 2)) &&
|
||||||
(super_down || !(hotkey & 4));
|
(cmd_down || !(hotkey & 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int modify_opt_cmd(int code) {
|
static int modify_opt_cmd(int code) {
|
||||||
@ -1028,9 +1028,9 @@ void driver_dga::suspend(void)
|
|||||||
ADBKeyUp(0x36);
|
ADBKeyUp(0x36);
|
||||||
ctrl_down = false;
|
ctrl_down = false;
|
||||||
ADBKeyUp(0x37);
|
ADBKeyUp(0x37);
|
||||||
super_down = false;
|
cmd_down = false;
|
||||||
ADBKeyUp(0x3a);
|
ADBKeyUp(0x3a);
|
||||||
alt_down = false;
|
opt_down = false;
|
||||||
|
|
||||||
// Lock frame buffer (this will stop the MacOS thread)
|
// Lock frame buffer (this will stop the MacOS thread)
|
||||||
LOCK_FRAME_BUFFER;
|
LOCK_FRAME_BUFFER;
|
||||||
@ -2252,10 +2252,10 @@ static void handle_events(void)
|
|||||||
if (code == 0x36) {
|
if (code == 0x36) {
|
||||||
ctrl_down = true;
|
ctrl_down = true;
|
||||||
} else if (code == 0x3a) {
|
} else if (code == 0x3a) {
|
||||||
alt_down = true;
|
opt_down = true;
|
||||||
code = modify_opt_cmd(code);
|
code = modify_opt_cmd(code);
|
||||||
} else if (code == 0x37) {
|
} else if (code == 0x37) {
|
||||||
super_down = true;
|
cmd_down = true;
|
||||||
code = modify_opt_cmd(code);
|
code = modify_opt_cmd(code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2289,10 +2289,10 @@ static void handle_events(void)
|
|||||||
if (code == 0x36) {
|
if (code == 0x36) {
|
||||||
ctrl_down = false;
|
ctrl_down = false;
|
||||||
} else if (code == 0x3a) {
|
} else if (code == 0x3a) {
|
||||||
alt_down = false;
|
opt_down = false;
|
||||||
code = modify_opt_cmd(code);
|
code = modify_opt_cmd(code);
|
||||||
} else if (code == 0x37) {
|
} else if (code == 0x37) {
|
||||||
super_down = false;
|
cmd_down = false;
|
||||||
code = modify_opt_cmd(code);
|
code = modify_opt_cmd(code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,9 +103,9 @@ static const bool use_vosf = false; // VOSF not possible
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool palette_changed = false; // Flag: Palette changed, redraw thread must update palette
|
static bool palette_changed = false; // Flag: Palette changed, redraw thread must update palette
|
||||||
static bool ctrl_down = false; // Flag: Ctrl key pressed
|
static bool ctrl_down = false; // Flag: Ctrl key pressed (for use with hotkeys)
|
||||||
static bool super_down = false; // Flag: Super key pressed
|
static bool opt_down = false; // Flag: Opt/Alt key pressed (for use with hotkeys)
|
||||||
static bool alt_down = false; // Flag: Alt key pressed
|
static bool cmd_down = false; // Flag: Cmd/Super/Win key pressed (for use with hotkeys)
|
||||||
static bool caps_on = false; // Flag: Caps Lock on
|
static bool caps_on = false; // Flag: Caps Lock on
|
||||||
static bool quit_full_screen = false; // Flag: DGA close requested from redraw thread
|
static bool quit_full_screen = false; // Flag: DGA close requested from redraw thread
|
||||||
static volatile bool quit_full_screen_ack = false; // Acknowledge for quit_full_screen
|
static volatile bool quit_full_screen_ack = false; // Acknowledge for quit_full_screen
|
||||||
@ -230,8 +230,8 @@ static bool is_hotkey_down()
|
|||||||
int hotkey = PrefsFindInt32("hotkey");
|
int hotkey = PrefsFindInt32("hotkey");
|
||||||
if (!hotkey) hotkey = 1;
|
if (!hotkey) hotkey = 1;
|
||||||
return (ctrl_down || !(hotkey & 1)) &&
|
return (ctrl_down || !(hotkey & 1)) &&
|
||||||
(alt_down || !(hotkey & 2)) &&
|
(opt_down || !(hotkey & 2)) &&
|
||||||
(super_down || !(hotkey & 4));
|
(cmd_down || !(hotkey & 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int modify_opt_cmd(int code) {
|
static int modify_opt_cmd(int code) {
|
||||||
@ -1758,9 +1758,9 @@ static void suspend_emul(void)
|
|||||||
ADBKeyUp(0x36);
|
ADBKeyUp(0x36);
|
||||||
ctrl_down = false;
|
ctrl_down = false;
|
||||||
ADBKeyUp(0x3a);
|
ADBKeyUp(0x3a);
|
||||||
alt_down = false;
|
opt_down = false;
|
||||||
ADBKeyUp(0x37);
|
ADBKeyUp(0x37);
|
||||||
super_down = false;
|
cmd_down = false;
|
||||||
|
|
||||||
// Lock frame buffer (this will stop the MacOS thread)
|
// Lock frame buffer (this will stop the MacOS thread)
|
||||||
LOCK_FRAME_BUFFER;
|
LOCK_FRAME_BUFFER;
|
||||||
@ -2102,10 +2102,10 @@ static void handle_events(void)
|
|||||||
if (code == 0x36) {
|
if (code == 0x36) {
|
||||||
ctrl_down = true;
|
ctrl_down = true;
|
||||||
} else if (code == 0x3a) {
|
} else if (code == 0x3a) {
|
||||||
alt_down = true;
|
opt_down = true;
|
||||||
code = modify_opt_cmd(code);
|
code = modify_opt_cmd(code);
|
||||||
} else if (code == 0x37) {
|
} else if (code == 0x37) {
|
||||||
super_down = true;
|
cmd_down = true;
|
||||||
code = modify_opt_cmd(code);
|
code = modify_opt_cmd(code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2139,10 +2139,10 @@ static void handle_events(void)
|
|||||||
if (code == 0x36) {
|
if (code == 0x36) {
|
||||||
ctrl_down = false;
|
ctrl_down = false;
|
||||||
} else if (code == 0x3a) {
|
} else if (code == 0x3a) {
|
||||||
alt_down = false;
|
opt_down = false;
|
||||||
code = modify_opt_cmd(code);
|
code = modify_opt_cmd(code);
|
||||||
} else if (code == 0x37) {
|
} else if (code == 0x37) {
|
||||||
super_down = false;
|
cmd_down = false;
|
||||||
code = modify_opt_cmd(code);
|
code = modify_opt_cmd(code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user