After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 677375 - tools do not strictly follow mouse pointer (missing motion events)
tools do not strictly follow mouse pointer (missing motion events)
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Tools
2.8.0
Other Linux
: Normal normal
: 2.8
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2012-06-04 09:37 UTC by Serge Gavrilov
Modified: 2012-06-18 16:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Quick and dirty hack (1.64 KB, patch)
2012-06-13 04:28 UTC, Massimo
none Details | Review
proposed patch (1.73 KB, patch)
2012-06-16 11:53 UTC, Massimo
none Details | Review

Description Serge Gavrilov 2012-06-04 09:37:32 UTC
To reproduce:

1) Create new image
2) Select rectangle selection tool
3) Begin to make a selection
4) Move a mouse pointer fast; then stop

Sometimes the selection stops at a different (from mouse pointer) position

This is not a duplicate of bug #645345, since this can be reproduced without "color management" display filter (though it is more easy to reproduce the with 
"color management" display filter).

I have tested this with latest git from branch gimp-2-8 with latest patch from Massimo fixing the bug #645345.

Please, take a look at the screencast: http://www.youtube.com/watch?v=gPATySQRE7c
Comment 1 Mikael Magnusson 2012-06-10 05:41:00 UTC
This problem is not limited to rectangle selection, it affects regular painting as well, though it is harder to reproduce. It's easier to stop in the middle of a fast movement if you just lift the mouse off the pad while moving fast rather than trying to stop.
Comment 2 Massimo 2012-06-10 13:18:14 UTC
Reading the documentation I'd say that either GDK_POINTER_MOTION_HINT_MASK
should be removed in app/display/gimpcanvas.h or 
gdk_event_request_motions (mevent) should be added in  
app/display/gimpdisplayshell-tool-events.c in function
gimp_display_shell_canvas_tool_events before returning
after processing GDK_MOTION_NOTIFY.

What is confusing is:

http://git.gnome.org/browse/gimp/commit/?id=8569c6e2f7ebe2204bc01b682397f2cd125393d9

and its comment
Comment 3 Michael Natterer 2012-06-10 13:30:58 UTC
Argh, I missed the define in that header. Please go ahead removing it.
Comment 4 Massimo 2012-06-10 15:29:39 UTC
Removed. Please test if it fixes the issues.

commit d5b6608ad4012a45c9dcb4636dd32f64a0d06d10
Author: Massimo Valentini <mvalentini@src.gnome.org>
Date:   Sun Jun 10 17:20:43 2012 +0200

    Bug 677375: tools do not strictly follow mouse...
    
    pointer (missing motion events)
