Merge rxvtlib.h.in in rxvt.h.
authorayin <ayin>
Fri, 28 Dec 2007 14:00:46 +0000 (14:00 +0000)
committerayin <ayin>
Fri, 28 Dec 2007 14:00:46 +0000 (14:00 +0000)
MANIFEST
configure
configure.ac
src/Makefile.in
src/optinc.h
src/rxvt.h
src/rxvtlib.h.in [deleted file]

index 8430c721b5346aafc0230dbb9cd20e439668afbc..1133c80f4981c840dc8ea41f536d5c5ffe26fc84 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -75,7 +75,6 @@ src/rxvtc.C
 src/rxvtd.C
 src/rxvtdaemon.C
 src/rxvtdaemon.h
-src/rxvtlib.h.in
 src/salloc.C
 src/salloc.h
 src/screen.C
index 37292a71799b1c44dae4ab50a57d53f389e5d29e..62ea16fa116e616efa2a7b9b6fd3820e9f845549 100755 (executable)
--- a/configure
+++ b/configure
@@ -696,9 +696,6 @@ IF_PERL
 PERL_O
 AFTERIMAGE_CFLAGS
 AFTERIMAGE_LIBS
-include_stdint_h
-include_sys_ioctl_h
-include_sys_strredir_h
 LIBOBJS
 LTLIBOBJS'
 ac_subst_files=''
@@ -7763,59 +7760,6 @@ fi
 done
 
 
-{ echo "$as_me:$LINENO: checking whether termios.h and sys/ioctl.h may both be included" >&5
-echo $ECHO_N "checking whether termios.h and sys/ioctl.h may both be included... $ECHO_C" >&6; }
-if test "${rxvt_cv_header_sysioctl+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 <stdio.h>
-#include <sys/ioctl.h>
-#include <termios.h>
-
-int
-main ()
-{
-int a = ECHO;
-  ;
-  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
-  rxvt_cv_header_sysioctl=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       rxvt_cv_header_sysioctl=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $rxvt_cv_header_sysioctl" >&5
-echo "${ECHO_T}$rxvt_cv_header_sysioctl" >&6; }
-
 { echo "$as_me:$LINENO: checking for XPointer" >&5
 echo $ECHO_N "checking for XPointer... $ECHO_C" >&6; }
 if test "${rxvt_cv_xpointer+set}" = set; then
@@ -11901,26 +11845,7 @@ program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
 rm -f conftest.sed
 
 
-
-
-
-if test "$ac_cv_header_stdint_h" = "yes" -o "$notset" = "dontmatch"; then
-  include_stdint_h="#include <stdint.h>"
-else
-  include_stdint_h="/* #include <stdint.h> */"
-fi
-if test "$rxvt_cv_header_sysioctl" = "yes" -o "$notset" = "dontmatch"; then
-  include_sys_ioctl_h="#include <sys/ioctl.h>"
-else
-  include_sys_ioctl_h="/* #include <sys/ioctl.h> */"
-fi
-if test "$ac_cv_header_sys_strredir_h" = "yes" -o "$notset" = "dontmatch"; then
-  include_sys_strredir_h="#include <sys/strredir.h>"
-else
-  include_sys_strredir_h="/* #include <sys/strredir.h> */"
-fi
-
-ac_config_files="$ac_config_files Makefile doc/Makefile src/Makefile src/rxvtlib.h"
+ac_config_files="$ac_config_files Makefile doc/Makefile src/Makefile"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -12479,7 +12404,6 @@ do
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
     "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
-    "src/rxvtlib.h") CONFIG_FILES="$CONFIG_FILES src/rxvtlib.h" ;;
 
   *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
@@ -12624,14 +12548,11 @@ IF_PERL!$IF_PERL$ac_delim
 PERL_O!$PERL_O$ac_delim
 AFTERIMAGE_CFLAGS!$AFTERIMAGE_CFLAGS$ac_delim
 AFTERIMAGE_LIBS!$AFTERIMAGE_LIBS$ac_delim
-include_stdint_h!$include_stdint_h$ac_delim
-include_sys_ioctl_h!$include_sys_ioctl_h$ac_delim
-include_sys_strredir_h!$include_sys_strredir_h$ac_delim
 LIBOBJS!$LIBOBJS$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 88; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 85; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
