Prevent pressure from being emitted when pen tip is not binded

This commit is contained in:
X9VoiD 2022-06-20 14:22:23 +08:00
parent 96f5f3b6f9
commit 06da3c8c00
4 changed files with 9 additions and 3 deletions

View file

@ -37,6 +37,7 @@ namespace VoiDPlugins.OutputMode
SharedStore.TryAdd(POINTER, this);
SharedStore.TryAdd(ERASER_STATE, false);
SharedStore.TryAdd(MANUAL_ERASER, false);
SharedStore.TryAdd(TIP_PRESSED, false);
RawPointer = Instance.Pointer;
}
else
@ -77,6 +78,9 @@ namespace VoiDPlugins.OutputMode
{
Dirty = false;
if (!SharedStore.Get<bool>(TIP_PRESSED))
SetPressure(0);
if (ForcedSync)
SyncOSCursor();
Instance.Write();

View file

@ -37,7 +37,7 @@ namespace VoiDPlugins.OutputMode
}
catch
{
Log.Write("WinInk",
Log.WriteNotify("WinInk",
"Windows Ink bindings are being used without an active Windows Ink output mode.",
LogLevel.Error);
}
@ -52,6 +52,7 @@ namespace VoiDPlugins.OutputMode
switch (Button)
{
case "Pen Tip":
_sharedStore.Set(TIP_PRESSED, true);
_instance.EnableButtonBit((int)(eraserState ? WindowsInkButtonFlags.Eraser : WindowsInkButtonFlags.Press));
break;
@ -80,6 +81,7 @@ namespace VoiDPlugins.OutputMode
switch (Button)
{
case "Pen Tip":
_sharedStore.Set(TIP_PRESSED, false);
_instance.DisableButtonBit((int)(WindowsInkButtonFlags.Press | WindowsInkButtonFlags.Eraser));
break;

View file

@ -7,5 +7,6 @@ namespace VoiDPlugins.OutputMode
public const int POINTER = 1;
public const int ERASER_STATE = 2;
public const int MANUAL_ERASER = 3;
public const int TIP_PRESSED = 4;
}
}

View file

@ -58,8 +58,7 @@ namespace VoiDPlugins.Library.VMulti
if (VMultiDev == null)
{
Log.Write(Name, "Cannot find VirtualHID", LogLevel.Error);
Log.Write(Name, "Install VMulti driver here: https://github.com/X9VoiD/vmulti-bin/releases/latest", LogLevel.Error);
Log.WriteNotify(Name, "Cannot find VirtualHID. Install VMulti driver here: https://github.com/X9VoiD/vmulti-bin/releases/latest", LogLevel.Error);
}
return VMultiDev;