diff options
author | Andriy Grytsenko <andrej@rep.kiev.ua> | 2013-10-22 01:18:44 +0300 |
---|---|---|
committer | Andriy Grytsenko <andrej@rep.kiev.ua> | 2013-10-22 01:18:44 +0300 |
commit | c9d5ca6424f80e7d6c6e4009cb492863b4e6bd60 (patch) | |
tree | 3e9e3eb556474839933ac43eb7bb3082fad40f8d | |
parent | 06fe6ce9326a1e50e1336cf614a077346f59df2e (diff) |
Make it compilable with both Openbox 3.5.0 and 3.5.2.
Test for AC_CHECK_MEMBER(RrTheme.btn_desk) will detect structure change
so we can use AC_DEFINE and do conditional compilation.
-rw-r--r-- | configure.ac | 7 | ||||
-rw-r--r-- | src/preview.c | 25 |
2 files changed, 32 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 98b4dbc..7f1510b 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,13 @@ PKG_CHECK_MODULES(OPENBOX, [obrender-3.5 >= 3.5 obt-3.5 >= 3.5]) AC_SUBST(OPENBOX_CFLAGS) AC_SUBST(OPENBOX_LIBS) +save_CFLAFS="$CFLAGS" +CFLAGS="$CFLAGS $pkg_cv_OPENBOX_CFLAGS" +AC_CHECK_MEMBER(RrTheme.btn_desk, + AC_DEFINE(HAVE_OPENBOX_3_5_2,[],[Openbox version is 3.5.2]),, + [#include <obrender/theme.h>]) +CFLAGS="$save_CFLAFS" + if test "x$enable_gtk3" = "xyes" ; then CFLAGS="$CFLAGS -DENABLE_GTK3" gtk_modules="gtk+-3.0 >= 3.0.0" diff --git a/src/preview.c b/src/preview.c index fd3a965..b6e3410 100644 --- a/src/preview.c +++ b/src/preview.c @@ -549,28 +549,53 @@ static GdkPixbuf* preview_window(RrTheme *theme, const gchar *titlelayout, switch (*layout) { case 'D': a = focus ? +#ifdef HAVE_OPENBOX_3_5_2 theme->btn_desk->a_focused_unpressed : theme->btn_desk->a_unfocused_unpressed; +#else + theme->a_focused_unpressed_desk : + theme->a_unfocused_unpressed_desk; +#endif break; case 'S': a = focus ? +#ifdef HAVE_OPENBOX_3_5_2 theme->btn_shade->a_focused_unpressed : theme->btn_shade->a_unfocused_unpressed; +#else + theme->a_focused_unpressed_shade : + theme->a_unfocused_unpressed_shade; +#endif break; case 'I': a = focus ? +#ifdef HAVE_OPENBOX_3_5_2 theme->btn_iconify->a_focused_unpressed : theme->btn_iconify->a_unfocused_unpressed; +#else + theme->a_focused_unpressed_iconify : + theme->a_unfocused_unpressed_iconify; +#endif break; case 'M': a = focus ? +#ifdef HAVE_OPENBOX_3_5_2 theme->btn_max->a_focused_unpressed : theme->btn_max->a_unfocused_unpressed; +#else + theme->a_focused_unpressed_max : + theme->a_unfocused_unpressed_max; +#endif break; case 'C': a = focus ? +#ifdef HAVE_OPENBOX_3_5_2 theme->btn_close->a_focused_unpressed : theme->btn_close->a_unfocused_unpressed; +#else + theme->a_focused_unpressed_close : + theme->a_unfocused_unpressed_close; +#endif break; default: continue; |