index 58ef14acb3990f34e5dbd6c3c80b2694f973e74f..e352837f0714dc2d83b5032b3865b5c6a5651e19 100644 (file)
@@ -762,23 +762,9 @@ AC_SUBST(AFTERIMAGE_LIBS)
 
 AC_ARG_PROGRAM
 
-dnl# revert HAVE_BLAH_H into a "#include <blah.h>"
-AC_DEFUN([RXVT_DEFINE_TO_INCLUDE], dnl
-[if test "$$3" = "$4" -o "$$5" = "$6"; then
-  $1="#include <$2>"
-else
-  $1="/* #include <$2> */"
-fi dnl
-AC_SUBST($1)])
-
-RXVT_DEFINE_TO_INCLUDE(include_stdint_h, stdint.h, ac_cv_header_stdint_h, yes, notset, dontmatch)
-RXVT_DEFINE_TO_INCLUDE(include_sys_ioctl_h, sys/ioctl.h, ac_cv_header_sys_ioctl_h, yes, notset, dontmatch)
-RXVT_DEFINE_TO_INCLUDE(include_sys_strredir_h, sys/strredir.h, ac_cv_header_sys_strredir_h, yes, notset, dontmatch)
-
 AC_CONFIG_FILES([Makefile \
 doc/Makefile \
 src/Makefile \
-src/rxvtlib.h \
 ])
 AC_OUTPUT
 
