Added support for modifier keys in gui command mode (shift, control, alt, caps lock).
- Enter command mode with F7 key only, but no modifier pressed. - Pressing / releasing modifier key only doesn't leave command mode. - Changed some headerbar button access keys using modifiers (e.g. shift + c calls config button handler). See user doc for all supported keys.
This commit is contained in:
parent
08d8782810
commit
f545071b4d
@ -5666,31 +5666,31 @@ will not be received by the OS running in Bochs.
|
||||
<entry>Press the Copy button</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>e</entry>
|
||||
<entry>SHIFT + c</entry>
|
||||
<entry>Press the Config button</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>f</entry>
|
||||
<entry>Toggle windowed / fullscreen mode (sdl, sdl2 and win32 only)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>n</entry>
|
||||
<entry>Press the Snapshot button</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>o</entry>
|
||||
<entry>Press the Power button</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>p</entry>
|
||||
<entry>Press the Paste button</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>SHIFT + p</entry>
|
||||
<entry>Press the Power button</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>r</entry>
|
||||
<entry>Press the Reset button</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>s</entry>
|
||||
<entry>Press the Snapshot button</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>SHIFT + s</entry>
|
||||
<entry>Press the Suspend button</entry>
|
||||
</row>
|
||||
<row>
|
||||
|
@ -706,6 +706,35 @@ const char* bx_gui_c::get_toggle_info(void)
|
||||
return mouse_toggle_text;
|
||||
}
|
||||
|
||||
Bit8u bx_gui_c::get_modifier_keys(void)
|
||||
{
|
||||
if ((keymodstate & BX_MOD_KEY_CAPS) > 0) {
|
||||
return ((keymodstate & ~BX_MOD_KEY_CAPS) | BX_MOD_KEY_SHIFT);
|
||||
} else {
|
||||
return keymodstate;
|
||||
}
|
||||
}
|
||||
|
||||
Bit8u bx_gui_c::set_modifier_keys(Bit8u modifier, bx_bool pressed)
|
||||
{
|
||||
Bit8u newstate = keymodstate, changestate = 0;
|
||||
|
||||
if (modifier == BX_MOD_KEY_CAPS) {
|
||||
if (pressed) {
|
||||
newstate ^= modifier;
|
||||
}
|
||||
} else {
|
||||
if (pressed) {
|
||||
newstate |= modifier;
|
||||
} else {
|
||||
newstate &= ~modifier;
|
||||
}
|
||||
}
|
||||
changestate = keymodstate ^ newstate;
|
||||
keymodstate = newstate;
|
||||
return changestate;
|
||||
}
|
||||
|
||||
bx_bool bx_gui_c::parse_user_shortcut(const char *val)
|
||||
{
|
||||
char *ptr, shortcut_tmp[512];
|
||||
|
@ -44,6 +44,12 @@
|
||||
#define BX_TEXT_BLINK_TOGGLE 0x02
|
||||
#define BX_TEXT_BLINK_STATE 0x04
|
||||
|
||||
// modifier keys
|
||||
#define BX_MOD_KEY_SHIFT 0x01
|
||||
#define BX_MOD_KEY_CTRL 0x02
|
||||
#define BX_MOD_KEY_ALT 0x04
|
||||
#define BX_MOD_KEY_CAPS 0x08
|
||||
|
||||
// mouse capture toggle feature
|
||||
#define BX_MT_KEY_CTRL 0x01
|
||||
#define BX_MT_KEY_ALT 0x02
|
||||
@ -175,6 +181,8 @@ public:
|
||||
static void toggle_mouse_enable(void);
|
||||
bx_bool mouse_toggle_check(Bit32u key, bx_bool pressed);
|
||||
const char* get_toggle_info(void);
|
||||
Bit8u get_modifier_keys(void);
|
||||
Bit8u set_modifier_keys(Bit8u modifier, bx_bool pressed);
|
||||
bx_bool parse_user_shortcut(const char *val);
|
||||
#if BX_DEBUGGER && BX_DEBUGGER_GUI
|
||||
void init_debug_dialog(void);
|
||||
@ -297,6 +305,8 @@ protected:
|
||||
Bit8u red;
|
||||
Bit8u reserved;
|
||||
} palette[256];
|
||||
// modifier keys
|
||||
Bit8u keymodstate;
|
||||
// mouse toggle setup
|
||||
Bit8u toggle_method;
|
||||
Bit32u toggle_keystate;
|
||||
|
105
bochs/gui/sdl.cc
105
bochs/gui/sdl.cc
@ -831,7 +831,7 @@ void bx_sdl_gui_c::handle_events(void)
|
||||
{
|
||||
SDL_Event sdl_event;
|
||||
Bit32u key_event;
|
||||
Bit8u mouse_state;
|
||||
Bit8u mouse_state, kmodchange = 0;
|
||||
int dx, dy, wheel_status;
|
||||
bx_bool mouse_toggle = 0;
|
||||
|
||||
@ -948,6 +948,19 @@ void bx_sdl_gui_c::handle_events(void)
|
||||
break;
|
||||
|
||||
case SDL_KEYDOWN:
|
||||
// check modifier keys
|
||||
if ((sdl_event.key.keysym.sym == SDLK_LSHIFT) ||
|
||||
(sdl_event.key.keysym.sym == SDLK_RSHIFT)) {
|
||||
kmodchange = set_modifier_keys(BX_MOD_KEY_SHIFT, 1);
|
||||
} else if ((sdl_event.key.keysym.sym == SDLK_LCTRL) ||
|
||||
(sdl_event.key.keysym.sym == SDLK_RCTRL)) {
|
||||
kmodchange = set_modifier_keys(BX_MOD_KEY_CTRL, 1);
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_LALT) {
|
||||
kmodchange = set_modifier_keys(BX_MOD_KEY_ALT, 1);
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_CAPSLOCK) {
|
||||
kmodchange = set_modifier_keys(BX_MOD_KEY_CAPS, 1);
|
||||
}
|
||||
// handle gui console mode
|
||||
if (console_running()) {
|
||||
SDLKey keysym = sdl_event.key.keysym.sym;
|
||||
Bit8u ascii = (Bit8u)sdl_event.key.keysym.unicode;
|
||||
@ -961,10 +974,9 @@ void bx_sdl_gui_c::handle_events(void)
|
||||
}
|
||||
// mouse capture toggle-check
|
||||
if (sdl_fullscreen_toggle == 0) {
|
||||
if ((sdl_event.key.keysym.sym == SDLK_LCTRL) ||
|
||||
(sdl_event.key.keysym.sym == SDLK_RCTRL)) {
|
||||
if ((kmodchange & BX_MOD_KEY_CTRL) > 0) {
|
||||
mouse_toggle = mouse_toggle_check(BX_MT_KEY_CTRL, 1);
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_LALT) {
|
||||
} else if ((kmodchange & BX_MOD_KEY_ALT) > 0) {
|
||||
mouse_toggle = mouse_toggle_check(BX_MT_KEY_ALT, 1);
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_F10) {
|
||||
mouse_toggle = mouse_toggle_check(BX_MT_KEY_F10, 1);
|
||||
@ -975,46 +987,52 @@ void bx_sdl_gui_c::handle_events(void)
|
||||
toggle_mouse_enable();
|
||||
}
|
||||
}
|
||||
|
||||
// handle command mode
|
||||
if (bx_gui->command_mode_active()) {
|
||||
if (sdl_event.key.keysym.sym == SDLK_a) {
|
||||
bx_gui->floppyA_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_b) {
|
||||
bx_gui->floppyB_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_c) {
|
||||
bx_gui->copy_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_e) {
|
||||
bx_gui->config_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_f) {
|
||||
sdl_fullscreen_toggle = !sdl_fullscreen_toggle;
|
||||
if (sdl_fullscreen_toggle == 0) {
|
||||
switch_to_windowed();
|
||||
} else {
|
||||
switch_to_fullscreen();
|
||||
if (bx_gui->get_modifier_keys() == 0) {
|
||||
if (sdl_event.key.keysym.sym == SDLK_a) {
|
||||
bx_gui->floppyA_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_b) {
|
||||
bx_gui->floppyB_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_c) {
|
||||
bx_gui->copy_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_f) {
|
||||
sdl_fullscreen_toggle = !sdl_fullscreen_toggle;
|
||||
if (sdl_fullscreen_toggle == 0) {
|
||||
switch_to_windowed();
|
||||
} else {
|
||||
switch_to_fullscreen();
|
||||
}
|
||||
bx_gui->set_fullscreen_mode(sdl_fullscreen_toggle);
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_p) {
|
||||
bx_gui->paste_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_r) {
|
||||
bx_gui->reset_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_s) {
|
||||
bx_gui->snapshot_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_u) {
|
||||
bx_gui->userbutton_handler();
|
||||
}
|
||||
} else if (bx_gui->get_modifier_keys() == BX_MOD_KEY_SHIFT) {
|
||||
if (sdl_event.key.keysym.sym == SDLK_c) {
|
||||
bx_gui->config_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_p) {
|
||||
bx_gui->power_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_s) {
|
||||
bx_gui->save_restore_handler();
|
||||
}
|
||||
bx_gui->set_fullscreen_mode(sdl_fullscreen_toggle);
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_n) {
|
||||
bx_gui->snapshot_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_o) {
|
||||
bx_gui->power_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_p) {
|
||||
bx_gui->paste_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_r) {
|
||||
bx_gui->reset_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_s) {
|
||||
bx_gui->save_restore_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_u) {
|
||||
bx_gui->userbutton_handler();
|
||||
}
|
||||
bx_gui->set_command_mode(0);
|
||||
if (kmodchange == 0) {
|
||||
bx_gui->set_command_mode(0);
|
||||
#if BX_SHOW_IPS
|
||||
sdl_show_info_msg = 0;
|
||||
sdl_show_info_msg = 0;
|
||||
#endif
|
||||
}
|
||||
if (sdl_event.key.keysym.sym != COMMAND_MODE_KEYSYM) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (bx_gui->has_command_mode() &&
|
||||
if (bx_gui->has_command_mode() && (bx_gui->get_modifier_keys() == 0) &&
|
||||
(sdl_event.key.keysym.sym == COMMAND_MODE_KEYSYM)) {
|
||||
bx_gui->set_command_mode(1);
|
||||
sdl_set_status_text(0, "Command mode", 1);
|
||||
@ -1062,11 +1080,20 @@ void bx_sdl_gui_c::handle_events(void)
|
||||
break;
|
||||
|
||||
case SDL_KEYUP:
|
||||
// mouse capture toggle-check
|
||||
if ((sdl_event.key.keysym.sym == SDLK_LCTRL) ||
|
||||
(sdl_event.key.keysym.sym == SDLK_RCTRL)) {
|
||||
mouse_toggle_check(BX_MT_KEY_CTRL, 0);
|
||||
// check modifier keys
|
||||
if ((sdl_event.key.keysym.sym == SDLK_LSHIFT) ||
|
||||
(sdl_event.key.keysym.sym == SDLK_RSHIFT)) {
|
||||
kmodchange = set_modifier_keys(BX_MOD_KEY_SHIFT, 0);
|
||||
} else if ((sdl_event.key.keysym.sym == SDLK_LCTRL) ||
|
||||
(sdl_event.key.keysym.sym == SDLK_RCTRL)) {
|
||||
kmodchange = set_modifier_keys(BX_MOD_KEY_CTRL, 0);
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_LALT) {
|
||||
kmodchange = set_modifier_keys(BX_MOD_KEY_ALT, 0);
|
||||
}
|
||||
// mouse capture toggle-check
|
||||
if ((kmodchange & BX_MOD_KEY_CTRL) > 0) {
|
||||
mouse_toggle_check(BX_MT_KEY_CTRL, 0);
|
||||
} else if ((kmodchange & BX_MOD_KEY_ALT) > 0) {
|
||||
mouse_toggle_check(BX_MT_KEY_ALT, 0);
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_F10) {
|
||||
mouse_toggle_check(BX_MT_KEY_F10, 0);
|
||||
|
@ -755,7 +755,7 @@ void bx_sdl2_gui_c::handle_events(void)
|
||||
{
|
||||
SDL_Event sdl_event;
|
||||
Bit32u key_event;
|
||||
Bit8u mouse_state;
|
||||
Bit8u mouse_state, kmodchange = 0;
|
||||
int dx, dy, wheel_status;
|
||||
bx_bool mouse_toggle = 0;
|
||||
|
||||
@ -875,6 +875,19 @@ void bx_sdl2_gui_c::handle_events(void)
|
||||
break;
|
||||
|
||||
case SDL_KEYDOWN:
|
||||
// check modifier keys
|
||||
if ((sdl_event.key.keysym.sym == SDLK_LSHIFT) ||
|
||||
(sdl_event.key.keysym.sym == SDLK_RSHIFT)) {
|
||||
kmodchange = set_modifier_keys(BX_MOD_KEY_SHIFT, 1);
|
||||
} else if ((sdl_event.key.keysym.sym == SDLK_LCTRL) ||
|
||||
(sdl_event.key.keysym.sym == SDLK_RCTRL)) {
|
||||
kmodchange = set_modifier_keys(BX_MOD_KEY_CTRL, 1);
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_LALT) {
|
||||
kmodchange = set_modifier_keys(BX_MOD_KEY_ALT, 1);
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_CAPSLOCK) {
|
||||
kmodchange = set_modifier_keys(BX_MOD_KEY_CAPS, 1);
|
||||
}
|
||||
// handle gui console mode
|
||||
if (console_running()) {
|
||||
if ((sdl_event.key.keysym.sym & (1 << 30)) == 0) {
|
||||
Bit8u ascii = (Bit8u)sdl_event.key.keysym.sym;
|
||||
@ -886,10 +899,9 @@ void bx_sdl2_gui_c::handle_events(void)
|
||||
}
|
||||
// mouse capture toggle-check
|
||||
if (sdl_fullscreen_toggle == 0) {
|
||||
if ((sdl_event.key.keysym.sym == SDLK_LCTRL) ||
|
||||
(sdl_event.key.keysym.sym == SDLK_RCTRL)) {
|
||||
if ((kmodchange & BX_MOD_KEY_CTRL) > 0) {
|
||||
mouse_toggle = mouse_toggle_check(BX_MT_KEY_CTRL, 1);
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_LALT) {
|
||||
} else if ((kmodchange & BX_MOD_KEY_ALT) > 0) {
|
||||
mouse_toggle = mouse_toggle_check(BX_MT_KEY_ALT, 1);
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_F10) {
|
||||
mouse_toggle = mouse_toggle_check(BX_MT_KEY_F10, 1);
|
||||
@ -900,46 +912,52 @@ void bx_sdl2_gui_c::handle_events(void)
|
||||
toggle_mouse_enable();
|
||||
}
|
||||
}
|
||||
|
||||
// handle command mode
|
||||
if (bx_gui->command_mode_active()) {
|
||||
if (sdl_event.key.keysym.sym == SDLK_a) {
|
||||
bx_gui->floppyA_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_b) {
|
||||
bx_gui->floppyB_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_c) {
|
||||
bx_gui->copy_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_e) {
|
||||
bx_gui->config_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_f) {
|
||||
sdl_fullscreen_toggle = !sdl_fullscreen_toggle;
|
||||
if (sdl_fullscreen_toggle == 0) {
|
||||
switch_to_windowed();
|
||||
} else {
|
||||
switch_to_fullscreen();
|
||||
if (bx_gui->get_modifier_keys() == 0) {
|
||||
if (sdl_event.key.keysym.sym == SDLK_a) {
|
||||
bx_gui->floppyA_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_b) {
|
||||
bx_gui->floppyB_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_c) {
|
||||
bx_gui->copy_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_f) {
|
||||
sdl_fullscreen_toggle = !sdl_fullscreen_toggle;
|
||||
if (sdl_fullscreen_toggle == 0) {
|
||||
switch_to_windowed();
|
||||
} else {
|
||||
switch_to_fullscreen();
|
||||
}
|
||||
bx_gui->set_fullscreen_mode(sdl_fullscreen_toggle);
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_p) {
|
||||
bx_gui->paste_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_r) {
|
||||
bx_gui->reset_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_s) {
|
||||
bx_gui->snapshot_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_u) {
|
||||
bx_gui->userbutton_handler();
|
||||
}
|
||||
} else if (bx_gui->get_modifier_keys() == BX_MOD_KEY_SHIFT) {
|
||||
if (sdl_event.key.keysym.sym == SDLK_c) {
|
||||
bx_gui->config_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_p) {
|
||||
bx_gui->power_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_s) {
|
||||
bx_gui->save_restore_handler();
|
||||
}
|
||||
bx_gui->set_fullscreen_mode(sdl_fullscreen_toggle);
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_n) {
|
||||
bx_gui->snapshot_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_o) {
|
||||
bx_gui->power_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_p) {
|
||||
bx_gui->paste_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_r) {
|
||||
bx_gui->reset_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_s) {
|
||||
bx_gui->save_restore_handler();
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_u) {
|
||||
bx_gui->userbutton_handler();
|
||||
}
|
||||
bx_gui->set_command_mode(0);
|
||||
if (kmodchange == 0) {
|
||||
bx_gui->set_command_mode(0);
|
||||
#if BX_SHOW_IPS
|
||||
sdl_show_info_msg = 0;
|
||||
sdl_show_info_msg = 0;
|
||||
#endif
|
||||
}
|
||||
if (sdl_event.key.keysym.sym != COMMAND_MODE_KEYSYM) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (bx_gui->has_command_mode() &&
|
||||
if (bx_gui->has_command_mode() && (bx_gui->get_modifier_keys() == 0) &&
|
||||
(sdl_event.key.keysym.sym == COMMAND_MODE_KEYSYM)) {
|
||||
bx_gui->set_command_mode(1);
|
||||
sdl_set_status_text(0, "Command mode", 1);
|
||||
@ -985,11 +1003,20 @@ void bx_sdl2_gui_c::handle_events(void)
|
||||
break;
|
||||
|
||||
case SDL_KEYUP:
|
||||
// mouse capture toggle-check
|
||||
if ((sdl_event.key.keysym.sym == SDLK_LCTRL) ||
|
||||
(sdl_event.key.keysym.sym == SDLK_RCTRL)) {
|
||||
mouse_toggle_check(BX_MT_KEY_CTRL, 0);
|
||||
// check modifier keys
|
||||
if ((sdl_event.key.keysym.sym == SDLK_LSHIFT) ||
|
||||
(sdl_event.key.keysym.sym == SDLK_RSHIFT)) {
|
||||
kmodchange = set_modifier_keys(BX_MOD_KEY_SHIFT, 0);
|
||||
} else if ((sdl_event.key.keysym.sym == SDLK_LCTRL) ||
|
||||
(sdl_event.key.keysym.sym == SDLK_RCTRL)) {
|
||||
kmodchange = set_modifier_keys(BX_MOD_KEY_CTRL, 0);
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_LALT) {
|
||||
kmodchange = set_modifier_keys(BX_MOD_KEY_ALT, 0);
|
||||
}
|
||||
// mouse capture toggle-check
|
||||
if ((kmodchange & BX_MOD_KEY_CTRL) > 0) {
|
||||
mouse_toggle_check(BX_MT_KEY_CTRL, 0);
|
||||
} else if ((kmodchange & BX_MOD_KEY_ALT) > 0) {
|
||||
mouse_toggle_check(BX_MT_KEY_ALT, 0);
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_F10) {
|
||||
mouse_toggle_check(BX_MT_KEY_F10, 0);
|
||||
|
@ -1180,6 +1180,8 @@ LRESULT CALLBACK simWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
PAINTSTRUCT ps;
|
||||
bx_bool mouse_toggle = 0;
|
||||
int toolbar_cmd = -1;
|
||||
Bit8u kmodchange = 0;
|
||||
bx_bool keymod = 0;
|
||||
static BOOL mouseModeChange = FALSE;
|
||||
|
||||
switch (iMsg) {
|
||||
@ -1323,9 +1325,24 @@ LRESULT CALLBACK simWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
if (wParam == VK_CONTROL) {
|
||||
mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_CTRL, 1);
|
||||
// check modifier keys
|
||||
if (wParam == VK_SHIFT) {
|
||||
kmodchange = bx_gui->set_modifier_keys(BX_MOD_KEY_SHIFT, 1);
|
||||
keymod = 1;
|
||||
} else if (wParam == VK_CONTROL) {
|
||||
kmodchange = bx_gui->set_modifier_keys(BX_MOD_KEY_CTRL, 1);
|
||||
keymod = 1;
|
||||
} else if (wParam == VK_MENU) {
|
||||
kmodchange = bx_gui->set_modifier_keys(BX_MOD_KEY_ALT, 1);
|
||||
keymod = 1;
|
||||
} else if (wParam == VK_CAPITAL) {
|
||||
kmodchange = bx_gui->set_modifier_keys(BX_MOD_KEY_CAPS, 1);
|
||||
keymod = 1;
|
||||
}
|
||||
// mouse capture toggle-check
|
||||
if (kmodchange == BX_MOD_KEY_CTRL) {
|
||||
mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_CTRL, 1);
|
||||
} else if (kmodchange == BX_MOD_KEY_ALT) {
|
||||
mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_ALT, 1);
|
||||
} else if (wParam == VK_F10) {
|
||||
mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_F10, 1);
|
||||
@ -1338,39 +1355,45 @@ LRESULT CALLBACK simWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
return 0;
|
||||
}
|
||||
if (bx_gui->command_mode_active()) {
|
||||
if (wParam == 'A') {
|
||||
toolbar_cmd = 0; // Floppy A
|
||||
} else if (wParam == 'B') {
|
||||
toolbar_cmd = 1; // Floppy B
|
||||
} else if (wParam == 'C') {
|
||||
toolbar_cmd = 10; // Copy
|
||||
} else if (wParam == 'E') {
|
||||
toolbar_cmd = 7; // Config
|
||||
} else if (wParam == 'F') {
|
||||
if (!saveParent) {
|
||||
BX_INFO(("entering fullscreen mode"));
|
||||
set_fullscreen_mode(TRUE);
|
||||
bx_gui->set_fullscreen_mode(1);
|
||||
} else {
|
||||
BX_INFO(("leaving fullscreen mode"));
|
||||
resize_main_window(TRUE);
|
||||
bx_gui->set_fullscreen_mode(0);
|
||||
if (bx_gui->get_modifier_keys() == 0) {
|
||||
if (wParam == 'A') {
|
||||
toolbar_cmd = 0; // Floppy A
|
||||
} else if (wParam == 'B') {
|
||||
toolbar_cmd = 1; // Floppy B
|
||||
} else if (wParam == 'C') {
|
||||
toolbar_cmd = 10; // Copy
|
||||
} else if (wParam == 'F') {
|
||||
if (!saveParent) {
|
||||
BX_INFO(("entering fullscreen mode"));
|
||||
set_fullscreen_mode(TRUE);
|
||||
bx_gui->set_fullscreen_mode(1);
|
||||
} else {
|
||||
BX_INFO(("leaving fullscreen mode"));
|
||||
resize_main_window(TRUE);
|
||||
bx_gui->set_fullscreen_mode(0);
|
||||
}
|
||||
} else if (wParam == 'P') {
|
||||
toolbar_cmd = 9; // Paste
|
||||
} else if (wParam == 'R') {
|
||||
toolbar_cmd = 6; // Reset
|
||||
} else if (wParam == 'S') {
|
||||
toolbar_cmd = 8; // Snapshot
|
||||
} else if (wParam == 'U') {
|
||||
toolbar_cmd = 11; // User
|
||||
}
|
||||
} else if (bx_gui->get_modifier_keys() == BX_MOD_KEY_SHIFT) {
|
||||
if (wParam == 'C') {
|
||||
toolbar_cmd = 7; // Config
|
||||
} else if (wParam == 'P') {
|
||||
toolbar_cmd = 4; // Power
|
||||
} else if (wParam == 'S') {
|
||||
toolbar_cmd = 5; // Suspend
|
||||
}
|
||||
} else if (wParam == 'N') {
|
||||
toolbar_cmd = 8; // Snapshot
|
||||
} else if (wParam == 'O') {
|
||||
toolbar_cmd = 4; // Power
|
||||
} else if (wParam == 'P') {
|
||||
toolbar_cmd = 9; // Paste
|
||||
} else if (wParam == 'R') {
|
||||
toolbar_cmd = 6; // Reset
|
||||
} else if (wParam == 'S') {
|
||||
toolbar_cmd = 5; // Suspend
|
||||
} else if (wParam == 'U') {
|
||||
toolbar_cmd = 11; // User
|
||||
}
|
||||
bx_gui->set_command_mode(0);
|
||||
SetMouseToggleInfo();
|
||||
if (!keymod) {
|
||||
bx_gui->set_command_mode(0);
|
||||
SetMouseToggleInfo();
|
||||
}
|
||||
if (toolbar_cmd >= 0) {
|
||||
EnterCriticalSection(&stInfo.keyCS);
|
||||
enq_key_event((Bit32u)toolbar_cmd, TOOLBAR_CLICKED);
|
||||
@ -1381,7 +1404,8 @@ LRESULT CALLBACK simWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (bx_gui->has_command_mode() && (wParam == COMMAND_MODE_VKEY)) {
|
||||
if (bx_gui->has_command_mode() && (bx_gui->get_modifier_keys() == 0) &&
|
||||
(wParam == COMMAND_MODE_VKEY)) {
|
||||
bx_gui->set_command_mode(1);
|
||||
SetStatusText(0, "Command mode", TRUE);
|
||||
return 0;
|
||||
@ -1408,9 +1432,18 @@ LRESULT CALLBACK simWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
resize_main_window(TRUE);
|
||||
}
|
||||
} else {
|
||||
if (wParam == VK_CONTROL) {
|
||||
bx_gui->mouse_toggle_check(BX_MT_KEY_CTRL, 0);
|
||||
// check modifier keys
|
||||
if (wParam == VK_SHIFT) {
|
||||
kmodchange = bx_gui->set_modifier_keys(BX_MOD_KEY_SHIFT, 0);
|
||||
} else if (wParam == VK_CONTROL) {
|
||||
kmodchange = bx_gui->set_modifier_keys(BX_MOD_KEY_CTRL, 0);
|
||||
} else if (wParam == VK_MENU) {
|
||||
kmodchange = bx_gui->set_modifier_keys(BX_MOD_KEY_ALT, 0);
|
||||
}
|
||||
// mouse capture toggle-check
|
||||
if (kmodchange == BX_MOD_KEY_CTRL) {
|
||||
bx_gui->mouse_toggle_check(BX_MT_KEY_CTRL, 0);
|
||||
} else if (kmodchange == BX_MOD_KEY_ALT) {
|
||||
bx_gui->mouse_toggle_check(BX_MT_KEY_ALT, 0);
|
||||
} else if (wParam == VK_F10) {
|
||||
bx_gui->mouse_toggle_check(BX_MT_KEY_F10, 0);
|
||||
|
@ -1941,8 +1941,19 @@ void bx_x_gui_c::send_mouse_status(void)
|
||||
void bx_x_gui_c::xkeypress(KeySym keysym, int press_release)
|
||||
{
|
||||
Bit32u key_event;
|
||||
Bit8u kmodchange = 0;
|
||||
bx_bool mouse_toggle = 0;
|
||||
|
||||
if ((keysym == XK_Shift_L) || (keysym == XK_Shift_R)) {
|
||||
kmodchange = set_modifier_keys(BX_MOD_KEY_SHIFT, !press_release);
|
||||
} else if ((keysym == XK_Control_L) || (keysym == XK_Control_R)) {
|
||||
kmodchange = set_modifier_keys(BX_MOD_KEY_CTRL, !press_release);
|
||||
} else if (keysym == XK_Alt_L) {
|
||||
kmodchange = set_modifier_keys(BX_MOD_KEY_ALT, !press_release);
|
||||
} else if (keysym == XK_Caps_Lock) {
|
||||
kmodchange = set_modifier_keys(BX_MOD_KEY_CAPS, !press_release);
|
||||
}
|
||||
|
||||
if (console_running() && !press_release) {
|
||||
if (((keysym >= XK_space) && (keysym <= XK_asciitilde)) ||
|
||||
(keysym == XK_Return) || (keysym == XK_BackSpace)) {
|
||||
@ -1950,14 +1961,15 @@ void bx_x_gui_c::xkeypress(KeySym keysym, int press_release)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((keysym == XK_Control_L) || (keysym == XK_Control_R)) {
|
||||
mouse_toggle = mouse_toggle_check(BX_MT_KEY_CTRL, !press_release);
|
||||
} else if (keysym == XK_Alt_L) {
|
||||
mouse_toggle = mouse_toggle_check(BX_MT_KEY_ALT, !press_release);
|
||||
|
||||
if ((kmodchange & BX_MOD_KEY_CTRL) > 0) {
|
||||
mouse_toggle = mouse_toggle_check(BX_MT_KEY_CTRL, !press_release);
|
||||
} else if ((kmodchange & BX_MOD_KEY_ALT) > 0) {
|
||||
mouse_toggle = mouse_toggle_check(BX_MT_KEY_ALT, !press_release);
|
||||
} else if (keysym == XK_F10) {
|
||||
mouse_toggle = mouse_toggle_check(BX_MT_KEY_F10, !press_release);
|
||||
mouse_toggle = mouse_toggle_check(BX_MT_KEY_F10, !press_release);
|
||||
} else if (keysym == XK_F12) {
|
||||
mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_F12, !press_release);
|
||||
mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_F12, !press_release);
|
||||
}
|
||||
if (mouse_toggle) {
|
||||
toggle_mouse_enable();
|
||||
@ -1972,28 +1984,31 @@ void bx_x_gui_c::xkeypress(KeySym keysym, int press_release)
|
||||
bx_gui->floppyB_handler();
|
||||
} else if (keysym == XK_c) {
|
||||
bx_gui->copy_handler();
|
||||
} else if (keysym == XK_e) {
|
||||
} else if (keysym == XK_C) {
|
||||
bx_gui->config_handler();
|
||||
} else if (keysym == XK_n) {
|
||||
bx_gui->snapshot_handler();
|
||||
} else if (keysym == XK_o) {
|
||||
bx_gui->power_handler();
|
||||
} else if (keysym == XK_p) {
|
||||
bx_gui->paste_handler();
|
||||
} else if (keysym == XK_P) {
|
||||
bx_gui->power_handler();
|
||||
} else if (keysym == XK_r) {
|
||||
bx_gui->reset_handler();
|
||||
} else if (keysym == XK_s) {
|
||||
bx_gui->snapshot_handler();
|
||||
} else if (keysym == XK_S) {
|
||||
bx_gui->save_restore_handler();
|
||||
} else if (keysym == XK_u) {
|
||||
bx_gui->userbutton_handler();
|
||||
}
|
||||
bx_gui->set_command_mode(0);
|
||||
x11_set_status_text(0, "", 0, 1);
|
||||
if (kmodchange == 0) {
|
||||
bx_gui->set_command_mode(0);
|
||||
x11_set_status_text(0, "", 0, 1);
|
||||
}
|
||||
if (keysym != COMMAND_MODE_KEYSYM) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if ((bx_gui->has_command_mode()) && (keysym == COMMAND_MODE_KEYSYM)) {
|
||||
if ((bx_gui->has_command_mode()) && (bx_gui->get_modifier_keys() == 0) &&
|
||||
(keysym == COMMAND_MODE_KEYSYM)) {
|
||||
bx_gui->set_command_mode(1);
|
||||
x11_set_status_text(0, "Command mode", 0, 1);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user