Allow using versions of libnotify < 0.7 in wxGTK.

libnotify 0.4.5 included in Ubuntu Lucid (10.04) can be used for implementing
wxNotificationMessage too, there is only a minor difference with 0.7 API. So
while we stick check for 0.7 initially, accept lower versions too if 0.7 is
not available.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72456 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2012-09-09 13:36:43 +00:00
parent 82213cb04e
commit 2eb92b0da8
4 changed files with 180 additions and 11 deletions

161
configure vendored
View File

@ -34032,6 +34032,7 @@ fi
if test "$wxUSE_NOTIFICATION_MESSAGE" = "yes" ; then
if test "$wxUSE_LIBNOTIFY" = "yes" ; then
HAVE_LIBNOTIFY=0
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBNOTIFY" >&5
@ -34092,15 +34093,157 @@ fi
echo "$LIBNOTIFY_PKG_ERRORS" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&5
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBNOTIFY" >&5
$as_echo_n "checking for LIBNOTIFY... " >&6; }
if test -n "$PKG_CONFIG"; then
if test -n "$LIBNOTIFY_CFLAGS"; then
pkg_cv_LIBNOTIFY_CFLAGS="$LIBNOTIFY_CFLAGS"
else
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnotify >= 0.4\""; } >&5
($PKG_CONFIG --exists --print-errors "libnotify >= 0.4") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBNOTIFY_CFLAGS=`$PKG_CONFIG --cflags "libnotify >= 0.4" 2>/dev/null`
else
pkg_failed=yes
fi
fi
else
pkg_failed=untried
fi
if test -n "$PKG_CONFIG"; then
if test -n "$LIBNOTIFY_LIBS"; then
pkg_cv_LIBNOTIFY_LIBS="$LIBNOTIFY_LIBS"
else
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnotify >= 0.4\""; } >&5
($PKG_CONFIG --exists --print-errors "libnotify >= 0.4") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBNOTIFY_LIBS=`$PKG_CONFIG --libs "libnotify >= 0.4" 2>/dev/null`
else
pkg_failed=yes
fi
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
LIBNOTIFY_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libnotify >= 0.4"`
else
LIBNOTIFY_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libnotify >= 0.4"`
fi
# Put the nasty error message in config.log where it belongs
echo "$LIBNOTIFY_PKG_ERRORS" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&5
$as_echo "$as_me: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&2;}
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&5
$as_echo "$as_me: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&2;}
else
LIBNOTIFY_CFLAGS=$pkg_cv_LIBNOTIFY_CFLAGS
LIBNOTIFY_LIBS=$pkg_cv_LIBNOTIFY_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
HAVE_LIBNOTIFY=1
fi
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&5
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBNOTIFY" >&5
$as_echo_n "checking for LIBNOTIFY... " >&6; }
if test -n "$PKG_CONFIG"; then
if test -n "$LIBNOTIFY_CFLAGS"; then
pkg_cv_LIBNOTIFY_CFLAGS="$LIBNOTIFY_CFLAGS"
else
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnotify >= 0.4\""; } >&5
($PKG_CONFIG --exists --print-errors "libnotify >= 0.4") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBNOTIFY_CFLAGS=`$PKG_CONFIG --cflags "libnotify >= 0.4" 2>/dev/null`
else
pkg_failed=yes
fi
fi
else
pkg_failed=untried
fi
if test -n "$PKG_CONFIG"; then
if test -n "$LIBNOTIFY_LIBS"; then
pkg_cv_LIBNOTIFY_LIBS="$LIBNOTIFY_LIBS"
else
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnotify >= 0.4\""; } >&5
($PKG_CONFIG --exists --print-errors "libnotify >= 0.4") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBNOTIFY_LIBS=`$PKG_CONFIG --libs "libnotify >= 0.4" 2>/dev/null`
else
pkg_failed=yes
fi
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
LIBNOTIFY_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libnotify >= 0.4"`
else
LIBNOTIFY_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libnotify >= 0.4"`
fi
# Put the nasty error message in config.log where it belongs
echo "$LIBNOTIFY_PKG_ERRORS" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&5
$as_echo "$as_me: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&2;}
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&5
$as_echo "$as_me: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&2;}
else
LIBNOTIFY_CFLAGS=$pkg_cv_LIBNOTIFY_CFLAGS
LIBNOTIFY_LIBS=$pkg_cv_LIBNOTIFY_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
HAVE_LIBNOTIFY=1
fi
else
LIBNOTIFY_CFLAGS=$pkg_cv_LIBNOTIFY_CFLAGS
@ -34108,13 +34251,19 @@ else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
GUI_TK_LIBRARY="$GUI_TK_LIBRARY $LIBNOTIFY_LIBS"
CFLAGS="$LIBNOTIFY_CFLAGS $CFLAGS"
CXXFLAGS="$LIBNOTIFY_CFLAGS $CXXFLAGS"
$as_echo "#define wxUSE_LIBNOTIFY 1" >>confdefs.h
HAVE_LIBNOTIFY=1
$as_echo "#define wxUSE_LIBNOTIFY_0_7 1" >>confdefs.h
fi
if test "$HAVE_LIBNOTIFY" = "1" ; then
GUI_TK_LIBRARY="$GUI_TK_LIBRARY $LIBNOTIFY_LIBS"
CFLAGS="$LIBNOTIFY_CFLAGS $CFLAGS"
CXXFLAGS="$LIBNOTIFY_CFLAGS $CXXFLAGS"
$as_echo "#define wxUSE_LIBNOTIFY 1" >>confdefs.h
fi
fi
fi

