Commit Graph

11 Commits (4d2c2514fc466fc1dd8cfb972c2697a843e28d70)

Author SHA1 Message Date
Romain Vimont 4d2c2514fc Initialize controller in two steps
There is a dependency cycle in the initialization order:
 - keyboard depends on controller
 - controller depends on acksync
 - acksync depends on keyboard initialization

To break this cycle, bind the async instance to the controller in a
second step.

PR #4473 <https://github.com/Genymobile/scrcpy/pull/4473>
3 months ago
Romain Vimont e91618586c Prefix receiver by sc_
Like all other components in scrcpy.
1 year ago
Romain Vimont fa5b2a29e9 Add missing SC_ prefix to header guards 2 years ago
Romain Vimont 5d17bcf1bc Wait SET_CLIPBOARD ack before Ctrl+v via HID
To allow seamless copy-paste, on Ctrl+v, a SET_CLIPBOARD request is
performed before injecting Ctrl+v.

But when HID keyboard is enabled, the Ctrl+v injection is not sent on
the same channel as the clipboard request, so they are not serialized,
and may occur in any order. If Ctrl+v happens to be injected before the
new clipboard content is set, then the old content is pasted instead,
which is incorrect.

To minimize the probability of occurrence of the wrong order, a delay of
2 milliseconds was added before injecting Ctrl+v. Then 5ms. But even
with 5ms, the wrong behavior sometimes happens.

To handle it properly, add an acknowledgement mechanism, so that Ctrl+v
is injected over AOA only after the SET_CLIPBOARD request has been
performed and acknowledged by the server.

Refs e4163321f0
Refs 45b0f8123a

PR #2814 <https://github.com/Genymobile/scrcpy/pull/2814>
3 years ago
Romain Vimont 3adff37c2d Use sc_ prefix for sockets
Rename:
 - socket_t to sc_socket
 - INVALID_SOCKET to SC_INVALID_SOCKET
3 years ago
Romain Vimont f6320c7e31 Wrap SDL thread functions into scrcpy-specific API
The goal is to expose a consistent API for system tools, and paves the
way to make the "core" independant of SDL in the future.
3 years ago
Romain Vimont ab912c23e7 Define feature test macros in common.h
This enables necessary functions once for all.

As a consequence, define common.h before any other header.
3 years ago
Romain Vimont 59feb2a15c Group common includes into common.h
Include config.h and compat.h in common.h, and include common.h from all
source files.
3 years ago
Romain Vimont dfd0707a29 Move utilities to util/ 5 years ago
Romain Vimont 1f8ba1ca79 Include config.h everywhere
Ref: <https://github.com/Genymobile/scrcpy/issues/829>

Suggested-by: Louis Kruger <louisk@gmail.com>
5 years ago
Romain Vimont 6112095e75 Add device event receiver
Create a separate component to handle device events, managed by the
controller.
5 years ago