lan-mouse icon indicating copy to clipboard operation
lan-mouse copied to clipboard

MacOS Client: Globe Modifier sometimes gets sent / stuck

Open dimenus opened this issue 1 year ago • 10 comments

Hello, I'm having pretty good luck with using lan-mouse between KDE (Wayland) and MacOS, however when I'm typing quickly, it sometimes it seems like the Globe modifier gets sent/stuck somehow. I have a regular US keyboard layout. I'm not sure what key is triggering that.

Server: KDE Plasma: 6.1.5 KDE Framework: 6.5 Qt Version: 6.7.2 Kernel: 6.10.9-arch1-2 Graphics: Wayland

Client:

M3 MBP

dimenus avatar Sep 12 '24 14:09 dimenus

Seems to be related to #198. It would be helpful, if you could send a trace log when the key gets stuck from both devices.

To do this, run lan-mouse via

LAN_MOUSE_LOG_LEVEL=trace lan-mouse

feschber avatar Sep 12 '24 14:09 feschber

Restarting the linux side does not seem to fix the issue.

macos.log linux.log

dimenus avatar Sep 12 '24 14:09 dimenus

This doesn't only happen with the globe/fn key. It also does it with caps lock and probably other modifiers too. I'm using NixOS with Gnome as my server with an M1 Mac as the client.

I've been seeing this issue a lot and it makes lan-mouse nearly unusable for me... I have to turn it off any time I'm doing a presentation or anything important because it happens so frequently.

It seems to happen more often when typing quickly, though that could just be coincidence.

Jacoby6000 avatar Sep 23 '24 16:09 Jacoby6000

I have a suspicion what is going on here, could someone check if #206 fixes this problem?

Let me know, if you need help with testing that branch, you can download a debug build from https://github.com/feschber/lan-mouse/actions/runs/10999236745?pr=206

feschber avatar Sep 23 '24 17:09 feschber

Running commit 196d0f on the client device I still get this issue... Running it on my Linux host as well made my mac client infinitely repeat some characters (though I'm fairly sure running it on linux didn't change anything. AFAIK changes to the mac input emulation only runs on the mac. I just hadn't run in to the issue before deploying the version to my linux server), and I couldn't make it stop even after closing lan-mouse. I had to forcibly restart the mac. :sweat_smile:

I made another comment over here: https://github.com/feschber/lan-mouse/issues/198#issuecomment-2368810598

I wonder if that'd provide some more useful context?

Jacoby6000 avatar Sep 23 '24 18:09 Jacoby6000

Reproducing this a second time, I can see that console on the client device gets repeatedly spammed with

WARN lan_mouse::server::ping_task: device not responding, releasing keys!

And the key is never released, even after terminating lan-mouse. Pressing the key that's held down on the client device does nothing to release it either.

Jacoby6000 avatar Sep 23 '24 18:09 Jacoby6000

I just realized this point was never clarified: Caps-lock, fn/globe and other modifiers are being sent and stuck even when we never press them

Jacoby6000 avatar Sep 23 '24 18:09 Jacoby6000

@Jacoby6000 could you test the log-keypress branch and send another log from both sides?

This would tell me whether or not its a problem with the emulation or capture code.

In any case, thank you for your detailed reports!

feschber avatar Sep 23 '24 18:09 feschber

Alright, here's a detailed session reproducing some funkiness

Here are the exact keystrokes I entered

Typing some text<CR>
<CR>
Now copying the above text<UP><LeftShift+UP><LeftMeta+C><DOWN><DOWN><DOWN><CR>
<CR>
Now pasting the text<CR>
<CR>
<LeftMeta+V>

And here's the actual text output from those inputs:

Typing some text

Now copying the above text

Now pasting th txt

The <CR> inputs at the end did not register, and the <LeftMeta+V> input pasted nothing. Unsure if the lack of paste is because it failed to even copy in the first place.

You can see the e inputs get dropped on the last line as well. This is likely because <Fn (Globe)+e> = open emoji menu on a mac.

lan-mouse-linux-server.txt lan-mouse-macos-client.txt

Before the copy/paste test, I did a long test typing normally without any modifiers besides shift, and it worked fine. So something strange is happening with cmd (Meta) inputs I think. In normal use I suspect I run in to the issue often because I (and probably most programmers) use cmd hotkeys for a lot of stuff. Cmd-tab always seems to work Okay initially, but sometimes might act a little funky. Copy and paste has never been consistent for me but works sometimes.

Jacoby6000 avatar Sep 23 '24 21:09 Jacoby6000

okay this definitely seems to be an issue with the MacOS emulation code, presumably something to do with modifier keys.

feschber avatar Sep 24 '24 16:09 feschber

@feschber I saw that #206 got merged. Just a reminder that when I was testing on that branch, my mac got in to a state where it would hold down a key and I could not make it stop no matter what I did. I had to restart the machine to make the key stop repeating. Closing lan-mouse did not fix the issue. My previous comment about it may not have made that clear

Jacoby6000 avatar Oct 08 '24 16:10 Jacoby6000

That's weird, it should functionally be identical. Could you test this on the latest commit?

feschber avatar Oct 08 '24 17:10 feschber

In my testing this resolves the issue at least with the command and option keys. I am however unsure about the globe modifier.

From my testing on the input-capture side, the globe modifier does not get picked up at all, (there seems to be no keycode associated with it atm) so it technically should not even work at all right now.

Would be great, if you could test this PR (#219) @Jacoby6000 @zhurai

feschber avatar Oct 25 '24 20:10 feschber

And in case you notice: I'm aware that caps lock does not work correctly. Will have to fix that as well

feschber avatar Oct 25 '24 21:10 feschber

I will merge this for now, as it definitely fixes some of the problems with modifier keys in my testing. Feel free to reopen if something does not work!

feschber avatar Oct 27 '24 07:10 feschber