Using autotools to support pre- and post-3.4 Gtk+ themes
In Gtk+ 3.4, the CSS themes were changed to require px
to be used on size-based values, while before that you do not specify units.
To handle this, you can check if px
is required by using:
AC_MSG_CHECKING([if GTK+ CSS themes need an explicit px unit specifier])
PKG_CHECK_EXISTS([gtk+-3.0 >= 3.4.0],
[AC_MSG_RESULT([yes])
AC_SUBST(GTK_PX, [px])],
[AC_MSG_RESULT([no])
AC_SUBST(GTK_PX, [])])
You then need to rename your styles.css
to styles.css.in
and add styles.css
to your AC_CONFIG_FILES
, e.g.:
AC_CONFIG_FILES([
Makefile
styles.css
])
All the areas where you need to specify px
, replace with @GTK_PX@
, e.g.:
GtkNotebook {
border-width: 1@GTK_PX@ 0 1@GTK_PX@ 0;
}
Now, whenever you run ./configure
, you will have a styles.css
that will work on the different versions of Gtk+.
Written by Reece Dunn
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Gtk3
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#