index 0b77601b166f5ac56b01dcb54a63ef6c08274d41..1d12bee43f4fc593adf0d8c87b64dd9d554c492e 100644 (file)
@@ -104,7 +104,7 @@ clean:
        rm -f *.o *.lo .libs/* librxvt.la tmpproto *.tmp
 
 distclean: clean
-       rm -f Makefile rxvtlib.h
+       rm -f Makefile
 
 realclean: distclean
        rm -f tags TAGS
@@ -141,11 +141,11 @@ depend:
 
 # DO NOT DELETE: nice dependency list follows
 
-background.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h
+background.o: ../config.h rxvt.h optinc.h feature.h encoding.h
 background.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h ../libev/ev++.h
 background.o: ../libev/ev.h callback.h salloc.h libptytty.h rxvtperl.h
 background.o: hookinc.h background.h rsinc.h
-command.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h
+command.o: ../config.h rxvt.h optinc.h feature.h encoding.h
 command.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h ../libev/ev++.h
 command.o: ../libev/ev.h callback.h salloc.h libptytty.h rxvtperl.h hookinc.h
 command.o: background.h rsinc.h version.h command.h keyboard.h
@@ -167,86 +167,86 @@ encoding.o: table/compose.h table/category.h
 ev_cpp.o: ev_cpp.h ../libev/ev++.h ../libev/ev.h ../libev/ev.c ../config.h
 ev_cpp.o: ../libev/ev_vars.h ../libev/ev_epoll.c ../libev/ev_select.c
 fdpass.o: ../config.h libptytty.h
-init.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h rxvtutil.h
+init.o: ../config.h rxvt.h optinc.h feature.h encoding.h rxvtutil.h
 init.o: rxvtfont.h rxvttoolkit.h ev_cpp.h ../libev/ev++.h ../libev/ev.h
 init.o: callback.h salloc.h libptytty.h rxvtperl.h hookinc.h background.h
 init.o: rsinc.h init.h
-keyboard.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h
+keyboard.o: ../config.h rxvt.h optinc.h feature.h encoding.h
 keyboard.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h ../libev/ev++.h
 keyboard.o: ../libev/ev.h callback.h salloc.h libptytty.h rxvtperl.h
 keyboard.o: hookinc.h background.h rsinc.h keyboard.h command.h
-logging.o: ../config.h ptytty.h libptytty.h ptytty_conf.h rxvt.h rxvtlib.h
+logging.o: ../config.h ptytty.h libptytty.h ptytty_conf.h rxvt.h
 logging.o: optinc.h feature.h encoding.h rxvtutil.h rxvtfont.h rxvttoolkit.h
 logging.o: ev_cpp.h ../libev/ev++.h ../libev/ev.h callback.h salloc.h
 logging.o: rxvtperl.h hookinc.h background.h rsinc.h
-main.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h rxvtutil.h
+main.o: ../config.h rxvt.h optinc.h feature.h encoding.h rxvtutil.h
 main.o: rxvtfont.h rxvttoolkit.h ev_cpp.h ../libev/ev++.h ../libev/ev.h
 main.o: callback.h salloc.h libptytty.h rxvtperl.h hookinc.h background.h
 main.o: rsinc.h keyboard.h
-misc.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h rxvtutil.h
+misc.o: ../config.h rxvt.h optinc.h feature.h encoding.h rxvtutil.h
 misc.o: rxvtfont.h rxvttoolkit.h ev_cpp.h ../libev/ev++.h ../libev/ev.h
 misc.o: callback.h salloc.h libptytty.h rxvtperl.h hookinc.h background.h
 misc.o: rsinc.h
-proxy.o: ../config.h ptytty.h libptytty.h ptytty_conf.h rxvt.h rxvtlib.h
+proxy.o: ../config.h ptytty.h libptytty.h ptytty_conf.h rxvt.h
 proxy.o: optinc.h feature.h encoding.h rxvtutil.h rxvtfont.h rxvttoolkit.h
 proxy.o: ev_cpp.h ../libev/ev++.h ../libev/ev.h callback.h salloc.h
 proxy.o: rxvtperl.h hookinc.h background.h rsinc.h
-ptytty.o: ../config.h ptytty.h libptytty.h ptytty_conf.h rxvt.h rxvtlib.h
+ptytty.o: ../config.h ptytty.h libptytty.h ptytty_conf.h rxvt.h
 ptytty.o: optinc.h feature.h encoding.h rxvtutil.h rxvtfont.h rxvttoolkit.h
 ptytty.o: ev_cpp.h ../libev/ev++.h ../libev/ev.h callback.h salloc.h
 ptytty.o: rxvtperl.h hookinc.h background.h rsinc.h
-rxvt.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h rxvtutil.h
+rxvt.o: ../config.h rxvt.h optinc.h feature.h encoding.h rxvtutil.h
 rxvt.o: rxvtfont.h rxvttoolkit.h ev_cpp.h ../libev/ev++.h ../libev/ev.h
 rxvt.o: callback.h salloc.h libptytty.h rxvtperl.h hookinc.h background.h
 rxvt.o: rsinc.h
-rxvtc.o: ../config.h rxvtdaemon.h rxvtutil.h libptytty.h rxvt.h rxvtlib.h
+rxvtc.o: ../config.h rxvtdaemon.h rxvtutil.h libptytty.h rxvt.h
 rxvtc.o: optinc.h feature.h encoding.h rxvtfont.h rxvttoolkit.h ev_cpp.h
 rxvtc.o: ../libev/ev++.h ../libev/ev.h callback.h salloc.h rxvtperl.h
 rxvtc.o: hookinc.h background.h rsinc.h
-rxvtd.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h
+rxvtd.o: ../config.h rxvt.h optinc.h feature.h encoding.h
 rxvtd.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h ../libev/ev++.h
 rxvtd.o: ../libev/ev.h callback.h salloc.h libptytty.h rxvtperl.h hookinc.h
 rxvtd.o: 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: ../config.h rxvt.h optinc.h feature.h encoding.h
 rxvtfont.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h ../libev/ev++.h
 rxvtfont.o: ../libev/ev.h callback.h salloc.h libptytty.h rxvtperl.h
 rxvtfont.o: hookinc.h background.h rsinc.h table/linedraw.h
 rxvtperl.o: ../config.h ev_cpp.h ../libev/ev++.h ../libev/ev.h rxvt.h
-rxvtperl.o: rxvtlib.h optinc.h feature.h encoding.h rxvtutil.h rxvtfont.h
+rxvtperl.o: optinc.h feature.h encoding.h rxvtutil.h rxvtfont.h
 rxvtperl.o: rxvttoolkit.h callback.h salloc.h libptytty.h rxvtperl.h
 rxvtperl.o: hookinc.h background.h rsinc.h keyboard.h perlxsi.c ./iom_perl.h
-rxvttoolkit.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h
+rxvttoolkit.o: ../config.h rxvt.h optinc.h feature.h encoding.h
 rxvttoolkit.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h ../libev/ev++.h
 rxvttoolkit.o: ../libev/ev.h callback.h salloc.h libptytty.h rxvtperl.h
 rxvttoolkit.o: 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: ../config.h rxvt.h optinc.h feature.h encoding.h
 screen.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h ../libev/ev++.h
 screen.o: ../libev/ev.h callback.h salloc.h libptytty.h rxvtperl.h hookinc.h
 screen.o: background.h rsinc.h salloc.C
-scrollbar-next.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h
+scrollbar-next.o: ../config.h rxvt.h optinc.h feature.h encoding.h
 scrollbar-next.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h
 scrollbar-next.o: ../libev/ev++.h ../libev/ev.h callback.h salloc.h
 scrollbar-next.o: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h
-scrollbar-plain.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h
+scrollbar-plain.o: ../config.h rxvt.h optinc.h feature.h encoding.h
 scrollbar-plain.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h
 scrollbar-plain.o: ../libev/ev++.h ../libev/ev.h callback.h salloc.h
 scrollbar-plain.o: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h
-scrollbar-rxvt.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h
+scrollbar-rxvt.o: ../config.h rxvt.h optinc.h feature.h encoding.h
 scrollbar-rxvt.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h
 scrollbar-rxvt.o: ../libev/ev++.h ../libev/ev.h callback.h salloc.h
 scrollbar-rxvt.o: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h
-scrollbar-xterm.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h
+scrollbar-xterm.o: ../config.h rxvt.h optinc.h feature.h encoding.h
 scrollbar-xterm.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h
 scrollbar-xterm.o: ../libev/ev++.h ../libev/ev.h callback.h salloc.h
 scrollbar-xterm.o: libptytty.h rxvtperl.h hookinc.h background.h rsinc.h
-scrollbar.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h
+scrollbar.o: ../config.h rxvt.h optinc.h feature.h encoding.h
 scrollbar.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h ../libev/ev++.h
 scrollbar.o: ../libev/ev.h callback.h salloc.h libptytty.h rxvtperl.h
 scrollbar.o: hookinc.h background.h rsinc.h
-xdefaults.o: ../config.h rxvt.h rxvtlib.h optinc.h feature.h encoding.h
+xdefaults.o: ../config.h rxvt.h optinc.h feature.h encoding.h
 xdefaults.o: rxvtutil.h rxvtfont.h rxvttoolkit.h ev_cpp.h ../libev/ev++.h
 xdefaults.o: ../libev/ev.h callback.h salloc.h libptytty.h rxvtperl.h
 xdefaults.o: hookinc.h background.h rsinc.h version.h keyboard.h
index 56c86a6ddb2edb0b3a72e93a5f49116a13714540..207e3bea63f446fc60dffb9877c130d1b37f7cb5 100644 (file)
@@ -1,4 +1,4 @@
-// all resource indices, used by rxvtlib.h and rxvtperl.xs
+// all resource indices, used by rxvt.h and rxvtperl.xs
 
  def(loginShell,            1)
  def(iconic,                2)
index 003dbe5b80cf4e586fefd4690b1926df13f6b819..356471cc26fb812499b450c27d95e713c0e796c6 100644 (file)
@@ -1,7 +1,49 @@
 #ifndef RXVT_H_                /* include once only */
 #define RXVT_H_
 
