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)
This commit is contained in:
Volker Ruppert 2014-07-07 07:29:08 +00:00
parent 20cc91a7d8
commit cb8d81defd
4 changed files with 68 additions and 36 deletions

View File

@ -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

View File

@ -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
<xref linkend="compiling"> for compile instructions.
</entry>
<entry>x, sdl, wx, term, rfb, vncsrv</entry>
<entry>x, sdl, sdl2, wx, term, rfb, vncsrv</entry>
</row>
<row>
@ -621,7 +621,7 @@ code that displays the Bochs VGA screen and handles keyboard and mouse events.
see <xref linkend="compiling-win32"> for compile instructions,
or Cygwin, see <xref linkend="compile-cygwin">.
</entry>
<entry>win32, sdl, wx, rfb</entry>
<entry>win32, sdl, sdl2, wx, rfb</entry>
</row>
<row>
@ -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 <xref linkend="compile-macosx"> for compile instructions.
</entry>
<entry>carbon, x, rfb, sdl</entry>
<entry>carbon, x, rfb, sdl, sdl2</entry>
</row>
<row>
@ -1575,7 +1575,7 @@ description of each one.
<row><entry>/usr/bin/bochs-dlx </entry> <entry> run this script to try out DLX Linux inside Bochs!</entry> </row>
<row><entry>/usr/share/bochs/dlxlinux/ </entry> <entry> directory containing DLX linux sample disk image and configuration files</entry> </row>
<row><entry>/usr/share/bochs/dlxlinux/readme.txt</entry> <entry> description of DLX linux</entry> </row>
<row><entry>/usr/share/bochs/keymaps/*.map </entry> <entry>keymap tables for X11 and SDL </entry> </row>
<row><entry>/usr/share/bochs/keymaps/*.map </entry> <entry>keymap tables for X11, SDL and SDL2 </entry> </row>
</tbody>
</tgroup>
</table>
@ -1989,7 +1989,11 @@ In Bochs 1.3 and before, the X11 GUI was always the default.
</row>
<row>
<entry>--with-sdl</entry>
<entry>Enable support for the SDL GUI interface; see <xref linkend="compile-sdl">.</entry>
<entry>Enable support for the SDL 1.2.x GUI interface; see <xref linkend="compile-sdl">.</entry>
</row>
<row>
<entry>--with-sdl2</entry>
<entry>Enable support for the SDL 2.x GUI interface; see <xref linkend="compile-sdl">.</entry>
</row>
<row>
<entry>--with-term</entry>
@ -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:
<screen>
"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)
</screen>
See the examples below for other currently supported options.
<screen>
display_library: sdl, options="fullscreen" # startup in fullscreen mode
display_library: sdl2, options="fullscreen" # startup in fullscreen mode
</screen>
</para>
@ -3273,7 +3278,12 @@ See the examples below for other currently supported options.
</row>
<row>
<entry>sdl</entry>
<entry>use SDL library, cross platform,
<entry>use SDL 1.2.x library, cross platform,
details in <xref linkend="compile-sdl"></entry>
</row>
<row>
<entry>sdl2</entry>
<entry>use SDL 2.x library, cross platform,
details in <xref linkend="compile-sdl"></entry>
</row>
<row>
@ -3782,8 +3792,9 @@ Valid key names:
</para>
<para>
"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".
</para>
</section>
@ -5283,7 +5294,7 @@ behavoiur of Bochs at runtime if you click on one of these buttons:
</para>
<note><para>
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.
</para></note>
<note><para>
Support for 2 button mouse to toggle the capture mode not yet complete - using
@ -5578,7 +5589,7 @@ drivers and their features.
</row>
<row>
<entry>sdl</entry>
<entry>for wave output on platforms supported by SDL</entry>
<entry>for wave output on platforms supported by SDL (1.2.x or 2.x)</entry>
<entry>No</entry>
<entry>No</entry>
</row>
@ -6295,7 +6306,12 @@ simulation is starting.
<row>
<entry>SDL</entry>
<entry>SDL</entry>
<entry>SDL gui</entry>
<entry>SDL 1.2.x gui</entry>
</row>
<row>
<entry>SDL2</entry>
<entry>SDL2</entry>
<entry>SDL 2.x gui</entry>
</row>
<row>
<entry>serial</entry>

View File

@ -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

View File

@ -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;