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.
This commit is contained in:
Michael Natterer 2016-10-14 22:08:02 +02:00
parent 3a52bf4cce
commit 151b44e4bb
2 changed files with 16 additions and 4 deletions

View File

@ -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;

View File

@ -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 |