[Xfce4-commits] <gtk-xfce-engine:master> Added Gtk 3 Xfce engine
Peter de Ridder
noreply at xfce.org
Sat Dec 17 17:16:01 CET 2011
Updating branch refs/heads/master
to 6a8475e3a9da3b2cd6e5b2865dd8a4eb4aefd344 (commit)
from e0f3335137f2a3b74cd1535338994fba3d43144e (commit)
commit 6a8475e3a9da3b2cd6e5b2865dd8a4eb4aefd344
Author: Peter de Ridder <peter at xfce.org>
Date: Fri Sep 23 21:37:19 2011 +0200
Added Gtk 3 Xfce engine
Split the source into Gtk 2 and Gtk 3 variant and added basic Gtk 3
implementation to mimic Gtk 2 look
Makefile.am | 7 +-
configure.in.in | 33 +-
{src => gtk-2.0}/Makefile.am | 6 +-
{src => gtk-2.0}/cairo-support.c | 0
{src => gtk-2.0}/cairo-support.h | 0
{src => gtk-2.0}/ge-support.h | 0
{src => gtk-2.0}/general-support.h | 0
{src => gtk-2.0}/gradient_draw.c | 0
{src => gtk-2.0}/gradient_draw.h | 0
{src => gtk-2.0}/xfce_rc_style.c | 0
{src => gtk-2.0}/xfce_rc_style.h | 0
{src => gtk-2.0}/xfce_style.h | 0
{src => gtk-2.0}/xfce_theme_draw.c | 0
{src => gtk-2.0}/xfce_theme_main.c | 0
gtk-3.0/Makefile.am | 51 +
gtk-3.0/xfce_engine.c | 1712 +++++++++++++++++++++
src/xfce_theme_main.c => gtk-3.0/xfce_engine.h | 41 +-
{src => gtk-3.0}/xfce_style.h | 0
src/gradient_draw.h => gtk-3.0/xfce_style_types.h | 22 +-
{src => gtk-3.0}/xfce_theme_main.c | 17 +-
gtk-3.0/xfce_typebuiltin.c.template | 38 +
gtk-3.0/xfce_typebuiltin.h.template | 22 +
22 files changed, 1893 insertions(+), 56 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 4a85e6c..ad88561 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,12 @@
SUBDIRS = \
themes \
- src
+ $(GTK_SUBDIRS)
+
+DIST_SUBDIRS= \
+ themes \
+ gtk-2.0 \
+ gtk-3.0
distclean-local:
rm -rf *.cache *~
diff --git a/configure.in.in b/configure.in.in
index 59f3477..1349a50 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -50,12 +50,29 @@ AC_HEADER_STDC()
dnl ***********************************
dnl *** Check for required packages ***
dnl ***********************************
-XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.20.0])
-XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.24.0])
+AM_PATH_GLIB_2_0([2.24.0])
XDT_CHECK_PACKAGE([GMODULE], [gmodule-2.0], [2.24.0])
-GTK_BINARY_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
-AC_SUBST([GTK_BINARY_VERSION])
+dnl ***********************************
+dnl *** Check for optional packages ***
+dnl ***********************************
+XDT_CHECK_OPTIONAL_PACKAGE([GTK2], [gtk+-2.0], [2.20.0], [gtk2], [Gtk 2 theme engine])
+XDT_CHECK_OPTIONAL_PACKAGE([GTK3], [gtk+-3.0], [3.0.0], [gtk3], [Gtk 3 theme engine])
+
+GTK_SUBDIRS=""
+if test x"$GTK2_FOUND" = x"yes"
+then
+ GTK2_BINARY_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
+ AC_SUBST([GTK2_BINARY_VERSION])
+ GTK_SUBDIRS="$GTK_SUBDIRS gtk-2.0"
+fi
+if test x"$GTK3_FOUND" = x"yes"
+then
+ GTK3_BINARY_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`
+ AC_SUBST([GTK3_BINARY_VERSION])
+ GTK_SUBDIRS="$GTK_SUBDIRS gtk-3.0"
+fi
+AC_SUBST([GTK_SUBDIRS])
dnl ***********************************
dnl *** Check for debugging support ***
@@ -78,9 +95,11 @@ AC_SUBST([PLATFORM_LDFLAGS])
AC_OUTPUT([
gtk-xfce-engine-2.spec
Makefile
-src/Makefile
+gtk-2.0/Makefile
+gtk-3.0/Makefile
themes/b5/Makefile
themes/b5/gtk-2.0/Makefile
+themes/b5/gtk-3.0/Makefile
themes/xfce/gtk-2.0/Makefile
themes/xfce/Makefile
themes/xfce-4.0/gtk-2.0/Makefile
@@ -128,5 +147,9 @@ dnl ***************************
echo
echo "Build Configuration:"
echo
+echo "* Gtk 2 Engine: $GTK2_FOUND"
+echo "* Gtk 3 Engine: $GTK3_FOUND"
+echo
+echo "* Install Prefix: $prefix"
echo "* Debug Support: $enable_debug"
echo
diff --git a/src/Makefile.am b/gtk-2.0/Makefile.am
similarity index 86%
rename from src/Makefile.am
rename to gtk-2.0/Makefile.am
index d81392e..6311eed 100644
--- a/src/Makefile.am
+++ b/gtk-2.0/Makefile.am
@@ -4,7 +4,7 @@ INCLUDES = \
-DG_LOG_DOMAIN=\"gtk-xfce-engine\" \
$(PLATFORM_CPPFLAGS)
-enginedir = $(libdir)/gtk-2.0/$(GTK_BINARY_VERSION)/engines
+enginedir = $(libdir)/gtk-2.0/$(GTK2_BINARY_VERSION)/engines
engine_LTLIBRARIES = libxfce.la
@@ -22,13 +22,13 @@ libxfce_la_SOURCES = \
xfce_style.h
libxfce_la_CFLAGS = \
- $(GTK_CFLAGS) \
+ $(GTK2_CFLAGS) \
$(GLIB_CFLAGS) \
$(GMODULE_CFLAGS) \
$(PLATFORM_CFLAGS)
libxfce_la_LIBADD = \
- $(GTK_LIBS) \
+ $(GTK2_LIBS) \
$(GLIB_LIBS) \
$(GMODULE_LIBS)
diff --git a/src/cairo-support.c b/gtk-2.0/cairo-support.c
similarity index 100%
rename from src/cairo-support.c
rename to gtk-2.0/cairo-support.c
diff --git a/src/cairo-support.h b/gtk-2.0/cairo-support.h
similarity index 100%
rename from src/cairo-support.h
rename to gtk-2.0/cairo-support.h
diff --git a/src/ge-support.h b/gtk-2.0/ge-support.h
similarity index 100%
rename from src/ge-support.h
rename to gtk-2.0/ge-support.h
diff --git a/src/general-support.h b/gtk-2.0/general-support.h
similarity index 100%
rename from src/general-support.h
rename to gtk-2.0/general-support.h
diff --git a/src/gradient_draw.c b/gtk-2.0/gradient_draw.c
similarity index 100%
rename from src/gradient_draw.c
rename to gtk-2.0/gradient_draw.c
diff --git a/src/gradient_draw.h b/gtk-2.0/gradient_draw.h
similarity index 100%
copy from src/gradient_draw.h
copy to gtk-2.0/gradient_draw.h
diff --git a/src/xfce_rc_style.c b/gtk-2.0/xfce_rc_style.c
similarity index 100%
rename from src/xfce_rc_style.c
rename to gtk-2.0/xfce_rc_style.c
diff --git a/src/xfce_rc_style.h b/gtk-2.0/xfce_rc_style.h
similarity index 100%
rename from src/xfce_rc_style.h
rename to gtk-2.0/xfce_rc_style.h
diff --git a/src/xfce_style.h b/gtk-2.0/xfce_style.h
similarity index 100%
copy from src/xfce_style.h
copy to gtk-2.0/xfce_style.h
diff --git a/src/xfce_theme_draw.c b/gtk-2.0/xfce_theme_draw.c
similarity index 100%
rename from src/xfce_theme_draw.c
rename to gtk-2.0/xfce_theme_draw.c
diff --git a/src/xfce_theme_main.c b/gtk-2.0/xfce_theme_main.c
similarity index 100%
copy from src/xfce_theme_main.c
copy to gtk-2.0/xfce_theme_main.c
diff --git a/gtk-3.0/Makefile.am b/gtk-3.0/Makefile.am
new file mode 100644
index 0000000..b8b425b
--- /dev/null
+++ b/gtk-3.0/Makefile.am
@@ -0,0 +1,51 @@
+
+INCLUDES = \
+ -I$(top_srcdir) \
+ -DG_LOG_DOMAIN=\"gtk-xfce-engine\" \
+ $(PLATFORM_CPPFLAGS)
+
+enginedir = $(libdir)/gtk-3.0/$(GTK3_BINARY_VERSION)/theming-engines
+
+engine_LTLIBRARIES = libxfce.la
+
+BUILT_SOURCES = \
+ xfce_typebuiltin.c \
+ xfce_typebuiltin.h
+
+libxfce_la_SOURCES = \
+ xfce_theme_main.c \
+ xfce_engine.c \
+ xfce_engine.h \
+ xfce_style_types.h \
+ xfce_typebuiltin.c \
+ xfce_typebuiltin.h
+
+libxfce_la_CFLAGS = \
+ $(GTK3_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(GMODULE_CFLAGS) \
+ $(PLATFORM_CFLAGS)
+
+libxfce_la_LIBADD = \
+ $(GTK3_LIBS) \
+ $(GLIB_LIBS) \
+ $(GMODULE_LIBS)
+
+libxfce_la_LDFLAGS = \
+ -module \
+ -avoid-version \
+ -no-undefined \
+ $(PLATFORM_LDFLAGS)
+
+xfce_typebuiltin.h: xfce_style_types.h Makefile xfce_typebuiltin.h.template
+ @( cd $(srcdir) && $(GLIB_MKENUMS) --template ./xfce_typebuiltin.h.template \
+ ./xfce_style_types.h ) >> xgen-gtbh \
+ && (cmp -s xgen-gtbh $@ || (echo "Creating $@..."; cp xgen-gtbh $@) ) \
+ && rm -f xgen-gtbh
+
+xfce_typebuiltin.c: xfce_style_types.h Makefile xfce_typebuiltin.c.template
+ @( cd $(srcdir) && $(GLIB_MKENUMS) --template ./xfce_typebuiltin.c.template \
+ ./xfce_style_types.h ) >> xgen-gtbc \
+ && (cmp -s xgen-gtbc $@ || (echo "Creating $@..."; cp xgen-gtbc $@) ) \
+ && rm -f xgen-gtbc
+
diff --git a/gtk-3.0/xfce_engine.c b/gtk-3.0/xfce_engine.c
new file mode 100644
index 0000000..d9dca59
--- /dev/null
+++ b/gtk-3.0/xfce_engine.c
@@ -0,0 +1,1712 @@
+/* $Id$
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Copyright (C) 1999-2004 Olivier Fourdan (fourdan at xfce.org)
+ * Copyright (C) 2011 Peter de Ridder (peter at xfce.org)
+ *
+ * Portions based Thinice port by
+ * Tim Gerla <timg at rrv.net>,
+ * Tomas Ögren <stric at ing.umu.se,
+ * Richard Hult <rhult at codefactory.se>
+ * Portions based on Smooth theme by
+ * Andrew Johnson <ajgenius at ajgenius.us>
+ * Portions based on IceGradient theme by
+ * Tim Gerla <timg at means.net>
+ * Tomas Ögren <stric at ing.umu.se>
+ * JM Perez <jose.perez at upcnet.es>
+ * Portions based on Wonderland theme by
+ * Garrett LeSage
+ * Alexander Larsson
+ * Owen Taylor <otaylor at redhat.com>
+ * Portions based on Raleigh theme by
+ * Owen Taylor <otaylor at redhat.com>
+ * Portions based on Notif theme
+ * Portions based on Notif2 theme
+ * Portions based on original GTK theme
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <gtk/gtk.h>
+
+#include <math.h>
+
+#include "xfce_style_types.h"
+#include "xfce_typebuiltin.h"
+#include "xfce_engine.h"
+
+/* css properties */
+#define XFCE_NAMESPACE "xfce"
+#define SMOOTH_EDGE "smooth-edge"
+#define XFCE_SMOOTH_EDGE "-"XFCE_NAMESPACE"-"SMOOTH_EDGE
+#define GRIP_STYLE "grip-style"
+#define XFCE_GRIP_STYLE "-"XFCE_NAMESPACE"-"GRIP_STYLE
+
+/* macros to make sure that things are sane ... */
+#define GE_CAIRO_INIT \
+ cairo_set_line_width (cr, 1.0); \
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE); \
+ cairo_set_line_join (cr, CAIRO_LINE_JOIN_MITER);
+
+G_DEFINE_DYNAMIC_TYPE(XfceEngine, xfce_engine, GTK_TYPE_THEMING_ENGINE)
+
+/* Taken from raleigh theme engine */
+typedef enum
+{
+ CHECK_LIGHT,
+ CHECK_DARK,
+ CHECK_BASE,
+ CHECK_TEXT,
+ CHECK_CROSS,
+ CHECK_DASH,
+ RADIO_LIGHT,
+ RADIO_DARK,
+ RADIO_BASE,
+ RADIO_TEXT
+}
+Part;
+
+#define PART_SIZE 13
+
+static const guint32 check_light_bits[] = {
+ 0x0000, 0x0000, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800,
+ 0x0800, 0x0800, 0x0ffc, 0x0000,
+};
+static const guint32 check_dark_bits[] = {
+ 0x0000, 0x0ffe, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
+ 0x0002, 0x0002, 0x0002, 0x0000,
+};
+static const guint32 check_base_bits[] = {
+ 0x0000, 0x0000, 0x07fc, 0x07fc, 0x07fc, 0x07fc, 0x07fc, 0x07fc, 0x07fc,
+ 0x07fc, 0x07fc, 0x0000, 0x0000,
+};
+static const guint32 check_text_bits[] = {
+ 0x0000, 0x0000, 0x1c00, 0x0f00, 0x0380, 0x01c0, 0x00e0, 0x0073, 0x003f,
+ 0x003e, 0x001c, 0x0018, 0x0008
+};
+static const guint32 check_cross_bits[] = {
+ 0x0000, 0x0000, 0x0000, 0x0300, 0x0380, 0x01d8, 0x00f8, 0x0078, 0x0038,
+ 0x0018, 0x0000, 0x0000, 0x0000,
+};
+static const guint32 check_dash_bits[] = {
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f8, 0x03f8, 0x03f8, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000,
+};
+static const guint32 radio_light_bits[] = {
+ 0x0000, 0x0000, 0x0000, 0x0400, 0x0800, 0x0800, 0x0800, 0x0800, 0x0800,
+ 0x0400, 0x0208, 0x01f0, 0x0000,
+};
+static const guint32 radio_dark_bits[] = {
+ 0x0000, 0x01f0, 0x0208, 0x0004, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
+ 0x0004, 0x0000, 0x0000, 0x0000,
+};
+static const guint32 radio_base_bits[] = {
+ 0x0000, 0x0000, 0x01f0, 0x03f8, 0x07fc, 0x07fc, 0x07fc, 0x07fc, 0x07fc,
+ 0x03f8, 0x01f0, 0x0000, 0x0000,
+};
+static const guint32 radio_text_bits[] = {
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x00e0, 0x01f0, 0x01f0, 0x01f0, 0x00e0,
+ 0x0000, 0x0000, 0x0000, 0x0000,
+};
+
+static struct
+{
+ const guint32 *bits;
+ cairo_surface_t *bmap;
+}
+parts[] =
+{
+ { check_light_bits, NULL },
+ { check_dark_bits, NULL },
+ { check_base_bits, NULL },
+ { check_text_bits, NULL },
+ { check_cross_bits, NULL },
+ { check_dash_bits, NULL },
+ { radio_light_bits, NULL },
+ { radio_dark_bits, NULL },
+ { radio_base_bits, NULL },
+ { radio_text_bits, NULL }
+};
+
+/* internal functions */
+static void xfce_draw_grips(GtkThemingEngine * engine, cairo_t * cr, gdouble x, gdouble y, gdouble width, gdouble height, GtkOrientation orientation);
+
+static void render_line(GtkThemingEngine * engine, cairo_t * cr, gdouble x1, gdouble y1, gdouble x2, gdouble y2);
+static void render_frame(GtkThemingEngine * engine, cairo_t * cr, gdouble x, gdouble y, gdouble width, gdouble height);
+
+static void render_check(GtkThemingEngine * engine, cairo_t * cr, gdouble x, gdouble y, gdouble width, gdouble height);
+static void render_option(GtkThemingEngine * engine, cairo_t * cr, gdouble x, gdouble y, gdouble width, gdouble height);
+static void render_frame_gap(GtkThemingEngine * engine, cairo_t * cr, gdouble x, gdouble y, gdouble width, gdouble height, GtkPositionType gap_side, gdouble gap_s, gdouble gap_e);
+static void render_extension(GtkThemingEngine * engine, cairo_t * cr, gdouble x, gdouble y, gdouble width, gdouble height, GtkPositionType gap_side);
+static void render_slider(GtkThemingEngine * engine, cairo_t * cr, gdouble x, gdouble y, gdouble width, gdouble height, GtkOrientation orientation);
+static void render_handle(GtkThemingEngine * engine, cairo_t * cr, gdouble x, gdouble y, gdouble width, gdouble height);
+static void render_activity(GtkThemingEngine * engine, cairo_t * cr, gdouble x, gdouble y, gdouble width, gdouble height);
+
+static void color_dark2light(const GdkRGBA * color, GdkRGBA * color_return)
+{
+ GtkSymbolicColor *literal, *shade;
+
+ literal = gtk_symbolic_color_new_literal(color);
+ shade = gtk_symbolic_color_new_shade(literal, 1.3 / 0.7);
+ gtk_symbolic_color_unref(literal);
+
+ gtk_symbolic_color_resolve(shade, NULL, color_return);
+ gtk_symbolic_color_unref(shade);
+}
+
+static void color_dark2light_mid(const GdkRGBA * color_dark_, GdkRGBA * color_light_, GdkRGBA * color_mid_)
+{
+ GtkSymbolicColor *dark, *light, *mid;
+
+ dark = gtk_symbolic_color_new_literal(color_dark_);
+ light = gtk_symbolic_color_new_shade(dark, 1.3 / 0.7);
+
+ gtk_symbolic_color_resolve(light, NULL, color_light_);
+ mid = gtk_symbolic_color_new_mix(light, dark, 0.5);
+ gtk_symbolic_color_unref(light);
+ gtk_symbolic_color_unref(dark);
+
+ gtk_symbolic_color_resolve(mid, NULL, color_mid_);
+ gtk_symbolic_color_unref(mid);
+}
+
+static void xfce_draw_grip_rough (GtkThemingEngine * engine, cairo_t * cr, GtkStateFlags state, gdouble x, gdouble y, gdouble width, gdouble height, GtkOrientation orientation)
+{
+ gint xx, yy;
+ gint xthick, ythick;
+ GdkRGBA light, dark;
+ GtkBorder border;
+
+ gtk_theming_engine_get_border(engine, state, &border);
+
+ xthick = border.left;
+ ythick = border.top;
+
+ gtk_theming_engine_get_border_color(engine, state, &dark);
+ color_dark2light(&dark, &light);
+
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ {
+ if (width > 15 + xthick)
+ {
+ gint len = (height - 2 * (ythick + 2) > 4 ? height - 2 * (ythick + 2) : height - 2 * ythick);
+ gint delta = x + (width / 2) - 5;
+ yy = y + (height - len) / 2;
+ for(xx = 0; xx < 10; xx += 2)
+ {
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, xx + delta + 0.5, yy + 0.5);
+ cairo_line_to(cr, xx + delta + 0.5, yy + len - 0.5);
+ cairo_stroke(cr);
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, xx + delta + 1.5, yy + 0.5);
+ cairo_line_to(cr, xx + delta + 1.5, yy + len - 0.5);
+ cairo_stroke(cr);
+ }
+ }
+ }
+ else
+ {
+ if (height > 15 + ythick)
+ {
+ gint len = (width - 2 * (xthick + 2) > 4 ? width - 2 * (xthick + 2) : width - 2 * xthick);
+ gint delta = y + (height / 2) - 5;
+ xx = x + (width - len) / 2;
+ for(yy = 0; yy < 10; yy += 2)
+ {
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, xx + 0.5, yy + delta + 0.5);
+ cairo_line_to(cr, xx + len - 0.5, yy + delta + 0.5);
+ cairo_stroke(cr);
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, xx + 0.5, yy + delta + 1.5);
+ cairo_line_to(cr, xx + len - 0.5, yy + delta + 1.5);
+ cairo_stroke(cr);
+ }
+ }
+ }
+}
+
+static void xfce_draw_grip_slide (GtkThemingEngine * engine, cairo_t * cr, GtkStateFlags state, gdouble x, gdouble y, gdouble width, gdouble height, GtkOrientation orientation)
+{
+ gint xthick, ythick;
+ gint gx, gy, gwidth, gheight;
+ GdkRGBA light, dark, mid, bg;
+ GtkBorder border;
+
+ gtk_theming_engine_get_border(engine, state, &border);
+
+ xthick = border.left;
+ ythick = border.top;
+
+ gtk_theming_engine_get_border_color(engine, state, &dark);
+ color_dark2light_mid(&dark, &light, &mid);
+ gtk_theming_engine_get_background_color(engine, GTK_STATE_FLAG_SELECTED, &bg);
+
+ gx = gy = gwidth = gheight = 0;
+
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ {
+ gint delta = ((gint)((height - 3) / 2));
+ gx = x + delta;
+ gy = y + delta;
+ gwidth = width - 2 * delta - 1;
+ gheight = height - 2 * delta - 1;
+ }
+ else
+ {
+ gint delta = ((gint)((width - 3) / 2));
+ gx = x + delta;
+ gy = y + delta;
+ gwidth = width - 2 * delta - 1;
+ gheight = height - 2 * delta - 1;
+ }
+
+ if ((gheight > 1) && (gwidth > 1))
+ {
+ gdk_cairo_set_source_rgba(cr, &bg);
+ cairo_rectangle(cr, gx + 1, gy + 1, gwidth - 1, gheight - 1);
+ cairo_fill(cr);
+
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, gx + 0.5, gy + gheight + 0.5);
+ cairo_line_to(cr, gx + 0.5, gy + 0.5);
+ cairo_line_to(cr, gx + gwidth + 0.5, gy + 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, gx + 0.5, gy + gheight + 0.5);
+ cairo_line_to(cr, gx + gwidth + 0.5, gy + gheight + 0.5);
+ cairo_line_to(cr, gx + gwidth + 0.5, gy + 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &mid);
+ cairo_rectangle(cr, gx, gy, 1, 1);
+ cairo_rectangle(cr, gx + gwidth, gy, 1, 1);
+ cairo_rectangle(cr, gx, gy + gheight, 1, 1);
+ cairo_rectangle(cr, gx + gwidth, gy + gheight, 1, 1);
+ cairo_fill(cr);
+ }
+}
+
+static void xfce_draw_grips(GtkThemingEngine * engine, cairo_t * cr, gdouble x, gdouble y, gdouble width, gdouble height, GtkOrientation orientation)
+{
+ GtkStateFlags state;
+ XfceGripStyle grip_style = XFCE_GRIP_ROUGH;
+
+ state = gtk_theming_engine_get_state(engine);
+ gtk_theming_engine_get(engine, state, XFCE_GRIP_STYLE, &grip_style, NULL);
+
+ switch (grip_style)
+ {
+ case XFCE_GRIP_DISABLED:
+ break;
+ case XFCE_GRIP_ROUGH:
+ xfce_draw_grip_rough (engine, cr, state, x, y, width, height, orientation);
+ break;
+ case XFCE_GRIP_SLIDE:
+ xfce_draw_grip_slide (engine, cr, state, x, y, width, height, orientation);
+ break;
+ }
+}
+
+static void render_line(GtkThemingEngine * engine, cairo_t * cr, gdouble x1, gdouble y_1, gdouble x2, gdouble y_2)
+{
+ gint16 xthick, ythick;
+ gint16 thickness_light;
+ gint16 thickness_dark;
+ GtkStateFlags state;
+ GdkRGBA light, dark;
+ GtkBorder border;
+ GtkBorderStyle border_style;
+
+ state = gtk_theming_engine_get_state(engine);
+
+ gtk_theming_engine_get(engine, state, GTK_STYLE_PROPERTY_BORDER_STYLE, &border_style, NULL);
+
+#if 0
+ if (border_style == GTK_BORDER_STYLE_NONE)
+ return;
+#endif
+
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
+
+ gtk_theming_engine_get_border_color(engine, state, &dark);
+ gtk_theming_engine_get_border(engine, state, &border);
+
+ xthick = border.left;
+ ythick = border.top;
+
+#if 0
+ switch (border_style)
+ {
+ case GTK_BORDER_STYLE_NONE:
+ break;
+ case GTK_BORDER_STYLE_SOLID:
+ light = dark;
+ break;
+ case GTK_BORDER_STYLE_INSET:
+ break;
+ case GTK_BORDER_STYLE_OUTSET:
+ light = dark;
+ color_dark2light(&light, &dark);
+ break;
+ }
+#endif
+ color_dark2light(&dark, &light);
+
+ /* Vertical */
+ if (floor(x1 - x2) == 0)
+ {
+ thickness_light = xthick / 2;
+ thickness_dark = xthick - thickness_light;
+
+ /* Compensation for the way x and y are caclculated */
+ x1 += 1 + thickness_dark - thickness_light;
+ y_2 += 1;
+
+ cairo_set_line_width (cr, thickness_dark);
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x1 - (thickness_dark / 2.0), y_1);
+ cairo_line_to(cr, x1 - (thickness_dark / 2.0), y_2);
+ cairo_stroke(cr);
+
+ cairo_set_line_width (cr, thickness_light);
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x1 + (thickness_light / 2.0), y_1);
+ cairo_line_to(cr, x1 + (thickness_light / 2.0), y_2);
+ cairo_stroke(cr);
+ }
+ else
+ {
+ thickness_light = ythick / 2;
+ thickness_dark = ythick - thickness_light;
+
+ /* Compensation for the way x and y are caclculated */
+ y_1 += 1 + thickness_dark - thickness_light;
+ x2 += 1;
+
+ cairo_set_line_width (cr, thickness_dark);
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x1, y_1 - (thickness_dark / 2.0));
+ cairo_line_to(cr, x2, y_1 - (thickness_dark / 2.0));
+ cairo_stroke(cr);
+
+ cairo_set_line_width (cr, thickness_light);
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x1, y_1 + (thickness_light / 2.0));
+ cairo_line_to(cr, x2, y_1 + (thickness_light / 2.0));
+ cairo_stroke(cr);
+ }
+}
+
+static void render_frame(GtkThemingEngine * engine, cairo_t * cr, gdouble x, gdouble y, gdouble width, gdouble height)
+{
+ gint xt, yt;
+ gint xthick, ythick;
+ GtkStateFlags state;
+ GtkBorderStyle border_style;
+ GdkRGBA dark, light, mid, bg;
+ GdkRGBA black = {0.0, 0.0, 0.0, 1.0}; /* black */
+ gboolean smooth_edge;
+ GtkBorder border;
+ GtkJunctionSides junction;
+
+ state = gtk_theming_engine_get_state(engine);
+ gtk_theming_engine_get(engine, state, GTK_STYLE_PROPERTY_BORDER_STYLE, &border_style, NULL);
+
+ if (border_style == GTK_BORDER_STYLE_NONE)
+ return;
+
+ GE_CAIRO_INIT;
+
+ gtk_theming_engine_get_border_color(engine, state, &dark);
+ gtk_theming_engine_get_border(engine, state, &border);
+
+ xthick = border.left;
+ ythick = border.top;
+
+ /* Spin buttons are a special case */
+ if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SPINBUTTON))
+ {
+ junction = gtk_theming_engine_get_junction_sides(engine);
+ if ((junction & GTK_JUNCTION_TOP) == GTK_JUNCTION_TOP || (junction & GTK_JUNCTION_BOTTOM) == GTK_JUNCTION_BOTTOM)
+ {
+ if (!(state & GTK_STATE_FLAG_ACTIVE))
+ {
+ border_style = GTK_BORDER_STYLE_OUTSET;
+ }
+
+ if (state == GTK_STATE_FLAG_NORMAL || state & GTK_STATE_FLAG_INSENSITIVE)
+ {
+ gtk_theming_engine_get_border_color(engine, state, &dark);
+ }
+ else
+ {
+ gtk_theming_engine_get_border_color(engine, GTK_STATE_FLAG_NORMAL, &dark);
+ }
+
+ y = floor(y);
+ height = ceil(height);
+
+ xt = MIN(xthick, width - 1);
+ yt = MIN(ythick, height - 1);
+
+ gtk_theming_engine_get(engine, state, XFCE_SMOOTH_EDGE, &smooth_edge, NULL);
+ color_dark2light_mid(&dark, &light, &mid);
+ if (smooth_edge)
+ {
+ if ((xt > 1) && (yt > 1))
+ {
+ gdk_cairo_set_source_rgba(cr, &dark);
+ if ((junction & GTK_JUNCTION_TOP) != GTK_JUNCTION_TOP)
+ {
+ cairo_rectangle(cr, x - 2, y, 1, 1);
+ }
+ if ((junction & GTK_JUNCTION_BOTTOM) != GTK_JUNCTION_BOTTOM)
+ {
+ cairo_rectangle(cr, x - 2, y + height - 1, 1, 1);
+ }
+ cairo_fill(cr);
+
+ if ((junction & GTK_JUNCTION_TOP) != GTK_JUNCTION_TOP)
+ {
+ cairo_move_to(cr, x - 0.5, y + 1.5);
+ }
+ else
+ {
+ cairo_move_to(cr, x - 0.5, y + 0.5);
+ }
+ if ((junction & GTK_JUNCTION_BOTTOM) != GTK_JUNCTION_BOTTOM)
+ {
+ cairo_line_to(cr, x - 0.5, y + height - 1.5);
+ }
+ else
+ {
+ cairo_line_to(cr, x - 0.5, y + height - 0.5);
+ }
+ cairo_stroke(cr);
+
+ if ((junction & GTK_JUNCTION_TOP) != GTK_JUNCTION_TOP)
+ {
+ gdk_cairo_set_source_rgba(cr, &mid);
+ cairo_rectangle(cr, x - 2, y + 1, 1, 1);
+ cairo_fill(cr);
+ }
+
+ gdk_cairo_set_source_rgba(cr, &light);
+ if ((junction & GTK_JUNCTION_TOP) != GTK_JUNCTION_TOP)
+ {
+ cairo_move_to(cr, x - 1.5, y + 2.5);
+ }
+ else
+ {
+ cairo_move_to(cr, x - 1.5, y + 0.5);
+ }
+ if ((junction & GTK_JUNCTION_BOTTOM) != GTK_JUNCTION_BOTTOM)
+ {
+ cairo_line_to(cr, x - 1.5, y + height - 1.5);
+ }
+ else
+ {
+ cairo_line_to(cr, x - 1.5, y + height - 0.5);
+ }
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &mid);
+ if ((junction & GTK_JUNCTION_TOP) != GTK_JUNCTION_TOP)
+ {
+ cairo_rectangle(cr, x - 1, y, 1, 1);
+ }
+ if ((junction & GTK_JUNCTION_BOTTOM) != GTK_JUNCTION_BOTTOM)
+ {
+ cairo_rectangle(cr, x - 1, y + height - 1, 1, 1);
+ }
+ cairo_fill(cr);
+ }
+ else if ((xt > 0) && (yt > 0))
+ {
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x - 0.5, y + 0.5);
+ cairo_line_to(cr, x - 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &mid);
+ if ((junction & GTK_JUNCTION_TOP) != GTK_JUNCTION_TOP)
+ {
+ cairo_rectangle(cr, x - 1, y, 1, 1);
+ }
+ if ((junction & GTK_JUNCTION_BOTTOM) != GTK_JUNCTION_BOTTOM)
+ {
+ cairo_rectangle(cr, x - 1, y + height - 1, 1, 1);
+ }
+ cairo_fill(cr);
+ }
+ }
+ else
+ {
+ if ((xt > 1) && (yt > 1))
+ {
+ if ((junction & GTK_JUNCTION_TOP) != GTK_JUNCTION_TOP)
+ {
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x - 1.5, y + 0.5);
+ cairo_line_to(cr, x - 0.5, y + 0.5);
+ cairo_stroke(cr);
+ }
+
+ gdk_cairo_set_source_rgba(cr, &light);
+ if ((junction & GTK_JUNCTION_TOP) != GTK_JUNCTION_TOP)
+ {
+ cairo_move_to(cr, x - 0.5, y + 1.5);
+ }
+ else
+ {
+ cairo_move_to(cr, x - 0.5, y + 0.5);
+ }
+ cairo_line_to(cr, x - 0.5, y + height - 0.5);
+ if ((junction & GTK_JUNCTION_BOTTOM) != GTK_JUNCTION_BOTTOM)
+ {
+ cairo_line_to(cr, x - 1.5, y + height - 0.5);
+ }
+ cairo_stroke(cr);
+
+ if ((junction & GTK_JUNCTION_TOP) != GTK_JUNCTION_TOP)
+ {
+ gdk_cairo_set_source_rgba(cr, &black);
+ cairo_rectangle(cr, x - 2, y + 1, 1, 1);
+ cairo_fill(cr);
+ }
+
+ gdk_cairo_set_source_rgba(cr, &dark);
+ if ((junction & GTK_JUNCTION_TOP) != GTK_JUNCTION_TOP)
+ {
+ cairo_move_to(cr, x - 1.5, y + 2.5);
+ }
+ else
+ {
+ cairo_move_to(cr, x - 1.5, y + 0.5);
+ }
+ if ((junction & GTK_JUNCTION_BOTTOM) != GTK_JUNCTION_BOTTOM)
+ {
+ cairo_line_to(cr, x - 1.5, y + height - 1.5);
+ }
+ else
+ {
+ cairo_line_to(cr, x - 1.5, y + height - 0.5);
+ }
+ cairo_stroke(cr);
+ }
+ else if ((xt > 0) && (yt > 0))
+ {
+ if ((junction & GTK_JUNCTION_TOP) != GTK_JUNCTION_TOP)
+ {
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_rectangle(cr, x - 1, y, 1, 1);
+ cairo_fill(cr);
+ }
+
+ gdk_cairo_set_source_rgba(cr, &light);
+ if ((junction & GTK_JUNCTION_TOP) != GTK_JUNCTION_TOP)
+ {
+ cairo_move_to(cr, x - 0.5, y + 1.5);
+ }
+ else
+ {
+ cairo_move_to(cr, x - 0.5, y + 0.5);
+ }
+ cairo_line_to(cr, x - 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+ }
+ }
+
+ if (state != GTK_STATE_FLAG_NORMAL && !(state & GTK_STATE_FLAG_INSENSITIVE))
+ {
+ gtk_theming_engine_get_border_color(engine, state, &dark);
+ }
+ }
+ }
+
+ xt = MIN(xthick, width - 1);
+ yt = MIN(ythick, height - 1);
+
+ switch (border_style)
+ {
+ case GTK_BORDER_STYLE_NONE:
+ break;
+ case GTK_BORDER_STYLE_SOLID:
+ gdk_cairo_set_source_rgba(cr, &dark);
+ if ((xt > 1) && (yt > 1))
+ {
+ cairo_set_line_width(cr, 2.0);
+ cairo_rectangle(cr, x + 1, y + 1, width - 2, height - 2);
+ }
+ else if ((xt > 0) && (yt > 0))
+ {
+ cairo_rectangle(cr, x + 0.5, y + 0.5, width - 1, height - 1);
+ }
+ cairo_stroke(cr);
+ break;
+ case GTK_BORDER_STYLE_INSET:
+ gtk_theming_engine_get(engine, state, XFCE_SMOOTH_EDGE, &smooth_edge, NULL);
+ color_dark2light_mid(&dark, &light, &mid);
+ if (smooth_edge)
+ {
+ if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_TROUGH))
+ {
+ /* Do nothing */
+ }
+ else if ((xt > 1) && (yt > 1))
+ {
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + 1.5, y + 0.5);
+ cairo_line_to(cr, x + width - 1.5, y + 0.5);
+ cairo_move_to(cr, x + 0.5, y + 1.5);
+ cairo_line_to(cr, x + 0.5, y + height - 1.5);
+
+ cairo_move_to(cr, x + 1.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 1.5, y + height - 0.5);
+ cairo_move_to(cr, x + width - 0.5, y + 1.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &mid);
+ cairo_move_to(cr, x + width - 1.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + height - 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x + 2.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + 2.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &mid);
+ cairo_rectangle(cr, x, y, 1, 1);
+ cairo_rectangle(cr, x + width - 1, y, 1, 1);
+ cairo_rectangle(cr, x, y + height - 1, 1, 1);
+ cairo_rectangle(cr, x + width - 1, y + height - 1, 1, 1);
+ cairo_fill(cr);
+ }
+ else if ((xt > 0) && (yt > 0))
+ {
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + 1.5, y + 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 0.5);
+ cairo_move_to(cr, x + 0.5, y + 1.5);
+ cairo_line_to(cr, x + 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x + 1.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &mid);
+ cairo_rectangle(cr, x, y, 1, 1);
+ cairo_rectangle(cr, x + width - 1, y, 1, 1);
+ cairo_rectangle(cr, x, y + height - 1, 1, 1);
+ cairo_rectangle(cr, x + width - 1, y + height - 1, 1, 1);
+ cairo_fill(cr);
+ }
+ }
+ else
+ {
+ if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_TROUGH))
+ {
+ gtk_theming_engine_get_border_color(engine, GTK_STATE_FLAG_ACTIVE, &dark);
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_rectangle(cr, x + 0.5, y + 0.5, width - 1, height - 1);
+ cairo_stroke(cr);
+ }
+ else if ((xt > 1) && (yt > 1))
+ {
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + width - 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x + 1.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &black);
+ cairo_move_to(cr, x + width - 1.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + height - 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + 2.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + 2.5);
+ cairo_stroke(cr);
+ }
+ else if ((xt > 0) && (yt > 0))
+ {
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + width - 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x + 1.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 1.5);
+ cairo_stroke(cr);
+ }
+ }
+ break;
+ case GTK_BORDER_STYLE_OUTSET:
+ gtk_theming_engine_get(engine, state, XFCE_SMOOTH_EDGE, &smooth_edge, NULL);
+ color_dark2light_mid(&dark, &light, &mid);
+ if (smooth_edge)
+ {
+ if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SPINBUTTON) && !(state & GTK_STATE_FLAG_PRELIGHT))
+ {
+ /* Do nothing */
+ }
+ else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_PROGRESSBAR))
+ {
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_rectangle(cr, x + 0.5, y + 0.5, width - 1, height - 1);
+ cairo_stroke(cr);
+
+ gtk_theming_engine_get_border_color(engine, GTK_STATE_FLAG_NORMAL, &dark);
+ color_dark2light_mid(&dark, &light, &mid);
+
+ gdk_cairo_set_source_rgba(cr, &mid);
+ cairo_rectangle(cr, x, y, 1, 1);
+ cairo_rectangle(cr, x + width - 1, y, 1, 1);
+ cairo_rectangle(cr, x, y + height - 1, 1, 1);
+ cairo_rectangle(cr, x + width - 1, y + height - 1, 1, 1);
+ cairo_fill(cr);
+ }
+ else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENU))
+ {
+ if ((xt > 0) && (yt > 0))
+ {
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_rectangle(cr, x + 0.5, y + 0.5, width - 1, height - 1);
+ cairo_stroke(cr);
+ }
+ }
+ else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUBAR))
+ {
+ if ((xt > 1) && (yt > 1))
+ {
+ gdk_cairo_set_source_rgba(cr, &mid);
+ cairo_move_to(cr, x + 0.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+ }
+ else if ((xt > 0) && (yt > 0))
+ {
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+ }
+ }
+ else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_DOCK) ||
+ gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_TOOLBAR))
+ {
+ if ((xt > 1) && (yt > 1))
+ {
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x + 0.5, y + 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &mid);
+ cairo_move_to(cr, x + 0.5 , y + height - 1.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+ }
+ else if ((xt > 0) && (yt > 0))
+ {
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x + 0.5, y + 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+ }
+ }
+ else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SLIDER))
+ {
+ if ((xt > 1) && (yt > 1))
+ {
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + width - 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + height - 0.5);
+
+ cairo_move_to(cr, x + 1.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x + width - 2.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + height - 2.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &mid);
+ cairo_move_to(cr, x + 1.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + 1.5);
+ cairo_stroke(cr);
+ }
+ else if ((xt > 0) && (yt > 0))
+ {
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x + width - 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + 1.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 1.5);
+ cairo_stroke(cr);
+ }
+ }
+ else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_FRAME))
+ {
+ if ((xt > 1) && (yt > 1))
+ {
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x + width - 1.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + height - 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 0.5);
+ cairo_stroke(cr);
+
+ gtk_theming_engine_get_background_color(engine, state, &bg);
+ gdk_cairo_set_source_rgba(cr, &bg);
+ cairo_move_to(cr, x + width - 1.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + height - 1.5);
+
+ cairo_move_to(cr, x + 2.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + 2.5);
+ cairo_stroke(cr);
+ }
+ else if ((xt > 0) && (yt > 0))
+ {
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x + width - 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + 1.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 1.5);
+ cairo_stroke(cr);
+ }
+ }
+ else
+ {
+ if ((xt > 1) && (yt > 1))
+ {
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + 1.5, y + 0.5);
+ cairo_line_to(cr, x + width - 1.5, y + 0.5);
+ cairo_move_to(cr, x + 0.5, y + 1.5);
+ cairo_line_to(cr, x + 0.5, y + height - 1.5);
+
+ cairo_move_to(cr, x + 1.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 1.5, y + height - 0.5);
+ cairo_move_to(cr, x + width - 0.5, y + 1.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x + width - 2.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + height - 2.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &mid);
+ cairo_move_to(cr, x + 1.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &mid);
+ cairo_rectangle(cr, x, y, 1, 1);
+ cairo_rectangle(cr, x + width - 1, y, 1, 1);
+ cairo_rectangle(cr, x, y + height - 1, 1, 1);
+ cairo_rectangle(cr, x + width - 1, y + height - 1, 1, 1);
+ cairo_fill(cr);
+ }
+ else if ((xt > 0) && (yt > 0))
+ {
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x + 1.5, y + 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 0.5);
+ cairo_move_to(cr, x + 0.5, y + 1.5);
+ cairo_line_to(cr, x + 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + 1.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &mid);
+ cairo_rectangle(cr, x, y, 1, 1);
+ cairo_rectangle(cr, x + width - 1, y, 1, 1);
+ cairo_rectangle(cr, x, y + height - 1, 1, 1);
+ cairo_rectangle(cr, x + width - 1, y + height - 1, 1, 1);
+ cairo_fill(cr);
+ }
+ }
+ }
+ else
+ {
+ if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_SPINBUTTON) && !(state & GTK_STATE_FLAG_PRELIGHT))
+ {
+ /* Do nothing */
+ }
+ else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUBAR))
+ {
+ if ((xt > 1) && (yt > 1))
+ {
+ gdk_cairo_set_source_rgba(cr, &mid);
+ cairo_move_to(cr, x + 0.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+ }
+ else if ((xt > 0) && (yt > 0))
+ {
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+ }
+ }
+ else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_DOCK) ||
+ gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_TOOLBAR))
+ {
+ if ((xt > 1) && (yt > 1))
+ {
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x + 0.5, y + 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &mid);
+ cairo_move_to(cr, x + 0.5 , y + height - 1.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+ }
+ else if ((xt > 0) && (yt > 0))
+ {
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x + 0.5, y + 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+ }
+ }
+ else if ((xt > 1) && (yt > 1))
+ {
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + width - 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &black);
+ cairo_move_to(cr, x + 1.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x + width - 1.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + height - 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + 2.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + 2.5);
+ cairo_stroke(cr);
+ }
+ else if ((xt > 0) && (yt > 0))
+ {
+ gdk_cairo_set_source_rgba(cr, &light);
+ cairo_move_to(cr, x + width - 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &dark);
+ cairo_move_to(cr, x + 1.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 1.5);
+ cairo_stroke(cr);
+ }
+ }
+ break;
+ }
+}
+
+static cairo_surface_t *get_part_bmap (Part part)
+{
+ if (!parts[part].bmap)
+ {
+ parts[part].bmap = cairo_image_surface_create_for_data((guchar*)parts[part].bits, CAIRO_FORMAT_A1, PART_SIZE, PART_SIZE, sizeof(guint32));
+ }
+ return parts[part].bmap;
+}
+
+static void draw_part(cairo_t * cr, const GdkRGBA * c, gdouble x, gdouble y, Part part)
+{
+ gdk_cairo_set_source_rgba(cr, c);
+
+ cairo_mask_surface(cr, get_part_bmap (part), x, y);
+}
+
+static void render_check(GtkThemingEngine * engine, cairo_t * cr, gdouble x, gdouble y, gdouble width, gdouble height)
+{
+ GtkStateFlags state;
+ GdkRGBA bg, border, fg;
+
+ x -= (1 + PART_SIZE - width) / 2;
+ y -= (1 + PART_SIZE - height) / 2;
+
+ state = gtk_theming_engine_get_state(engine);
+ gtk_theming_engine_get_background_color(engine, state, &bg);
+ gtk_theming_engine_get_border_color(engine, state, &border);
+ gtk_theming_engine_get_color(engine, state, &fg);
+
+ if (!gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM))
+ draw_part(cr, &bg, x, y, CHECK_BASE);
+ draw_part(cr, &border, x, y, CHECK_LIGHT);
+ draw_part(cr, &border, x, y, CHECK_DARK);
+
+ if (state & GTK_STATE_FLAG_INCONSISTENT)
+ {
+ draw_part(cr, &fg, x, y, CHECK_DASH);
+ }
+ else if (state & GTK_STATE_FLAG_ACTIVE)
+ {
+ draw_part(cr, &fg, x, y, CHECK_CROSS);
+ }
+}
+
+static void render_option(GtkThemingEngine * engine, cairo_t * cr, gdouble x, gdouble y, gdouble width, gdouble height)
+{
+ GtkStateFlags state;
+ GdkRGBA bg, border, fg;
+
+ x -= (1 + PART_SIZE - width) / 2;
+ y -= (1 + PART_SIZE - height) / 2;
+
+ state = gtk_theming_engine_get_state(engine);
+ gtk_theming_engine_get_background_color(engine, state, &bg);
+ gtk_theming_engine_get_border_color(engine, state, &border);
+ gtk_theming_engine_get_color(engine, state, &fg);
+
+ if (!gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM))
+ draw_part(cr, &bg, x, y, RADIO_BASE);
+ draw_part(cr, &border, x, y, RADIO_LIGHT);
+ draw_part(cr, &border, x, y, RADIO_DARK);
+
+ if (state & GTK_STATE_FLAG_INCONSISTENT)
+ {
+ draw_part(cr, &fg, x, y, CHECK_DASH);
+ }
+ else if (state & GTK_STATE_FLAG_ACTIVE)
+ {
+ draw_part(cr, &fg, x, y, RADIO_TEXT);
+ }
+}
+
+static void render_frame_gap(GtkThemingEngine * engine, cairo_t * cr, gdouble x, gdouble y, gdouble width, gdouble height, GtkPositionType gap_side, gdouble gap_s, gdouble gap_e)
+{
+ GtkStateFlags state;
+ GtkBorderStyle border_style;
+ gdouble x0, y_0, x1, y_1;
+ gdouble ex, ey, ew, eh;
+
+ state = gtk_theming_engine_get_state(engine);
+
+ if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_NOTEBOOK))
+ {
+ GdkRGBA c1;
+ GdkRGBA c2;
+ GdkRGBA c3;
+ GdkRGBA c4 = {0.0, 0.0, 0.0, 1.0}; /* black */
+ gboolean smooth_edge;
+
+ GE_CAIRO_INIT;
+
+ gtk_theming_engine_get(engine, state, XFCE_SMOOTH_EDGE, &smooth_edge, NULL);
+ if (smooth_edge)
+ {
+ gtk_theming_engine_get_background_color(engine, state, &c2);
+ gtk_theming_engine_get_border_color(engine, state, &c1);
+ c3 = c2;
+ c4 = c1;
+ }
+ else
+ {
+ gtk_theming_engine_get_border_color(engine, state, &c1);
+ color_dark2light(&c1, &c2);
+ c3 = c1;
+ }
+
+ switch (gap_side)
+ {
+ case GTK_POS_TOP:
+ gdk_cairo_set_source_rgba(cr, &c1);
+ cairo_move_to(cr, x + 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c2);
+ cairo_move_to(cr, x + 1.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + height - 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c3);
+ cairo_move_to(cr, x + 2.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c4);
+ cairo_move_to(cr, x + 1.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 0.5);
+ cairo_stroke(cr);
+
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
+ if (gap_s > 0)
+ {
+ gdk_cairo_set_source_rgba(cr, &c1);
+ cairo_move_to(cr, x, y + 0.5);
+ cairo_line_to(cr, x + gap_s, y + 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c2);
+ cairo_move_to(cr, x + 1, y + 1.5);
+ cairo_line_to(cr, x + gap_s, y + 1.5);
+ cairo_stroke(cr);
+
+ cairo_rectangle(cr, x + gap_s, y + 0.5, 1, 1);
+ cairo_move_to(cr, x + gap_s, y);
+ cairo_line_to(cr, x + gap_s + 1, y + 0.5);
+ cairo_fill(cr);
+ }
+ if ((width - gap_e) > 0)
+ {
+ gdk_cairo_set_source_rgba(cr, &c1);
+ cairo_move_to(cr, x + gap_e, y + 0.5);
+ cairo_line_to(cr, x + width - 1, y + 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c2);
+ cairo_move_to(cr, x + gap_e, y + 1.5);
+ cairo_line_to(cr, x + width - 1, y + 1.5);
+
+ cairo_move_to(cr, x + gap_e - 1, y + 0.5);
+ cairo_line_to(cr, x + gap_e, y + 0.5);
+ cairo_stroke(cr);
+ }
+ break;
+ case GTK_POS_BOTTOM:
+ gdk_cairo_set_source_rgba(cr, &c1);
+ cairo_move_to(cr, x + width - 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c2);
+ cairo_move_to(cr, x + width - 1.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c3);
+ cairo_move_to(cr, x + width - 1.5, y + 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c4);
+ cairo_move_to(cr, x + width - 0.5, y + 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
+ if (gap_s > 0)
+ {
+ gdk_cairo_set_source_rgba(cr, &c4);
+ cairo_move_to(cr, x, y + height - 0.5);
+ cairo_line_to(cr, x + gap_s, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c3);
+ cairo_move_to(cr, x + 1, y + height - 1.5);
+ cairo_line_to(cr, x + gap_s, y + height - 1.5);
+
+ cairo_move_to(cr, x + gap_s, y + height - 0.5);
+ cairo_line_to(cr, x + gap_s + 1, y + height - 0.5);
+ cairo_stroke(cr);
+ }
+ if ((width - gap_e) > 0)
+ {
+ gdk_cairo_set_source_rgba(cr, &c4);
+ cairo_move_to(cr, x + gap_e, y + height - 0.5);
+ cairo_line_to(cr, x + width - 1, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c3);
+ cairo_move_to(cr, x + gap_e, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1, y + height - 1.5);
+
+ cairo_move_to(cr, x + gap_e - 1, y + height - 0.5);
+ cairo_line_to(cr, x + gap_e, y + height - 0.5);
+ cairo_stroke(cr);
+ }
+ break;
+ case GTK_POS_LEFT:
+ gdk_cairo_set_source_rgba(cr, &c1);
+ cairo_move_to(cr, x + 0.5, y + 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c2);
+ cairo_move_to(cr, x + 0.5, y + 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c3);
+ cairo_move_to(cr, x + 0.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c4);
+ cairo_move_to(cr, x + 1.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 0.5);
+ cairo_stroke(cr);
+
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
+ if (gap_s > 0)
+ {
+ gdk_cairo_set_source_rgba(cr, &c1);
+ cairo_move_to(cr, x + 0.5, y);
+ cairo_line_to(cr, x + 0.5, y + gap_s);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c2);
+ cairo_move_to(cr, x + 1.5, y + 1);
+ cairo_line_to(cr, x + 1.5, y + gap_s);
+
+ cairo_move_to(cr, x + 0.5, y + gap_s);
+ cairo_line_to(cr, x + 0.5, y + gap_s + 1);
+ cairo_stroke(cr);
+ }
+ if ((width - gap_e) > 0)
+ {
+ gdk_cairo_set_source_rgba(cr, &c1);
+ cairo_move_to(cr, x + 0.5, y + gap_e);
+ cairo_line_to(cr, x + 0.5, y + height - 1);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c2);
+ cairo_move_to(cr, x + 1.5, y + gap_e);
+ cairo_line_to(cr, x + 1.5, y + height - 1);
+
+ cairo_move_to(cr, x + 0.5, y + gap_e - 1);
+ cairo_line_to(cr, x + 0.5, y + gap_e);
+ cairo_stroke(cr);
+ }
+ break;
+ case GTK_POS_RIGHT:
+ gdk_cairo_set_source_rgba(cr, &c1);
+ cairo_move_to(cr, x + width - 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c2);
+ cairo_move_to(cr, x + width - 0.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + height - 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c3);
+ cairo_move_to(cr, x + 1.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c4);
+ cairo_move_to(cr, x + 1.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
+ if (gap_s > 0)
+ {
+ gdk_cairo_set_source_rgba(cr, &c4);
+ cairo_move_to(cr, x + width - 0.5, y);
+ cairo_line_to(cr, x + width - 0.5, y + gap_s);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c3);
+ cairo_move_to(cr, x + width - 1.5, y + 1);
+ cairo_line_to(cr, x + width - 1.5, y + gap_s);
+
+ cairo_move_to(cr, x + width - 0.5, y + gap_s);
+ cairo_line_to(cr, x + width - 0.5, y + gap_s + 1);
+ cairo_stroke(cr);
+ }
+ if ((width - gap_e) > 0)
+ {
+ gdk_cairo_set_source_rgba(cr, &c4);
+ cairo_move_to(cr, x + width - 0.5, y + gap_e);
+ cairo_line_to(cr, x + width - 0.5, y + height - 1);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c3);
+ cairo_move_to(cr, x + width - 1.5, y + gap_e);
+ cairo_line_to(cr, x + width - 1.5, y + height - 1);
+
+ cairo_move_to(cr, x + width - 0.5, y + gap_e - 1);
+ cairo_line_to(cr, x + width - 0.5, y + gap_e);
+ cairo_stroke(cr);
+ }
+ break;
+ }
+
+ return;
+ }
+
+ gtk_theming_engine_get(engine, state, GTK_STYLE_PROPERTY_BORDER_STYLE, &border_style, NULL);
+
+ if (border_style == GTK_BORDER_STYLE_NONE)
+ return;
+
+ switch (gap_side)
+ {
+ case GTK_POS_TOP:
+ ex = x + gap_s;
+ ey = y;
+ ew = gap_e - gap_s;
+ eh = 2;
+ break;
+ case GTK_POS_BOTTOM:
+ ex = x + gap_s;
+ ey = y + height - 2;
+ ew = gap_e - gap_s;
+ eh = 2;
+ break;
+ case GTK_POS_LEFT:
+ ex = x;
+ ey = y + gap_s;
+ ew = 2;
+ eh = gap_e - gap_s;
+ break;
+ case GTK_POS_RIGHT:
+ ex = x + width - 2;
+ ey = y + gap_s;
+ ew = 2;
+ eh = gap_e - gap_s;
+ break;
+ }
+
+ cairo_save (cr);
+
+ cairo_clip_extents (cr, &x0, &y_0, &x1, &y_1);
+ cairo_rectangle (cr, x0, y_0, x1 - x0, ey - y_0);
+ cairo_rectangle (cr, x0, ey, ex - x0, eh);
+ cairo_rectangle (cr, ex + ew, ey, x1 - (ex + ew), eh);
+ cairo_rectangle (cr, x0, ey + eh, x1 - x0, y_1 - (ey + eh));
+ cairo_clip (cr);
+
+ render_frame (engine, cr, x, y, width, height);
+
+ cairo_restore (cr);
+}
+
+static void render_extension(GtkThemingEngine * engine, cairo_t * cr, gdouble x, gdouble y, gdouble width, gdouble height, GtkPositionType gap_side)
+{
+ GtkStateFlags state;
+ gboolean smooth_edge = FALSE;
+ GdkRGBA c1;
+ GdkRGBA c2;
+ GdkRGBA c3;
+ GdkRGBA c4 = {0.0, 0.0, 0.0, 1.0}; /* black */
+ GtkBorder border;
+
+ GE_CAIRO_INIT;
+
+ state = gtk_theming_engine_get_state(engine);
+ gtk_theming_engine_get_border(engine, state, &border);
+
+ GTK_THEMING_ENGINE_GET_CLASS(engine)->render_background(engine, cr, x - border.left + 1, y - border.top + 1, width + border.left + border.right - 2, height + border.top + border.bottom - 2);
+
+ gtk_theming_engine_get(engine, state, XFCE_SMOOTH_EDGE, &smooth_edge, NULL);
+
+ if (smooth_edge)
+ {
+ gtk_theming_engine_get_background_color(engine, state, &c2);
+ gtk_theming_engine_get_border_color(engine, state, &c1);
+ c3 = c2;
+ c4 = c1;
+ }
+ else
+ {
+ gtk_theming_engine_get_border_color(engine, state, &c1);
+ color_dark2light(&c1, &c2);
+ c3 = c1;
+ }
+
+ switch (gap_side)
+ {
+ case GTK_POS_TOP:
+ gdk_cairo_set_source_rgba(cr, &c1);
+ cairo_move_to(cr, x + 0.5, y + 0.5);
+ cairo_line_to(cr, x + 0.5, y + height - 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c2);
+ cairo_move_to(cr, x + 1.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + height - 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c3);
+ cairo_move_to(cr, x + 2.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c4);
+ cairo_move_to(cr, x + 1.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 1.5, y + height - 0.5);
+ cairo_move_to(cr, x + width - 0.5, y + 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 1.5);
+ cairo_stroke(cr);
+ break;
+ case GTK_POS_BOTTOM:
+ gdk_cairo_set_source_rgba(cr, &c1);
+ cairo_move_to(cr, x + 1.5, y + 0.5);
+ cairo_line_to(cr, x + width - 1.5, y + 0.5);
+ cairo_move_to(cr, x + 0.5, y + 1.5);
+ cairo_line_to(cr, x + 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c2);
+ cairo_move_to(cr, x + width - 1.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c3);
+ cairo_move_to(cr, x + width - 1.5, y + 2.5);
+ cairo_line_to(cr, x + width - 1.5, y + height - 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c4);
+ cairo_move_to(cr, x + width - 0.5, y + 1.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+ break;
+ case GTK_POS_LEFT:
+ gdk_cairo_set_source_rgba(cr, &c1);
+ cairo_move_to(cr, x + 0.5, y + 0.5);
+ cairo_line_to(cr, x + width - 1.5, y + 0.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c2);
+ cairo_move_to(cr, x + 1.5, y + 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c3);
+ cairo_move_to(cr, x + 0.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 1.5, y + 2.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c4);
+ cairo_move_to(cr, x + 0.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 1.5, y + height - 0.5);
+ cairo_move_to(cr, x + width - 0.5, y + 1.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 1.5);
+ cairo_stroke(cr);
+ break;
+ case GTK_POS_RIGHT:
+ gdk_cairo_set_source_rgba(cr, &c1);
+ cairo_move_to(cr, x + 1.5, y + 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + 0.5);
+ cairo_move_to(cr, x + 0.5, y + 1.5);
+ cairo_line_to(cr, x + 0.5, y + height - 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c2);
+ cairo_move_to(cr, x + width - 0.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + 1.5);
+ cairo_line_to(cr, x + 1.5, y + height - 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c3);
+ cairo_move_to(cr, x + 2.5, y + height - 1.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 1.5);
+ cairo_stroke(cr);
+
+ gdk_cairo_set_source_rgba(cr, &c4);
+ cairo_move_to(cr, x + 1.5, y + height - 0.5);
+ cairo_line_to(cr, x + width - 0.5, y + height - 0.5);
+ cairo_stroke(cr);
+ break;
+ }
+}
+
+static void render_slider(GtkThemingEngine * engine, cairo_t * cr, gdouble x, gdouble y, gdouble width, gdouble height, GtkOrientation orientation)
+{
+ GE_CAIRO_INIT;
+
+ GTK_THEMING_ENGINE_GET_CLASS(engine)->render_background(engine, cr, x, y, width, height);
+ GTK_THEMING_ENGINE_GET_CLASS(engine)->render_frame(engine, cr, x, y, width, height);
+ xfce_draw_grips(engine, cr, x, y, width, height, orientation);
+}
+
+static void render_handle(GtkThemingEngine * engine, cairo_t * cr, gdouble x, gdouble y, gdouble width, gdouble height)
+{
+ GtkOrientation orientation;
+
+ if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_GRIP))
+ {
+ GTK_THEMING_ENGINE_CLASS(xfce_engine_parent_class)->render_handle(engine, cr, x, y, width, height);
+ return;
+ }
+
+ GE_CAIRO_INIT;
+
+ orientation = GTK_ORIENTATION_HORIZONTAL;
+ if (height > width)
+ orientation = GTK_ORIENTATION_VERTICAL;
+
+#if 0
+ GTK_THEMING_ENGINE_GET_CLASS(engine)->render_background(engine, cr, x, y, width, height);
+#endif
+ xfce_draw_grips(engine, cr, x, y, width, height, orientation);
+}
+
+static void render_activity(GtkThemingEngine * engine, cairo_t * cr, gdouble x, gdouble y, gdouble width, gdouble height)
+{
+ if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_PROGRESSBAR))
+ {
+ GTK_THEMING_ENGINE_GET_CLASS(engine)->render_background(engine, cr, x, y, width, height);
+ GTK_THEMING_ENGINE_GET_CLASS(engine)->render_frame(engine, cr, x, y, width, height);
+ }
+ else
+ {
+ GTK_THEMING_ENGINE_CLASS(xfce_engine_parent_class)->render_activity(engine, cr, x, y, width, height);
+ }
+}
+
+void xfce_engine_register_types(GTypeModule * module)
+{
+ xfce_engine_register_type(module);
+}
+
+static void xfce_engine_init(XfceEngine * engine)
+{
+}
+
+static void xfce_engine_class_init(XfceEngineClass * klass)
+{
+ GtkThemingEngineClass *engine_class = GTK_THEMING_ENGINE_CLASS(klass);
+
+ engine_class->render_line = render_line;
+ engine_class->render_frame = render_frame;
+ engine_class->render_check = render_check;
+ engine_class->render_option = render_option;
+ engine_class->render_frame_gap = render_frame_gap;
+ engine_class->render_extension = render_extension;
+ engine_class->render_slider = render_slider;
+ engine_class->render_handle = render_handle;
+ engine_class->render_activity = render_activity;
+
+ gtk_theming_engine_register_property(XFCE_NAMESPACE, NULL,
+ g_param_spec_boolean(SMOOTH_EDGE, "Smooth edge", "Smooth edge",
+ FALSE, 0));
+ gtk_theming_engine_register_property(XFCE_NAMESPACE, NULL,
+ g_param_spec_enum(GRIP_STYLE, "Grip style", "Grip style",
+ XFCE_TYPE_GRIP_STYLE, XFCE_GRIP_ROUGH, 0));
+}
+
+static void xfce_engine_class_finalize(XfceEngineClass * klass)
+{
+}
+
diff --git a/src/xfce_theme_main.c b/gtk-3.0/xfce_engine.h
similarity index 65%
copy from src/xfce_theme_main.c
copy to gtk-3.0/xfce_engine.h
index 58941c0..25c4ed6 100644
--- a/src/xfce_theme_main.c
+++ b/gtk-3.0/xfce_engine.h
@@ -15,6 +15,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Copyright (C) 1999-2004 Olivier Fourdan (fourdan at xfce.org)
+ * Copyright (C) 2011 Peter de Ridder (peter at xfce.org)
*
* Portions based Thinice port by
* Tim Gerla <timg at rrv.net>,
@@ -41,36 +42,28 @@
# include "config.h"
#endif
-#include <gmodule.h>
#include <gtk/gtk.h>
-#include "xfce_rc_style.h"
-#include "xfce_style.h"
-G_MODULE_EXPORT void theme_init(GTypeModule * module);
-G_MODULE_EXPORT void theme_exit(void);
-G_MODULE_EXPORT GtkRcStyle *theme_create_rc_style(void);
-G_MODULE_EXPORT const gchar * g_module_check_init (GModule * module);
+typedef struct _XfceEngine XfceEngine;
+typedef struct _XfceEngineClass XfceEngineClass;
+#define XFCE_TYPE_ENGINE xfce_engine_get_type()
+#define XFCE_ENGINE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), XFCE_TYPE_ENGINE, XfceEngine))
+#define XFCE_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_ENGINE, XfceEngineClass))
+#define XFCE_IS_ENGINE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), XFCE_TYPE_ENGINE))
+#define XFCE_IS_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_ENGINE))
+#define XFCE_ENGINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_ENGINE, XfceEngineClass))
-
-G_MODULE_EXPORT void theme_init(GTypeModule * module)
+struct _XfceEngine
{
- xfce_rc_style_register_type(module);
- xfce_style_register_type(module);
-}
+ GtkThemingEngine parent_instance;
+};
-G_MODULE_EXPORT void theme_exit(void)
+struct _XfceEngineClass
{
-}
+ GtkThemingEngineClass parent_class;
+};
-G_MODULE_EXPORT GtkRcStyle *theme_create_rc_style(void)
-{
- void *ptr;
- ptr = GTK_RC_STYLE(g_object_new(XFCE_TYPE_RC_STYLE, NULL));
- return (GtkRcStyle *) ptr;
-}
+GType xfce_engine_get_type(void);
-G_MODULE_EXPORT const gchar * g_module_check_init (GModule * module)
-{
- return gtk_check_version (GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION - GTK_INTERFACE_AGE);
-}
+void xfce_engine_register_types(GTypeModule * module);
diff --git a/src/xfce_style.h b/gtk-3.0/xfce_style.h
similarity index 100%
rename from src/xfce_style.h
rename to gtk-3.0/xfce_style.h
diff --git a/src/gradient_draw.h b/gtk-3.0/xfce_style_types.h
similarity index 73%
rename from src/gradient_draw.h
rename to gtk-3.0/xfce_style_types.h
index fc7f859..213cea0 100644
--- a/src/gradient_draw.h
+++ b/gtk-3.0/xfce_style_types.h
@@ -15,7 +15,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Copyright (C) 1999-2004 Olivier Fourdan (fourdan at xfce.org)
- * Copyright (C) 2011 Peter de Ridder <peter at xfce.org>
+ * Copyright (C) 2011 Peter de Ridder (peter at xfce.org)
*
* Portions based Thinice port by
* Tim Gerla <timg at rrv.net>,
@@ -38,20 +38,14 @@
* Portions based on original GTK theme
*/
-#ifndef INC_GRADIENT_DRAW_H
-#define INC_GRADIENT_DRAW_H
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
typedef enum
{
- GRADIENT_HORIZONTAL,
- GRADIENT_VERTICAL,
- GRADIENT_NORTHERN_DIAGONAL,
- GRADIENT_SOUTHERN_DIAGONAL
-} GradientType;
+ XFCE_GRIP_DISABLED,
+ XFCE_GRIP_ROUGH,
+ XFCE_GRIP_SLIDE
+} XfceGripStyle;
-#define GRADIENT(horizontal) (horizontal ? GRADIENT_HORIZONTAL : GRADIENT_VERTICAL)
-#define DIAGONALGRADIENT(northern) (northern ? GRADIENT_NORTHERN_DIAGONAL : GRADIENT_SOUTHERN_DIAGONAL)
-
-void gradient_draw_shaded(cairo_t * cr, gint x, gint y, gint width, gint height, const GdkColor * color, gfloat shine_value, gfloat shade_value, GradientType gradient_style);
-
-#endif /* INC_GRADIENT_DRAW_H */
diff --git a/src/xfce_theme_main.c b/gtk-3.0/xfce_theme_main.c
similarity index 86%
rename from src/xfce_theme_main.c
rename to gtk-3.0/xfce_theme_main.c
index 58941c0..60c994c 100644
--- a/src/xfce_theme_main.c
+++ b/gtk-3.0/xfce_theme_main.c
@@ -15,6 +15,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Copyright (C) 1999-2004 Olivier Fourdan (fourdan at xfce.org)
+ * Copyright (C) 2011 Peter de Ridder (peter at xfce.org)
*
* Portions based Thinice port by
* Tim Gerla <timg at rrv.net>,
@@ -43,31 +44,29 @@
#include <gmodule.h>
#include <gtk/gtk.h>
-#include "xfce_rc_style.h"
-#include "xfce_style.h"
+#include "xfce_engine.h"
G_MODULE_EXPORT void theme_init(GTypeModule * module);
G_MODULE_EXPORT void theme_exit(void);
-G_MODULE_EXPORT GtkRcStyle *theme_create_rc_style(void);
+G_MODULE_EXPORT GtkThemingEngine *create_engine(void);
G_MODULE_EXPORT const gchar * g_module_check_init (GModule * module);
G_MODULE_EXPORT void theme_init(GTypeModule * module)
{
- xfce_rc_style_register_type(module);
- xfce_style_register_type(module);
+ xfce_engine_register_types(module);
}
G_MODULE_EXPORT void theme_exit(void)
{
}
-G_MODULE_EXPORT GtkRcStyle *theme_create_rc_style(void)
+G_MODULE_EXPORT GtkThemingEngine *create_engine(void)
{
- void *ptr;
- ptr = GTK_RC_STYLE(g_object_new(XFCE_TYPE_RC_STYLE, NULL));
- return (GtkRcStyle *) ptr;
+ GtkThemingEngine *ptr;
+ ptr = GTK_THEMING_ENGINE(g_object_new(XFCE_TYPE_ENGINE, "name", "xfce", NULL));
+ return ptr;
}
G_MODULE_EXPORT const gchar * g_module_check_init (GModule * module)
diff --git a/gtk-3.0/xfce_typebuiltin.c.template b/gtk-3.0/xfce_typebuiltin.c.template
new file mode 100644
index 0000000..1c5309b
--- /dev/null
+++ b/gtk-3.0/xfce_typebuiltin.c.template
@@ -0,0 +1,38 @@
+/*** BEGIN file-header ***/
+#include <gtk/gtk.h>
+#include "xfce_style_types.h"
+#include "xfce_typebuiltin.h"
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name at _get_type(void)
+{
+ static GType etype = 0;
+ if (G_UNLIKELY(etype == 0))
+ {
+ static const G at Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+ { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+ { 0, NULL, NULL }
+ };
+ etype = g_ at type@_register_static(g_intern_static_string("@EnumName@"), values);
+ }
+ return etype;
+}
+
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+
+/*** END file-tail ***/
+
diff --git a/gtk-3.0/xfce_typebuiltin.h.template b/gtk-3.0/xfce_typebuiltin.h.template
new file mode 100644
index 0000000..b52140b
--- /dev/null
+++ b/gtk-3.0/xfce_typebuiltin.h.template
@@ -0,0 +1,22 @@
+/*** BEGIN file-header ***/
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name at _get_type (void) G_GNUC_CONST;
+#define @ENUMPREFIX at _TYPE_@ENUMSHORT@ (@enum_name at _get_type ())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+
+G_END_DECLS
+/*** END file-tail ***/
+
More information about the Xfce4-commits
mailing list