VirtualBox

Changeset 79640 in vbox


Ignore:
Timestamp:
Jul 9, 2019 11:22:28 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
131942
Message:

FE/Qt: X11 hosts: ask the X server if we have the focus before grabbing.
bugref:9506: FE/Qt: SUSE report GUI problem with Qt 5.13.
Changes in Qt 5.13 which delay reporting focus out events on X11 upset our
keyboard grabbing code, which waits for a short delay after receiving focus
to grab the keyboard and checks if we still have it. The delay in reporting
focus out defeats this check, so with this change, on Qt 5.13 and later we ask
the X server directly, not via Qt.

File:
1 edited

Legend:

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

    r79365 r79640  
    269269         * the keyboard before the target window sees the click. (GNOME Shell's hot corner has
    270270         * the same problem. At present we just let that problem be.) */
     271
     272# if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
     273        /* Make sure we really do still have the focus.  Qt as of version 5.13 started
     274         * reporting it with delay, so ask the X server directly.  We could remove the
     275         * version check some time in the future.  If we do, remove the comment above
     276         * about the focus notification dance, as it will no longer be relevant. */
     277        xcb_get_input_focus_cookie_t xcbFocusCookie = xcb_get_input_focus(QX11Info::connection());
     278        xcb_get_input_focus_reply_t *pFocusReply = xcb_get_input_focus_reply(QX11Info::connection(), xcbFocusCookie, 0);
     279        xcb_window_t xcbFocusWindow = pFocusReply->focus;
     280        free(pFocusReply);
     281        if (xcbFocusWindow != m_windows[m_iKeyboardCaptureViewIndex]->winId())
     282            return true;
     283# endif
    271284
    272285        /* Grab the mouse button.
Note: See TracChangeset for help on using the changeset viewer.

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