- Timestamp:
- Jul 4, 2016 1:34:20 PM (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
r61987 r62008 269 269 return; 270 270 271 #ifdef VBOX_WS_X11 272 # if QT_VERSION >= 0x050000 271 #if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 273 272 /* Due to X11 async nature we may have lost the focus already by the time we get the focus 274 273 * notification, so we do a sanity check that we still have it. If we don't have the focus … … 287 286 if (m_windows.value(uScreenId)->winId() != actualWinId) 288 287 return; 289 # endif /* QT_VERSION >= 0x050000 */ 290 #endif /* VBOX_WS_X11 */ 288 #endif /* VBOX_WS_X11 && QT_VERSION >= 0x050000 */ 291 289 292 290 /* If such view exists: */ … … 366 364 * is trying to click outside of internal window geometry. */ 367 365 368 /* Use the Qt5 keyboard grabbing: */ 369 m_views[uScreenId]->grabKeyboard(); 370 /* And grab the mouse button (if mouse is not captured), 366 /* Grab the mouse button (if mouse is not captured), 371 367 * We do not check for failure as we do not currently implement a back-up plan. */ 372 368 if (!uisession()->isMouseCaptured()) 373 369 xcb_grab_button_checked(QX11Info::connection(), 0, QX11Info::appRootWindow(), 374 XCB_EVENT_MASK_BUTTON_PRESS, XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC, 375 XCB_NONE, XCB_NONE, XCB_BUTTON_INDEX_1, XCB_MOD_MASK_ANY); 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); 376 381 377 382 # endif /* QT_VERSION >= 0x050000 */ … … 1440 1445 releaseKeyboard(); 1441 1446 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 we 1452 * 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(); 1442 1456 break; 1443 1457 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r61945 r62008 1910 1910 case XCB_KEY_RELEASE: 1911 1911 case XCB_BUTTON_PRESS: 1912 case XCB_BUTTON_RELEASE: 1912 1913 { 1913 1914 /* Delegate key-event handling to the keyboard-handler and let it
Note:
See TracChangeset
for help on using the changeset viewer.