Kaydet (Commit) 8c2711e7 authored tarafından Luboš Luňák's avatar Luboš Luňák

change #ifdef -> #if for KDE4 feature macros

Change-Id: I289744eaa62ad819620f0b31a54efd5ebbdb9dc2
üst 58d8ad36
...@@ -6,5 +6,8 @@ Settings for KDE4 integration. ...@@ -6,5 +6,8 @@ Settings for KDE4 integration.
#define CONFIG_KDE4_H #define CONFIG_KDE4_H
#undef KDE_HAVE_GLIB #undef KDE_HAVE_GLIB
#ifndef KDE_HAVE_GLIB
#define KDE_HAVE_GLIB 0
#endif
#endif #endif
...@@ -47,14 +47,18 @@ ...@@ -47,14 +47,18 @@
#include <config_kde4.h> #include <config_kde4.h>
#if QT_VERSION >= QT_VERSION_CHECK( 4, 9, 0 ) #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 #endif
#ifdef KDE_HAVE_GLIB #if KDE_HAVE_GLIB
#define GLIB_EVENT_LOOP_SUPPORT #define GLIB_EVENT_LOOP_SUPPORT 1
#else
#define GLIB_EVENT_LOOP_SUPPORT 0
#endif #endif
#ifdef GLIB_EVENT_LOOP_SUPPORT #if GLIB_EVENT_LOOP_SUPPORT
#include <glib-2.0/glib.h> #include <glib-2.0/glib.h>
#endif #endif
...@@ -176,11 +180,11 @@ void KDEXLib::Init() ...@@ -176,11 +180,11 @@ void KDEXLib::Init()
// needs to be unlocked shortly before entering the main sleep (e.g. select()) and locked // 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 // immediatelly after. So we need to know which event loop implementation is used and
// hook accordingly. // hook accordingly.
#ifdef GLIB_EVENT_LOOP_SUPPORT #if GLIB_EVENT_LOOP_SUPPORT
static GPollFunc old_gpoll = NULL; static GPollFunc old_gpoll = NULL;
static gint gpoll_wrapper( GPollFD*, guint, gint ); static gint gpoll_wrapper( GPollFD*, guint, gint );
#endif #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, static int (*qt_select)(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
const struct timeval *orig_timeout); const struct timeval *orig_timeout);
static int lo_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, 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 ) ...@@ -200,7 +204,7 @@ static bool qt_event_filter( void* m )
void KDEXLib::setupEventLoop() void KDEXLib::setupEventLoop()
{ {
old_qt_event_filter = QAbstractEventDispatcher::instance()->setEventFilter( qt_event_filter ); 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. // 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 // 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. // not be, leading to crashes caused by QClipboard re-entering the event loop.
...@@ -219,7 +223,7 @@ void KDEXLib::setupEventLoop() ...@@ -219,7 +223,7 @@ void KDEXLib::setupEventLoop()
} }
#endif #endif
#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. // 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 // 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 // functionality or semantics), as e.g. awake() is not emitted right after the dispatcher
...@@ -239,7 +243,7 @@ void KDEXLib::setupEventLoop() ...@@ -239,7 +243,7 @@ void KDEXLib::setupEventLoop()
#endif #endif
} }
#ifdef GLIB_EVENT_LOOP_SUPPORT #if GLIB_EVENT_LOOP_SUPPORT
gint gpoll_wrapper( GPollFD* ufds, guint nfds, gint timeout ) gint gpoll_wrapper( GPollFD* ufds, guint nfds, gint timeout )
{ {
SalYieldMutexReleaser release; // release YieldMutex (and re-acquire at block end) SalYieldMutexReleaser release; // release YieldMutex (and re-acquire at block end)
...@@ -247,7 +251,7 @@ gint gpoll_wrapper( GPollFD* ufds, guint nfds, gint timeout ) ...@@ -247,7 +251,7 @@ gint gpoll_wrapper( GPollFD* ufds, guint nfds, gint timeout )
} }
#endif #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, int lo_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
const struct timeval *orig_timeout) const struct timeval *orig_timeout)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment