Skip to content

Commit ac07bde

Browse files
committed
ATRONIX: Support async read from clipboard
In case that read doesn't returns the data immediately, it needs to move the data from port/state/data to port/data for later reading. Currently the implementation assumes that the clipboard can be read in one read when it's ready, which means a partial clipboard read is not allowed. (cherry picked from commit 2d7dc6e)
1 parent 4148634 commit ac07bde

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/core/p-clipboard.c

+18
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,24 @@
5050
req = Use_Port_State(port, RDI_CLIPBOARD, sizeof(REBREQ));
5151

5252
switch (action) {
53+
case A_UPDATE:
54+
// Update the port object after a READ or WRITE operation.
55+
// This is normally called by the WAKE-UP function.
56+
arg = OFV(port, STD_PORT_DATA);
57+
if (req->command == RDC_READ) {
58+
len = req->actual;
59+
if (GET_FLAG(req->flags, RRF_WIDE)) {
60+
len /= sizeof(REBUNI); //correct length
61+
// Copy the string (convert to latin-8 if it fits):
62+
Set_Binary(arg, Copy_Wide_Str(req->data, len));
63+
} else {
64+
Set_Binary(arg, Copy_OS_Str(req->data, len));
65+
}
66+
}
67+
else if (req->command == RDC_WRITE) {
68+
SET_NONE(arg); // Write is done.
69+
}
70+
return R_NONE;
5371

5472
case A_READ:
5573
// This device is opened on the READ:

0 commit comments

Comments
 (0)