- Timestamp:
- Jan 28, 2011 10:14:33 AM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin-cocoa.mm
r35740 r35750 334 334 } 335 335 336 bool darwinMouse MoveEvents(const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser)336 bool darwinMouseGrabEvents(const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser) 337 337 { 338 338 NSEvent *pEvent = (NSEvent*)pvCocoaEvent; … … 352 352 || EvtType == NSScrollWheel)) 353 353 { 354 /* When the mouse position is not associated to the mouse cursor, the x 355 and y values are reported as delta values. */ 354 356 float x = [pEvent deltaX]; 355 357 float y = [pEvent deltaY]; 356 /* Get the buttons which where pressed when this event occurs. We have357 to use Carbon here, cause the Cocoa method [NSEvent pressedMouseButtons]358 is >= 10.6. */359 358 if (EvtType == NSScrollWheel) 360 359 { … … 372 371 y = qBound(-120, (int)(y * 10000), 120); 373 372 } 373 /* Get the buttons which where pressed when this event occurs. We have 374 to use Carbon here, cause the Cocoa method [NSEvent pressedMouseButtons] 375 is >= 10.6. */ 374 376 uint32 buttonMask = 0; 375 377 GetEventParameter((EventRef)pvCarbonEvent, kEventParamMouseChord, typeUInt32, 0, 376 378 sizeof(buttonMask), 0, &buttonMask); 377 379 /* Produce a Qt event out of our info. */ 378 ::darwinSend DeltaEvents((QWidget*)pvUser, EvtType, [pEvent buttonNumber], buttonMask, x, y);380 ::darwinSendMouseGrabEvents((QWidget*)pvUser, EvtType, [pEvent buttonNumber], buttonMask, x, y); 379 381 return true; 380 382 } -
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.cpp
r35740 r35750 356 356 RT_BIT_32(27) | /* NSOtherMouseDragged */ 357 357 RT_BIT_32(22), /* NSScrollWheel */ 358 ::darwinMouse MoveEvents, pWidget);358 ::darwinMouseGrabEvents, pWidget); 359 359 } 360 360 … … 372 372 RT_BIT_32(27) | /* NSOtherMouseDragged */ 373 373 RT_BIT_32(22), /* NSScrollWheel */ 374 ::darwinMouse MoveEvents, pWidget);374 ::darwinMouseGrabEvents, pWidget); 375 375 CGAssociateMouseAndMouseCursorPosition(true); 376 376 } 377 377 378 void darwinSend DeltaEvents(QWidget *pWidget, int type, int button, int buttons, int x, int y)378 void darwinSendMouseGrabEvents(QWidget *pWidget, int type, int button, int buttons, int x, int y) 379 379 { 380 380 QEvent::Type qtType = QEvent::None; -
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.h
r35740 r35750 86 86 87 87 bool darwinUnifiedToolbarEvents(const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser); 88 bool darwinMouse MoveEvents(const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser);88 bool darwinMouseGrabEvents(const void *pvCocoaEvent, const void *pvCarbonEvent, void *pvUser); 89 89 void darwinCreateContextMenuEvent(void *pvWin, int x, int y); 90 90 … … 93 93 void darwinRetranslateAppMenu(); 94 94 95 void darwinSend DeltaEvents(QWidget *pWidget, int type, int button, int buttons, int x, int y);95 void darwinSendMouseGrabEvents(QWidget *pWidget, int type, int button, int buttons, int x, int y); 96 96 97 97 QString darwinResolveAlias(const QString &strFile); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
r35742 r35750 506 506 { 507 507 UIGrabMouseEvent *pDeltaEvent = static_cast<UIGrabMouseEvent*>(pEvent); 508 QPoint gl = m_lastMousePos; 509 QPoint p = QPoint(pDeltaEvent->xDelta() + gl.x(), 510 pDeltaEvent->yDelta() + gl.y()); 508 QPoint p = QPoint(pDeltaEvent->xDelta() + m_lastMousePos.x(), 509 pDeltaEvent->yDelta() + m_lastMousePos.y()); 511 510 if (mouseEvent(pDeltaEvent->mouseEventType(), uScreenId, 512 511 m_viewports[uScreenId]->mapFromGlobal(p), p, … … 514 513 pDeltaEvent->wheelDelta(), pDeltaEvent->orientation())) 515 514 return true; 516 //517 // QMouseEvent *pNewMouseEvent = new QMouseEvent(QEvent::MouseMove,518 // m_viewports[uScreenId]->mapFromGlobal(p), p,519 // Qt::NoButton,520 // Qt::NoButton,521 // Qt::NoModifier);522 //523 //524 // /* Send that event to real destination: */525 // QApplication::postEvent(m_viewports[uScreenId], pNewMouseEvent);526 return false;527 515 break; 528 516 }
Note:
See TracChangeset
for help on using the changeset viewer.