- Timestamp:
- Jul 6, 2016 11:17:02 AM (9 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
r62008 r62048 364 364 * is trying to click outside of internal window geometry. */ 365 365 366 /* Grab the mouse button (if mouse is not captured), 366 /* Use the Qt5 keyboard grabbing: */ 367 m_views[uScreenId]->grabKeyboard(); 368 /* And grab the mouse button (if mouse is not captured), 367 369 * We do not check for failure as we do not currently implement a back-up plan. */ 368 370 if (!uisession()->isMouseCaptured()) 369 371 xcb_grab_button_checked(QX11Info::connection(), 0, QX11Info::appRootWindow(), 370 XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE, XCB_GRAB_MODE_SYNC, 371 XCB_GRAB_MODE_ASYNC, XCB_NONE, XCB_NONE, XCB_BUTTON_INDEX_1, XCB_MOD_MASK_ANY); 372 /* Delay the actual keyboard grab request if the mouse button is held down and the mouse 373 * is not captured to work around window managers which transfer the focus when the user 374 * clicks in the title bar and then try to grab the keyboard and sulk if they fail. */ 375 xcb_query_pointer_cookie_t xcbRequestCookie = xcb_query_pointer(QX11Info::connection(), QX11Info::appRootWindow()); 376 xcb_query_pointer_reply_t *pReply = xcb_query_pointer_reply(QX11Info::connection(), xcbRequestCookie, NULL); 377 /* And use the Qt5 keyboard grabbing finally: */ 378 if (uisession()->isMouseCaptured() || !pReply || !(pReply->mask & XCB_KEY_BUT_MASK_BUTTON_1)) 379 m_views[uScreenId]->grabKeyboard(); 380 free(pReply); 372 XCB_EVENT_MASK_BUTTON_PRESS, XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC, 373 XCB_NONE, XCB_NONE, XCB_BUTTON_INDEX_1, XCB_MOD_MASK_ANY); 381 374 382 375 # endif /* QT_VERSION >= 0x050000 */ … … 1445 1438 releaseKeyboard(); 1446 1439 xcb_allow_events_checked(QX11Info::connection(), XCB_ALLOW_REPLAY_POINTER, pButtonEvent->time); 1447 break;1448 }1449 case XCB_BUTTON_RELEASE:1450 {1451 /* If the mouse button was pressed when we captured the keyboard then we1452 * will have delayed doing the grab. Do it now on button release.1453 * This will not hurt if it is already grabbed. */1454 if (m_iKeyboardCaptureViewIndex != -1)1455 m_views[m_iKeyboardCaptureViewIndex]->grabKeyboard();1456 1440 break; 1457 1441 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r62008 r62048 1910 1910 case XCB_KEY_RELEASE: 1911 1911 case XCB_BUTTON_PRESS: 1912 case XCB_BUTTON_RELEASE:1913 1912 { 1914 1913 /* Delegate key-event handling to the keyboard-handler and let it
Note:
See TracChangeset
for help on using the changeset viewer.