[Xfce4-commits] [apps/xfce4-notifyd] 20/29: Enclose all gtk_style_context_get with gtk_style_context_save/ gtk_style_context_restore. This is something completely counterintuitive, but in Gtk >= 3.18 calling gtk_style_context_get with a state that is different from the current widget state, causes the widget to redraw itself. Resulting in a storm of draw callbacks. See : https://bugzilla.gnome.org/show_bug.cgi?id=756524
noreply at xfce.org
noreply at xfce.org
Wed Jun 29 23:20:10 CEST 2016
This is an automated email from the git hooks/post-receive script.
ochosi pushed a commit to branch master
in repository apps/xfce4-notifyd.
commit 3d220778770bdac9b4e262fa40b8ac1eed701991
Author: Ali Abdallah <aliovx at gmail.com>
Date: Thu Oct 29 07:28:08 2015 +0100
Enclose all gtk_style_context_get with gtk_style_context_save/ gtk_style_context_restore. This is something completely counterintuitive, but in Gtk >= 3.18 calling gtk_style_context_get with a state that is different from the current widget state, causes the widget to redraw itself. Resulting in a storm of draw callbacks. See : https://bugzilla.gnome.org/show_bug.cgi?id=756524
---
xfce4-notifyd/xfce-notify-window.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/xfce4-notifyd/xfce-notify-window.c b/xfce4-notifyd/xfce-notify-window.c
index 686d4b1..ac9ee43 100644
--- a/xfce4-notifyd/xfce-notify-window.c
+++ b/xfce4-notifyd/xfce-notify-window.c
@@ -318,9 +318,11 @@ get_max_border_width (GtkStyleContext *context,
GtkBorder border_width;
gint border_width_max;
+ gtk_style_context_save (context);
gtk_style_context_get_border (context,
state,
&border_width);
+ gtk_style_context_restore (context);
border_width_max = MAX(border_width.left,
MAX(border_width.top,
@@ -351,11 +353,18 @@ xfce_notify_window_draw_rectangle (XfceNotifyWindow *window,
state = GTK_STATE_FLAG_PRELIGHT;
context = gtk_widget_get_style_context (widget);
+ /* This is something completely counterintuitive,
+ * but in Gtk >= 3.18 calling gtk_style_context_get
+ * with a state that is different from the current widget state, causes
+ * the widget to redraw itself. Resulting in a storm of draw callbacks.
+ * See : https://bugzilla.gnome.org/show_bug.cgi?id=756524 */
+ gtk_style_context_save (context);
gtk_style_context_get (context,
state,
"border-radius", &radius,
NULL);
-
+ gtk_style_context_restore (context);
+
border_width = get_max_border_width (context, state);
border_padding = border_width / 2.0;
@@ -430,12 +439,14 @@ static gboolean xfce_notify_window_draw (GtkWidget *widget,
/* Get the style context to get style properties */
context = gtk_widget_get_style_context (widget);
+ gtk_style_context_save (context);
gtk_style_context_get (context,
state,
"border-color", &border_color,
"background-color", &bg_color,
NULL);
-
+ gtk_style_context_restore (context);
+
/* Draw the background, getting its color from the style context*/
cairo_set_source_rgba (cr2,
bg_color->red, bg_color->green, bg_color->blue,
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list