|
|
|
@ -263,6 +263,7 @@ namespace AutoHotInterception
|
|
|
|
|
public void SubscribeMouseMoveAbsolute(int id, bool block, dynamic callback, bool concurrent = false)
|
|
|
|
|
{
|
|
|
|
|
HelperFunctions.IsValidDeviceId(true, id);
|
|
|
|
|
SetFilterState(false);
|
|
|
|
|
|
|
|
|
|
_mouseMoveAbsoluteMappings[id] = new MappingOptions
|
|
|
|
|
{Block = block, Concurrent = concurrent, Callback = callback};
|
|
|
|
@ -284,9 +285,13 @@ namespace AutoHotInterception
|
|
|
|
|
public void UnsubscribeMouseMoveAbsolute(int id)
|
|
|
|
|
{
|
|
|
|
|
HelperFunctions.IsValidDeviceId(true, id);
|
|
|
|
|
SetFilterState(false);
|
|
|
|
|
|
|
|
|
|
if (_mouseMoveAbsoluteMappings.TryRemove(id, out _))
|
|
|
|
|
if (!DeviceHasBindings(id))
|
|
|
|
|
SetDeviceFilterState(id, false);
|
|
|
|
|
SetFilterState(true);
|
|
|
|
|
SetThreadState(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Shorthand for SubscribeMouseMoveRelative
|
|
|
|
@ -332,6 +337,7 @@ namespace AutoHotInterception
|
|
|
|
|
public void UnsubscribeMouseMoveRelative(int id)
|
|
|
|
|
{
|
|
|
|
|
HelperFunctions.IsValidDeviceId(true, id);
|
|
|
|
|
SetFilterState(false);
|
|
|
|
|
|
|
|
|
|
if (_mouseMoveRelativeMappings.TryRemove(id, out _))
|
|
|
|
|
if (!DeviceHasBindings(id))
|
|
|
|
@ -680,10 +686,10 @@ namespace AutoHotInterception
|
|
|
|
|
|
|
|
|
|
while (ManagedWrapper.Receive(_deviceContext, i, ref stroke, 1) > 0)
|
|
|
|
|
{
|
|
|
|
|
if (!isMonitoredMouse) continue;
|
|
|
|
|
|
|
|
|
|
var moveRemoved = false;
|
|
|
|
|
var hasMove = false;
|
|
|
|
|
if (isMonitoredMouse)
|
|
|
|
|
{
|
|
|
|
|
var x = stroke.mouse.x;
|
|
|
|
|
var y = stroke.mouse.y;
|
|
|
|
|
//Debug.WriteLine($"AHK| Stroke Seen. State = {stroke.mouse.state}, Flags = {stroke.mouse.flags}, x={x}, y={y}");
|
|
|
|
@ -748,6 +754,7 @@ namespace AutoHotInterception
|
|
|
|
|
{
|
|
|
|
|
//debugStr += "Not Blocking";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Debug.WriteLine(debugStr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -777,6 +784,7 @@ namespace AutoHotInterception
|
|
|
|
|
{
|
|
|
|
|
//debugStr += "Not Blocking";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Debug.WriteLine(debugStr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -792,7 +800,8 @@ namespace AutoHotInterception
|
|
|
|
|
var btnStates = HelperFunctions.MouseStrokeToButtonStates(stroke);
|
|
|
|
|
foreach (var btnState in btnStates)
|
|
|
|
|
{
|
|
|
|
|
if (!isMouseButtonsMapping && !_mouseButtonMappings[i].ContainsKey(btnState.Button)) continue;
|
|
|
|
|
if (!isMouseButtonsMapping && !_mouseButtonMappings[i].ContainsKey(btnState.Button))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
hasSubscription = true;
|
|
|
|
|
MappingOptions mapping = null;
|
|
|
|
@ -811,7 +820,8 @@ namespace AutoHotInterception
|
|
|
|
|
{
|
|
|
|
|
if (isMouseButtonsMapping)
|
|
|
|
|
{
|
|
|
|
|
ThreadPool.QueueUserWorkItem(threadProc => mapping.Callback(btnState.Button, state.State));
|
|
|
|
|
ThreadPool.QueueUserWorkItem(threadProc =>
|
|
|
|
|
mapping.Callback(btnState.Button, state.State));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -840,12 +850,14 @@ namespace AutoHotInterception
|
|
|
|
|
// If we are removing a mouse wheel event, then set rolling to 0 if no mouse wheel event left
|
|
|
|
|
if (btnState.Flag == 0x400 || btnState.Flag == 0x800)
|
|
|
|
|
{
|
|
|
|
|
if ((stroke.mouse.state & 0x400) != 0x400 && (stroke.mouse.state & 0x800) != 0x800)
|
|
|
|
|
if ((stroke.mouse.state & 0x400) != 0x400 &&
|
|
|
|
|
(stroke.mouse.state & 0x800) != 0x800)
|
|
|
|
|
{
|
|
|
|
|
//Debug.WriteLine("AHK| Removing rolling flag from stroke");
|
|
|
|
|
stroke.mouse.rolling = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Debug.WriteLine($"AHK| Removing flag {btnState.Flag} from stoke, leaving state {stroke.mouse.state}");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -854,7 +866,7 @@ namespace AutoHotInterception
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Forward on the stroke if required
|
|
|
|
|
if (hasSubscription)
|
|
|
|
|