Changeset 63601 in vbox
- Timestamp:
- Aug 19, 2016 1:55:15 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 110304
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
r63599 r63601 1437 1437 fResult = keyEvent(ks, uScan, iflags, uScreenId); 1438 1438 1439 break;1440 }1441 /* Watch for mouse-events: */1442 case XCB_BUTTON_PRESS:1443 {1444 /* Do nothing if mouse is actively grabbed: */1445 if (uisession()->isMouseCaptured())1446 break;1447 1448 /* If we see a mouse press outside of our views while the mouse is not1449 * captured, release the keyboard before letting the event owner see it.1450 * This is because some owners cannot deal with failures to grab the1451 * keyboard themselves (e.g. window managers dragging windows).1452 * Only works if we have passively grabbed the mouse button. */1453 1454 /* Cast to XCB key-event: */1455 xcb_button_press_event_t *pButtonEvent = static_cast<xcb_button_press_event_t*>(pMessage);1456 1457 /* Detect the widget which should receive the event actually: */1458 const QWidget *pWidget = qApp->widgetAt(pButtonEvent->root_x, pButtonEvent->root_y);1459 if (pWidget)1460 {1461 /* Redirect the event to corresponding widget: */1462 const QPoint pos = pWidget->mapFromGlobal(QPoint(pButtonEvent->root_x, pButtonEvent->root_y));1463 pButtonEvent->event = pWidget->effectiveWinId();1464 pButtonEvent->event_x = pos.x();1465 pButtonEvent->event_y = pos.y();1466 xcb_ungrab_pointer_checked(QX11Info::connection(), pButtonEvent->time);1467 break;1468 }1469 /* Else if the event happened outside of our view areas then release the keyboard,1470 * but capture it again (delayed) immediately. If the event causes us to loose the1471 * focus then the delayed capture will not happen: */1472 releaseKeyboard();1473 captureKeyboard(uScreenId);1474 /* And re-send the event so that the window which it was meant for actually gets it: */1475 xcb_allow_events_checked(QX11Info::connection(), XCB_ALLOW_REPLAY_POINTER, pButtonEvent->time);1476 1439 break; 1477 1440 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r63579 r63601 2012 2012 case XCB_KEY_PRESS: 2013 2013 case XCB_KEY_RELEASE: 2014 case XCB_BUTTON_PRESS: // TODO: Move to mouse-filter case!2015 2014 { 2016 2015 /* Delegate key-event handling to the keyboard-handler: */ 2017 2016 return machineLogic()->keyboardHandler()->nativeEventFilter(pMessage, screenId()); 2017 } 2018 /* Watch for button-events: */ 2019 case XCB_BUTTON_PRESS: 2020 case XCB_BUTTON_RELEASE: 2021 { 2022 /* Delegate button-event handling to the mouse-handler: */ 2023 return machineLogic()->mouseHandler()->nativeEventFilter(pMessage, screenId()); 2018 2024 } 2019 2025 default: -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
r63580 r63601 23 23 # include <QMouseEvent> 24 24 # include <QTimer> 25 # if defined(VBOX_WS_X11) && QT_VERSION >= 0x050000 26 # include <QX11Info> 27 # endif 25 28 26 29 /* GUI includes: */ … … 71 74 # undef FocusOut 72 75 # endif /* FocusOut */ 73 # endif /* QT_VERSION < 0x050000 */ 74 #endif /* VBOX_WS_X11 */ 76 # else 77 # include <xcb/xcb.h> 78 # endif 79 #endif 75 80 76 81 … … 357 362 # elif defined(VBOX_WS_X11) 358 363 359 /* Nothing for now. */ 360 RT_NOREF(pMessage, uScreenId); 364 /* Cast to XCB event: */ 365 xcb_generic_event_t *pEvent = static_cast<xcb_generic_event_t*>(pMessage); 366 367 /* Depending on event type: */ 368 switch (pEvent->response_type & ~0x80) 369 { 370 /* Watch for button-events: */ 371 case XCB_BUTTON_PRESS: 372 { 373 /* Do nothing if mouse is actively grabbed: */ 374 if (uisession()->isMouseCaptured()) 375 break; 376 377 /* If we see a mouse press outside of our views while the mouse is not 378 * captured, release the keyboard before letting the event owner see it. 379 * This is because some owners cannot deal with failures to grab the 380 * keyboard themselves (e.g. window managers dragging windows). 381 * Only works if we have passively grabbed the mouse button. */ 382 383 /* Cast to XCB button-event: */ 384 xcb_button_press_event_t *pButtonEvent = static_cast<xcb_button_press_event_t*>(pMessage); 385 386 /* Detect the widget which should receive the event actually: */ 387 const QWidget *pWidget = qApp->widgetAt(pButtonEvent->root_x, pButtonEvent->root_y); 388 if (pWidget) 389 { 390 /* Redirect the event to corresponding widget: */ 391 const QPoint pos = pWidget->mapFromGlobal(QPoint(pButtonEvent->root_x, pButtonEvent->root_y)); 392 pButtonEvent->event = pWidget->effectiveWinId(); 393 pButtonEvent->event_x = pos.x(); 394 pButtonEvent->event_y = pos.y(); 395 xcb_ungrab_pointer_checked(QX11Info::connection(), pButtonEvent->time); 396 break; 397 } 398 /* Else if the event happened outside of our view areas then release the keyboard, 399 * but capture it again (delayed) immediately. If the event causes us to loose the 400 * focus then the delayed capture will not happen: */ 401 machineLogic()->keyboardHandler()->releaseKeyboard(); 402 machineLogic()->keyboardHandler()->captureKeyboard(uScreenId); 403 /* And re-send the event so that the window which it was meant for actually gets it: */ 404 xcb_allow_events_checked(QX11Info::connection(), XCB_ALLOW_REPLAY_POINTER, pButtonEvent->time); 405 break; 406 } 407 default: 408 break; 409 } 361 410 362 411 # else
Note:
See TracChangeset
for help on using the changeset viewer.