From: Dana Jansens Date: Sun, 9 Feb 2003 23:07:54 +0000 (+0000) Subject: use the c++ std cheaders X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=115fedf432d73f17ade48eaa2fa12dfd333bfcaa;p=chaz%2Fopenbox use the c++ std cheaders --- diff --git a/configure.ac b/configure.ac index 3511aa42..c5302aa4 100644 --- a/configure.ac +++ b/configure.ac @@ -39,8 +39,8 @@ ALL_LINGUAS="" AM_GNU_GETTEXT_VERSION(0.11.5) AM_GNU_GETTEXT([external]) -AC_CHECK_HEADERS(ctype.h dirent.h fcntl.h libgen.h locale.h nl_types.h process.h signal.h stdarg.h stdint.h stdio.h stdlib.h string.h time.h unistd.h sys/param.h sys/select.h sys/signal.h sys/stat.h sys/time.h sys/types.h sys/wait.h) -AC_HEADER_TIME +AC_CHECK_HEADERS(fcntl.h signal.h stdarg.h stdint.h unistd.h sys/select.h sys/signal.h sys/stat.h sys/time.h sys/types.h sys/wait.h) +# AC_HEADER_TIME # AC_TYPE_SIGNAL # Check for Xft2 diff --git a/otk/application.cc b/otk/application.cc index ffa33ab8..94842ca5 100644 --- a/otk/application.cc +++ b/otk/application.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif +#include "config.h" #include "application.hh" #include "eventhandler.hh" diff --git a/otk/appwidget.cc b/otk/appwidget.cc index 5c963f7b..113998fe 100644 --- a/otk/appwidget.cc +++ b/otk/appwidget.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif +#include "config.h" #include "appwidget.hh" #include "application.hh" diff --git a/otk/button.cc b/otk/button.cc index c0f48100..774aa11b 100644 --- a/otk/button.cc +++ b/otk/button.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif +#include "config.h" #include "button.hh" diff --git a/otk/display.cc b/otk/display.cc index cf4e22e3..cb13440a 100644 --- a/otk/display.cc +++ b/otk/display.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif +#include "config.h" #include "display.hh" #include "screeninfo.hh" @@ -24,10 +22,6 @@ extern "C" { #include #endif // XINERAMA -#ifdef HAVE_STDIO_H -# include -#endif // HAVE_STDIO_H - #ifdef HAVE_SIGNAL_H # include #endif // HAVE_SIGNAL_H @@ -45,6 +39,8 @@ extern "C" { #define _(str) gettext(str) } +#include + namespace otk { diff --git a/otk/eventdispatcher.cc b/otk/eventdispatcher.cc index 8c245dde..0560eec8 100644 --- a/otk/eventdispatcher.cc +++ b/otk/eventdispatcher.cc @@ -1,18 +1,11 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif +#include "config.h" #include "eventdispatcher.hh" #include "display.hh" -extern "C" { -#ifdef HAVE_STDIO_H -# include -#endif -} - +#include #include namespace otk { diff --git a/otk/eventhandler.cc b/otk/eventhandler.cc index c867d809..6539d587 100644 --- a/otk/eventhandler.cc +++ b/otk/eventhandler.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif +#include "config.h" #include "display.hh" #include "eventhandler.hh" diff --git a/otk/font.cc b/otk/font.cc index 4c3a3476..424c13fb 100644 --- a/otk/font.cc +++ b/otk/font.cc @@ -1,15 +1,8 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif // HAVE_CONFIG_H - -extern "C" { -#ifdef HAVE_STDLIB_H -# include -#endif // HAVE_STDLIB_H -} +#include "config.h" +#include #include #include diff --git a/otk/font.hh b/otk/font.hh index 16c47f27..618d4f6e 100644 --- a/otk/font.hh +++ b/otk/font.hh @@ -11,7 +11,7 @@ extern "C" { #include } -#include +#include namespace otk { diff --git a/otk/label.cc b/otk/label.cc index c17e295e..751fff34 100644 --- a/otk/label.cc +++ b/otk/label.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif +#include "config.h" #include "label.hh" #include "display.hh" diff --git a/otk/otk_test.cc b/otk/otk_test.cc index b438b3b1..f10c4b3b 100644 --- a/otk/otk_test.cc +++ b/otk/otk_test.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif +#include "config.h" #include "application.hh" #include "appwidget.hh" diff --git a/otk/property.cc b/otk/property.cc index 39626911..699dd91b 100644 --- a/otk/property.cc +++ b/otk/property.cc @@ -1,19 +1,16 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif // HAVE_CONFIG_H +#include "config.h" #include "property.hh" #include "display.hh" extern "C" { #include - -#include } #include +#include namespace otk { diff --git a/otk/property.hh b/otk/property.hh index 1dc08937..22b62fe6 100644 --- a/otk/property.hh +++ b/otk/property.hh @@ -11,11 +11,10 @@ extern "C" { #include - -#include } #include +#include namespace otk { diff --git a/otk/pseudorendercontrol.cc b/otk/pseudorendercontrol.cc index 813eb4d1..e239a4f0 100644 --- a/otk/pseudorendercontrol.cc +++ b/otk/pseudorendercontrol.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif // HAVE_CONFIG_H +#include "config.h" #include "pseudorendercontrol.hh" #include "display.hh" diff --git a/otk/rendercolor.cc b/otk/rendercolor.cc index be9521bf..5917b007 100644 --- a/otk/rendercolor.cc +++ b/otk/rendercolor.cc @@ -1,18 +1,12 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif // HAVE_CONFIG_H +#include "config.h" #include "rendercolor.hh" #include "display.hh" #include "screeninfo.hh" -extern "C" { -#ifdef HAVE_STDIO_H -# include -#endif -} +#include namespace otk { diff --git a/otk/rendercontrol.cc b/otk/rendercontrol.cc index bf69a4e5..58c8f555 100644 --- a/otk/rendercontrol.cc +++ b/otk/rendercontrol.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif // HAVE_CONFIG_H +#include "config.h" #include "rendercontrol.hh" #include "truerendercontrol.hh" diff --git a/otk/renderstyle.cc b/otk/renderstyle.cc index ae2a3a18..e7ae0e0a 100644 --- a/otk/renderstyle.cc +++ b/otk/renderstyle.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif // HAVE_CONFIG_H +#include "config.h" #include "renderstyle.hh" #include "display.hh" diff --git a/otk/rendertest.cc b/otk/rendertest.cc index 484a08ff..b3a03a03 100644 --- a/otk/rendertest.cc +++ b/otk/rendertest.cc @@ -1,9 +1,14 @@ +#include "config.h" + #include "otk.hh" #include "rendercontrol.hh" #include "rendertexture.hh" -#include +extern "C" { #include +} + +#include int main(int argc, char **argv) { diff --git a/otk/screeninfo.cc b/otk/screeninfo.cc index 535156e9..2838c897 100644 --- a/otk/screeninfo.cc +++ b/otk/screeninfo.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif // HAVE_CONFIG_H +#include "config.h" extern "C" { #include diff --git a/otk/surface.cc b/otk/surface.cc index 60e6824c..7d7c0c53 100644 --- a/otk/surface.cc +++ b/otk/surface.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif // HAVE_CONFIG_H +#include "config.h" #include "surface.hh" #include "display.hh" diff --git a/otk/timer.cc b/otk/timer.cc index 4f993616..0a008314 100644 --- a/otk/timer.cc +++ b/otk/timer.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif // HAVE_CONFIG_H +#include "config.h" #include "timer.hh" #include "display.hh" @@ -10,12 +8,11 @@ extern "C" { #ifdef HAVE_SYS_SELECT_H # include -#else -# ifdef HAVE_UNISTD_H -# include -# include -# endif // HAVE_UNISTD_H #endif // HAVE_SYS_SELECT_H + +#ifdef HAVE_SYS_TIME_H +# include +#endif } namespace otk { diff --git a/otk/timer.hh b/otk/timer.hh index 0ca8be8d..556475c1 100644 --- a/otk/timer.hh +++ b/otk/timer.hh @@ -7,16 +7,7 @@ */ extern "C" { -#ifdef TIME_WITH_SYS_TIME -# include -# include -#else // !TIME_WITH_SYS_TIME -# ifdef HAVE_SYS_TIME_H -# include -# else // !HAVE_SYS_TIME_H -# include -# endif // HAVE_SYS_TIME_H -#endif // TIME_WITH_SYS_TIME +#include } #include @@ -39,7 +30,9 @@ private: struct TimerCompare { //! Compares two timeval structs inline bool operator()(const Timer *a, const Timer *b) const { - return timercmp(&a->_timeout, &b->_timeout, >); + return ((&a->_timeout)->tv_sec == (&b->_timeout)->tv_sec) ? + ((&a->_timeout)->tv_usec > (&b->_timeout)->tv_usec) : + ((&a->_timeout)->tv_sec > (&b->_timeout)->tv_sec); } }; friend struct TimerCompare; // give access to _timeout for shitty compilers diff --git a/otk/truerendercontrol.cc b/otk/truerendercontrol.cc index fffaa05a..ec7bc461 100644 --- a/otk/truerendercontrol.cc +++ b/otk/truerendercontrol.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif // HAVE_CONFIG_H +#include "config.h" #include "truerendercontrol.hh" #include "display.hh" diff --git a/otk/ustring.cc b/otk/ustring.cc index 7dbe8ece..8ffe07fe 100644 --- a/otk/ustring.cc +++ b/otk/ustring.cc @@ -1,14 +1,10 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif // HAVE_CONFIG_H +#include "config.h" #include "ustring.hh" -extern "C" { -#include -} +#include namespace otk { diff --git a/otk/util.cc b/otk/util.cc index b33a1148..03df393e 100644 --- a/otk/util.cc +++ b/otk/util.cc @@ -1,39 +1,29 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif // HAVE_CONFIG_H +#include "config.h" extern "C" { #include -#ifdef HAVE_STDIO_H -#include -#endif - -#ifdef HAVE_STRING_H -#include -#endif - -#ifdef HAVE_STDLIB_H -#include -#endif - #ifdef HAVE_UNISTD_H #include #endif // HAVE_UNISTD_H -#if defined(HAVE_PROCESS_H) && defined(__EMX__) -# include -#endif // HAVE_PROCESS_H __EMX__ +// this is not checked in configure anymore!! +//#if defined(HAVE_PROCESS_H) && defined(__EMX__) +//# include +//#endif // HAVE_PROCESS_H __EMX__ #include "../src/gettext.h" #define _(str) gettext(str) -#include } #include +#include +#include +#include +#include #include "util.hh" @@ -52,16 +42,16 @@ string expandTilde(const string& s) { void bexec(const string& command, const string& displaystring) { -#ifndef __EMX__ +//#ifndef __EMX__ if (! fork()) { setsid(); putenv(displaystring); int ret = execl("/bin/sh", "/bin/sh", "-c", command.c_str(), NULL); exit(ret); } -#else // __EMX__ - spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", command.c_str(), NULL); -#endif // !__EMX__ +//#else // __EMX__ +// spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", command.c_str(), NULL); +//#endif // !__EMX__ } diff --git a/otk/util.hh b/otk/util.hh index e00a4e1b..22d45fba 100644 --- a/otk/util.hh +++ b/otk/util.hh @@ -5,17 +5,6 @@ extern "C" { #include #include - -#ifdef TIME_WITH_SYS_TIME -# include -# include -#else // !TIME_WITH_SYS_TIME -# ifdef HAVE_SYS_TIME_H -# include -# else // !HAVE_SYS_TIME_H -# include -# endif // HAVE_SYS_TIME_H -#endif // TIME_WITH_SYS_TIME } #include diff --git a/src/actions.cc b/src/actions.cc index bb5088e9..3eb29215 100644 --- a/src/actions.cc +++ b/src/actions.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif +#include "config.h" #include "actions.hh" #include "openbox.hh" @@ -13,7 +11,7 @@ #include "bindings.hh" #include "otk/display.hh" -#include +#include #include namespace ob { diff --git a/src/bindings.cc b/src/bindings.cc index 167d0a85..138aba81 100644 --- a/src/bindings.cc +++ b/src/bindings.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif +#include "config.h" #include "bindings.hh" #include "screen.hh" diff --git a/src/client.cc b/src/client.cc index e2c2dcb4..25434573 100644 --- a/src/client.cc +++ b/src/client.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif +#include "config.h" #include "client.hh" #include "frame.hh" diff --git a/src/frame.cc b/src/frame.cc index 17ebdb65..5f63d17c 100644 --- a/src/frame.cc +++ b/src/frame.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif +#include "config.h" extern "C" { #ifdef SHAPE diff --git a/src/main.cc b/src/main.cc index 83cbf516..13047780 100644 --- a/src/main.cc +++ b/src/main.cc @@ -4,19 +4,9 @@ @brief Main entry point for the application */ -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif // HAVE_CONFIG_H +#include "config.h" extern "C" { -#ifdef HAVE_LOCALE_H -# include -#endif // HAVE_LOCALE_H - -#ifdef HAVE_STDIO_H -# include -#endif // HAVE_STDIO_H - #ifdef HAVE_UNISTD_H # include # include @@ -28,6 +18,9 @@ extern "C" { #include "openbox.hh" #include "otk/util.hh" +#include +#include + int main(int argc, char **argv) { // initialize the locale if (!setlocale(LC_ALL, "")) diff --git a/src/openbox.cc b/src/openbox.cc index 24b32786..9c1041ac 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -1,8 +1,6 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif +#include "config.h" #include "openbox.hh" #include "client.hh" @@ -20,14 +18,6 @@ extern "C" { #include -#ifdef HAVE_STDIO_H -# include -#endif // HAVE_STDIO_H - -#ifdef HAVE_STDLIB_H -# include -#endif // HAVE_STDLIB_H - #ifdef HAVE_SIGNAL_H # include #endif // HAVE_SIGNAL_H @@ -45,6 +35,8 @@ extern "C" { } #include +#include +#include namespace ob { diff --git a/src/screen.cc b/src/screen.cc index 4878d7b6..024c5094 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -1,18 +1,8 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif +#include "config.h" extern "C" { -#ifdef HAVE_STDIO_H -# include -#endif // HAVE_STDIO_H - -#ifdef HAVE_STRING_H -# include -#endif // HAVE_STRING_H - #ifdef HAVE_UNISTD_H # include # include @@ -33,6 +23,8 @@ extern "C" { #include #include +#include +#include static bool running; static int anotherWMRunning(Display *display, XErrorEvent *) { diff --git a/wrap/ob.i b/wrap/ob.i index 33cc5403..0ba9a90e 100644 --- a/wrap/ob.i +++ b/wrap/ob.i @@ -3,9 +3,7 @@ %module ob %{ -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif +#include "config.h" #include "frame.hh" #include "openbox.hh"