From acc82b617ddbee05e509392c09e2729bc2fc1911 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 12 Nov 2012 23:51:27 -0600 Subject: [PATCH] Migrate to TDE build system and fix crashes --- Makefile.am | 8 -- config.h.in | 230 +++++++++++++++++++++++++++++----- configure.ac | 132 ------------------- configure.in.in | 153 ++++++++++++++++++++++ tdegtk/Makefile.am | 20 +-- tdegtk/raico-blur.c | 173 ------------------------- tdegtk/raico-blur.h | 67 ---------- tdegtk/tdegtk-cairo-support.c | 72 ----------- tdegtk/tdegtk-draw.cpp | 3 + tdegtk/tdegtk-engine.c | 157 ----------------------- tdegtk/tdegtk-support.c | 2 +- tdegtk/tdegtk-theme.cpp | 27 ++-- tests/Makefile.am | 23 ++-- 13 files changed, 396 insertions(+), 671 deletions(-) delete mode 100644 configure.ac create mode 100644 configure.in.in delete mode 100644 tdegtk/raico-blur.c delete mode 100644 tdegtk/raico-blur.h diff --git a/Makefile.am b/Makefile.am index 571511b..48f5153 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,4 @@ SUBDIRS = \ - build \ tdegtk \ rc \ tests @@ -11,13 +10,6 @@ EXTRA_DIST = autogen.sh COPYING DISTCHECK_CONFIGURE_FLAGS = --disable-scrollkeeper MAINTAINERCLEANFILES = \ - build/compile \ - build/config.guess \ - build/config.sub \ - build/depcomp \ - build/install-sh \ - build/ltmain.sh \ - build/missing \ Makefile.in \ config.h.in \ configure \ diff --git a/config.h.in b/config.h.in index 8939ae1..c3ca294 100644 --- a/config.h.in +++ b/config.h.in @@ -1,14 +1,65 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* Defines if your system has the Cairo library */ +#undef HAVE_CAIRO + +/* Define to 1 if you have the header file. */ +#undef HAVE_CARBON_CARBON_H + +/* Define if you have the CoreAudio API */ +#undef HAVE_COREAUDIO + +/* Define to 1 if you have the header file. */ +#undef HAVE_CRT_EXTERNS_H + +/* Defines if your system has the crypt function */ +#undef HAVE_CRYPT /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H +/* Defines if your system has the GTK3 library */ +#undef HAVE_GTK3 + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define if you have libjpeg */ +#undef HAVE_LIBJPEG + +/* Define if you have libpng */ +#undef HAVE_LIBPNG + +/* Define if you have a working libpthread (will enable threaded code) */ +#undef HAVE_LIBPTHREAD + +/* Define if you have libz */ +#undef HAVE_LIBZ + /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define if your system needs _NSGetEnviron to set up the environment */ +#undef HAVE_NSGETENVIRON + +/* Defines if your system has the Pango library */ +#undef HAVE_PANGO + +/* Define if you have res_init */ +#undef HAVE_RES_INIT + +/* Define if you have the res_init prototype */ +#undef HAVE_RES_INIT_PROTO + +/* Define if you have a STL implementation by SGI */ +#undef HAVE_SGI_STL + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H @@ -21,6 +72,21 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H +/* Define if you have strlcat */ +#undef HAVE_STRLCAT + +/* Define if you have the strlcat prototype */ +#undef HAVE_STRLCAT_PROTO + +/* Define if you have strlcpy */ +#undef HAVE_STRLCPY + +/* Define if you have the strlcpy prototype */ +#undef HAVE_STRLCPY_PROTO + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_BITYPES_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H @@ -30,6 +96,15 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF + +/* Suffix for lib directories */ +#undef KDELIBSUFF + +/* Define a safe value for MAXPATHLEN */ +#undef KDEMAXPATHLEN + /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR @@ -58,49 +133,142 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* The size of `char *', as computed by sizeof. */ +#undef SIZEOF_CHAR_P + +/* The size of `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T + +/* The size of `unsigned long', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_LONG + /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE +/* Version number of package */ +#undef VERSION + +/* Defined if compiling without arts */ +#undef WITHOUT_ARTS + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif #endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE + +/* + * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system + * headers and I'm too lazy to write a configure test as long as only + * unixware is related + */ +#ifdef _UNIXWARE +#define HAVE_BOOLEAN #endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS + + + +/* + * AIX defines FD_SET in terms of bzero, but fails to include + * that defines bzero. + */ + +#if defined(_AIX) +#include #endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE + + + +#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H) +# include +# include +# define environ (*_NSGetEnviron()) +#endif + + + +#if !defined(HAVE_RES_INIT_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +int res_init(void); +#ifdef __cplusplus +} #endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ #endif -/* Version number of package */ -#undef VERSION -/* Define to 1 if on MINIX. */ -#undef _MINIX +#if !defined(HAVE_STRLCAT_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +unsigned long strlcat(char*, const char*, unsigned long); +#ifdef __cplusplus +} +#endif +#endif + -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#undef _POSIX_SOURCE +#if !defined(HAVE_STRLCPY_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +unsigned long strlcpy(char*, const char*, unsigned long); +#ifdef __cplusplus +} +#endif +#endif -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline + +/* + * On HP-UX, the declaration of vsnprintf() is needed every time ! + */ + +#if !defined(HAVE_VSNPRINTF) || defined(hpux) +#if __STDC__ +#include +#include +#else +#include +#endif +#ifdef __cplusplus +extern "C" +#endif +int vsnprintf(char *str, size_t n, char const *fmt, va_list ap); +#ifdef __cplusplus +extern "C" #endif +int snprintf(char *str, size_t n, char const *fmt, ...); +#endif + + + +#if defined(__SVR4) && !defined(__svr4__) +#define __svr4__ 1 +#endif + + +/* type to use in place of socklen_t if not defined */ +#undef kde_socklen_t + +/* type to use in place of socklen_t if not defined (deprecated, use + kde_socklen_t) */ +#undef ksize_t diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 2bee047..0000000 --- a/configure.ac +++ /dev/null @@ -1,132 +0,0 @@ -AC_PREREQ(2.63) - -# Package - -AC_INIT([tdegtk],[1.0.1],[https://bugs.trinitydesktop.org],[tdegtk]) -AC_CONFIG_SRCDIR([tdegtk/tdegtk.h]) -AC_CONFIG_MACRO_DIR([build]) -AC_CONFIG_AUX_DIR([build]) -AC_CONFIG_HEADERS([config.h]) -AM_INIT_AUTOMAKE([1.9 foreign dist-bzip2]) -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -NANO=`echo AC_PACKAGE_VERSION | cut -d'.' -f4` -if test x"$NANO" = x || test "x$NANO" = "x0" ; then - TDEGTK_TRUNK="no" - PACKAGE_VERSION_NANO="0" -else - TDEGTK_TRUNK="yes" - PACKAGE_VERSION_NANO="$NANO" -fi -AC_SUBST(TDEGTK_TRUNK) -AC_SUBST(PACKAGE_VERSION_NANO) - -AC_USE_SYSTEM_EXTENSIONS -AC_PROG_CC -AM_PROG_CC_C_O -AC_PROG_CXX -LT_INIT -AC_C_CONST -AC_C_INLINE - -# Build dependencies - -AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums]) -AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal]) -PKG_PROG_PKG_CONFIG - -AC_SUBST(glib_req, 2.26.0) -AC_SUBST(gtk_req, 3.1.10) -AC_SUBST(cairo_req, 1.10) - -PKG_CHECK_MODULES(DEPS, glib-2.0 >= $glib_req gtk+-3.0 >= $gtk_req cairo >= $cairo_req) -AC_SUBST(DEPS_CFLAGS) -AC_SUBST(DEPS_LIBS) - -# Debug flags - -if test x$TDEGTK_TRUNK = xyes; then - DEFAULT_DEBUG="yes" -else - DEFAULT_DEBUG="no" -fi -AC_SUBST(DEFAULT_DEBUG) -AC_ARG_ENABLE([debug], - [AS_HELP_STRING([--enable-debug=@<:@no/yes/full@:>@],[Control debug level @<:@default=debug_default@:>@])], - [], [enable_debug=$DEFAULT_DEBUG]) -AS_CASE([$enable_debug], - [yes], - [ - test "$cflags_set" = set || CFLAGS="$CFLAGS -g" - DEBUG_CFLAGS="-D_DEBUG" - ], - [no], - [DEBUG_CFLAGS="-DNDEBUG"], - [AC_MSG_ERROR([Unknown argument for --enable-debug])] -) -AC_SUBST(DEBUG_CFLAGS) - -# Maintainer flags - -if test x$TDEGTK_TRUNK = xyes; then - DEFAULT_MAINTAINER_FLAGS="yes" -else - DEFAULT_MAINTAINER_FLAGS="no" -fi -AC_SUBST(DEFAULT_MAINTAINER_FLAGS) -AC_ARG_ENABLE([maintainer-flags], - [AS_HELP_STRING([--enable-maintainer-flags=@<:@no/yes@:>@],[Use strict compiler flags @<:@default=maintainer_flags_default@:>@])], - [], - [enable_maintainer_flags=$DEFAULT_MAINTAINER_FLAGS]) -AS_IF([test "x$enable_maintainer_flags" = "xyes" && test "x$GCC" = "xyes"], - [ - AS_COMPILER_FLAGS([MAINTAINER_CFLAGS], - ["-fno-common -Wall -Wextra -Werror -Wempty-body - -Wno-missing-field-initializers -Wstrict-aliasing=2 - -Wno-unused-parameter -Wdeclaration-after-statement - -Wpointer-arith -Wcast-align -Wwrite-strings - -Wformat-security -Wformat-nonliteral -Winit-self - -Wmissing-declarations -Wnested-externs -Wundef - -Wold-style-definition -Wswitch-default - -Wredundant-decls"]) - ] -) -AC_SUBST(MAINTAINER_CFLAGS) - -# Variables - -TDEGTK_LIBADD="\$(DEPS_LIBS)" -AC_SUBST(TDEGTK_LIBADD) - -TDEGTK_CFLAGS="-I\$(top_srcdir) -DTDEGTK_COMPILATION \$(DEPS_CFLAGS) \$(DEBUG_CFLAGS) \$(MAINTAINER_CFLAGS)" -AC_SUBST(TDEGTK_CFLAGS) - -TDEGTK_LDFLAGS="-module -avoid-version -no-undefined" -AC_SUBST(TDEGTK_LDFLAGS) - -GTK_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0` -AC_SUBST(GTK_VERSION) - -# Files - -AC_CONFIG_FILES([ -Makefile -build/Makefile -po/Makefile -tdegtk/Makefile -tests/Makefile -rc/Makefile -]) -AC_OUTPUT - -# Summary - -echo "" -echo " tdegtk $PACKAGE_VERSION" -echo " =========================" -echo "" -echo " Debug: ${enable_debug}" -echo " Prefix: ${prefix}" -echo "" -echo " Compiler flags: ${CPPFLAGS} ${DEBUG_CFLAGS} ${MAINTAINER_CFLAGS}" -echo "" diff --git a/configure.in.in b/configure.in.in new file mode 100644 index 0000000..3b3d2d2 --- /dev/null +++ b/configure.in.in @@ -0,0 +1,153 @@ +#MIN_CONFIG(3.2.0) + +AM_INIT_AUTOMAKE(tdegtk3, 0.1) +AC_C_BIGENDIAN +AC_CHECK_KDEMAXPATHLEN + +# C support +AM_PROG_CC_C_O + +# --- Cairo check --- + +KDE_FIND_PATH(pkg-config, PKGCONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/bin /usr/local/bin /opt/local/bin], [ + AC_MSG_WARN([Could not find pkg-config]) +]) + +AC_MSG_CHECKING([for Cairo]) + +if test -n "$PKGCONFIG"; then + vers=`$PKGCONFIG cairo --modversion 2>/dev/null` + if test -n "$vers" + then + CAIRO_LIBS="`$PKGCONFIG cairo --libs`" + CAIRO_RPATH= + for args in $CAIRO_LIBS; do + case $args in + -L*) + CAIRO_RPATH="$CAIRO_RPATH $args" + ;; + esac + done + CAIRO_RPATH=`echo $CAIRO_RPATH | $SED -e "s/-L/-R/g"` + CAIRO_CFLAGS="`$PKGCONFIG cairo --cflags`" + + AC_DEFINE_UNQUOTED(HAVE_CAIRO, 1, [Defines if your system has the Cairo library]) + fi +fi + +if test ! "$USE_RPATH" = "yes"; then + CAIRO_RPATH= +fi + +if test -n "$CAIRO_LIBS" +then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([not found]) +fi + +AC_SUBST(CAIRO_LIBS) +AC_SUBST(CAIRO_CFLAGS) +AC_SUBST(CAIRO_RPATH) + +AM_CONDITIONAL(have_openexr, test -n "$CAIRO_LIBS") + +# --- End of Cairo check --- + +# --- GTK3 check --- + +KDE_FIND_PATH(pkg-config, PKGCONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/bin /usr/local/bin /opt/local/bin], [ + AC_MSG_WARN([Could not find pkg-config]) +]) + +AC_MSG_CHECKING([for GTK3]) + +if test -n "$PKGCONFIG"; then + vers=`$PKGCONFIG gtk+-3.0 --modversion 2>/dev/null` + if test -n "$vers" + then + GTK3_LIBS="`$PKGCONFIG gtk+-3.0 --libs`" + GTK3_RPATH= + for args in $GTK3_LIBS; do + case $args in + -L*) + GTK3_RPATH="$GTK3_RPATH $args" + ;; + esac + done + GTK3_RPATH=`echo $GTK3_RPATH | $SED -e "s/-L/-R/g"` + GTK3_CFLAGS="`$PKGCONFIG gtk+-3.0 --cflags`" + GTK3_PREFIX=`$PKG_CONFIG --variable=prefix gtk+-3.0` + GTK3_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0` + + AC_DEFINE_UNQUOTED(HAVE_GTK3, 1, [Defines if your system has the GTK3 library]) + fi +fi + +if test ! "$USE_RPATH" = "yes"; then + GTK3_RPATH= +fi + +if test -n "$GTK3_LIBS" +then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([not found]) +fi + +AC_SUBST(GTK3_LIBS) +AC_SUBST(GTK3_CFLAGS) +AC_SUBST(GTK3_RPATH) +AC_SUBST(GTK3_PREFIX) +AC_SUBST(GTK3_VERSION) + +AM_CONDITIONAL(have_openexr, test -n "$GTK3_LIBS") + +# --- End of GTK3 check --- + +# --- Pango check --- + +KDE_FIND_PATH(pkg-config, PKGCONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/bin /usr/local/bin /opt/local/bin], [ + AC_MSG_WARN([Could not find pkg-config]) +]) + +AC_MSG_CHECKING([for Pango]) + +if test -n "$PKGCONFIG"; then + vers=`$PKGCONFIG pango --modversion 2>/dev/null` + if test -n "$vers" + then + PANGO_LIBS="`$PKGCONFIG pango --libs`" + PANGO_RPATH= + for args in $PANGO_LIBS; do + case $args in + -L*) + PANGO_RPATH="$PANGO_RPATH $args" + ;; + esac + done + PANGO_RPATH=`echo $PANGO_RPATH | $SED -e "s/-L/-R/g"` + PANGO_CFLAGS="`$PKGCONFIG pango --cflags`" + + AC_DEFINE_UNQUOTED(HAVE_PANGO, 1, [Defines if your system has the Pango library]) + fi +fi + +if test ! "$USE_RPATH" = "yes"; then + PANGO_RPATH= +fi + +if test -n "$PANGO_LIBS" +then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([not found]) +fi + +AC_SUBST(PANGO_LIBS) +AC_SUBST(PANGO_CFLAGS) +AC_SUBST(PANGO_RPATH) + +AM_CONDITIONAL(have_openexr, test -n "$PANGO_LIBS") + +# --- End of Pango check --- 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 - * - */ - -#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 - * - */ - -#ifndef _RAICO_BLUR_H -#define _RAICO_BLUR_H - -#include -#include - -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 #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) { diff --git a/tests/Makefile.am b/tests/Makefile.am index d5874ad..93f4eee 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,3 +1,5 @@ +INCLUDES= $(all_includes) $(KDE_INCLUDES)/tde + EXTRA_DIST = \ test-widgets.glade @@ -7,26 +9,31 @@ noinst_PROGRAMS = \ test_widgets_CFLAGS = \ -I$(top_srcdir) \ - $(TDEGTK_CFLAGS) + $(TDEGTK_CFLAGS) \ + $(CAIRO_CFLAGS) \ + $(GTK3_CFLAGS) test_widgets_LDADD = \ $(TDEGTK_LIBADD) test_widgets_LDFLAGS = \ - $(TDEGTK_LDFLAGS) + $(TDEGTK_LDFLAGS) \ + $(CAIRO_LIBS) \ + $(GTK3_LIBS) test_painter_SOURCES = test-painter.cpp test_painter_CXXFLAGS = \ -I$(top_srcdir) \ -I$(top_srcdir)/tdegtk \ - -I/usr/include/tqt -I/usr/include/tqt3 \ - $(TDEGTK_CFLAGS) + $(TDEGTK_CFLAGS) \ + $(CAIRO_CFLAGS) \ + $(GTK3_CFLAGS) test_painter_LDADD = \ - $(TDEGTK_LIBADD) ../tdegtk/libtqtcairo.la -ltqt -ltqt-mt + $(TDEGTK_LIBADD) ../tdegtk/libtqtcairo.la $(all_libraries) $(CAIRO_LIBS) $(GTK3_LIBS) $(LIB_QT) test_painter_LDFLAGS = \ - $(TDEGTK_LDFLAGS) - -# FIXME(Cimi): Figure out what tests must be compiled and add them here. + $(TDEGTK_LDFLAGS) \ + $(CAIRO_LIBS) \ + $(GTK3_LIBS)