VirtualBox

Changeset 16695 in vbox for trunk


Ignore:
Timestamp:
Feb 11, 2009 8:33:48 PM (16 years ago)
Author:
vboxsync
Message:

FE/Qt: attempt to fix key repeat on Linux host, Windows guest - again

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp

    r16693 r16695  
    21042104
    21052105/**
     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 */
     2113static 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/**
    21062125 *  This routine gets X11 events before they are processed by Qt. This is
    21072126 *  used for our platform specific keyboard implementation. A return value
     
    21472166    /* Fix for http://www.virtualbox.org/ticket/1296:
    21482167     * 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
    21532177    if ((XKeyRelease == event->type) && XPending(event->xkey.display))
    21542178    {
     
    21572181        XPeekEvent(event->xkey.display, &nextEvent);
    21582182        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))
    21612184            /* Discard it, don't pass it to Qt. */
    21622185            return true;
    21632186    }
     2187#endif
    21642188
    21652189    KeySym ks = ::XKeycodeToKeysym (event->xkey.display, event->xkey.keycode, 0);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette