VirtualBox

Changeset 61745 in vbox


Ignore:
Timestamp:
Jun 17, 2016 1:35:34 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:7564: Yet another Qt5 migration consequence: Preventing keyboard-grabbing for window which have lost focus already (Qt5 version this time).

File:
1 edited

Legend:

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

    r61242 r61745  
    268268    if (m_fIsKeyboardCaptured)
    269269        return;
     270
     271#ifdef VBOX_WS_X11
     272# if QT_VERSION >= 0x050000
     273    /* Due to X11 async nature we may have lost the focus already by the time we get the focus
     274     * notification, so we do a sanity check that we still have it. If we don't have the focus
     275     * and grab the keyboard now that will cause focus change which we want to avoid. This change
     276     * potentially leads to a loop where two windows are continually responding to outdated focus events. */
     277    const xcb_get_input_focus_cookie_t xcbRequestCookie = xcb_get_input_focus(QX11Info::connection());
     278    xcb_get_input_focus_reply_t *pReply = xcb_get_input_focus_reply(QX11Info::connection(), xcbRequestCookie, NULL);
     279    WId actualWinId = 0;
     280    if (pReply)
     281    {
     282        actualWinId = pReply->focus;
     283        free(pReply);
     284    }
     285    else
     286        LogRel(("GUI: UIKeyboardHandler::captureKeyboard: XCB error on acquiring focus information detected!\n"));
     287    if (m_windows.value(uScreenId)->winId() != actualWinId)
     288        return;
     289# endif /* QT_VERSION >= 0x050000 */
     290#endif /* VBOX_WS_X11 */
    270291
    271292    /* If such view exists: */
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