diff --git a/scrcpy/control.py b/scrcpy/control.py index 3c7f4c4..2c7ce67 100644 --- a/scrcpy/control.py +++ b/scrcpy/control.py @@ -61,7 +61,7 @@ def text(self, text: str) -> bytes: @inject(const.TYPE_INJECT_TOUCH_EVENT) def touch( - self, x: int, y: int, action: int = const.ACTION_DOWN, touch_id: int = -1 + self, x: int, y: int, action: int = const.ACTION_DOWN, touch_id: int = 0x1234567887654321 ) -> bytes: """ Touch screen @@ -74,7 +74,7 @@ def touch( """ x, y = max(x, 0), max(y, 0) return struct.pack( - ">BqiiHHHi", + ">BqiiHHHii", action, touch_id, int(x), @@ -83,6 +83,7 @@ def touch( int(self.parent.resolution[1]), 0xFFFF, 1, + 1, ) @inject(const.TYPE_INJECT_SCROLL_EVENT) diff --git a/scrcpy/core.py b/scrcpy/core.py index b1041b3..cb81f79 100644 --- a/scrcpy/core.py +++ b/scrcpy/core.py @@ -150,22 +150,19 @@ def __deploy_server(self) -> None: "app_process", "/", "com.genymobile.scrcpy.Server", - "1.20", # Scrcpy server version - "info", # Log level: info, verbose... - f"{self.max_width}", # Max screen width (long side) - f"{self.bitrate}", # Bitrate of video - f"{self.max_fps}", # Max frame per second - f"{self.lock_screen_orientation}", # Lock screen orientation: LOCK_SCREEN_ORIENTATION - "true", # Tunnel forward - "-", # Crop screen - "false", # Send frame rate to client - "true", # Control enabled - "0", # Display id - "false", # Show touches - "true" if self.stay_awake else "false", # Stay awake - "-", # Codec (video encoding) options - self.encoder_name or "-", # Encoder name - "false", # Power off screen after server closed + "2.4", # Scrcpy server version + "log_level=info", + f"max_size={self.max_width}", + f"max_fps={self.max_fps}", + f"video_bit_rate={self.bitrate}", + "tunnel_forward=true", + "send_frame_meta=false", + "control=true", + "audio=false", + "show_touches=false", + "stay_awake=false", + "power_off_on_close=false", + "clipboard_autosync=false" ] self.__server_stream: AdbConnection = self.device.shell( diff --git a/scrcpy/scrcpy-server.jar b/scrcpy/scrcpy-server.jar index d1d8016..1d867f8 100644 Binary files a/scrcpy/scrcpy-server.jar and b/scrcpy/scrcpy-server.jar differ diff --git a/scrcpy_ui/main.py b/scrcpy_ui/main.py index 06fb04b..7a205b7 100644 --- a/scrcpy_ui/main.py +++ b/scrcpy_ui/main.py @@ -7,7 +7,7 @@ import scrcpy -from .ui_main import Ui_MainWindow +from ui_main import Ui_MainWindow if not QApplication.instance(): app = QApplication([]) @@ -40,6 +40,7 @@ def __init__( flip=self.ui.flip.isChecked(), bitrate=1000000000, encoder_name=encoder_name, + max_fps=60 ) self.client.add_listener(scrcpy.EVENT_INIT, self.on_init) self.client.add_listener(scrcpy.EVENT_FRAME, self.on_frame)