Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 268226 Details for
Bug 514483
[wayland] Launchbar filter closes when clicked
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
SnippetA: To reproduce getCursorLocationInPixels issue (v2)
Bug_514483_getCursorLocation.java (text/x-java), 2.31 KB, created by
Leo Ufimtsev
on 2017-05-08 16:30:08 EDT
(
hide
)
Description:
SnippetA: To reproduce getCursorLocationInPixels issue (v2)
Filename:
MIME Type:
Creator:
Leo Ufimtsev
Created:
2017-05-08 16:30:08 EDT
Size:
2.31 KB
patch
obsolete
>package mouseCoordinates; > >import org.eclipse.swt.SWT; >import org.eclipse.swt.events.MouseAdapter; >import org.eclipse.swt.events.MouseEvent; >import org.eclipse.swt.graphics.Point; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Label; >import org.eclipse.swt.widgets.Shell; > >public class Bug_514483_getCursorLocation >{ > public static void main(String[] args) > { > final Display display = new Display(); > Shell shell = new Shell(display); > shell.setBounds(0, 0, 600, 600); > > Label parentShellLabel = new Label(shell, SWT.None); > parentShellLabel.setText("Parent shell.\n" > + "INSTRUCTIONS:\n" > + "- Parent shell should be maximized.\n" > + "- Child shell should be at x400 y400 (in yellow square).\n" > + "- Click inside the child shell, observe result coordinates below.\n" > + "\n" > + "The bug is that x,y is not relative to parent, but relative to child-shell itself (0-200 range).\n" > + "Expected coordinates: between ~400 to ~600. (i.e, relative to parent's x,y.)\n" > + "Result Coordinates:"); > parentShellLabel.setBounds(0, 0, 600, 200); > > final Label resultLbl = new Label(shell, SWT.None); > resultLbl.setBounds(0,180, 600, 100); > resultLbl.setBackground(display.getSystemColor(SWT.COLOR_YELLOW)); > > Label childShellLocation = new Label(shell, SWT.None); > childShellLocation.setText("Child Shell should be here.\nIf it is not, move it here \nmanually"); > childShellLocation.setBackground(display.getSystemColor(SWT.COLOR_YELLOW)); > childShellLocation.setBounds(400, 400, 200, 160); > > Shell childShell = new Shell(shell, SWT.ON_TOP); > childShell.setBackground(display.getSystemColor(SWT.COLOR_DARK_YELLOW)); > > MouseAdapter clickListener = new MouseAdapter() { > @Override > public void mouseDown(MouseEvent e) { > Point loc = display.getCursorLocation(); > resultLbl.setText(loc.toString()); > if (loc.x > 300 && loc.x < 700 && loc.y > 300 && loc.y < 700) // give user some slack. > resultLbl.setBackground(display.getSystemColor(SWT.COLOR_GREEN)); > else > resultLbl.setBackground(display.getSystemColor(SWT.COLOR_RED)); > } > }; > childShell.addMouseListener(clickListener); > > shell.open(); > childShell.open(); > childShell.setBounds(400, 400, 200, 200); > while (!shell.isDisposed()) > { > if (!display.readAndDispatch()) display.sleep(); > } > display.dispose(); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 514483
:
267950
|
268198
| 268226