Interface IEventSimulationProvider
Represents a provider of low-level event simulation functionality.
public interface IEventSimulationProvider
Methods
GetPostTextDelayX11()
Gets the delay (in nanoseconds) between posting individual characters when posting text on Linux.
ulong GetPostTextDelayX11()
Returns
- ulong
The delay (in nanoseconds) between posting individual characters when posting text on Linux.
Remarks
X11 doesn't support posting arbitrary Unicode characters directly. Instead, for each character, an unused key code is remapped to that character, and then key press/release is simulated. Since the receiving application must react to the remapping, and may not do so instantaneously, a delay is needed for accurate simulation.
The default delay is 50 milliseconds.
On Windows and macOS this method always returns 0
.
- See Also
PostEvent(ref UioHookEvent)
Posts a fake input event.
UioHookResult PostEvent(ref UioHookEvent e)
Parameters
e
UioHookEventThe event to post.
Returns
- UioHookResult
The result of the operation.
Remarks
The instance of the event doesn't need all fields to have value. Only Type, Keyboard/Mouse/Wheel should be present.
The following table describes the specifics of simulating each event type.
Event type | Description |
---|---|
HookEnabled | Events of this type are ignored. |
HookDisabled | Events of this type are ignored. |
KeyPressed | Only KeyCode is considered. |
KeyReleased | Only KeyCode is considered. |
KeyTyped | Events of this type are ignored. PostText(string) should be used to post Unicode characters. |
MousePressed | Only X, Y, and Button are considered. |
MouseReleased | Only X, Y, and Button are considered. |
MouseClicked | Events of this type are ignored. |
MouseMoved | Only X and Y are considered. |
MouseDragged | Not recommended to use; same as MouseMoved. |
MouseWheel | Only Rotation, Direction, and Type are considered. |
- See Also
PostText(string)
Simulates the input of arbitrary Unicode characters.
UioHookResult PostText(string text)
Parameters
text
stringThe text to simulate.
Returns
- UioHookResult
The result of the operation.
Remarks
The text to simulate doesn't depend on the current keyboard layout. The full range of UTF-16 (including surrogate pairs, e.g. emojis) is supported.
On Windows text simulation should work correctly and consistently.
On macOS applications are not required to process text simulation, but most of them should handle it correctly.
X11 doesn't support text simulation directly. Instead, for each character, an unused key code is remapped to that character, and then key press/release is simulated. Since the receiving application must react to the remapping, and may not do so instantaneously, a delay is needed for accurate simulation. This means that text entry on Linux works slowly and is not guaranteed to be correct. SetPostTextDelayX11(ulong) can be used to increase (or decrease) the delay if needed - longer delays add consistency but may be more jarring to end users. GetPostTextDelayX11() can be used to get the currently configured delay - the default is 50 milliseconds.
- See Also
SetPostTextDelayX11(ulong)
Sets the delay (in nanoseconds) between posting individual characters when posting text on Linux.
void SetPostTextDelayX11(ulong delayNanoseconds)
Parameters
delayNanoseconds
ulongThe delay (in nanoseconds) between posting individual characters when posting text on Linux.
Remarks
X11 doesn't support posting arbitrary Unicode characters directly. Instead, for each character, an unused key code is remapped to that character, and then key press/release is simulated. Since the receiving application must react to the remapping, and may not do so instantaneously, a delay is needed for accurate simulation.
The default delay is 50 milliseconds.
On Windows and macOS this method does nothing.
- See Also