Updated wintab32-improvements patchset

This commit is contained in:
Alistair Leslie-Hughes
2019-04-05 14:41:32 +11:00
parent bfdd49203c
commit ac1bb98de4
2 changed files with 21 additions and 9 deletions

View File

@@ -1,17 +1,16 @@
From dd5371720cce8910281a79d860d1fcb45acc1767 Mon Sep 17 00:00:00 2001
From d4f6b48e80e18404bb3a48d5861f3e6998d179a8 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Wed, 3 Apr 2019 16:43:30 +1100
Subject: [PATCH] wintab32: Scale NormalPressure before sending to the client.
We need to workout how to get valid Min/Max Pressure values that are the
same value as windows.
---
dlls/winex11.drv/wintab.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
dlls/winex11.drv/wintab.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c
index 3517bd53cef..380562e9597 100644
index 3517bd5..5e823e1 100644
--- a/dlls/winex11.drv/wintab.c
+++ b/dlls/winex11.drv/wintab.c
@@ -925,7 +925,11 @@ static BOOL motion_event( HWND hwnd, XEvent *event )
@@ -20,13 +19,26 @@ index 3517bd53cef..380562e9597 100644
}
- gMsgPacket.pkNormalPressure = motion->axis_data[2];
+ /* Scale the value sent from XInput 0-65536
+ * Windows 0-1043
+ * Windows 0-1023
+ */
+ gMsgPacket.pkNormalPressure = ((motion->axis_data[2] - gSysDevice.NPRESSURE.axMin) /
+ ((float)gSysDevice.NPRESSURE.axMax - gSysDevice.NPRESSURE.axMin)) * 1043;
+ ((float)gSysDevice.NPRESSURE.axMax - gSysDevice.NPRESSURE.axMin)) * 1023;
gMsgPacket.pkButtons = get_button_state(curnum);
gMsgPacket.pkChanged = get_changed_state(&gMsgPacket);
SendMessageW(hwndTabletDefault,WT_PACKET,gMsgPacket.pkSerialNumber,(LPARAM)hwnd);
@@ -1009,7 +1013,11 @@ static BOOL proximity_event( HWND hwnd, XEvent *event )
FIXME("Negative orAltitude detected\n");
return FALSE;
}
- gMsgPacket.pkNormalPressure = proximity->axis_data[2];
+ /* Scale the value sent from XInput 0-65536
+ * Windows 0-1023
+ */
+ gMsgPacket.pkNormalPressure = ((proximity->axis_data[2] - gSysDevice.NPRESSURE.axMin) /
+ ((float)gSysDevice.NPRESSURE.axMax - gSysDevice.NPRESSURE.axMin)) * 1023;
gMsgPacket.pkButtons = get_button_state(curnum);
/* FIXME: LPARAM loword is true when cursor entering context, false when leaving context
--
2.20.1
1.9.1