| Summary: | Shell#getLocation() wrong after setVisible(false) | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Markus Keller <markus.kell.r> |
| Component: | SWT | Assignee: | Xi Yan <xixiyan> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | ericwill, marlin.cremers, snorthov, xixiyan |
| Version: | 3.4 | Keywords: | triaged |
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux-GTK | ||
| See Also: |
https://git.eclipse.org/r/127513 https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=eaeacca6acd37400d458d7d93f4638e912c2d3b6 |
||
| Whiteboard: | |||
Not that severe any more for me, since I don't use this call sequence any more. Is there any chance this will be fixed? Xi, please investigate. New Gerrit change created: https://git.eclipse.org/r/127513 Gerrit change https://git.eclipse.org/r/127513 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=eaeacca6acd37400d458d7d93f4638e912c2d3b6 (In reply to Eclipse Genie from comment #5) > Gerrit change https://git.eclipse.org/r/127513 was merged to [master]. > Commit: > http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/ > ?id=eaeacca6acd37400d458d7d93f4638e912c2d3b6 Patch is in master, thanks Xi. Verified in I20180923-1800. |
I20071120-1300 Invisible shells report a wrong (old) location on Linux-GTK. Running the snippet below and clicking the "Show" button produces this output: before setLocation:Point {-30000, 0} after setLocation:Point {108, 168} before setVisible(false): Point {108, 168} after setVisible(false): Point {-30000, 0} before setVisible(true): Point {-30000, 0} after setVisible(true): Point {108, 168} Expected: all but the first Point should be Point {108, 168}. Works as expected on Windows. ------------------------------------------------ package org.eclipse.swt.snippets; import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; public class WrongLoc { public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setText("Main"); shell.setLayout(new RowLayout()); final Button button = new Button(shell, SWT.PUSH); button.setText("Show"); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { showHover(shell, button); } }); shell.setBounds(100, 100, 300, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } static void showHover(final Shell shell, final Button button) { final Display display = shell.getDisplay(); Rectangle bb = button.getBounds(); final Point pos = button.toDisplay(bb.x, bb.y + bb.height + 5); final Shell hover = new Shell(shell, SWT.ON_TOP | SWT.NO_TRIM); hover.setBackground(display.getSystemColor(SWT.COLOR_YELLOW)); hover.setBounds(-30000, 0, 100, 50); hover.setVisible(true); display.asyncExec(new Runnable() { public void run() { System.out.println("before setLocation:" + hover.getLocation()); hover.setLocation(pos); System.out.println("after setLocation:" + hover.getLocation()); } }); display.timerExec(2000, new Runnable() { public void run() { Point loc = hover.getLocation(); System.out.println("before setVisible(false): " + loc); hover.setVisible(false); Point loc2 = hover.getLocation(); System.out.println("after setVisible(false): " + loc2); } }); display.timerExec(4000, new Runnable() { public void run() { Point loc = hover.getLocation(); System.out.println("before setVisible(true): " + loc); hover.setVisible(true); Point loc2 = hover.getLocation(); System.out.println("after setVisible(true): " + loc2); } }); } }