[gtk-theme-engine-clearlooks] Handle entries in render_frame()



commit 5bf9130fd94d22e8e88e932d71389d0a9127aa0d
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Nov 16 00:57:44 2010 +0100

    Handle entries in render_frame()

 src/clearlooks_engine.c |  105 ++++++++++++++++++++++++----------------------
 1 files changed, 55 insertions(+), 50 deletions(-)
---
diff --git a/src/clearlooks_engine.c b/src/clearlooks_engine.c
index cb7f45a..3ba674f 100644
--- a/src/clearlooks_engine.c
+++ b/src/clearlooks_engine.c
@@ -150,56 +150,7 @@ clearlooks_engine_render_shadow (DRAW_ARGS)
 
 	CHECK_ARGS
 
-	/* The "frame" thing is a hack because of GtkCombo. */
-	if ((DETAIL ("entry") && !CHECK_HINT (GE_HINT_TREEVIEW)) ||
-	    (DETAIL ("frame") && CHECK_HINT (GE_HINT_COMBOBOX_ENTRY)))
-	{
-		WidgetParameters params;
-		FocusParameters  focus;
-
-		/* Override the entries state type, because we are too lame to handle this via
-		 * the focus ring, and GtkEntry doesn't even set the INSENSITIVE state ... */
-		if (state_type == GTK_STATE_NORMAL && widget && GE_IS_ENTRY (widget))
-			state_type = gtk_widget_get_state (widget);
-
-		clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
-		if (CHECK_HINT (GE_HINT_COMBOBOX_ENTRY) || CHECK_HINT (GE_HINT_SPINBUTTON))
-		{
-			width += style->xthickness;
-			if (!params.ltr)
-				x -= style->xthickness;
-
-			if (params.ltr)
-				params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
-			else
-				params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
-		}
-		
-		/* Fill the background as it is initilized to base[NORMAL].
-		 * Relevant GTK+ bug: http://bugzilla.gnome.org/show_bug.cgi?id=513471
-		 * The fill only happens if no hint has been added by some application
-		 * that is faking GTK+ widgets. */
-		if (!widget || !g_object_get_data(G_OBJECT (widget), "transparent-bg-hint"))
-		{
-			cairo_rectangle (cr, 0, 0, width, height);
-			ge_cairo_set_color (cr, &params.parentbg);
-			cairo_fill (cr);
-		}
-
-		/* Focus color */
-		if (clearlooks_style->has_focus_color)
-		{
-			ge_gdk_color_to_cairo (&clearlooks_style->focus_color, &focus.color);
-			focus.has_color = TRUE;
-		}
-		else
-			focus.color = colors->spot[2];
-
-		STYLE_FUNCTION (draw_entry) (cr, &clearlooks_style->colors, &params, &focus,
-		                             x, y, width, height);
-	}
-	else if (DETAIL ("frame") && CHECK_HINT (GE_HINT_STATUSBAR))
+	if (DETAIL ("frame") && CHECK_HINT (GE_HINT_STATUSBAR))
 	{
 		WidgetParameters params;
 
@@ -531,6 +482,60 @@ clearlooks_engine_render_frame (GtkThemingEngine *engine,
 			style_functions->draw_menubar (cr, engine, &menubar,
 						       x, y, width, height);
 	}
+	if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_ENTRY) &&
+	    !gtk_widget_path_has_parent (path, GTK_TYPE_TREE_VIEW))
+	{
+		FocusParameters  focus;
+		CairoColor *focus_color;
+
+		gtk_theming_engine_get (engine, state,
+					"-clearlooks-focus-color", &focus_color,
+					NULL);
+
+#if 0
+		/* Override the entries state type, because we are too lame to handle this via
+		 * the focus ring, and GtkEntry doesn't even set the INSENSITIVE state ... */
+		if (state_type == GTK_STATE_NORMAL && widget && GE_IS_ENTRY (widget))
+			state_type = gtk_widget_get_state (widget);
+
+		if (CHECK_HINT (GE_HINT_COMBOBOX_ENTRY) || CHECK_HINT (GE_HINT_SPINBUTTON))
+		{
+			width += style->xthickness;
+			if (!params.ltr)
+				x -= style->xthickness;
+
+			if (params.ltr)
+				params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
+			else
+				params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
+		}
+
+		/* Fill the background as it is initilized to base[NORMAL].
+		 * Relevant GTK+ bug: http://bugzilla.gnome.org/show_bug.cgi?id=513471
+		 * The fill only happens if no hint has been added by some application
+		 * that is faking GTK+ widgets. */
+		if (!widget || !g_object_get_data(G_OBJECT (widget), "transparent-bg-hint"))
+		{
+			cairo_rectangle (cr, 0, 0, width, height);
+			ge_cairo_set_color (cr, &params.parentbg);
+			cairo_fill (cr);
+		}
+#endif
+
+		/* Focus color */
+		if (focus_color)
+		{
+			focus.color = *focus_color;
+			focus.has_color = TRUE;
+		}
+		else
+			clearlooks_lookup_spot (engine, 2, (GdkRGBA *) &focus.color);
+
+		style_functions->draw_entry (cr, engine, &focus,
+		                             x, y, width, height);
+
+		gdk_rgba_free ((GdkRGBA *) focus_color);
+	}
 	else if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_BUTTON) &&
 		 gtk_theming_engine_has_class (engine, GTK_STYLE_REGION_COLUMN_HEADER))
 	{



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]