-#include "rxvtlib.h"
+#include <cstdio>
+#include <cctype>
+#include <cerrno>
+#include <cstdarg>
+#include <cstdlib>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <sys/types.h>
+#include <unistd.h>
+#include <cstring>
+#include <assert.h>
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#ifdef HAVE_SYS_STRREDIR_H
+#include <sys/strredir.h>
+#endif
+
+#if HAVE_CWCHAR
+# include <cwchar>
+#elif HAVE_WCHAR_H
+# include <wchar.h>
+#else
+// stdlib.h might provide it
+#endif
+
+using namespace std;
+
+extern "C" {
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xresource.h>
+}
+
+#if UNICODE_3
+typedef uint32_t text_t;
+#else
+typedef uint16_t text_t; // saves lots of memory
+#endif
+typedef uint32_t rend_t;
+typedef  int32_t tlen_t;  // was int16_t, but this results in smaller code and memory use
+typedef  int32_t tlen_t_; // specifically for use in the line_t structure
 
 #include "feature.h"
 
@@ -112,6 +154,7 @@ class out_of_input { };
 extern bool rxvt_set_locale (const char *locale) NOTHROW;
 extern void rxvt_push_locale (const char *locale) NOTHROW;
 extern void rxvt_pop_locale () NOTHROW;
+void rxvt_init ();
 
 // misc.C
 char *           rxvt_wcstombs                    (const wchar_t *str, int len = -1);
