app: replace using the "draw" signal by "expose-event" on GTK+2.

Not sure why but adding a handler to the "expose-event" signal of
GimpDisplayShell (similarly to how we do it in master branch on "draw")
just didn't work. But it works on the already existing signal handling
on the canvas instead (which actually is not a bad deal, as we also
remove the coordinates translation so maybe we should test this on
`master` too).

Note: why we are backporting all this logics to gimp-2-10 is because
changes in macOS BigSur broke the selection's marching ants the same way
they broke on Wayland and it was confirmed this fix worked for BigSur as
well, at least on the dev builds.
It is unnecessary to backport for Wayland (because GIMP 2.10 is based on
GTK2 which anyway works only through XWayland, hence doesn't have the
issue), we do it only for macOS BigSur (and further). Well at least the
fix will hopefully work on the stable branch, because I cannot test
myself.

See issue #5952.
This commit is contained in:
Jehan
2021-10-22 23:08:07 +02:00
parent 16adb3bf3d
commit 6be014fc59
3 changed files with 1 additions and 23 deletions

View File

@ -593,6 +593,7 @@ gimp_display_shell_canvas_draw_image (GimpDisplayShell *shell,
gimp_canvas_item_draw (shell->unrotated_item, cr);
/* restart (and recalculate) the selection boundaries */
gimp_display_shell_selection_draw (shell, cr);
gimp_display_shell_selection_restart (shell);
}

View File

@ -412,12 +412,6 @@ selection_generate_segs (Selection *selection)
&selection->n_segs_in, &selection->n_segs_out,
0, 0, 0, 0);
if (selection->n_segs_in || selection->n_segs_out)
gtk_widget_translate_coordinates (GTK_WIDGET (selection->shell->canvas),
GTK_WIDGET (selection->shell),
0, 0,
&canvas_offset_x, &canvas_offset_y);
if (selection->n_segs_in)
{
selection->segs_in = g_new (GimpSegment, selection->n_segs_in);

View File

@ -151,8 +151,6 @@ static void gimp_display_shell_unmap (GtkWidget *widget);
static void gimp_display_shell_screen_changed (GtkWidget *widget,
GdkScreen *previous);
static gboolean gimp_display_shell_popup_menu (GtkWidget *widget);
static gboolean gimp_display_shell_draw (GtkWidget *widget,
cairo_t *cr);
static void gimp_display_shell_real_scaled (GimpDisplayShell *shell);
static void gimp_display_shell_real_scrolled (GimpDisplayShell *shell);
@ -257,7 +255,6 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass)
widget_class->unmap = gimp_display_shell_unmap;
widget_class->screen_changed = gimp_display_shell_screen_changed;
widget_class->popup_menu = gimp_display_shell_popup_menu;
widget_class->draw = gimp_display_shell_draw;
klass->scaled = gimp_display_shell_real_scaled;
klass->scrolled = gimp_display_shell_real_scrolled;
@ -1056,20 +1053,6 @@ gimp_display_shell_popup_menu (GtkWidget *widget)
return TRUE;
}
static gboolean
gimp_display_shell_draw (GtkWidget *widget,
cairo_t *cr)
{
GtkWidgetClass *widget_class = g_type_class_peek_parent (parent_class);
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (widget);
gboolean stop_handlers;
stop_handlers = widget_class->draw (widget, cr);
gimp_display_shell_selection_draw (shell, cr);
return stop_handlers;
}
static void
gimp_display_shell_real_scaled (GimpDisplayShell *shell)
{