Changeset 53931 in vbox
- Timestamp:
- Jan 22, 2015 5:24:21 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r53921 r53931 962 962 #ifdef Q_WS_MAC 963 963 /* Due to Qt 4.x doesn't supports HiDPI directly 964 * we should take the backing-scale-factor into account: */ 964 * we should take the backing-scale-factor into account. 965 * See also viewportToContents()... */ 965 966 if (gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid())) 966 967 { … … 983 984 QPoint UIMachineView::viewportToContents(const QPoint &vp) const 984 985 { 985 return QPoint(vp.x() + contentsX(), vp.y() + contentsY()); 986 /* Get physical contents shifts of scroll-bars: */ 987 int iContentsX = contentsX(); 988 int iContentsY = contentsY(); 989 990 #ifdef Q_WS_MAC 991 /* Due to Qt 4.x doesn't supports HiDPI directly 992 * we should take the backing-scale-factor into account. 993 * See also updateSliders()... */ 994 if (gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid())) 995 { 996 const double dBackingScaleFactor = darwinBackingScaleFactor(machineWindow()); 997 if (dBackingScaleFactor > 1.0) 998 { 999 iContentsX /= dBackingScaleFactor; 1000 iContentsY /= dBackingScaleFactor; 1001 } 1002 } 1003 #endif /* Q_WS_MAC */ 1004 1005 /* Return point shifted according scroll-bars: */ 1006 return QPoint(vp.x() + iContentsX, vp.y() + iContentsY); 986 1007 } 987 1008 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
r53447 r53931 928 928 QPoint cpnt = m_views[uScreenId]->viewportToContents(relativePos); 929 929 930 /* Determine scaling: */ 931 UIFrameBuffer *pFrameBuffer = m_views[uScreenId]->frameBuffer(); 932 QSize scaledSize = pFrameBuffer->scaledSize(); 933 double xRatio = scaledSize.isValid() ? (double)pFrameBuffer->width() / (double)scaledSize.width() : 1; 934 double yRatio = scaledSize.isValid() ? (double)pFrameBuffer->height() / (double)scaledSize.height() : 1; 935 /* Set scaling if scale-factor is present: */ 936 cpnt.setX((int)(cpnt.x() * xRatio)); 937 cpnt.setY((int)(cpnt.y() * yRatio)); 930 /* Take the scale-factor(s) into account: */ 931 const UIFrameBuffer *pFrameBuffer = m_views[uScreenId]->frameBuffer(); 932 if (pFrameBuffer) 933 { 934 const QSize scaledSize = pFrameBuffer->scaledSize(); 935 if (scaledSize.isValid()) 936 { 937 const double xScaleFactor = (double)scaledSize.width() / pFrameBuffer->width(); 938 const double yScaleFactor = (double)scaledSize.height() / pFrameBuffer->height(); 939 cpnt.setX(cpnt.x() / xScaleFactor); 940 cpnt.setY(cpnt.y() / yScaleFactor); 941 } 942 } 943 944 #ifdef Q_WS_MAC 945 /* Take the backing-scale-factor into account: */ 946 if (gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid())) 947 { 948 const double dBackingScaleFactor = darwinBackingScaleFactor(m_windows.value(uScreenId)); 949 if (dBackingScaleFactor > 1.0) 950 { 951 cpnt.setX(cpnt.x() * dBackingScaleFactor); 952 cpnt.setY(cpnt.y() * dBackingScaleFactor); 953 } 954 } 955 #endif /* Q_WS_MAC */ 938 956 939 957 #ifdef VBOX_WITH_DRAG_AND_DROP … … 969 987 cpnt.setX(cpnt.x() + xShift); 970 988 cpnt.setY(cpnt.y() + yShift); 971 972 #ifdef Q_WS_MAC973 /* Take the backing-scale-factor into account: */974 if (gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid()))975 {976 const double dBackingScaleFactor = darwinBackingScaleFactor(m_windows.value(uScreenId));977 if (dBackingScaleFactor > 1.0)978 cpnt *= dBackingScaleFactor;979 }980 #endif /* Q_WS_MAC */981 989 982 990 /* Post absolute mouse-event into guest: */
Note:
See TracChangeset
for help on using the changeset viewer.