Open LanHikari22 opened 11 months ago
Can you set the SDL_EVENT_LOGGING=1
environment variable and then run Moonlight.exe? It will log the exact key presses that are recognized, so you can tell if the Windows key issue is on Moonlight's side or a Sunshine bug.
Thanks for the quick response.
Yes Moonlight is able to send different key signals:
For Windows key: 00:04:42 - SDL Info (0): SDL EVENT: SDL_KEYDOWN (timestamp=282381 windowid=2 state=pressed repeat=false scancode=227 keycode=1073742051 mod=5120) 00:04:42 - SDL Info (0): SDL EVENT: SDL_KEYUP (timestamp=282509 windowid=2 state=released repeat=false scancode=227 keycode=1073742051 mod=4096)
For Left Alt: 00:04:45 - SDL Info (0): SDL EVENT: SDL_KEYUP (timestamp=285013 windowid=2 state=released repeat=false scancode=226 keycode=1073742050 mod=4096) 00:04:45 - SDL Info (0): SDL EVENT: SDL_KEYDOWN (timestamp=285157 windowid=2 state=pressed repeat=false scancode=226 keycode=1073742050 mod=4352)
Thanks, Lan
They seem aware of this
Lan
@LanHikari22
Are you still able to reproduce this with current versions of both host and client?
I tried to reproduce this with Moonlight 5.0.1 on Win10 and Sunshine 0.22.2 on Ubuntu 22.04/Gnome/Xorg) but in Sunshine's log I have this :
[2024:04:09:20:37:40]: Debug: --begin keyboard packet--
keyAction [00000003]
keyCode [805B]
modifiers [08]
flags [00]
--end keyboard packet--
[2024:04:09:20:37:40]: Debug: --begin keyboard packet--
keyAction [00000004]
keyCode [805B]
modifiers [00]
flags [00]
--end keyboard packet--
(loglevel must be set to debug
in the config/UI)
The 5B
refers to the left Windows key:
https://github.com/LizardByte/Sunshine/blob/7e26d2fd3064c6adf3e7a52a275046dd0cf194be/src/platform/linux/input.cpp#L242
It also executes the correct action (Gnome's Show all applications).
In case it helps anyone in the future, I had a similar issue with macOS connecting to Linux.
It turns out Moonlight was sending the correct keycodes, and Sunshine was receiving the correct keycodes. However because I had installed Sunshine using a flatpak, I had to run a manual post-install script:
sudo chown $USER /dev/uinput && echo 'KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"' | sudo tee /etc/udev/rules.d/60-sunshine-input.rules
After running this script and restarting Sunshine, everything worked as expected. It appears that Sunshine is falling back to some very basic input handling when it can't create new input devices.
Anyway in case it helps anyone in the future, I did the following to verify keycodes for Moonlight:
$ SDL_EVENT_LOGGING=1 /Applications/Moonlight.app/Contents/MacOS/Moonlight
Redirecting log output to /tmp/Moonlight-1728643324.log
And then
$ tail -f /tmp/Moonlight-1728643324.log
To verify Sunshine was receiving the correct keycodes, I edited the ~/.var/app/dev.lizardbyte.app.Sunshine/config/sunshine/sunshine.conf
config file to include:
min_log_level = debug
Then restarted it using the web UI, and tailed the logs in ~/.var/app/dev.lizardbyte.app.Sunshine/config/sunshine/sunshine.log
. It's best not to scroll through them in the web UI as scrolling through the logs there will generate scroll events that will be included in the logs, making it impossible to actually read what is going on.
So all that said, everything looked fine. In digging through online documentation I then found there may be extra installation steps when using flatpak, relating to creating input devices. The command I mention at the top of this comment fixed that for me.
Describe the bug I have Sunshine running on Ubuntu 22.04 GNOME. And a Windows 11 Moonlight client. I am not able to forward the "Windows key" over and it seems to pass as Left Alt instead.
Steps to reproduce Using "xev -event keyboard" I get identical events for Left Alt press and Windows key press:
Windows Key: KeyPress event, serial 28, synthetic NO, window 0x5400001, root 0x50f, subw 0x0, time 10639451, (685,558), root:(735,677), state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False
KeyRelease event, serial 28, synthetic NO, window 0x5400001, root 0x50f, subw 0x0, time 10639746, (685,558), root:(735,677), state 0x18, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False
Left Alt: KeyPress event, serial 28, synthetic NO, window 0x5400001, root 0x50f, subw 0x0, time 10640770, (685,558), root:(735,677), state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False
KeyRelease event, serial 28, synthetic NO, window 0x5400001, root 0x50f, subw 0x0, time 10641019, (685,558), root:(735,677), state 0x18, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False
Moonlight settings (please complete the following information) I checked "Capture system keyboard shortcuts" and selected "in fullscreen".
Client PC details (please complete the following information)
Server PC details (please complete the following information)
Moonlight Logs (please attach)
Additional context
Thanks! Lan