[gtk+] GtkStyleContext: handle prelight transitions
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkStyleContext: handle prelight transitions
- Date: Sat, 4 Dec 2010 15:24:31 +0000 (UTC)
commit 3d956b10ee15264f93758422755378e758f7e74b
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Nov 24 23:21:28 2010 +0100
GtkStyleContext: handle prelight transitions
gtk/gtkthemingengine.c | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index 4b44502..b1db538 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -1588,7 +1588,8 @@ render_frame_internal (GtkThemingEngine *engine,
GdkRGBA *border_color;
GtkBorderStyle border_style;
gint border_width, radius;
- gdouble d1, d2, m;
+ gdouble progress, d1, d2, m;
+ gboolean running;
state = gtk_theming_engine_get_state (engine);
gtk_theming_engine_get (engine, state,
@@ -1598,6 +1599,33 @@ render_frame_internal (GtkThemingEngine *engine,
"border-radius", &radius,
NULL);
+ running = gtk_theming_engine_state_is_running (engine, GTK_STATE_PRELIGHT, &progress);
+
+ if (running)
+ {
+ GtkStateFlags other_state;
+ GdkRGBA *other_color;
+
+ if (state & GTK_STATE_FLAG_PRELIGHT)
+ {
+ other_state = state & ~(GTK_STATE_FLAG_PRELIGHT);
+ progress = 1 - progress;
+ }
+ else
+ other_state = state | GTK_STATE_FLAG_PRELIGHT;
+
+ gtk_theming_engine_get (engine, other_state,
+ "border-color", &other_color,
+ NULL);
+
+ border_color->red = CLAMP (border_color->red + ((other_color->red - border_color->red) * progress), 0, 1);
+ border_color->green = CLAMP (border_color->green + ((other_color->green - border_color->green) * progress), 0, 1);
+ border_color->blue = CLAMP (border_color->blue + ((other_color->blue - border_color->blue) * progress), 0, 1);
+ border_color->alpha = CLAMP (border_color->alpha + ((other_color->alpha - border_color->alpha) * progress), 0, 1);
+
+ gdk_rgba_free (other_color);
+ }
+
cairo_save (cr);
color_shade (border_color, 1.8, &lighter);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]