[gimp] Bug 759939 - Ghost brush outline in FG Select tool



commit 151b44e4bb97afd4bc177f244ccbfa70da3dffea
Author: Michael Natterer <mitch gimp org>
Date:   Fri Oct 14 22:08:02 2016 +0200

    Bug 759939 - Ghost brush outline in FG Select tool
    
    Fix the check that keeps events on overlay widgets from entering the
    tool event mechanism, they have no business there.
    
    gimp_overlay_child_realize(): set the embedding widget's event mask on
    all overlay children, so their windows will be used as event window,
    so their events become distinguishable from events on the parent (the
    canvas).
    
    gimp_display_shell_canvas_tool_events(): fix the check for events on
    overlays, and skip them for real this time.

 app/display/gimpdisplayshell-tool-events.c |   17 ++++++++++++++---
 app/widgets/gimpoverlaychild.c             |    3 ++-
 2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-tool-events.c b/app/display/gimpdisplayshell-tool-events.c
index 234d43d..de794af 100644
--- a/app/display/gimpdisplayshell-tool-events.c
+++ b/app/display/gimpdisplayshell-tool-events.c
@@ -49,6 +49,7 @@
 #include "tools/gimptoolcontrol.h"
 #include "tools/tool_manager.h"
 
+#include "gimpcanvas.h"
 #include "gimpdisplay.h"
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-autoscroll.h"
@@ -321,11 +322,21 @@ gimp_display_shell_canvas_tool_events (GtkWidget        *canvas,
   if (gimp_display_shell_events (canvas, event, shell))
     return TRUE;
 
-  /*  ignore events on overlays, which are the canvas' children
+  /*  events on overlays have a different window, but these windows'
+   *  user_data can still be the canvas, we need to check manually if
+   *  the event's window and the canvas' window are different.
    */
-  if (gtk_widget_is_ancestor (gtk_get_event_widget (event), shell->canvas))
+  if (event->any.window != gtk_widget_get_window (canvas))
     {
-      return FALSE;
+      GtkWidget *event_widget;
+
+      gdk_window_get_user_data (event->any.window, (gpointer) &event_widget);
+
+      /*  if the event came from a different window than the canvas',
+       *  check if it came from a canvas child and bail out.
+       */
+      if (gtk_widget_get_ancestor (event_widget, GIMP_TYPE_CANVAS))
+        return FALSE;
     }
 
   display = shell->display;
diff --git a/app/widgets/gimpoverlaychild.c b/app/widgets/gimpoverlaychild.c
index 44c3aaf..72449fe 100644
--- a/app/widgets/gimpoverlaychild.c
+++ b/app/widgets/gimpoverlaychild.c
@@ -170,7 +170,8 @@ gimp_overlay_child_realize (GimpOverlayBox   *box,
   attributes.wclass      = GDK_INPUT_OUTPUT;
   attributes.visual      = gtk_widget_get_visual (child->widget);
   attributes.colormap    = gtk_widget_get_colormap (child->widget);
-  attributes.event_mask  = GDK_EXPOSURE_MASK;
+  attributes.event_mask  = (gtk_widget_get_events (widget) |
+                            GDK_EXPOSURE_MASK);
   attributes.cursor      = gdk_cursor_new_for_display (display, GDK_LEFT_PTR);
 
   attributes_mask = (GDK_WA_X        |


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]