[Spice-devel] [PATCH v2 2/2] qxl-wdm-dod: Fix double mouse pointer when moving window

Yuri Benditovich yuri.benditovich at daynix.com
Mon Nov 21 14:04:34 UTC 2016


The driver saves 'visible' state of the pointer and sends
HIDE command when the pointer becomes invisible.

Signed-off-by: Yuri Benditovich <yuri.benditovich at daynix.com>
---
 qxldod/QxlDod.cpp | 38 +++++++++++++++++++++++++-------------
 qxldod/QxlDod.h   |  2 ++
 2 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index 724e89f..1fd2941 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -434,11 +434,6 @@ NTSTATUS QxlDod::SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pSetP
     QXL_ASSERT(pSetPointerPosition != NULL);
     QXL_ASSERT(pSetPointerPosition->VidPnSourceId < MAX_VIEWS);
 
-    if (!(pSetPointerPosition->Flags.Visible))
-    {
-        DbgPrint(TRACE_LEVEL_INFORMATION, ("<--- %s Cursor is not visible\n", __FUNCTION__));
-        return STATUS_SUCCESS;
-    }
     return m_pHWDevice->SetPointerPosition(pSetPointerPosition);
 }
 
@@ -2970,6 +2965,7 @@ QxlDevice::QxlDevice(_In_ QxlDod* pQxlDod)
     m_CustomMode = 0;
     m_FreeOutputs = 0;
     m_Pending = 0;
+    m_bPointerVisible = TRUE;
 }
 
 QxlDevice::~QxlDevice(void)
@@ -4499,6 +4495,13 @@ NTSTATUS  QxlDevice::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPoi
 
 NTSTATUS QxlDevice::SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pSetPointerPosition)
 {
+    BOOLEAN bIsVisible =
+        pSetPointerPosition->Flags.Visible &&
+        pSetPointerPosition->X >= 0;
+    BOOLEAN bTurnOff = !bIsVisible && m_bPointerVisible;
+    BOOLEAN bSkip = !bIsVisible && !m_bPointerVisible;
+    m_bPointerVisible = bIsVisible;
+
     PAGED_CODE();
     DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
     DbgPrint(TRACE_LEVEL_INFORMATION, ("<--> %s flag = %d id = %d, x = %d, y = %d\n", __FUNCTION__,
@@ -4506,15 +4509,24 @@ NTSTATUS QxlDevice::SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pS
                                  pSetPointerPosition->VidPnSourceId,
                                  pSetPointerPosition->X,
                                  pSetPointerPosition->Y));
-    QXLCursorCmd *cursor_cmd = CursorCmd();
-    if (pSetPointerPosition->X < 0) {
-        cursor_cmd->type = QXL_CURSOR_HIDE;
-    } else {
-        cursor_cmd->type = QXL_CURSOR_MOVE;
-        cursor_cmd->u.position.x = (INT16)pSetPointerPosition->X;
-        cursor_cmd->u.position.y = (INT16)pSetPointerPosition->Y;
+
+    if (!bSkip) {
+        QXLCursorCmd *cursor_cmd = CursorCmd();
+
+        if (bTurnOff) {
+            cursor_cmd->type = QXL_CURSOR_HIDE;
+        }
+        else {
+            cursor_cmd->type = QXL_CURSOR_MOVE;
+            cursor_cmd->u.position.x = (INT16)pSetPointerPosition->X;
+            cursor_cmd->u.position.y = (INT16)pSetPointerPosition->Y;
+        }
+        PushCursorCmd(cursor_cmd);
     }
-    PushCursorCmd(cursor_cmd);
+    else {
+        DbgPrint(TRACE_LEVEL_VERBOSE, ("Skip command\n", __FUNCTION__));
+    }
+
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
     return STATUS_SUCCESS;
 }
diff --git a/qxldod/QxlDod.h b/qxldod/QxlDod.h
index 8503f29..1610fe6 100755
--- a/qxldod/QxlDod.h
+++ b/qxldod/QxlDod.h
@@ -601,6 +601,8 @@ private:
 
     QXLMonitorsConfig* m_monitor_config;
     QXLPHYSICAL* m_monitor_config_pa;
+
+    BOOLEAN m_bPointerVisible;
 };
 
 class QxlDod {
-- 
2.7.0.windows.1



More information about the Spice-devel mailing list