Skip to content

Commit

Permalink
Fix input exception when browser window is unmapped
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Hejtmanek <xhejtman@gmail.com>
  • Loading branch information
xhejtman authored and danisla committed Apr 20, 2022
1 parent b629f70 commit 193651e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/selkies_gstreamer/webrtc_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ def send_mouse(self, action, data):
if action == MOUSE_POSITION:
# data is a tuple of (x, y)
# using X11 mouse even when virtual mouse is enabled for non-relative actions.
self.mouse.position = data
if self.mouse:
self.mouse.position = data
elif action == MOUSE_MOVE:
# data is a tuple of (x, y)
x, y = data
Expand Down Expand Up @@ -511,7 +512,12 @@ def on_message(self, msg):
relative = False
if toks[0] == "m2":
relative = True
self.send_x11_mouse(*[int(i) for i in toks[1:]], relative)
try:
x, y, button_mask = [int(i) for i in toks[1:]]
except:
x, y, button_mask = 0, 0, self.button_mask
relative = False
self.send_x11_mouse(x, y, button_mask, relative)
elif toks[0] == "p":
# toggle mouse pointer visibility
visible = bool(int(toks[1]))
Expand Down

0 comments on commit 193651e

Please sign in to comment.