@@ -842,6 +885,191 @@ extern class rxvt_composite_vec rxvt_composite;
 class keyboard_manager;
 #endif
 
+typedef struct rxvt_term *rxvt_t;
+
+extern rxvt_t rxvt_current_term;
+
+#define SET_R(r) rxvt_current_term = const_cast<rxvt_term *>(r)
+#define GET_R rxvt_current_term
+
+typedef struct {
+  int row;
+  int col;
+} row_col_t;
+
+/*
+ * terminal limits:
+ *
+ *  width      : 1 <= width
+ *  height     : 1 <= height
+ *  ncol       : 1 <= ncol       <= MAX(tlen_t)
+ *  nrow       : 1 <= nrow       <= MAX(int)
+ *  saveLines  : 0 <= saveLines  <= MAX(int)
+ *  term_start : 0 <= term_start < saveLines
+ *  total_rows : nrow + saveLines
+ *
+ *  top_row    : -saveLines <= top_row    <= 0
+ *  view_start : top_row    <= view_start <= 0
+ *
+ *          | most coordinates are stored relative to term_start,
+ *  ROW_BUF | which is the first line of the terminal screen
+ *  |························= row_buf[0]
+ *  |························= row_buf[1]
+ *  |························= row_buf[2] etc.
+ *  |
+ *  +------------+···········= term_start + top_row
+ *  | scrollback |
+ *  | scrollback +---------+·= term_start + view_start
+ *  | scrollback | display |
+ *  | scrollback | display |
+ *  +------------+·display·+·= term_start
+ *  |  terminal  | display |
+ *  |  terminal  +---------+
+ *  |  terminal  |
+ *  |  terminal  |
+ *  +------------+···········= term_stat + nrow - 1
+ *  |
+ *  |
+ *  END······················= total_rows
+ */
+
+struct TermWin_t {
+  int            width;         /* window width                    [pixels] */
+  int            height;        /* window height                   [pixels] */
+  int            fwidth;        /* font width                      [pixels] */
+  int            fheight;       /* font height                     [pixels] */
+  int            fbase;         /* font ascent (baseline)          [pixels] */
+  int            ncol;          /* window columns              [characters] */
+  int            nrow;          /* window rows                 [characters] */
+  int            focus;         /* window has focus                         */
+  int            mapped;        /* window state mapped?                     */
+  int            int_bwidth;    /* internal border width                    */
+  int            ext_bwidth;    /* external border width                    */
+  int            lineSpace;     /* number of extra pixels between rows      */
+  int            saveLines;     /* number of lines that fit in scrollback   */
+  int            total_rows;    /* total number of rows in this terminal    */
+  int            term_start;    /* term lines start here                    */
+  int            view_start;    /* scrollback view starts here              */
+  int            top_row;       /* topmost row index of scrollback          */
+  Window         parent[6];     /* parent identifiers - we're parent[0]     */
+  Window         vt;            /* vt100 window                             */
+  GC             gc;            /* GC for drawing                           */
+  Pixmap         pixmap;
+  rxvt_drawable *drawable;
+  rxvt_fontset  *fontset[4];
+};
+
+/*
+ * screen accounting:
+ * screen_t elements
+ *   row:       Cursor row position                   : 0 <= row < nrow
+ *   col:       Cursor column position                : 0 <= col < ncol
+ *   tscroll:   Scrolling region top row inclusive    : 0 <= row < nrow
+ *   bscroll:   Scrolling region bottom row inclusive : 0 <= row < nrow
+ *
+ * selection_t elements
+ *   clicks:    1, 2 or 3 clicks - 4 indicates a special condition of 1 where
+ *              nothing is selected
+ *   beg:       row/column of beginning of selection  : never past mark
+ *   mark:      row/column of initial click           : never past end
+ *   end:       row/column of one character past end of selection
+ * * Note: -nsaved <= beg.row <= mark.row <= end.row < nrow
+ * * Note: col == -1 ==> we're left of screen
+ *
+ */
+typedef struct {
+  row_col_t       cur;          /* cursor position on the screen             */
+  int             tscroll;      /* top of settable scroll region             */
+  int             bscroll;      /* bottom of settable scroll region          */
+  unsigned int    charset;      /* character set number [0..3]               */
+  unsigned int    flags;        /* see below                                 */
+  row_col_t       s_cur;        /* saved cursor position                     */
+  unsigned int    s_charset;    /* saved character set number [0..3]         */
+  char            s_charset_char;
+  rend_t          s_rstyle;     /* saved rendition style                     */
+} screen_t;
+
+enum selection_op_t {
+  SELECTION_CLEAR = 0,  /* nothing selected                          */
+  SELECTION_INIT,       /* marked a point                            */
+  SELECTION_BEGIN,      /* started a selection                       */
+  SELECTION_CONT,       /* continued selection                       */
+  SELECTION_DONE        /* selection put in CUT_BUFFER0              */
+};
+
+typedef struct {
+  wchar_t          *text;       /* selected text                             */
+  unsigned int      len;        /* length of selected text                   */
+  unsigned int      screen;     /* screen being used                         */
+  unsigned int      clicks;     /* number of clicks                          */
+  selection_op_t    op;         /* current operation                         */
+  bool              rect;       /* rectangular selection?                    */
+  row_col_t         beg;        /* beginning of selection   <= mark          */
+  row_col_t         mark;       /* point of initial click   <= end           */
+  row_col_t         end;        /* one character past end point              */
+} selection_t;
+
+/* ------------------------------------------------------------------------- */
+
+/* screen_t flags */
+#define Screen_Relative          (1<<0)  /* relative origin mode flag         */
+#define Screen_VisibleCursor     (1<<1)  /* cursor visible?                   */
+#define Screen_Autowrap          (1<<2)  /* auto-wrap flag                    */
+#define Screen_Insert            (1<<3)  /* insert mode (vs. overstrike)      */
+#define Screen_WrapNext          (1<<4)  /* need to wrap for next char?       */
+#define Screen_DefaultFlags      (Screen_VisibleCursor | Screen_Autowrap)
+
+/* rxvt_vars.options */
+enum {
+# define def(name,idx) Opt_ ## name = idx,
+# define nodef(name)   Opt_ ## name = 0,
+# include "optinc.h"
+# undef nodef
+# undef def
+Opt_count
+};
+
+/* ------------------------------------------------------------------------- */
+
+typedef struct {
+  char            state;        /* scrollbar state                          */
+  char            init;         /* scrollbar has been initialised           */
+  unsigned int    beg;          /* slider sub-window begin height           */
+  unsigned int    end;          /* slider sub-window end height             */
+  unsigned int    top;          /* slider top position                      */
+  unsigned int    bot;          /* slider bottom position                   */
+  unsigned int    style;        /* style: rxvt, xterm, next                 */
+  unsigned int    width;        /* scrollbar width                          */
+  Window          win;
+  int             (rxvt_term::*update)(int, int, int, int);
+
+  void setIdle()   { state =  1 ; }
+  void setMotion() { state = 'm'; }
+  void setUp()     { state = 'U'; }
+  void setDn()     { state = 'D'; }
+} scrollBar_t;
+
+struct rxvt_vars : TermWin_t {
+  scrollBar_t     scrollBar;
+  uint8_t         options[(Opt_count + 7) >> 3];
+  XSizeHints      szHint;
+  rxvt_color     *pix_colors;
+  rxvt_color     *pix_colors_focused;
+#ifdef OFF_FOCUS_FADING
+  rxvt_color     *pix_colors_unfocused;
+#endif
+  Cursor          TermWin_cursor;       /* cursor for vt window */
+  int             sb_shadow;    /* scrollbar shadow width                    */
+  int             numlock_state;
+  line_t         *row_buf;      // all lines, scrollback + terminal, circular, followed by temp_buf
+  line_t         *drawn_buf;    // text on screen
+  line_t         *swap_buf;     // lines for swap buffer
+  char           *tabs;         /* per location: 1 == tab-stop               */
+  screen_t        screen;
+  screen_t        swap;
+  selection_t     selection;
+};
+
 struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen {
 
   // special markers with magic addresses
diff --git a/src/rxvtlib.h.in b/src/rxvtlib.h.in
deleted file mode 100644 (file)
index aab9747..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
-#ifndef _RXVTLIB_H_             /* include once only */
-#define _RXVTLIB_H_
-
-#include <cstdio>
-#include <cctype>
-#include <cerrno>
-#include <cstdarg>
-#include <cstdlib>
-@include_stdint_h@
-#include <sys/types.h>
-#include <unistd.h>
-#include <cstring>
-#include <assert.h>
-@include_sys_ioctl_h@
-@include_sys_strredir_h@
-
-#if HAVE_CWCHAR
-# include <cwchar>
-#elif HAVE_WCHAR_H
-# include <wchar.h>
-#else
-// stdlib.h might provide it
-#endif
-
-using namespace std;
-
-extern "C" {
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xresource.h>
-}
-
-struct rxvt_fontset;
-struct rxvt_color;
-struct rxvt_term;
-struct rxvt_drawable;
-
-typedef struct rxvt_term *rxvt_t;
-
-extern rxvt_t rxvt_current_term;
-
-#define SET_R(r) rxvt_current_term = const_cast<rxvt_term *>(r)
-#define GET_R rxvt_current_term
-
-typedef struct {
-  int row;
-  int col;
-} row_col_t;
-
-#if UNICODE_3
-typedef uint32_t text_t;
-#else
-typedef uint16_t text_t; // saves lots of memory
-#endif
-typedef uint32_t rend_t;
-typedef  int32_t tlen_t;  // was int16_t, but this results in smaller code and memory use
-typedef  int32_t tlen_t_; // specifically for use in the line_t structure
-
-struct line_t;
-
-/*
- * terminal limits:
- *
- *  width      : 1 <= width
- *  height     : 1 <= height
- *  ncol       : 1 <= ncol       <= MAX(tlen_t)
- *  nrow       : 1 <= nrow       <= MAX(int)
- *  saveLines  : 0 <= saveLines  <= MAX(int)
- *  term_start : 0 <= term_start < saveLines
- *  total_rows : nrow + saveLines
- *
- *  top_row    : -saveLines <= top_row    <= 0
- *  view_start : top_row    <= view_start <= 0
- *
- *          | most coordinates are stored relative to term_start,
- *  ROW_BUF | which is the first line of the terminal screen
- *  |························= row_buf[0]
- *  |························= row_buf[1]
- *  |························= row_buf[2] etc.
- *  |
- *  +------------+···········= term_start + top_row
- *  | scrollback |
- *  | scrollback +---------+·= term_start + view_start
- *  | scrollback | display |
- *  | scrollback | display |
- *  +------------+·display·+·= term_start
- *  |  terminal  | display |
- *  |  terminal  +---------+
- *  |  terminal  |
- *  |  terminal  |
- *  +------------+···········= term_stat + nrow - 1
- *  |
- *  |
- *  END······················= total_rows
- */
-
-struct TermWin_t {
-  int            width;         /* window width                    [pixels] */
-  int            height;        /* window height                   [pixels] */
-  int            fwidth;        /* font width                      [pixels] */
-  int            fheight;       /* font height                     [pixels] */
-  int            fbase;         /* font ascent (baseline)          [pixels] */
-  int            ncol;          /* window columns              [characters] */
-  int            nrow;          /* window rows                 [characters] */
-  int            focus;         /* window has focus                         */
-  int            mapped;        /* window state mapped?                     */
-  int            int_bwidth;    /* internal border width                    */
-  int            ext_bwidth;    /* external border width                    */
-  int            lineSpace;     /* number of extra pixels between rows      */
-  int            saveLines;     /* number of lines that fit in scrollback   */
-  int            total_rows;    /* total number of rows in this terminal    */
-  int            term_start;    /* term lines start here                    */
-  int            view_start;    /* scrollback view starts here              */
-  int            top_row;       /* topmost row index of scrollback          */
-  Window         parent[6];     /* parent identifiers - we're parent[0]     */
-  Window         vt;            /* vt100 window                             */
-  GC             gc;            /* GC for drawing                           */
-  Pixmap         pixmap;
-  rxvt_drawable *drawable;
-  rxvt_fontset  *fontset[4];
-};
-
-/*
- * screen accounting:
- * screen_t elements
- *   row:       Cursor row position                   : 0 <= row < nrow
- *   col:       Cursor column position                : 0 <= col < ncol
- *   tscroll:   Scrolling region top row inclusive    : 0 <= row < nrow
- *   bscroll:   Scrolling region bottom row inclusive : 0 <= row < nrow
- *
- * selection_t elements
- *   clicks:    1, 2 or 3 clicks - 4 indicates a special condition of 1 where
- *              nothing is selected
- *   beg:       row/column of beginning of selection  : never past mark
- *   mark:      row/column of initial click           : never past end
- *   end:       row/column of one character past end of selection
- * * Note: -nsaved <= beg.row <= mark.row <= end.row < nrow
- * * Note: col == -1 ==> we're left of screen
- *
- */
-typedef struct {
-  row_col_t       cur;          /* cursor position on the screen             */
-  int             tscroll;      /* top of settable scroll region             */
-  int             bscroll;      /* bottom of settable scroll region          */
-  unsigned int    charset;      /* character set number [0..3]               */
-  unsigned int    flags;        /* see below                                 */
-  row_col_t       s_cur;        /* saved cursor position                     */
-  unsigned int    s_charset;    /* saved character set number [0..3]         */
-  char            s_charset_char;
-  rend_t          s_rstyle;     /* saved rendition style                     */
-} screen_t;
-
-enum selection_op_t {
-  SELECTION_CLEAR = 0,  /* nothing selected                          */
-  SELECTION_INIT,       /* marked a point                            */
-  SELECTION_BEGIN,      /* started a selection                       */
-  SELECTION_CONT,       /* continued selection                       */
-  SELECTION_DONE        /* selection put in CUT_BUFFER0              */
-};
-
-typedef struct {
-  wchar_t          *text;       /* selected text                             */
-  unsigned int      len;        /* length of selected text                   */
-  unsigned int      screen;     /* screen being used                         */
-  unsigned int      clicks;     /* number of clicks                          */
-  selection_op_t    op;         /* current operation                         */
-  bool              rect;       /* rectangular selection?                    */
-  row_col_t         beg;        /* beginning of selection   <= mark          */
-  row_col_t         mark;       /* point of initial click   <= end           */
-  row_col_t         end;        /* one character past end point              */
-} selection_t;
-
-/* ------------------------------------------------------------------------- */
-
-/* screen_t flags */
-#define Screen_Relative          (1<<0)  /* relative origin mode flag         */
-#define Screen_VisibleCursor     (1<<1)  /* cursor visible?                   */
-#define Screen_Autowrap          (1<<2)  /* auto-wrap flag                    */
-#define Screen_Insert            (1<<3)  /* insert mode (vs. overstrike)      */
-#define Screen_WrapNext          (1<<4)  /* need to wrap for next char?       */
-#define Screen_DefaultFlags      (Screen_VisibleCursor | Screen_Autowrap)
-
-/* rxvt_vars.options */
-enum {
-# define def(name,idx) Opt_ ## name = idx,
-# define nodef(name)   Opt_ ## name = 0,
-# include "optinc.h"
-# undef nodef
-# undef def
-Opt_count
-};
-
-/* ------------------------------------------------------------------------- */
-
-typedef struct {
-  char            state;        /* scrollbar state                          */
-  char            init;         /* scrollbar has been initialised           */
-  unsigned int    beg;          /* slider sub-window begin height           */
-  unsigned int    end;          /* slider sub-window end height             */
-  unsigned int    top;          /* slider top position                      */
-  unsigned int    bot;          /* slider bottom position                   */
-  unsigned int    style;        /* style: rxvt, xterm, next                 */
-  unsigned int    width;        /* scrollbar width                          */
-  Window          win;
-  int             (rxvt_term::*update)(int, int, int, int);
-
-  void setIdle()   { state =  1 ; }
-  void setMotion() { state = 'm'; }
-  void setUp()     { state = 'U'; }
-  void setDn()     { state = 'D'; }
-} scrollBar_t;
-
-struct rxvt_vars : TermWin_t {
-  scrollBar_t     scrollBar;
-  uint8_t         options[(Opt_count + 7) >> 3];
-  XSizeHints      szHint;
-  rxvt_color     *pix_colors;
-  rxvt_color     *pix_colors_focused;
-#ifdef OFF_FOCUS_FADING
-  rxvt_color     *pix_colors_unfocused;
-#endif
-  Cursor          TermWin_cursor;       /* cursor for vt window */
-  int             sb_shadow;    /* scrollbar shadow width                    */
-  int             numlock_state;
-  line_t         *row_buf;      // all lines, scrollback + terminal, circular, followed by temp_buf
-  line_t         *drawn_buf;    // text on screen
-  line_t         *swap_buf;     // lines for swap buffer
-  char           *tabs;         /* per location: 1 == tab-stop               */
-  screen_t        screen;
-  screen_t        swap;
-  selection_t     selection;
-};
-
-void rxvt_init ();
-
-#endif                          /* _RXVTLIB_H_ */
-