mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-03 06:39:39 +00:00
WIP Synchronize keyboard on Ctrl+v
This commit is contained in:
parent
a98b74df3d
commit
b330ba448b
1 changed files with 12 additions and 3 deletions
|
@ -268,6 +268,7 @@ input_manager_process_key(struct input_manager *im,
|
||||||
bool ctrl = event->keysym.mod & (KMOD_LCTRL | KMOD_RCTRL);
|
bool ctrl = event->keysym.mod & (KMOD_LCTRL | KMOD_RCTRL);
|
||||||
bool alt = event->keysym.mod & (KMOD_LALT | KMOD_RALT);
|
bool alt = event->keysym.mod & (KMOD_LALT | KMOD_RALT);
|
||||||
bool meta = event->keysym.mod & (KMOD_LGUI | KMOD_RGUI);
|
bool meta = event->keysym.mod & (KMOD_LGUI | KMOD_RGUI);
|
||||||
|
bool shift = event->keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT);
|
||||||
|
|
||||||
if (alt) {
|
if (alt) {
|
||||||
// No shortcuts involve Alt, and it is not forwarded to the device
|
// No shortcuts involve Alt, and it is not forwarded to the device
|
||||||
|
@ -276,6 +277,9 @@ input_manager_process_key(struct input_manager *im,
|
||||||
|
|
||||||
struct controller *controller = im->controller;
|
struct controller *controller = im->controller;
|
||||||
|
|
||||||
|
SDL_Keycode keycode = event->keysym.sym;
|
||||||
|
bool down = event->type == SDL_KEYDOWN;
|
||||||
|
|
||||||
// Capture all Meta events
|
// Capture all Meta events
|
||||||
if (meta) {
|
if (meta) {
|
||||||
if (ctrl) {
|
if (ctrl) {
|
||||||
|
@ -283,11 +287,8 @@ input_manager_process_key(struct input_manager *im,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Keycode keycode = event->keysym.sym;
|
|
||||||
bool down = event->type == SDL_KEYDOWN;
|
|
||||||
int action = down ? ACTION_DOWN : ACTION_UP;
|
int action = down ? ACTION_DOWN : ACTION_UP;
|
||||||
bool repeat = event->repeat;
|
bool repeat = event->repeat;
|
||||||
bool shift = event->keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT);
|
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case SDLK_h:
|
case SDLK_h:
|
||||||
if (control && !shift && !repeat) {
|
if (control && !shift && !repeat) {
|
||||||
|
@ -416,6 +417,14 @@ input_manager_process_key(struct input_manager *im,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(!meta);
|
||||||
|
|
||||||
|
if (ctrl && !shift && keycode == SDLK_v && down) {
|
||||||
|
// Synchronize the computer clipboard to the device clipboard before
|
||||||
|
// sending Ctrl+v
|
||||||
|
set_device_clipboard(controller, false);
|
||||||
|
}
|
||||||
|
|
||||||
struct control_msg msg;
|
struct control_msg msg;
|
||||||
if (convert_input_key(event, &msg, im->prefer_text)) {
|
if (convert_input_key(event, &msg, im->prefer_text)) {
|
||||||
if (!controller_push_msg(controller, &msg)) {
|
if (!controller_push_msg(controller, &msg)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue