[gtk+/wip/window-unfocused-fixes: 3/13] scale: Set GTK_STATE_FLAG_WINDOW_UNFOCUSED on draw
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/window-unfocused-fixes: 3/13] scale: Set GTK_STATE_FLAG_WINDOW_UNFOCUSED on draw
- Date: Tue, 13 Dec 2011 21:03:25 +0000 (UTC)
commit 5fbf3389f6ee1f925818bacaecb3c5f08e709fb5
Author: Rui Matos <tiagomatos gmail com>
Date: Sun Dec 11 22:52:51 2011 +0000
scale: Set GTK_STATE_FLAG_WINDOW_UNFOCUSED on draw
https://bugzilla.gnome.org/show_bug.cgi?id=666126
gtk/gtkscale.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index 3266f2e..5b70dac 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -1021,6 +1021,7 @@ gtk_scale_draw (GtkWidget *widget,
GtkScalePrivate *priv = scale->priv;
GtkRange *range = GTK_RANGE (scale);
GtkStateFlags state = 0;
+ GtkStateFlags widget_state;
GtkStyleContext *context;
gint *marks;
gint focus_padding;
@@ -1040,9 +1041,13 @@ gtk_scale_draw (GtkWidget *widget,
*/
GTK_WIDGET_CLASS (gtk_scale_parent_class)->draw (widget, cr);
- if (!gtk_widget_is_sensitive (widget))
+ widget_state = gtk_widget_get_state_flags (widget);
+
+ if ((widget_state & GTK_STATE_FLAG_INSENSITIVE) == 0)
state |= GTK_STATE_FLAG_INSENSITIVE;
+ state |= (widget_state & GTK_STATE_FLAG_WINDOW_UNFOCUSED);
+
if (priv->marks)
{
GtkOrientation orientation;
@@ -1187,10 +1192,13 @@ gtk_scale_draw (GtkWidget *widget,
gtk_scale_get_layout_offsets (scale, &x, &y);
gtk_widget_get_allocation (widget, &allocation);
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, state);
gtk_render_layout (context, cr,
x - allocation.x,
y - allocation.y,
layout);
+ gtk_style_context_restore (context);
}
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]