From: Dana Jansens Date: Fri, 10 May 2002 02:58:09 +0000 (+0000) Subject: better gcc3 compat. using ostrstream again. and using namespace std; X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=098fae70a6d8d15877938080437f0fc20f52bbf5;p=chaz%2Fopenbox better gcc3 compat. using ostrstream again. and using namespace std; some focus changes. workspace contains a focused window instead of openbox class. this fixes a seg --- diff --git a/configure b/configure index 8710c2bc..aba5e368 100644 --- a/configure +++ b/configure @@ -1226,20 +1226,12 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -ac_ext=C -# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cxx_cross - - for ac_prog in sed do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1243: checking for $ac_word" >&5 +echo "configure:1235: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_regex_cmd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1272,26 +1264,29 @@ if test x$regex_cmd = "x"; then { echo "configure: error: error. sed is required to build the default menu file." 1>&2; exit 1; } fi -echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6 -echo "configure:1277: checking how to run the C++ preprocessor" >&5 -if test -z "$CXXCPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1269: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - ac_ext=C -# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cxx_cross - CXXCPP="${CXX-g++} -E" + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. cat > conftest.$ac_ext < +#include +Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1295: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1290: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1300,36 +1295,70 @@ else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* - CXXCPP=/lib/cpp + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1307: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1324: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp fi rm -f conftest* - ac_cv_prog_CXXCPP="$CXXCPP" -ac_ext=C -# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cxx_cross fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" fi -CXXCPP="$ac_cv_prog_CXXCPP" -echo "$ac_t""$CXXCPP" 1>&6 +echo "$ac_t""$CPP" 1>&6 -for ac_hdr in ctype.h dirent.h fcntl.h libgen.h locale.h nl_types.h process.h signal.h stdarg.h stdio.h string.h stdlib.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 sstream +for ac_hdr in ctype.h dirent.h fcntl.h libgen.h locale.h nl_types.h process.h signal.h stdarg.h stdio.h string.h stdlib.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 do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1323: checking for $ac_hdr" >&5 +echo "configure:1352: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1333: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1362: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1356,12 +1385,12 @@ fi done echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1360: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1389: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1370,7 +1399,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1374: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1403: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1394,20 +1423,17 @@ fi for ac_func in basename do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1398: checking for $ac_func" >&5 +echo "configure:1427: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); @@ -1425,7 +1451,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1447,7 +1473,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for basename in -lgen""... $ac_c" 1>&6 -echo "configure:1451: checking for basename in -lgen" >&5 +echo "configure:1477: checking for basename in -lgen" >&5 ac_lib_var=`echo gen'_'basename | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1455,12 +1481,9 @@ else ac_save_LIBS="$LIBS" LIBS="-lgen $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1498,20 +1521,17 @@ done for ac_func in getpid setlocale sigaction strftime strcasestr snprintf vsnprintf catopen catgets catclose do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1502: checking for $ac_func" >&5 +echo "configure:1525: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); @@ -1529,7 +1549,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1533: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1554,7 +1574,7 @@ fi done echo $ac_n "checking for t_open in -lnsl""... $ac_c" 1>&6 -echo "configure:1558: checking for t_open in -lnsl" >&5 +echo "configure:1578: checking for t_open in -lnsl" >&5 ac_lib_var=`echo nsl'_'t_open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1562,12 +1582,9 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1597: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1597,7 +1614,7 @@ else fi echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:1601: checking for socket in -lsocket" >&5 +echo "configure:1618: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1605,12 +1622,9 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1645,7 +1659,7 @@ fi # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:1649: checking for X" >&5 +echo "configure:1663: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -1707,12 +1721,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1716: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1730: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1781,14 +1795,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1806: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -1894,17 +1908,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:1898: checking whether -R must be followed by a space" >&5 +echo "configure:1912: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1922: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -1920,14 +1934,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -1959,7 +1973,7 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:1963: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:1977: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1967,12 +1981,9 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2003,7 +2014,7 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:2007: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:2018: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2011,12 +2022,9 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2054,20 +2062,17 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:2058: checking for gethostbyname" >&5 +echo "configure:2066: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname(); @@ -2085,7 +2090,7 @@ gethostbyname(); ; return 0; } EOF -if { (eval echo configure:2089: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -2106,7 +2111,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:2110: checking for gethostbyname in -lnsl" >&5 +echo "configure:2115: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2114,12 +2119,9 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2158,20 +2160,17 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:2162: checking for connect" >&5 +echo "configure:2164: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect(); @@ -2189,7 +2188,7 @@ connect(); ; return 0; } EOF -if { (eval echo configure:2193: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -2210,7 +2209,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:2214: checking for connect in -lsocket" >&5 +echo "configure:2213: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2218,12 +2217,9 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2256,20 +2252,17 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:2260: checking for remove" >&5 +echo "configure:2256: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove(); @@ -2287,7 +2280,7 @@ remove(); ; return 0; } EOF -if { (eval echo configure:2291: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -2308,7 +2301,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:2312: checking for remove in -lposix" >&5 +echo "configure:2305: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2316,12 +2309,9 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2354,20 +2344,17 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:2358: checking for shmat" >&5 +echo "configure:2348: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat(); @@ -2385,7 +2372,7 @@ shmat(); ; return 0; } EOF -if { (eval echo configure:2389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2376: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -2406,7 +2393,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:2410: checking for shmat in -lipc" >&5 +echo "configure:2397: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2414,12 +2401,9 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2416: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2461,7 +2445,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:2465: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:2449: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2469,12 +2453,9 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2519,7 +2500,7 @@ LIBS="$LIBS $X_LIBS" LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS" echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6 -echo "configure:2523: checking for XOpenDisplay in -lX11" >&5 +echo "configure:2504: checking for XOpenDisplay in -lX11" >&5 ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2527,12 +2508,9 @@ else ac_save_LIBS="$LIBS" LIBS="-lX11 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2570,7 +2548,7 @@ Xext_lib="" SHAPE="" echo $ac_n "checking whether to build support for the XShape extension""... $ac_c" 1>&6 -echo "configure:2574: checking whether to build support for the XShape extension" >&5 +echo "configure:2552: checking whether to build support for the XShape extension" >&5 # Check whether --enable-shape or --disable-shape was given. if test "${enable_shape+set}" = set; then enableval="$enable_shape" @@ -2582,7 +2560,7 @@ fi if test x$enableval = "xyes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for XShapeCombineShape in -lXext""... $ac_c" 1>&6 -echo "configure:2586: checking for XShapeCombineShape in -lXext" >&5 +echo "configure:2564: checking for XShapeCombineShape in -lXext" >&5 ac_lib_var=`echo Xext'_'XShapeCombineShape | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2590,12 +2568,9 @@ else ac_save_LIBS="$LIBS" LIBS="-lXext $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2583: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2620,9 +2595,9 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for X11/extensions/shape.h""... $ac_c" 1>&6 -echo "configure:2624: checking for X11/extensions/shape.h" >&5 +echo "configure:2599: checking for X11/extensions/shape.h" >&5 cat > conftest.$ac_ext < #include @@ -2632,7 +2607,7 @@ int main() { long foo = ShapeSet ; return 0; } EOF -if { (eval echo configure:2636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 SHAPE="-DSHAPE"; Xext_lib="-lXext" @@ -2658,7 +2633,7 @@ LIBS="$LIBS $Xext_lib" SLIT="" echo $ac_n "checking whether to include the Slit""... $ac_c" 1>&6 -echo "configure:2662: checking whether to include the Slit" >&5 +echo "configure:2637: checking whether to include the Slit" >&5 # Check whether --enable-slit or --disable-slit was given. if test "${enable_slit+set}" = set; then enableval="$enable_slit" @@ -2678,7 +2653,7 @@ fi NEWWMSPEC="" echo $ac_n "checking whether to include the new WM Spec (DOES NOTHING)""... $ac_c" 1>&6 -echo "configure:2682: checking whether to include the new WM Spec (DOES NOTHING)" >&5 +echo "configure:2657: checking whether to include the new WM Spec (DOES NOTHING)" >&5 # Check whether --enable-newspec or --disable-newspec was given. if test "${enable_newspec+set}" = set; then enableval="$enable_newspec" @@ -2698,7 +2673,7 @@ fi INTERLACE="" echo $ac_n "checking whether to include interlacing image code""... $ac_c" 1>&6 -echo "configure:2702: checking whether to include interlacing image code" >&5 +echo "configure:2677: checking whether to include interlacing image code" >&5 # Check whether --enable-interlace or --disable-interlace was given. if test "${enable_interlace+set}" = set; then enableval="$enable_interlace" @@ -2718,7 +2693,7 @@ fi ORDEREDPSEUDO="" echo $ac_n "checking whether to include Pseudocolor ordered dithering code""... $ac_c" 1>&6 -echo "configure:2722: checking whether to include Pseudocolor ordered dithering code" >&5 +echo "configure:2697: checking whether to include Pseudocolor ordered dithering code" >&5 # Check whether --enable-ordered-pseudo or --disable-ordered-pseudo was given. if test "${enable_ordered_pseudo+set}" = set; then enableval="$enable_ordered_pseudo" @@ -2737,7 +2712,7 @@ fi CLOBBER="" echo $ac_n "checking whether to intercept mouse events to clients""... $ac_c" 1>&6 -echo "configure:2741: checking whether to intercept mouse events to clients" >&5 +echo "configure:2716: checking whether to intercept mouse events to clients" >&5 # Check whether --enable-clobber or --disable-clobber was given. if test "${enable_clobber+set}" = set; then enableval="$enable_clobber" @@ -2756,7 +2731,7 @@ fi DEBUG="" echo $ac_n "checking whether to include verbose debugging code""... $ac_c" 1>&6 -echo "configure:2760: checking whether to include verbose debugging code" >&5 +echo "configure:2735: checking whether to include verbose debugging code" >&5 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" @@ -2775,7 +2750,7 @@ fi NLS="" echo $ac_n "checking whether to include NLS support""... $ac_c" 1>&6 -echo "configure:2779: checking whether to include NLS support" >&5 +echo "configure:2754: checking whether to include NLS support" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -2794,7 +2769,7 @@ fi echo $ac_n "checking for setlocale in -lxpg4""... $ac_c" 1>&6 -echo "configure:2798: checking for setlocale in -lxpg4" >&5 +echo "configure:2773: checking for setlocale in -lxpg4" >&5 ac_lib_var=`echo xpg4'_'setlocale | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2802,12 +2777,9 @@ else ac_save_LIBS="$LIBS" LIBS="-lxpg4 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2842,7 +2814,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2846: checking for $ac_word" >&5 +echo "configure:2818: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gencat_cmd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2878,7 +2850,7 @@ fi TIMEDCACHE="" echo $ac_n "checking whether to use the new timed pixmap cache""... $ac_c" 1>&6 -echo "configure:2882: checking whether to use the new timed pixmap cache" >&5 +echo "configure:2854: checking whether to use the new timed pixmap cache" >&5 # Check whether --enable-timed-cache or --disable-timed-cache was given. if test "${enable_timed_cache+set}" = set; then enableval="$enable_timed_cache" @@ -2897,12 +2869,12 @@ fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2901: checking return type of signal handlers" >&5 +echo "configure:2873: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2919,7 +2891,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:2923: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2895: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2939,7 +2911,7 @@ EOF echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:2943: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:2915: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -3143,7 +3115,7 @@ s%@SET_MAKE@%$SET_MAKE%g s%@CC@%$CC%g s%@CXX@%$CXX%g s%@regex_cmd@%$regex_cmd%g -s%@CXXCPP@%$CXXCPP%g +s%@CPP@%$CPP%g s%@X_CFLAGS@%$X_CFLAGS%g s%@X_PRE_LIBS@%$X_PRE_LIBS%g s%@X_LIBS@%$X_LIBS%g diff --git a/configure.in b/configure.in index f8bf80d3..f37715db 100644 --- a/configure.in +++ b/configure.in @@ -15,15 +15,13 @@ AC_PROG_CC AC_PROG_CXX AC_PROG_INSTALL -AC_LANG_CPLUSPLUS - AC_CHECK_PROGS(regex_cmd, sed) if test x$regex_cmd = "x"; then AC_MSG_ERROR([error. sed is required to build the default menu file.]) fi dnl Check for system header files -AC_CHECK_HEADERS(ctype.h dirent.h fcntl.h libgen.h locale.h nl_types.h process.h signal.h stdarg.h stdio.h string.h stdlib.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 sstream) +AC_CHECK_HEADERS(ctype.h dirent.h fcntl.h libgen.h locale.h nl_types.h process.h signal.h stdarg.h stdio.h string.h stdlib.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 dnl Check for existance of basename(), setlocale() and strftime() diff --git a/src/Configmenu.cc b/src/Configmenu.cc index ffb5d6e3..b8aef8ce 100644 --- a/src/Configmenu.cc +++ b/src/Configmenu.cc @@ -185,14 +185,14 @@ void Configmenu::Focusmenu::itemSelected(int button, int index) { configmenu->screen.setSloppyFocus(false); configmenu->screen.setAutoRaise(false); - if (! configmenu->screen.getOpenbox().getFocusedWindow()) + if (! configmenu->screen.getOpenbox().focusedWindow()) XSetInputFocus(configmenu->screen.getOpenbox().getXDisplay(), configmenu->screen.getToolbar()->getWindowID(), RevertToParent, CurrentTime); else XSetInputFocus(configmenu->screen.getOpenbox().getXDisplay(), configmenu->screen.getOpenbox(). - getFocusedWindow()->getClientWindow(), + focusedWindow()->getClientWindow(), RevertToParent, CurrentTime); configmenu->screen.reconfigure(); diff --git a/src/Screen.cc b/src/Screen.cc index c5378d4f..3e7df54b 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -32,6 +32,7 @@ #include #include +#include #include "i18n.h" #include "openbox.h" @@ -100,11 +101,10 @@ #define FONT_ELEMENT_SIZE 50 #endif // FONT_ELEMENT_SIZE -#ifdef HAVE_SSTREAM -# include -#endif // HAVE_SSTREAM +#include #include #include +using namespace std; static Bool running = True; @@ -699,7 +699,7 @@ void BScreen::readDatabaseTexture(const char *rname, const char *rclass, BTexture *texture, unsigned long default_pixel) { - std::string s; + string s; if (resource.styleconfig.getValue(rname, rclass, s)) image_control->parseTexture(texture, s.c_str()); @@ -796,7 +796,7 @@ void BScreen::readDatabaseTexture(const char *rname, const char *rclass, void BScreen::readDatabaseColor(const char *rname, const char *rclass, BColor *color, unsigned long default_pixel) { - std::string s; + string s; if (resource.styleconfig.getValue(rname, rclass, s)) image_control->parseColor(color, s.c_str()); @@ -815,7 +815,7 @@ void BScreen::readDatabaseFontSet(const char *rname, const char *rclass, static char *defaultFont = "fixed"; bool load_default = false; - std::string s; + string s; if (*fontset) XFreeFontSet(getBaseDisplay().getXDisplay(), *fontset); @@ -844,7 +844,7 @@ void BScreen::readDatabaseFont(const char *rname, const char *rclass, static char *defaultFont = "fixed"; bool load_default = false; - std::string s; + string s; if (*font) XFreeFont(getBaseDisplay().getXDisplay(), *font); @@ -932,92 +932,98 @@ XFontSet BScreen::createFontSet(const char *fontname) { void BScreen::setSloppyFocus(bool b) { resource.sloppy_focus = b; - std::ostringstream s; - s << "session.screen" << getScreenNumber() << ".focusModel"; + ostrstream s; + s << "session.screen" << getScreenNumber() << ".focusModel" << ends; config.setValue(s.str(), (resource.sloppy_focus ? (resource.auto_raise ? "AutoRaiseSloppyFocus" : "SloppyFocus") : "ClickToFocus")); + s.rdbuf()->freeze(0); } void BScreen::setAutoRaise(bool a) { resource.auto_raise = a; - std::ostringstream s; - s << "session.screen" << getScreenNumber() << ".focusModel"; + ostrstream s; + s << "session.screen" << getScreenNumber() << ".focusModel" << ends; config.setValue(s.str(), (resource.sloppy_focus ? (resource.auto_raise ? "AutoRaiseSloppyFocus" : "SloppyFocus") : "ClickToFocus")); + s.rdbuf()->freeze(0); } void BScreen::setImageDither(bool d, bool reconfig) { resource.image_dither = d; image_control->setDither(d); - std::ostringstream s; - s << "session.screen" << getScreenNumber() << ".imageDither"; + ostrstream s; + s << "session.screen" << getScreenNumber() << ".imageDither" << ends; config.setValue(s.str(), resource.image_dither); if (reconfig) reconfigure(); + s.rdbuf()->freeze(0); } void BScreen::setOpaqueMove(bool o) { resource.opaque_move = o; - std::ostringstream s; - s << "session.screen" << getScreenNumber() << ".opaqueMove"; + ostrstream s; + s << "session.screen" << getScreenNumber() << ".opaqueMove" << ends; config.setValue(s.str(), resource.opaque_move); + s.rdbuf()->freeze(0); } void BScreen::setFullMax(bool f) { resource.full_max = f; - std::ostringstream s; - s << "session.screen" << getScreenNumber() << ".fullMaximization"; + ostrstream s; + s << "session.screen" << getScreenNumber() << ".fullMaximization" << ends; config.setValue(s.str(), resource.full_max); -#ifndef HAVE_SSTREAM s.rdbuf()->freeze(0); -#endif // HAVE_SSTREAM } void BScreen::setFocusNew(bool f) { resource.focus_new = f; - std::ostringstream s; - s << "session.screen" << getScreenNumber() << ".focusNewWindows"; + ostrstream s; + s << "session.screen" << getScreenNumber() << ".focusNewWindows" << ends; config.setValue(s.str(), resource.focus_new); + s.rdbuf()->freeze(0); } void BScreen::setFocusLast(bool f) { resource.focus_last = f; - std::ostringstream s; - s << "session.screen" << getScreenNumber() << ".focusLastWindow"; + ostrstream s; + s << "session.screen" << getScreenNumber() << ".focusLastWindow" << ends; config.setValue(s.str(), resource.focus_last); + s.rdbuf()->freeze(0); } void BScreen::setWindowZones(int z) { resource.zones = z; - std::ostringstream s; - s << "session.screen" << getScreenNumber() << ".windowZones"; + ostrstream s; + s << "session.screen" << getScreenNumber() << ".windowZones" << ends; config.setValue(s.str(), resource.zones); + s.rdbuf()->freeze(0); } void BScreen::setWorkspaceCount(int w) { resource.workspaces = w; - std::ostringstream s; - s << "session.screen" << getScreenNumber() << ".workspaces"; + ostrstream s; + s << "session.screen" << getScreenNumber() << ".workspaces" << ends; config.setValue(s.str(), resource.workspaces); + s.rdbuf()->freeze(0); } void BScreen::setPlacementPolicy(int p) { resource.placement_policy = p; - std::ostringstream s; - s << "session.screen" << getScreenNumber() << ".windowPlacement"; + ostrstream s; + s << "session.screen" << getScreenNumber() << ".windowPlacement" << ends; const char *placement; switch (resource.placement_policy) { case CascadePlacement: placement = "CascadePlacement"; break; @@ -1029,34 +1035,38 @@ void BScreen::setPlacementPolicy(int p) { case RowSmartPlacement: placement = "RowSmartPlacement"; break; } config.setValue(s.str(), placement); + s.rdbuf()->freeze(0); } void BScreen::setEdgeSnapThreshold(int t) { resource.edge_snap_threshold = t; - std::ostringstream s; - s << "session.screen" << getScreenNumber() << ".edgeSnapThreshold"; + ostrstream s; + s << "session.screen" << getScreenNumber() << ".edgeSnapThreshold" << ends; config.setValue(s.str(), resource.edge_snap_threshold); + s.rdbuf()->freeze(0); } void BScreen::setRowPlacementDirection(int d) { resource.row_direction = d; - std::ostringstream s; - s << "session.screen" << getScreenNumber() << ".rowPlacementDirection"; + ostrstream s; + s << "session.screen" << getScreenNumber() << ".rowPlacementDirection" << ends; config.setValue(s.str(), resource.row_direction == LeftRight ? "LeftToRight" : "RightToLeft"); + s.rdbuf()->freeze(0); } void BScreen::setColPlacementDirection(int d) { resource.col_direction = d; - std::ostringstream s; - s << "session.screen" << getScreenNumber() << ".colPlacementDirection"; + ostrstream s; + s << "session.screen" << getScreenNumber() << ".colPlacementDirection" << ends; config.setValue(s.str(), resource.col_direction == TopBottom ? "TopToBottom" : "BottomToTop"); + s.rdbuf()->freeze(0); } @@ -1079,25 +1089,28 @@ void BScreen::setStrftimeFormat(const char *f) { delete [] resource.strftime_format; resource.strftime_format = bstrdup(f); - std::ostringstream s; - s << "session.screen" << getScreenNumber() << ".strftimeFormat"; + ostrstream s; + s << "session.screen" << getScreenNumber() << ".strftimeFormat" << ends; config.setValue(s.str(), resource.strftime_format); + s.rdbuf()->freeze(0); } #else // !HAVE_STRFTIME void BScreen::setDateFormat(int f) { resource.date_format = f; - std::ostringstream s; - s << "session.screen" << getScreenNumber() << ".dateFormat"; + ostrstream s; + s << "session.screen" << getScreenNumber() << ".dateFormat" << ends; config.setValue(s.str(), resource.date_format == B_EuropeanDate ? "European" : "American"); + s.rdbuf()->freeze(0); } void BScreen::setClock24Hour(Bool c) { resource.clock24hour = c; - std::ostringstream s; - s << "session.screen" << getScreenNumber() << ".clockFormat"; + ostrstream s; + s << "session.screen" << getScreenNumber() << ".clockFormat" << ends; config.setValue(s.str(), resource.clock24hour ? 24 : 12); + s.rdbuf()->freeze(0); } #endif // HAVE_STRFTIME @@ -1107,13 +1120,14 @@ void BScreen::setHideToolbar(bool b) { getToolbar()->unMapToolbar(); else getToolbar()->mapToolbar(); - std::ostringstream s; - s << "session.screen" << getScreenNumber() << ".hideToolbar"; + ostrstream s; + s << "session.screen" << getScreenNumber() << ".hideToolbar" << ends; config.setValue(s.str(), resource.hide_toolbar ? "True" : "False"); + s.rdbuf()->freeze(0); } void BScreen::saveWorkspaceNames() { - std::ostringstream rc, names; + ostrstream rc, names; for (int i = 0; i < resource.workspaces; i++) { Workspace *w = getWorkspace(i); @@ -1123,10 +1137,12 @@ void BScreen::saveWorkspaceNames() { names << ','; } } - names; + names << ends; - rc << "session.screen" << getScreenNumber() << ".workspaceNames"; + rc << "session.screen" << getScreenNumber() << ".workspaceNames" << ends; config.setValue(rc.str(), names.str()); + rc.rdbuf()->freeze(0); + names.rdbuf()->freeze(0); } void BScreen::save() { @@ -1147,7 +1163,7 @@ void BScreen::save() { #ifdef HAVE_STRFTIME // it deletes the current value before setting the new one, so we have to // duplicate the current value. - std::string s = resource.strftime_format; + string s = resource.strftime_format; setStrftimeFormat(s.c_str()); #else // !HAVE_STRFTIME setDateFormat(resource.date_format); @@ -1157,14 +1173,14 @@ void BScreen::save() { } void BScreen::load() { - std::ostringstream rscreen, rname, rclass; - std::string s; + ostrstream rscreen, rname, rclass; + string s; bool b; long l; - rscreen << "session.screen" << getScreenNumber() << '.'; + rscreen << "session.screen" << getScreenNumber() << '.' << ends; - rname << rscreen.str() << "hideToolbar"; - rclass << rscreen.str() << "HideToolbar"; + rname << rscreen.str() << "hideToolbar" << ends; + rclass << rscreen.str() << "HideToolbar" << ends; if (config.getValue(rname.str(), rclass.str(), b)) resource.hide_toolbar = b; else @@ -1178,32 +1194,32 @@ void BScreen::load() { } rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "fullMaximization"; - rclass << rscreen.str() << "FullMaximization"; + rname << rscreen.str() << "fullMaximization" << ends; + rclass << rscreen.str() << "FullMaximization" << ends; if (config.getValue(rname.str(), rclass.str(), b)) resource.full_max = b; else resource.full_max = false; rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "focusNewWindows"; - rclass << rscreen.str() << "FocusNewWindows"; + rname << rscreen.str() << "focusNewWindows" << ends; + rclass << rscreen.str() << "FocusNewWindows" << ends; if (config.getValue(rname.str(), rclass.str(), b)) resource.focus_new = b; else resource.focus_new = false; rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "focusLastWindow"; - rclass << rscreen.str() << "FocusLastWindow"; + rname << rscreen.str() << "focusLastWindow" << ends; + rclass << rscreen.str() << "FocusLastWindow" << ends; if (config.getValue(rname.str(), rclass.str(), b)) resource.focus_last = b; else resource.focus_last = false; rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "rowPlacementDirection"; - rclass << rscreen.str() << "RowPlacementDirection"; + rname << rscreen.str() << "rowPlacementDirection" << ends; + rclass << rscreen.str() << "RowPlacementDirection" << ends; if (config.getValue(rname.str(), rclass.str(), s)) { if (0 == strncasecmp(s.c_str(), "RightToLeft", s.length())) resource.row_direction = RightLeft; @@ -1213,8 +1229,8 @@ void BScreen::load() { resource.row_direction = LeftRight; rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "colPlacementDirection"; - rclass << rscreen.str() << "ColPlacementDirection"; + rname << rscreen.str() << "colPlacementDirection" << ends; + rclass << rscreen.str() << "ColPlacementDirection" << ends; if (config.getValue(rname.str(), rclass.str(), s)) { if (0 == strncasecmp(s.c_str(), "BottomToTop", s.length())) resource.col_direction = BottomTop; @@ -1224,8 +1240,8 @@ void BScreen::load() { resource.col_direction = TopBottom; rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "workspaces"; - rclass << rscreen.str() << "Workspaces"; + rname << rscreen.str() << "workspaces" << ends; + rclass << rscreen.str() << "Workspaces" << ends; if (config.getValue(rname.str(), rclass.str(), l)) resource.workspaces = l; else @@ -1233,14 +1249,14 @@ void BScreen::load() { removeWorkspaceNames(); rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "workspaceNames"; - rclass << rscreen.str() << "WorkspaceNames"; + rname << rscreen.str() << "workspaceNames" << ends; + rclass << rscreen.str() << "WorkspaceNames" << ends; if (config.getValue(rname.str(), rclass.str(), s)) { - std::string::const_iterator it = s.begin(), end = s.end(); + string::const_iterator it = s.begin(), end = s.end(); while(1) { - std::string::const_iterator tmp = it;// current string.begin() + string::const_iterator tmp = it;// current string.begin() it = std::find(tmp, end, ','); // look for comma between tmp and end - std::string name(tmp, it); // name = s[tmp:it] + string name(tmp, it); // name = s[tmp:it] addWorkspaceName(name.c_str()); if (it == end) break; @@ -1249,8 +1265,8 @@ void BScreen::load() { } rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "focusModel"; - rclass << rscreen.str() << "FocusModel"; + rname << rscreen.str() << "focusModel" << ends; + rclass << rscreen.str() << "FocusModel" << ends; if (config.getValue(rname.str(), rclass.str(), s)) { if (0 == strncasecmp(s.c_str(), "ClickToFocus", s.length())) { resource.auto_raise = false; @@ -1269,16 +1285,16 @@ void BScreen::load() { } rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "windowZones"; - rclass << rscreen.str() << "WindowZones"; + rname << rscreen.str() << "windowZones" << ends; + rclass << rscreen.str() << "WindowZones" << ends; if (config.getValue(rname.str(), rclass.str(), l)) resource.zones = (l == 1 || l == 2 || l == 4) ? l : 1; else resource.zones = 4; rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "windowPlacement"; - rclass << rscreen.str() << "WindowPlacement"; + rname << rscreen.str() << "windowPlacement" << ends; + rclass << rscreen.str() << "WindowPlacement" << ends; if (config.getValue(rname.str(), rclass.str(), s)) { if (0 == strncasecmp(s.c_str(), "RowSmartPlacement", s.length())) resource.placement_policy = RowSmartPlacement; @@ -1297,8 +1313,8 @@ void BScreen::load() { #ifdef HAVE_STRFTIME rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "strftimeFormat"; - rclass << rscreen.str() << "StrftimeFormat"; + rname << rscreen.str() << "strftimeFormat" << ends; + rclass << rscreen.str() << "StrftimeFormat" << ends; if (resource.strftime_format != NULL) delete [] resource.strftime_format; @@ -1309,8 +1325,8 @@ void BScreen::load() { resource.strftime_format = bstrdup("%I:%M %p"); #else // !HAVE_STRFTIME rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "dateFormat"; - rclass << rscreen.str() << "DateFormat"; + rname << rscreen.str() << "dateFormat" << ends; + rclass << rscreen.str() << "DateFormat" << ends; if (config.getValue(rname.str(), rclass.str(), s)) { if (strncasecmp(s.c_str(), "European", s.length())) resource.date_format = B_EuropeanDate; @@ -1320,8 +1336,8 @@ void BScreen::load() { resource.date_format = B_AmericanDate; rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "clockFormat"; - rclass << rscreen.str() << "ClockFormat"; + rname << rscreen.str() << "clockFormat" << ends; + rclass << rscreen.str() << "ClockFormat" << ends; if (config.getValue(rname.str(), rclass.str(), l)) { if (clock == 24) resource.clock24hour = true; @@ -1332,24 +1348,24 @@ void BScreen::load() { #endif // HAVE_STRFTIME rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "edgeSnapThreshold"; - rclass << rscreen.str() << "EdgeSnapThreshold"; + rname << rscreen.str() << "edgeSnapThreshold" << ends; + rclass << rscreen.str() << "EdgeSnapThreshold" << ends; if (config.getValue(rname.str(), rclass.str(), l)) resource.edge_snap_threshold = l; else resource.edge_snap_threshold = 4; rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "imageDither"; - rclass << rscreen.str() << "ImageDither"; + rname << rscreen.str() << "imageDither" << ends; + rclass << rscreen.str() << "ImageDither" << ends; if (config.getValue(rname.str(), rclass.str(), b)) resource.image_dither = b; else resource.image_dither = true; rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "rootCommand"; - rclass << rscreen.str() << "RootCommand"; + rname << rscreen.str() << "rootCommand" << ends; + rclass << rscreen.str() << "RootCommand" << ends; if (resource.root_command != NULL) delete [] resource.root_command; @@ -1360,12 +1376,16 @@ void BScreen::load() { resource.root_command = NULL; rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "opaqueMove"; - rclass << rscreen.str() << "OpaqueMove"; + rname << rscreen.str() << "opaqueMove" << ends; + rclass << rscreen.str() << "OpaqueMove" << ends; if (config.getValue(rname.str(), rclass.str(), b)) resource.opaque_move = b; else resource.opaque_move = false; + + rscreen.rdbuf()->freeze(0); + rname.rdbuf()->freeze(0); + rclass.rdbuf()->freeze(0); } void BScreen::reconfigure(void) { @@ -1565,7 +1585,7 @@ void BScreen::LoadStyle(void) { } } - std::string s; + string s; long l; // load fonts/fontsets @@ -1949,11 +1969,11 @@ void BScreen::changeWorkspaceID(int id) { workspacemenu->setItemSelected(current_workspace->getWorkspaceID() + 2, False); - if (openbox.getFocusedWindow() && - openbox.getFocusedWindow()->getScreen() == this && - (! openbox.getFocusedWindow()->isStuck())) { - current_workspace->setLastFocusedWindow(openbox.getFocusedWindow()); - openbox.setFocusedWindow(NULL); + if (openbox.focusedWindow() && + openbox.focusedWindow()->getScreen() == this && + (! openbox.focusedWindow()->isStuck())) { + current_workspace->setLastFocusedWindow(openbox.focusedWindow()); + openbox.focusWindow((OpenboxWindow *) 0); } current_workspace = getWorkspace(id); @@ -1987,8 +2007,8 @@ void BScreen::addNetizen(Netizen *n) { w->getWorkspaceID()); } - Window f = ((openbox.getFocusedWindow()) ? - openbox.getFocusedWindow()->getClientWindow() : None); + Window f = ((openbox.focusedWindow()) ? + openbox.focusedWindow()->getClientWindow() : None); n->sendWindowFocus(f); } @@ -2022,8 +2042,8 @@ void BScreen::updateNetizenWorkspaceCount(void) { void BScreen::updateNetizenWindowFocus(void) { - Window f = ((openbox.getFocusedWindow()) ? - openbox.getFocusedWindow()->getClientWindow() : None); + Window f = ((openbox.focusedWindow()) ? + openbox.focusedWindow()->getClientWindow() : None); LinkedListIterator it(netizenList); for (Netizen *n = it.current(); n; it++, n = it.current()) n->sendWindowFocus(f); @@ -2156,11 +2176,11 @@ void BScreen::nextFocus(void) { int focused_window_number = -1; OpenboxWindow *next; - if (openbox.getFocusedWindow()) { - if (openbox.getFocusedWindow()->getScreen()->getScreenNumber() == + if (openbox.focusedWindow()) { + if (openbox.focusedWindow()->getScreen()->getScreenNumber() == getScreenNumber()) { have_focused = True; - focused_window_number = openbox.getFocusedWindow()->getWindowNumber(); + focused_window_number = openbox.focusedWindow()->getWindowNumber(); } } @@ -2190,11 +2210,11 @@ void BScreen::prevFocus(void) { int focused_window_number = -1; OpenboxWindow *prev; - if (openbox.getFocusedWindow()) { - if (openbox.getFocusedWindow()->getScreen()->getScreenNumber() == + if (openbox.focusedWindow()) { + if (openbox.focusedWindow()->getScreen()->getScreenNumber() == getScreenNumber()) { have_focused = True; - focused_window_number = openbox.getFocusedWindow()->getWindowNumber(); + focused_window_number = openbox.focusedWindow()->getWindowNumber(); } } @@ -2223,17 +2243,17 @@ void BScreen::raiseFocus(void) { Bool have_focused = False; int focused_window_number = -1; - if (openbox.getFocusedWindow()) { - if (openbox.getFocusedWindow()->getScreen()->getScreenNumber() == + if (openbox.focusedWindow()) { + if (openbox.focusedWindow()->getScreen()->getScreenNumber() == getScreenNumber()) { have_focused = True; - focused_window_number = openbox.getFocusedWindow()->getWindowNumber(); + focused_window_number = openbox.focusedWindow()->getWindowNumber(); } } if ((getCurrentWorkspace()->getCount() > 1) && have_focused) - getWorkspace(openbox.getFocusedWindow()->getWorkspaceNumber())-> - raiseWindow(openbox.getFocusedWindow()); + getWorkspace(openbox.focusedWindow()->getWorkspaceNumber())-> + raiseWindow(openbox.focusedWindow()); } @@ -2643,7 +2663,7 @@ Bool BScreen::parseMenuFile(FILE *file, Rootmenu *menu) { closedir(d); - std::sort(ls, ls + entries, dcmp()); + std::sort(ls, ls + entries, dcmp()); int n, slen = strlen(stylesdir); for (n = 0; n < entries; n++) { diff --git a/src/Slit.cc b/src/Slit.cc index 9e9073d6..bbaeb1f1 100644 --- a/src/Slit.cc +++ b/src/Slit.cc @@ -41,11 +41,9 @@ #include "Slit.h" #include "Toolbar.h" -#ifdef HAVE_SSTREAM -# include -#endif // HAVE_SSTREAM - +#include #include +using namespace std; Slit::Slit(BScreen &scr, Resource &conf) : screen(scr), openbox(scr.getOpenbox()), config(conf) @@ -214,22 +212,25 @@ void Slit::removeClient(Window w, Bool remap) { void Slit::setOnTop(bool b) { m_ontop = b; - std::ostringstream s; - s << "session.screen" << screen.getScreenNumber() << ".slit.onTop"; + ostrstream s; + s << "session.screen" << screen.getScreenNumber() << ".slit.onTop" << ends; config.setValue(s.str(), m_ontop ? "True" : "False"); + s.rdbuf()->freeze(0); } void Slit::setAutoHide(bool b) { m_autohide = b; - std::ostringstream s; - s << "session.screen" << screen.getScreenNumber() << ".slit.autoHide"; + ostrstream s; + s << "session.screen" << screen.getScreenNumber() << ".slit.autoHide" << ends; config.setValue(s.str(), m_autohide ? "True" : "False"); + s.rdbuf()->freeze(0); } void Slit::setPlacement(int p) { m_placement = p; - std::ostringstream s; - s << "session.screen" << screen.getScreenNumber() << ".slit.placement"; + ostrstream s; + s << "session.screen" << screen.getScreenNumber() << ".slit.placement" + << ends; const char *placement; switch (m_placement) { case TopLeft: placement = "TopLeft"; break; @@ -242,14 +243,17 @@ void Slit::setPlacement(int p) { case CenterRight: default: placement = "CenterRight"; break; } config.setValue(s.str(), placement); + s.rdbuf()->freeze(0); } void Slit::setDirection(int d) { m_direction = d; - std::ostringstream s; - s << "session.screen" << screen.getScreenNumber() << ".slit.direction"; + ostrstream s; + s << "session.screen" << screen.getScreenNumber() << ".slit.direction" + << ends; config.setValue(s.str(), m_direction == Horizontal ? "Horizontal" : "Vertical"); + s.rdbuf()->freeze(0); } void Slit::save() { @@ -260,13 +264,13 @@ void Slit::save() { } void Slit::load() { - std::ostringstream rscreen, rname, rclass; - std::string s; + ostrstream rscreen, rname, rclass; + string s; bool b; - rscreen << "session.screen" << screen.getScreenNumber() << '.'; + rscreen << "session.screen" << screen.getScreenNumber() << '.' << ends; - rname << rscreen.str() << "slit.placement"; - rclass << rscreen.str() << "Slit.Placement"; + rname << rscreen.str() << "slit.placement" << ends; + rclass << rscreen.str() << "Slit.Placement" << ends; if (config.getValue(rname.str(), rclass.str(), s)) { if (0 == strncasecmp(s.c_str(), "TopLeft", s.length())) m_placement = TopLeft; @@ -288,8 +292,8 @@ void Slit::load() { m_placement = CenterRight; rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "slit.direction"; - rclass << rscreen.str() << "Slit.Direction"; + rname << rscreen.str() << "slit.direction" << ends; + rclass << rscreen.str() << "Slit.Direction" << ends; if (config.getValue(rname.str(), rclass.str(), s)) { if (0 == strncasecmp(s.c_str(), "Horizontal", s.length())) m_direction = Horizontal; @@ -299,20 +303,24 @@ void Slit::load() { m_direction = Vertical; rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "slit.onTop"; - rclass << rscreen.str() << "Slit.OnTop"; + rname << rscreen.str() << "slit.onTop" << ends; + rclass << rscreen.str() << "Slit.OnTop" << ends; if (config.getValue(rname.str(), rclass.str(), b)) m_ontop = b; else m_ontop = false; rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "slit.autoHide"; - rclass << rscreen.str() << "Slit.AutoHide"; + rname << rscreen.str() << "slit.autoHide" << ends; + rclass << rscreen.str() << "Slit.AutoHide" << ends; if (config.getValue(rname.str(), rclass.str(), b)) m_hidden = m_autohide = b; else m_hidden = m_autohide = false; + + rscreen.rdbuf()->freeze(0); + rname.rdbuf()->freeze(0); + rclass.rdbuf()->freeze(0); } void Slit::reconfigure(void) { diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 59b92ee1..44a0059f 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -62,11 +62,9 @@ # endif // HAVE_SYS_TIME_H #endif // TIME_WITH_SYS_TIME -#ifdef HAVE_SSTREAM -# include -#endif // HAVE_SSTREAM - +#include #include +using namespace std; Toolbar::Toolbar(BScreen &scrn, Resource &conf) : screen(scrn), openbox(scrn.getOpenbox()), config(conf) @@ -217,30 +215,35 @@ Toolbar::~Toolbar() { void Toolbar::setOnTop(bool b) { m_ontop = b; - std::ostringstream s; - s << "session.screen" << screen.getScreenNumber() << ".toolbar.onTop"; + ostrstream s; + s << "session.screen" << screen.getScreenNumber() << ".toolbar.onTop" << ends; config.setValue(s.str(), m_ontop ? "True" : "False"); + s.rdbuf()->freeze(0); } void Toolbar::setAutoHide(bool b) { m_autohide = b; - std::ostringstream s; - s << "session.screen" << screen.getScreenNumber() << ".toolbar.autoHide"; + ostrstream s; + s << "session.screen" << screen.getScreenNumber() << ".toolbar.autoHide" + << ends; config.setValue(s.str(), m_autohide ? "True" : "False"); + s.rdbuf()->freeze(0); } void Toolbar::setWidthPercent(int w) { m_width_percent = w; - std::ostringstream s; + ostrstream s; s << "session.screen" << screen.getScreenNumber() << ".toolbar.widthPercent" - ; + << ends; config.setValue(s.str(), m_width_percent); + s.rdbuf()->freeze(0); } void Toolbar::setPlacement(int p) { m_placement = p; - std::ostringstream s; - s << "session.screen" << screen.getScreenNumber() << ".toolbar.placement"; + ostrstream s; + s << "session.screen" << screen.getScreenNumber() << ".toolbar.placement" + << ends; const char *placement; switch (m_placement) { case TopLeft: placement = "TopLeft"; break; @@ -251,6 +254,7 @@ void Toolbar::setPlacement(int p) { case BottomCenter: default: placement = "BottomCenter"; break; } config.setValue(s.str(), placement); + s.rdbuf()->freeze(0); } void Toolbar::save() { @@ -261,22 +265,22 @@ void Toolbar::save() { } void Toolbar::load() { - std::ostringstream rscreen, rname, rclass; - std::string s; + ostrstream rscreen, rname, rclass; + string s; bool b; long l; - rscreen << "session.screen" << screen.getScreenNumber() << '.'; + rscreen << "session.screen" << screen.getScreenNumber() << '.' << ends; - rname << rscreen.str() << "toolbar.widthPercent"; - rclass << rscreen.str() << "Toolbar.WidthPercent"; + rname << rscreen.str() << "toolbar.widthPercent" << ends; + rclass << rscreen.str() << "Toolbar.WidthPercent" << ends; if (config.getValue(rname.str(), rclass.str(), l) && (l > 0 && l <= 100)) m_width_percent = l; else m_width_percent =66; rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "toolbar.placement"; - rclass << rscreen.str() << "Toolbar.Placement"; + rname << rscreen.str() << "toolbar.placement" << ends; + rclass << rscreen.str() << "Toolbar.Placement" << ends; if (config.getValue(rname.str(), rclass.str(), s)) { if (0 == strncasecmp(s.c_str(), "TopLeft", s.length())) m_placement = TopLeft; @@ -294,20 +298,24 @@ void Toolbar::load() { m_placement = BottomCenter; rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "toolbar.onTop"; - rclass << rscreen.str() << "Toolbar.OnTop"; + rname << rscreen.str() << "toolbar.onTop" << ends; + rclass << rscreen.str() << "Toolbar.OnTop" << ends; if (config.getValue(rname.str(), rclass.str(), b)) m_ontop = b; else m_ontop = false; rname.seekp(0); rclass.seekp(0); - rname << rscreen.str() << "toolbar.autoHide"; - rclass << rscreen.str() << "Toolbar.AutoHide"; + rname << rscreen.str() << "toolbar.autoHide" << ends; + rclass << rscreen.str() << "Toolbar.AutoHide" << ends; if (config.getValue(rname.str(), rclass.str(), b)) m_hidden = m_autohide = b; else m_hidden = m_autohide = false; + + rscreen.rdbuf()->freeze(0); + rname.rdbuf()->freeze(0); + rclass.rdbuf()->freeze(0); } void Toolbar::reconfigure() { @@ -714,11 +722,11 @@ void Toolbar::checkClock(Bool redraw, Bool date) { void Toolbar::redrawWindowLabel(Bool redraw) { - if (screen.getOpenbox().getFocusedWindow()) { + if (screen.getOpenbox().focusedWindow()) { if (redraw) XClearWindow(display, frame.window_label); - OpenboxWindow *foc = screen.getOpenbox().getFocusedWindow(); + OpenboxWindow *foc = screen.getOpenbox().focusedWindow(); if (foc->getScreen() != &screen) return; int dx = (frame.bevel_w * 2), dlen = strlen(*foc->getTitle()); @@ -967,8 +975,8 @@ void Toolbar::edit() { XClearWindow(display, frame.workspace_label); openbox.setNoFocus(True); - if (openbox.getFocusedWindow()) - openbox.getFocusedWindow()->setFocusFlag(False); + if (openbox.focusedWindow()) + openbox.focusedWindow()->setFocusFlag(False); XDrawRectangle(display, frame.workspace_label, screen.getWindowStyle()->l_text_focus_gc, @@ -1143,9 +1151,9 @@ void Toolbar::keyPressEvent(XKeyEvent *ke) { m_editing = False; openbox.setNoFocus(False); - if (openbox.getFocusedWindow()) { - openbox.getFocusedWindow()->setInputFocus(); - openbox.getFocusedWindow()->setFocusFlag(True); + if (openbox.focusedWindow()) { + openbox.focusedWindow()->setInputFocus(); + openbox.focusedWindow()->setFocusFlag(True); } else { XSetInputFocus(display, PointerRoot, None, CurrentTime); } diff --git a/src/Window.cc b/src/Window.cc index 48052658..5a28d232 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -56,6 +56,9 @@ #endif // SLIT #include "Util.h" +#include +using namespace std; + /* * Initializes the class with default values/the window's set initial values. */ @@ -1390,7 +1393,7 @@ Bool OpenboxWindow::setInputFocus(void) { XSetInputFocus(display, screen->getRootWindow(), RevertToNone, CurrentTime); - openbox.setFocusedWindow(this); + openbox.focusWindow(this); if (flags.send_focus_message) { XEvent ce; diff --git a/src/Workspace.cc b/src/Workspace.cc index 0af1c332..d8737348 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc @@ -63,9 +63,8 @@ typedef std::vector rectList; Workspace::Workspace(BScreen &scrn, int i) : screen(scrn) { - cascade_x = cascade_y = 0; - + _focused = (OpenboxWindow *) 0; id = i; stackingList = new LinkedList; @@ -122,11 +121,11 @@ const int Workspace::removeWindow(OpenboxWindow *w) { w->getTransientFor()->isVisible()) { w->getTransientFor()->setInputFocus(); } else if (screen.sloppyFocus()) { - screen.getOpenbox().setFocusedWindow((OpenboxWindow *) 0); + screen.getOpenbox().focusWindow((OpenboxWindow *) 0); } else { OpenboxWindow *top = stackingList->first(); if (! top || ! top->setInputFocus()) { - screen.getOpenbox().setFocusedWindow((OpenboxWindow *) 0); + screen.getOpenbox().focusWindow((OpenboxWindow *) 0); XSetInputFocus(screen.getOpenbox().getXDisplay(), screen.getToolbar()->getWindowID(), RevertToParent, CurrentTime); @@ -152,6 +151,15 @@ const int Workspace::removeWindow(OpenboxWindow *w) { } +void Workspace::focusWindow(OpenboxWindow *win) { + if (win != (OpenboxWindow *) 0) + clientmenu->setItemSelected(win->getWindowNumber(), true); + if (_focused != (OpenboxWindow *) 0) + clientmenu->setItemSelected(_focused->getWindowNumber(), false); + _focused = win; +} + + void Workspace::showAll(void) { LinkedListIterator it(stackingList); for (OpenboxWindow *bw = it.current(); bw; it++, bw = it.current()) @@ -506,7 +514,7 @@ Point *Workspace::rowSmartPlacement(const Size &win_size, const Rect &space) { best = NULL; for (siter=spaces.begin(); siter!=spaces.end(); ++siter) if ((siter->w() >= win_size.w()) && (siter->h() >= win_size.h())) { - best = siter; + best = &*siter; break; } @@ -550,7 +558,7 @@ Point *Workspace::colSmartPlacement(const Size &win_size, const Rect &space) { best = NULL; for (siter=spaces.begin(); siter!=spaces.end(); ++siter) if ((siter->w() >= win_size.w()) && (siter->h() >= win_size.h())) { - best = siter; + best = &*siter; break; } diff --git a/src/Workspace.h b/src/Workspace.h index ab8dad3f..01b520ad 100644 --- a/src/Workspace.h +++ b/src/Workspace.h @@ -26,12 +26,13 @@ #include #include "LinkedList.h" -#include "Geometry.h" class BScreen; class Clientmenu; class Workspace; class OpenboxWindow; +class Size; +class Rect; class Workspace { private: @@ -44,6 +45,7 @@ private: char *name; int id, cascade_x, cascade_y; + OpenboxWindow *_focused; protected: void placeWindow(OpenboxWindow &); @@ -58,26 +60,19 @@ public: ~Workspace(void); inline BScreen &getScreen(void) { return screen; } - inline OpenboxWindow *getLastFocusedWindow(void) { return lastfocus; } - inline Clientmenu *getMenu(void) { return clientmenu; } - inline const char *getName(void) const { return name; } - inline const int &getWorkspaceID(void) const { return id; } - inline void setLastFocusedWindow(OpenboxWindow *w) { lastfocus = w; } - + inline OpenboxWindow *focusedWindow() { return _focused; } + void focusWindow(OpenboxWindow *win); OpenboxWindow *getWindow(int); - Bool isCurrent(void); Bool isLastWindow(OpenboxWindow *); - const int addWindow(OpenboxWindow *, Bool = False); const int removeWindow(OpenboxWindow *); const int getCount(void); - void showAll(void); void hideAll(void); void removeAll(void); diff --git a/src/openbox.cc b/src/openbox.cc index c6880fc4..3325bf38 100644 --- a/src/openbox.cc +++ b/src/openbox.cc @@ -186,7 +186,7 @@ Openbox::Openbox(int m_argc, char **m_argv, char *dpy_name, char *rc) resource.titlebar_layout = NULL; resource.auto_raise_delay.tv_sec = resource.auto_raise_delay.tv_usec = 0; - focused_window = masked_window = NULL; + masked_window = NULL; masked = None; windowSearchList = new LinkedList; @@ -225,6 +225,7 @@ Openbox::Openbox(int m_argc, char **m_argv, char *dpy_name, char *rc) "Openbox::Openbox: no managable screens found, aborting.\n")); ::exit(3); } + focused_screen = screenList->first(); // save current settings and default values save(); @@ -502,8 +503,6 @@ void Openbox::process_event(XEvent *e) { if ((win = searchWindow(e->xunmap.window))) { win->unmapNotifyEvent(&e->xunmap); - if (focused_window == win) - focused_window = (OpenboxWindow *) 0; #ifdef SLIT } else if ((slit = searchSlit(e->xunmap.window))) { slit->removeClient(e->xunmap.window); @@ -523,8 +522,6 @@ void Openbox::process_event(XEvent *e) { if ((win = searchWindow(e->xdestroywindow.window))) { win->destroyNotifyEvent(&e->xdestroywindow); - if (focused_window == win) - focused_window = (OpenboxWindow *) 0; #ifdef SLIT } else if ((slit = searchSlit(e->xdestroywindow.window))) { slit->removeClient(e->xdestroywindow.window, False); @@ -674,8 +671,8 @@ void Openbox::process_event(XEvent *e) { break; OpenboxWindow *win = searchWindow(e->xfocus.window); - if (win && ! win->isFocused()) - setFocusedWindow(win); + if (win && !win->isFocused()) + focusWindow(win); break; } @@ -1185,42 +1182,44 @@ void Openbox::timeout() { } -void Openbox::setFocusedWindow(OpenboxWindow *win) { - BScreen *old_screen = (BScreen *) 0, *screen = (BScreen *) 0; - OpenboxWindow *old_win = (OpenboxWindow *) 0; +OpenboxWindow *Openbox::focusedWindow() { + if (focused_screen == (BScreen *) 0) + return (OpenboxWindow *) 0; + return focused_screen->getCurrentWorkspace()->focusedWindow(); +} + + +void Openbox::focusWindow(OpenboxWindow *win) { + BScreen *old_screen = (BScreen *) 0; Toolbar *old_tbar = (Toolbar *) 0, *tbar = (Toolbar *) 0; Workspace *old_wkspc = (Workspace *) 0, *wkspc = (Workspace *) 0; - if (focused_window) { - old_win = focused_window; + OpenboxWindow *old_win = focusedWindow(); + if (old_win != (OpenboxWindow *) 0) { old_screen = old_win->getScreen(); - old_tbar = old_screen->getToolbar(); old_wkspc = old_screen->getWorkspace(old_win->getWorkspaceNumber()); + old_tbar = old_screen->getToolbar(); old_win->setFocusFlag(False); - old_wkspc->getMenu()->setItemSelected(old_win->getWindowNumber(), False); + old_wkspc->focusWindow((OpenboxWindow *) 0); } - if (win && ! win->isIconic()) { - screen = win->getScreen(); - tbar = screen->getToolbar(); - wkspc = screen->getWorkspace(win->getWorkspaceNumber()); - - focused_window = win; - - win->setFocusFlag(True); - wkspc->getMenu()->setItemSelected(win->getWindowNumber(), True); - } else { - focused_window = (OpenboxWindow *) 0; + if (win && !win->isIconic()) { + focused_screen = win->getScreen(); + tbar = focused_screen->getToolbar(); + wkspc = focused_screen->getWorkspace(win->getWorkspaceNumber()); + win->setFocusFlag(true); + wkspc->focusWindow(win); + + if (tbar) + tbar->redrawWindowLabel(true); + focused_screen->updateNetizenWindowFocus(); + //} else { + // focused_window = (OpenboxWindow *) 0; } - if (tbar) - tbar->redrawWindowLabel(True); - if (screen) - screen->updateNetizenWindowFocus(); - if (old_tbar && old_tbar != tbar) - old_tbar->redrawWindowLabel(True); - if (old_screen && old_screen != screen) + old_tbar->redrawWindowLabel(true); + if (old_screen && old_screen != focused_screen) old_screen->updateNetizenWindowFocus(); } diff --git a/src/openbox.h b/src/openbox.h index 8135a329..82abab7a 100644 --- a/src/openbox.h +++ b/src/openbox.h @@ -103,7 +103,8 @@ private: LinkedList *menuTimestamps; LinkedList *screenList; - OpenboxWindow *focused_window, *masked_window; + BScreen *focused_screen; + OpenboxWindow *masked_window; BTimer *timer; #ifdef HAVE_GETPID @@ -139,7 +140,8 @@ public: OpenboxWindow *searchGroup(Window, OpenboxWindow *); OpenboxWindow *searchWindow(Window); - inline OpenboxWindow *getFocusedWindow() { return focused_window; } + OpenboxWindow *focusedWindow(); + void focusWindow(OpenboxWindow *w); BScreen *getScreen(int); BScreen *searchScreen(Window); @@ -178,7 +180,6 @@ public: { masked = w; masked_window = bw; } inline void setNoFocus(Bool f) { no_focus = f; } - void setFocusedWindow(OpenboxWindow *w); void shutdown(); void setStyleFilename(const char *); void setMenuFilename(const char *);