- added new config option to select mouse capture toggle method. In addition to
the default Bochs method using the CTRL key and the middle mouse button there are now the choices CTRL+F10 (like DOSBox) and CTRL+ALT (like QEMU). * currently implemented in the X11 and SDL guis only * TODO: porting to wxWidgets and Win32, documentation updates
This commit is contained in:
parent
05bbbb1a2c
commit
19ed74f642
@ -641,23 +641,34 @@ keyboard_paste_delay: 100000
|
||||
|
||||
#=======================================================================
|
||||
# MOUSE:
|
||||
# The Bochs gui creates mouse "events" unless the 'enabled' option is
|
||||
# set to 0. The hardware emulation itself is not disabled by this.
|
||||
# Unless you have a particular reason for enabling the mouse by default,
|
||||
# it is recommended that you leave it off. You can also toggle the mouse
|
||||
# usage at runtime (control key + middle mouse button on X11, SDL,
|
||||
# wxWidgets and Win32).
|
||||
# With the mouse type option you can select the type of mouse to emulate.
|
||||
# The default value is 'ps2'. The other choices are 'imps2' (wheel mouse
|
||||
# on PS/2), 'serial', 'serial_wheel' and 'serial_msys' (one com port requires
|
||||
# setting 'mode=mouse'). To connect a mouse to an USB port, see the 'usb_uhci'
|
||||
# or 'usb_ohci' option (requires PCI and USB support).
|
||||
# This defines parameters for the emulated mouse type, the initial status
|
||||
# of the mouse capture and the runtime method to toggle it.
|
||||
#
|
||||
# TYPE:
|
||||
# With the mouse type option you can select the type of mouse to emulate.
|
||||
# The default value is 'ps2'. The other choices are 'imps2' (wheel mouse
|
||||
# on PS/2), 'serial', 'serial_wheel' and 'serial_msys' (one com port requires
|
||||
# setting 'mode=mouse'). To connect a mouse to an USB port, see the 'usb_uhci'
|
||||
# or 'usb_ohci' option (requires PCI and USB support).
|
||||
#
|
||||
# ENABLED:
|
||||
# The Bochs gui creates mouse "events" unless the 'enabled' option is
|
||||
# set to 0. The hardware emulation itself is not disabled by this.
|
||||
# Unless you have a particular reason for enabling the mouse by default,
|
||||
# it is recommended that you leave it off. You can also toggle the mouse
|
||||
# usage at runtime (X11, SDL, wxWidgets and Win32 - see below).
|
||||
#
|
||||
# TOGGLE:
|
||||
# The default method to toggle the mouse capture at runtime is to press the
|
||||
# CTRL key and the middle mouse button ('ctrl+mbutton'). This option allows
|
||||
# to change the method to 'ctrl+f10' (like DOSBox) or 'ctrl+alt' (like QEMU).
|
||||
# NOTE: currently implemented in the X11 and SDL guis only!
|
||||
#
|
||||
# Examples:
|
||||
# mouse: enabled=1
|
||||
# mouse: enabled=1, type=imps2
|
||||
# mouse: enabled=1, type=serial
|
||||
# mouse: enabled=0
|
||||
# mouse: type=imps2, enabled=1
|
||||
# mouse: type=serial, enabled=1
|
||||
# mouse: enabled=0, toggle=ctrl+f10
|
||||
#=======================================================================
|
||||
mouse: enabled=0
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: config.cc,v 1.203 2010-04-29 19:34:31 sshwarts Exp $
|
||||
// $Id: config.cc,v 1.204 2010-05-16 09:01:36 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2009 The Bochs Project
|
||||
@ -229,7 +229,7 @@ void bx_init_options()
|
||||
bx_list_c *deplist;
|
||||
bx_param_num_c *ioaddr, *ioaddr2, *irq;
|
||||
bx_param_bool_c *enabled, *status;
|
||||
bx_param_enum_c *mode, *type, *ethmod;
|
||||
bx_param_enum_c *mode, *type, *ethmod, *toggle;
|
||||
bx_param_string_c *macaddr, *ethdev;
|
||||
bx_param_filename_c *path;
|
||||
char name[BX_PATHNAME_LEN], descr[512], group[16], label[512];
|
||||
@ -854,6 +854,20 @@ void bx_init_options()
|
||||
enabled->set_handler(bx_param_handler);
|
||||
enabled->set_runtime_param(1);
|
||||
|
||||
static const char *mouse_toggle_list[] = {
|
||||
"ctrl+mbutton",
|
||||
"ctrl+f10",
|
||||
"ctrl+alt",
|
||||
NULL
|
||||
};
|
||||
toggle = new bx_param_enum_c(mouse,
|
||||
"toggle", "Mouse toggle method",
|
||||
"The mouse toggle method can be one of these: 'ctrl+mbutton', 'ctrl+f10', 'ctrl+alt'",
|
||||
mouse_toggle_list,
|
||||
BX_MOUSE_TOGGLE_CTRL_MB,
|
||||
BX_MOUSE_TOGGLE_CTRL_MB);
|
||||
toggle->set_ask_format("Choose the mouse toggle method [%s] ");
|
||||
|
||||
kbd_mouse->set_options(kbd_mouse->SHOW_PARENT);
|
||||
keyboard->set_options(keyboard->SHOW_PARENT);
|
||||
mouse->set_options(mouse->SHOW_PARENT);
|
||||
@ -2821,6 +2835,9 @@ static int parse_line_formatted(const char *context, int num_params, char *param
|
||||
} else if (!strncmp(params[i], "type=", 5)) {
|
||||
if (!SIM->get_param_enum(BXPN_MOUSE_TYPE)->set_by_name(¶ms[i][5]))
|
||||
PARSE_ERR(("%s: mouse type '%s' not available", context, ¶ms[i][5]));
|
||||
} else if (!strncmp(params[i], "toggle=", 7)) {
|
||||
if (!SIM->get_param_enum(BXPN_MOUSE_TOGGLE)->set_by_name(¶ms[i][7]))
|
||||
PARSE_ERR(("%s: mouse toggle method '%s' not available", context, ¶ms[i][7]));
|
||||
} else {
|
||||
PARSE_ERR(("%s: mouse directive malformed.", context));
|
||||
}
|
||||
@ -3859,9 +3876,10 @@ int bx_write_configuration(const char *rc, int overwrite)
|
||||
bx_write_loader_options(fp);
|
||||
bx_write_log_options(fp, (bx_list_c*) SIM->get_param("log"));
|
||||
bx_write_keyboard_options(fp);
|
||||
fprintf(fp, "mouse: enabled=%d, type=%s\n",
|
||||
fprintf(fp, "mouse: enabled=%d, type=%s, toggle=%s\n",
|
||||
SIM->get_param_bool(BXPN_MOUSE_ENABLED)->get(),
|
||||
SIM->get_param_enum(BXPN_MOUSE_TYPE)->get_selected());
|
||||
SIM->get_param_enum(BXPN_MOUSE_TYPE)->get_selected(),
|
||||
SIM->get_param_enum(BXPN_MOUSE_TOGGLE)->get_selected());
|
||||
SIM->save_user_options(fp);
|
||||
fclose(fp);
|
||||
return 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: gui.cc,v 1.114 2010-02-26 14:18:18 sshwarts Exp $
|
||||
// $Id: gui.cc,v 1.115 2010-05-16 09:01:36 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2009 The Bochs Project
|
||||
@ -117,6 +117,20 @@ void bx_gui_c::init(int argc, char **argv, unsigned tilewidth, unsigned tileheig
|
||||
BX_GUI_THIS host_bpp = 8;
|
||||
BX_GUI_THIS dialog_caps = BX_GUI_DLG_RUNTIME | BX_GUI_DLG_SAVE_RESTORE;
|
||||
|
||||
BX_GUI_THIS toggle_method = SIM->get_param_enum(BXPN_MOUSE_TOGGLE)->get();
|
||||
BX_GUI_THIS toggle_keystate = 0;
|
||||
switch (toggle_method) {
|
||||
case BX_MOUSE_TOGGLE_CTRL_MB:
|
||||
strcpy(mouse_toggle_text, "CTRL + 3rd button");
|
||||
break;
|
||||
case BX_MOUSE_TOGGLE_CTRL_F10:
|
||||
strcpy(mouse_toggle_text, "CTRL + F10");
|
||||
break;
|
||||
case BX_MOUSE_TOGGLE_CTRL_ALT:
|
||||
strcpy(mouse_toggle_text, "CTRL + ALT");
|
||||
break;
|
||||
}
|
||||
|
||||
specific_init(argc, argv, tilewidth, tileheight, BX_HEADER_BAR_Y);
|
||||
|
||||
// Define some bitmaps to use in the headerbar
|
||||
@ -512,6 +526,38 @@ void bx_gui_c::toggle_mouse_enable(void)
|
||||
SIM->get_param_bool(BXPN_MOUSE_ENABLED)->set(!old);
|
||||
}
|
||||
|
||||
bx_bool bx_gui_c::mouse_toggle_check(Bit32u key, bx_bool pressed)
|
||||
{
|
||||
Bit32u newstate;
|
||||
bx_bool toggle = 0;
|
||||
|
||||
newstate = toggle_keystate;
|
||||
if (pressed) {
|
||||
newstate |= key;
|
||||
if (newstate == toggle_keystate) return 0;
|
||||
switch (toggle_method) {
|
||||
case BX_MOUSE_TOGGLE_CTRL_MB:
|
||||
toggle = (newstate & BX_GUI_MT_CTRL_MB) == BX_GUI_MT_CTRL_MB;
|
||||
break;
|
||||
case BX_MOUSE_TOGGLE_CTRL_F10:
|
||||
toggle = (newstate & BX_GUI_MT_CTRL_F10) == BX_GUI_MT_CTRL_F10;
|
||||
break;
|
||||
case BX_MOUSE_TOGGLE_CTRL_ALT:
|
||||
toggle = (newstate & BX_GUI_MT_CTRL_ALT) == BX_GUI_MT_CTRL_ALT;
|
||||
break;
|
||||
}
|
||||
toggle_keystate = newstate;
|
||||
} else {
|
||||
toggle_keystate &= ~key;
|
||||
}
|
||||
return toggle;
|
||||
}
|
||||
|
||||
const char* bx_gui_c::get_toggle_info(void)
|
||||
{
|
||||
return mouse_toggle_text;
|
||||
}
|
||||
|
||||
Bit32u get_user_key(char *key)
|
||||
{
|
||||
int i = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: gui.h,v 1.62 2009-12-04 20:02:12 sshwarts Exp $
|
||||
// $Id: gui.h,v 1.63 2010-05-16 09:01:36 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2009 The Bochs Project
|
||||
@ -32,6 +32,15 @@
|
||||
#define BX_TEXT_BLINK_TOGGLE 0x02
|
||||
#define BX_TEXT_BLINK_STATE 0x04
|
||||
|
||||
#define BX_MT_KEY_CTRL 0x01
|
||||
#define BX_MT_KEY_ALT 0x02
|
||||
#define BX_MT_KEY_F10 0x04
|
||||
#define BX_MT_MBUTTON 0x08
|
||||
|
||||
#define BX_GUI_MT_CTRL_MB 0x09
|
||||
#define BX_GUI_MT_CTRL_F10 0x05
|
||||
#define BX_GUI_MT_CTRL_ALT 0x03
|
||||
|
||||
typedef struct {
|
||||
Bit16u start_address;
|
||||
Bit8u cs_start;
|
||||
@ -131,7 +140,8 @@ public:
|
||||
int register_statusitem(const char *text);
|
||||
static void init_signal_handlers();
|
||||
static void toggle_mouse_enable(void);
|
||||
|
||||
bx_bool mouse_toggle_check(Bit32u key, bx_bool pressed);
|
||||
const char* get_toggle_info(void);
|
||||
|
||||
protected:
|
||||
// And these are defined and used privately in gui.cc
|
||||
@ -178,6 +188,9 @@ protected:
|
||||
Bit8u host_bpp;
|
||||
Bit8u *framebuffer;
|
||||
Bit32u dialog_caps;
|
||||
Bit8u toggle_method;
|
||||
Bit32u toggle_keystate;
|
||||
char mouse_toggle_text[20];
|
||||
};
|
||||
|
||||
|
||||
|
202
bochs/gui/sdl.cc
202
bochs/gui/sdl.cc
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: sdl.cc,v 1.89 2010-02-26 14:18:18 sshwarts Exp $
|
||||
// $Id: sdl.cc,v 1.90 2010-05-16 09:01:36 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2009 The Bochs Project
|
||||
@ -957,6 +957,7 @@ void bx_sdl_gui_c::handle_events(void)
|
||||
Bit32u key_event;
|
||||
Bit8u mouse_state;
|
||||
int wheel_status;
|
||||
bx_bool mouse_toggle = 0;
|
||||
|
||||
while(SDL_PollEvent(&sdl_event))
|
||||
{
|
||||
@ -1002,27 +1003,25 @@ void bx_sdl_gui_c::handle_events(void)
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
if((sdl_event.button.button == SDL_BUTTON_MIDDLE)
|
||||
&& ((SDL_GetModState() & KMOD_CTRL) > 0)
|
||||
&& (sdl_fullscreen_toggle == 0))
|
||||
{
|
||||
if(sdl_grab == 0)
|
||||
{
|
||||
SDL_ShowCursor(0);
|
||||
SDL_WM_GrabInput(SDL_GRAB_ON);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ShowCursor(1);
|
||||
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
}
|
||||
sdl_grab = ~sdl_grab;
|
||||
toggle_mouse_enable();
|
||||
break;
|
||||
} else if (sdl_event.button.y < headerbar_height) {
|
||||
headerbar_click(sdl_event.button.x);
|
||||
break;
|
||||
}
|
||||
// mouse capture toggle-check
|
||||
if ((sdl_event.button.button == SDL_BUTTON_MIDDLE)
|
||||
&& (sdl_fullscreen_toggle == 0)) {
|
||||
if (mouse_toggle_check(BX_MT_MBUTTON, 1)) {
|
||||
if (sdl_grab == 0) {
|
||||
SDL_ShowCursor(0);
|
||||
SDL_WM_GrabInput(SDL_GRAB_ON);
|
||||
} else {
|
||||
SDL_ShowCursor(1);
|
||||
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
}
|
||||
sdl_grab = ~sdl_grab;
|
||||
toggle_mouse_enable();
|
||||
}
|
||||
break;
|
||||
} else if (sdl_event.button.y < headerbar_height) {
|
||||
headerbar_click(sdl_event.button.x);
|
||||
break;
|
||||
}
|
||||
#ifdef SDL_BUTTON_WHEELUP
|
||||
// get the wheel status
|
||||
if (sdl_event.button.button == SDL_BUTTON_WHEELUP) {
|
||||
@ -1033,76 +1032,103 @@ void bx_sdl_gui_c::handle_events(void)
|
||||
}
|
||||
#endif
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
// figure out mouse state
|
||||
new_mousex = (int)(sdl_event.button.x);
|
||||
new_mousey = (int)(sdl_event.button.y);
|
||||
// SDL_GetMouseState() returns the state of all buttons
|
||||
mouse_state = SDL_GetMouseState(NULL, NULL);
|
||||
new_mousebuttons =
|
||||
(mouse_state & 0x01) |
|
||||
((mouse_state>>1)&0x02) |
|
||||
((mouse_state<<1)&0x04);
|
||||
// filter out middle button if not fullscreen
|
||||
if(sdl_fullscreen_toggle == 0)
|
||||
new_mousebuttons &= 0x07;
|
||||
if ((sdl_event.button.button == SDL_BUTTON_MIDDLE)
|
||||
&& (sdl_fullscreen_toggle == 0)) {
|
||||
mouse_toggle_check(BX_MT_MBUTTON, 0);
|
||||
}
|
||||
// figure out mouse state
|
||||
new_mousex = (int)(sdl_event.button.x);
|
||||
new_mousey = (int)(sdl_event.button.y);
|
||||
// SDL_GetMouseState() returns the state of all buttons
|
||||
mouse_state = SDL_GetMouseState(NULL, NULL);
|
||||
new_mousebuttons =
|
||||
(mouse_state & 0x01) |
|
||||
((mouse_state>>1)&0x02) |
|
||||
((mouse_state<<1)&0x04);
|
||||
// filter out middle button if not fullscreen
|
||||
if(sdl_fullscreen_toggle == 0)
|
||||
new_mousebuttons &= 0x07;
|
||||
// send motion information
|
||||
DEV_mouse_motion_ext(
|
||||
new_mousex - old_mousex,
|
||||
-(new_mousey - old_mousey),
|
||||
wheel_status,
|
||||
new_mousebuttons);
|
||||
// mark current state to diff with next packet
|
||||
old_mousebuttons = new_mousebuttons;
|
||||
old_mousex = new_mousex;
|
||||
old_mousey = new_mousey;
|
||||
break;
|
||||
// mark current state to diff with next packet
|
||||
old_mousebuttons = new_mousebuttons;
|
||||
old_mousex = new_mousex;
|
||||
old_mousey = new_mousey;
|
||||
break;
|
||||
|
||||
case SDL_KEYDOWN:
|
||||
|
||||
// Windows/Fullscreen toggle-check
|
||||
if(sdl_event.key.keysym.sym == SDLK_SCROLLOCK)
|
||||
{
|
||||
// SDL_WM_ToggleFullScreen(sdl_screen);
|
||||
sdl_fullscreen_toggle = ~sdl_fullscreen_toggle;
|
||||
if(sdl_fullscreen_toggle == 0)
|
||||
switch_to_windowed();
|
||||
else
|
||||
switch_to_fullscreen();
|
||||
bx_gui->show_headerbar();
|
||||
bx_gui->flush();
|
||||
break;
|
||||
}
|
||||
|
||||
// convert sym->bochs code
|
||||
if (sdl_event.key.keysym.sym > SDLK_LAST) break;
|
||||
if (!SIM->get_param_bool(BXPN_KBD_USEMAPPING)->get()) {
|
||||
key_event = sdl_sym_to_bx_key (sdl_event.key.keysym.sym);
|
||||
BX_DEBUG(("keypress scancode=%d, sym=%d, bx_key = %d", sdl_event.key.keysym.scancode, sdl_event.key.keysym.sym, key_event));
|
||||
} else {
|
||||
/* use mapping */
|
||||
BXKeyEntry *entry = bx_keymap.findHostKey (sdl_event.key.keysym.sym);
|
||||
if (!entry) {
|
||||
BX_ERROR(("host key %d (0x%x) not mapped!",
|
||||
(unsigned) sdl_event.key.keysym.sym,
|
||||
(unsigned) sdl_event.key.keysym.sym));
|
||||
break;
|
||||
}
|
||||
key_event = entry->baseKey;
|
||||
}
|
||||
if (key_event == BX_KEY_UNHANDLED) break;
|
||||
DEV_kbd_gen_scancode( key_event);
|
||||
if ((key_event == BX_KEY_NUM_LOCK) || (key_event == BX_KEY_CAPS_LOCK)) {
|
||||
DEV_kbd_gen_scancode(key_event | BX_KEY_RELEASED);
|
||||
// mouse capture toggle-check
|
||||
if (sdl_fullscreen_toggle == 0) {
|
||||
if ((sdl_event.key.keysym.sym == SDLK_LCTRL) ||
|
||||
(sdl_event.key.keysym.sym == SDLK_RCTRL)) {
|
||||
mouse_toggle = mouse_toggle_check(BX_MT_KEY_CTRL, 1);
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_LALT) {
|
||||
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);
|
||||
}
|
||||
if (mouse_toggle) {
|
||||
toggle_mouse_enable();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// Windows/Fullscreen toggle-check
|
||||
if (sdl_event.key.keysym.sym == SDLK_SCROLLOCK) {
|
||||
// SDL_WM_ToggleFullScreen(sdl_screen);
|
||||
sdl_fullscreen_toggle = ~sdl_fullscreen_toggle;
|
||||
if(sdl_fullscreen_toggle == 0)
|
||||
switch_to_windowed();
|
||||
else
|
||||
switch_to_fullscreen();
|
||||
bx_gui->show_headerbar();
|
||||
bx_gui->flush();
|
||||
break;
|
||||
}
|
||||
|
||||
// convert sym->bochs code
|
||||
if (sdl_event.key.keysym.sym > SDLK_LAST) break;
|
||||
if (!SIM->get_param_bool(BXPN_KBD_USEMAPPING)->get()) {
|
||||
key_event = sdl_sym_to_bx_key (sdl_event.key.keysym.sym);
|
||||
BX_DEBUG(("keypress scancode=%d, sym=%d, bx_key = %d", sdl_event.key.keysym.scancode, sdl_event.key.keysym.sym, key_event));
|
||||
} else {
|
||||
/* use mapping */
|
||||
BXKeyEntry *entry = bx_keymap.findHostKey (sdl_event.key.keysym.sym);
|
||||
if (!entry) {
|
||||
BX_ERROR(("host key %d (0x%x) not mapped!",
|
||||
(unsigned) sdl_event.key.keysym.sym,
|
||||
(unsigned) sdl_event.key.keysym.sym));
|
||||
break;
|
||||
}
|
||||
key_event = entry->baseKey;
|
||||
}
|
||||
if (key_event == BX_KEY_UNHANDLED) break;
|
||||
DEV_kbd_gen_scancode( key_event);
|
||||
if ((key_event == BX_KEY_NUM_LOCK) || (key_event == BX_KEY_CAPS_LOCK)) {
|
||||
DEV_kbd_gen_scancode(key_event | BX_KEY_RELEASED);
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_KEYUP:
|
||||
|
||||
// filter out release of Windows/Fullscreen toggle and unsupported keys
|
||||
if ((sdl_event.key.keysym.sym != SDLK_SCROLLOCK)
|
||||
&& (sdl_event.key.keysym.sym < SDLK_LAST))
|
||||
{
|
||||
// convert sym->bochs code
|
||||
// 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);
|
||||
} else if (sdl_event.key.keysym.sym == SDLK_LALT) {
|
||||
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);
|
||||
}
|
||||
|
||||
// filter out release of Windows/Fullscreen toggle and unsupported keys
|
||||
if ((sdl_event.key.keysym.sym != SDLK_SCROLLOCK)
|
||||
&& (sdl_event.key.keysym.sym < SDLK_LAST))
|
||||
{
|
||||
// convert sym->bochs code
|
||||
if (!SIM->get_param_bool(BXPN_KBD_USEMAPPING)->get()) {
|
||||
key_event = sdl_sym_to_bx_key (sdl_event.key.keysym.sym);
|
||||
} else {
|
||||
@ -1110,23 +1136,23 @@ void bx_sdl_gui_c::handle_events(void)
|
||||
BXKeyEntry *entry = bx_keymap.findHostKey (sdl_event.key.keysym.sym);
|
||||
if (!entry) {
|
||||
BX_ERROR(("host key %d (0x%x) not mapped!",
|
||||
(unsigned) sdl_event.key.keysym.sym,
|
||||
(unsigned) sdl_event.key.keysym.sym));
|
||||
(unsigned) sdl_event.key.keysym.sym,
|
||||
(unsigned) sdl_event.key.keysym.sym));
|
||||
break;
|
||||
}
|
||||
key_event = entry->baseKey;
|
||||
}
|
||||
if (key_event == BX_KEY_UNHANDLED) break;
|
||||
if (key_event == BX_KEY_UNHANDLED) break;
|
||||
if ((key_event == BX_KEY_NUM_LOCK) || (key_event == BX_KEY_CAPS_LOCK)) {
|
||||
DEV_kbd_gen_scancode(key_event);
|
||||
}
|
||||
DEV_kbd_gen_scancode(key_event | BX_KEY_RELEASED);
|
||||
}
|
||||
break;
|
||||
DEV_kbd_gen_scancode(key_event | BX_KEY_RELEASED);
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_QUIT:
|
||||
LOG_THIS setonoff(LOGLEV_PANIC, ACT_FATAL);
|
||||
BX_PANIC(("User requested shutdown."));
|
||||
LOG_THIS setonoff(LOGLEV_PANIC, ACT_FATAL);
|
||||
BX_PANIC(("User requested shutdown."));
|
||||
}
|
||||
}
|
||||
#if BX_SHOW_IPS
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: siminterface.h,v 1.251 2010-02-28 14:52:17 sshwarts Exp $
|
||||
// $Id: siminterface.h,v 1.252 2010-05-16 09:01:36 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 The Bochs Project
|
||||
@ -904,6 +904,12 @@ enum {
|
||||
BX_MOUSE_TYPE_SERIAL_MSYS
|
||||
};
|
||||
|
||||
enum {
|
||||
BX_MOUSE_TOGGLE_CTRL_MB,
|
||||
BX_MOUSE_TOGGLE_CTRL_F10,
|
||||
BX_MOUSE_TOGGLE_CTRL_ALT
|
||||
};
|
||||
|
||||
#define BX_FDD_NONE 0 // floppy not present
|
||||
#define BX_FDD_525DD 1 // 360K 5.25"
|
||||
#define BX_FDD_525HD 2 // 1.2M 5.25"
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: x.cc,v 1.130 2010-02-26 14:18:18 sshwarts Exp $
|
||||
// $Id: x.cc,v 1.131 2010-05-16 09:01:36 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002-2009 The Bochs Project
|
||||
@ -106,7 +106,6 @@ static unsigned imDepth, imWide, imBPP;
|
||||
static int prev_x=-1, prev_y=-1;
|
||||
static int current_x=-1, current_y=-1, current_z=0;
|
||||
static unsigned mouse_button_state = 0;
|
||||
static bx_bool CTRL_pressed = 0;
|
||||
|
||||
static unsigned prev_cursor_x=0;
|
||||
static unsigned prev_cursor_y=0;
|
||||
@ -619,7 +618,7 @@ void bx_x_gui_c::specific_init(int argc, char **argv, unsigned tilewidth, unsign
|
||||
bx_status_led_green = 0;
|
||||
bx_status_graytext = 0;
|
||||
}
|
||||
strcpy(bx_status_info_text, "CTRL + 3rd button enables mouse");
|
||||
sprintf(bx_status_info_text, "%s enables mouse", get_toggle_info());
|
||||
|
||||
x_init_done = true;
|
||||
}
|
||||
@ -724,7 +723,8 @@ void bx_x_gui_c::mouse_enabled_changed_specific (bx_bool val)
|
||||
BX_DEBUG (("mouse_enabled=%d, x11 specific code", val?1:0));
|
||||
if (val) {
|
||||
BX_INFO(("[x] Mouse on"));
|
||||
set_status_text(0, "CTRL + 3rd button disables mouse", 0);
|
||||
sprintf(bx_status_info_text, "%s disables mouse", get_toggle_info());
|
||||
set_status_text(0, bx_status_info_text, 0);
|
||||
mouse_enable_x = current_x;
|
||||
mouse_enable_y = current_y;
|
||||
disable_cursor();
|
||||
@ -732,7 +732,8 @@ void bx_x_gui_c::mouse_enabled_changed_specific (bx_bool val)
|
||||
warp_cursor(warp_home_x-current_x, warp_home_y-current_y);
|
||||
} else {
|
||||
BX_INFO(("[x] Mouse off"));
|
||||
set_status_text(0, "CTRL + 3rd button enables mouse", 0);
|
||||
sprintf(bx_status_info_text, "%s enables mouse", get_toggle_info());
|
||||
set_status_text(0, bx_status_info_text, 0);
|
||||
enable_cursor();
|
||||
warp_cursor(mouse_enable_x-current_x, mouse_enable_y-current_y);
|
||||
}
|
||||
@ -840,7 +841,7 @@ void bx_x_gui_c::handle_events(void)
|
||||
mouse_update = 0;
|
||||
break;
|
||||
case Button2:
|
||||
if (CTRL_pressed) {
|
||||
if (mouse_toggle_check(BX_MT_MBUTTON, 1)) {
|
||||
toggle_mouse_enable();
|
||||
} else {
|
||||
mouse_button_state |= 0x04;
|
||||
@ -878,6 +879,7 @@ void bx_x_gui_c::handle_events(void)
|
||||
mouse_update = 0;
|
||||
break;
|
||||
case Button2:
|
||||
mouse_toggle_check(BX_MT_MBUTTON, 0);
|
||||
mouse_button_state &= ~0x04;
|
||||
send_keyboard_mouse_status();
|
||||
mouse_update = 0;
|
||||
@ -1011,9 +1013,18 @@ void bx_x_gui_c::flush(void)
|
||||
void xkeypress(KeySym keysym, int press_release)
|
||||
{
|
||||
Bit32u key_event;
|
||||
bx_bool mouse_toggle = 0;
|
||||
|
||||
if ((keysym == XK_Control_L) || (keysym == XK_Control_R)) {
|
||||
CTRL_pressed = !press_release;
|
||||
mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_CTRL, !press_release);
|
||||
} else if (keysym == XK_Alt_L) {
|
||||
mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_ALT, !press_release);
|
||||
} else if (keysym == XK_F10) {
|
||||
mouse_toggle = bx_gui->mouse_toggle_check(BX_MT_KEY_F10, !press_release);
|
||||
}
|
||||
if (mouse_toggle) {
|
||||
bx_gui->toggle_mouse_enable();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Old (no mapping) behavior */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: param_names.h,v 1.7 2010-04-29 19:34:31 sshwarts Exp $
|
||||
// $Id: param_names.h,v 1.8 2010-05-16 09:01:36 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2009 The Bochs Project
|
||||
@ -97,6 +97,7 @@
|
||||
#define BXPN_USER_SHORTCUT "keyboard_mouse.keyboard.user_shortcut"
|
||||
#define BXPN_MOUSE_TYPE "keyboard_mouse.mouse.type"
|
||||
#define BXPN_MOUSE_ENABLED "keyboard_mouse.mouse.enabled"
|
||||
#define BXPN_MOUSE_TOGGLE "keyboard_mouse.mouse.toggle"
|
||||
#define BXPN_BOOTDRIVE1 "boot_params.boot_drive1"
|
||||
#define BXPN_BOOTDRIVE2 "boot_params.boot_drive2"
|
||||
#define BXPN_BOOTDRIVE3 "boot_params.boot_drive3"
|
||||
|
Loading…
x
Reference in New Issue
Block a user