[gimp] app: fix gimp_highlight_widget() to not draw multiple highlights
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: fix gimp_highlight_widget() to not draw multiple highlights
- Date: Wed, 23 May 2018 17:48:16 +0000 (UTC)
commit 4eb50f8a64e3a465ee8a854f5c22efc76dfc7458
Author: Michael Natterer <mitch gimp org>
Date: Wed May 23 19:45:03 2018 +0200
app: fix gimp_highlight_widget() to not draw multiple highlights
app/widgets/gimpwidgets-utils.c | 43 +++++++++++++++++++++++++++-----------
1 files changed, 30 insertions(+), 13 deletions(-)
---
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index cff6383..0d4797d 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -1233,22 +1233,36 @@ void
gimp_highlight_widget (GtkWidget *widget,
gboolean highlight)
{
+ gboolean old_highlight;
+
g_return_if_fail (GTK_IS_WIDGET (widget));
- if (highlight)
- {
- g_signal_connect_after (widget, "draw",
- G_CALLBACK (gimp_highlight_widget_draw),
- NULL);
- }
- else
+ highlight = highlight ? TRUE : FALSE;
+
+ old_highlight = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
+ "gimp-widget-highlight"));
+
+ if (highlight != old_highlight)
{
- g_signal_handlers_disconnect_by_func (widget,
- gimp_highlight_widget_draw,
- NULL);
- }
+ if (highlight)
+ {
+ g_signal_connect_after (widget, "draw",
+ G_CALLBACK (gimp_highlight_widget_draw),
+ NULL);
+ }
+ else
+ {
+ g_signal_handlers_disconnect_by_func (widget,
+ gimp_highlight_widget_draw,
+ NULL);
+ }
- gtk_widget_queue_draw (widget);
+ g_object_set_data (G_OBJECT (widget),
+ "gimp-widget-highlight",
+ GINT_TO_POINTER (highlight));
+
+ gtk_widget_queue_draw (widget);
+ }
}
typedef struct
@@ -1311,6 +1325,8 @@ gimp_widget_blink (GtkWidget *widget)
g_return_if_fail (GTK_IS_WIDGET (widget));
+ gimp_widget_blink_cancel (widget);
+
blink = widget_blink_new ();
g_object_set_data_full (G_OBJECT (widget), "gimp-widget-blink", blink,
@@ -1323,7 +1339,8 @@ gimp_widget_blink (GtkWidget *widget)
gimp_highlight_widget (widget, TRUE);
}
-void gimp_widget_blink_cancel (GtkWidget *widget)
+void
+gimp_widget_blink_cancel (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]