GNOME Bugzilla – Bug 758025
cursor flickering
Last modified: 2015-11-20 17:03:33 UTC
when I type in gnome-terminal or in gedit (or any other application using a gtktextview), the cursor starts flickering, as if it is drawn at various offsets, vertically. This does not happen under weston. The fact that it starts as soon as I type and stops as soon as I move the mouse makes me think it has something to do with vte/gtk+ trying to hide the mouse pointer during keyboard input.
https://mclasen.fedorapeople.org/20151112_195429.mp4
to reproduce this here, it is enough to click on the 'blank cursor' button in the cursors example in gtk3-demo.
I've put a WAYLAND_DEBUG=1 log of gedit when this flicker occured here: https://mclasen.fedorapeople.org/gedit-wayland-debug.txt
For the record, after investigating this with Matthias a bit, the flicker seems to be caused by gtk+ for some reason setting the blank cursor hotspot to a very high number, causing the cursor to move offscreen. This causes the cursor surface to leave the wl_output, causing gtk+ to set the cursor again, but now for some reason with the hotspot (0, 0). This new hotspot causes the cursor to jump back to within the wl_output region, and as a result, gtk+ again sets the hotspot to something odd. Then it repeats, again and again, causing glitches.
Hm. Why would setting the cursor hotspot cause GTK+ to do anything? Leaving the wl_output shouldn't do anything -- do we send any events to GTK+ because of that?
1. GTK+ sets a funky cursor hotspot causing the actual cursor surface to end up off screen 2. mutter sends "wl_surface.leave" to the cursor surface because thats what happened 3. GTK+ sets a non-funky hotspot (0, 0) causing the cursor surface to end up on screen 4. mutter sends "wl_surface.enter" to the cursor surface because thats what happened 5. goto 1.
The reason why leaving the output causes set_cursor is because GTK+ is lazy and just calls wl_pointer_set_cursor no matter what (because if it didn't change its a no-op anyway). The real issue here is that setting a empty cursor has an incorrect hotspot.
Created attachment 315942 [details] [review] wayland: Set a null cursor surface when cursor buffer is null If the buffer of a cursor is NULL, for example if its an empty cursor, just set the cursor surface to NULL as well. Not doing this we'll use uninitialized hotspot coordinates, dimensions and scales. ----- As I've yet to reproduce this bug, I have not verified that this patch fixes the issue. It does send more sane data to the compositor however.
Attachment 315942 [details] pushed as dc65abc - wayland: Set a null cursor surface when cursor buffer is null