[prev in list] [next in list] [prev in thread] [next in thread]
List: bochs-cvs
Subject: [Bochs-cvs] SF.net SVN: bochs:[10518] trunk/bochs/gui/x.cc
From: vruppert () users ! sourceforge ! net
Date: 2011-07-31 15:46:37
Message-ID: E1QnYDt-0002Sc-Nv () sfp-svn-1 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]
Revision: 10518
http://bochs.svn.sourceforge.net/bochs/?rev=10518&view=rev
Author: vruppert
Date: 2011-07-31 15:46:37 +0000 (Sun, 31 Jul 2011)
Log Message:
-----------
- added display library option to detect and turn off host keyboard repeat (X11 key \
repeat detection grabbed from SDL 1.2)
- TODO: implement this feature in other display libraries and add a key repeat \
generator in the keyboard code that uses the typematic values from the guest.
Modified Paths:
--------------
trunk/bochs/gui/x.cc
Modified: trunk/bochs/gui/x.cc
===================================================================
--- trunk/bochs/gui/x.cc 2011-07-31 14:56:45 UTC (rev 10517)
+++ trunk/bochs/gui/x.cc 2011-07-31 15:46:37 UTC (rev 10518)
@@ -124,6 +124,8 @@
static void disable_cursor();
static void enable_cursor();
+// keyboard
+static bx_bool x11_nokeyrepeat = 0;
static Bit32u convertStringToXKeysym (const char *string);
static bx_bool x_init_done = 0;
@@ -648,21 +650,21 @@
// parse x11 specific options
if (argc > 1) {
for (i = 1; i < argc; i++) {
+ if (!strcmp(argv[i], "nokeyrepeat")) {
+ BX_INFO(("disabled host keyboard repeat"));
+ x11_nokeyrepeat = 1;
#if BX_DEBUGGER && BX_DEBUGGER_GUI
- if (!strcmp(argv[i], "gui_debug")) {
+ } else if (!strcmp(argv[i], "gui_debug")) {
void InitDebugDialog();
SIM->set_debug_gui(1);
InitDebugDialog();
- }
- else
#endif
#if BX_SHOW_IPS
- if (!strcmp(argv[i], "hideIPS")) {
+ } else if (!strcmp(argv[i], "hideIPS")) {
+ BX_INFO(("hide IPS display in status bar"));
x11_hide_ips = 1;
- }
- else
#endif
- {
+ } else {
BX_PANIC(("Unknown x11 option '%s'", argv[i]));
}
}
@@ -759,6 +761,27 @@
}
}
+/* Check to see if this is a repeated key. (grabbed from SDL 1.2)
+ (idea shamelessly lifted from GII -- thanks guys! :)
+ */
+static int X11_KeyRepeat(Display *display, XEvent *event)
+{
+ XEvent peekevent;
+ int repeated;
+
+ repeated = 0;
+ if (XPending(display)) {
+ XPeekEvent(display, &peekevent);
+ if ((peekevent.type == KeyPress) &&
+ (peekevent.xkey.keycode == event->xkey.keycode) &&
+ ((peekevent.xkey.time-event->xkey.time) < 2)) {
+ repeated = 1;
+ XNextEvent(display, &peekevent);
+ }
+ }
+ return repeated;
+}
+
void bx_x_gui_c::handle_events(void)
{
XEvent report;
@@ -784,6 +807,11 @@
while (XPending(bx_x_display) > 0) {
XNextEvent(bx_x_display, &report);
current_z = 0;
+
+ if (x11_nokeyrepeat && (report.type == KeyRelease) && \
X11_KeyRepeat(bx_x_display, &report)) { + return;
+ }
+
switch (report.type) {
case Expose:
This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.
------------------------------------------------------------------------------
Got Input? Slashdot Needs You.
Take our quick survey online. Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Bochs-cvs mailing list
Bochs-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bochs-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic