Community
Participate
Working Groups
Reproduced using Snippet23, running on GTK2. Does not occur with GTK3. Run the following snippet of code. Click the cursor within the resulting window and attempt to drag it off the window. Observed: The cursor gets stuck at the boundary of the window and cannot be dragged off the window. This is inconsistent with the behavior of SWT on other platforms including GTK3. Expected: The cursor moves off of the window. public class Snippet23 { public static void main (String [] args) { Display display = new Display (); final Shell shell = new Shell (display); shell.open (); shell.addListener (SWT.MouseDown, e -> { Tracker tracker = new Tracker (shell, SWT.NONE); tracker.setRectangles (new Rectangle [] { new Rectangle (e.x, e.y, 100, 100), }); tracker.open (); }); while (!shell.isDisposed()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } }
Unable to use the Display constructor as a workaround due to bug 492783.
New Gerrit change created: https://git.eclipse.org/r/72590
I've attached a rough idea for a fix here but I haven't tested it yet.
Possibly related to bug 406954
New Gerrit change created: https://git.eclipse.org/r/72659
No need for workarounds. I've attached a proper fix.
This should really go in for RC2.
(In reply to Stefan Xenos from comment #0) > Reproduced using Snippet23, running on GTK2. Does not occur with GTK3. > > Run the following snippet of code. Click the cursor within the resulting > window and attempt to drag it off the window. > > Observed: > > The cursor gets stuck at the boundary of the window and cannot be dragged > off the window. This is inconsistent with the behavior of SWT on other > platforms including GTK3. > > Expected: > > The cursor moves off of the window. Stefan, which Linux version are you trying this on? Can you please attach a small video which demonstrates the exact behaviour you're seeing? I tried the Snippet23 on Ubuntu 15.10 and did notice that the Tracker that is created on mouse down event is stuck at the window boundary, however, the cursor moves freely out of the window. Did you mean the Tracker when you say the cursor gets stuck at the boundary of the window? Also, I tried the attached patch with the same snippet and it does seem to allow the Tracker to move off of the window. There is another difference in behaviour though between GTK2 and GTK3 after the patch - with GTK2 you can see that the Tracker is no longer trapped inside the window boundaries but it is not visible when dragged outside the window whereas with GTK3 the Tracker is always visible. Did you notice this too? I'm not sure if that is a different bug with GTK3 as I verified on Windows 7 and found that it matches with the GTK2 behaviour (with your patch).
The patch itself looks quite simple and not very risky but I would like to clarify the questions from comment 8 before we decide to go ahead and merge it...
> Stefan, which Linux version are you trying this on? 4.2.0-35-generic #40~14.04.1-Ubuntu SMP Fri Mar 18 16:37:35 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux > Can you please attach a small video which demonstrates the exact > behaviour you're seeing? I'll need to install and figure out the use of some video capture software first. It may take some time. I'd suggest we don't gate this fix on that. > Did you mean the Tracker when you say the cursor gets stuck at the > boundary of the window? Both. However, it's the cursor that creates problems for Drag & Drop in Eclipse since Eclipse intentionally uses an invisible Tracker. Actually, from my reading of the GTK documentation, this behavior of constraining the cursor seems to be intended behavior when you invoke that method with a non-null argument. > Did you notice this too? Yes. On GTK2 the Tracker isn't visible when dragged outside the parent shell, but that seems to be a separate bug from the problem with the cursor.
(In reply to Stefan Xenos from comment #10) > > Did you mean the Tracker when you say the cursor gets stuck at the > > boundary of the window? > > Both. However, it's the cursor that creates problems for Drag & Drop in > Eclipse since Eclipse intentionally uses an invisible Tracker. Actually, > from my reading of the GTK documentation, this behavior of constraining the > cursor seems to be intended behavior when you invoke that method with a > non-null argument. I understand that but its contrary to the behaviour I observed which is why I wanted you to upload a video of what you're seeing. When I run the Snippet23 with GTK2, what I see is that the Tracker gets stuck inside the window but the cursor does not, I'm able to move the cursor anywhere on the screen. In effect, I'm unable to reproduce the exact problem as reported by the title of the bug but I'm still in favour of merging this patch because: a) It unblocks the Tracker (and the cursor in case it does get trapped) and helps resolve the DND bug 493478. b) After applying the patch, the GTK2 behaviour matches with that of GTK3 as well as Windows. c) And from the code perspective as well, this seems to be the clean and better thing to do than confine the pointer to the Tracker's originating window. > > Did you notice this too? > > Yes. On GTK2 the Tracker isn't visible when dragged outside the parent > shell, but that seems to be a separate bug from the problem with the cursor. Can you please raise a separate bug for this different behaviour with GTK3 so that it can be tracked and if necessary, be fixed at a later point of time? Thanks!
Gerrit change https://git.eclipse.org/r/72659 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=fb4165e3ebbd49650992685a61503c7defde1eab
Extracted bug 493916.
*** Bug 493478 has been marked as a duplicate of this bug. ***