all repos — fluxbox @ 5bf23bb05df9abbafa2ab967212c11b76a0d4e7e

custom fork of the fluxbox windowmanager

Merge branches 'fix-out-of-range-memory', 'obey-configure' and 'other-improvements' into windows-mingw
Ryan Pavlik rpavlik@iastate.edu
commit

5bf23bb05df9abbafa2ab967212c11b76a0d4e7e

parent

757f78035da77fb84ad4ab479506f494353029d1

M acinclude.m4acinclude.m4

@@ -227,5 +227,5 @@ fi

CFLAGS="$CFLAGS $XFT_CFLAGS" CXXFLAGS="$CXXFLAGS $XFT_CFLAGS" - LIBS="$LIBS $XFT_LIBS" + LIBS="$XFT_LIBS $LIBS" ])
M configure.inconfigure.in

@@ -60,10 +60,10 @@ AC_FUNC_REALLOC

AC_FUNC_SELECT_ARGTYPES AC_FUNC_STAT -AC_CHECK_FUNCS(basename, , AC_CHECK_LIB(gen, basename, LIBS="$LIBS -lgen")) +AC_CHECK_FUNCS(basename, , AC_CHECK_LIB(gen, basename, LIBS="-lgen $LIBS")) AC_CHECK_FUNCS(catclose catgets catopen getpid gettimeofday memset mkdir \ nl_langinfo putenv regcomp select setenv setlocale sigaction snprintf \ - sqrt strcasecmp strcasestr strchr strstr strtol strtoul vsnprintf) + sqrt strcasecmp strcasestr strchr strstr strtol strtoul sync vsnprintf) dnl The autoconf test for strftime is broken now (due to gcc 3.3 bug?): dnl Gcc 3.3 testprog = ``extern "C" char strftime;'', build with g++ test.cc

@@ -130,13 +130,13 @@ AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])

AC_CHECK_LIB([iconv], [iconv_open], [ - LIBS="$LIBS -liconv" + LIBS="-liconv $LIBS" ], []) AC_CHECK_LIB([iconv], [libiconv_open], [ - LIBS="$LIBS -liconv" + LIBS="-liconv $LIBS" ], [])

@@ -163,8 +163,8 @@ fi

fi fi -AC_CHECK_LIB(nsl, t_open, LIBS="$LIBS -lnsl") -AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket") +AC_CHECK_LIB(nsl, t_open, LIBS="-lnsl $LIBS") +AC_CHECK_LIB(socket, socket, LIBS="-lsocket $LIBS") dnl Check for X headers and libraries AC_PATH_X

@@ -177,18 +177,18 @@ test x$x_libraries = "x" && x_libraries="/usr/lib"

CFLAGS="$CFLAGS $X_CFLAGS" CXXFLAGS="$CXXFLAGS $X_CFLAGS" -LIBS="$LIBS $X_LIBS" +LIBS="$X_LIBS $LIBS" LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS" dnl Check for required functions in -lX11 AC_CHECK_LIB(X11, XOpenDisplay, - LIBS="$LIBS -lX11", + LIBS="-lX11 $LIBS", AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.]) ) -LIBS="$LIBS $X_EXTRA_LIBS" +LIBS="$X_EXTRA_LIBS $LIBS" -AC_CHECK_LIB(xpg4, setlocale, LIBS="$LIBS -lxpg4") +AC_CHECK_LIB(xpg4, setlocale, LIBS="-lxpg4 $LIBS") AC_CHECK_PROGS(gencat_cmd, gencat) if test x$gencat_cmd = "x"; then

@@ -397,14 +397,14 @@ if test x$enableval = "xyes"; then

AC_MSG_RESULT([yes]) AC_CHECK_LIB(Xrender, XRenderCreatePicture, AC_DEFINE(HAVE_XRENDER, 1, "Xrender support") - LIBS="$LIBS -lXrender") + LIBS="-lXrender $LIBS") else AC_MSG_RESULT([no]) fi, AC_MSG_RESULT([yes]) AC_CHECK_LIB(Xrender, XRenderCreatePicture, AC_DEFINE(HAVE_XRENDER, 1, "Xrender support") - LIBS="$LIBS -lXrender") + LIBS="-lXrender $LIBS") ) XPM=false

@@ -417,7 +417,7 @@ AC_MSG_RESULT([yes])

AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, AC_DEFINE(HAVE_XPM, 1, "Xpm support") XPM=true - LIBS="$LIBS -lXpm") + LIBS="-lXpm $LIBS") else AC_MSG_RESULT([no]) fi,

@@ -425,7 +425,7 @@ AC_MSG_RESULT([yes])

AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, AC_DEFINE(HAVE_XPM, 1, "Xpm support") XPM=true - LIBS="$LIBS -lXpm") + LIBS="-lXpm $LIBS") ) AM_CONDITIONAL(XPM, test x$XPM = xtrue)

@@ -445,7 +445,7 @@ IMLIB2=true

