Bug 542777 - Proposal for StyledText: Mouse Navigation
Summary: Proposal for StyledText: Mouse Navigation
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.9   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.11 RC2   Edit
Assignee: Laurent CARON CLA
QA Contact: Eric Williams CLA
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks: 544156 544616 544658
  Show dependency tree
 
Reported: 2018-12-13 12:58 EST by Laurent CARON CLA
Modified: 2020-02-20 14:26 EST (History)
6 users (show)

See Also:
daniel_megert: pmc_approved+


Attachments
Video showing mouse navigation (766.85 KB, video/mp4)
2018-12-13 12:58 EST, Laurent CARON CLA
no flags Details
Video showing the problem noticed on Linux (837.45 KB, video/webm)
2019-02-21 03:09 EST, Sravan Kumar Lakkimsetti CLA
no flags Details
Video showing the problem (536.97 KB, video/webm)
2019-03-04 01:44 EST, Sravan Kumar Lakkimsetti CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent CARON CLA 2018-12-13 12:58:22 EST
Created attachment 276930 [details]
Video showing mouse navigation

I've worked on a little enhancement for StyledText widgets. It mimics the behaviour of Firefox or Chrome when you click on the wheel button: a circle with arrows appears and you can navigate through the whole document by moving you mouse.
(please see encloding video)

Maybe this proposal may be integrated in standard with StyledText ?

I'll send a patch once the code will be cleaned.
Comment 1 Dani Megert CLA 2018-12-14 10:04:22 EST
(In reply to Laurent CARON from comment #0)
> I'll send a patch once the code will be cleaned.

Please provide the work in a Gerrit change.
Comment 2 Laurent CARON CLA 2018-12-14 10:28:15 EST
Sure. Is it necessary to use Gerrit or can I make a PR on https://github.com/eclipse/eclipse.platform.swt ?
Comment 3 Lars Vogel CLA 2018-12-14 10:33:24 EST
(In reply to Laurent CARON from comment #2)
> Sure. Is it necessary to use Gerrit or can I make a PR on
> https://github.com/eclipse/eclipse.platform.swt ?

We currently use Gerrit. If you have questions / issues with Gerrit, please feel free to ask (Lars.Vogel@vogella.com).
Comment 4 Laurent CARON CLA 2018-12-14 10:36:04 EST
Thank you Lars, I'll use gerrit.
Comment 5 Laurent CARON CLA 2018-12-14 14:32:12 EST
Question: we agree that this behaviour will not be activated by default.

To activate this, I have 2 solutions :

a) create a method to activate/deactivate, for example setMouseNavigationEnabled(boolean)

b) Use a SWT bit flag in constructor. In this case, which one ?

What's your opinion ?
Comment 6 Dani Megert CLA 2018-12-16 06:06:43 EST
(In reply to Laurent CARON from comment #5)
> Question: we agree that this behaviour will not be activated by default.
> 
> To activate this, I have 2 solutions :
> 
> a) create a method to activate/deactivate, for example
> setMouseNavigationEnabled(boolean)
> 
> b) Use a SWT bit flag in constructor. In this case, which one ?
> 
> What's your opinion ?

Definitely a) because that allows to change the behavior for already opened/created StyledText which is not possible via style constant.
Comment 7 Eclipse Genie CLA 2018-12-23 10:13:44 EST
New Gerrit change created: https://git.eclipse.org/r/134437
Comment 9 Eclipse Genie CLA 2019-02-14 15:30:57 EST
New Gerrit change created: https://git.eclipse.org/r/136956
Comment 11 Eric Williams CLA 2019-02-14 15:37:03 EST
(In reply to Eclipse Genie from comment #8)
> Gerrit change https://git.eclipse.org/r/134437 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=2315f3403bf77d0f911eac74a4851fbc19cde824

In master now, thanks for the patch and contribution Laurent!

(In reply to Eclipse Genie from comment #10)
> Gerrit change https://git.eclipse.org/r/136956 was merged to [master].
> Commit:
> http://git.eclipse.org/c/www.eclipse.org/eclipse/news.git/commit/
> ?id=df14ba1beee6c6537b1171bc103b29c234ab657c

Merged the N&N entry for 4.11.
Comment 12 Eclipse Genie CLA 2019-02-15 09:11:06 EST
New Gerrit change created: https://git.eclipse.org/r/137016
Comment 14 Eric Williams CLA 2019-02-19 09:23:42 EST
Verified in I20190219-0600.
Comment 15 Sravan Kumar Lakkimsetti CLA 2019-02-20 02:54:57 EST
This is definitely good enhancement. In my testing using TextEditor example from swt examples package, I noticed some issues

1. In 4 way navigation, the circle of arrows is jumping to different locations when the mouse moved. This does not happen in 2 way mode. Specifically when I try to move in diagonal 

2. When we move the mouse away from the navigation circle the widget scrolls as long as mouse moves. but stops once we leave mouse. this is different from chrome or firefox behavior. In the browsers the browser pane keeps moving till the end and the scroll speed is proportional to the distance from navigation circle. But this can be considered as another enhancement. This is not required for 4.11

I my opinion the first problem also doesn't warrant removal from 4.11. But that will stop us from enabling this feature by default.

Test environment
OS: Ubuntu 18.04 Gnome on X11
Eclipse SDK
Version: 2019-03 (4.11)
Build id: I20190218-1800
OS: Linux, v.4.15.0-45-generic, x86_64 / gtk 3.22.30
Java version: 11.0.2
Comment 16 Niraj Modi CLA 2019-02-20 04:48:04 EST
(In reply to Sravan Kumar Lakkimsetti from comment #15)
> This is definitely good enhancement. In my testing using TextEditor example
> from swt examples package, I noticed some issues
> 
> 1. In 4 way navigation, the circle of arrows is jumping to different
> locations when the mouse moved. This does not happen in 2 way mode.
> Specifically when I try to move in diagonal 
I don't see this problem on Windows7.

> 2. When we move the mouse away from the navigation circle the widget scrolls
> as long as mouse moves. but stops once we leave mouse. this is different
> from chrome or firefox behavior. In the browsers the browser pane keeps
> moving till the end and the scroll speed is proportional to the distance
> from navigation circle. But this can be considered as another enhancement.
> This is not required for 4.11
Can notice the same on Windows too, but agree that i can be improved later on.
Comment 17 Niraj Modi CLA 2019-02-20 04:54:20 EST
Raised bug 544616 to provide a new preference option to enable/disable Mouse navigation from Eclipse UI.
Comment 18 Lakshmi P Shanmugam CLA 2019-02-20 05:08:41 EST
(In reply to Niraj Modi from comment #16)
> (In reply to Sravan Kumar Lakkimsetti from comment #15)
> > This is definitely good enhancement. In my testing using TextEditor example
> > from swt examples package, I noticed some issues
> > 
> > 1. In 4 way navigation, the circle of arrows is jumping to different
> > locations when the mouse moved. This does not happen in 2 way mode.
> > Specifically when I try to move in diagonal 
> I don't see this problem on Windows7.
I don't see this problem on Mac either.
Comment 19 Eclipse Genie CLA 2019-02-20 05:32:28 EST
New Gerrit change created: https://git.eclipse.org/r/137264
Comment 20 Niraj Modi CLA 2019-02-20 05:34:12 EST
(In reply to Eclipse Genie from comment #19)
> New Gerrit change created: https://git.eclipse.org/r/137264
With above gerrit, updated CustomControlExample's StyledText tab for the Mouse Navigator option.
Comment 21 Lakshmi P Shanmugam CLA 2019-02-20 13:21:59 EST
(In reply to Sravan Kumar Lakkimsetti from comment #15)
> This is definitely good enhancement. In my testing using TextEditor example
> from swt examples package, I noticed some issues
> 
> 1. In 4 way navigation, the circle of arrows is jumping to different
> locations when the mouse moved. This does not happen in 2 way mode.
> Specifically when I try to move in diagonal 
> 
@Eric, do you see this problem?
Comment 22 Eric Williams CLA 2019-02-20 13:54:36 EST
(In reply to Lakshmi Shanmugam from comment #21)
> (In reply to Sravan Kumar Lakkimsetti from comment #15)
> > This is definitely good enhancement. In my testing using TextEditor example
> > from swt examples package, I noticed some issues
> > 
> > 1. In 4 way navigation, the circle of arrows is jumping to different
> > locations when the mouse moved. This does not happen in 2 way mode.
> > Specifically when I try to move in diagonal 
> > 
> @Eric, do you see this problem?

Nope, I just tried Snippet375 and I don't see it at all. No jumping regardless of which direction I move in (for 4-way mode).
Comment 23 Sravan Kumar Lakkimsetti CLA 2019-02-21 01:40:21 EST
(In reply to Eric Williams from comment #22)
> (In reply to Lakshmi Shanmugam from comment #21)
> > (In reply to Sravan Kumar Lakkimsetti from comment #15)
> > > This is definitely good enhancement. In my testing using TextEditor example
> > > from swt examples package, I noticed some issues
> > > 
> > > 1. In 4 way navigation, the circle of arrows is jumping to different
> > > locations when the mouse moved. This does not happen in 2 way mode.
> > > Specifically when I try to move in diagonal 
> > > 
> > @Eric, do you see this problem?
> 
> Nope, I just tried Snippet375 and I don't see it at all. No jumping
> regardless of which direction I move in (for 4-way mode).

I see this problem even on snippet375 but it is quite difficult to reproduce (you don't have much space to move diagonally). 

I can see this problem even on Fedora 29
Eclipse SDK
Version: 2019-03 (4.11)
Build id: I20190220-1800
OS: Linux, v.4.20.7-200.fc29.x86_64, x86_64 / gtk 3.24.1, WebKit 2.22.5
Java version: 1.8.0_201

The snippet I am using is https://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor with the styledText.setMouseNavigatorEnabled(true); added to TextEditor.open() method.
Comment 24 Sravan Kumar Lakkimsetti CLA 2019-02-21 03:09:06 EST
Created attachment 277639 [details]
Video showing the problem noticed on Linux
Comment 25 Laurent CARON CLA 2019-02-21 03:52:05 EST
Thank you for the detailled bug report.
I'm gonna install a VM with Ubuntu/GTK/Java 8 and I'll come back to you.

Laurent
Comment 26 Lakshmi P Shanmugam CLA 2019-02-21 05:02:24 EST
Moving to RC1.
Comment 27 Eric Williams CLA 2019-02-21 11:28:37 EST
(In reply to Sravan Kumar Lakkimsetti from comment #23)
> (In reply to Eric Williams from comment #22)
> > (In reply to Lakshmi Shanmugam from comment #21)
> > > (In reply to Sravan Kumar Lakkimsetti from comment #15)
> > > > This is definitely good enhancement. In my testing using TextEditor example
> > > > from swt examples package, I noticed some issues
> > > > 
> > > > 1. In 4 way navigation, the circle of arrows is jumping to different
> > > > locations when the mouse moved. This does not happen in 2 way mode.
> > > > Specifically when I try to move in diagonal 
> > > > 
> > > @Eric, do you see this problem?
> > 
> > Nope, I just tried Snippet375 and I don't see it at all. No jumping
> > regardless of which direction I move in (for 4-way mode).
> 
> I see this problem even on snippet375 but it is quite difficult to reproduce
> (you don't have much space to move diagonally). 
> 
> I can see this problem even on Fedora 29
> Eclipse SDK
> Version: 2019-03 (4.11)
> Build id: I20190220-1800
> OS: Linux, v.4.20.7-200.fc29.x86_64, x86_64 / gtk 3.24.1, WebKit 2.22.5
> Java version: 1.8.0_201
> 
> The snippet I am using is
> https://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/
> org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor with the
> styledText.setMouseNavigatorEnabled(true); added to TextEditor.open() method.

X11 or Wayland? I tried as you have described and still don't see it, but this is Wayland.
Comment 28 Eric Williams CLA 2019-02-21 16:36:36 EST
(In reply to Eric Williams from comment #27)
> (In reply to Sravan Kumar Lakkimsetti from comment #23)
> > (In reply to Eric Williams from comment #22)
> > > (In reply to Lakshmi Shanmugam from comment #21)
> > > > (In reply to Sravan Kumar Lakkimsetti from comment #15)
> > > > > This is definitely good enhancement. In my testing using TextEditor example
> > > > > from swt examples package, I noticed some issues
> > > > > 
> > > > > 1. In 4 way navigation, the circle of arrows is jumping to different
> > > > > locations when the mouse moved. This does not happen in 2 way mode.
> > > > > Specifically when I try to move in diagonal 
> > > > > 
> > > > @Eric, do you see this problem?
> > > 
> > > Nope, I just tried Snippet375 and I don't see it at all. No jumping
> > > regardless of which direction I move in (for 4-way mode).
> > 
> > I see this problem even on snippet375 but it is quite difficult to reproduce
> > (you don't have much space to move diagonally). 
> > 
> > I can see this problem even on Fedora 29
> > Eclipse SDK
> > Version: 2019-03 (4.11)
> > Build id: I20190220-1800
> > OS: Linux, v.4.20.7-200.fc29.x86_64, x86_64 / gtk 3.24.1, WebKit 2.22.5
> > Java version: 1.8.0_201
> > 
> > The snippet I am using is
> > https://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/
> > org.eclipse.swt.examples/src/org/eclipse/swt/examples/texteditor with the
> > styledText.setMouseNavigatorEnabled(true); added to TextEditor.open() method.
> 
> X11 or Wayland? I tried as you have described and still don't see it, but
> this is Wayland.

Okay it happens only on X11, Wayland seems unaffected.
Comment 29 Lakshmi P Shanmugam CLA 2019-02-27 01:58:25 EST
(In reply to Laurent CARON from comment #25)
> Thank you for the detailled bug report.
> I'm gonna install a VM with Ubuntu/GTK/Java 8 and I'll come back to you.
> 
> Laurent

@Laurent,
Were you able to take a look at the problem?
Comment 30 Laurent CARON CLA 2019-02-27 02:12:32 EST
Hi Lakshmi,

I've just installed my VM, I'll have a look tomorrow (thursday)

Laurent
Comment 31 Eclipse Genie CLA 2019-03-02 14:06:12 EST
New Gerrit change created: https://git.eclipse.org/r/137922
Comment 32 Eclipse Genie CLA 2019-03-02 14:18:29 EST
New Gerrit change created: https://git.eclipse.org/r/137923
Comment 33 Laurent CARON CLA 2019-03-02 14:20:07 EST
I finally found the problem on GTK/X11. The methods that check if the scrollbars are present where very slow.

I've fixed it and checked on Windows 10 and Ubuntu/Gnome (X11 and Wayland)

Have a look at https://git.eclipse.org/r/c/137923/
Comment 34 Laurent CARON CLA 2019-03-02 14:20:41 EST
(In reply to Eclipse Genie from comment #31)
> New Gerrit change created: https://git.eclipse.org/r/137922

Mad mishandling, sorry
Comment 35 Lakshmi P Shanmugam CLA 2019-03-03 13:55:28 EST
(In reply to Laurent CARON from comment #33)
> I finally found the problem on GTK/X11. The methods that check if the
> scrollbars are present where very slow.
> 
> I've fixed it and checked on Windows 10 and Ubuntu/Gnome (X11 and Wayland)
> 
> Have a look at https://git.eclipse.org/r/c/137923/

@Laurent, thanks for the fix!

I think we can consider it for RC2 as it would fix a bug in the new API and also the changes are only in the newly added MouseNavigator class.

@Eric, @Sravan, 
I don't have a mouse to verify this now, can you please review & verify the patch for RC2?
Comment 36 Sravan Kumar Lakkimsetti CLA 2019-03-04 01:44:18 EST
Created attachment 277742 [details]
Video showing the problem

The patch is huge improvement. But there is still some issue. It is quite difficult to reproduce now. 

My recommendation would be we should consider this problem as resolved now and target the remaining issues to the future releases
Comment 37 Eric Williams CLA 2019-03-04 09:59:32 EST
(In reply to Sravan Kumar Lakkimsetti from comment #36)
> Created attachment 277742 [details]
> Video showing the problem
> 
> The patch is huge improvement. But there is still some issue. It is quite
> difficult to reproduce now. 
> 
> My recommendation would be we should consider this problem as resolved now
> and target the remaining issues to the future releases

I +2'd the patch on Gerrit, it looks fine on my end.

However I do notice that the pasting issue is back. The patch to fix the icon hopping hasn't introduced it, but it is still there.

To see what I am talking about, look at Sravan's video. Notice how when the middle click button is first pressed, there is text pasted from the clipboard. This was fixed when I reviewed the initial patch with the API contribution, but somehow it's managed to sneak back in somewhere.

My proposal: since this issue only affects Linux I am fine with merging this for RC2, provided that we address the pasting issue early in 4.12.
Comment 39 Lakshmi P Shanmugam CLA 2019-03-05 01:42:03 EST
@Eric, @Sravan,
Thanks for the reviews, I've merged the patch.
Please open bugs for the respective issues you have found, so that we can close this bug.
Comment 40 Eric Williams CLA 2019-03-05 09:28:55 EST
(In reply to Lakshmi Shanmugam from comment #39)
> @Eric, @Sravan,
> Thanks for the reviews, I've merged the patch.
> Please open bugs for the respective issues you have found, so that we can
> close this bug.

I've opened bug 545073 for the clipboard pasting issue and Sravan has opened bug 545041 for the icon hopping.