[murrine/gtk+3] Started port of the engine to Gtk+ 3.0. Do expect breakage, even if I hope it won't break :-)



commit 95a617085a76401edde44d1b54c5206210c56976
Author: Andrea Cimitan <andrea cimitan gmail com>
Date:   Tue Oct 12 19:48:33 2010 +0200

    Started port of the engine to Gtk+ 3.0. Do expect breakage, even if I hope it won't break :-)

 Makefile.am            |    2 +-
 configure.ac           |    6 +-
 src/cairo-support.c    |   44 ++++-
 src/cairo-support.h    |    2 +
 src/murrine_rc_style.h |    5 +-
 src/murrine_style.c    |  556 ++++++++++++++++--------------------------------
 src/murrine_style.h    |    5 +-
 src/murrine_types.h    |   20 +--
 src/support.c          |  171 ++-------------
 src/support.h          |    5 -
 10 files changed, 262 insertions(+), 554 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 131ca9f..5f02bf4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,7 +3,7 @@ INCLUDES = $(GTK_CFLAGS)
 SUBDIRS = schema
 DIST_SUBDIRS = $(SUBDIRS) po
 
-enginedir = $(libdir)/gtk-2.0/$(GTK_VERSION)/engines
+enginedir = $(libdir)/gtk-3.0/$(GTK_VERSION)/engines
 engine_LTLIBRARIES = libmurrine.la
 
 EXTRA_DIST = ./src/config.h.in \
diff --git a/configure.ac b/configure.ac
index 832edec..a69e244 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,15 +39,15 @@ AC_ARG_ENABLE(rgba,
               [rgba=$enableval],
               [rgba="yes"], )
 
-PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18.0,,
-                  AC_MSG_ERROR([GTK+-2.18 is required to compile murrine]))
+PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 2.91.0,,
+                  AC_MSG_ERROR([GTK+-3.0 is required to compile murrine]))
 
 PKG_CHECK_MODULES(pixman,[pixman-1],,AC_MSG_ERROR([Pixman is required to compile murrine]))
 
 AC_SUBST(GTK_CFLAGS)
 AC_SUBST(GTK_LIBS)
 
