diff options
Diffstat (limited to 'tdegtk')
-rw-r--r-- | tdegtk/Makefile.am | 20 | ||||
-rw-r--r-- | tdegtk/raico-blur.c | 173 | ||||
-rw-r--r-- | tdegtk/raico-blur.h | 67 | ||||
-rw-r--r-- | tdegtk/tdegtk-cairo-support.c | 72 | ||||
-rw-r--r-- | tdegtk/tdegtk-draw.cpp | 3 | ||||
-rw-r--r-- | tdegtk/tdegtk-engine.c | 157 | ||||
-rw-r--r-- | tdegtk/tdegtk-support.c | 2 | ||||
-rw-r--r-- | tdegtk/tdegtk-theme.cpp | 27 |
8 files changed, 29 insertions, 492 deletions
diff --git a/tdegtk/Makefile.am b/tdegtk/Makefile.am index 4d18449..3f92391 100644 --- a/tdegtk/Makefile.am +++ b/tdegtk/Makefile.am @@ -1,8 +1,9 @@ +INCLUDES= $(all_includes) $(KDE_INCLUDES)/tde + source_h = \ $(srcdir)/tdegtk.h \ $(srcdir)/exponential-blur.h \ $(srcdir)/gtkroundedboxprivate.h \ - $(srcdir)/raico-blur.h \ $(srcdir)/tdegtk-cairo-support.h \ $(srcdir)/tdegtk-draw.h \ $(srcdir)/tdegtk-engine.h \ @@ -22,7 +23,6 @@ source_h = \ source_c = \ $(srcdir)/exponential-blur.c \ $(srcdir)/gtkroundedbox.c \ - $(srcdir)/raico-blur.c \ $(srcdir)/tdegtk-cairo-support.c \ $(srcdir)/tdegtk-draw.cpp \ $(srcdir)/tdegtk-engine.c \ @@ -36,25 +36,25 @@ source_c = \ $(srcdir)/tdegtk-baseengine.cpp \ $(srcdir)/tdegtk-theme.cpp -enginedir = $(libdir)/gtk-3.0/$(GTK_VERSION)/theming-engines +enginedir = $(GTK3_PREFIX)/lib/gtk-3.0/$(GTK3_VERSION)/theming-engines engine_LTLIBRARIES = libtdegtk.la libtdegtk_la_SOURCES = $(source_h) $(source_c) -libtdegtk_la_CFLAGS = $(TDEGTK_CFLAGS) -libtdegtk_la_CXXFLAGS = $(TDEGTK_CXXFLAGS) -I/usr/include/tqt -I/usr/include/tqt3 -I/opt/trinity/include $(TDEGTK_CFLAGS) +libtdegtk_la_CFLAGS = $(TDEGTK_CFLAGS) $(CAIRO_CFLAGS) $(GTK3_CFLAGS) +libtdegtk_la_CXXFLAGS = $(TDEGTK_CXXFLAGS) $(TDEGTK_CFLAGS) $(CAIRO_CFLAGS) $(GTK3_CFLAGS) -libtdegtk_la_LIBADD = $(TDEGTK_LIBADD) libtqtcairo.la -ltqt -ltqt-mt -L/opt/trinity/lib -ltdecore +libtdegtk_la_LIBADD = $(TDEGTK_LIBADD) libtqtcairo.la $(all_libraries) $(CAIRO_LIBS) $(GTK3_LIBS) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) -libtdegtk_la_LDFLAGS = $(TDEGTK_LDFLAGS) +libtdegtk_la_LDFLAGS = $(TDEGTK_LDFLAGS) $(CAIRO_LIBS) $(GTK3_LIBS) lib_LTLIBRARIES = libtqtcairo.la libtqtcairo_la_SOURCES = tqtcairopainter.h tqtcairopainter.cpp -libtqtcairo_la_CFLAGS = $(TDEGTK_CFLAGS) -libtqtcairo_la_CXXFLAGS = $(TDEGTK_CXXFLAGS) -I/usr/include/tqt -I/usr/include/tqt3 $(TDEGTK_CFLAGS) +libtqtcairo_la_CFLAGS = $(TDEGTK_CFLAGS) $(CAIRO_CFLAGS) $(GTK3_CFLAGS) +libtqtcairo_la_CXXFLAGS = $(TDEGTK_CXXFLAGS) $(TDEGTK_CFLAGS) $(CAIRO_CFLAGS) $(GTK3_CFLAGS) libtqtcairo_la_LIBADD = $(TDEGTK_LIBADD) -libtqtcairo_la_LDFLAGS = $(TDEGTK_LDFLAGS) +libtqtcairo_la_LDFLAGS = $(TDEGTK_LDFLAGS) $(CAIRO_LIBS) $(GTK3_LIBS) diff --git a/tdegtk/raico-blur.c b/tdegtk/raico-blur.c deleted file mode 100644 index 3330ae2..0000000 --- a/tdegtk/raico-blur.c +++ /dev/null @@ -1,173 +0,0 @@ -/* The TdeGtk Theming Engine for Gtk+. - * Copyright (C) 2009 Canonical Ltd - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301, USA. - * - * Authored by Mirco "MacSlow" Mueller <mirco.mueller@canonical.com> - * - */ - -#include "exponential-blur.h" -#include "raico-blur.h" - -struct _raico_blur_private_t -{ - raico_blur_quality_t quality; /* low, medium, high */ - guint radius; /* blur-radius */ -}; - -raico_blur_t* -raico_blur_create (void) -{ - raico_blur_t* blur = NULL; - raico_blur_private_t* priv = NULL; - - blur = g_new0 (raico_blur_t, 1); - if (!blur) - { - g_debug ("raico_blur_create(): could not allocate blur struct"); - return NULL; - } - - priv = g_new0 (raico_blur_private_t, 1); - if (!priv) - { - g_debug ("raico_blur_create(): could not allocate priv struct"); - g_free ((gpointer) blur); - return NULL; - } - - priv->quality = RAICO_BLUR_QUALITY_LOW; - - priv->radius = 0; - - blur->priv = priv; - - return blur; -} - -raico_blur_quality_t -raico_blur_get_quality (raico_blur_t* blur) -{ - g_assert (blur != NULL); - - return blur->priv->quality; -} - -void -raico_blur_set_quality (raico_blur_t* blur, - raico_blur_quality_t quality) -{ - if (!blur) - { - g_debug ("raico_blur_set_quality(): NULL blur-pointer passed"); - return; - } - - blur->priv->quality = quality; -} - -guint -raico_blur_get_radius (raico_blur_t* blur) -{ - g_assert (blur != NULL); - - return blur->priv->radius; -} - -void -raico_blur_set_radius (raico_blur_t* blur, - guint radius) -{ - if (!blur) - { - g_debug ("raico_blur_set_radius(): NULL blur-pointer passed"); - return; - } - - blur->priv->radius = radius; -} - -void -raico_blur_apply (raico_blur_t* blur, - cairo_surface_t* surface) -{ - cairo_format_t format; - - /* sanity checks */ - if (!blur) - { - g_debug ("raico_blur_apply(): NULL blur-pointer passed"); - return; - } - - if (!surface) - { - g_debug ("raico_blur_apply(): NULL surface-pointer passed"); - return; - } - - if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS) - { - g_debug ("raico_blur_apply(): invalid surface status"); - return; - } - - if (cairo_surface_get_type (surface) != CAIRO_SURFACE_TYPE_IMAGE) - { - g_debug ("raico_blur_apply(): non-image surface passed"); - return; - } - - format = cairo_image_surface_get_format (surface); - if (format != CAIRO_FORMAT_A8 && - format != CAIRO_FORMAT_RGB24 && - format != CAIRO_FORMAT_ARGB32) - { - g_debug ("raico_blur_apply(): unsupported image-format"); - return; - } - - /* stupid, but you never know */ - if (blur->priv->radius == 0) - return; - - /* now do the real work */ - switch (blur->priv->quality) - { - default: - case RAICO_BLUR_QUALITY_HIGH: - case RAICO_BLUR_QUALITY_MEDIUM: - /* Not implemented yet */ - //surface_gaussian_blur (surface, blur->priv->radius); - case RAICO_BLUR_QUALITY_LOW: - surface_exponential_blur (surface, blur->priv->radius); - break; - } -} - -void -raico_blur_destroy (raico_blur_t* blur) -{ - if (!blur) - { - g_debug ("raico_blur_destroy(): invalid blur-pointer passed"); - return; - } - - g_free ((gpointer) blur->priv); - g_free ((gpointer) blur); -} diff --git a/tdegtk/raico-blur.h b/tdegtk/raico-blur.h deleted file mode 100644 index 1d562b9..0000000 --- a/tdegtk/raico-blur.h +++ /dev/null @@ -1,67 +0,0 @@ -/* The TdeGtk Theming Engine for Gtk+. - * Copyright (C) 2009 Canonical Ltd - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301, USA. - * - * Authored by Mirco "MacSlow" Mueller <mirco.mueller@canonical.com> - * - */ - -#ifndef _RAICO_BLUR_H -#define _RAICO_BLUR_H - -#include <cairo.h> -#include <glib.h> - -typedef enum _raico_blur_quality_t -{ - RAICO_BLUR_QUALITY_LOW = 0, /* low quality, but fast, maybe interactive */ - RAICO_BLUR_QUALITY_MEDIUM, /* compromise between speed and quality */ - RAICO_BLUR_QUALITY_HIGH /* quality before speed */ -} raico_blur_quality_t; - -typedef struct _raico_blur_private_t raico_blur_private_t; - -typedef struct _raico_blur_t -{ - raico_blur_private_t* priv; -} raico_blur_t; - -raico_blur_t* -raico_blur_create (void); - -raico_blur_quality_t -raico_blur_get_quality (raico_blur_t* blur); - -void -raico_blur_set_quality (raico_blur_t* blur, - raico_blur_quality_t quality); - -guint -raico_blur_get_radius (raico_blur_t* blur); - -void -raico_blur_set_radius (raico_blur_t* blur, - guint radius); - -void -raico_blur_apply (raico_blur_t* blur, - cairo_surface_t* surface); - -void -raico_blur_destroy (raico_blur_t* blur); - -#endif /* _RAICO_BLUR_H */ diff --git a/tdegtk/tdegtk-cairo-support.c b/tdegtk/tdegtk-cairo-support.c index 8b3a1d5..f591754 100644 --- a/tdegtk/tdegtk-cairo-support.c +++ b/tdegtk/tdegtk-cairo-support.c @@ -24,7 +24,6 @@ #include <gtk/gtk.h> #include "gtkroundedboxprivate.h" -#include "raico-blur.h" #include "tdegtk-cairo-support.h" #include "tdegtk-support.h" #include "tdegtk-types.h" @@ -332,76 +331,6 @@ draw_glow (GtkThemingEngine *engine, guint hidden_side, GtkJunctionSides junction) { - GdkRGBA *glow_color; - GtkBorder border; - GtkRoundedBox border_box, padding_box; - GtkStateFlags state; - cairo_t *cr_surface; - cairo_surface_t *surface; - gint bradius = 0; - raico_blur_t* blur = NULL; - - state = gtk_theming_engine_get_state (engine); - - gtk_theming_engine_get (engine, state, - "-tdegtk-glow-radius", &bradius, - "-tdegtk-glow-color", &glow_color, - NULL); - - if (bradius <= 0) - goto end_draw_glow; - - gtk_theming_engine_get_border (engine, state, &border); - - hide_border_sides (&border, hidden_side); - - cairo_save (cr); - - cairo_translate (cr, x, y); - - /* create the path to clip */ - _gtk_rounded_box_init_rect (&border_box, 0, 0, width, height); - _gtk_rounded_box_apply_border_radius (&border_box, engine, state, junction); - _gtk_rounded_box_shrink (&border_box, border.top, border.right, border.bottom, border.left); - _gtk_rounded_box_path (&border_box, cr); - - cairo_clip (cr); - - /* create the surface to blur */ - surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, - width + bradius * 2, - height + bradius * 2); - cr_surface = cairo_create (surface); - - /* create the path on the surface to blur */ - _gtk_rounded_box_move (&border_box, bradius, bradius); - padding_box = border_box; - _gtk_rounded_box_shrink (&padding_box, border.top * 2, border.right * 2, border.bottom * 2, border.left * 2); - - cairo_set_fill_rule (cr_surface, CAIRO_FILL_RULE_EVEN_ODD); - - gdk_cairo_set_source_rgba (cr_surface, glow_color); - - _gtk_rounded_box_path (&border_box, cr_surface); - _gtk_rounded_box_path (&padding_box, cr_surface); - cairo_fill (cr_surface); - - /* create and apply raico blur */ - blur = raico_blur_create (); - raico_blur_set_radius (blur, bradius); - raico_blur_apply (blur, surface); - - /* paint the blurred surface to cr */ - cairo_set_source_surface (cr, surface, - bradius, - bradius); - cairo_paint (cr); - - cairo_restore (cr); - - cairo_surface_destroy (surface); - cairo_destroy (cr_surface); - -end_draw_glow: - gdk_rgba_free (glow_color); } /* draw a repeated texture */ @@ -1364,7 +1293,6 @@ tdegtk_cairo_set_source_border (GtkThemingEngine *engine, gtk_theming_engine_get (engine, state, "border-style", &border_style, - "-tdegtk-border-gradient", &border_pat, NULL); gtk_theming_engine_get_border_color (engine, state, &border_color); diff --git a/tdegtk/tdegtk-draw.cpp b/tdegtk/tdegtk-draw.cpp index 71d704a..d3bec4f 100644 --- a/tdegtk/tdegtk-draw.cpp +++ b/tdegtk/tdegtk-draw.cpp @@ -2196,6 +2196,9 @@ tdegtk_draw_line (GtkThemingEngine *engine, gdouble x1, gdouble y1) { + // FIXME + // This should be using TQt to draw the line with an appropriate line color from the current widget type palette + // line endings if (y0 == y1) { y0 += 0.5; diff --git a/tdegtk/tdegtk-engine.c b/tdegtk/tdegtk-engine.c index fbf07a8..9619b9e 100644 --- a/tdegtk/tdegtk-engine.c +++ b/tdegtk/tdegtk-engine.c @@ -348,163 +348,6 @@ tdegtk_engine_class_init (TdeGtkEngineClass *klass) engine_class->render_line = tdegtk_engine_render_line; engine_class->render_option = tdegtk_engine_render_option; engine_class->render_slider = tdegtk_engine_render_slider; - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("background-texture", - "Background texture", - "Background texture", - CAIRO_GOBJECT_TYPE_PATTERN, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("border-gradient", - "Border gradient", - "Border gradient", - CAIRO_GOBJECT_TYPE_PATTERN, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("bullet-color", - "Bullet color", - "Bullet color", - GDK_TYPE_RGBA, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("bullet-outline-color", - "Bullet outline color", - "Bullet outline color", - GDK_TYPE_RGBA, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("centroid-texture", - "Centroid texture", - "Centroid texture", - CAIRO_GOBJECT_TYPE_PATTERN, 0)); - - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("focus-border-color", - "Focus border color", - "Focus border color", - GDK_TYPE_RGBA, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_int ("focus-border-radius", - "Focus border radius", - "Focus border radius", - 0, G_MAXINT, 0, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("focus-fill-color", - "Focus fill color", - "Focus fill color", - GDK_TYPE_RGBA, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("focus-outer-stroke-color", - "Focus outer stroke color", - "Focus outer stroke color", - GDK_TYPE_RGBA, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_int ("glow-radius", - "Glow radius", - "Glow radius", - 0, G_MAXINT, 0, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("glow-color", - "Glow color", - "Glow color", - GDK_TYPE_RGBA, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("inner-stroke-color", - "Inner stroke color", - "Inner stroke color", - GDK_TYPE_RGBA, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("inner-stroke-top-color", - "Inner stroke top color", - "Inner stroke top color", - GDK_TYPE_RGBA, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("inner-stroke-right-color", - "Inner stroke right color", - "Inner stroke right color", - GDK_TYPE_RGBA, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("inner-stroke-bottom-color", - "Inner stroke bottom color", - "Inner stroke bottom color", - GDK_TYPE_RGBA, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("inner-stroke-left-color", - "Inner stroke left color", - "Inner stroke left color", - GDK_TYPE_RGBA, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("inner-stroke-gradient", - "Inner stroke gradient", - "Inner stroke gradient", - CAIRO_GOBJECT_TYPE_PATTERN, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("inner-stroke-width", - "Inner stroke width", - "Inner stroke width", - GTK_TYPE_BORDER, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("outer-stroke-color", - "Outer stroke color", - "Outer stroke color", - GDK_TYPE_RGBA, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("outer-stroke-top-color", - "Outer stroke top color", - "Outer stroke top color", - GDK_TYPE_RGBA, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("outer-stroke-right-color", - "Outer stroke right color", - "Outer stroke right color", - GDK_TYPE_RGBA, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("outer-stroke-bottom-color", - "Outer stroke bottom color", - "Outer stroke bottom color", - GDK_TYPE_RGBA, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("outer-stroke-left-color", - "Outer stroke left color", - "Outer stroke left color", - GDK_TYPE_RGBA, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("outer-stroke-gradient", - "Outer stroke gradient", - "Outer stroke gradient", - CAIRO_GOBJECT_TYPE_PATTERN, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("outer-stroke-width", - "Outer stroke width", - "Outer stroke width", - GTK_TYPE_BORDER, 0)); - - gtk_theming_engine_register_property (TDEGTK_NAMESPACE, NULL, - g_param_spec_boxed ("text-shadow-color", - "Text shadow color", - "Text shadow color", - GDK_TYPE_RGBA, 0)); } static void diff --git a/tdegtk/tdegtk-support.c b/tdegtk/tdegtk-support.c index 431769e..f2c0492 100644 --- a/tdegtk/tdegtk-support.c +++ b/tdegtk/tdegtk-support.c @@ -76,5 +76,5 @@ tdegtk_trim_scale_allocation (GtkThemingEngine *engine, gdouble *width, gdouble *height) { - // Do nothing! + /* Do nothing! */ } diff --git a/tdegtk/tdegtk-theme.cpp b/tdegtk/tdegtk-theme.cpp index e214844..118b173 100644 --- a/tdegtk/tdegtk-theme.cpp +++ b/tdegtk/tdegtk-theme.cpp @@ -142,15 +142,12 @@ G_MODULE_EXPORT GtkThemingEngine* create_engine(void) { icon_sizes.push_back(std::make_pair("gtk-dialog", IconSize(KIcon::Small))); icon_sizes.push_back(std::make_pair("", IconSize(KIcon::Small))); - // FIXME - // GTK3 crashes if false is passed to writeGtkThemeControlFile - // Figure out why! -// if (gtk3TQtDebug) { + if (gtk3TQtDebug) { writeGtkThemeControlFile(true); -// } -// else { -// writeGtkThemeControlFile(false); -// } + } + else { + writeGtkThemeControlFile(false); + } // Initialize hooks m_widgetLookup.initializeHooks(); @@ -272,17 +269,23 @@ void gtk3_tqt_load_resource_string(const char* css_string) { void gtk3_tqt_reload_theme_definition_file(const char* filename) { GtkCssProvider *provider; - GError *error; + GError *error = NULL; provider = gtk_css_provider_new(); GdkDisplay *display = gdk_display_get_default(); GdkScreen *screen = gdk_display_get_default_screen(display); gtk_style_context_add_provider_for_screen(screen, GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - g_object_unref(provider); if (!gtk_css_provider_load_from_path(provider, filename, &error)) { - g_printerr("%s: error parsing %s: %s\n", G_STRFUNC, filename, error->message); - g_clear_error(&error); + if (error) { + g_printerr("[ERROR] %s: error parsing %s: %s\n", G_STRFUNC, filename, error->message); + g_clear_error(&error); + } + else { + g_printerr("[ERROR] %s: unknown failure parsing %s\n\r", G_STRFUNC, filename); fflush(stdout); + } } + + g_object_unref(provider); } TQString tdeFontToGTKFontString(TQFont font) { |