- config option and bochsrc example added
This commit is contained in:
parent
f81909361d
commit
ec33a610e4
@ -4,16 +4,23 @@ Author: Volker Ruppert
|
||||
Date: August 6th 2002
|
||||
|
||||
Detailed description:
|
||||
This patch adds a headerbar button that can send keypresses to the guest OS.
|
||||
It currently can send CTRL+ALT+DEL only. We need an option in the config
|
||||
interface to change the shortcut to be sent.
|
||||
This patch adds a headerbar button that can send keyboard shortcuts to the
|
||||
guest OS. The shortcut can be defined in the bochsrc or in the config
|
||||
interface. It is possible to change it at runtime.
|
||||
|
||||
These shortcuts are currently recognized:
|
||||
ctrlaltdel, ctrlaltesc, ctrlaltf1, alttab
|
||||
|
||||
Here is the list of changes:
|
||||
|
||||
* userbutton.h added in gui/bitmaps
|
||||
* config options for the userbutton shortcut added
|
||||
* initialize the new button in the gui.cc
|
||||
* the new userbutton handler generates keypresses and relaeses depending on
|
||||
the shortcut keyword
|
||||
* the gui stops adding buttons to the headerbar if not enough space is left.
|
||||
This can happen when the screen width is 320 pixels. Done for X11 and Win32.
|
||||
* TODO: implement this feature in the wxWindows gui too
|
||||
|
||||
Patch was created with:
|
||||
diff -u
|
||||
@ -23,12 +30,44 @@ Instructions:
|
||||
To patch, go to main bochs directory.
|
||||
Type "patch -p0 < THIS_PATCH_FILE".
|
||||
----------------------------------------------------------------------
|
||||
diff -urN ../bochs/gui/bitmaps/userbutton.h gui/bitmaps/userbutton.h
|
||||
diff -urN ../bochs/.bochsrc ./.bochsrc
|
||||
--- ../bochs/.bochsrc Fri Aug 2 07:41:04 2002
|
||||
+++ ./.bochsrc Wed Aug 7 22:17:58 2002
|
||||
@@ -447,6 +447,17 @@
|
||||
#keyboard_type: mf
|
||||
|
||||
#=======================================================================
|
||||
+# USER_SHORTCUT:
|
||||
+# This defines the keyboard shortcut to be sent when you press the "user"
|
||||
+# button in the headerbar. These shortcuts are currently recognized:
|
||||
+# ctrlaltdel, ctrlaltesc, ctrlaltf1, alttab
|
||||
+#
|
||||
+# Example:
|
||||
+# user_shortcut: keys=ctrlaltdel
|
||||
+#=======================================================================
|
||||
+#user_shortcut: keys=ctrlaltdel
|
||||
+
|
||||
+#=======================================================================
|
||||
# other stuff
|
||||
#=======================================================================
|
||||
# magic_break
|
||||
diff -urN ../bochs/bochs.h ./bochs.h
|
||||
--- ../bochs/bochs.h Thu Aug 1 09:34:58 2002
|
||||
+++ ./bochs.h Wed Aug 7 20:01:29 2002
|
||||
@@ -660,6 +660,7 @@
|
||||
bx_load32bitOSImage_t load32bitOSImage;
|
||||
bx_log_options log;
|
||||
bx_keyboard_options keyboard;
|
||||
+ bx_param_string_c *Ouser_shortcut;
|
||||
} bx_options_t;
|
||||
|
||||
extern bx_options_t bx_options;
|
||||
diff -urN ../bochs/gui/bitmaps/userbutton.h ./gui/bitmaps/userbutton.h
|
||||
--- ../bochs/gui/bitmaps/userbutton.h Thu Jan 1 01:00:00 1970
|
||||
+++ gui/bitmaps/userbutton.h Tue Aug 6 17:45:57 2002
|
||||
+++ ./gui/bitmaps/userbutton.h Tue Aug 6 17:45:57 2002
|
||||
@@ -0,0 +1,19 @@
|
||||
+/////////////////////////////////////////////////////////////////////////
|
||||
+// $Id: patch.userbutton,v 1.1 2002-08-06 16:17:49 vruppert Exp $
|
||||
+// $Id: patch.userbutton,v 1.2 2002-08-07 20:35:57 vruppert Exp $
|
||||
+/////////////////////////////////////////////////////////////////////////
|
||||
+#define BX_USER_BMAP_X 32
|
||||
+#define BX_USER_BMAP_Y 32
|
||||
@ -46,9 +85,62 @@ diff -urN ../bochs/gui/bitmaps/userbutton.h gui/bitmaps/userbutton.h
|
||||
+ 0xaa, 0xbf, 0xaa, 0x2a, 0x02, 0x00, 0x00, 0x20, 0xfe, 0xff, 0xff, 0x3f,
|
||||
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
+ };
|
||||
diff -urN ../bochs/gui/gui.cc gui/gui.cc
|
||||
diff -urN ../bochs/gui/control.cc ./gui/control.cc
|
||||
--- ../bochs/gui/control.cc Wed Aug 7 09:24:32 2002
|
||||
+++ ./gui/control.cc Wed Aug 7 21:02:31 2002
|
||||
@@ -368,11 +368,12 @@
|
||||
"7. VGA Update Interval: %d\n"
|
||||
"8. Mouse: %s\n"
|
||||
"9. Keyboard paste delay: %d\n"
|
||||
-"10. Instruction tracing: off (doesn't exist yet)\n"
|
||||
-"11. Continue simulation\n"
|
||||
-"12. Quit now\n"
|
||||
+"10. Userbutton shortcut: %s\n"
|
||||
+"11. Instruction tracing: off (doesn't exist yet)\n"
|
||||
+"12. Continue simulation\n"
|
||||
+"13. Quit now\n"
|
||||
"\n"
|
||||
-"Please choose one: [11] ";
|
||||
+"Please choose one: [12] ";
|
||||
|
||||
char *menu_prompt_list[BX_CPANEL_N_MENUS] = {
|
||||
ask_about_control_panel,
|
||||
@@ -421,7 +422,8 @@
|
||||
/* ips->get (), */
|
||||
SIM->get_param_num (BXP_VGA_UPDATE_INTERVAL)->get (),
|
||||
SIM->get_param_num (BXP_MOUSE_ENABLED)->get () ? "enabled" : "disabled",
|
||||
- SIM->get_param_num (BXP_KBD_PASTE_DELAY)->get ());
|
||||
+ SIM->get_param_num (BXP_KBD_PASTE_DELAY)->get (),
|
||||
+ SIM->get_param_string (BXP_USER_SHORTCUT)->getptr ());
|
||||
}
|
||||
|
||||
int do_menu (bx_id id) {
|
||||
@@ -511,7 +513,7 @@
|
||||
bx_floppy_options floppyop;
|
||||
bx_cdrom_options cdromop;
|
||||
build_runtime_options_prompt (runtime_menu_prompt, prompt, 1024);
|
||||
- if (ask_uint (prompt, 1, 12, 11, &choice, 10) < 0) return -1;
|
||||
+ if (ask_uint (prompt, 1, 13, 12, &choice, 10) < 0) return -1;
|
||||
switch (choice) {
|
||||
case 1:
|
||||
SIM->get_floppy_options (0, &floppyop);
|
||||
@@ -534,9 +536,10 @@
|
||||
case 7: askparam (BXP_VGA_UPDATE_INTERVAL); break;
|
||||
case 8: askparam (BXP_MOUSE_ENABLED); break;
|
||||
case 9: askparam (BXP_KBD_PASTE_DELAY); break;
|
||||
- case 10: NOT_IMPLEMENTED (choice); break;
|
||||
- case 11: fprintf (stderr, "Continuing simulation\n"); return 0;
|
||||
- case 12:
|
||||
+ case 10: askparam (BXP_USER_SHORTCUT); break;
|
||||
+ case 11: NOT_IMPLEMENTED (choice); break;
|
||||
+ case 12: fprintf (stderr, "Continuing simulation\n"); return 0;
|
||||
+ case 13:
|
||||
fprintf (stderr, "You chose quit on the control panel.\n");
|
||||
SIM->quit_sim (1);
|
||||
return -1;
|
||||
diff -urN ../bochs/gui/gui.cc ./gui/gui.cc
|
||||
--- ../bochs/gui/gui.cc Sun Aug 4 10:42:34 2002
|
||||
+++ gui/gui.cc Tue Aug 6 17:44:56 2002
|
||||
+++ ./gui/gui.cc Wed Aug 7 22:19:45 2002
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "gui/bitmaps/paste.h"
|
||||
#include "gui/bitmaps/configbutton.h"
|
||||
@ -75,7 +167,7 @@ diff -urN ../bochs/gui/gui.cc gui/gui.cc
|
||||
|
||||
show_headerbar();
|
||||
}
|
||||
@@ -389,6 +394,18 @@
|
||||
@@ -389,6 +394,53 @@
|
||||
int old = bx_options.Omouse_enabled->get ();
|
||||
BX_DEBUG (("toggle mouse_enabled, now %d", !old));
|
||||
bx_options.Omouse_enabled->set (!old);
|
||||
@ -84,19 +176,54 @@ diff -urN ../bochs/gui/gui.cc gui/gui.cc
|
||||
+ void
|
||||
+bx_gui_c::userbutton_handler(void)
|
||||
+{
|
||||
+ BX_INFO(("User button pressed"));
|
||||
+ bx_devices.keyboard->gen_scancode(BX_KEY_CTRL_L);
|
||||
+ bx_devices.keyboard->gen_scancode(BX_KEY_ALT_L);
|
||||
+ bx_devices.keyboard->gen_scancode(BX_KEY_DELETE);
|
||||
+ bx_devices.keyboard->gen_scancode(BX_KEY_DELETE | BX_KEY_RELEASED);
|
||||
+ bx_devices.keyboard->gen_scancode(BX_KEY_ALT_L | BX_KEY_RELEASED);
|
||||
+ bx_devices.keyboard->gen_scancode(BX_KEY_CTRL_L | BX_KEY_RELEASED);
|
||||
+ unsigned shortcut[4];
|
||||
+ char *user_shortcut;
|
||||
+ int i, len;
|
||||
+
|
||||
+ len = 0;
|
||||
+ user_shortcut = bx_options.Ouser_shortcut->getptr();
|
||||
+ i = 0;
|
||||
+ if (user_shortcut[0] && (strcmp(user_shortcut, "none"))) {
|
||||
+ if (!strcmp(user_shortcut, "ctrlaltdel")) {
|
||||
+ shortcut[0] = BX_KEY_CTRL_L;
|
||||
+ shortcut[1] = BX_KEY_ALT_L;
|
||||
+ shortcut[2] = BX_KEY_DELETE;
|
||||
+ len = 3;
|
||||
+ }
|
||||
+ else if (!strcmp(user_shortcut, "ctrlaltesc")) {
|
||||
+ shortcut[0] = BX_KEY_CTRL_L;
|
||||
+ shortcut[1] = BX_KEY_ALT_L;
|
||||
+ shortcut[2] = BX_KEY_ESC;
|
||||
+ len = 3;
|
||||
+ }
|
||||
+ else if (!strcmp(user_shortcut, "ctrlaltf1")) {
|
||||
+ shortcut[0] = BX_KEY_CTRL_L;
|
||||
+ shortcut[1] = BX_KEY_ALT_L;
|
||||
+ shortcut[2] = BX_KEY_F1;
|
||||
+ len = 3;
|
||||
+ }
|
||||
+ else if (!strcmp(user_shortcut, "alttab")) {
|
||||
+ shortcut[0] = BX_KEY_ALT_L;
|
||||
+ shortcut[1] = BX_KEY_TAB;
|
||||
+ len = 2;
|
||||
+ }
|
||||
+ else {
|
||||
+ BX_ERROR(("Unknown shortcut %s ignored", user_shortcut));
|
||||
+ }
|
||||
+ while (i < len) {
|
||||
+ bx_devices.keyboard->gen_scancode(shortcut[i++]);
|
||||
+ }
|
||||
+ i--;
|
||||
+ while (i >= 0) {
|
||||
+ bx_devices.keyboard->gen_scancode(shortcut[i--] | BX_KEY_RELEASED);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
||||
diff -urN ../bochs/gui/gui.h gui/gui.h
|
||||
diff -urN ../bochs/gui/gui.h ./gui/gui.h
|
||||
--- ../bochs/gui/gui.h Sat Apr 20 09:19:35 2002
|
||||
+++ gui/gui.h Tue Aug 6 17:50:14 2002
|
||||
+++ ./gui/gui.h Wed Aug 7 19:41:26 2002
|
||||
@@ -83,6 +83,7 @@
|
||||
static void snapshot_handler(void);
|
||||
static void config_handler(void);
|
||||
@ -119,9 +246,20 @@ diff -urN ../bochs/gui/gui.h gui/gui.h
|
||||
#define BX_HEADER_BAR_Y 32
|
||||
|
||||
// align pixmaps towards left or right side of header bar
|
||||
diff -urN ../bochs/gui/win32.cc gui/win32.cc
|
||||
diff -urN ../bochs/gui/siminterface.h ./gui/siminterface.h
|
||||
--- ../bochs/gui/siminterface.h Sun Aug 4 10:42:34 2002
|
||||
+++ ./gui/siminterface.h Wed Aug 7 20:43:02 2002
|
||||
@@ -158,6 +158,7 @@
|
||||
BXP_KEYBOARD_USEMAPPING,
|
||||
BXP_KEYBOARD_MAP,
|
||||
BXP_KEYBOARD,
|
||||
+ BXP_USER_SHORTCUT,
|
||||
BXP_ASK_FOR_PATHNAME, // for general file selection dialog
|
||||
BXP_THIS_IS_THE_LAST // used to determine length of list
|
||||
} bx_id;
|
||||
diff -urN ../bochs/gui/win32.cc ./gui/win32.cc
|
||||
--- ../bochs/gui/win32.cc Sat Apr 20 09:19:35 2002
|
||||
+++ gui/win32.cc Tue Aug 6 17:38:40 2002
|
||||
+++ ./gui/win32.cc Tue Aug 6 17:38:40 2002
|
||||
@@ -1019,6 +1019,7 @@
|
||||
|
||||
void bx_gui_c::show_headerbar(void) {
|
||||
@ -151,9 +289,9 @@ diff -urN ../bochs/gui/win32.cc gui/win32.cc
|
||||
DrawBitmap(MemoryDC, bx_headerbar_entry[i].bitmap, xorigin, 0, SRCCOPY, 0x7);
|
||||
}
|
||||
|
||||
diff -urN ../bochs/gui/x.cc gui/x.cc
|
||||
diff -urN ../bochs/gui/x.cc ./gui/x.cc
|
||||
--- ../bochs/gui/x.cc Sat May 18 18:02:20 2002
|
||||
+++ gui/x.cc Tue Aug 6 17:38:40 2002
|
||||
+++ ./gui/x.cc Tue Aug 6 17:38:40 2002
|
||||
@@ -1245,15 +1245,23 @@
|
||||
bx_gui_c::show_headerbar(void)
|
||||
{
|
||||
@ -180,3 +318,43 @@ diff -urN ../bochs/gui/x.cc gui/x.cc
|
||||
XCopyPlane(bx_x_display, bx_headerbar_entry[i].bitmap, win, gc_headerbar,
|
||||
0,0, bx_headerbar_entry[i].xdim, bx_headerbar_entry[i].ydim,
|
||||
xorigin, 0, 1);
|
||||
diff -urN ../bochs/main.cc ./main.cc
|
||||
--- ../bochs/main.cc Sun Aug 4 10:42:34 2002
|
||||
+++ ./main.cc Wed Aug 7 21:06:21 2002
|
||||
@@ -1023,6 +1023,12 @@
|
||||
bx_options.Okeyboard_type->set_format ("Keyboard type: %s");
|
||||
bx_options.Okeyboard_type->set_ask_format ("Enter keyboard type: [%s] ");
|
||||
|
||||
+ // Userbutton shortcut
|
||||
+ bx_options.Ouser_shortcut = new bx_param_string_c (BXP_USER_SHORTCUT,
|
||||
+ "Userbutton shortcut",
|
||||
+ "Userbutton shortcut",
|
||||
+ "none", 16);
|
||||
+
|
||||
bx_param_c *other_init_list[] = {
|
||||
bx_options.Okeyboard_serial_delay,
|
||||
bx_options.Okeyboard_paste_delay,
|
||||
@@ -1035,6 +1041,7 @@
|
||||
bx_options.keyboard.OuseMapping,
|
||||
bx_options.keyboard.Okeymap,
|
||||
bx_options.Okeyboard_type,
|
||||
+ bx_options.Ouser_shortcut,
|
||||
NULL
|
||||
};
|
||||
menu = new bx_list_c (BXP_MENU_MISC, "Configure Everything Else", "", other_init_list);
|
||||
@@ -2357,7 +2364,15 @@
|
||||
else if (!strncmp(params[i], "map=", 4)) {
|
||||
bx_options.keyboard.Okeymap->set (strdup(¶ms[i][4]));
|
||||
}
|
||||
+ }
|
||||
}
|
||||
+ else if (!strcmp(params[0], "user_shortcut")) {
|
||||
+ if (num_params != 2) {
|
||||
+ BX_PANIC(("%s: user_shortcut directive: wrong # args.", context));
|
||||
+ }
|
||||
+ if(!strncmp(params[1], "keys=", 4)) {
|
||||
+ bx_options.Ouser_shortcut->set (strdup(¶ms[1][5]));
|
||||
+ }
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user