summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Benditovich <yuri.benditovich@daynix.com>2020-02-27 12:02:55 +0200
committerFrediano Ziglio <fziglio@redhat.com>2020-03-02 16:52:13 +0000
commit96a8fcf04f5bc4621e918658482dbac105827058 (patch)
tree6a00d973cf37b87f3bf0d91f32035b7d25332bbf
parente318b56cb8f69ac9d649f6b93d058a579d6bfa57 (diff)
Remap the pointer in case of rotated screen
https://bugzilla.redhat.com/show_bug.cgi?id=1791804 The remapping will work only when the driver controls the placement of drawn pointer, i.e. when the input device in VM is usb-mouse and the Spice Agent is not active. Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com> Acked-by: Marek Kedzierski <mkedzier@redhat.com>
-rwxr-xr-xqxldod/QxlDod.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index 6e97360..7f03ee1 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -557,7 +557,31 @@ NTSTATUS QxlDod::SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pSetP
QXL_ASSERT(pSetPointerPosition != NULL);
QXL_ASSERT(pSetPointerPosition->VidPnSourceId < MAX_VIEWS);
-
+ DXGKARG_SETPOINTERPOSITION adjusted;
+ if (m_CurrentModes[pSetPointerPosition->VidPnSourceId].Rotation == D3DKMDT_VPPR_ROTATE90)
+ {
+ adjusted = *pSetPointerPosition;
+ adjusted.Y = m_CurrentModes[pSetPointerPosition->VidPnSourceId].SrcModeHeight - pSetPointerPosition->X;
+ adjusted.X = pSetPointerPosition->Y;
+ DbgPrint(TRACE_LEVEL_INFORMATION, ("%s: src %d,%d -> %d,%d\n", __FUNCTION__,
+ pSetPointerPosition->X, pSetPointerPosition->Y,
+ adjusted.X, adjusted.Y));
+ pSetPointerPosition = &adjusted;
+ }
+ else if (m_CurrentModes[pSetPointerPosition->VidPnSourceId].Rotation == D3DKMDT_VPPR_ROTATE180)
+ {
+ adjusted = *pSetPointerPosition;
+ adjusted.Y = m_CurrentModes[pSetPointerPosition->VidPnSourceId].SrcModeHeight - pSetPointerPosition->Y;
+ adjusted.X = m_CurrentModes[pSetPointerPosition->VidPnSourceId].SrcModeWidth - pSetPointerPosition->X;
+ pSetPointerPosition = &adjusted;
+ }
+ else if (m_CurrentModes[pSetPointerPosition->VidPnSourceId].Rotation == D3DKMDT_VPPR_ROTATE270)
+ {
+ adjusted = *pSetPointerPosition;
+ adjusted.Y = pSetPointerPosition->X;
+ adjusted.X = m_CurrentModes[pSetPointerPosition->VidPnSourceId].SrcModeWidth - pSetPointerPosition->Y;
+ pSetPointerPosition = &adjusted;
+ }
return m_pHWDevice->SetPointerPosition(pSetPointerPosition);
}