Press COPY on "get clipboard" request if possible

If the device runs at least Android 7, just press COPY on the device
(the clipboard content will be sent via the clipboard listener).

<https://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_COPY>
This commit is contained in:
Romain Vimont
2020-05-29 22:46:08 +02:00
parent 31cee2c49f
commit 9badd2bdf0
11 changed files with 65 additions and 19 deletions

View File

@@ -102,9 +102,10 @@ collapse_notification_panel(struct controller *controller) {
}
static void
request_device_clipboard(struct controller *controller) {
request_device_clipboard(struct controller *controller, bool copy) {
struct control_msg msg;
msg.type = CONTROL_MSG_TYPE_GET_CLIPBOARD;
msg.get_clipboard.copy = copy;
if (!controller_push_msg(controller, &msg)) {
LOGW("Could not request device clipboard");
@@ -341,7 +342,8 @@ input_manager_process_key(struct input_manager *im,
return;
case SDLK_c:
if (control && !shift && !repeat && down) {
request_device_clipboard(controller);
// Press COPY, then get the clipboard content
request_device_clipboard(controller, true);
}
return;
case SDLK_v: