diff options
author | Paul Pazderski | 2019-06-03 21:24:03 +0000 |
---|---|---|
committer | Eric Williams | 2019-06-05 19:49:08 +0000 |
commit | 8d127558d9158f454dc40a49a1b0e58094aba6f0 (patch) | |
tree | c371b940d5e7b7b904eef22fc7ddbc8b8e3e1c7a /examples | |
parent | bd6f468e1dbeb44d8ddaadc278bdf81133e8ac8b (diff) | |
download | eclipse.platform.swt-8d127558d9158f454dc40a49a1b0e58094aba6f0.tar.gz eclipse.platform.swt-8d127558d9158f454dc40a49a1b0e58094aba6f0.tar.xz eclipse.platform.swt-8d127558d9158f454dc40a49a1b0e58094aba6f0.zip |
Bug 547938 - [Snippets] Move mouse over test Shell before starting
automated mouse scroll
Some systems scroll the focused element independent of mouse position.
Other scroll what's under the mouse cursor regardless of the focused
element.
Change-Id: I6aae5c8991c6120ad7ee8b7234b27d0080c48c8d
Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet268.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet268.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet268.java index 943e3c0cdb..7c4cddff4f 100644 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet268.java +++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet268.java @@ -23,6 +23,7 @@ package org.eclipse.swt.snippets; */ import org.eclipse.swt.*; import org.eclipse.swt.custom.*; +import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; @@ -40,6 +41,14 @@ public static void main(String[] args) { styledText.setText(multiLineString); shell.setSize(styledText.computeSize(SWT.DEFAULT, 400)); shell.open(); + // move cursor over styled text + Rectangle clientArea = shell.getClientArea(); + Point location = shell.getLocation(); + Event event = new Event(); + event.type = SWT.MouseMove; + event.x = location.x + clientArea.width / 2; + event.y = location.y + clientArea.height / 2; + display.post(event); styledText.addListener(SWT.MouseWheel, e -> System.out.println("Mouse Wheel event " + e)); new Thread(){ Event event; |