Bug 2089432 - Cursor jumping and hiding letters while typing in Electron apps under Wayland
Summary: Cursor jumping and hiding letters while typing in Electron apps under Wayland
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: xorg-x11-server-Xwayland
Version: 36
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Olivier Fourdan
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-05-23 16:21 UTC by somethingsomethingfedora
Modified: 2022-05-24 17:31 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
freedesktop.org Gitlab xorg xserver issues 1317 0 None opened xwayland glamor renders incorrectly on nvidia 2022-05-24 17:31:42 UTC

Description somethingsomethingfedora 2022-05-23 16:21:12 UTC
Description of problem:
Typing cursor jumps back and hides letters randomly while typing in Electron apps under Wayland

Version-Release number of selected component (if applicable):


How reproducible:
100% on wayland applications when typing a long string in an electron application

Steps to Reproduce:
1. Use Wayland (I use GNOME but not sure if that part is required)
2. Open an electron application like VS Code or discord
3. Type anywhere for a bit and observe cursor jumps

Actual results:
Cursor intermittently jumps back 1+ characters and hides the typed characters in the process

Expected results:
Cursor moves forward normally and does not jump back

Additional info:
I tried to record a video of this with the screenshot tool, but the recording does not show the behavior even though it occurred while recording.

Comment 1 Olivier Fourdan 2022-05-24 13:42:03 UTC
Wayland is just a set of protocol definitions and a small IPC library, so not "Wayland".

If anything that would be Xwayland as Electron apps run by default on X11, hence on Xwayland.

When you say "cursor jumps back", you mean the caret in the text widget?

I fail to see how Xwayland could be tampering with the caret in the application. I fail to reproduce the exact same behavior, however what I do see is a delayed update, the last character typed on the keyboard shows up after a 1 second delay, that would corroborate the fact that the issue doesn't show on the screencast (i.e. it's more of an app painting issue).

Comment 2 Olivier Fourdan 2022-05-24 13:52:40 UTC
Actually… I see something really weird now, like spurious key events when typing -relly- fast (regardless of VScode or Electro, I can even see that in weston-eventdemo).

Out of curiosity, mind trying to reproduce the issue in another Wayland compositor such as weston, sway or KDE Plasma Wayland?

Comment 3 somethingsomethingfedora 2022-05-24 15:08:51 UTC
Well, I installed weston and loaded into it and can't launch any of my apps without a seg fault.  I've tried installing Sway, but it just kicks me back to GDM when I try to login to it.

I did manage to get an external video of the behavior in GNOME though: https://imgur.com/a/uDvxi2Z

It gets even messier when you start trying to backspace, but I didn't want to add that in the video because it's hard to tell on video what is a backspace and what is this cursor jump bug since the letters also disappear for a moment with the bug.

The issue came up on the ask forums https://ask.fedoraproject.org/t/stuttering-keyboard-on-wayland/22718/4 and I've also discussed it in Discord previously with a couple other people that were able to confirm.

Comment 4 somethingsomethingfedora 2022-05-24 15:17:30 UTC
I just tested on KDE Plasma Wayland and the cursor does not visually show the jumping around, but instead just has an intermittent delay between cursor movements forwards and backwards. So letters won't show up for a bit and backspaced letters won't remove for a bit.

Comment 5 Olivier Fourdan 2022-05-24 15:23:13 UTC
Yeah, looking at the video I am now even more convinced this is a buffer update issue more than anything to do with keyboard. And that would possibly match what I was seeing.

Can you try something real quick?

In VScode, go to File → Preferences → Settings then expand the "Text Editor" section and click on cursor, and enable "Cursor Smooth Caret Animation" - Does that help?

Comment 6 somethingsomethingfedora 2022-05-24 15:33:09 UTC
Yes, it looks like that does fix it in VS Code.

Comment 7 Olivier Fourdan 2022-05-24 15:39:09 UTC
I'd say it's a workaround, not a fix. Similarly, disabling glamor support (XWAYLAND_NO_GLAMOR=1 in /etc/environment) also avoids the issue.

So I think the problem is with the present code in Xwayland, I reckon that 1 second delay is the present flip timer.

Comment 8 Olivier Fourdan 2022-05-24 16:33:42 UTC
Out of curiosity, is that with NVIDIA proprietary driver?

Comment 9 somethingsomethingfedora 2022-05-24 17:14:26 UTC
Yes it is with the NVIDIA proprietary driver

Comment 10 Olivier Fourdan 2022-05-24 17:31:43 UTC
(In reply to somethingsomethingfedora from comment #9)
> Yes it is with the NVIDIA proprietary driver

Ah right, that was a crucial piece of information missing :)

Then I think it's another effect of upstream bug https://gitlab.freedesktop.org/xorg/xserver/-/issues/1317 (fwiw, I fail to reproduce in intel using the open source stack).


Note You need to log in before you can comment on or make changes to this bug.