Remove SetFilterState from IDeviceHandler

device-handlers
Clive Galway 2 years ago
parent fcdacb1572
commit 12237abed7

@ -10,7 +10,7 @@ namespace AutoHotInterception.DeviceHandlers
protected IntPtr DeviceContext;
protected int DeviceId;
public bool IsFiltered { get; set; }
protected bool _isFiltered { get; set; }
// Holds MappingOptions for individual mouse button / keyboard key subscriptions
protected ConcurrentDictionary<ushort, MappingOptions> SingleButtonMappings = new ConcurrentDictionary<ushort, MappingOptions>();
@ -39,7 +39,7 @@ namespace AutoHotInterception.DeviceHandlers
WorkerThreads.TryAdd(code, new WorkerThread());
WorkerThreads[code].Start();
}
IsFiltered = true;
_isFiltered = true;
}
/// <summary>
@ -70,7 +70,7 @@ namespace AutoHotInterception.DeviceHandlers
DeviceWorkerThread = new WorkerThread();
DeviceWorkerThread.Start();
}
IsFiltered = true;
_isFiltered = true;
}
/// <summary>
@ -95,7 +95,7 @@ namespace AutoHotInterception.DeviceHandlers
public void SetContextCallback(dynamic callback)
{
ContextCallback = callback;
IsFiltered = true;
_isFiltered = true;
}
/// <summary>
@ -108,18 +108,9 @@ namespace AutoHotInterception.DeviceHandlers
}
// ToDo: Why is this IDeviceHandler.IsFiltered() and other Interface methods aren't?
int IDeviceHandler.IsFiltered()
public int IsFiltered()
{
return Convert.ToInt32(IsFiltered);
}
/// <summary>
/// Lets this device know if it is currently being filtered or not, and governs what IsFiltered() returns
/// </summary>
/// <param name="state">true for filtered, false for not filtered</param>
public void SetFilterState(bool state)
{
IsFiltered = state;
return Convert.ToInt32(_isFiltered);
}
/// <summary>

@ -11,12 +11,6 @@ namespace AutoHotInterception.DeviceHandlers
/// <returns>0 for not filtered, 1 for filtered</returns>
int IsFiltered();
/// <summary>
/// Lets this device know if it is currently being filtered or not, and governs what IsFiltered() returns
/// </summary>
/// <param name="state">true for filtered, false for not filtered</param>
void SetFilterState(bool state);
/// <summary>
/// Subscribes to a single key or button of this device
/// </summary>

@ -22,7 +22,7 @@ namespace AutoHotInterception.DeviceHandlers
&& SingleButtonMappings.Count == 0
&& ContextCallback == null)
{
IsFiltered = false;
_isFiltered = false;
}
}
@ -59,7 +59,7 @@ namespace AutoHotInterception.DeviceHandlers
// Process any waiting input for this keyboard
var block = false;
if (IsFiltered)
if (_isFiltered)
{
var isKeyMapping = false; // True if this is a mapping to a single key, else it would be a mapping to a whole device
var processedState = HelperFunctions.KeyboardStrokeToKeyboardState(stroke);

@ -29,7 +29,7 @@ namespace AutoHotInterception.DeviceHandlers
&& _mouseMoveRelativeMapping == null
&& _mouseMoveAbsoluteMapping == null)
{
IsFiltered = false;
_isFiltered = false;
}
}
@ -47,7 +47,7 @@ namespace AutoHotInterception.DeviceHandlers
WorkerThreads.TryAdd(7, new WorkerThread());
WorkerThreads[7].Start();
}
IsFiltered = true;
_isFiltered = true;
}
/// <summary>
@ -76,7 +76,7 @@ namespace AutoHotInterception.DeviceHandlers
WorkerThreads.TryAdd(8, new WorkerThread());
WorkerThreads[8].Start();
}
IsFiltered = true;
_isFiltered = true;
}
/// <summary>

@ -7,6 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Added
- Add RemoveContextManager() to remove a Context Manager
### Changed
- MAJOR changes to the code behind the scenes - the code is now organized way better, and key / button handling has been consolidated into the same code.
Nothing should have changed apart from what is listed in this changelog
- If you SubscribeKey to subscribe to a specific key on a device, and use SubscribeKeyboard to subscribe to all keys on the same device
Then SubscribeKey now takes precedence (SubscribeKey callback fires, and SubscribeKeyboard does not)
### Deprecated

Loading…
Cancel
Save