diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/kvilib/config/kvi_settings.h | 108 | ||||
| -rw-r--r-- | src/kvilib/ext/KviXlib.h | 34 | ||||
| -rw-r--r-- | src/kvilib/net/kvi_socket.h | 6 | ||||
| -rw-r--r-- | src/kvirc/kvs/KviKvsCoreSimpleCommands_af.cpp | 64 |
4 files changed, 109 insertions, 103 deletions
diff --git a/src/kvilib/config/kvi_settings.h b/src/kvilib/config/kvi_settings.h index 218e57401..e96ed65f1 100644 --- a/src/kvilib/config/kvi_settings.h +++ b/src/kvilib/config/kvi_settings.h @@ -39,21 +39,46 @@ // assume CMake build system for all systems #include "kvi_sysconfig.h" -// FIXME: Once we have a stable CMake build system, this section needs a cleanup. -#if (defined(_OS_WIN32_) || defined(Q_OS_WIN32) || defined(Q_OS_WIN32_)) && !defined(MINGW) +/** + * \def KVILIB_API This prefix before a class name or function enables the export of its symbols outside kvilib; needed for win32/visual studio, win32/mingw, linux/gcc. + * \def KVILIB_API_TYPEDEF This prefix before a typedef enables the export of its symbol outside kvilib; needed for win32/visual studio, win32/mingw + */ + +/** + * \def KVIRC_API This prefix before a class name or function enables the export of its symbols outside kvirc; needed for win32/visual studio, win32/mingw, linux/gcc. + * \def KVIRC_API_TYPEDEF This prefix before a typedef enables the export of its symbol outside kvirc; needed for win32/visual studio, win32/mingw + */ +// note: MINGW is a cmake-set variable +#ifdef MINGW /** - * \def COMPILE_WITH_SYSTEM_MEMMOVE This flag will disable kvirc's internal optimized memmove functions - * \def COMPILE_ON_WINDOWS This flag will enable specific code for windows/visual studio compilation + * \def COMPILE_ON_MINGW This flag will enable specific code for windows/mingw (cross)compilation */ + #define COMPILE_ON_MINGW - #define COMPILE_ON_WINDOWS + #ifdef __KVILIB__ + #define KVILIB_API __declspec(dllexport) __attribute__((visibility("default"))) + #define KVILIB_API_TYPEDEF __declspec(dllexport) + #else + #define KVILIB_API __declspec(dllimport) __attribute__((visibility("default"))) + #define KVILIB_API_TYPEDEF __declspec(dllimport) + #endif - /** - * \def KVILIB_API This prefix before a class name or function enables the export of its symbols outside kvilib; needed for win32/visual studio, win32/mingw, linux/gcc. - * \def KVILIB_API_TYPEDEF This prefix before a typedef enables the export of its symbol outside kvilib; needed for win32/visual studio, win32/mingw - */ + #ifdef __KVIRC__ + #define KVIRC_API __declspec(dllexport) __attribute__((visibility("default"))) + #define KVIRC_API_TYPEDEF __declspec(dllexport) + #else + #define KVIRC_API __declspec(dllimport) __attribute__((visibility("default"))) + #define KVIRC_API_TYPEDEF __declspec(dllimport) + #endif + +// note: unofficial cmake ports defines OS2 +#elif defined(OS2) + // os2 ports still uses mingw/gcc + #define COMPILE_ON_MINGW + + // visibility attribute is not supported by gcc/os2 #ifdef __KVILIB__ #define KVILIB_API __declspec(dllexport) #define KVILIB_API_TYPEDEF __declspec(dllexport) @@ -62,11 +87,6 @@ #define KVILIB_API_TYPEDEF __declspec(dllimport) #endif - /** - * \def KVIRC_API This prefix before a class name or function enables the export of its symbols outside kvirc; needed for win32/visual studio, win32/mingw, linux/gcc. - * \def KVIRC_API_TYPEDEF This prefix before a typedef enables the export of its symbol outside kvirc; needed for win32/visual studio, win32/mingw - */ - #ifdef __KVIRC__ #define KVIRC_API __declspec(dllexport) #define KVIRC_API_TYPEDEF __declspec(dllexport) @@ -74,41 +94,42 @@ #define KVIRC_API __declspec(dllimport) #define KVIRC_API_TYPEDEF __declspec(dllimport) #endif -#else - #ifdef MINGW + +// note: cmake defines "WIN32" but we're not using it since it includes cygwin, too +// we use qt's Q_OS_WIN32 instead (and its variants) +#elif (defined(_OS_WIN32_) || defined(Q_OS_WIN32) || defined(Q_OS_WIN32_)) /** - * \def COMPILE_ON_MINGW This flag will enable specific code for windows/mingw compilation - * \def COMPILE_NO_X This flag forces X11 support to be disabled + * \def COMPILE_ON_WINDOWS This flag will enable specific code for windows/visual studio compilation */ - #define COMPILE_ON_MINGW - #define COMPILE_NO_X - #define COMPILE_WITH_SYSTEM_MEMMOVE + #define COMPILE_ON_WINDOWS - #ifdef __KVILIB__ - #define KVILIB_API __declspec(dllexport) __attribute__((visibility("default"))) - #define KVILIB_API_TYPEDEF __declspec(dllexport) - #else - #define KVILIB_API __declspec(dllimport) __attribute__((visibility("default"))) - #define KVILIB_API_TYPEDEF __declspec(dllimport) - #endif + #ifdef __KVILIB__ + #define KVILIB_API __declspec(dllexport) + #define KVILIB_API_TYPEDEF __declspec(dllexport) + #else + #define KVILIB_API __declspec(dllimport) + #define KVILIB_API_TYPEDEF __declspec(dllimport) + #endif - #ifdef __KVIRC__ - #define KVIRC_API __declspec(dllexport) __attribute__((visibility("default"))) - #define KVIRC_API_TYPEDEF __declspec(dllexport) - #else - #define KVIRC_API __declspec(dllimport) __attribute__((visibility("default"))) - #define KVIRC_API_TYPEDEF __declspec(dllimport) - #endif + #ifdef __KVIRC__ + #define KVIRC_API __declspec(dllexport) + #define KVIRC_API_TYPEDEF __declspec(dllexport) #else + #define KVIRC_API __declspec(dllimport) + #define KVIRC_API_TYPEDEF __declspec(dllimport) + #endif - #define KVILIB_API __attribute__((visibility("default"))) - #define KVILIB_API_TYPEDEF +#else + // we failback on unix/linux variants + #define KVILIB_API __attribute__((visibility("default"))) + #define KVILIB_API_TYPEDEF - #define KVIRC_API __attribute__((visibility("default"))) - #define KVIRC_API_TYPEDEF - #endif + #define KVIRC_API __attribute__((visibility("default"))) + #define KVIRC_API_TYPEDEF + // note: cmake defines "APPLE" but we're not using it since it includes legacy mac os version (pre-X) + // we use qt's Q_OS_MACX instead #ifdef Q_OS_MACX /** * \def COMPILE_ON_MAC This flag will enable specific code for mac compilation @@ -126,7 +147,6 @@ * \def KVI_RELEASE_NAME Defines the codename for the current kvirc release * \def _GNU_SOURCE Enables _GNU_SOURCE features * \def KVI_PTR2MEMBER Cross-platform macro that returns a member from its pointer -* \def COMPILE_NO_X_BELL Enasures X bell is disabled if X is disabled * \def KVI_DEPRECATED Prefix for deprecated objects inside kvirc code (currently unused) * \def BIG_ENDIAN_MACHINE_BYTE_ORDER If defined, the current target processor is big endian, little endian otherwise */ @@ -166,12 +186,6 @@ #define KVI_PTR2MEMBER(__x) &(__x) #endif -#ifdef COMPILE_NO_X - #ifndef COMPILE_NO_X_BELL - #define COMPILE_NO_X_BELL - #endif -#endif - #define KVI_DEPRECATED // Trust Qt about the current target processor endianness diff --git a/src/kvilib/ext/KviXlib.h b/src/kvilib/ext/KviXlib.h index 0b7a71d09..6c03ffa83 100644 --- a/src/kvilib/ext/KviXlib.h +++ b/src/kvilib/ext/KviXlib.h @@ -26,27 +26,23 @@ #include "kvi_settings.h" -#ifndef COMPILE_ON_WINDOWS - #ifndef COMPILE_NO_X +#ifdef COMPILE_X11_SUPPORT + #ifdef Bool + // Someone has defined Bool ? + #undef Bool + #endif - #ifdef Bool - // Someone has defined Bool ? - #undef Bool - #endif + #include <X11/Xlib.h> - #include <X11/Xlib.h> + // Too bad that X11/Xlib.h defines Bool, Error and Success... this basically + // SUX since we can't use them anywhere in the source! + // this breaks, enums in Qt, enums in KVIrc and other stuff all around... + // Shame on you Xlib.h author :D - // Too bad that X11/Xlib.h defines Bool, Error and Success... this basically - // SUX since we can't use them anywhere in the source! - // this breaks, enums in Qt, enums in KVIrc and other stuff all around... - // Shame on you Xlib.h author :D - - #ifdef Bool - // NO! - #undef Bool - #endif - - #endif // !COMPILE_NO_X -#endif + #ifdef Bool + // NO! + #undef Bool + #endif +#endif //COMPILE_X11_SUPPORT #endif //_KVI_XLIB_H_ diff --git a/src/kvilib/net/kvi_socket.h b/src/kvilib/net/kvi_socket.h index d76606d75..4026051d0 100644 --- a/src/kvilib/net/kvi_socket.h +++ b/src/kvilib/net/kvi_socket.h @@ -42,7 +42,7 @@ -#if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) +#if defined(COMPILE_ON_WINDOWS) || (defined(COMPILE_ON_MINGW) && !defined(OS2)) #define KVI_INVALID_SOCKET INVALID_SOCKET @@ -62,7 +62,7 @@ #define KVI_PROTECTION_LEVEL_UNRESTRICTED PROTECTION_LEVEL_UNRESTRICTED #define KVI_IPPROTO_IPV6 IPPROTO_IPV6 -#else //!(defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW)) +#else //!(defined(COMPILE_ON_WINDOWS) || (defined(COMPILE_ON_MINGW) && !defined(OS2)) #include <sys/time.h> #include <sys/types.h> @@ -73,7 +73,7 @@ #include <unistd.h> #define KVI_INVALID_SOCKET (-1) -#endif //!(defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW)) +#endif //!(defined(COMPILE_ON_WINDOWS) || (defined(COMPILE_ON_MINGW) && !defined(OS2)) #ifndef MSG_NOSIGNAL // At least solaris seems to not have it diff --git a/src/kvirc/kvs/KviKvsCoreSimpleCommands_af.cpp b/src/kvirc/kvs/KviKvsCoreSimpleCommands_af.cpp index e82612f05..2be09ab4b 100644 --- a/src/kvirc/kvs/KviKvsCoreSimpleCommands_af.cpp +++ b/src/kvirc/kvs/KviKvsCoreSimpleCommands_af.cpp @@ -347,47 +347,43 @@ namespace KviKvsCoreSimpleCommands #if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) Beep(pitch,duration); -#else - #ifdef COMPILE_X11_SUPPORT - #ifndef COMPILE_NO_X_BELL - bool bSync = (KVSCSC_pSwitches->find('s',"sync") != 0); +#elif defined(COMPILE_X11_SUPPORT) + bool bSync = (KVSCSC_pSwitches->find('s',"sync") != 0); - XKeyboardState st; - XKeyboardControl ctl; + XKeyboardState st; + XKeyboardControl ctl; - XGetKeyboardControl(get_xdisplay(),&st); + XGetKeyboardControl(get_xdisplay(),&st); - unsigned long mask = KBBellPercent; - ctl.bell_percent = uVolume; - if(pitch >= 0) - { - ctl.bell_pitch = pitch; - mask |= KBBellPitch; - } - if(duration >= 0) - { - ctl.bell_duration = duration; - mask |= KBBellDuration; - } - XChangeKeyboardControl(get_xdisplay(),mask,&ctl); - - XBell(get_xdisplay(),100); + unsigned long mask = KBBellPercent; + ctl.bell_percent = uVolume; + if(pitch >= 0) + { + ctl.bell_pitch = pitch; + mask |= KBBellPitch; + } + if(duration >= 0) + { + ctl.bell_duration = duration; + mask |= KBBellDuration; + } + XChangeKeyboardControl(get_xdisplay(),mask,&ctl); - if(bSync) - { - if(duration >= 0)usleep(duration * 1000); - else usleep(st.bell_duration * 1000); - } + XBell(get_xdisplay(),100); - ctl.bell_pitch = st.bell_pitch; - ctl.bell_duration = st.bell_duration; - ctl.bell_percent = st.bell_percent; + if(bSync) + { + if(duration >= 0)usleep(duration * 1000); + else usleep(st.bell_duration * 1000); + } - XChangeKeyboardControl(get_xdisplay(),mask,&ctl); + ctl.bell_pitch = st.bell_pitch; + ctl.bell_duration = st.bell_duration; + ctl.bell_percent = st.bell_percent; + + XChangeKeyboardControl(get_xdisplay(),mask,&ctl); +#endif //COMPILE_X11_SUPPORT - #endif //COMPILE_NO_X_BELL - #endif //COMPILE_X11_SUPPORT -#endif return true; } |
