summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrank Richter <frank.richter@gmail.com>2017-11-22 16:52:12 +0100
committerFrank Richter <frank.richter@gmail.com>2018-01-21 11:08:12 +0000
commit2e5294883b77a9274b473fb17afa51a7f56ccb8f (patch)
tree352aa1cea8eccd6ad3bdb009dad593e1a2bb3c64 /src
parent5e8bc07cb2ded1f5f74435411de666f419869514 (diff)
Windows QPA: Avoid 'large' mouse cursors over RDP
On some combinations of RDP client and server a large mouse cursor results in a hang of the RDP session. However, the 'touch' drag facility (creating a transparent window) works just fine, so use that when encountering a large cursor on RDP. (The threshold of 96 for a 'large' cursor was extracted from the spec, as that is the largest supported size mentioned.) Change-Id: I9782c45e8bd6640f36bb5a392961681a99e214e6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp
index aa6454ef63..777c45ae86 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.cpp
+++ b/src/plugins/platforms/windows/qwindowsdrag.cpp
@@ -246,7 +246,7 @@ private:
typedef QMap<Qt::DropAction, CursorEntry> ActionCursorMap;
- const Mode m_mode;
+ Mode m_mode;
QWindowsDrag *m_drag;
Qt::MouseButtons m_currentButtons;
ActionCursorMap m_cursors;
@@ -301,6 +301,15 @@ void QWindowsOleDropSource::createCursors()
Q_ASSERT(platformScreen);
QPlatformCursor *platformCursor = platformScreen->cursor();
+ if (GetSystemMetrics (SM_REMOTESESSION) != 0) {
+ /* Workaround for RDP issues with large cursors.
+ * Touch drag window seems to work just fine...
+ * 96 pixel is a 'large' mouse cursor, according to RDP spec */
+ const int rdpLargeCursor = qRound(qreal(96) / QHighDpiScaling::factor(platformScreen));
+ if (pixmap.width() > rdpLargeCursor || pixmap.height() > rdpLargeCursor)
+ m_mode = TouchDrag;
+ }
+
qreal pixmapScaleFactor = 1;
qreal hotSpotScaleFactor = 1;
if (m_mode != TouchDrag) { // Touch drag: pixmap is shown in a separate QWindow, which will be scaled.)
@@ -433,6 +442,9 @@ QWindowsOleDropSource::GiveFeedback(DWORD dwEffect)
SetCursor(e.cursor->handle());
break;
case TouchDrag:
+ // "Touch drag" with an unsuppressed cursor may happen with RDP (see createCursors())
+ if (QWindowsCursor::cursorState() != QWindowsCursor::CursorSuppressed)
+ SetCursor(nullptr);
if (!m_touchDragWindow)
m_touchDragWindow = new QWindowsDragCursorWindow;
m_touchDragWindow->setPixmap(e.pixmap);