View File

@ -5668,17 +5668,26 @@ if test "$WXGTK2" = 1; then
if test "$wxUSE_NOTIFICATION_MESSAGE" = "yes" ; then
if test "$wxUSE_LIBNOTIFY" = "yes" ; then
HAVE_LIBNOTIFY=0
PKG_CHECK_MODULES(LIBNOTIFY, [libnotify >= 0.7],
[
GUI_TK_LIBRARY="$GUI_TK_LIBRARY $LIBNOTIFY_LIBS"
CFLAGS="$LIBNOTIFY_CFLAGS $CFLAGS"
CXXFLAGS="$LIBNOTIFY_CFLAGS $CXXFLAGS"
AC_DEFINE(wxUSE_LIBNOTIFY)
HAVE_LIBNOTIFY=1
AC_DEFINE(wxUSE_LIBNOTIFY_0_7)
],
[
AC_MSG_WARN([libnotify not found, wxNotificationMessage will use generic implementation.])
PKG_CHECK_MODULES(LIBNOTIFY, [libnotify >= 0.4],
[HAVE_LIBNOTIFY=1],
[AC_MSG_WARN([libnotify not found, wxNotificationMessage will use generic implementation.])]
)
]
)
if test "$HAVE_LIBNOTIFY" = "1" ; then
GUI_TK_LIBRARY="$GUI_TK_LIBRARY $LIBNOTIFY_LIBS"
CFLAGS="$LIBNOTIFY_CFLAGS $CFLAGS"
CXXFLAGS="$LIBNOTIFY_CFLAGS $CXXFLAGS"
AC_DEFINE(wxUSE_LIBNOTIFY)
fi
fi
fi

View File

@ -826,6 +826,10 @@
* Use libnotify library.
*/
#define wxUSE_LIBNOTIFY 0
/*
* Use libnotify 0.7+ API.
*/
#define wxUSE_LIBNOTIFY_0_7 0
/*
* Use libXpm
*/

View File

@ -138,6 +138,13 @@ bool wxNotificationMessage::Show(int timeout)
GetTitle().utf8_str(),
GetMessage().utf8_str(),
icon
#if !wxUSE_LIBNOTIFY_0_7
// There used to be an "associated window"
// parameter in this function but it has
// disappeared by 0.7, so use it for previous
// versions only.
, 0
#endif // libnotify < 0.7
);
if ( !m_notification )
{