From 8c2711e771bebf1e33f185ff98e4eaed7eb7f95b Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Mon, 18 Mar 2013 16:57:22 +0100 Subject: change #ifdef -> #if for KDE4 feature macros Change-Id: I289744eaa62ad819620f0b31a54efd5ebbdb9dc2 --- config_host/config_kde4.h.in | 3 +++ vcl/unx/kde4/KDEXLib.cxx | 24 ++++++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/config_host/config_kde4.h.in b/config_host/config_kde4.h.in index 6e5cddf5a5f4..654d2352402c 100644 --- a/config_host/config_kde4.h.in +++ b/config_host/config_kde4.h.in @@ -6,5 +6,8 @@ Settings for KDE4 integration. #define CONFIG_KDE4_H #undef KDE_HAVE_GLIB +#ifndef KDE_HAVE_GLIB +#define KDE_HAVE_GLIB 0 +#endif #endif diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx index 86495eb73b4b..ee5735bd4c82 100644 --- a/vcl/unx/kde4/KDEXLib.cxx +++ b/vcl/unx/kde4/KDEXLib.cxx @@ -47,14 +47,18 @@ #include #if QT_VERSION >= QT_VERSION_CHECK( 4, 9, 0 ) -#define QT_UNIX_EVENT_LOOP_SUPPORT +#define QT_UNIX_EVENT_LOOP_SUPPORT 1 +#else +#define QT_UNIX_EVENT_LOOP_SUPPORT 0 #endif -#ifdef KDE_HAVE_GLIB -#define GLIB_EVENT_LOOP_SUPPORT +#if KDE_HAVE_GLIB +#define GLIB_EVENT_LOOP_SUPPORT 1 +#else +#define GLIB_EVENT_LOOP_SUPPORT 0 #endif -#ifdef GLIB_EVENT_LOOP_SUPPORT +#if GLIB_EVENT_LOOP_SUPPORT #include #endif @@ -176,11 +180,11 @@ void KDEXLib::Init() // needs to be unlocked shortly before entering the main sleep (e.g. select()) and locked // immediatelly after. So we need to know which event loop implementation is used and // hook accordingly. -#ifdef GLIB_EVENT_LOOP_SUPPORT +#if GLIB_EVENT_LOOP_SUPPORT static GPollFunc old_gpoll = NULL; static gint gpoll_wrapper( GPollFD*, guint, gint ); #endif -#ifdef QT_UNIX_EVENT_LOOP_SUPPORT +#if QT_UNIX_EVENT_LOOP_SUPPORT static int (*qt_select)(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, const struct timeval *orig_timeout); static int lo_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, @@ -200,7 +204,7 @@ static bool qt_event_filter( void* m ) void KDEXLib::setupEventLoop() { old_qt_event_filter = QAbstractEventDispatcher::instance()->setEventFilter( qt_event_filter ); -#ifdef GLIB_EVENT_LOOP_SUPPORT +#if GLIB_EVENT_LOOP_SUPPORT // Glib is simple, it has g_main_context_set_poll_func() for wrapping the sleep call. // The catch is that Qt has a bug that allows triggering timers even when they should // not be, leading to crashes caused by QClipboard re-entering the event loop. @@ -219,7 +223,7 @@ void KDEXLib::setupEventLoop() } #endif #endif -#ifdef QT_UNIX_EVENT_LOOP_SUPPORT +#if QT_UNIX_EVENT_LOOP_SUPPORT // When Qt does not use Glib support, it uses its own Unix event dispatcher. // That one has aboutToBlock() and awake() signals, but they are broken (either // functionality or semantics), as e.g. awake() is not emitted right after the dispatcher @@ -239,7 +243,7 @@ void KDEXLib::setupEventLoop() #endif } -#ifdef GLIB_EVENT_LOOP_SUPPORT +#if GLIB_EVENT_LOOP_SUPPORT gint gpoll_wrapper( GPollFD* ufds, guint nfds, gint timeout ) { SalYieldMutexReleaser release; // release YieldMutex (and re-acquire at block end) @@ -247,7 +251,7 @@ gint gpoll_wrapper( GPollFD* ufds, guint nfds, gint timeout ) } #endif -#ifdef QT_UNIX_EVENT_LOOP_SUPPORT +#if QT_UNIX_EVENT_LOOP_SUPPORT int lo_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, const struct timeval *orig_timeout) { -- cgit