Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 500013

Summary: [Wayland] Keyboard Left and Right Arrow keys are very slow or unresponsive
Product: [Eclipse Project] Platform Reporter: Michael Arnold <myk321>
Component: SWTAssignee: Ian Pun <ipun>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: akurtakov, conrad.leonard, gautier.desaintmartinlacaze, ipun, johan.gardhage, kencx, noamcohen1, psuzzi
Version: 4.6   
Target Milestone: 4.7 M6   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/89546
https://git.eclipse.org/r/90975
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=34e1c1ed3a200da94dc833627f60ed56dc75b362
https://git.eclipse.org/r/91117
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=3ead1bbd14e89294aeaba6f0e1b7ce8f0e2b1522
https://git.eclipse.org/r/91218
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=b3374a13114f858a723270acab708020b66f5103
https://git.eclipse.org/r/91413
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=a6faa38b93f4cb00168ac8f1755dfe0662f7e03c
Whiteboard:
Bug Depends on:    
Bug Blocks: 496923    
Attachments:
Description Flags
Modified snippet222 to display time mesaurements old vs new none

Description Michael Arnold CLA 2016-08-20 00:37:17 EDT
On Fedora 24 using Gnome under wayland, with Eclipse 4.6 Neon CDT: in the main editor, the left and right arrow keys are very slow or completely unresponsive.
The up and down arrow keys respond immediately by moving the cursor.
This problem is not present on XOrg but is present under wayland.
Comment 1 Patrik Suzzi CLA 2016-08-20 05:38:33 EDT
Adding Alexander in c/c as he might be interested.
Comment 2 Michael Arnold CLA 2016-11-26 00:39:18 EST
This problem also exists in Fedora 25, that uses wayland by default.
Comment 3 Conrad Leonard CLA 2016-12-17 20:22:59 EST
I see this too with Eclipse Neon running with Wayland but not Xserver; I can add that the actual text insertion point (line:column) indicator at the bottom of the Eclipse window updates correctly with each press of the <Left-arrow> or <Right-arrow> keys, but the -displayed- position of the cursor does not.

For example if you position the cursor somewhere in the text with a click of the trackpad button, then press <Right-arrow> twice, the cursor does not move on screen but the column indicator correctly increments by 2. If you then type some character keys, the characters will be inserted into the text at the correct position according to the insertion location indicator - but not according to the displayed position of the cursor which is still two character widths to the left.
Comment 4 Ian Pun CLA 2017-01-25 12:24:38 EST
This looks more like an SWT issue as this is reproducable in Snippet 222. Moving to SWT.
Comment 5 Eclipse Genie CLA 2017-01-25 13:36:49 EST
New Gerrit change created: https://git.eclipse.org/r/89546
Comment 6 Michael Arnold CLA 2017-02-09 08:41:27 EST
Ian, if adding redraw() into ShowCaret() is not a good way to fix this issue, is there a preferred solution vector?
Comment 7 Ian Pun CLA 2017-02-09 09:36:13 EST
(In reply to Michael Arnold from comment #6)
> Ian, if adding redraw() into ShowCaret() is not a good way to fix this
> issue, is there a preferred solution vector?

Hey Michael,

Im currently still investigating the issue now. It looks like the reason behind this is that we are drawing the caret through a Cairo call that grabs the context outside of a draw signal. This is actually not supported in GTK for wayland so I am seeing if i can do a low invasive fix before I fall back to the redraw.
Comment 8 Eclipse Genie CLA 2017-02-13 11:59:05 EST
New Gerrit change created: https://git.eclipse.org/r/90975
Comment 9 Ian Pun CLA 2017-02-13 14:28:49 EST
Created attachment 266797 [details]
Modified snippet222 to display time mesaurements old vs new

Attached is a modified snippet222 that will display how long it takes to run a setCaretOffset about 10000 times. Testing both prior and post patch (on both wayland and X11), it seems to average around ~700 milliseconds to finish the process. There is no big difference in timing moving to the new patch, as I believe the only margin of error causing the timing differences is the priority of the process for the OS.
Comment 11 Alexander Kurtakov CLA 2017-02-15 04:09:57 EST
Also fixes a nasty issue on X11 where stale cursor stays drawn while the new one moves. Thanks for the patch. In master now.
Comment 12 Eclipse Genie CLA 2017-02-15 04:20:27 EST
New Gerrit change created: https://git.eclipse.org/r/91117
Comment 14 Alexander Kurtakov CLA 2017-02-15 04:21:57 EST
Ian, please test with Snippet43. With your patch the caret no longer blink.
Comment 15 Eclipse Genie CLA 2017-02-15 15:43:37 EST
New Gerrit change created: https://git.eclipse.org/r/91218
Comment 17 Alexander Kurtakov CLA 2017-02-16 02:46:30 EST
In master now. It even draws better with the snippet than the old code where there were leftovers when the caret should have been hidden.
Comment 18 Eclipse Genie CLA 2017-02-17 16:42:11 EST
New Gerrit change created: https://git.eclipse.org/r/91413
Comment 19 Ian Pun CLA 2017-02-17 16:44:10 EST
Was running the integration build and found a race condition where if you held down an arrow key, isDrawing is being fought over by the blinking procedure and the drawCaret call. Removed it and is now fixed as it was not necessary to have in the first place.
Comment 21 Michael Arnold CLA 2017-02-22 06:26:33 EST
Awesome - thank-you!
Comment 22 Ian Pun CLA 2017-05-31 10:27:27 EDT
*** Bug 422969 has been marked as a duplicate of this bug. ***