Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shift was tranferred to the device in an old version (aug 18), then no more #879

Closed
giogio02 opened this issue Oct 22, 2019 · 6 comments
Closed

Comments

@giogio02
Copy link

Or is there an option I haven't seen?
Using shift makes writing uppercase letters a lot easier

@rom1v
Copy link
Collaborator

rom1v commented Oct 22, 2019

Shift was tranferred to the device in an old version

The shift key have never been forwarded directly to the device. Here is the code of v1.0:
https://github.com/Genymobile/scrcpy/blob/v1.0/app/src/inputmanager.c#L164-L167

Using shift makes writing uppercase letters a lot easier

Text is sent as text, not as a combination of key events: https://blog.rom1v.com/2018/03/introducing-scrcpy/#handle-text-input

So, when you press Shift+a, the text A is sent to the device.

If it does not work, what do you observe exactly?

@giogio02
Copy link
Author

shift+a = a
CapsLock then a = a
v. 1.3 was fine, instead.

@rom1v
Copy link
Collaborator

rom1v commented Oct 22, 2019

OK, so this is related to #87 (comment).

Since this commit, letters are sent as raw key events (including their modifiers like shift) instead of as text.

However, they include the modifiers, so shift should be taken into account.

What is the keyboard layout on your device and on your computer?

If you apply this patch, build, run, and press shift+a, could you post what is printed in the console, please?

diff --git a/app/src/event_converter.c b/app/src/event_converter.c
index da4b2e3..65e6075 100644
--- a/app/src/event_converter.c
+++ b/app/src/event_converter.c
@@ -1,6 +1,7 @@
 #include "event_converter.h"
 
 #include "config.h"
+#include "log.h"
 
 #define MAP(FROM, TO) case FROM: *to = TO; return true
 #define FAIL default: return false
@@ -172,6 +173,11 @@ convert_input_key(const SDL_KeyboardEvent *from, struct control_msg *to) {
     }
 
     to->inject_keycode.metastate = convert_meta_state(mod);
+    LOGD("key (action=%x): %x [mod=%x, metastate=%x]",
+          (int) from->type,
+          (int) from->keysym.sym,
+          (int) from->keysym.mod,
+          (int) to->inject_keycode.metastate);
 
     return true;
 }

@giogio02
Copy link
Author

I have Italian kbd on Win10... so I can't rebuild

@rom1v
Copy link
Collaborator

rom1v commented May 25, 2020

Does --prefer-text solve your problem?

@rom1v
Copy link
Collaborator

rom1v commented Oct 27, 2021

Shift is forwarded to the device since v1.15 (d4ca85d).

@rom1v rom1v closed this as completed Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants