Skip to content

Commit

Permalink
Fix initializing event loop in relays
Browse files Browse the repository at this point in the history
  • Loading branch information
quaxalber committed Dec 19, 2023
1 parent 95aff6b commit 603be5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bluetooth_2_usb/relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class DeviceRelay:
def __init__(self, input_device: InputDevice, grab_device: bool = False) -> None:
self._input_device = input_device
self._grab_device = grab_device
self._running_loop = asyncio.get_running_loop()
if grab_device:
self._input_device.grab()
if not all_gadgets_ready():
Expand Down Expand Up @@ -136,8 +137,7 @@ async def _async_relay_event(self, input_event: InputEvent) -> None:
elif isinstance(event, KeyEvent):
func = _send_key
if func:
loop = asyncio.get_running_loop()
await loop.run_in_executor(None, func, event)
await self._running_loop.run_in_executor(None, func, event)


def _move_mouse(event: RelEvent) -> None:
Expand Down

0 comments on commit 603be5c

Please sign in to comment.