AC_DEFINE(HAVE_IMLIB2, [], [Imlib2 support]) IMLIB2_LIBS=`imlib2-config --libs` IMLIB2_CFLAGS=`imlib2-config --cflags` - LIBS="$LIBS $IMLIB2_LIBS" + LIBS="$IMLIB2_LIBS $LIBS" CXXFLAGS="$CXXFLAGS $IMLIB2_CFLAGS" ], [ AC_MSG_RESULT(no)] )

@@ -494,7 +494,7 @@ #include <X11/extensions/Xinerama.h>

, XineramaQueryScreens(0, 0), AC_MSG_RESULT([yes]) AC_DEFINE(XINERAMA, [1], [Define to 1 if you have XINERAMA]) - LIBS="$LIBS -lXinerama", + LIBS="-lXinerama $LIBS", AC_MSG_RESULT([no]))) else AC_MSG_RESULT([no])

@@ -519,7 +519,7 @@ #include <X11/extensions/shape.h>

, long foo = ShapeSet, AC_MSG_RESULT([yes]) AC_DEFINE(SHAPE, [1], [Define to 1 if you have SHAPE]) - LIBS="$LIBS -lXext" + LIBS="-lXext $LIBS" FEATURES="$FEATURES XShape", AC_MSG_RESULT([no]))) else

@@ -547,7 +547,7 @@ #include <X11/extensions/Xrandr.h>

, XRRQueryExtension(0, 0, 0), AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_RANDR, [1], [Define to 1 if you have RANDR]) - LIBS="$LIBS -lXrandr", + LIBS="-lXrandr $LIBS", AC_MSG_RESULT([no]))) else AC_MSG_RESULT([no])

@@ -571,7 +571,7 @@ #include <X11/extensions/Xrandr.h>

, XRRUpdateConfiguration(0), AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_RANDR1_2, [1], [Define to 1 if you have RANDR 1.2]) - LIBS="$LIBS -lXrandr", + LIBS="-lXrandr $LIBS", AC_MSG_RESULT([no]))) else AC_MSG_RESULT([no])

@@ -613,7 +613,7 @@ #include <fribidi/fribidi.h>

, fribidi_version_info, AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_FRIBIDI, [1], [Define to 1 if you have FRIBIDI]) - LIBS="$LIBS -lfribidi", + LIBS="-lfribidi $LIBS", AC_MSG_RESULT([no]))) else AC_MSG_RESULT([no])
M src/FbTk/App.ccsrc/FbTk/App.cc

@@ -60,8 +60,13 @@ // a blank string, rather than a null string, so we make them equivalent

if (displayname != 0 && displayname[0] == '\0') displayname = 0; m_display = XOpenDisplay(displayname); - if (!m_display) - throw std::string("Couldn't connect to XServer"); + if (!m_display) { + if (displayname) { + throw std::string("Couldn't connect to XServer") + displayname; + } else { + throw std::string("Couldn't connect to XServer passing null display"); + } + } FbStringUtil::init(); }
M src/FbTk/FileUtil.ccsrc/FbTk/FileUtil.cc

@@ -63,9 +63,14 @@ struct stat buf;

if (!filename || stat(filename, &buf)) return false; - return buf.st_mode & S_IXUSR || - buf.st_mode & S_IXGRP || - buf.st_mode & S_IXOTH; + return buf.st_mode & S_IXUSR +#ifdef S_IXGRP + || buf.st_mode & S_IXGRP +#endif +#ifdef S_IXOTH + || buf.st_mode & S_IXOTH +#endif + ; } bool FileUtil::copyFile(const char* from, const char* to) {
M src/FbTk/I18n.ccsrc/FbTk/I18n.cc

@@ -72,17 +72,17 @@ }

