gtk+ r21787 - in trunk: . gtk
- From: cdywan svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r21787 - in trunk: . gtk
- Date: Wed, 12 Nov 2008 16:11:30 +0000 (UTC)
Author: cdywan
Date: Wed Nov 12 16:11:30 2008
New Revision: 21787
URL: http://svn.gnome.org/viewvc/gtk+?rev=21787&view=rev
Log:
2008-11-12 Christian Dywan <christian imendio com>
Bug 560139 â GtkEntry doesn't paint with the right state
* gtk/gtkentry.c (gtk_entry_class_init), (gtk_entry_draw_frame),
(gtk_entry_expose): Reflect the right state if state-hint is set
Modified:
trunk/ChangeLog
trunk/gtk/gtkentry.c
Modified: trunk/gtk/gtkentry.c
==============================================================================
--- trunk/gtk/gtkentry.c (original)
+++ trunk/gtk/gtkentry.c Wed Nov 12 16:11:30 2008
@@ -987,6 +987,21 @@
GTK_TYPE_BORDER,
GTK_PARAM_READABLE));
+ /**
+ * GtkEntry:state-hint:
+ *
+ * Indicates whether to pass a proper widget state when
+ * drawing the shadow and the widget background.
+ *
+ * Since: 2.16
+ */
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_boolean ("state-hint",
+ P_("State Hint"),
+ P_("Whether to pass a proper state when drawing shadow or background"),
+ FALSE,
+ GTK_PARAM_READABLE));
+
gtk_settings_install_property (g_param_spec_boolean ("gtk-entry-select-on-focus",
P_("Select on focus"),
P_("Whether to select the contents of an entry when it is focused"),
@@ -1719,6 +1734,8 @@
{
GtkEntryPrivate *priv = GTK_ENTRY_GET_PRIVATE (widget);
gint x = 0, y = 0, width, height;
+ gboolean state_hint;
+ GtkStateType state;
gdk_drawable_get_size (widget->window, &width, &height);
@@ -1743,9 +1760,16 @@
height -= 2 * priv->focus_width;
}
+ gtk_widget_style_get (widget, "state-hint", &state_hint, NULL);
+ if (state_hint)
+ state = GTK_WIDGET_HAS_FOCUS (widget) ?
+ GTK_STATE_ACTIVE : GTK_WIDGET_STATE (widget);
+ else
+ state = GTK_STATE_NORMAL;
+
gtk_paint_shadow (widget->style, widget->window,
- GTK_STATE_NORMAL, priv->shadow_type,
- area, widget, "entry", x, y, width, height);
+ state, priv->shadow_type,
+ area, widget, "entry", x, y, width, height);
if (GTK_WIDGET_HAS_FOCUS (widget) && !priv->interior_focus)
{
@@ -1765,6 +1789,8 @@
GdkEventExpose *event)
{
GtkEntry *entry = GTK_ENTRY (widget);
+ gboolean state_hint;
+ GtkStateType state;
if (widget->window == event->window)
gtk_entry_draw_frame (widget, &event->area);
@@ -1773,8 +1799,15 @@
gint area_width, area_height;
gdk_drawable_get_size (entry->text_area, &area_width, &area_height);
+ gtk_widget_style_get (widget, "state-hint", &state_hint, NULL);
+ if (state_hint)
+ state = GTK_WIDGET_HAS_FOCUS (widget) ?
+ GTK_STATE_ACTIVE : GTK_WIDGET_STATE (widget);
+ else
+ state = GTK_WIDGET_STATE(widget);
+
gtk_paint_flat_box (widget->style, entry->text_area,
- GTK_WIDGET_STATE(widget), GTK_SHADOW_NONE,
+ state, GTK_SHADOW_NONE,
&event->area, widget, "entry_bg",
0, 0, area_width, area_height);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]