- Timestamp:
- Sep 9, 2016 2:11:40 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
r63612 r63779 369 369 * user is trying to click outside of internal window geometry. */ 370 370 371 /* Grab the mouse button. We do not check for failure as we do not currently implement a back-up plan. */ 372 xcb_grab_button_checked(QX11Info::connection(), 0, QX11Info::appRootWindow(), 373 XCB_EVENT_MASK_BUTTON_PRESS, XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC, 374 XCB_NONE, XCB_NONE, XCB_BUTTON_INDEX_1, XCB_MOD_MASK_ANY); 371 /* Grab the mouse button if the cursor is outside of our views. 372 * We do not check for failure as we do not currently implement a back-up plan. */ 373 if (!isItListenedView(QApplication::widgetAt(QCursor::pos()))) 374 xcb_grab_button_checked(QX11Info::connection(), 0, QX11Info::appRootWindow(), 375 XCB_EVENT_MASK_BUTTON_PRESS, XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC, 376 XCB_NONE, XCB_NONE, XCB_BUTTON_INDEX_1, XCB_MOD_MASK_ANY); 375 377 /* And grab the keyboard, using XCB directly, as Qt does not report failure. */ 376 378 xcb_grab_keyboard_cookie_t xcbGrabCookie = xcb_grab_keyboard(QX11Info::connection(), false, m_views[m_iKeyboardCaptureViewIndex]->winId(), … … 379 381 if (pGrabReply == NULL || pGrabReply->status != XCB_GRAB_STATUS_SUCCESS) 380 382 { 383 /* Release the mouse button grab. 384 * We do not check for failure as we do not currently implement a back-up plan. */ 385 xcb_ungrab_button_checked(QX11Info::connection(), XCB_BUTTON_INDEX_1, 386 QX11Info::appRootWindow(), XCB_MOD_MASK_ANY); 381 387 /* Try again later: */ 382 388 free(pGrabReply); … … 477 483 /* Ungrab using XCB: */ 478 484 xcb_ungrab_keyboard(QX11Info::connection(), XCB_TIME_CURRENT_TIME); 479 /* And release the mouse button,485 /* Release the mouse button grab. 480 486 * We do not check for failure as we do not currently implement a back-up plan. */ 481 xcb_ungrab_button_checked(QX11Info::connection(), XCB_BUTTON_INDEX_1, QX11Info::appRootWindow(), XCB_MOD_MASK_ANY); 487 xcb_ungrab_button_checked(QX11Info::connection(), XCB_BUTTON_INDEX_1, 488 QX11Info::appRootWindow(), XCB_MOD_MASK_ANY); 482 489 483 490 # endif /* QT_VERSION >= 0x050000 */ … … 1757 1764 break; 1758 1765 } 1766 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 1767 case QEvent::Enter: 1768 { 1769 /* Release the mouse button grab. 1770 * We do not check for failure as we do not currently implement a back-up plan. */ 1771 xcb_ungrab_button_checked(QX11Info::connection(), XCB_BUTTON_INDEX_1, 1772 QX11Info::appRootWindow(), XCB_MOD_MASK_ANY); 1773 1774 break; 1775 } 1776 case QEvent::Leave: 1777 { 1778 /* Grab the mouse button if the keyboard is captured. 1779 * We do not check for failure as we do not currently implement a back-up plan. */ 1780 if (m_fIsKeyboardCaptured) 1781 xcb_grab_button_checked(QX11Info::connection(), 0, QX11Info::appRootWindow(), 1782 XCB_EVENT_MASK_BUTTON_PRESS, XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC, 1783 XCB_NONE, XCB_NONE, XCB_BUTTON_INDEX_1, XCB_MOD_MASK_ANY); 1784 1785 break; 1786 } 1787 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */ 1759 1788 case QEvent::KeyPress: 1760 1789 case QEvent::KeyRelease:
Note:
See TracChangeset
for help on using the changeset viewer.