I18n::I18n():m_multibyte(false), m_utf8_translate(false), m_catalog_fd((nl_catd)(-1)) { -#ifdef HAVE_SETLOCALE +#if defined(HAVE_SETLOCALE) && defined(NLS) //make sure we don't get 0 to m_locale string char *temp = setlocale(LC_MESSAGES, ""); m_locale = ( temp ? temp : ""); if (m_locale.empty()) { cerr<<"Warning: Failed to set locale, reverting to \"C\""<<endl; -#endif // HAVE_SETLOCALE +#endif // defined(HAVE_SETLOCALE) && defined(NLS) m_locale = "C"; -#ifdef HAVE_SETLOCALE +#if defined(HAVE_SETLOCALE) && defined(NLS) } else {

@@ -102,7 +102,7 @@ index = m_locale.find('=');

if (index != string::npos) m_locale.erase(0,index+1); //erase all characters starting up to index } -#endif // HAVE_SETLOCALE +#endif // defined(HAVE_SETLOCALE) && defined(NLS) }
M src/FbTk/SignalHandler.ccsrc/FbTk/SignalHandler.cc

@@ -46,6 +46,7 @@ // get old signal handler for this signum

if (oldhandler_ret != 0) *oldhandler_ret = s_signal_handler[signum]; +#ifdef HAVE_SIGACTION struct sigaction sa; // set callback sa.sa_handler = SignalHandler::handleSignal;

@@ -54,7 +55,12 @@ sa.sa_flags = 0;

if (sigaction(signum, &sa, 0) == -1) return false; - +#else + // Fallback code for Windows and other platforms lacking sigaction. + if (signal(signum, &SignalHandler::handleSignal) == SIG_ERR) { + return false; + } +#endif s_signal_handler[signum] = eh; return true;
M src/FbTk/Timer.ccsrc/FbTk/Timer.cc

@@ -49,7 +49,9 @@ #else

# include <string.h> #endif -#include <sys/select.h> +#ifdef HAVE_SYS_SELECT_H +# include <sys/select.h> +#endif namespace FbTk {
M src/Makefile.amsrc/Makefile.am

@@ -63,6 +63,7 @@

defaults.cc: force @( \ GITDIR=$(top_srcdir)/.git; \ + echo '// This file is generated from Makefile. Do not edit!'; \ echo '#include "defaults.hh"'; \ echo ''; \ echo 'std::string realProgramName(const std::string& name) {'; \
M src/RootTheme.ccsrc/RootTheme.cc

@@ -40,7 +40,10 @@ #include <X11/Xatom.h>

#include <iostream> #include <sys/types.h> +#ifdef HAVE_SYS_WAIT_H #include <sys/wait.h> +#endif + #ifdef HAVE_CSTRING #include <cstring> #else
M src/fluxbox.ccsrc/fluxbox.cc

@@ -124,7 +124,9 @@ #include <sys/types.h>

#include <sys/stat.h> #endif // HAVE_SYS_STAT_H +#ifdef HAVE_SYS_WAIT_H #include <sys/wait.h> +#endif // HAVE_SYS_WAIT_H #include <iostream> #include <memory>
M src/main.ccsrc/main.cc

@@ -34,6 +34,7 @@ #include "FbTk/Theme.hh"

#include "FbTk/I18n.hh" #include "FbTk/CommandParser.hh" #include "FbTk/FileUtil.hh" +#include "FbTk/StringUtil.hh" //use GNU extensions #ifndef _GNU_SOURCE

@@ -114,22 +115,22 @@ << ": " << endl;

ostr <<_FB_CONSOLETEXT(Common, DefaultMenuFile, " menu", "default menu file (right aligned - make sure same width as other default values)") << ": " - << DEFAULTMENU << endl; + << FbTk::StringUtil::expandFilename(DEFAULTMENU) << endl; ostr << _FB_CONSOLETEXT(Common, DefaultStyle, " style", "default style (right aligned - make sure same width as other default values)") << ": " - << DEFAULTSTYLE << endl; + << FbTk::StringUtil::expandFilename(DEFAULTSTYLE) << endl; ostr << _FB_CONSOLETEXT(Common, DefaultKeyFile, " keys", "default key file (right aligned - make sure same width as other default values)") << ": " - << DEFAULTKEYSFILE << endl; + << FbTk::StringUtil::expandFilename(DEFAULTKEYSFILE) << endl; ostr << _FB_CONSOLETEXT(Common, DefaultInitFile, " init", "default init file (right aligned - make sure same width as other default values)") << ": " - << DEFAULT_INITFILE << endl; + << FbTk::StringUtil::expandFilename(DEFAULT_INITFILE) << endl; #ifdef NLS ostr << _FB_CONSOLETEXT(Common, DefaultLocalePath, " nls", "location for localization files (right aligned - make sure same width as other default values)") << ": " - << LOCALEPATH << endl; + << FbTk::StringUtil::expandFilename(LOCALEPATH) << endl; #endif const char NOT[] = "-";

@@ -220,12 +221,12 @@

const char* env; env = getenv("DISPLAY"); - if (env) { + if (env && strlen(env) > 0) { session_display.assign(env); } env = getenv("HOME"); - if (env) { + if (env && strlen(env) > 0) { rc_path.assign(std::string(env) + "/." + realProgramName("fluxbox")); rc_file = rc_path + "/init"; }

@@ -369,14 +370,15 @@

// copy default files if needed for (size_t i = 0; i < nr_of_cfiles; ++i) { if (cfiles[i].create_file) { - FbTk::FileUtil::copyFile(cfiles[i].default_name, cfiles[i].filename.c_str()); + FbTk::FileUtil::copyFile(FbTk::StringUtil::expandFilename(cfiles[i].default_name).c_str(), cfiles[i].filename.c_str()); sync_fs = true; } } - +#ifdef HAVE_SYNC if (sync_fs) { sync(); } +#endif }

@@ -413,7 +415,9 @@ fbdbg << "running '"

<< commandargs << "' failed." << endl; } +#ifdef HAVE_SYNC sync(); +#endif // HAVE_SYNC } }