Comment 5 Serge Gavrilov 2012-06-10 16:58:07 UTC
I still can reproduce the bug with latest gimp-2-8 (updated up to commit 
http://git.gnome.org/browse/gimp/commit/?h=gimp-2-8&id=a4ecfde635f993a6c196cacbf357623a93bb0e5b )
Comment 6 Massimo 2012-06-11 10:53:46 UTC
instrumenting libgimpwidgets/gimphelpui.c like this:

diff --git a/libgimpwidgets/gimphelpui.c b/libgimpwidgets/gimphelpui.c
index 8e55211..c096406 100644
--- a/libgimpwidgets/gimphelpui.c
+++ b/libgimpwidgets/gimphelpui.c
@@ -224,7 +224,21 @@ gimp_help_set_help_data (GtkWidget   *widget,

   if (tooltips_enabled)
     {
+      const gchar *type_name = g_type_name (G_TYPE_FROM_INSTANCE (widget));
+      if (g_strcmp0 (type_name, "GimpCanvas") == 0)
+        g_printerr ("%s %p %s %x %x %d\n", G_STRLOC,
+              widget,
+              g_type_name (G_TYPE_FROM_INSTANCE (widget)),
+              gtk_widget_get_events(widget),
+              gtk_widget_get_events (widget) & GDK_POINTER_MOTION_HINT_MASK);
       gtk_widget_set_tooltip_text (widget, tooltip);
+      if (g_strcmp0 (type_name, "GimpCanvas") == 0)
+        g_printerr ("%s %p %s %x %x\n", G_STRLOC,
+              widget,
+              g_type_name (G_TYPE_FROM_INSTANCE (widget)),
+              gtk_widget_get_events(widget),
+              gtk_widget_get_events (widget) & GDK_POINTER_MOTION_HINT_MASK);
+

       if (GTK_IS_MENU_ITEM (widget))
         gimp_help_menu_item_set_tooltip (widget, tooltip, help_id);

shows that gtk_widget_set_tooltip_text is setting the MOTION_HINT flag.

The only way I've found to clear definitely that flag is to comment out
the three calls to gimp_help_set_help_data (shell->canvas, ...);
in app/display/gimpdisplayshell.c, this appears to work.

Instead adding gdk_event_request_motions does not work.

Don't know if it is better to have a tooltip on the canvas
or to follow the mouse faithfully.
Comment 7 Massimo 2012-06-13 04:28:09 UTC
Created attachment 216246 [details] [review]
Quick and dirty hack

Useful only to verify if clearing the GDK_POINTER_MOTION_HINT
is sufficient to fix all the issues.
Comment 8 Serge Gavrilov 2012-06-13 08:27:22 UTC
I cannot reproduce the bug with the latest patch.
Comment 9 Michael Natterer 2012-06-13 14:24:55 UTC
Massimo, doesn't simply not setting the tooltip have same effect?
Comment 10 Massimo 2012-06-13 16:54:36 UTC
(In reply to comment #9)
> Massimo, doesn't simply not setting the tooltip have same effect?

The same GimpCanvas widget is used for the empty image window
and to display the image content. When GIMP is started on that 
widget it is set a tooltip, when an image is loaded the tooltip
is removed, but the flag cannot be reset.

This also means that apart the window that used to be the empty
image window (showing Wilber), all other windows should not have 
the problem described here.

Obviously never setting the tooltip, solves the problem.
Comment 11 Michael Natterer 2012-06-13 18:45:16 UTC
Yeah let's kill the tooltip then, perhaps by #if 0'ing it and adding
a comment, so it doesn't get added back when somebody notices it's missing :)

Dropping files to an application's window doesn't need to be explained
these days i think.
Comment 12 Mikael Magnusson 2012-06-13 22:16:34 UTC
> This also means that apart the window that used to be the empty
image window (showing Wilber), all other windows should not have 
the problem described here.

Are you sure about this? We set tooltips on the menu button and rulers, and gtk+ uses the same X window for all of these and the canvas iiuc.
Comment 13 Michael Natterer 2012-06-14 06:16:26 UTC
The toplevel X window selects all events anyway, and GDK forwards them
the the resp. client-side window, and the canvas has its own window. If
this doesn't work, then GDK is broken. X windows are an implementation
detail.
Comment 14 Massimo 2012-06-14 10:51:02 UTC
(In reply to comment #12)
> > This also means that apart the window that used to be the empty
> image window (showing Wilber), all other windows should not have 
> the problem described here.
> 
> Are you sure about this? We set tooltips on the menu button and rulers, and
> gtk+ uses the same X window for all of these and the canvas iiuc.

I'm sure that:

after the commit referenced in comment #4 and without the patch
attached to comment #7
      
a) if you open simultaneously 2 (or more) images in multi-window-mode
   only one of them exhibits the problem.

b) rulers and GimpCanvas don't share the same X window. GimpCanvas
   creates its own in GimpOverlayBox:realize.
Comment 15 Massimo 2012-06-16 11:53:06 UTC
Created attachment 216559 [details] [review]
proposed patch

A patch disabling (#if 0) the three problematic calls.

If there is no objection I'll push it later
Comment 16 Massimo 2012-06-18 16:19:19 UTC
Fixed in master and gimp-2-8:

commit 5835a730a3eef3cee579c50b250bb8ba15b77d7c
Author: Massimo Valentini <mvalentini@src.gnome.org>
Date:   Mon Jun 18 18:14:43 2012 +0200

    Bug 677375: tools do not strictly follow mouse...
    
    pointer (missing motion events)
    
    Disable calls gimp_help_set_help_data for shell->canavs