From cb8d81defd7fff374fdd18d6816d8643d7631561 Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Mon, 7 Jul 2014 07:29:08 +0000 Subject: [PATCH] Added new user shortcut "scrlck" (SDL/SDL2 using "Scroll Lock" for fullscreen toggle). Cleanups and improvements in the userbutton shortcut code. Documentation update (mention SDL2, updated userbutton list) --- bochs/.bochsrc | 15 +++++++---- bochs/doc/docbook/user/user.dbk | 44 ++++++++++++++++++++++----------- bochs/doc/man/bochsrc.5 | 17 +++++++------ bochs/gui/gui.cc | 28 +++++++++++++-------- 4 files changed, 68 insertions(+), 36 deletions(-) diff --git a/bochs/.bochsrc b/bochs/.bochsrc index ebb24a010..979358dd3 100644 --- a/bochs/.bochsrc +++ b/bochs/.bochsrc @@ -54,7 +54,8 @@ # carbon use Carbon library (for MacOS X) # macintosh use MacOS pre-10 # amigaos use native AmigaOS libraries -# sdl use SDL library, cross platform +# sdl use SDL 1.2.x library, cross platform +# sdl2 use SDL 2.x library, cross platform # svga use SVGALIB library for Linux, allows graphics without X11 # term text only, uses curses/ncurses library, cross platform # rfb provides an interface to AT&T's VNC viewer, cross platform @@ -69,9 +70,11 @@ # Some display libraries now support specific options to control their # behaviour. These options are supported by more than one display library: # -# "gui_debug" - use GTK debugger gui (sdl, x) / Win32 debugger gui (sdl, win32) -# "hideIPS" - disable IPS output in status bar (rfb, sdl, vncsrv, win32, wx, x) -# "nokeyrepeat" - turn off host keyboard repeat (sdl, win32, x) +# "gui_debug" - use GTK debugger gui (sdl, sdl2, x) / Win32 debugger gui (sdl, +# sdl2, win32) +# "hideIPS" - disable IPS output in status bar (rfb, sdl, sdl2, vncsrv, +# win32, wx, x) +# "nokeyrepeat" - turn off host keyboard repeat (sdl, sdl2, win32, x) # "timeout" - time (in seconds) to wait for client (rfb, vncsrv) # # See the examples below for other currently supported options. @@ -82,6 +85,7 @@ #display_library: nogui #display_library: rfb #display_library: sdl, options="fullscreen" # startup in fullscreen mode +#display_library: sdl2, options="fullscreen" # startup in fullscreen mode #display_library: term #display_library: vncsrv #display_library: win32 @@ -459,7 +463,8 @@ vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest # Valid key names: # "alt", "bksl", "bksp", "ctrl", "del", "down", "end", "enter", "esc", # "f1", ... "f12", "home", "ins", "left", "menu", "minus", "pgdwn", "pgup", -# "plus", "right", "shift", "space", "tab", "up", "win", "print" and "power". +# "plus", "power", "print", "right", "scrlck", "shift", "space", "tab", "up" +# and "win". # Examples: # keyboard: type=mf, serial_delay=200, paste_delay=100000 diff --git a/bochs/doc/docbook/user/user.dbk b/bochs/doc/docbook/user/user.dbk index 3495dbb95..694abae2f 100644 --- a/bochs/doc/docbook/user/user.dbk +++ b/bochs/doc/docbook/user/user.dbk @@ -610,7 +610,7 @@ code that displays the Bochs VGA screen and handles keyboard and mouse events. tried first in Unix and then ported to the others; see for compile instructions. - x, sdl, wx, term, rfb, vncsrv + x, sdl, sdl2, wx, term, rfb, vncsrv @@ -621,7 +621,7 @@ code that displays the Bochs VGA screen and handles keyboard and mouse events. see for compile instructions, or Cygwin, see . - win32, sdl, wx, rfb + win32, sdl, sdl2, wx, rfb @@ -631,7 +631,7 @@ code that displays the Bochs VGA screen and handles keyboard and mouse events. Jeremy Parsons (Br'fin) has been maintaining the MacOS X port since March 2002; see for compile instructions. - carbon, x, rfb, sdl + carbon, x, rfb, sdl, sdl2 @@ -1575,7 +1575,7 @@ description of each one. /usr/bin/bochs-dlx run this script to try out DLX Linux inside Bochs! /usr/share/bochs/dlxlinux/ directory containing DLX linux sample disk image and configuration files /usr/share/bochs/dlxlinux/readme.txt description of DLX linux -/usr/share/bochs/keymaps/*.map keymap tables for X11 and SDL +/usr/share/bochs/keymaps/*.map keymap tables for X11, SDL and SDL2 @@ -1989,7 +1989,11 @@ In Bochs 1.3 and before, the X11 GUI was always the default. --with-sdl - Enable support for the SDL GUI interface; see . + Enable support for the SDL 1.2.x GUI interface; see . + + + --with-sdl2 + Enable support for the SDL 2.x GUI interface; see . --with-term @@ -3230,14 +3234,15 @@ Examples: Some display libraries now support specific options to control their behaviour. These options are supported by more than one display library: - "gui_debug" - use GTK debugger gui (sdl, x) / Win32 debugger gui (sdl, win32) - "hideIPS" - disable IPS output in status bar (rfb, sdl, vncsrv, win32, wx, x) - "nokeyrepeat" - turn off host keyboard repeat (sdl, win32, x) + "gui_debug" - use GTK debugger gui (sdl, x) / Win32 debugger gui (sdl, sdl2, win32) + "hideIPS" - disable IPS output in status bar (rfb, sdl, sdl2, vncsrv, win32, wx, x) + "nokeyrepeat" - turn off host keyboard repeat (sdl, sdl2, win32, x) "timeout" - time (in seconds) to wait for client (rfb, vncsrv) See the examples below for other currently supported options. display_library: sdl, options="fullscreen" # startup in fullscreen mode + display_library: sdl2, options="fullscreen" # startup in fullscreen mode @@ -3273,7 +3278,12 @@ See the examples below for other currently supported options. sdl - use SDL library, cross platform, + use SDL 1.2.x library, cross platform, + details in + + + sdl2 + use SDL 2.x library, cross platform, details in @@ -3782,8 +3792,9 @@ Valid key names: "alt", "bksl", "bksp", "ctrl", "del", "down", "end", "enter", "esc", -"f1", ... "f12", "home", "ins", "left", "menu", "minus", "pgdwn", "pgup", "plus", -"right", "shift", "space", "tab", "up", "win", "print" and "power". +"f1", ... "f12", "home", "ins", "left", "menu", "minus", "pgdwn", "pgup", +"plus", "power", "print", "right", "scrlck", "shift", "space", "tab", "up" +and "win". @@ -5283,7 +5294,7 @@ behavoiur of Bochs at runtime if you click on one of these buttons: Changing the mouse capture at runtime is not supported by all display libraries, - but it is already present on RFB, SDL, VNCSRV, Win32, wxWidgets and X11. + but it is already present on RFB, SDL, SDL2, VNCSRV, Win32, wxWidgets and X11. Support for 2 button mouse to toggle the capture mode not yet complete - using @@ -5578,7 +5589,7 @@ drivers and their features. sdl - for wave output on platforms supported by SDL + for wave output on platforms supported by SDL (1.2.x or 2.x) No No @@ -6295,7 +6306,12 @@ simulation is starting. SDL SDL - SDL gui + SDL 1.2.x gui + + + SDL2 + SDL2 + SDL 2.x gui serial diff --git a/bochs/doc/man/bochsrc.5 b/bochs/doc/man/bochsrc.5 index 8b98c445b..294cf36ba 100644 --- a/bochs/doc/man/bochsrc.5 +++ b/bochs/doc/man/bochsrc.5 @@ -1,5 +1,5 @@ .\"Document Author: Timothy R. Butler - tbutler@uninetsolutions.com" -.TH bochsrc 5 "19 Jun 2014" "bochsrc" "The Bochs Project" +.TH bochsrc 5 "7 Jul 2014" "bochsrc" "The Bochs Project" .\"SKIP_SECTION" .SH NAME bochsrc \- Configuration file for Bochs. @@ -93,7 +93,8 @@ The choices are: carbon Carbon library (for MacOS X) macintosh MacOS pre-10 amigaos native AmigaOS libraries - sdl SDL library, cross platform + sdl SDL 1.2.x library, cross platform + sdl2 SDL 2.x library, cross platform term text only, uses curses/ncurses library, cross platform rfb provides an interface to AT&T's VNC viewer, cross platform vncsrv use LibVNCServer for extended RFB(VNC) support @@ -108,9 +109,9 @@ the "wx" display library. Some display libraries now support specific options to control their behaviour. These options are supported by more than one display library: - "gui_debug" - use GTK debugger gui (sdl, x) - "hideIPS" - disable IPS output in status bar (rfb, sdl, vncsrv, wx, x) - "nokeyrepeat" - turn off host keyboard repeat (sdl, x) + "gui_debug" - use GTK debugger gui (sdl, sdl2, x) + "hideIPS" - disable IPS output in status bar (rfb, sdl, sdl2, vncsrv, wx, x) + "nokeyrepeat" - turn off host keyboard repeat (sdl, sdl2, x) "timeout" - time (in seconds) to wait for client (rfb, vncsrv) See the examples below for other currently supported options. @@ -118,6 +119,7 @@ See the examples below for other currently supported options. Examples: display_library: x display_library: sdl, options="fullscreen" # startup in fullscreen mode + display_library: sdl2, options="fullscreen" # startup in fullscreen mode .TP @@ -521,8 +523,9 @@ button in the header bar. The shortcut string is a combination of maximum Valid key names: "alt", "bksl", "bksp", "ctrl", "del", "down", "end", "enter", "esc", -"f1", ... "f12", "home", "ins", "left", "menu", "minus", "pgdwn", "pgup", "plus", -"right", "shift", "space", "tab", "up", "win", "print" and "power". +"f1", ... "f12", "home", "ins", "left", "menu", "minus", "pgdwn", "pgup", +"plus", "power", "print", "right", "scrlck", "shift", "space", "tab", "up" +and "win". Examples: keyboard: type=mf, serial_delay=200, paste_delay=100000 diff --git a/bochs/gui/gui.cc b/bochs/gui/gui.cc index ca4c8fb73..326355521 100644 --- a/bochs/gui/gui.cc +++ b/bochs/gui/gui.cc @@ -46,7 +46,7 @@ bx_gui_c *bx_gui = NULL; #define LOG_THIS BX_GUI_THIS #define BX_KEY_UNKNOWN 0x7fffffff -#define N_USER_KEYS 37 +#define N_USER_KEYS 38 typedef struct { const char *key; @@ -91,7 +91,8 @@ static user_key_t user_keys[N_USER_KEYS] = { "up", BX_KEY_UP }, { "win", BX_KEY_WIN_L }, { "print", BX_KEY_PRINT }, - { "power", BX_KEY_POWER_POWER } + { "power", BX_KEY_POWER_POWER }, + { "scrlck", BX_KEY_SCRL_LOCK } }; bx_gui_c::bx_gui_c(void): disp_mode(DISP_MODE_SIM) @@ -660,6 +661,7 @@ void bx_gui_c::userbutton_handler(void) { Bit32u shortcut[4]; Bit32u symbol; + bx_param_string_c *sparam; char user_shortcut[512]; char *ptr; int i, len = 0, ret = 1; @@ -667,22 +669,28 @@ void bx_gui_c::userbutton_handler(void) if (BX_GUI_THIS dialog_caps & BX_GUI_DLG_USER) { ret = SIM->ask_param(BXPN_USER_SHORTCUT); } - strcpy(user_shortcut, SIM->get_param_string(BXPN_USER_SHORTCUT)->getptr()); - if ((ret > 0) && user_shortcut[0] && (strcmp(user_shortcut, "none"))) { + sparam = SIM->get_param_string(BXPN_USER_SHORTCUT); + if ((ret > 0) && !sparam->isempty()) { + strcpy(user_shortcut, sparam->getptr()); ptr = strtok(user_shortcut, "-"); - if ((strcmp(ptr, SIM->get_param_string(BXPN_USER_SHORTCUT)->getptr())) || - (strlen(SIM->get_param_string(BXPN_USER_SHORTCUT)->getptr()) < 6)) { + if ((strcmp(ptr, sparam->getptr())) || + (strlen(sparam->getptr()) < 7)) { while (ptr) { symbol = get_user_key(ptr); if (symbol == BX_KEY_UNKNOWN) { - BX_ERROR(("Unknown shortcut %s ignored", ptr)); + BX_ERROR(("Unknown shortcut '%s' ignored", ptr)); return; } - shortcut[len++] = symbol; - ptr = strtok(NULL, "-"); + if (len < 3) { + shortcut[len++] = symbol; + ptr = strtok(NULL, "-"); + } else { + BX_ERROR(("Ignoring extra key symbol '%s'", ptr)); + break; + } } } else { - BX_ERROR(("Unknown shortcut %s ignored", user_shortcut)); + BX_ERROR(("Unknown shortcut '%s' ignored", user_shortcut)); return; } i = 0;