From: root Date: Sun, 11 Nov 2007 04:08:00 +0000 (+0000) Subject: first rough cut at libev integration X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=0af7ae61a80fa6448dc40f526655a2254723aadb;p=dana%2Furxvt.git first rough cut at libev integration --- diff --git a/MANIFEST b/MANIFEST index 28906e81..0d1a6343 100644 --- a/MANIFEST +++ b/MANIFEST @@ -66,9 +66,8 @@ src/feature.h src/hookinc.h src/init.C src/init.h -src/iom.C -src/iom.h -src/iom_conf.h +src/ev_cpp.C +src/ev_cpp.h src/keyboard.C src/keyboard.h src/main.C @@ -178,3 +177,12 @@ src/perl/block-graphics-to-ascii src/perl/digital-clock src/perl/macosx-clipboard +libev/ev.h +libev/ev.c +libev/ev_vars.h +libev/ev_wrap.h +libev/ev_win32.c +libev/ev_select.c +libev/ev_poll.c +libev/ev_epoll.c +libev/ev_kqueue.c diff --git a/autogen.sh b/autogen.sh index 5817320a..af28e412 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,5 +1,17 @@ #! /bin/sh +if ! [ -e libev/ev++.h ]; then + cat < header file. */ #undef HAVE_CLOCALE +/* Define to 1 if you have the `clock_gettime' function. */ +#undef HAVE_CLOCK_GETTIME + /* Define to 1 if you have the header file. */ #undef HAVE_CWCHAR @@ -67,6 +70,9 @@ /* Define to 1 if you have /dev/ptmx */ #undef HAVE_DEV_PTMX +/* Define to 1 if you have the `epoll_ctl' function. */ +#undef HAVE_EPOLL_CTL + /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H @@ -79,9 +85,18 @@ /* Define to 1 if you have the `isastream' function. */ #undef HAVE_ISASTREAM +/* Define to 1 if you have the `kqueue' function. */ +#undef HAVE_KQUEUE + /* Define to 1 if you have the header file. */ #undef HAVE_LASTLOG_H +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + +/* Define to 1 if you have the `rt' library (-lrt). */ +#undef HAVE_LIBRT + /* Define to 1 if you have the header file. */ #undef HAVE_LIBUTIL_H @@ -151,9 +166,18 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_BYTEORDER_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EPOLL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EVENT_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_QUEUE_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H diff --git a/configure b/configure index 43d9f539..2da36255 100755 --- a/configure +++ b/configure @@ -681,9 +681,9 @@ EGREP LINKER INSTALL_LIBRXVT RXVTNAME +CXXCPP TIC XMKMF -CXXCPP X_CFLAGS X_PRE_LIBS X_LIBS @@ -733,8 +733,8 @@ CXX CXXFLAGS CCC CPP -XMKMF -CXXCPP' +CXXCPP +XMKMF' # Initialize some variables set by options. @@ -1375,8 +1375,8 @@ Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags CPP C preprocessor - XMKMF Path to xmkmf, Makefile generator for X Window System CXXCPP C++ preprocessor + XMKMF Path to xmkmf, Makefile generator for X Window System Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -4893,49 +4893,6 @@ fi -# Extract the first word of "tic", so it can be a program name with args. -set dummy tic; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_TIC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $TIC in - [\\/]* | ?:[\\/]*) - ac_cv_path_TIC="$TIC" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_TIC="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - - test -z "$ac_cv_path_TIC" && ac_cv_path_TIC=":" - ;; -esac -fi -TIC=$ac_cv_path_TIC -if test -n "$TIC"; then - { echo "$as_me:$LINENO: result: $TIC" >&5 -echo "${ECHO_T}$TIC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - - ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' @@ -5157,11 +5114,868 @@ See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + +for ac_header in sys/epoll.h sys/event.h sys/queue.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + +for ac_func in epoll_ctl kqueue +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +{ echo "$as_me:$LINENO: checking for clock_gettime" >&5 +echo $ECHO_N "checking for clock_gettime... $ECHO_C" >&6; } +if test "${ac_cv_func_clock_gettime+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define clock_gettime to an innocuous variant, in case declares clock_gettime. + For example, HP-UX 11i declares gettimeofday. */ +#define clock_gettime innocuous_clock_gettime + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char clock_gettime (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef clock_gettime + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char clock_gettime (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_clock_gettime || defined __stub___clock_gettime +choke me +#endif + +int +main () +{ +return clock_gettime (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_func_clock_gettime=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_clock_gettime=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_func_clock_gettime" >&5 +echo "${ECHO_T}$ac_cv_func_clock_gettime" >&6; } +if test $ac_cv_func_clock_gettime = yes; then + : +else + + +{ echo "$as_me:$LINENO: checking for clock_gettime in -lrt" >&5 +echo $ECHO_N "checking for clock_gettime in -lrt... $ECHO_C" >&6; } +if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char clock_gettime (); +int +main () +{ +return clock_gettime (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_rt_clock_gettime=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_rt_clock_gettime=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_rt_clock_gettime" >&5 +echo "${ECHO_T}$ac_cv_lib_rt_clock_gettime" >&6; } +if test $ac_cv_lib_rt_clock_gettime = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBRT 1 +_ACEOF + + LIBS="-lrt $LIBS" + +fi + + +for ac_func in clock_gettime +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +fi + + + +{ echo "$as_me:$LINENO: checking for ceil in -lm" >&5 +echo $ECHO_N "checking for ceil in -lm... $ECHO_C" >&6; } +if test "${ac_cv_lib_m_ceil+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ceil (); +int +main () +{ +return ceil (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_m_ceil=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_m_ceil=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_ceil" >&5 +echo "${ECHO_T}$ac_cv_lib_m_ceil" >&6; } +if test $ac_cv_lib_m_ceil = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBM 1 +_ACEOF + + LIBS="-lm $LIBS" + +fi + + + + + + + +# Extract the first word of "tic", so it can be a program name with args. +set dummy tic; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_TIC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $TIC in + [\\/]* | ?:[\\/]*) + ac_cv_path_TIC="$TIC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_TIC="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_TIC" && ac_cv_path_TIC=":" + ;; +esac +fi +TIC=$ac_cv_path_TIC +if test -n "$TIC"; then + { echo "$as_me:$LINENO: result: $TIC" >&5 +echo "${ECHO_T}$TIC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + { echo "$as_me:$LINENO: checking for X" >&5 @@ -6624,249 +7438,6 @@ _ACEOF fi -{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - @@ -13821,9 +14392,9 @@ EGREP!$EGREP$ac_delim LINKER!$LINKER$ac_delim INSTALL_LIBRXVT!$INSTALL_LIBRXVT$ac_delim RXVTNAME!$RXVTNAME$ac_delim +CXXCPP!$CXXCPP$ac_delim TIC!$TIC$ac_delim XMKMF!$XMKMF$ac_delim -CXXCPP!$CXXCPP$ac_delim X_CFLAGS!$X_CFLAGS$ac_delim X_PRE_LIBS!$X_PRE_LIBS$ac_delim X_LIBS!$X_LIBS$ac_delim diff --git a/configure.ac b/configure.ac index 13c92147..58959f6b 100644 --- a/configure.ac +++ b/configure.ac @@ -437,6 +437,10 @@ AC_ARG_WITH(terminfo, dnl# -------------------------------------------------------------------------- +m4_include([libev/libev.m4]) + +dnl# -------------------------------------------------------------------------- + AC_PATH_PROG(TIC, tic, :) dnl# need a neat way to detect SVR4 or its features diff --git a/src/Makefile.in b/src/Makefile.in index 2136e693..cb506756 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -21,7 +21,7 @@ DEFS = @DEFS@ LIBS = @LIBS@ XINC = @X_CFLAGS@ @AFTERIMAGE_CFLAGS@ XLIB = @X_LIBS@ @AFTERIMAGE_LIBS@ -lX11 @X_EXTRA_LIBS@ -COMPILE = $(CXX) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) $(DEBUG) $(XINC) -I.. -I$(srcdir) -I. +COMPILE = $(CXX) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) $(DEBUG) $(XINC) -I../libev -I.. -I$(srcdir) -I. LINK = @LINKER@ $(LDFLAGS) srcdir = @srcdir@ @@ -36,7 +36,7 @@ COMMON = \ background.o command.o rxvtfont.o init.o logging.o main.o misc.o \ ptytty.o proxy.o screen.o scrollbar.o scrollbar-next.o scrollbar-rxvt.o \ scrollbar-xterm.o scrollbar-plain.o xdefaults.o encoding.o \ - rxvttoolkit.o rxvtutil.o iom.o keyboard.o fdpass.o @PERL_O@ + rxvttoolkit.o rxvtutil.o keyboard.o fdpass.o ev_cpp.o @PERL_O@ COMMON_DAEMON = rxvtdaemon.o @@ -141,13 +141,12 @@ depend: # DO NOT DELETE: nice dependency list follows background.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -background.o: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h -background.o: libptytty.h callback.h salloc.h rxvtperl.h hookinc.h -background.o: background.h rsinc.h +background.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h +background.o: salloc.h libptytty.h rxvtperl.h hookinc.h background.h rsinc.h command.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -command.o: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h -command.o: callback.h salloc.h rxvtperl.h hookinc.h background.h rsinc.h -command.o: version.h command.h keyboard.h +command.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h +command.o: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h version.h +command.o: command.h keyboard.h encoding.o: ../config.h encoding.h table/iso8859_1.h table/iso8859_15.h encoding.o: table/iso8859_2.h table/iso8859_3.h table/iso8859_4.h encoding.o: table/iso8859_5.h table/iso8859_6.h table/iso8859_7.h @@ -163,91 +162,90 @@ encoding.o: table/cns11643_1992_f.h table/big5_ext.h table/big5_plus.h encoding.o: table/viscii.h table/jis0201_1976_0.h table/jis0208_1990_0.h encoding.o: table/jis0212_1990_0.h table/jis0213_1.h table/jis0213_2.h encoding.o: table/compose.h table/category.h +ev_cpp.o: rxvttoolkit.h ev_cpp.h rxvtlib.h optinc.h rxvtutil.h callback.h fdpass.o: ../config.h libptytty.h init.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h rxvtutil.h -init.o: rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h callback.h -init.o: salloc.h rxvtperl.h hookinc.h background.h rsinc.h init.h -iom.o: iom.h iom_conf.h rxvtutil.h libptytty.h callback.h +init.o: rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h libptytty.h +init.o: rxvtperl.h hookinc.h background.h rsinc.h init.h keyboard.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -keyboard.o: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h -keyboard.o: callback.h salloc.h rxvtperl.h hookinc.h background.h rsinc.h -keyboard.o: keyboard.h command.h +keyboard.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h +keyboard.o: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h keyboard.h +keyboard.o: command.h logging.o: ../config.h ptytty.h libptytty.h ptytty_conf.h rxvt.h rxvtlib.h logging.o: optinc.h feature.h encoding.h rxvtutil.h rxvtfont.h rxvttoolkit.h -logging.o: iom.h iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h -logging.o: background.h rsinc.h +logging.o: ev_cpp.h callback.h salloc.h rxvtperl.h hookinc.h background.h +logging.o: rsinc.h main.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h rxvtutil.h -main.o: rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h callback.h -main.o: salloc.h rxvtperl.h hookinc.h background.h rsinc.h keyboard.h +main.o: rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h libptytty.h +main.o: rxvtperl.h hookinc.h background.h rsinc.h keyboard.h misc.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h rxvtutil.h -misc.o: rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h callback.h -misc.o: salloc.h rxvtperl.h hookinc.h background.h rsinc.h +misc.o: rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h libptytty.h +misc.o: rxvtperl.h hookinc.h background.h rsinc.h proxy.o: ../config.h ptytty.h libptytty.h ptytty_conf.h rxvt.h rxvtlib.h proxy.o: optinc.h feature.h encoding.h rxvtutil.h rxvtfont.h rxvttoolkit.h -proxy.o: iom.h iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h -proxy.o: background.h rsinc.h +proxy.o: ev_cpp.h callback.h salloc.h rxvtperl.h hookinc.h background.h +proxy.o: rsinc.h ptytty.o: ../config.h ptytty.h libptytty.h ptytty_conf.h rxvt.h rxvtlib.h ptytty.o: optinc.h feature.h encoding.h rxvtutil.h rxvtfont.h rxvttoolkit.h -ptytty.o: iom.h iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h -ptytty.o: background.h rsinc.h +ptytty.o: ev_cpp.h callback.h salloc.h rxvtperl.h hookinc.h background.h +ptytty.o: rsinc.h rxvt.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h rxvtutil.h -rxvt.o: rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h callback.h -rxvt.o: salloc.h rxvtperl.h hookinc.h background.h rsinc.h +rxvt.o: rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h libptytty.h +rxvt.o: rxvtperl.h hookinc.h background.h rsinc.h rxvtc.o: ../config.h rxvtdaemon.h rxvtutil.h libptytty.h rxvt.h rxvtlib.h -rxvtc.o: optinc.h feature.h encoding.h rxvtfont.h rxvttoolkit.h iom.h -rxvtc.o: iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h background.h -rxvtc.o: rsinc.h +rxvtc.o: optinc.h feature.h encoding.h rxvtfont.h rxvttoolkit.h ev_cpp.h +rxvtc.o: callback.h salloc.h rxvtperl.h hookinc.h background.h rsinc.h rxvtd.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -rxvtd.o: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h -rxvtd.o: callback.h salloc.h rxvtperl.h hookinc.h background.h rsinc.h -rxvtd.o: rxvtdaemon.h +rxvtd.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h +rxvtd.o: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h rxvtdaemon.h rxvtdaemon.o: rxvtdaemon.h rxvtutil.h rxvtfont.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -rxvtfont.o: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h -rxvtfont.o: callback.h salloc.h rxvtperl.h hookinc.h background.h rsinc.h +rxvtfont.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h +rxvtfont.o: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h rxvtfont.o: table/linedraw.h +rxvtperl.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +rxvtperl.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h +rxvtperl.o: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h keyboard.h +rxvtperl.o: perlxsi.c ./iom_perl.h rxvttoolkit.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -rxvttoolkit.o: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h -rxvttoolkit.o: libptytty.h callback.h salloc.h rxvtperl.h hookinc.h -rxvttoolkit.o: background.h rsinc.h +rxvttoolkit.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h +rxvttoolkit.o: salloc.h libptytty.h rxvtperl.h hookinc.h background.h rsinc.h rxvtutil.o: rxvtutil.h salloc.o: salloc.h screen.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -screen.o: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h -screen.o: callback.h salloc.h rxvtperl.h hookinc.h background.h rsinc.h -screen.o: salloc.C +screen.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h +screen.o: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h salloc.C scrollbar-next.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -scrollbar-next.o: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h -scrollbar-next.o: libptytty.h callback.h salloc.h rxvtperl.h hookinc.h -scrollbar-next.o: background.h rsinc.h +scrollbar-next.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h +scrollbar-next.o: salloc.h libptytty.h rxvtperl.h hookinc.h background.h +scrollbar-next.o: rsinc.h scrollbar-plain.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -scrollbar-plain.o: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h -scrollbar-plain.o: libptytty.h callback.h salloc.h rxvtperl.h hookinc.h -scrollbar-plain.o: background.h rsinc.h +scrollbar-plain.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h +scrollbar-plain.o: salloc.h libptytty.h rxvtperl.h hookinc.h background.h +scrollbar-plain.o: rsinc.h scrollbar-rxvt.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -scrollbar-rxvt.o: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h -scrollbar-rxvt.o: libptytty.h callback.h salloc.h rxvtperl.h hookinc.h -scrollbar-rxvt.o: background.h rsinc.h +scrollbar-rxvt.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h +scrollbar-rxvt.o: salloc.h libptytty.h rxvtperl.h hookinc.h background.h +scrollbar-rxvt.o: rsinc.h scrollbar-xterm.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -scrollbar-xterm.o: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h -scrollbar-xterm.o: libptytty.h callback.h salloc.h rxvtperl.h hookinc.h -scrollbar-xterm.o: background.h rsinc.h +scrollbar-xterm.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h +scrollbar-xterm.o: salloc.h libptytty.h rxvtperl.h hookinc.h background.h +scrollbar-xterm.o: rsinc.h scrollbar.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -scrollbar.o: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h -scrollbar.o: callback.h salloc.h rxvtperl.h hookinc.h background.h rsinc.h +scrollbar.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h +scrollbar.o: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h xdefaults.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -xdefaults.o: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h -xdefaults.o: callback.h salloc.h rxvtperl.h hookinc.h background.h rsinc.h -xdefaults.o: version.h keyboard.h +xdefaults.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h +xdefaults.o: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h version.h +xdefaults.o: keyboard.h background.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -background.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h -background.lo: libptytty.h callback.h salloc.h rxvtperl.h hookinc.h -background.lo: background.h rsinc.h +background.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h +background.lo: salloc.h libptytty.h rxvtperl.h hookinc.h background.h rsinc.h command.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -command.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h -command.lo: callback.h salloc.h rxvtperl.h hookinc.h background.h rsinc.h -command.lo: version.h command.h keyboard.h +command.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h +command.lo: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h version.h +command.lo: command.h keyboard.h encoding.lo: ../config.h encoding.h table/iso8859_1.h table/iso8859_15.h encoding.lo: table/iso8859_2.h table/iso8859_3.h table/iso8859_4.h encoding.lo: table/iso8859_5.h table/iso8859_6.h table/iso8859_7.h @@ -263,81 +261,80 @@ encoding.lo: table/cns11643_1992_f.h table/big5_ext.h table/big5_plus.h encoding.lo: table/viscii.h table/jis0201_1976_0.h table/jis0208_1990_0.h encoding.lo: table/jis0212_1990_0.h table/jis0213_1.h table/jis0213_2.h encoding.lo: table/compose.h table/category.h +ev_cpp.lo: rxvttoolkit.h ev_cpp.h rxvtlib.h optinc.h rxvtutil.h callback.h fdpass.lo: ../config.h libptytty.h init.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -init.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h -init.lo: callback.h salloc.h rxvtperl.h hookinc.h background.h rsinc.h init.h -iom.lo: iom.h iom_conf.h rxvtutil.h libptytty.h callback.h +init.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h +init.lo: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h init.h keyboard.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -keyboard.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h -keyboard.lo: callback.h salloc.h rxvtperl.h hookinc.h background.h rsinc.h -keyboard.lo: keyboard.h command.h +keyboard.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h +keyboard.lo: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h keyboard.h +keyboard.lo: command.h logging.lo: ../config.h ptytty.h libptytty.h ptytty_conf.h rxvt.h rxvtlib.h logging.lo: optinc.h feature.h encoding.h rxvtutil.h rxvtfont.h rxvttoolkit.h -logging.lo: iom.h iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h -logging.lo: background.h rsinc.h +logging.lo: ev_cpp.h callback.h salloc.h rxvtperl.h hookinc.h background.h +logging.lo: rsinc.h main.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -main.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h -main.lo: callback.h salloc.h rxvtperl.h hookinc.h background.h rsinc.h -main.lo: keyboard.h +main.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h +main.lo: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h keyboard.h misc.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -misc.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h -misc.lo: callback.h salloc.h rxvtperl.h hookinc.h background.h rsinc.h +misc.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h +misc.lo: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h proxy.lo: ../config.h ptytty.h libptytty.h ptytty_conf.h rxvt.h rxvtlib.h proxy.lo: optinc.h feature.h encoding.h rxvtutil.h rxvtfont.h rxvttoolkit.h -proxy.lo: iom.h iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h -proxy.lo: background.h rsinc.h +proxy.lo: ev_cpp.h callback.h salloc.h rxvtperl.h hookinc.h background.h +proxy.lo: rsinc.h ptytty.lo: ../config.h ptytty.h libptytty.h ptytty_conf.h rxvt.h rxvtlib.h ptytty.lo: optinc.h feature.h encoding.h rxvtutil.h rxvtfont.h rxvttoolkit.h -ptytty.lo: iom.h iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h -ptytty.lo: background.h rsinc.h +ptytty.lo: ev_cpp.h callback.h salloc.h rxvtperl.h hookinc.h background.h +ptytty.lo: rsinc.h rxvt.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -rxvt.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h -rxvt.lo: callback.h salloc.h rxvtperl.h hookinc.h background.h rsinc.h +rxvt.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h +rxvt.lo: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h rxvtc.lo: ../config.h rxvtdaemon.h rxvtutil.h libptytty.h rxvt.h rxvtlib.h -rxvtc.lo: optinc.h feature.h encoding.h rxvtfont.h rxvttoolkit.h iom.h -rxvtc.lo: iom_conf.h callback.h salloc.h rxvtperl.h hookinc.h background.h -rxvtc.lo: rsinc.h +rxvtc.lo: optinc.h feature.h encoding.h rxvtfont.h rxvttoolkit.h ev_cpp.h +rxvtc.lo: callback.h salloc.h rxvtperl.h hookinc.h background.h rsinc.h rxvtd.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -rxvtd.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h -rxvtd.lo: callback.h salloc.h rxvtperl.h hookinc.h background.h rsinc.h -rxvtd.lo: rxvtdaemon.h +rxvtd.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h +rxvtd.lo: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h rxvtdaemon.h rxvtdaemon.lo: rxvtdaemon.h rxvtutil.h rxvtfont.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -rxvtfont.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h -rxvtfont.lo: callback.h salloc.h rxvtperl.h hookinc.h background.h rsinc.h +rxvtfont.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h +rxvtfont.lo: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h rxvtfont.lo: table/linedraw.h +rxvtperl.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h +rxvtperl.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h +rxvtperl.lo: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h keyboard.h +rxvtperl.lo: perlxsi.c ./iom_perl.h rxvttoolkit.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -rxvttoolkit.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h -rxvttoolkit.lo: libptytty.h callback.h salloc.h rxvtperl.h hookinc.h -rxvttoolkit.lo: background.h rsinc.h +rxvttoolkit.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h +rxvttoolkit.lo: salloc.h libptytty.h rxvtperl.h hookinc.h background.h +rxvttoolkit.lo: rsinc.h rxvtutil.lo: rxvtutil.h salloc.lo: salloc.h screen.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -screen.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h libptytty.h -screen.lo: callback.h salloc.h rxvtperl.h hookinc.h background.h rsinc.h -screen.lo: salloc.C +screen.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h salloc.h +screen.lo: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h salloc.C scrollbar-next.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -scrollbar-next.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h -scrollbar-next.lo: libptytty.h callback.h salloc.h rxvtperl.h hookinc.h -scrollbar-next.lo: background.h rsinc.h +scrollbar-next.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h +scrollbar-next.lo: salloc.h libptytty.h rxvtperl.h hookinc.h background.h +scrollbar-next.lo: rsinc.h scrollbar-plain.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h -scrollbar-plain.lo: encoding.h rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h -scrollbar-plain.lo: iom_conf.h libptytty.h callback.h salloc.h rxvtperl.h -scrollbar-plain.lo: hookinc.h background.h rsinc.h +scrollbar-plain.lo: encoding.h rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h +scrollbar-plain.lo: callback.h salloc.h libptytty.h rxvtperl.h hookinc.h +scrollbar-plain.lo: background.h rsinc.h scrollbar-rxvt.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -scrollbar-rxvt.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h -scrollbar-rxvt.lo: libptytty.h callback.h salloc.h rxvtperl.h hookinc.h -scrollbar-rxvt.lo: background.h rsinc.h +scrollbar-rxvt.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h +scrollbar-rxvt.lo: salloc.h libptytty.h rxvtperl.h hookinc.h background.h +scrollbar-rxvt.lo: rsinc.h scrollbar-xterm.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h -scrollbar-xterm.lo: encoding.h rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h -scrollbar-xterm.lo: iom_conf.h libptytty.h callback.h salloc.h rxvtperl.h -scrollbar-xterm.lo: hookinc.h background.h rsinc.h +scrollbar-xterm.lo: encoding.h rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h +scrollbar-xterm.lo: callback.h salloc.h libptytty.h rxvtperl.h hookinc.h +scrollbar-xterm.lo: background.h rsinc.h scrollbar.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -scrollbar.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h -scrollbar.lo: libptytty.h callback.h salloc.h rxvtperl.h hookinc.h -scrollbar.lo: background.h rsinc.h +scrollbar.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h +scrollbar.lo: salloc.h libptytty.h rxvtperl.h hookinc.h background.h rsinc.h xdefaults.lo: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h -xdefaults.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h -xdefaults.lo: libptytty.h callback.h salloc.h rxvtperl.h hookinc.h -xdefaults.lo: background.h rsinc.h version.h keyboard.h +xdefaults.lo: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h callback.h +xdefaults.lo: salloc.h libptytty.h rxvtperl.h hookinc.h background.h rsinc.h +xdefaults.lo: version.h keyboard.h diff --git a/src/background.h b/src/background.h index 9937c470..ede6ab85 100644 --- a/src/background.h +++ b/src/background.h @@ -112,7 +112,7 @@ struct bgPixmap_t { if (!(flags & isInvalid)) { flags |= isInvalid; - invalid_since = NOW; + invalid_since = ev::now (); } }; }; diff --git a/src/command.C b/src/command.C index eb9520ef..0cb75efa 100644 --- a/src/command.C +++ b/src/command.C @@ -1096,18 +1096,18 @@ rxvt_term::flush () } void -rxvt_term::check_cb (check_watcher &w) +rxvt_term::prepare_cb (ev::prepare &w, int revents) { make_current (); display->flush (); if (want_refresh && !flush_ev.active) - flush_ev.start (NOW + 1. / 60.); // refresh at max. 60 hz normally + flush_ev.start (1. / 60.); // refresh at max. 60 hz normally } void -rxvt_term::flush_cb (time_watcher &w) +rxvt_term::flush_cb (ev::timer &w, int revents) { make_current (); @@ -1117,57 +1117,54 @@ rxvt_term::flush_cb (time_watcher &w) #ifdef CURSOR_BLINK void -rxvt_term::cursor_blink_cb (time_watcher &w) +rxvt_term::cursor_blink_cb (ev::timer &w, int revents) { hidden_cursor = !hidden_cursor; want_refresh = 1; - - w.start (w.at + CURSOR_BLINK_INTERVAL); } #endif #ifdef TEXT_BLINK void -rxvt_term::text_blink_cb (time_watcher &w) +rxvt_term::text_blink_cb (ev::timer &w, int revents) { if (scr_refresh_rend (RS_Blink, RS_Blink)) { hidden_text = !hidden_text; want_refresh = 1; - w.start (w.at + TEXT_BLINK_INTERVAL); } } #endif #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING void -rxvt_term::cont_scroll_cb (time_watcher &w) +rxvt_term::cont_scroll_cb (ev::timer &w, int revents) { if ((scrollbar_isUp() || scrollbar_isDn()) && scr_page (scrollbar_isUp() ? UP : DN, 1)) - { - want_refresh = 1; - w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); - } + want_refresh = 1; + else + w.stop (); } #endif #ifdef SELECTION_SCROLLING void -rxvt_term::sel_scroll_cb (time_watcher &w) +rxvt_term::sel_scroll_cb (ev::timer &w, int revents) { if (scr_page (scroll_selection_dir, scroll_selection_lines)) { selection_extend (selection_save_x, selection_save_y, selection_save_state); want_refresh = 1; - w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); } + else + w.stop (); } #endif #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) void -rxvt_term::slip_wheel_cb (time_watcher &w) +rxvt_term::slip_wheel_cb (ev::timer &w, int revents) { if (mouse_slip_wheel_speed == 0 || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) @@ -1177,17 +1174,18 @@ rxvt_term::slip_wheel_cb (time_watcher &w) mouse_slip_wheel_speed = 0; want_refresh = 1; - w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); } + else + w.stop (); } #endif #if LINUX_YIELD_HACK static struct event_handler { - check_watcher yield_ev; + ev::prepare yield_ev; - void yield_cb (check_watcher &w) + void yield_cb (ev::prepare &w, int revents) { // this should really be sched_yield(), but the linux guys thought // that giving a process calling sched_yield () less cpu time than @@ -1248,17 +1246,17 @@ rxvt_term::pty_fill () } void -rxvt_term::pty_cb (io_watcher &w, short revents) +rxvt_term::pty_cb (ev::io &w, int revents) { make_current (); - if (revents & EVENT_READ) + if (revents & ev::READ) // loop, but don't allow a single term to monopolize us while (pty_fill ()) if (cmd_parse ()) break; - if (revents & EVENT_WRITE) + if (revents & ev::WRITE) pty_write (); } @@ -1272,7 +1270,7 @@ rxvt_term::pointer_unblank () hidden_pointer = 0; if (option (Opt_pointerBlank)) - pointer_ev.start (NOW + pointerBlankDelay); + pointer_ev.start (pointerBlankDelay); #endif } @@ -1290,7 +1288,7 @@ rxvt_term::pointer_blank () } void -rxvt_term::pointer_cb (time_watcher &w) +rxvt_term::pointer_cb (ev::timer &w, int revents) { make_current (); @@ -1531,7 +1529,7 @@ rxvt_term::x_cb (XEvent &ev) case MapNotify: mapped = 1; #ifdef TEXT_BLINK - text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); + text_blink_ev.start (TEXT_BLINK_INTERVAL); #endif HOOK_INVOKE ((this, HOOK_MAP_NOTIFY, DT_XEVENT, &ev, DT_END)); break; @@ -1633,7 +1631,7 @@ rxvt_term::x_cb (XEvent &ev) * already in the middle of scrolling. */ if (!sel_scroll_ev.active) - sel_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); + sel_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); /* save the event params so we can highlight * the selection in the pending-scroll loop @@ -1702,7 +1700,7 @@ rxvt_term::x_cb (XEvent &ev) want_refresh = 1; } - cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); + cursor_blink_ev.again (); } #endif @@ -1740,7 +1738,7 @@ rxvt_term::focus_in () #endif #if CURSOR_BLINK if (option (Opt_cursorBlink)) - cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); + cursor_blink_ev.start (CURSOR_BLINK_INTERVAL, CURSOR_BLINK_INTERVAL); #endif #if OFF_FOCUS_FADING if (rs[Rs_fade]) @@ -1788,6 +1786,7 @@ rxvt_term::focus_out () #if CURSOR_BLINK if (option (Opt_cursorBlink)) cursor_blink_ev.stop (); + hidden_cursor = 0; #endif #if OFF_FOCUS_FADING @@ -2030,7 +2029,7 @@ rxvt_term::button_press (XButtonEvent &ev) if (upordown) { #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING - cont_scroll_ev.start (NOW + SCROLLBAR_INITIAL_DELAY); + cont_scroll_ev.start (SCROLLBAR_INITIAL_DELAY, SCROLLBAR_CONTINUOUS_DELAY); #endif if (scr_page (upordown < 0 ? UP : DN, 1)) { @@ -2203,10 +2202,7 @@ rxvt_term::button_release (XButtonEvent &ev) if (mouse_slip_wheel_speed < -nrow) mouse_slip_wheel_speed = -nrow; if (mouse_slip_wheel_speed > +nrow) mouse_slip_wheel_speed = +nrow; - if (slip_wheel_ev.at < NOW) - slip_wheel_ev.at = NOW + SCROLLBAR_CONTINUOUS_DELAY; - - slip_wheel_ev.start (); + slip_wheel_ev.start (SCROLLBAR_CONTINUOUS_DELAY, SCROLLBAR_CONTINUOUS_DELAY); } else { @@ -2284,7 +2280,7 @@ rxvt_term::cmd_parse () { refresh_count = 0; - if (!option (Opt_skipScroll) || io_manager::now () > NOW + 1. / 60.) + if (!option (Opt_skipScroll) || ev::ev_time () > ev::now () + 1. / 60.) { refreshnow = true; ch = NOCHAR; @@ -4009,7 +4005,7 @@ rxvt_term::tt_write (const char *data, unsigned int len) memcpy (v_buffer + v_buflen, data, len); v_buflen += len; - pty_ev.set (EVENT_READ | EVENT_WRITE); + pty_ev.set (ev::READ | ev::WRITE); } void rxvt_term::pty_write () @@ -4025,14 +4021,14 @@ void rxvt_term::pty_write () free (v_buffer); v_buffer = 0; - pty_ev.set (EVENT_READ); + pty_ev.set (ev::READ); return; } memmove (v_buffer, v_buffer + written, v_buflen); } else if (written != -1 || (errno != EAGAIN && errno != EINTR)) - pty_ev.set (EVENT_READ); + pty_ev.set (ev::READ); } /*----------------------- end-of-file (C source) -----------------------*/ diff --git a/src/iom.C b/src/iom.C deleted file mode 100644 index 1c9fa8e9..00000000 --- a/src/iom.C +++ /dev/null @@ -1,591 +0,0 @@ -/* - iom.C -- generic I/O multiplexer - Copyright (C) 2003-2006 Marc Lehmann - - This file is part of GVPE. - - GVPE is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with gvpe; if not, write to the Free Software - Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "iom.h" - -#include -#include -#include -#include - -#include -#include - -#if 1 // older unices need these includes for select (2) -# include -# include -#endif - -#if IOM_CHILD -# include -#endif - -#if IOM_SIG -# include -# include -#endif - -// if the BSDs would at least be marginally POSIX-compatible.. *sigh* -// until that happens, sys/select.h must come last -#include - -#define TIMEVAL timeval -#define TV_FRAC tv_usec -#define TV_MULT 1000000L - -#if IOM_CHECK -static io_manager_vec cw; -#endif -#if IOM_IDLE -static io_manager_vec iw; -#endif - -#if IOM_SIG -static int sigpipe[2]; // signal signalling pipe -static sigset_t sigs; -struct sig_vec : io_manager_vec { - int pending; - sig_vec () - : pending (false) - { } -}; -static vector sw; -#endif - -#if IOM_CHILD -static io_manager_vec pw; -#endif - -#ifdef IOM_LIBEVENT -static bool need_set_now; // need to set_now in callback -#else - #if IOM_IO - static io_manager_vec iow; - #endif - #if IOM_TIME - static io_manager_vec tw; - #endif -#endif - -#if IOM_TIME -tstamp io_manager::now () -{ - struct timeval tv; - - gettimeofday (&tv, 0); - return (tstamp)tv.tv_sec + (tstamp)tv.tv_usec / 1000000.; -} - -void io_manager::set_now () -{ - NOW = now (); - #ifdef IOM_LIBEVENT - need_set_now = false; - #endif -} -#endif - -#ifndef IOM_LIBEVENT -// this is a dummy time watcher to ensure that the first -// time watcher is _always_ valid, this gets rid of a lot -// of null-pointer-checks -// (must come _before_ iom is being defined) -static struct tw0 : time_watcher -{ - void cb (time_watcher &w) - { - // should never get called - // reached end-of-time, or tstamp has a bogus definition, - // or compiler initialisation order broken, or something else :) - abort (); - } - - tw0 () - : time_watcher (this, &tw0::cb) - { } -} tw0; -#endif - -tstamp NOW; - -#if IOM_CHILD -// sig_watcher for child signal(s) -static struct sw0 : sig_watcher -{ - void cb (sig_watcher &w) - { - // SIGCHLD, call corresponding watchera - pid_t pid; - int status; - - while ((pid = waitpid (-1, &status, WNOHANG)) > 0) - for (int i = pw.size (); i--; ) - { - child_watcher *w = pw[i]; - - if (!w) - pw.erase_unordered (i); - else if (w->pid == pid) - { - io_manager::unreg (*w); - w->call (*w, status); - } - } - } - - sw0 () - : sig_watcher (this, &sw0::cb) - { } -} sw0; -#endif - -static bool iom_valid; - -// used for initialisation only -static struct init { - init () - { - #ifdef IOM_PREINIT - { IOM_PREINIT } - #endif - - #ifdef IOM_LIBEVENT - event_init (); - #endif - iom_valid = true; - - #if IOM_SIG - sigemptyset (&sigs); - - if (pipe (sigpipe)) - { - perror ("io_manager: unable to create signal pipe, aborting."); - abort (); - } - - fcntl (sigpipe[0], F_SETFL, O_NONBLOCK); fcntl (sigpipe[0], F_SETFD, FD_CLOEXEC); - fcntl (sigpipe[1], F_SETFL, O_NONBLOCK); fcntl (sigpipe[1], F_SETFD, FD_CLOEXEC); - #endif - - #if IOM_CHILD - sw0.start (SIGCHLD); - #endif - - #if IOM_TIME - io_manager::set_now (); - - #ifndef IOM_LIBEVENT - tw0.start (TSTAMP_MAX); - #endif - #endif - - #ifdef IOM_POSTINIT - { IOM_POSTINIT } - #endif - } - - ~init () - { - iom_valid = false; - } - - static void required (); -} init; - -void -init::required () -{ - if (!iom_valid) - { - write (2, "io_manager: early registration attempt, aborting.\n", - sizeof ("io_manager: early registration attempt, aborting.\n") - 1); - abort (); - } -} - -template -void io_manager::reg (watcher &w, io_manager_vec &queue) -{ - init::required (); - - if (!w.active) - { - queue.push_back (&w); - w.active = queue.size (); - } -} - -template -void io_manager::unreg (watcher &w, io_manager_vec &queue) -{ - if (!iom_valid) - return; - - if (w.active) - { - queue [w.active - 1] = 0; - w.active = 0; - } -} - -#if IOM_TIME - #ifdef IOM_LIBEVENT - void iom_time_c_callback (int fd, short events, void *data) - { - if (need_set_now) io_manager::set_now (); - time_watcher *w = static_cast(data); - w->call (*w); - } - - void time_watcher::start () - { - stop (); - evtimer_set (&ev, iom_time_c_callback, (void *)this); - struct timeval tv; - tv.tv_sec = (long)at; - tv.tv_usec = (long)((at - (tstamp)tv.tv_sec) * 1000000.); - evtimer_add (&ev, &tv); - active = 1; - } - #else - void io_manager::reg (time_watcher &w) { io_manager::reg (w, tw); } - void io_manager::unreg (time_watcher &w) { io_manager::unreg (w, tw); } - #endif - - void time_watcher::trigger () - { - call (*this); - start (); - } -#endif - -#if IOM_IO - #ifdef IOM_LIBEVENT - void iom_io_c_callback (int fd, short events, void *data) - { - if (need_set_now) io_manager::set_now (); - io_watcher *w = static_cast(data); - w->call (*w, events); - } - - void io_watcher::set (int fd_, short events_) - { - if (active) event_del (&ev); - fd = fd_; - events = events_; - event_set (&ev, fd_, events_ | EV_PERSIST, iom_io_c_callback, (void *)this); - if (active) event_add (&ev, 0); - } - #else - void io_manager::reg (io_watcher &w) { io_manager::reg (w, iow); } - void io_manager::unreg (io_watcher &w) { io_manager::unreg (w, iow); } - #endif -#endif - -#if IOM_CHECK -void io_manager::reg (check_watcher &w) { io_manager::reg (w, cw); } -void io_manager::unreg (check_watcher &w) { io_manager::unreg (w, cw); } -#endif - -#if IOM_IDLE -void io_manager::reg (idle_watcher &w) { io_manager::reg (w, iw); } -void io_manager::unreg (idle_watcher &w) { io_manager::unreg (w, iw); } -#endif - -#if IOM_SIG -static void -sighandler (int signum) -{ - sw [signum - 1]->pending = true; - - // we use a pipe for signal notifications, as most current - // OSes (Linux...) do not implement pselect correctly. ugh. - char ch = signum; // actual content not used - write (sigpipe[1], &ch, 1); -} - -void io_manager::reg (sig_watcher &w) -{ - init::required (); - - assert (0 < w.signum); - - sw.reserve (w.signum); - - while (sw.size () < w.signum) // pathetic - sw.push_back (0); - - sig_vec *&sv = sw[w.signum - 1]; - - if (!sv) - { - sv = new sig_vec; - - sigaddset (&sigs, w.signum); - sigprocmask (SIG_BLOCK, &sigs, NULL); - - struct sigaction sa; - sa.sa_handler = sighandler; - sigfillset (&sa.sa_mask); - sa.sa_flags = SA_RESTART; - - if (sigaction (w.signum, &sa, 0)) - { - perror ("io_manager: error while installing signal handler, ignoring."); - abort (); - } - - } - - io_manager::reg (w, *sv); -} - -void io_manager::unreg (sig_watcher &w) -{ - if (!w.active || !iom_valid) - return; - - assert (0 < w.signum && w.signum <= sw.size ()); - - io_manager::unreg (w, *sw[w.signum - 1]); -} - -void sig_watcher::start (int signum) -{ - stop (); - this->signum = signum; - io_manager::reg (*this); -} -#endif - -#if IOM_CHILD -void io_manager::reg (child_watcher &w) { io_manager::reg (w, pw); } -void io_manager::unreg (child_watcher &w) { io_manager::unreg (w, pw); } -#endif - -void io_manager::loop () -{ - init::required (); - - #if IOM_TIME - set_now (); - #endif - - for (;;) - { - #ifndef IOM_LIBEVENT - #if IOM_TIME - // call pending time watchers - { - bool activity; - - do - { - activity = false; - - for (int i = tw.size (); i--; ) - if (!tw[i]) - tw.erase_unordered (i); - else if (tw[i]->at <= NOW) - { - time_watcher &w = *tw[i]; - - unreg (w); - w.call (w); - - activity = true; - } - } - while (activity); - } - #endif - #endif - - #if IOM_CHECK - // call all check watchers - for (int i = cw.size (); i--; ) - if (!cw[i]) - cw.erase_unordered (i); - else - cw[i]->call (*cw[i]); - #endif - - struct TIMEVAL *to = 0; - struct TIMEVAL tval; - -#if IOM_IDLE - if (iw.size ()) - { - tval.tv_sec = 0; - tval.TV_FRAC = 0; - to = &tval; - } - else -#endif - { - #ifndef IOM_LIBEVENT - #if IOM_TIME - // find earliest active watcher - time_watcher *next = tw[0]; // the first time-watcher must exist at ALL times - - for (io_manager_vec::const_iterator i = tw.end (); i-- > tw.begin (); ) - if (*i && (*i)->at < next->at) - next = *i; - - if (next->at > NOW && next != tw[0]) - { - double diff = next->at - NOW; - tval.tv_sec = (int)diff; - tval.TV_FRAC = (int) ((diff - tval.tv_sec) * TV_MULT); - to = &tval; - } - #endif - #endif - } - - #ifndef IOM_LIBEVENT - #if IOM_IO || IOM_SIG - fd_set rfd, wfd; - - FD_ZERO (&rfd); - FD_ZERO (&wfd); - - int fds = 0; - - #if IOM_IO - for (io_manager_vec::const_iterator i = iow.end (); i-- > iow.begin (); ) - if (*i) - { - if ((*i)->events & EVENT_READ ) FD_SET ((*i)->fd, &rfd); - if ((*i)->events & EVENT_WRITE) FD_SET ((*i)->fd, &wfd); - - if ((*i)->fd >= fds) fds = (*i)->fd + 1; - } - #endif - - if (!to && !fds) //TODO: also check idle_watchers and check_watchers? - break; // no events - - #if IOM_SIG - FD_SET (sigpipe[0], &rfd); - if (sigpipe[0] >= fds) fds = sigpipe[0] + 1; - #endif - - #if IOM_SIG - // there is no race, as we use a pipe for signals, so select - // will return if a signal is caught. - sigprocmask (SIG_UNBLOCK, &sigs, NULL); - #endif - fds = select (fds, &rfd, &wfd, NULL, to); - #if IOM_SIG - sigprocmask (SIG_BLOCK, &sigs, NULL); - #endif - #elif IOM_TIME - if (!to) - break; - - select (0, 0, 0, 0, to); - #endif - - #if IOM_TIME - { - // update time, try to compensate for gross non-monotonic time changes - tstamp diff = NOW; - set_now (); - diff = NOW - diff; - - if (diff < 0) - for (io_manager_vec::const_iterator i = tw.end (); i-- > tw.begin (); ) - if (*i) - (*i)->at += diff; - } - #endif - - if (fds > 0) - { - #if IOM_SIG - if (FD_ISSET (sigpipe[0], &rfd)) - { - char ch; - - while (read (sigpipe[0], &ch, 1) > 0) - ; - - for (vector::iterator svp = sw.end (); svp-- > sw.begin (); ) - if (*svp && (*svp)->pending) - { - sig_vec &sv = **svp; - for (int i = sv.size (); i--; ) - if (!sv[i]) - sv.erase_unordered (i); - else - sv[i]->call (*sv[i]); - - sv.pending = false; - } - } - #endif - - #if IOM_IO - for (int i = iow.size (); i--; ) - if (!iow[i]) - iow.erase_unordered (i); - else - { - io_watcher &w = *iow[i]; - short revents = w.events; - - if (!FD_ISSET (w.fd, &rfd)) revents &= ~EVENT_READ; - if (!FD_ISSET (w.fd, &wfd)) revents &= ~EVENT_WRITE; - - if (revents) - w.call (w, revents); - } - #endif - } - else if (fds < 0 && errno != EINTR) - { - perror ("io_manager: fatal error while waiting for I/O or time event, aborting."); - abort (); - } -#if IOM_IDLE - else - for (int i = iw.size (); i--; ) - if (!iw[i]) - iw.erase_unordered (i); - else - iw[i]->call (*iw[i]); -#endif - - #else - need_set_now = true; - - if (to) - event_loop (EVLOOP_NONBLOCK); - else - event_loop (EVLOOP_ONCE); - - if (need_set_now) set_now (); - #endif - //TODO: IOM_IDLE - } -} - diff --git a/src/iom.h b/src/iom.h deleted file mode 100644 index fdb8f4c6..00000000 --- a/src/iom.h +++ /dev/null @@ -1,293 +0,0 @@ -/* - iom.h -- generic I/O multiplexer - Copyright (C) 2003-2006 Marc Lehmann - - This file is part of GVPE. - - GVPE is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with gvpe; if not, write to the Free Software - Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef IOM_H__ -#define IOM_H__ - -// required: -// - a vector template like simplevec or stl's vector -// - defines for all watcher types required in your app -// edit iom_conf.h as appropriate. -#include "iom_conf.h" - -#if IOM_CHILD -# undef IOM_SIG -# define IOM_SIG 1 -#endif - -#include "callback.h" - -typedef double tstamp; -extern tstamp NOW; - -// TSTAMP_MAX must still fit into a positive struct timeval -#define TSTAMP_MAX (double)(1UL<<31) - -//#define IOM_LIBEVENT "event.h" *NOT* a supported feature -#ifdef IOM_LIBEVENT -# include -# include IOM_LIBEVENT -# undef IOM_IO -# define IOM_IO 1 -# undef IOM_TIME -# define IOM_TIME 1 -# undef IOM_IDLE // NYI -# undef IOM_SIG // NYI -# undef IOM_CHILD // NYI -#endif - -struct watcher; -#if IOM_IO -struct io_watcher; -#endif -#if IOM_TIME -struct time_watcher; -#endif -#if IOM_CHECK -struct check_watcher; -#endif -#if IOM_IDLE -struct idle_watcher; -#endif -#if IOM_SIG -struct sig_watcher; -#endif -#if IOM_CHILD -struct child_watcher; -#endif - -template -struct io_manager_vec : vector { - void erase_unordered (unsigned int pos) - { - watcher *w = (*this)[this->size () - 1]; - this->pop_back (); - - if (!this->empty ()) - if (((*this)[pos] = w)) // '=' is correct! - w->active = pos + 1; - } -}; - -// only used as a namespace, and for initialisation purposes -class io_manager { - template - static void reg (watcher &w, io_manager_vec &queue); - - template - static void unreg (watcher &w, io_manager_vec &queue); - -public: -#if IOM_TIME - // fetch time only - static tstamp now (); - - // set NOW - static void set_now (); -#endif - - // register a watcher -#ifndef IOM_LIBEVENT -#if IOM_IO - static void reg (io_watcher &w); static void unreg (io_watcher &w); -#endif -#if IOM_TIME - static void reg (time_watcher &w); static void unreg (time_watcher &w); -#endif -#if IOM_SIG - static void reg (sig_watcher &w); static void unreg (sig_watcher &w); -#endif -#if IOM_CHECK - static void reg (check_watcher &w); static void unreg (check_watcher &w); -#endif -#endif -#if IOM_IDLE - static void reg (idle_watcher &w); static void unreg (idle_watcher &w); -#endif -#if IOM_CHILD - static void reg (child_watcher &w); static void unreg (child_watcher &w); -#endif - - static void loop (); -}; - -struct watcher { - int active; /* 0 == inactive, else index into respective vector */ - - bool is_active () { return active; } - - watcher () : active (0) { } -}; - -#if IOM_IO -#ifdef IOM_LIBEVENT -enum { EVENT_UNDEF = -1, EVENT_NONE = 0, EVENT_READ = EV_READ, EVENT_WRITE = EV_WRITE }; - -void iom_io_c_callback (int fd, short events, void *data); - -struct io_watcher : watcher, callback { - struct event ev; - int fd; - short events; - - void set (int fd_, short events_); - void set (short events_) { set (fd, events_); } - void start () { if (!active) event_add (&ev, 0); active = 1; } - void start (int fd_, short events_) { set (fd_, events_); start (); } - void stop () { if (active) event_del (&ev); active = 0; } - - template - io_watcher (O object, M method) - : callback (object, method) - { } - ~io_watcher () { stop (); } -}; -#else -enum { EVENT_UNDEF = -1, EVENT_NONE = 0, EVENT_READ = 1, EVENT_WRITE = 2 }; - -struct io_watcher : watcher, callback { - int fd; - short events; - - void set (int fd_, short events_) { fd = fd_; events = events_; } - - void set (short events_) { set (fd, events_); } - void start () { io_manager::reg (*this); } - void start (int fd_, short events_) { set (fd_, events_); start (); } - void stop () { io_manager::unreg (*this); } - - template - io_watcher (O object, M method) - : callback (object, method) - { } - ~io_watcher () { stop (); } -}; -#endif -#endif - -#if IOM_TIME -#ifdef IOM_LIBEVENT -void iom_time_c_callback (int fd, short events, void *data); - -struct time_watcher : watcher, callback { - struct event ev; - tstamp at; - - void trigger (); - - void set (tstamp when) - { - at = when; - if (active) - start (); - } - void operator () () { trigger (); } - void start (); - void start (tstamp when) { at = when; start (); } - void stop () { if (active) evtimer_del (&ev); active = 0; } - - template - time_watcher (O object, M method) - : callback (object, method), at (0) - { } - ~time_watcher () { stop (); } -}; -#else -struct time_watcher : watcher, callback { - tstamp at; - - void trigger (); - - void set (tstamp when) { at = when; } - void operator () () { trigger (); } - void start () { io_manager::reg (*this); } - void start (tstamp when) { set (when); start (); } - void stop () { io_manager::unreg (*this); } - - template - time_watcher (O object, M method) - : callback (object, method), at (0) - { } - ~time_watcher () { stop (); } -}; -#endif -#endif - -#if IOM_CHECK -// run before checking for new events -struct check_watcher : watcher, callback { - void start () { io_manager::reg (*this); } - void stop () { io_manager::unreg (*this); } - - template - check_watcher (O object, M method) - : callback (object, method) - { } - ~check_watcher () { stop (); } -}; -#endif - -#if IOM_IDLE -// run after checking for any i/o, but before waiting -struct idle_watcher : watcher, callback { - void start () { io_manager::reg (*this); } - void stop () { io_manager::unreg (*this); } - - template - idle_watcher (O object, M method) - : callback (object, method) - { } - ~idle_watcher () { stop (); } -}; -#endif - -#if IOM_SIG -struct sig_watcher : watcher, callback { - int signum; - - void start (int signum); - void stop () { io_manager::unreg (*this); } - - template - sig_watcher (O object, M method) - : callback (object, method), signum (0) - { } - ~sig_watcher () { stop (); } -}; -#endif - -#if IOM_CHILD -struct child_watcher : watcher, callback { - int /*pid_t*/ pid; - - void start (int pid) { this->pid = pid; io_manager::reg (*this); } - void stop () { io_manager::unreg (*this); } - - template - child_watcher (O object, M method) - : callback (object, method), pid (0) - { } - ~child_watcher () { stop (); } -}; -#endif - -#endif - diff --git a/src/iom_conf.h b/src/iom_conf.h deleted file mode 100644 index b454498d..00000000 --- a/src/iom_conf.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - iom_conf.h -- generic I/O multiplexer config - Copyright (C) 2003-2006 Marc Lehmann - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef RXVT_IOM_CONF_H__ -#define RXVT_IOM_CONF_H__ - -#include "rxvtutil.h" - -#define IOM_IO 1 -#define IOM_TIME 1 -#define IOM_CHECK 1 -#define IOM_SIG 1 -#define IOM_IDLE 1 -#define IOM_CHILD 1 - -#include "libptytty.h" -#define IOM_PREINIT ptytty::sanitise_stdfd (); - -#endif - diff --git a/src/iom_perl.h b/src/iom_perl.h index 6ee524fa..30652065 100644 --- a/src/iom_perl.h +++ b/src/iom_perl.h @@ -64,20 +64,15 @@ perl_watcher::invoke (const char *type, SV *self, int arg) #define newSVtimer(timer) iom_new_ref ((timer)->self, IOM_CLASS "::timer") #define SvTIMER(sv) (timer *)(perl_watcher *)SvPTR ((sv), IOM_CLASS "::timer") -struct timer : perl_watcher, time_watcher +struct timer : perl_watcher, ev::timer { - tstamp interval; - timer () - : time_watcher (this, &timer::execute) + : ev::timer (this, &timer::execute) { } - void execute (time_watcher &w) + void execute (ev::timer &w, int revents) { - if (interval) - start (at + interval); - invoke (IOM_CLASS "::timer", newSVtimer (this)); } }; @@ -85,14 +80,14 @@ struct timer : perl_watcher, time_watcher #define newSViow(iow) iom_new_ref ((iow)->self, IOM_CLASS "::iow") #define SvIOW(sv) (iow *)(perl_watcher *)SvPTR ((sv), IOM_CLASS "::iow") -struct iow : perl_watcher, io_watcher +struct iow : perl_watcher, ev::io { iow () - : io_watcher (this, &iow::execute) + : ev::io (this, &iow::execute) { } - void execute (io_watcher &w, short revents) + void execute (ev::io &w, int revents) { invoke (IOM_CLASS "::iow", newSViow (this), revents); } @@ -101,14 +96,14 @@ struct iow : perl_watcher, io_watcher #define newSViw(iw) iom_new_ref ((iw)->self, IOM_CLASS "::iw") #define SvIW(sv) (iw *)(perl_watcher *)SvPTR ((sv), IOM_CLASS "::iw") -struct iw : perl_watcher, idle_watcher +struct iw : perl_watcher, ev::idle { iw () - : idle_watcher (this, &iw::execute) + : ev::idle (this, &iw::execute) { } - void execute (idle_watcher &w) + void execute (ev::idle &w, int revents) { invoke (IOM_CLASS "::iw", newSViw (this)); } @@ -117,16 +112,16 @@ struct iw : perl_watcher, idle_watcher #define newSVpw(pw) iom_new_ref ((pw)->self, IOM_CLASS "::pw") #define SvPW(sv) (pw *)(perl_watcher *)SvPTR ((sv), IOM_CLASS "::pw") -struct pw : perl_watcher, child_watcher +struct pw : perl_watcher, ev::child { pw () - : child_watcher (this, &pw::execute) + : ev::child (this, &pw::execute) { } - void execute (child_watcher &w, int status) + void execute (ev::child &w, int revents) { - invoke (IOM_CLASS "::pw", newSVpw (this), status); + invoke (IOM_CLASS "::pw", newSVpw (this), w.rstatus); } }; diff --git a/src/iom_perl.xs b/src/iom_perl.xs index bb9066c9..c32f0f3b 100644 --- a/src/iom_perl.xs +++ b/src/iom_perl.xs @@ -13,9 +13,9 @@ BOOT: IV iv; } *civ, iom_const_iv[] = { # define iom_const_iv(name) { # name, (IV)name } - iom_const_iv (EVENT_NONE), - iom_const_iv (EVENT_READ), - iom_const_iv (EVENT_WRITE), + iom_const_iv (EV_NONE), + iom_const_iv (EV_READ), + iom_const_iv (EV_WRITE), # undef iom_const }; @@ -56,7 +56,7 @@ SV * timer::new () CODE: timer *w = new timer; - w->start (NOW); + w->start (0); RETVAL = newSVptr ((void *)(perl_watcher *)w, "IOM_CLASS::timer"); w->self = (HV *)SvRV (RETVAL); OUTPUT: @@ -70,9 +70,9 @@ timer::at () RETVAL IOM_CHAINED -timer::interval (NV interval) +timer::interval (NV repeat) CODE: - THIS->interval = interval; + THIS->repeat = repeat; OUTPUT: RETVAL @@ -84,16 +84,16 @@ timer::set (NV tstamp) RETVAL IOM_CHAINED -timer::start (NV tstamp = THIS->at) +timer::start (NV tstamp = ev::now ()) CODE: - THIS->start (tstamp); + THIS->start (tstamp - ev::now ()); OUTPUT: RETVAL IOM_CHAINED timer::after (NV delay) CODE: - THIS->start (NOW + delay); + THIS->start (delay); OUTPUT: RETVAL diff --git a/src/main.C b/src/main.C index 239a031c..3433b801 100644 --- a/src/main.C +++ b/src/main.C @@ -191,7 +191,7 @@ rxvt_term::rxvt_term () termwin_ev (this, &rxvt_term::x_cb), vt_ev (this, &rxvt_term::x_cb), child_ev (this, &rxvt_term::child_cb), - check_ev (this, &rxvt_term::check_cb), + prepare_ev (this, &rxvt_term::prepare_cb), flush_ev (this, &rxvt_term::flush_cb), destroy_ev (this, &rxvt_term::destroy_cb), pty_ev (this, &rxvt_term::pty_cb), @@ -312,7 +312,7 @@ rxvt_term::~rxvt_term () // child has exited, usually destroys void -rxvt_term::child_cb (child_watcher &w, int status) +rxvt_term::child_cb (ev::child &w, int status) { HOOK_INVOKE ((this, HOOK_CHILD_EXIT, DT_INT, status, DT_END)); @@ -350,7 +350,7 @@ rxvt_term::destroy () vt_ev.stop (display); } - check_ev.stop (); + prepare_ev.stop (); pty_ev.stop (); #ifdef CURSOR_BLINK cursor_blink_ev.stop (); @@ -368,11 +368,11 @@ rxvt_term::destroy () pointer_ev.stop (); #endif - destroy_ev.start (0); + destroy_ev.start (); } void -rxvt_term::destroy_cb (time_watcher &w) +rxvt_term::destroy_cb (ev::check &w, int revents) { make_current (); @@ -567,9 +567,9 @@ rxvt_term::init (int argc, const char *const *argv, stringvec *envv) free (cmd_argv); if (pty->pty >= 0) - pty_ev.start (pty->pty, EVENT_READ); + pty_ev.start (pty->pty, ev::READ); - check_ev.start (); + prepare_ev.start (); HOOK_INVOKE ((this, HOOK_START, DT_END)); @@ -591,16 +591,16 @@ rxvt_term::init (int argc, const char *const *argv, stringvec *envv) static struct sig_handlers { - sig_watcher sw_term, sw_int; + ev::sig sw_term, sw_int; /* * Catch a fatal signal and tidy up before quitting */ void - sig_term (sig_watcher &w) + sig_term (ev::sig &w, int revents) { rxvt_emergency_cleanup (); - signal (w.signum, SIG_DFL); + w.stop (); kill (getpid (), w.signum); } @@ -617,14 +617,15 @@ void rxvt_init () { ptytty::init (); + ev::ev_default_loop (0); rxvt_environ = environ; signal (SIGHUP, SIG_IGN); signal (SIGPIPE, SIG_IGN); - sig_handlers.sw_term.start (SIGTERM); - sig_handlers.sw_int.start (SIGINT); + sig_handlers.sw_term.start (SIGTERM); ev::ev_unref (); + sig_handlers.sw_int.start (SIGINT); ev::ev_unref (); /* need to trap SIGURG for SVR4 (Unixware) rlogin */ /* signal (SIGURG, SIG_DFL); */ @@ -1742,24 +1743,26 @@ rxvt_term::update_background () { bgPixmap.invalidate (); - /* no chance of real time refresh if we are blurring ! */ - if (bgPixmap.invalid_since + 0.5 < NOW && !(bgPixmap.flags & bgPixmap_t::blurNeeded)) + /* no chance of real time refresh if we are blurring! */ + if (bgPixmap.invalid_since + 0.5 < ev::now () && !(bgPixmap.flags & bgPixmap_t::blurNeeded)) bgPixmap.render (); else { update_background_ev.stop (); + if (!bgPixmap.need_client_side_rendering()) - update_background_ev.start (NOW + .05); + update_background_ev.start (.05); else if (bgPixmap.flags & bgPixmap_t::blurNeeded) - update_background_ev.start (NOW + .2); /* very slow !!! */ + update_background_ev.start (.20); /* very slow !!! */ else - update_background_ev.start (NOW + .07); + update_background_ev.start (.07); } + return 0; } void -rxvt_term::update_background_cb (time_watcher &w) +rxvt_term::update_background_cb (ev::timer &w, int revents) { bgPixmap.render (); } diff --git a/src/perl/remote-clipboard b/src/perl/remote-clipboard index e31f33a5..8bbe1c2a 100644 --- a/src/perl/remote-clipboard +++ b/src/perl/remote-clipboard @@ -40,7 +40,7 @@ sub store { $self->{iow} = urxvt::iow ->new ->fd (fileno $fh) - ->events (urxvt::EVENT_WRITE) + ->events (urxvt::EV_WRITE) ->start ->cb (sub { if (my $len = syswrite $fh, $txt) { @@ -65,7 +65,7 @@ sub fetch { $self->{iow} = urxvt::iow ->new ->fd (fileno $fh) - ->events (urxvt::EVENT_READ) + ->events (urxvt::EV_READ) ->start ->cb (sub { if (my $len = sysread $fh, $txt, 8192, length $txt) { diff --git a/src/perl/searchable-scrollback b/src/perl/searchable-scrollback index bf8f4cad..238189b5 100644 --- a/src/perl/searchable-scrollback +++ b/src/perl/searchable-scrollback @@ -37,7 +37,7 @@ sub enter { return if $self->{overlay}; $self->{view_start} = $self->view_start; - $self->{pty_ev_events} = $self->pty_ev_events (urxvt::EVENT_NONE); + $self->{pty_ev_events} = $self->pty_ev_events (urxvt::EV_NONE); $self->{row} = $self->nrow - 1; $self->{search} = "(?i)"; diff --git a/src/rxvt.C b/src/rxvt.C index e5c56f95..f25acdb3 100644 --- a/src/rxvt.C +++ b/src/rxvt.C @@ -1,4 +1,4 @@ -/*--------------------------------*-C-*---------------------------------* +/*----------------------------------------------------------------------* * File: rxvt.C *----------------------------------------------------------------------* * @@ -52,7 +52,7 @@ try #endif return EXIT_FAILURE; - io_manager::loop (); + ev::ev_loop (0); return EXIT_SUCCESS; } diff --git a/src/rxvt.h b/src/rxvt.h index a751ccce..b9b24c37 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -38,7 +38,7 @@ #include "rxvtutil.h" #include "rxvtfont.h" #include "rxvttoolkit.h" -#include "iom.h" +#include "ev_cpp.h" #include "salloc.h" #include "libptytty.h" @@ -1050,8 +1050,8 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen { #endif #ifdef HAVE_BG_PIXMAP int update_background (); - void update_background_cb (time_watcher &w); - time_watcher update_background_ev; + void update_background_cb (ev::timer &w, int revents); + ev::timer update_background_ev; #endif void x_cb (XEvent &xev); @@ -1061,37 +1061,37 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen { xevent_watcher scrollbar_ev; #endif - void child_cb (child_watcher &w, int status); child_watcher child_ev; - void check_cb (check_watcher &w); check_watcher check_ev; - void destroy_cb (time_watcher &w); time_watcher destroy_ev; + void child_cb (ev::child &w, int revents); ev::child child_ev; + void prepare_cb (ev::prepare &w, int revents); ev::prepare prepare_ev; + void destroy_cb (ev::check &w, int revents); ev::check destroy_ev; void flush (); - void flush_cb (time_watcher &w); time_watcher flush_ev; + void flush_cb (ev::timer &w, int revents); ev::timer flush_ev; bool pty_fill (); - void pty_cb (io_watcher &w, short revents); io_watcher pty_ev; - void incr_cb (time_watcher &w) NOTHROW; time_watcher incr_ev; + void pty_cb (ev::io &w, int revents); ev::io pty_ev; + void incr_cb (ev::timer &w, int revents) NOTHROW; ev::timer incr_ev; #ifdef CURSOR_BLINK - void cursor_blink_cb (time_watcher &w); time_watcher cursor_blink_ev; + void cursor_blink_cb (ev::timer &w, int revents); ev::timer cursor_blink_ev; #endif #ifdef TEXT_BLINK - void text_blink_cb (time_watcher &w); time_watcher text_blink_ev; + void text_blink_cb (ev::timer &w, int revents); ev::timer text_blink_ev; #endif #ifndef NO_BELL - void bell_cb (time_watcher &w); time_watcher bell_ev; + void bell_cb (ev::timer &w, int revents); ev::timer bell_ev; #endif #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING - void cont_scroll_cb (time_watcher &w); time_watcher cont_scroll_ev; + void cont_scroll_cb (ev::timer &w, int revents); ev::timer cont_scroll_ev; #endif #ifdef SELECTION_SCROLLING - void sel_scroll_cb (time_watcher &w); time_watcher sel_scroll_ev; + void sel_scroll_cb (ev::timer &w, int revents); ev::timer sel_scroll_ev; #endif #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) - void slip_wheel_cb (time_watcher &w); time_watcher slip_wheel_ev; + void slip_wheel_cb (ev::timer &w, int revents); ev::timer slip_wheel_ev; #endif #ifdef POINTER_BLANK - void pointer_cb (time_watcher &w); time_watcher pointer_ev; + void pointer_cb (ev::timer &w, int revents); ev::timer pointer_ev; void pointer_blank (); #endif void pointer_unblank (); diff --git a/src/rxvtd.C b/src/rxvtd.C index feff51f6..7ce801c3 100644 --- a/src/rxvtd.C +++ b/src/rxvtd.C @@ -38,13 +38,12 @@ #include "rxvt.h" #include "rxvtdaemon.h" #include "libptytty.h" -#include "iom.h" struct server : rxvt_connection { log_callback log_cb; getfd_callback getfd_cb; - void read_cb (io_watcher &w, short revents); io_watcher read_ev; + void read_cb (ev::io &w, int revents); ev::io read_ev; void log_msg (const char *msg); int getfd (int remote_fd); @@ -54,7 +53,7 @@ struct server : rxvt_connection { getfd_cb (this, &server::getfd) { this->fd = fd; - read_ev.start (fd, EVENT_READ); + read_ev.start (fd, ev::READ); } void err (const char *format = 0, ...); @@ -63,7 +62,7 @@ struct server : rxvt_connection { struct unix_listener { int fd; - void accept_cb (io_watcher &w, short revents); io_watcher accept_ev; + void accept_cb (ev::io &w, int revents); ev::io accept_ev; unix_listener (const char *sockname); }; @@ -108,10 +107,10 @@ unix_listener::unix_listener (const char *sockname) exit (EXIT_FAILURE); } - accept_ev.start (fd, EVENT_READ); + accept_ev.start (fd, ev::READ); } -void unix_listener::accept_cb (io_watcher &w, short revents) +void unix_listener::accept_cb (ev::io &w, int revents) { int fd2 = accept (fd, 0, 0); @@ -153,7 +152,7 @@ void server::err (const char *format, ...) delete this; } -void server::read_cb (io_watcher &w, short revents) +void server::read_cb (ev::io &w, int revents) { auto_str tok; @@ -276,7 +275,7 @@ main (int argc, const char *const *argv) _exit (EXIT_SUCCESS); } - io_manager::loop (); + ev::ev_loop (0); return EXIT_SUCCESS; } diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs index 44a7c29b..2df37e8e 100644 --- a/src/rxvtperl.xs +++ b/src/rxvtperl.xs @@ -33,7 +33,7 @@ #include "unistd.h" -#include "iom.h" +#include "ev_cpp.h" #include "rxvt.h" #include "keyboard.h" #include "rxvtutil.h" @@ -777,7 +777,7 @@ _exit (int status) NV NOW () CODE: - RETVAL = NOW; + RETVAL = ev::now (); OUTPUT: RETVAL @@ -1141,10 +1141,10 @@ rxvt_term::envv () } int -rxvt_term::pty_ev_events (int events = EVENT_UNDEF) +rxvt_term::pty_ev_events (int events = ev::UNDEF) CODE: RETVAL = THIS->pty_ev.events; - if (events != EVENT_UNDEF) + if (events != ev::UNDEF) THIS->pty_ev.set (events); OUTPUT: RETVAL @@ -1478,7 +1478,7 @@ rxvt_term::option (U8 optval, int set = -1) { THIS->set_option (optval, set); - if (THIS->check_ev.is_active ()) // avoid doing this before START + if (THIS->prepare_ev.is_active ()) // avoid doing this before START switch (optval) { case Opt_skipBuiltinGlyphs: diff --git a/src/rxvttoolkit.C b/src/rxvttoolkit.C index 248bc6e9..1ff64f98 100644 --- a/src/rxvttoolkit.C +++ b/src/rxvttoolkit.C @@ -473,7 +473,7 @@ bool rxvt_display::ref_init () if (!getsockname (fd, (sockaddr *)&sa, &sl)) is_local = sa.sun_family == AF_UNIX; - x_ev.start (fd, EVENT_READ); + x_ev.start (fd, ev::READ); fcntl (fd, F_SETFD, FD_CLOEXEC); XSelectInput (dpy, root, PropertyChangeMask); @@ -540,7 +540,7 @@ void rxvt_display::im_change_check () } #endif -void rxvt_display::x_cb (io_watcher &w, short revents) +void rxvt_display::x_cb (ev::io &w, int revents) { do { @@ -577,7 +577,7 @@ void rxvt_display::x_cb (io_watcher &w, short revents) void rxvt_display::flush () { if (XEventsQueued (dpy, QueuedAlready)) - x_cb (x_ev, EVENT_READ); + x_cb (x_ev, ev::READ); XFlush (dpy); } diff --git a/src/rxvttoolkit.h b/src/rxvttoolkit.h index 3e3c15f6..536eb484 100644 --- a/src/rxvttoolkit.h +++ b/src/rxvttoolkit.h @@ -29,7 +29,7 @@ # include #endif -#include "iom.h" +#include "ev_cpp.h" #include "rxvtlib.h" #include "rxvtutil.h" @@ -102,6 +102,27 @@ struct rxvt_display; struct im_watcher; struct xevent_watcher; +template +struct event_vec : vector { + void erase_unordered (unsigned int pos) + { + watcher *w = (*this)[this->size () - 1]; + this->pop_back (); + + if (!this->empty ()) + if (((*this)[pos] = w)) // '=' is correct! + w->active = pos + 1; + } +}; + +struct rxvt_watcher { + int active; /* 0 == inactive, else index into respective vector */ + + bool is_active () { return active; } + + rxvt_watcher () : active (0) { } +}; + struct refcounted { int referenced; char *id; @@ -190,9 +211,9 @@ struct rxvt_screen { }; struct rxvt_display : refcounted { - io_manager_vec xw; + event_vec xw; - io_watcher x_ev; void x_cb (io_watcher &w, short revents); + ev::io x_ev; void x_cb (ev::io &w, int revents); #ifdef USE_XIM refcache xims; @@ -236,7 +257,7 @@ struct rxvt_display : refcounted { }; #ifdef USE_XIM -struct im_watcher : watcher, callback { +struct im_watcher : rxvt_watcher, callback { template im_watcher (O object, M method) : callback (object, method) @@ -246,6 +267,7 @@ struct im_watcher : watcher, callback { { display->reg (this); } + void stop (rxvt_display *display) { display->unreg (this); @@ -253,7 +275,7 @@ struct im_watcher : watcher, callback { }; #endif -struct xevent_watcher : watcher, callback { +struct xevent_watcher : rxvt_watcher, callback { Window window; template @@ -266,6 +288,7 @@ struct xevent_watcher : watcher, callback { this->window = window; display->reg (this); } + void stop (rxvt_display *display) { display->unreg (this); diff --git a/src/screen.C b/src/screen.C index 3f032f6f..c6c95429 100644 --- a/src/screen.C +++ b/src/screen.C @@ -1868,7 +1868,7 @@ rxvt_term::scr_changeview (int new_view_start) NOTHROW #ifndef NO_BELL void -rxvt_term::bell_cb (time_watcher &w) +rxvt_term::bell_cb (ev::timer &w, int revents) { rvideo_bell = false; scr_rvideo_mode (rvideo_mode); @@ -1905,7 +1905,7 @@ rxvt_term::scr_bell () NOTHROW scr_rvideo_mode (rvideo_mode); display->flush (); - bell_ev.start (NOW + VISUAL_BELL_DURATION); + bell_ev.start (VISUAL_BELL_DURATION); } else XBell (dpy, 0); @@ -2321,7 +2321,7 @@ rxvt_term::scr_refresh () NOTHROW { if (!text_blink_ev.active) { - text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); + text_blink_ev.start (TEXT_BLINK_INTERVAL, TEXT_BLINK_INTERVAL); hidden_text = 0; } else if (hidden_text) @@ -2735,7 +2735,7 @@ rxvt_term::selection_paste (Window win, Atom prop, bool delete_prop) NOTHROW selection_wait = Sel_incr; incr_buf_fill = 0; - incr_ev.start (NOW + 10); + incr_ev.start (10); goto bailout; } @@ -2771,7 +2771,7 @@ rxvt_term::selection_paste (Window win, Atom prop, bool delete_prop) NOTHROW } else if (selection_wait == Sel_incr) { - incr_ev.start (NOW + 10); + incr_ev.start (10); while (incr_buf_fill + ct.nitems > incr_buf_size) { @@ -2821,7 +2821,7 @@ bailout: } void -rxvt_term::incr_cb (time_watcher &w) NOTHROW +rxvt_term::incr_cb (ev::timer &w, int revents) NOTHROW { selection_wait = Sel_none; diff --git a/src/urxvt.pm b/src/urxvt.pm index 1f3d6646..b76ae776 100644 --- a/src/urxvt.pm +++ b/src/urxvt.pm @@ -2057,7 +2057,7 @@ This class implements io watchers/events. Example: $term->{iow} = urxvt::iow ->new ->fd (fileno $term->{socket}) - ->events (urxvt::EVENT_READ) + ->events (urxvt::EV_READ) ->start ->cb (sub { my ($iow, $revents) = @_; @@ -2085,8 +2085,8 @@ Set the file descriptor (not handle) to watch. =item $iow = $iow->events ($eventmask) Set the event mask to watch. The only allowed values are -C and C, which might be ORed -together, or C. +C and C, which might be ORed +together, or C. =item $iow = $iow->start