Skip to content

Commit

Permalink
fix button bug
Browse files Browse the repository at this point in the history
  • Loading branch information
leng-yue committed Aug 5, 2021
1 parent b1939d5 commit 0604f38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "scrcpy-client"
version = "0.2.6"
version = "0.2.7"
description = "A client of scrcpy"
authors = ["lengyue <[email protected]>"]
readme = "README.md"
Expand Down
9 changes: 5 additions & 4 deletions scrcpy_ui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ def on_click_stop(self):

def on_mouse_event(self, action=scrcpy.ACTION_DOWN):
def handler(evt: QMouseEvent):
focused_widget = QApplication.focusWidget()
if focused_widget is not None:
focused_widget.clearFocus()
self.client.control.touch(evt.position().x(), evt.position().y(), action)

return handler
Expand Down Expand Up @@ -94,16 +97,14 @@ def map_code(self, code):
}
if code in hard_code:
return hard_code[code]
print(code)

print(f"Unknown keycode: {code}")
return -1

def on_init(self):
self.setWindowTitle(f"Serial: {self.client.device_name}")

def on_frame(self, frame):
focused_widget = QApplication.focusWidget()
if focused_widget is not None:
focused_widget.clearFocus()
app.processEvents()

if frame is not None:
Expand Down

0 comments on commit 0604f38

Please sign in to comment.