Bug 492783 - [GTK] Tracker doesn't work properly when using the constructor that accepts a Display
Summary: [GTK] Tracker doesn't work properly when using the constructor that accepts a...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.6   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard: hasSnippet
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2016-05-01 20:56 EDT by Stefan Xenos CLA
Modified: 2019-11-01 15:43 EDT (History)
4 users (show)

See Also:


Attachments
My video (497.50 KB, video/webm)
2016-05-03 03:13 EDT, Alexander Kurtakov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Xenos CLA 2016-05-01 20:56:53 EDT
On GTK, the rectangle for the SWT Tracker class stops following the mouse after moving the mouse a few pixels. After moving it slightly farther, it disappears entirely.

It also stops firing the SWT.MouseMove event after the tracker disappears.

Easily reproduced using both of the SWT Tracker snippets (Snippet31 and Snippet23).
Comment 1 Stefan Xenos CLA 2016-05-01 21:26:58 EDT
My bad. I see no evidence that the SWT.Move event is missing... but the tracker is disappearing.
Comment 2 Alexander Kurtakov CLA 2016-05-03 03:13:33 EDT
Created attachment 261420 [details]
My video
Comment 3 Alexander Kurtakov CLA 2016-05-03 03:15:17 EDT
Stefan, please take a look at the video. I can't experience what you describe. My system is Fedora 24/Gtk 3.20 , can it be smth caused  by additional things loaded in your env?
Comment 4 Eric Williams CLA 2016-05-04 09:06:21 EDT
(In reply to Alexander Kurtakov from comment #3)
> Stefan, please take a look at the video. I can't experience what you
> describe. My system is Fedora 24/Gtk 3.20 , can it be smth caused  by
> additional things loaded in your env?

I get the same result -- can't reproduce this bug.
Comment 5 Stefan Xenos CLA 2016-05-11 17:35:57 EDT
My bad. I forgot to include an important reproduction step. On the line that instantiates the Tracker, change the code to use the version that accepts a Display rather than the version that accepts a Shell.

Tracker tracker = new Tracker (display, SWT.NONE);

So for example: 

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 (display, 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 ();
}
}

I also see the following in the log:

(SWT:8101): Gdk-CRITICAL **: gdk_frame_clock_request_phase: assertion 'GDK_IS_FRAME_CLOCK (frame_clock)' failed
Comment 6 Stefan Xenos CLA 2016-05-11 22:49:52 EDT
I tried using the Shell constructor as a workaround, but encountered bug 493477.
Comment 7 Arun Thondapu CLA 2016-05-13 07:32:38 EDT
I can reproduce the problem using Snippet31 and Snippet23 (modified) but only on GTK2, GTK3 seems to work fine, is that what you noticed too Stefan?

Also, with GTK2, in my case, the tracker was not appearing at all for both snippets, I tried on Ubuntu 15.10.
Comment 8 Stefan Xenos CLA 2016-05-13 15:33:18 EDT
> I can reproduce the problem using Snippet31 and Snippet23 (modified) but
> only on GTK2, GTK3 seems to work fine, is that what you noticed too Stefan?

No, I'm only seeing this on GTK3. On GTK2, I get bug 493477 instead. With the Display constructor I still receive the events on GTK2 but not on GTK3 (verified by adding a System.out.println that spits out the current time.

> Also, with GTK2, in my case, the tracker was not appearing at all for
> both snippets, I tried on Ubuntu 15.10.

Yes, that happens for me, too. The tracker rectangle disappears entirely while moving the mouse and only reappears when the mouse is stationary. This isn't a problem for the Eclipse platform, though, since the platform always moves the Tracker rectangle offscreen so it can't be seen during drags. Platform only uses the Tracker as a mechanism for capturing the mouse events and setting the cursor globally.
Comment 9 Stefan Xenos CLA 2016-05-13 15:36:00 EDT
Arun, I've been trying to reach you over email for a couple months. Is your spam filter blocking emails from my @google.com address?
Comment 10 Ian Pun CLA 2016-06-14 14:16:05 EDT
I have taken a look at it and was able to reproduce this on GTK3. Initially, the bug would be that the rectangle would not draw correctly if you moved too fast when dragging. After restarting my computer, I was able to get the rectangle loading correctly again, however it would display the rectangle if you dragged your mouse slowly. If you moved fast, the rectangle would pause and delay, then draw on top of your mouses latest location. I did some println time statements and found that its not caused by any inherent function in SWT, but likely caused by how GTK3 deals with drawing images in a "queue" lineup. The timestamps would all post correctly in a batch, meaning its not stuck on any function, but the process itself was delayed.

I think GTK3 is perhaps setting the  function as a low priority in their queueing system, causing a delay in fast/often executed draw function.
Comment 11 Leo Ufimtsev CLA 2016-07-20 12:20:29 EDT
Potentially related:
498217: [GTK3] Dragging parts does not show rectangle
https://bugs.eclipse.org/bugs/show_bug.cgi?id=498217
Comment 12 Leo Ufimtsev CLA 2016-09-01 17:39:30 EDT
(In reply to Leo Ufimtsev from comment #11)
> Potentially related:
> 498217: [GTK3] Dragging parts does not show rectangle
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=498217

Nope, it appears that the issues are somewhat separate. 
I tested the snippet above on Gtk3.6, Gtk3.8, ...... Gtk3.20. The tracker is unreliable on all these gtk version. But the part-dragging issue above appears only in Gtk3.10 and onwards, but part-dragging works well on gtk3.6, gtk3.8.
Comment 13 Leo Ufimtsev CLA 2018-02-07 10:29:51 EST
Updating status as there still seems to be problems on newer Gtk3 versions.
Comment 14 Eric Williams CLA 2019-11-01 15:43:42 EDT
The snippet behaves somewhat properly -- right now if you run the snippet with a Display as the argument, the rectangle does appear but it's offset incorrectly to the left by about the Shell size. Likely the event or drawing coordinates are off.