Skip to content

Commit

Permalink
Merge pull request #1 from filipeabperes/master
Browse files Browse the repository at this point in the history
Fixed key never releasing bug
  • Loading branch information
perara authored Jan 16, 2018
2 parents c57c3dc + 878a259 commit 04fb3c0
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion pyVNC/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,32 @@ def send_key(self, key, duration=0.001):
elif key in constants.KEYMAPPINGS:
self.screen.protocol.key_event(constants.KEYMAPPINGS[key], down=1)
elif type(key) == str:
self.screen.protocol.key_event(ord(key))
self.screen.protocol.key_event(ord(key), down=1)

time.sleep(duration)

if key in constants.MODIFIERS:
self.screen.protocol.key_event(constants.MODIFIERS[key], down=0)
elif key in constants.KEYMAPPINGS:
self.screen.protocol.key_event(constants.KEYMAPPINGS[key], down=0)
elif type(key) == str:
self.screen.protocol.key_event(ord(key), down=0)

def send_press(self, key):
if key in constants.MODIFIERS:
self.screen.protocol.key_event(constants.MODIFIERS[key], down=1)
elif key in constants.KEYMAPPINGS:
self.screen.protocol.key_event(constants.KEYMAPPINGS[key], down=1)
elif type(key) == str:
self.screen.protocol.key_event(ord(key), down=1)

def send_release(self, key):
if key in constants.MODIFIERS:
self.screen.protocol.key_event(constants.MODIFIERS[key], down=0)
elif key in constants.KEYMAPPINGS:
self.screen.protocol.key_event(constants.KEYMAPPINGS[key], down=0)
elif type(key) == str:
self.screen.protocol.key_event(ord(key), down=0)

def send_mouse(self, event="Left", position=(0, 0)):
# Left 1, Middle 2, Right 3,
Expand Down

0 comments on commit 04fb3c0

Please sign in to comment.