-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
ALT key and Windows key Issue #5318
Comments
Alt is captured for scrcpy shortcuts by default (see If you change the shortcut mode, you can use Alt with UHID keyboard:
But it still not work with SDK keyboard. Probably I should change that now: diff --git a/app/src/keyboard_sdk.c b/app/src/keyboard_sdk.c
index 00b7f92af..2d9ca85b5 100644
--- a/app/src/keyboard_sdk.c
+++ b/app/src/keyboard_sdk.c
@@ -45,6 +45,10 @@ convert_keycode(enum sc_keycode from, enum android_keycode *to, uint16_t mod,
{SC_KEYCODE_RCTRL, AKEYCODE_CTRL_RIGHT},
{SC_KEYCODE_LSHIFT, AKEYCODE_SHIFT_LEFT},
{SC_KEYCODE_RSHIFT, AKEYCODE_SHIFT_RIGHT},
+ {SC_KEYCODE_LALT, AKEYCODE_ALT_LEFT},
+ {SC_KEYCODE_RALT, AKEYCODE_ALT_RIGHT},
+ {SC_KEYCODE_LGUI, AKEYCODE_META_LEFT},
+ {SC_KEYCODE_RGUI, AKEYCODE_META_RIGHT},
};
// Numpad navigation keys.
@@ -166,11 +170,7 @@ convert_keycode(enum sc_keycode from, enum android_keycode *to, uint16_t mod,
return false;
}
- if (mod & (SC_MOD_LALT | SC_MOD_RALT | SC_MOD_LGUI | SC_MOD_RGUI)) {
- return false;
- }
-
- // if ALT and META are not pressed, also handle letters and space
+ // Handle letters and space
entry = SC_INTMAP_FIND_ENTRY(alphaspace_keys, from);
if (entry) {
*to = entry->value; Could you try with this patch? (if you don't know how to, I can provide a binary) |
Try with this binary (replace in the v2.7 release):
Execute:
(for example, so that the shortcut mod is the right ctrl key) Now, you should be able to use Alt and Super. |
Hello, thank you for your kind reply. Using the new exe file and scrcpy --shortcut-mod=rctrl command you provided, I confirmed that ALT and Super Key are transmitted normally. But I still have concerns. I found the cause in the help.
According to the above, if I use UHID Mouse Mode in scrcpy, it seems to return mouse control to PC when I press Lalt, LSSuper or RSSuper Key. Sadly, I can't be satisfied with what I want in this situation. |
Yes, I think the mouse capture key should not be hardcoded to LAlt, LSuper or RSuper. I think it may be the same as the shortcut mod key (so if |
Even if I use --shortcut-mods=rctrl, if I use it with --mouse=uhid, I can't use the ALT key, so I think I need to modify the scrcpy source itself, but I don't know how to do it yet. |
Sure, but would that behavior (using the same key as shortcut mods for the mouse capture key) be ok to you? |
Yes, it would be nice if I could return the control of the mouse to the PC when I used the MOD Key (ex: rctrl) alone or entered it in combination with another key. |
Alt and Super (also named Meta) modifier keys are captured for shortcuts by default (cf --shortcut-mod). However, when shortcut modifiers are changed, Alt and Super should be forwarded to the device. This is the case for AOA and UHID keyboards, but it was not the case for SDK keyboard. Fixes #5318 <#5318>
Please test #5322. |
Hello, I'm telling you what I tested.
Thank you for your kindness. |
Thank you for your feedback.
👍
👍
I cannot reproduce on Linux. I guess the Windows environment captures Super for its own purpose (opening the "start menu" I guess?). It's weird that it both captures and send the event to the application though. Not sure I can do something about it with SDL.
👍
Yes, the Windows environment / window manager captures Alt+tab. There is a SDL hint (SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED), but whatever its value, I can't prevent Alt+tab to be captured by the system. At least, #5322 fixes forwarding of Alt and Super as expected with SDK keyboard (consistent with UHID/AOA keyboards). After that there are other issues because the system may also capture these keys. |
Hello.
I can't send the ALT key and Windows key of the keyboard connected to the PC to the smartphone while connected to the smartphone via scrcpy in Windows 10.
When I press the ALT key, it responds on the PC. The Windows key also responds on the PC, not the smartphone.
I set --keyboard=uhid, but it's the same problem.
--fullscreen didn't solve the problem either.
Please help.
The text was updated successfully, but these errors were encountered: