- Timestamp:
- Feb 11, 2009 8:33:48 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
r16693 r16695 2104 2104 2105 2105 /** 2106 * This function is a "predicate" for XCheckIfEvent(). It will check 2107 * the XEvent passed to it to see if it is a keypress event matching 2108 * the keyrelease event in @a pvArg. 2109 * @returns True if the event matches, False otherwise 2110 * @param pEvent the event to compare, taken from the event queue 2111 * @param pvArg the keyrelease event we would like to compare against 2112 */ 2113 static Bool VBoxConsoleViewCompEvent(Display *, XEvent *pEvent, 2114 XPointer pvArg) 2115 { 2116 XEvent *pKeyEvent = (XEvent *) pvArg; 2117 if ((pEvent->type == XKeyPress) && 2118 (pEvent->xkey.keycode == pKeyEvent->xkey.keycode)) 2119 return True; 2120 else 2121 return False; 2122 } 2123 2124 /** 2106 2125 * This routine gets X11 events before they are processed by Qt. This is 2107 2126 * used for our platform specific keyboard implementation. A return value … … 2147 2166 /* Fix for http://www.virtualbox.org/ticket/1296: 2148 2167 * when X11 sends events for repeated keys, it always inserts an 2149 * XKeyRelease before the XKeyPress. Since it nearly always 2150 * (always?) uses the same time stamp for both, we can spot the 2151 * unwanted event and discard it. Of course, if we do miss one it 2152 * isn't fatal for our purposes. */ 2168 * XKeyRelease before the XKeyPress. */ 2169 XEvent returnEvent; 2170 if ((event->type == XKeyRelease) && 2171 (XCheckIfEvent(event->xkey.display, &returnEvent, 2172 VBoxConsoleViewCompEvent, (XPointer) event) == True)) { 2173 XPutBackEvent(event->xkey.display, &returnEvent); 2174 return true; 2175 } 2176 #if 0 2153 2177 if ((XKeyRelease == event->type) && XPending(event->xkey.display)) 2154 2178 { … … 2157 2181 XPeekEvent(event->xkey.display, &nextEvent); 2158 2182 if ((XKeyPress == nextEvent.type) && 2159 (event->xkey.keycode == nextEvent.xkey.keycode) && 2160 (event->xkey.time == nextEvent.xkey.time)) 2183 (event->xkey.keycode == nextEvent.xkey.keycode)) 2161 2184 /* Discard it, don't pass it to Qt. */ 2162 2185 return true; 2163 2186 } 2187 #endif 2164 2188 2165 2189 KeySym ks = ::XKeycodeToKeysym (event->xkey.display, event->xkey.keycode, 0);
Note:
See TracChangeset
for help on using the changeset viewer.