-GTK_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
+GTK_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`
 AC_SUBST(GTK_VERSION)
 
 AC_SUBST(BUILD_ENGINES)
diff --git a/src/cairo-support.c b/src/cairo-support.c
index 5ba17d3..7f14787 100644
--- a/src/cairo-support.c
+++ b/src/cairo-support.c
@@ -266,14 +266,15 @@ void
 murrine_get_parent_bg (const GtkWidget *widget, MurrineRGB *color)
 {
 	GtkStateType state_type;
+	GtkStyle *style;
 	const GtkWidget *parent;
-	GdkColor *gcolor;
+	GdkColor gcolor;
 	gboolean stop;
 
 	if (widget == NULL)
 		return;
 
-	parent = widget->parent;
+	parent = gtk_widget_get_parent(GTK_WIDGET(widget));
 	stop = FALSE;
 
 	while (parent && !stop)
@@ -294,7 +295,7 @@ murrine_get_parent_bg (const GtkWidget *widget, MurrineRGB *color)
 		}
 
 		if (!stop)
-			parent = parent->parent;
+			parent = gtk_widget_get_parent(GTK_WIDGET(parent));
 	}
 
 	if (parent == NULL)
@@ -302,9 +303,42 @@ murrine_get_parent_bg (const GtkWidget *widget, MurrineRGB *color)
 
 	state_type = GTK_WIDGET_STATE (parent);
 
-	gcolor = &parent->style->bg[state_type];
+	style = gtk_widget_get_style(GTK_WIDGET(&parent));
+	gcolor = style->bg[state_type];
 
-	murrine_gdk_color_to_rgb (gcolor, &color->r, &color->g, &color->b);
+	murrine_gdk_color_to_rgb (&gcolor, &color->r, &color->g, &color->b);
+}
+
+void
+murrine_transform_for_layout (cairo_t *cr,
+                              PangoLayout *layout,
+                              int x,
+                              int y)
+{
+        const PangoMatrix *matrix;
+
+        matrix = pango_context_get_matrix (pango_layout_get_context (layout));
+        if (matrix)
+        {
+                cairo_matrix_t cairo_matrix;
+                PangoRectangle rect;
+
+                cairo_matrix_init (&cairo_matrix,
+                                   matrix->xx, matrix->yx,
+                                   matrix->xy, matrix->yy,
+                                   matrix->x0, matrix->y0);
+
+                pango_layout_get_extents (layout, NULL, &rect);
+                pango_matrix_transform_rectangle (matrix, &rect);
+                pango_extents_to_pixels (&rect, NULL);
+
+                cairo_matrix.x0 += x - rect.x;
+                cairo_matrix.y0 += y - rect.y;
+
+                cairo_set_matrix (cr, &cairo_matrix);
+        }
+        else
+                cairo_translate (cr, x, y);
 }
 
 void
diff --git a/src/cairo-support.h b/src/cairo-support.h
index cb9082f..ee67c69 100644
--- a/src/cairo-support.h
+++ b/src/cairo-support.h
@@ -36,6 +36,8 @@ G_GNUC_INTERNAL void murrine_gdk_color_to_rgb (GdkColor *c,
 G_GNUC_INTERNAL void murrine_get_parent_bg (const GtkWidget *widget,
                                             MurrineRGB *color);
 
+G_GNUC_INTERNAL void murrine_transform_for_layout (cairo_t *cr, PangoLayout *layout, int x, int y);
+
 G_GNUC_INTERNAL void murrine_set_color_rgb (cairo_t *cr,
                                             const MurrineRGB *color);
 
diff --git a/src/murrine_rc_style.h b/src/murrine_rc_style.h
index 8e3d7a8..79f9a99 100644
--- a/src/murrine_rc_style.h
+++ b/src/murrine_rc_style.h
@@ -18,7 +18,7 @@
  *
  */
 
-#include <gtk/gtkrc.h>
+#include <gtk/gtk.h>
 
 #ifndef MURRINE_RC_STYLE_H
 #define MURRINE_RC_STYLE_H
@@ -153,6 +153,7 @@ struct _MurrineRcStyleClass
 	GtkRcStyleClass parent_class;
 };
 
-GType murrine_rc_style_get_type	(void);
+G_GNUC_INTERNAL void  murrine_rc_style_register_types (GTypeModule *module);
+G_GNUC_INTERNAL GType murrine_rc_style_get_type       (void);
 
 #endif /* MURRINE_RC_STYLE_H */
diff --git a/src/murrine_style.c b/src/murrine_style.c
index 30af80e..f1327d4 100644
--- a/src/murrine_style.c
+++ b/src/murrine_style.c
@@ -22,7 +22,6 @@
 #include <cairo.h>
 #include <math.h>
 #include <string.h>
-#include <sys/time.h>
 
 #include "murrine_style.h"
 #include "murrine_rc_style.h"
@@ -35,13 +34,11 @@
 #define SCALE_SIZE 5
 
 #define DETAIL(xx) ((detail) && (!strcmp(xx, detail)))
-#define COMPARE_COLORS(a,b) (a.red == b.red && a.green == b.green && a.blue == b.blue)
 
 #define DRAW_ARGS GtkStyle      *style, \
-                  GdkWindow     *window, \
+                  cairo_t       *cr, \
                   GtkStateType  state_type, \
                   GtkShadowType shadow_type, \
-                  GdkRectangle  *area, \
                   GtkWidget     *widget, \
                   const gchar   *detail, \
                   gint          x, \
@@ -50,19 +47,9 @@
                   gint          height
 
 #define CHECK_ARGS \
-	g_return_if_fail (window != NULL); \
-	g_return_if_fail (style != NULL);
-
-#define SANITIZE_SIZE \
-	g_return_if_fail (width  >= -1); \
-	g_return_if_fail (height >= -1); \
-	\
-	if ((width == -1) && (height == -1)) \
-		gdk_drawable_get_size (window, &width, &height); \
-	else if (width == -1) \
-		gdk_drawable_get_size (window, &width, NULL); \
-	else if (height == -1) \
-		gdk_drawable_get_size (window, NULL, &height);
+	g_return_if_fail (cr != NULL);			\
+	g_return_if_fail (style != NULL);                     \
+	cairo_set_line_width (cr, 1.0);
 
 #ifdef HAVE_ANIMATION
 #include "animation.h"
@@ -72,26 +59,6 @@
 
 G_DEFINE_DYNAMIC_TYPE (MurrineStyle, murrine_style, GTK_TYPE_STYLE)
 
-static cairo_t *
-murrine_begin_paint (GdkDrawable *window, GdkRectangle *area)
-{
-	cairo_t *cr;
-
-	g_return_val_if_fail (window != NULL, NULL);
-
-	cr = (cairo_t*) gdk_cairo_create (window);
-	cairo_set_line_width (cr, 1.0);
-
-	if (area)
-	{
-		cairo_rectangle (cr, area->x, area->y, area->width, area->height);
-		cairo_clip_preserve (cr);
-		cairo_new_path (cr);
-	}
-
-	return cr;
-}
-
 static
 boolean murrine_widget_is_rgba (GtkWidget *widget)
 {
@@ -106,11 +73,12 @@ boolean murrine_widget_is_rgba (GtkWidget *widget)
 #ifdef HAVE_RGBA
 	if (gdk_screen_is_composited(screen))
 	{
-		GdkVisual *visual = gtk_widget_get_visual (widget);
-		if (visual->depth == 32 && (visual->red_mask   == 0xff0000 &&
-		                            visual->green_mask == 0x00ff00 &&
-		                            visual->blue_mask  == 0x0000ff))
-			use_rgba = TRUE;
+	/* XXX RGBA is disabled for the moment */
+/*		GdkVisual *visual = gtk_widget_get_visual (widget);*/
+/*		if (gdk_visual_get_depth (visual) == 32 && (visual->red_mask   == 0xff0000 &&*/
+/*		                            visual->green_mask == 0x00ff00 &&*/
+/*		                            visual->blue_mask  == 0x0000ff))*/
+			use_rgba = FALSE;
 	}
 #endif
 
@@ -128,11 +96,11 @@ murrine_set_widget_parameters (const GtkWidget  *widget,
 	params->active     = (state_type == GTK_STATE_ACTIVE);
 	params->prelight   = (state_type == GTK_STATE_PRELIGHT);
 	params->disabled   = (state_type == GTK_STATE_INSENSITIVE);
-	params->state_type = (MurrineStateType)state_type;
+	params->state_type = state_type;
 	params->corners    = MRN_CORNER_ALL;
 	params->ltr        = murrine_widget_is_ltr ((GtkWidget*)widget);
-	params->focus      = (MURRINE_STYLE (style)->focusstyle != 0) && widget && GTK_WIDGET_HAS_FOCUS (widget);
-	params->is_default = widget && GTK_WIDGET_HAS_DEFAULT (widget);
+	params->focus      = (MURRINE_STYLE (style)->focusstyle != 0) && widget && gtk_widget_has_focus ((GtkWidget *) widget);
+	params->is_default = widget && GTK_WIDGET_HAS_DEFAULT ((GtkWidget *) widget);
 
 	params->xthickness = style->xthickness;
 	params->ythickness = style->ythickness;
@@ -247,12 +215,8 @@ murrine_style_draw_flat_box (DRAW_ARGS)
 	{
 		MurrineStyle  *murrine_style = MURRINE_STYLE (style);
 		MurrineColors *colors = &murrine_style->colors;
-		cairo_t       *cr;
 
 		CHECK_ARGS
-		SANITIZE_SIZE
-
-		cr = murrine_begin_paint (window, area);
 
 		WidgetParameters params;
 		CellParameters cell;
@@ -262,19 +226,13 @@ murrine_style_draw_flat_box (DRAW_ARGS)
 		murrine_set_widget_parameters (widget, style, state_type, &params);
 
 		STYLE_FUNCTION(draw_selected_cell) (cr, colors, &params, &cell, x, y, width, height);
-
-		cairo_destroy (cr);
 	}
 	else if (DETAIL ("tooltip"))
 	{
 		MurrineStyle  *murrine_style = MURRINE_STYLE (style);
 		MurrineColors *colors = &murrine_style->colors;
-		cairo_t       *cr;
 
 		CHECK_ARGS
-		SANITIZE_SIZE
-
-		cr = murrine_begin_paint (window, area);
 
 		WidgetParameters params;
 
@@ -287,27 +245,19 @@ murrine_style_draw_flat_box (DRAW_ARGS)
 			params.corners = MRN_CORNER_NONE;
 
 		STYLE_FUNCTION(draw_tooltip) (cr, colors, &params, x, y, width, height);
-
-		cairo_destroy (cr);
 	}
 	else if (DETAIL ("icon_view_item"))
 	{
 		MurrineStyle  *murrine_style = MURRINE_STYLE (style);
 		MurrineColors *colors = &murrine_style->colors;
-		cairo_t       *cr;
 
 		CHECK_ARGS
-		SANITIZE_SIZE
-
-		cr = murrine_begin_paint (window, area);
 
 		WidgetParameters params;
 
 		murrine_set_widget_parameters (widget, style, state_type, &params);
 
-		STYLE_FUNCTION(draw_iconview) (cr, colors, &params, x, y, width, height);
-
-		cairo_destroy (cr);	
+		STYLE_FUNCTION(draw_iconview) (cr, colors, &params, x, y, width, height);	
 	}
 	else
 	{
@@ -315,25 +265,21 @@ murrine_style_draw_flat_box (DRAW_ARGS)
 		{
 			MurrineStyle  *murrine_style = MURRINE_STYLE (style);
 			MurrineColors *colors = &murrine_style->colors;
-			cairo_t       *cr;
 			boolean use_rgba = FALSE;
 
 			CHECK_ARGS
-			SANITIZE_SIZE
 
 			use_rgba = (murrine_widget_is_rgba (widget) && murrine_style->rgba);
 
 			if (!use_rgba)
 			{
-				GTK_STYLE_CLASS (murrine_style_parent_class)->draw_flat_box (style, window, state_type,
-				                                                             shadow_type,
-				                                                             area, widget, detail,
-				                                                             x, y, width, height);
+				GTK_STYLE_CLASS (murrine_style_parent_class)->draw_flat_box (style, cr, state_type,
+		                                                                             shadow_type,
+		                                                                             widget, detail,
+		                                                                             x, y, width, height);
 			}
 			else
 			{
-				cr = (cairo_t*) gdk_cairo_create (window);
-
 				if (DETAIL ("entry_bg"))
 				{
 					cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
@@ -361,17 +307,15 @@ murrine_style_draw_flat_box (DRAW_ARGS)
 					cairo_fill       (cr);
 					cairo_pattern_destroy (pat);
 				}
-
-				cairo_destroy (cr);
 			}
 		}
 		else
 		{
 /*			printf( "draw_flat_box: %s %s\n", detail, G_OBJECT_TYPE_NAME (widget));*/
-			GTK_STYLE_CLASS (murrine_style_parent_class)->draw_flat_box (style, window, state_type,
-			                                                             shadow_type,
-			                                                             area, widget, detail,
-			                                                             x, y, width, height);
+				GTK_STYLE_CLASS (murrine_style_parent_class)->draw_flat_box (style, cr, state_type,
+		                                                                             shadow_type,
+		                                                                             widget, detail,
+		                                                                             x, y, width, height);
 		}
 	}
 
@@ -387,12 +331,8 @@ murrine_style_draw_flat_box (DRAW_ARGS)
 			case 1:
 			{
 				MurrineColors *colors = &murrine_style->colors;
-				cairo_t       *cr;
 
 				CHECK_ARGS
-				SANITIZE_SIZE
-
-				cr = murrine_begin_paint (window, area);
 
 				cairo_translate (cr, x, y);
 				int i;
@@ -404,19 +344,13 @@ murrine_style_draw_flat_box (DRAW_ARGS)
 					cairo_rectangle (cr, -pos, i, 1, 1);
 					cairo_fill (cr);
 				}
-
-				cairo_destroy (cr);
 				break;
 			}
 			case 2:
 			{
 				MurrineColors *colors = &murrine_style->colors;
-				cairo_t       *cr;
 
 				CHECK_ARGS
-				SANITIZE_SIZE
-
-				cr = murrine_begin_paint (window, area);
 
 				cairo_translate (cr, murrine_style->listviewheaderstyle != 1 ? x-1 : x, y);
 
@@ -424,8 +358,6 @@ murrine_style_draw_flat_box (DRAW_ARGS)
 				cairo_line_to (cr, -0.5, height);
 				murrine_set_color_rgba (cr, &colors->text[GTK_STATE_NORMAL], 0.2);
 				cairo_stroke (cr);
-
-				cairo_destroy (cr);
 				break;
 			}
 		}
@@ -437,14 +369,10 @@ murrine_style_draw_shadow (DRAW_ARGS)
 {
 	MurrineStyle  *murrine_style = MURRINE_STYLE (style);
 	MurrineColors *colors = &murrine_style->colors;
-	cairo_t       *cr;
 
 	CHECK_ARGS
-	SANITIZE_SIZE
-
-	cr = murrine_begin_paint (window, area);
 
-	if (DETAIL ("entry") && !(widget && widget->parent && MRN_IS_TREE_VIEW (widget->parent)))
+	if (DETAIL ("entry") && !(widget && gtk_widget_get_parent (widget) && MRN_IS_TREE_VIEW (gtk_widget_get_parent (widget))))
 	{
 		WidgetParameters params;
 		FocusParameters  focus;
@@ -452,12 +380,12 @@ murrine_style_draw_shadow (DRAW_ARGS)
 		/* 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 && MRN_IS_ENTRY (widget))
-			state_type = GTK_WIDGET_STATE (widget);
+			state_type = gtk_widget_get_state (widget);
 
 		murrine_set_widget_parameters (widget, style, state_type, &params);
 
-		if (widget && (MRN_IS_COMBO (widget->parent) ||
-		               MRN_IS_COMBO_BOX_ENTRY(widget->parent) ||
+		if (widget && (MRN_IS_COMBO (gtk_widget_get_parent (widget)) ||
+		               MRN_IS_COMBO_BOX_ENTRY(gtk_widget_get_parent (widget)) ||
 		               MRN_IS_SPIN_BUTTON (widget)))
 		{
 			width += style->xthickness;
@@ -505,7 +433,7 @@ murrine_style_draw_shadow (DRAW_ARGS)
 		STYLE_FUNCTION(draw_entry) (cr, &murrine_style->colors, &params, &focus,
 		                            x, y, width, height);
 	}
-	else if (DETAIL ("frame") && widget && MRN_IS_STATUSBAR (widget->parent))
+	else if (DETAIL ("frame") && widget && MRN_IS_STATUSBAR (gtk_widget_get_parent (widget)))
 	{
 		WidgetParameters params;
 
@@ -513,8 +441,8 @@ murrine_style_draw_shadow (DRAW_ARGS)
 
 		if (!params.mrn_gradient.use_rgba)
 		{
-			gtk_style_apply_default_background (style, window, TRUE, state_type,
-			                                    area, x, y, width, height);
+			gtk_style_apply_default_background (style, cr, gtk_widget_get_window (widget),
+                                                            state_type, x, y, width, height);;
 		}
 
 		if (shadow_type != GTK_SHADOW_NONE)
@@ -566,8 +494,6 @@ murrine_style_draw_shadow (DRAW_ARGS)
 
 		STYLE_FUNCTION(draw_frame) (cr, colors, &params, &frame, x, y, width, height);
 	}
-
-	cairo_destroy (cr);
 }
 
 static void
@@ -578,12 +504,8 @@ murrine_style_draw_box_gap (DRAW_ARGS,
 {
 	MurrineStyle  *murrine_style = MURRINE_STYLE (style);
 	MurrineColors *colors = &murrine_style->colors;
-	cairo_t       *cr;
 
 	CHECK_ARGS
-	SANITIZE_SIZE
-
-	cr = murrine_begin_paint (window, area);
 
 	if (DETAIL ("notebook"))
 	{
@@ -673,13 +595,11 @@ murrine_style_draw_box_gap (DRAW_ARGS,
 	else
 	{
 		//printf( "draw_box_gap: %s %s\n", detail, G_OBJECT_TYPE_NAME (widget));
-		GTK_STYLE_CLASS (murrine_style_parent_class)->draw_box_gap (style, window, state_type, shadow_type,
-		                                                            area, widget, detail,
+		GTK_STYLE_CLASS (murrine_style_parent_class)->draw_box_gap (style, cr, state_type, shadow_type,
+		                                                            widget, detail,
 		                                                            x, y, width, height,
 		                                                            gap_side, gap_x, gap_width);
 	}
-
-	cairo_destroy (cr);
 }
 
 static void
@@ -687,12 +607,8 @@ murrine_style_draw_extension (DRAW_ARGS, GtkPositionType gap_side)
 {
 	MurrineStyle  *murrine_style = MURRINE_STYLE (style);
 	MurrineColors *colors = &murrine_style->colors;
-	cairo_t       *cr;
 
 	CHECK_ARGS
-	SANITIZE_SIZE
-
-	cr = murrine_begin_paint (window, area);
 
 	if (DETAIL ("tab"))
 	{
@@ -723,11 +639,9 @@ murrine_style_draw_extension (DRAW_ARGS, GtkPositionType gap_side)
 	else
 	{
 		//printf( "draw_extension: %s %s\n", detail, G_OBJECT_TYPE_NAME (widget));
-		GTK_STYLE_CLASS (murrine_style_parent_class)->draw_extension (style, window, state_type, shadow_type, area,
+		GTK_STYLE_CLASS (murrine_style_parent_class)->draw_extension (style, cr, state_type, shadow_type,
 		                                                              widget, detail, x, y, width, height, gap_side);
 	}
-
-	cairo_destroy (cr);
 }
 
 static void
@@ -735,12 +649,8 @@ murrine_style_draw_handle (DRAW_ARGS, GtkOrientation orientation)
 {
 	MurrineStyle  *murrine_style = MURRINE_STYLE (style);
 	MurrineColors *colors = &murrine_style->colors;
-	cairo_t       *cr;
 
 	CHECK_ARGS
-	SANITIZE_SIZE
-
-	cr = murrine_begin_paint (window, area);
 
 	if (DETAIL ("handlebox"))
 	{
@@ -781,8 +691,6 @@ murrine_style_draw_handle (DRAW_ARGS, GtkOrientation orientation)
 
 		STYLE_FUNCTION(draw_handle) (cr, colors, &params, &handle, x, y, width, height);
 	}
-
-	cairo_destroy (cr);
 }
 
 static void
@@ -790,15 +698,11 @@ murrine_style_draw_box (DRAW_ARGS)
 {
 	MurrineStyle *murrine_style = MURRINE_STYLE (style);
 	MurrineColors *colors = &murrine_style->colors;
-	cairo_t *cr;
 
 	CHECK_ARGS
-	SANITIZE_SIZE
-
-	cr = murrine_begin_paint (window, area);
 
 	if (DETAIL ("menubar") &&
-	    !(widget && (murrine_is_panel_widget (widget->parent))))
+	    !(widget && (murrine_is_panel_widget (gtk_widget_get_parent (widget)))))
 	{
 		WidgetParameters params;
 		gboolean horizontal;
@@ -826,9 +730,8 @@ murrine_style_draw_box (DRAW_ARGS)
 			STYLE_FUNCTION(draw_menubar) (cr, colors, &params, x, y,
 			                              width, height+offset, menubarstyle);
 	}
-	else if (DETAIL ("button") && widget && widget->parent &&
-	                 (MRN_IS_TREE_VIEW (widget->parent) ||
-	                  MRN_IS_CLIST (widget->parent)))
+	else if (DETAIL ("button") && widget && gtk_widget_get_parent (widget) &&
+	         MRN_IS_TREE_VIEW (gtk_widget_get_parent (widget)))
 	{
 		WidgetParameters params;
 		ListViewHeaderParameters header;
@@ -844,17 +747,12 @@ murrine_style_draw_box (DRAW_ARGS)
 		murrine_set_widget_parameters (widget, style, state_type, &params);
 		params.corners = MRN_CORNER_NONE;
 
-		if (MRN_IS_TREE_VIEW (widget->parent))
+		if (MRN_IS_TREE_VIEW (gtk_widget_get_parent (widget)))
 		{
-			murrine_gtk_treeview_get_header_index (GTK_TREE_VIEW(widget->parent),
+			murrine_gtk_treeview_get_header_index (GTK_TREE_VIEW(gtk_widget_get_parent (widget)),
 			                                       widget, &column_index, &columns,
 			                                       &resizable);
 		}
-		else if (MRN_IS_CLIST (widget->parent))
-		{
-			murrine_gtk_clist_get_header_index (GTK_CLIST(widget->parent),
-			                                    widget, &column_index, &columns);
-		}
 
 		header.resizable = resizable;
 
@@ -864,7 +762,7 @@ murrine_style_draw_box (DRAW_ARGS)
 		if (column_index == columns-1)
 			header.order |= params.ltr ? MRN_ORDER_LAST : MRN_ORDER_FIRST;
 
-		gtk_style_apply_default_background (style, window, FALSE, state_type, area, x, y, width, height);
+		gtk_style_apply_default_background (style, cr, gtk_widget_get_window (widget), state_type, x, y, width, height);
 
 		STYLE_FUNCTION(draw_list_view_header) (cr, colors, &params, &header, x, y, width, height);
 	}
@@ -899,7 +797,7 @@ murrine_style_draw_box (DRAW_ARGS)
 		    (murrine_style->highlight_shade != 1.0 && murrine_style->glazestyle > 0 && width<height))
 			horizontal = FALSE;
 
-		if ((widget && (MRN_IS_COMBO_BOX_ENTRY (widget->parent) || MRN_IS_COMBO (widget->parent))))
+		if ((widget && (MRN_IS_COMBO_BOX_ENTRY (gtk_widget_get_parent (widget)) || MRN_IS_COMBO (gtk_widget_get_parent (widget)))))
 		{
 			if (murrine_style->roundness > 0)
 			{
@@ -929,20 +827,20 @@ murrine_style_draw_box (DRAW_ARGS)
 		}
 
 		/* Basic hack to theme the task list when x/y thickness == 0 */
-		if (widget->parent && widget->parent->parent && 
-                    MRN_IS_PANEL_APPLET(widget->parent->parent))
-		{
-			if (params.xthickness == 0 && params.ythickness == 0)
-			{
-				x--; width+=1;
-				y-=2; height+=4;
-				params.roundness = 0;
-			}		
-		}
-
-		if (!MRN_IS_COMBO_BOX(widget->parent) ||
-		     MRN_IS_COMBO_BOX_ENTRY (widget->parent) ||
-		     MRN_IS_COMBO (widget->parent))
+/*		if (gtk_widget_get_parent (widget) && widget->parent->parent && */
+/*                    MRN_IS_PANEL_APPLET(widget->parent->parent))*/
+/*		{*/
+/*			if (params.xthickness == 0 && params.ythickness == 0)*/
+/*			{*/
+/*				x--; width+=1;*/
+/*				y-=2; height+=4;*/
+/*				params.roundness = 0;*/
+/*			}		*/
+/*		}*/
+
+		if (!MRN_IS_COMBO_BOX(gtk_widget_get_parent (widget)) ||
+		     MRN_IS_COMBO_BOX_ENTRY (gtk_widget_get_parent (widget)) ||
+		     MRN_IS_COMBO (gtk_widget_get_parent (widget)))
 			STYLE_FUNCTION(draw_button) (cr, &murrine_style->colors, &params, &button, x, y, width, height, horizontal);
 		else
 		{
@@ -952,7 +850,7 @@ murrine_style_draw_box (DRAW_ARGS)
 			combobox.style = murrine_style->comboboxstyle;
 			combobox.prelight_shade = murrine_style->prelight_shade;
 
-			gtk_widget_style_get (widget->parent, "appears-as-list", &combobox.as_list, NULL);
+			gtk_widget_style_get (gtk_widget_get_parent (widget), "appears-as-list", &combobox.as_list, NULL);
 
 			STYLE_FUNCTION(draw_combobox) (cr, murrine_style->colors, params, &combobox, x, y, width, height, horizontal);
 		}
@@ -1003,7 +901,7 @@ murrine_style_draw_box (DRAW_ARGS)
 		/* The "spinbutton" box is always drawn with state NORMAL, even if it is insensitive.
 		 * So work around this here. */
 		if (state_type == GTK_STATE_NORMAL && widget && MRN_IS_ENTRY (widget))
-			state_type = GTK_WIDGET_STATE (widget);
+			state_type = gtk_widget_get_state (widget);
 
 		murrine_set_widget_parameters (widget, style, state_type, &params);
 
@@ -1056,7 +954,7 @@ murrine_style_draw_box (DRAW_ARGS)
 
 		slider.lower = DETAIL ("trough-lower");
 		slider.fill_level = DETAIL ("trough-fill-level") || DETAIL ("trough-fill-level-full");
-		slider.horizontal = (GTK_RANGE (widget)->orientation == GTK_ORIENTATION_HORIZONTAL);
+		slider.horizontal = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)); /* width>=height; *//* XXX fallback based on size, is there an API? */
 
 		murrine_set_widget_parameters (widget, style, state_type, &params);
 		params.corners = MRN_CORNER_ALL;
@@ -1094,16 +992,31 @@ murrine_style_draw_box (DRAW_ARGS)
 		}
 
 		if (widget && MRN_IS_PROGRESS_BAR (widget))
-			progressbar.orientation = gtk_progress_bar_get_orientation (GTK_PROGRESS_BAR (widget));
+		{			
+			if (gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)) == GTK_ORIENTATION_HORIZONTAL)
+			{
+				if (gtk_progress_bar_get_inverted (GTK_PROGRESS_BAR (widget)))
+					progressbar.orientation = MRN_ORIENTATION_RIGHT_TO_LEFT;
+				else
+					progressbar.orientation = MRN_ORIENTATION_LEFT_TO_RIGHT;
+			}
+			else
+			{
+				if (gtk_progress_bar_get_inverted (GTK_PROGRESS_BAR (widget)))
+					progressbar.orientation = MRN_ORIENTATION_BOTTOM_TO_TOP;
+				else
+					progressbar.orientation = MRN_ORIENTATION_TOP_TO_BOTTOM;
+			}	
+		}
 		else
 			progressbar.orientation = MRN_ORIENTATION_LEFT_TO_RIGHT;
 
 		if (!params.ltr)
 		{
-			if (progressbar.orientation == GTK_PROGRESS_LEFT_TO_RIGHT)
-				progressbar.orientation = GTK_PROGRESS_RIGHT_TO_LEFT;
-			else if (progressbar.orientation == GTK_PROGRESS_RIGHT_TO_LEFT)
-				progressbar.orientation = GTK_PROGRESS_LEFT_TO_RIGHT;
+			if (progressbar.orientation == MRN_ORIENTATION_LEFT_TO_RIGHT)
+				progressbar.orientation = MRN_ORIENTATION_RIGHT_TO_LEFT;
+			else if (progressbar.orientation == MRN_ORIENTATION_RIGHT_TO_LEFT)
+				progressbar.orientation = MRN_ORIENTATION_LEFT_TO_RIGHT;
 		}
 
 		STYLE_FUNCTION(draw_progressbar_trough) (cr, colors, &params, &progressbar, x, y, width, height);
@@ -1114,12 +1027,11 @@ murrine_style_draw_box (DRAW_ARGS)
 		ScrollBarParameters scrollbar;
 		boolean within_bevel = FALSE;
 
-		if (widget->parent && MRN_IS_SCROLLED_WINDOW (widget->parent))
-			gtk_widget_style_get (widget->parent, "scrollbars-within-bevel", &within_bevel, NULL);
+		if (gtk_widget_get_parent (widget) && MRN_IS_SCROLLED_WINDOW (gtk_widget_get_parent (widget)))
+			gtk_widget_style_get (gtk_widget_get_parent (widget), "scrollbars-within-bevel", &within_bevel, NULL);
 
 		scrollbar.horizontal   = TRUE;
 		scrollbar.junction     = murrine_scrollbar_get_junction (widget);
-		scrollbar.steppers     = murrine_scrollbar_visible_steppers (widget);
 		scrollbar.stepperstyle = murrine_style->stepperstyle;
 		scrollbar.within_bevel = within_bevel;
 		gtk_widget_style_get (widget, "stepper-size", &scrollbar.steppersize, NULL);
@@ -1130,7 +1042,7 @@ murrine_style_draw_box (DRAW_ARGS)
 			params.corners = MRN_CORNER_NONE;
 
 		if (MRN_IS_RANGE (widget))
-			scrollbar.horizontal = GTK_RANGE (widget)->orientation == GTK_ORIENTATION_HORIZONTAL;
+			scrollbar.horizontal = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)) == GTK_ORIENTATION_HORIZONTAL;
 
 		if (murrine_style->stepperstyle != 1 && murrine_style->stepperstyle != 3 && !params.mrn_gradient.use_rgba)
 		{
@@ -1158,16 +1070,31 @@ murrine_style_draw_box (DRAW_ARGS)
 		progressbar.style = murrine_style->progressbarstyle;
 
 		if (widget && MRN_IS_PROGRESS_BAR (widget))
-			progressbar.orientation = gtk_progress_bar_get_orientation (GTK_PROGRESS_BAR (widget));
+		{			
+			if (gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)) == GTK_ORIENTATION_HORIZONTAL)
+			{
+				if (gtk_progress_bar_get_inverted (GTK_PROGRESS_BAR (widget)))
+					progressbar.orientation = MRN_ORIENTATION_RIGHT_TO_LEFT;
+				else
+					progressbar.orientation = MRN_ORIENTATION_LEFT_TO_RIGHT;
+			}
+			else
+			{
+				if (gtk_progress_bar_get_inverted (GTK_PROGRESS_BAR (widget)))
+					progressbar.orientation = MRN_ORIENTATION_BOTTOM_TO_TOP;
+				else
+					progressbar.orientation = MRN_ORIENTATION_TOP_TO_BOTTOM;
+			}	
+		}
 		else
 			progressbar.orientation = MRN_ORIENTATION_LEFT_TO_RIGHT;
 
 		if (!params.ltr)
 		{
-			if (progressbar.orientation == GTK_PROGRESS_LEFT_TO_RIGHT)
-				progressbar.orientation = GTK_PROGRESS_RIGHT_TO_LEFT;
-			else if (progressbar.orientation == GTK_PROGRESS_RIGHT_TO_LEFT)
-				progressbar.orientation = GTK_PROGRESS_LEFT_TO_RIGHT;
+			if (progressbar.orientation == MRN_ORIENTATION_LEFT_TO_RIGHT)
+				progressbar.orientation = MRN_ORIENTATION_RIGHT_TO_LEFT;
+			else if (progressbar.orientation == MRN_ORIENTATION_RIGHT_TO_LEFT)
+				progressbar.orientation = MRN_ORIENTATION_LEFT_TO_RIGHT;
 		}
 
 #ifdef HAVE_ANIMATION
@@ -1229,51 +1156,25 @@ murrine_style_draw_box (DRAW_ARGS)
 			/* We got an entry, but well, we may not be drawing to
 			 * this particular widget ... it may not even be realized.
 			 * Also, we need to be drawing on a window obviously ... */
-			if (GTK_WIDGET_REALIZED (widget) &&
-			    GDK_IS_WINDOW (window) &&
-			    gdk_window_is_visible (widget->window))
+			if (gtk_widget_get_realized (widget) &&
+			    gdk_window_is_visible (gtk_widget_get_window (widget)))
 			{
 				/* Assumptions done by this code:
 				 *  - GtkEntry has some nested windows.
-				 *  - widget->window is the entries window
-				 *  - widget->window is the size of the entry part
+				 *  - gtk_widget_get_window (widget) is the entries window
+				 *  - gtk_widget_get_window (widget) is the size of the entry part
 				 *    (and not larger)
 				 *  - only one layer of subwindows
 				 * These should be true with any GTK+ 2.x version.
 				 */
 
-				if (widget->window == window)
-				{
-					progress.max_size_known = TRUE;
-					gdk_drawable_get_size (widget->window,
-					                       &progress.max_size.width,
-					                       &progress.max_size.height);
-
-				}
-				else
-				{
-					GdkWindow *parent;
-					parent = gdk_window_get_parent (window);
-					if (widget->window == parent)
-					{
-						gint pos_x, pos_y;
-						/* widget->window is the parent window
-						 * of the current one. This means we can
-						 * calculate the correct offsets. */
-						gdk_window_get_position (window, &pos_x, &pos_y);
-						progress.max_size.x = -pos_x;
-						progress.max_size.y = -pos_y;
-
-						progress.max_size_known = TRUE;
-						gdk_drawable_get_size (widget->window,
-						                       &progress.max_size.width,
-						                       &progress.max_size.height);
-					} /* Nothing we can do in this case ... */
-				}
+	                        progress.max_size_known = TRUE;
+                                progress.max_size.width = gdk_window_get_width (gtk_widget_get_window (widget));
+                                progress.max_size.height = gdk_window_get_height (gtk_widget_get_window (widget));
 
 				/* Now, one more thing needs to be done. If interior-focus
 				 * is off, then the entry may be a bit smaller. */
-				if (progress.max_size_known && GTK_WIDGET_HAS_FOCUS (widget))
+				if (progress.max_size_known && gtk_widget_has_focus (widget))
 				{
 					gboolean interior_focus = TRUE;
 					gint focus_line_width = 1;
@@ -1392,15 +1293,15 @@ murrine_style_draw_box (DRAW_ARGS)
 
 		murrine_set_widget_parameters (widget, style, state_type, &params);
 
-		if (widget && !(MRN_IS_MENU_BAR (widget->parent) && murrine_style->menubaritemstyle))
+		if (widget && !(MRN_IS_MENU_BAR (gtk_widget_get_parent (widget)) && murrine_style->menubaritemstyle))
 		{
-			if (murrine_style->menustyle != 1 || (MRN_IS_MENU_BAR (widget->parent) && !murrine_style->menubaritemstyle))
+			if (murrine_style->menustyle != 1 || (MRN_IS_MENU_BAR (gtk_widget_get_parent (widget)) && !murrine_style->menubaritemstyle))
 				STYLE_FUNCTION(draw_menuitem) (cr, colors, &params, x, y, width, height, murrine_style->menuitemstyle);
 			else
 				STYLE_FUNCTION(draw_menuitem) (cr, colors, &params, x+3, y, width-3, height, murrine_style->menuitemstyle);
 		}
 
-		if (widget && MRN_IS_MENU_BAR (widget->parent) && murrine_style->menubaritemstyle)
+		if (widget && MRN_IS_MENU_BAR (gtk_widget_get_parent (widget)) && murrine_style->menubaritemstyle)
 		{
 			ButtonParameters button;
 			button.has_default_button_color = FALSE;
@@ -1408,7 +1309,7 @@ murrine_style_draw_box (DRAW_ARGS)
 			params.active = FALSE;
 			params.prelight = TRUE;
 			params.focus = TRUE;
-			params.state_type = MRN_STATE_SELECTED;
+			params.state_type = GTK_STATE_SELECTED;
 			params.xthickness = 2;
 			params.ythickness = 2;
 			params.reliefstyle = 0;
@@ -1427,14 +1328,13 @@ murrine_style_draw_box (DRAW_ARGS)
 		scrollbar.horizontal     = TRUE;
 		scrollbar.junction       = murrine_scrollbar_get_junction (widget);
 		scrollbar.handlestyle    = murrine_style->handlestyle;
-		scrollbar.steppers       = murrine_scrollbar_visible_steppers (widget);
 		scrollbar.style          = murrine_style->scrollbarstyle;
 		scrollbar.stepperstyle   = murrine_style->stepperstyle;
 		scrollbar.prelight_shade = murrine_style->prelight_shade;
 		gtk_widget_style_get (widget, "stepper-size", &scrollbar.steppersize, NULL);
 
 		if (MRN_IS_RANGE (widget))
-			scrollbar.horizontal = GTK_RANGE (widget)->orientation == GTK_ORIENTATION_HORIZONTAL;
+			scrollbar.horizontal = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)) == GTK_ORIENTATION_HORIZONTAL;
 
 		if (murrine_style->colorize_scrollbar)
 		{
@@ -1475,20 +1375,31 @@ murrine_style_draw_box (DRAW_ARGS)
 				ScrollBarStepperParameters stepper;
 				GdkRectangle this_rectangle = { x, y, width, height };
 
-				stepper.stepper = murrine_scrollbar_get_stepper (widget, &this_rectangle);
+				if (g_str_equal(detail + 10, "_start"))
+					stepper.stepper = MRN_STEPPER_START;
+				else if (g_str_equal(detail + 10, "_end"))
+					stepper.stepper = MRN_STEPPER_END;
+				else if (g_str_equal(detail + 10, "_start_inner"))
+					stepper.stepper = MRN_STEPPER_START_INNER;
+				else if (g_str_equal(detail + 10, "_end_inner"))
+					stepper.stepper = MRN_STEPPER_END_INNER;
+				else
+					stepper.stepper = MRN_STEPPER_UNKNOWN;
+
+				/* XXX Check later for corners */
 
 				if (scrollbar.horizontal)
 				{
-					if (stepper.stepper == MRN_STEPPER_A)
+					if (stepper.stepper == MRN_STEPPER_START)
 						params.corners = MRN_CORNER_TOPLEFT | MRN_CORNER_BOTTOMLEFT;
-					else if (stepper.stepper == MRN_STEPPER_D)
+					else if (stepper.stepper == MRN_STEPPER_END_INNER)
 						params.corners = MRN_CORNER_TOPRIGHT | MRN_CORNER_BOTTOMRIGHT;
 				}
 				else
 				{
-					if (stepper.stepper == MRN_STEPPER_A)
+					if (stepper.stepper == MRN_STEPPER_START)
 						params.corners = MRN_CORNER_BOTTOMLEFT | MRN_CORNER_TOPLEFT;
-					else if (stepper.stepper == MRN_STEPPER_D)
+					else if (stepper.stepper == MRN_STEPPER_END_INNER)
 						params.corners = MRN_CORNER_TOPRIGHT | MRN_CORNER_BOTTOMRIGHT;
 				}
 			}
@@ -1497,8 +1408,8 @@ murrine_style_draw_box (DRAW_ARGS)
 			else
 				params.corners = MRN_CORNER_NONE;
 
-			if (widget->parent && MRN_IS_SCROLLED_WINDOW (widget->parent))
-				gtk_widget_style_get (widget->parent, "scrollbars-within-bevel", &within_bevel, NULL);
+			if (gtk_widget_get_parent (widget) && MRN_IS_SCROLLED_WINDOW (gtk_widget_get_parent (widget)))
+				gtk_widget_style_get (gtk_widget_get_parent (widget), "scrollbars-within-bevel", &within_bevel, NULL);
 
 			if (within_bevel)
 				params.corners = MRN_CORNER_NONE;
@@ -1518,7 +1429,7 @@ murrine_style_draw_box (DRAW_ARGS)
 
 		murrine_set_widget_parameters (widget, style, state_type, &params);
 
-		murrine_set_toolbar_parameters (&toolbar, widget, window, x, y);
+		murrine_set_toolbar_parameters (&toolbar, widget, x, y);
 		toolbar.style = murrine_style->toolbarstyle;
 
 		if ((DETAIL ("handlebox_bin") || DETAIL ("dockitem_bin")) && MRN_IS_BIN (widget))
@@ -1577,21 +1488,19 @@ murrine_style_draw_box (DRAW_ARGS)
 
 		if (DETAIL ("hseparator"))
 		{
-			gtk_paint_hline (style, window, state_type, area, widget, new_detail,
+			gtk_paint_hline (style, cr, state_type, widget, new_detail,
 			                 x, x+width-1, y+height/2);
 		}
 		else
-			gtk_paint_vline (style, window, state_type, area, widget, new_detail,
+			gtk_paint_vline (style, cr, state_type, widget, new_detail,
 			                 y, y+height-1, x+width/2);
 	}
 	else
 	{
 		//printf( "draw_box: %s %s\n", detail, G_OBJECT_TYPE_NAME (widget));
-		GTK_STYLE_CLASS (murrine_style_parent_class)->draw_box (style, window, state_type, shadow_type, area,
+		GTK_STYLE_CLASS (murrine_style_parent_class)->draw_box (style, cr, state_type, shadow_type,
 		                                                        widget, detail, x, y, width, height);
 	}
-
-	cairo_destroy (cr);
 }
 
 static void
@@ -1599,11 +1508,11 @@ murrine_style_draw_slider (DRAW_ARGS, GtkOrientation orientation)
 {
 	if (DETAIL ("hscale") || DETAIL ("vscale"))
 	{
-		murrine_style_draw_box (style, window, state_type, shadow_type, area,
+		murrine_style_draw_box (style, cr, state_type, shadow_type,
 		                        widget, detail, x, y, width, height);
 	}
 	else
-		GTK_STYLE_CLASS (murrine_style_parent_class)->draw_slider (style, window, state_type, shadow_type, area,
+		GTK_STYLE_CLASS (murrine_style_parent_class)->draw_slider (style, cr, state_type, shadow_type,
 		                                                           widget, detail, x, y, width, height, orientation);
 }
 
@@ -1612,19 +1521,15 @@ murrine_style_draw_option (DRAW_ARGS)
 {
 	MurrineStyle *murrine_style = MURRINE_STYLE (style);
 	MurrineColors *colors = &murrine_style->colors;
-	cairo_t *cr;
 
 	CHECK_ARGS
-	SANITIZE_SIZE
-
-	cr = murrine_begin_paint (window, area);
 
 	WidgetParameters params;
 	CheckboxParameters checkbox;
 
 	checkbox.shadow_type = shadow_type;
 	checkbox.in_cell = DETAIL ("cellradio");
-	checkbox.in_menu = (widget && widget->parent && GTK_IS_MENU(widget->parent));
+	checkbox.in_menu = (widget && gtk_widget_get_parent (widget) && GTK_IS_MENU(gtk_widget_get_parent (widget)));
 
 	murrine_set_widget_parameters (widget, style, state_type, &params);
 
@@ -1645,8 +1550,6 @@ murrine_style_draw_option (DRAW_ARGS)
 #endif
 
 	STYLE_FUNCTION(draw_radiobutton) (cr, colors, &params, &checkbox, x, y, width, height, trans);
-
-	cairo_destroy (cr);
 }
 
 static void
@@ -1654,19 +1557,15 @@ murrine_style_draw_check (DRAW_ARGS)
 {
 	MurrineStyle *murrine_style = MURRINE_STYLE (style);
 	MurrineColors *colors = &murrine_style->colors;
-	cairo_t *cr;
 
 	CHECK_ARGS
-	SANITIZE_SIZE
-
-	cr = murrine_begin_paint (window, area);
 
 	WidgetParameters params;
 	CheckboxParameters checkbox;
 
 	checkbox.shadow_type = shadow_type;
 	checkbox.in_cell = DETAIL ("cellcheck");
-	checkbox.in_menu = (widget && widget->parent && GTK_IS_MENU(widget->parent));
+	checkbox.in_menu = (widget && gtk_widget_get_parent (widget) && GTK_IS_MENU(gtk_widget_get_parent (widget)));
 
 	murrine_set_widget_parameters (widget, style, state_type, &params);
 
@@ -1686,8 +1585,6 @@ murrine_style_draw_check (DRAW_ARGS)
 #endif
 
 	STYLE_FUNCTION(draw_checkbox) (cr, colors, &params, &checkbox, x, y, width, height, trans);
-
-	cairo_destroy (cr);
 }
 
 static void
@@ -1696,12 +1593,7 @@ murrine_style_draw_tab (DRAW_ARGS)
 	MurrineStyle *murrine_style = MURRINE_STYLE (style);
 	MurrineColors *colors = &murrine_style->colors;
 
-	cairo_t *cr;
-
 	CHECK_ARGS
-	SANITIZE_SIZE
-
-	cr = murrine_begin_paint (window, area);
 
 	WidgetParameters params;
 	ArrowParameters  arrow;
@@ -1713,15 +1605,12 @@ murrine_style_draw_tab (DRAW_ARGS)
 	murrine_set_widget_parameters (widget, style, state_type, &params);
 
 	STYLE_FUNCTION(draw_arrow) (cr, colors, &params, &arrow, x, y, width, height);
-
-	cairo_destroy (cr);
 }
 
 static void
 murrine_style_draw_vline (GtkStyle     *style,
-                          GdkWindow    *window,
+                          cairo_t      *cr,
                           GtkStateType  state_type,
-                          GdkRectangle *area,
                           GtkWidget    *widget,
                           const gchar  *detail,
                           gint          y1,
@@ -1730,15 +1619,13 @@ murrine_style_draw_vline (GtkStyle     *style,
 {
 	/* Get toplevel window for this widget */
 	GtkWidget* toplevel = gtk_widget_get_toplevel (widget);
+	GtkWidget* parent = gtk_widget_get_parent (widget);
 
 	MurrineStyle  *murrine_style = MURRINE_STYLE (style);
 	MurrineColors *colors = &murrine_style->colors;
-	cairo_t *cr;
 
 	CHECK_ARGS
 
-	cr = murrine_begin_paint (window, area);
-
 	SeparatorParameters separator;
 	separator.horizontal = FALSE;
 	separator.style = murrine_style->separatorstyle;
@@ -1752,22 +1639,21 @@ murrine_style_draw_vline (GtkStyle     *style,
 		params.style = MRN_STYLE_RGBA;
 	}
 
-	if (!(widget &&
-	    MRN_IS_HBOX (widget->parent) &&
-	    MRN_IS_TOGGLE_BUTTON (widget->parent->parent) &&
-	    MRN_IS_COMBO_BOX (widget->parent->parent->parent)))
+	
+
+	if (!(widget && parent && gtk_widget_get_parent (parent) &&
+	    MRN_IS_HBOX (gtk_widget_get_parent (widget)) &&
+	    MRN_IS_TOGGLE_BUTTON (gtk_widget_get_parent (parent)) &&
+	    MRN_IS_COMBO_BOX (gtk_widget_get_parent (parent))))
 	{
 		STYLE_FUNCTION(draw_separator) (cr, colors, &params, &separator, x, y1, 2, y2-y1);
 	}
-
-	cairo_destroy (cr);
 }
 
 static void
 murrine_style_draw_hline (GtkStyle     *style,
-                          GdkWindow    *window,
+                          cairo_t      *cr,
                           GtkStateType  state_type,
-                          GdkRectangle *area,
                           GtkWidget    *widget,
                           const gchar  *detail,
                           gint          x1,
@@ -1779,12 +1665,9 @@ murrine_style_draw_hline (GtkStyle     *style,
 
 	MurrineStyle *murrine_style = MURRINE_STYLE (style);
 	MurrineColors *colors = &murrine_style->colors;
-	cairo_t *cr;
 
 	CHECK_ARGS
 
-	cr = murrine_begin_paint (window, area);
-
 	SeparatorParameters separator;
 	separator.horizontal = TRUE;
 	separator.style = murrine_style->separatorstyle;
@@ -1799,8 +1682,6 @@ murrine_style_draw_hline (GtkStyle     *style,
 	}
 
 	STYLE_FUNCTION(draw_separator) (cr, colors, &params, &separator, x1, y, x2-x1, 2);
-
-	cairo_destroy (cr);
 }
 
 static void
@@ -1811,12 +1692,8 @@ murrine_style_draw_shadow_gap (DRAW_ARGS,
 {
 	MurrineStyle *murrine_style = MURRINE_STYLE (style);
 	const MurrineColors *colors = &murrine_style->colors;
-	cairo_t *cr;
 
 	CHECK_ARGS
-	SANITIZE_SIZE
-
-	cr = murrine_begin_paint (window, area);
 
 	if (DETAIL ("frame"))
 	{
@@ -1838,19 +1715,16 @@ murrine_style_draw_shadow_gap (DRAW_ARGS,
 	}
 	else
 	{
-		GTK_STYLE_CLASS (murrine_style_parent_class)->draw_shadow_gap (style, window, state_type, shadow_type, area,
+		GTK_STYLE_CLASS (murrine_style_parent_class)->draw_shadow_gap (style, cr, state_type, shadow_type,
 		                                                               widget, detail, x, y, width, height,
 		                                                               gap_side, gap_x, gap_width);
 	}
-
-	cairo_destroy (cr);
 }
 
 static void
 murrine_style_draw_resize_grip (GtkStyle      *style,
-                                GdkWindow     *window,
+                                cairo_t       *cr,
                                 GtkStateType  state_type,
-                                GdkRectangle  *area,
                                 GtkWidget     *widget,
                                 const gchar   *detail,
                                 GdkWindowEdge edge,
@@ -1862,12 +1736,7 @@ murrine_style_draw_resize_grip (GtkStyle      *style,
 	MurrineStyle *murrine_style = MURRINE_STYLE (style);
 	MurrineColors *colors = &murrine_style->colors;
 
-	cairo_t *cr;
-
 	CHECK_ARGS
-	SANITIZE_SIZE
-
-	cr = murrine_begin_paint (window, area);
 
 	WidgetParameters params;
 	ResizeGripParameters grip;
@@ -1875,8 +1744,6 @@ murrine_style_draw_resize_grip (GtkStyle      *style,
 
 	int lx, ly;
 
-	g_return_if_fail (window != NULL);
-
 	if (edge != GDK_WINDOW_EDGE_SOUTH_EAST)
 		return; /* sorry... need to work on this :P */
 
@@ -1884,17 +1751,14 @@ murrine_style_draw_resize_grip (GtkStyle      *style,
 
 	STYLE_FUNCTION(draw_resize_grip) (cr, colors, &params, &grip, x, y, width, height);
 
-	cairo_destroy (cr);
-
 	return;
 }
 
 static void
 murrine_style_draw_arrow (GtkStyle     *style,
-                          GdkWindow    *window,
+                          cairo_t      *cr,
                           GtkStateType  state_type,
                           GtkShadowType shadow,
-                          GdkRectangle  *area,
                           GtkWidget     *widget,
                           const gchar   *detail,
                           GtkArrowType  arrow_type,
@@ -1906,19 +1770,14 @@ murrine_style_draw_arrow (GtkStyle     *style,
 {
 	MurrineStyle  *murrine_style = MURRINE_STYLE (style);
 	MurrineColors *colors = &murrine_style->colors;
-	cairo_t *cr;
 
 	CHECK_ARGS
-	SANITIZE_SIZE;
-
-	cr = murrine_begin_paint (window, area);
 
 	WidgetParameters params;
 	ArrowParameters  arrow;
 
 	if (arrow_type == GTK_ARROW_NONE)
 	{
-		cairo_destroy (cr);
 		return;
 	}
 
@@ -2032,29 +1891,20 @@ murrine_style_draw_arrow (GtkStyle     *style,
 	}
 
 	STYLE_FUNCTION(draw_arrow) (cr, colors, &params, &arrow, x, y, width, height);
-
-	cairo_destroy (cr);
 }
 
 static void
 murrine_style_draw_layout (GtkStyle     *style,
-                           GdkWindow    *window,
+                           cairo_t      *cr,
                            GtkStateType state_type,
                            gboolean     use_text,
-                           GdkRectangle *area,
                            GtkWidget    *widget,
                            const gchar  *detail, gint x, gint y,
                            PangoLayout  *layout)
 {
-	GdkGC *gc;
-
-	g_return_if_fail (GTK_IS_STYLE (style));
-	g_return_if_fail (window != NULL);
-
-	gc = use_text ? style->text_gc[state_type] : style->fg_gc[state_type];
+	CHECK_ARGS
 
-	if (area)
-		gdk_gc_set_clip_rectangle (gc, area);
+	murrine_transform_for_layout (cr, layout, x, y);
 
 	if (widget && (state_type == GTK_STATE_INSENSITIVE || 
 	    (MURRINE_STYLE (style)->textstyle != 0 &&
@@ -2068,7 +1918,6 @@ murrine_style_draw_layout (GtkStyle     *style,
 
 		murrine_set_widget_parameters (widget, style, state_type, &params);
 
-		GdkColor etched;
 		MurrineRGB temp;
 
 		double shade_level = murrine_style->text_shade;
@@ -2103,23 +1952,23 @@ murrine_style_draw_layout (GtkStyle     *style,
 		if (!gtk_widget_get_has_window (widget))
 		{
 			boolean use_parentbg = TRUE;
-			while (widget->parent)
+			while (gtk_widget_get_parent (widget))
 			{
-				if (MRN_IS_BUTTON(widget->parent) ||
-				    MRN_IS_TOGGLE_BUTTON(widget->parent) ||
-				    MRN_IS_COMBO_BOX(widget->parent) ||
-				    MRN_IS_COMBO_BOX_ENTRY(widget->parent) ||
-				    MRN_IS_COMBO(widget->parent) ||
-				    MRN_IS_OPTION_MENU(widget->parent) ||
-				    MRN_IS_NOTEBOOK(widget->parent))
+				if (MRN_IS_BUTTON(gtk_widget_get_parent (widget)) ||
+				    MRN_IS_TOGGLE_BUTTON(gtk_widget_get_parent (widget)) ||
+				    MRN_IS_COMBO_BOX(gtk_widget_get_parent (widget)) ||
+				    MRN_IS_COMBO_BOX_ENTRY(gtk_widget_get_parent (widget)) ||
+				    MRN_IS_COMBO(gtk_widget_get_parent (widget)) ||
+				    MRN_IS_OPTION_MENU(gtk_widget_get_parent (widget)) ||
+				    MRN_IS_NOTEBOOK(gtk_widget_get_parent (widget)))
 				{
 					GtkReliefStyle relief = GTK_RELIEF_NORMAL;
 					/* Check for the shadow type. */
-					if (MRN_IS_BUTTON (widget->parent))
-						g_object_get (G_OBJECT (widget->parent), "relief", &relief, NULL);
+					if (MRN_IS_BUTTON (gtk_widget_get_parent (widget)))
+						g_object_get (G_OBJECT (gtk_widget_get_parent (widget)), "relief", &relief, NULL);
 
-					if (!MRN_IS_CHECK_BUTTON(widget->parent) &&
-					    !MRN_IS_RADIO_BUTTON(widget->parent) &&
+					if (!MRN_IS_CHECK_BUTTON(gtk_widget_get_parent (widget)) &&
+					    !MRN_IS_RADIO_BUTTON(gtk_widget_get_parent (widget)) &&
 					    !(relief == GTK_RELIEF_NONE &&
 					      (state_type == GTK_STATE_NORMAL ||
 					       state_type == GTK_STATE_INSENSITIVE)))
@@ -2127,38 +1976,27 @@ murrine_style_draw_layout (GtkStyle     *style,
 
 					break;
 				}
-				widget = widget->parent;
+				widget = gtk_widget_get_parent (widget);
 			}
 
 			if (use_parentbg)
 				murrine_shade (&params.parentbg, shade_level, &temp);
-			else if (DETAIL ("cellrenderertext"))
-				murrine_shade (&colors->base[state_type], shade_level, &temp);
 			else
-				murrine_shade (&colors->bg[state_type], shade_level, &temp);
+				murrine_shade (use_text ? &colors->base[state_type] : &colors->bg[state_type], shade_level, &temp);
 		}
-		else if (DETAIL ("cellrenderertext"))
-			murrine_shade (&colors->base[state_type], shade_level, &temp);
 		else
-			murrine_shade (&colors->bg[state_type], shade_level, &temp);
-
-		etched.red = (int) (temp.r*65535);
-		etched.green = (int) (temp.g*65535);
-		etched.blue = (int) (temp.b*65535);
+			murrine_shade (use_text ? &colors->base[state_type] : &colors->bg[state_type], shade_level, &temp);
 
-/*		gdk_draw_layout_with_colors (window, gc, x+xos, y+yos, layout, &etched, NULL);*/
+		cairo_save (cr);
 
-		/* with cairo *
-		 */
-		cairo_t *cr; 
-		cr = murrine_begin_paint (window, area); 
-		cairo_translate (cr, x+xos, y+yos); 
+		/* XXX or cairo_move_to (cr, xos, yos); */
+		cairo_translate (cr, xos, yos); 
 		pango_cairo_layout_path (cr, layout);
 		murrine_set_color_rgba (cr, &temp, 0.5);
 		cairo_stroke (cr);
-		cairo_destroy (cr);
 
-/*		printf( "draw_layout: %s %s\n", detail, G_OBJECT_TYPE_NAME (widget->parent));*/
+		cairo_restore (cr);
+/*		printf( "draw_layout: %s %s\n", detail, G_OBJECT_TYPE_NAME (gtk_widget_get_parent (widget)));*/
 	}
 
 	if (DETAIL ("accellabel"))
@@ -2170,29 +2008,26 @@ murrine_style_draw_layout (GtkStyle     *style,
 
 		murrine_set_widget_parameters (widget, style, state_type, &params);
 
-		GdkColor etched;
 		MurrineRGB temp;
 
 		murrine_mix_color (&colors->fg[state_type], &params.parentbg, state_type != GTK_STATE_PRELIGHT ? 0.4 : 0.2, &temp);
 
-		etched.red = (int) (temp.r*65535);
-		etched.green = (int) (temp.g*65535);
-		etched.blue = (int) (temp.b*65535);
+		murrine_set_color_rgb (cr, &temp);
 
-		gdk_draw_layout_with_colors(window, gc, x, y, layout, &etched, NULL);
+        	pango_cairo_show_layout (cr, layout);
 	}
 	else
-		gdk_draw_layout (window, gc, x, y, layout);
+	{
+		gdk_cairo_set_source_color (cr, use_text ? &style->text[state_type] : &style->fg[state_type]);
 
-	if (area)
-		gdk_gc_set_clip_rectangle (gc, NULL);
+		pango_cairo_show_layout (cr, layout);
+	}
 }
 
 static void
 murrine_style_draw_expander (GtkStyle        *style,
-                             GdkWindow       *window,
+                             cairo_t         *cr,
                              GtkStateType     state_type,
-                             GdkRectangle    *area,
                              GtkWidget       *widget,
                              const gchar     *detail,
                              gint             x,
@@ -2202,12 +2037,8 @@ murrine_style_draw_expander (GtkStyle        *style,
 	MurrineStyle  *murrine_style = MURRINE_STYLE (style);
 	MurrineColors *colors = &murrine_style->colors;
 
-	cairo_t *cr;
-
 	CHECK_ARGS
 
-	cr = murrine_begin_paint (window, area);
-
 	WidgetParameters params;
 	ExpanderParameters expander;
 
@@ -2224,13 +2055,11 @@ murrine_style_draw_expander (GtkStyle        *style,
 	expander.style = murrine_style->expanderstyle;
 
 	STYLE_FUNCTION(draw_expander) (cr, colors, &params, &expander, x, y);
-
-	cairo_destroy (cr);
 }
 
 static void
-murrine_style_draw_focus (GtkStyle *style, GdkWindow *window, GtkStateType state_type,
-                          GdkRectangle *area, GtkWidget *widget, const gchar *detail,
+murrine_style_draw_focus (GtkStyle *style, cairo_t *cr, GtkStateType state_type,
+                          GtkWidget *widget, const gchar *detail,
                           gint x, gint y, gint width, gint height)
 {
 	MurrineStyle *murrine_style = MURRINE_STYLE (style);
@@ -2239,21 +2068,16 @@ murrine_style_draw_focus (GtkStyle *style, GdkWindow *window, GtkStateType state
 	FocusParameters focus;
 	guint8* dash_list;
 
-	cairo_t *cr;
-
 	CHECK_ARGS
-	SANITIZE_SIZE
 
 	/* Just return if focus drawing is disabled. */
 	if (murrine_style->focusstyle == 0)
 		return;
 
-	cr = gdk_cairo_create (window);
-
 	murrine_set_widget_parameters (widget, style, state_type, &params);
 
 	/* Corners */
-	if (widget && widget->parent && MRN_IS_COMBO_BOX_ENTRY(widget->parent))
+	if (widget && gtk_widget_get_parent (widget) && MRN_IS_COMBO_BOX_ENTRY(gtk_widget_get_parent (widget)))
 	{
 		if (params.ltr)
 			params.corners = MRN_CORNER_TOPRIGHT | MRN_CORNER_BOTTOMRIGHT;
@@ -2292,9 +2116,8 @@ murrine_style_draw_focus (GtkStyle *style, GdkWindow *window, GtkStateType state
 	/* Focus type */
 	if (DETAIL("button"))
 	{
-		if (widget && widget->parent &&
-		    (MRN_IS_TREE_VIEW (widget->parent) ||
-		     MRN_IS_CLIST (widget->parent)))
+		if (widget && gtk_widget_get_parent (widget) &&
+		    (MRN_IS_TREE_VIEW (gtk_widget_get_parent (widget))))
 		{
 			focus.type = MRN_FOCUS_TREEVIEW_HEADER;
 		}
@@ -2406,8 +2229,6 @@ murrine_style_draw_focus (GtkStyle *style, GdkWindow *window, GtkStateType state
 	STYLE_FUNCTION(draw_focus) (cr, colors, &params, &focus, x, y, width, height);
 
 	g_free (focus.dash_list);
-
-	cairo_destroy (cr);
 }
 
 static void
@@ -2527,7 +2348,7 @@ murrine_style_realize (GtkStyle *style)
 	bg_normal.g = style->bg[0].green/65535.0;
 	bg_normal.b = style->bg[0].blue/65535.0;
 
-	/* Apply contrast */
+	/* (GtkWidget *) Apply contrast */
 	for (i = 0; i < 9; i++)
 	{
 		murrine_shade (&bg_normal,
@@ -2741,9 +2562,9 @@ murrine_style_draw_render_icon (GtkStyle            *style,
 		screen = gtk_widget_get_screen (widget);
 		settings = gtk_settings_get_for_screen (screen);
 	}
-	else if (style->colormap)
+	else if (style->visual)
 	{
-		screen = gdk_colormap_get_screen (style->colormap);
+		screen = gdk_visual_get_screen (style->visual);
 		settings = gtk_settings_get_for_screen (screen);
 	}
 	else
@@ -2836,7 +2657,6 @@ murrine_style_class_init (MurrineStyleClass *klass)
 	style_class->draw_extension   = murrine_style_draw_extension;
 	style_class->draw_flat_box    = murrine_style_draw_flat_box;
 	style_class->draw_focus       = murrine_style_draw_focus;
-	style_class->draw_handle      = murrine_style_draw_handle;
 	style_class->draw_hline       = murrine_style_draw_hline;
 	style_class->draw_option      = murrine_style_draw_option;
 	style_class->render_icon      = murrine_style_draw_render_icon;
diff --git a/src/murrine_style.h b/src/murrine_style.h
index 33ae51c..609f910 100644
--- a/src/murrine_style.h
+++ b/src/murrine_style.h
@@ -18,7 +18,7 @@
  *
  */
 
-#include <gtk/gtkstyle.h>
+#include <gtk/gtk.h>
 
 #ifndef MURRINE_STYLE_H
 #define MURRINE_STYLE_H
@@ -101,6 +101,7 @@ struct _MurrineStyleClass
 	MurrineStyleFunctions style_functions[MRN_NUM_DRAW_STYLES];
 };
 
-GType murrine_style_get_type (void);
+G_GNUC_INTERNAL void  murrine_style_register_types (GTypeModule *module);
+G_GNUC_INTERNAL GType murrine_style_get_type       (void);
 
 #endif /* MURRINE_STYLE_H */
diff --git a/src/murrine_types.h b/src/murrine_types.h
index 5dd76a5..b1bbf38 100644
--- a/src/murrine_types.h
+++ b/src/murrine_types.h
@@ -34,14 +34,6 @@ typedef enum
 
 typedef enum
 {
-	MRN_STATE_NORMAL,
-	MRN_STATE_ACTIVE,
-	MRN_STATE_SELECTED,
-	MRN_STATE_INSENSITIVE
-} MurrineStateType;
-
-typedef enum
-{
 	MRN_CORNER_NONE        = 0,
 	MRN_CORNER_TOPLEFT     = 1,
 	MRN_CORNER_TOPRIGHT    = 2,
@@ -66,11 +58,11 @@ typedef enum
 
 typedef enum
 {
-	MRN_STEPPER_UNKNOWN    = 0,
-	MRN_STEPPER_A          = 1,
-	MRN_STEPPER_B          = 2,
-	MRN_STEPPER_C          = 4,
-	MRN_STEPPER_D          = 8
+	MRN_STEPPER_UNKNOWN     = 0,
+	MRN_STEPPER_START       = 1,
+	MRN_STEPPER_START_INNER = 2,
+	MRN_STEPPER_END         = 4,
+	MRN_STEPPER_END_INNER   = 8
 } MurrineStepper;
 
 typedef enum
@@ -370,7 +362,7 @@ typedef struct
 	boolean ltr;
 	boolean focus;
 	boolean is_default;
-	MurrineStateType state_type;
+	GtkStateType state_type;
 	uint8 corners;
 	uint8 xthickness;
 	uint8 ythickness;
diff --git a/src/support.c b/src/support.c
index dc3a71a..50304a7 100644
--- a/src/support.c
+++ b/src/support.c
@@ -46,35 +46,18 @@ murrine_gtk_treeview_get_header_index (GtkTreeView *tv, GtkWidget *header,
 	do
 	{
 		GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(list->data);
-		if ( column->button == header )
+		if ( gtk_tree_view_column_get_widget (column) == header )
 		{
 			*column_index = *columns;
-			*resizable = column->resizable;
+			*resizable = gtk_tree_view_column_get_resizable (column);
 		}
-		if ( column->visible )
+		if ( gtk_tree_view_column_get_visible (column) )
 			(*columns)++;
 	} while ((list = g_list_next(list)));
 
 	g_list_free (list_start);
 }
 
-void
-murrine_gtk_clist_get_header_index (GtkCList *clist, GtkWidget *button,
-                                    gint *column_index, gint *columns)
-{
-	int i;
-	*columns = clist->columns;
-
-	for (i=0; i<*columns; i++)
-	{
-		if (clist->column[i].button == button)
-		{
-			*column_index = i;
-			break;
-		}
-	}
-}
-
 static GtkRequisition default_option_indicator_size = { 7, 13 };
 static GtkBorder default_option_indicator_spacing = { 7, 5, 2, 2 };
 
@@ -107,46 +90,6 @@ murrine_option_menu_get_props (GtkWidget      *widget,
 		*indicator_spacing = default_option_indicator_spacing;
 }
 
-GtkWidget* 
-murrine_special_get_ancestor (GtkWidget *widget, GType widget_type)
-{
-	g_return_val_if_fail(GTK_IS_WIDGET(widget), NULL);
-
-	while (widget && widget->parent
-	       && !g_type_is_a(GTK_WIDGET_TYPE(widget->parent),
-	       widget_type))
-		widget = widget->parent;
-
-	if (!
-	    (widget && widget->parent
-	     && g_type_is_a(GTK_WIDGET_TYPE(widget->parent), widget_type)))
-		return NULL;
-
-	return widget;
-}
-
-GtkWidget*
-murrine_get_parent_window (GtkWidget *widget)
-{
-	GtkWidget *parent = widget->parent;
-
-	while (parent && GTK_WIDGET_NO_WINDOW (parent))
-		parent = parent->parent;
-
-	return parent;
-}
-
-GdkColor*
-murrine_get_parent_bgcolor (GtkWidget *widget)
-{
-	GtkWidget *parent = murrine_get_parent_window (widget);
-
-	if (parent && parent->style)
-		return &parent->style->bg[GTK_STATE_NORMAL];
-
-	return NULL;
-}
-
 gboolean
 murrine_object_is_a (const GObject * object, const gchar * type_name)
 {
@@ -190,7 +133,7 @@ murrine_find_combo_box_widget (GtkWidget *widget)
 		if (GTK_IS_COMBO_BOX (widget))
 			result = widget;
 		else
-			result = murrine_find_combo_box_widget(widget->parent);
+			result = murrine_find_combo_box_widget(gtk_widget_get_parent(widget));
 	}
 
 	return result;
@@ -202,100 +145,19 @@ murrine_is_combo_box (GtkWidget *widget)
 	return (murrine_find_combo_box_widget(widget) != NULL);
 }
 
-MurrineStepper
-murrine_scrollbar_get_stepper (GtkWidget    *widget,
-                               GdkRectangle *stepper)
-{
-	MurrineStepper value = MRN_STEPPER_UNKNOWN;
-	GdkRectangle tmp;
-	GdkRectangle check_rectangle;
-	GtkOrientation orientation;
-
-	g_return_val_if_fail (GTK_IS_RANGE (widget), MRN_STEPPER_UNKNOWN);
-
-	check_rectangle.x      = widget->allocation.x;
-	check_rectangle.y      = widget->allocation.y;
-	check_rectangle.width  = stepper->width;
-	check_rectangle.height = stepper->height;
-
-	orientation = GTK_RANGE (widget)->orientation;
-
-	if (widget->allocation.x == -1 && widget->allocation.y == -1)
-		return MRN_STEPPER_UNKNOWN;
-
-	if (gdk_rectangle_intersect (stepper, &check_rectangle, &tmp))
-		value = MRN_STEPPER_A;
-
-	if (value == MRN_STEPPER_UNKNOWN) /* Haven't found a match */
-	{
-		if (orientation == GTK_ORIENTATION_HORIZONTAL)
-			check_rectangle.x = widget->allocation.x + stepper->width;
-		else
-			check_rectangle.y = widget->allocation.y + stepper->height;
-
-		if (gdk_rectangle_intersect (stepper, &check_rectangle, &tmp))
-			value = MRN_STEPPER_B;
-	}
-
-	if (value == MRN_STEPPER_UNKNOWN) /* Still haven't found a match */
-	{
-		if (orientation == GTK_ORIENTATION_HORIZONTAL)
-			check_rectangle.x = widget->allocation.x + widget->allocation.width - (stepper->width * 2);
-		else
-			check_rectangle.y = widget->allocation.y + widget->allocation.height - (stepper->height * 2);
-
-		if (gdk_rectangle_intersect (stepper, &check_rectangle, &tmp))
-			value = MRN_STEPPER_C;
-	}
-
-	if (value == MRN_STEPPER_UNKNOWN) /* STILL haven't found a match */
-	{
-		if (orientation == GTK_ORIENTATION_HORIZONTAL)
-			check_rectangle.x = widget->allocation.x + widget->allocation.width - stepper->width;
-		else
-			check_rectangle.y = widget->allocation.y + widget->allocation.height - stepper->height;
-
-		if (gdk_rectangle_intersect (stepper, &check_rectangle, &tmp))
-			value = MRN_STEPPER_D;
-	}
-
-	return value;
-}
-
-MurrineStepper
-murrine_scrollbar_visible_steppers (GtkWidget *widget)
-{
-	MurrineStepper steppers = 0;
-
-	g_return_val_if_fail (GTK_IS_RANGE (widget), MRN_STEPPER_UNKNOWN);
-
-	if (GTK_RANGE (widget)->has_stepper_a)
-		steppers |= MRN_STEPPER_A;
-
-	if (GTK_RANGE (widget)->has_stepper_b)
-		steppers |= MRN_STEPPER_B;
-
-	if (GTK_RANGE (widget)->has_stepper_c)
-		steppers |= MRN_STEPPER_C;
-
-	if (GTK_RANGE (widget)->has_stepper_d)
-		steppers |= MRN_STEPPER_D;
-
-	return steppers;
-}
-
 MurrineJunction
 murrine_scrollbar_get_junction (GtkWidget *widget)
 {
 	GtkAdjustment *adj;
 	MurrineJunction junction = MRN_JUNCTION_NONE;
 
-	g_return_val_if_fail (GTK_IS_RANGE (widget), MRN_JUNCTION_NONE);
+	if (!GTK_IS_RANGE (widget))
+		return MRN_JUNCTION_NONE;
 
-	adj = GTK_RANGE (widget)->adjustment;
+	adj = gtk_range_get_adjustment(GTK_RANGE (widget));
 
-	if (adj->value <= adj->lower &&
-	    (GTK_RANGE (widget)->has_stepper_a || GTK_RANGE (widget)->has_stepper_b))
+	if (gtk_adjustment_get_value(adj) <= gtk_adjustment_get_lower(adj) /*&&
+	    (GTK_RANGE (widget)->has_stepper_a || GTK_RANGE (widget)->has_stepper_b)*/)
 	{
 		if (!gtk_range_get_inverted (GTK_RANGE (widget)))
 			junction |= MRN_JUNCTION_BEGIN;
@@ -303,8 +165,8 @@ murrine_scrollbar_get_junction (GtkWidget *widget)
 			junction |= MRN_JUNCTION_END;
 	}
 
-	if (adj->value >= adj->upper - adj->page_size &&
-	    (GTK_RANGE (widget)->has_stepper_c || GTK_RANGE (widget)->has_stepper_d))
+	if (gtk_adjustment_get_value(adj) >= gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj) /*&&
+	    (GTK_RANGE (widget)->has_stepper_c || GTK_RANGE (widget)->has_stepper_d)*/)
 	{
 		if (!gtk_range_get_inverted (GTK_RANGE (widget)))
 			junction |= MRN_JUNCTION_END;
@@ -324,16 +186,17 @@ gboolean murrine_is_panel_widget (GtkWidget *widget)
 void
 murrine_set_toolbar_parameters (ToolbarParameters *toolbar,
                                 GtkWidget *widget,
-                                GdkWindow *window,
                                 gint x, gint y)
 {
+	GtkAllocation allocation;
+
+	gtk_widget_get_allocation (widget, &allocation);
 	toolbar->topmost = FALSE;
 
-	if (x == 0 && y == 0)
-	{
-		if (widget && widget->allocation.x == 0 && widget->allocation.y == 0)
+	if (x == 0 && y == 0) {
+		if (widget && allocation.x == 0 && allocation.y == 0)
 		{
-			if (widget->window == window && MRN_IS_TOOLBAR (widget))
+			if (MRN_IS_TOOLBAR (widget))
 			{
 				toolbar->topmost = TRUE;
 			}
diff --git a/src/support.h b/src/support.h
index 719edcf..e0c7d17 100644
--- a/src/support.h
+++ b/src/support.h
@@ -129,10 +129,6 @@ G_GNUC_INTERNAL void murrine_gtk_treeview_get_header_index (GtkTreeView *tv,
                                                             gint        *column_index,
                                                             gint        *columns,
                                                             gboolean    *resizable);
-G_GNUC_INTERNAL void murrine_gtk_clist_get_header_index (GtkCList  *clist,
-                                                         GtkWidget *button,
-                                                         gint      *column_index,
-                                                         gint      *columns);
 G_GNUC_INTERNAL void murrine_option_menu_get_props (GtkWidget      *widget,
                                                     GtkRequisition *indicator_size,
                                                     GtkBorder      *indicator_spacing);
@@ -142,7 +138,6 @@ G_GNUC_INTERNAL MurrineJunction murrine_scrollbar_get_junction (GtkWidget *widge
 G_GNUC_INTERNAL gboolean murrine_is_panel_widget (GtkWidget *widget);
 G_GNUC_INTERNAL void murrine_set_toolbar_parameters (ToolbarParameters *toolbar,
                                                      GtkWidget *widget,
-                                                     GdkWindow *window,
                                                      gint x, gint y);
 G_GNUC_INTERNAL void murrine_get_notebook_tab_position (GtkWidget *widget,
                                                         gboolean  *start,



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