diff --git a/.label-2_4 b/.label-2_4 new file mode 100644 index 000000000..b51e792a9 --- /dev/null +++ b/.label-2_4 @@ -0,0 +1,177 @@ +; QOCCA Label File: .label-2_4 for PDCurses +1.1 PDCurses/pdcurses/Makefile.in +1.1 PDCurses/pdcurses/README +1.1 PDCurses/pdcurses/addch.c +1.1 PDCurses/pdcurses/addchstr.c +1.1 PDCurses/pdcurses/addstr.c +1.1 PDCurses/pdcurses/attr.c +1.1 PDCurses/pdcurses/beep.c +1.1 PDCurses/pdcurses/bkgd.c +1.1 PDCurses/pdcurses/border.c +1.1 PDCurses/pdcurses/clear.c +1.1 PDCurses/pdcurses/color.c +1.1 PDCurses/pdcurses/delch.c +1.1 PDCurses/pdcurses/deleteln.c +1.1 PDCurses/pdcurses/getch.c +1.1 PDCurses/pdcurses/getstr.c +1.1 PDCurses/pdcurses/getyx.c +1.1 PDCurses/pdcurses/inch.c +1.1 PDCurses/pdcurses/inchstr.c +1.1 PDCurses/pdcurses/initscr.c +1.1 PDCurses/pdcurses/inopts.c +1.1 PDCurses/pdcurses/insch.c +1.1 PDCurses/pdcurses/insstr.c +1.1 PDCurses/pdcurses/instr.c +1.1 PDCurses/pdcurses/kernel.c +1.1 PDCurses/pdcurses/mouse.c +1.1 PDCurses/pdcurses/move.c +1.1 PDCurses/pdcurses/outopts.c +1.1 PDCurses/pdcurses/overlay.c +1.1 PDCurses/pdcurses/pad.c +1.1 PDCurses/pdcurses/pdcdebug.c +1.1 PDCurses/pdcurses/pdcutil.c +1.1 PDCurses/pdcurses/pdcwin.c +1.1 PDCurses/pdcurses/printw.c +1.1 PDCurses/pdcurses/refresh.c +1.1 PDCurses/pdcurses/scanw.c +1.1 PDCurses/pdcurses/scroll.c +1.1 PDCurses/pdcurses/slk.c +1.1 PDCurses/pdcurses/termattr.c +1.1 PDCurses/pdcurses/terminfo.c +1.1 PDCurses/pdcurses/touch.c +1.1 PDCurses/pdcurses/util.c +1.1 PDCurses/pdcurses/window.c +1.1 PDCurses/demos/Makefile.in +1.1 PDCurses/demos/firework.c +1.1 PDCurses/demos/newdemo.c +1.1 PDCurses/demos/ptest.c +1.1 PDCurses/demos/testcurs.c +1.1 PDCurses/demos/tui.c +1.1 PDCurses/demos/tui.h +1.1 PDCurses/demos/tuidemo.c +1.1 PDCurses/demos/xmas.c +1.1 PDCurses/doc/intro.man +1.1 PDCurses/doc/x11.man +1.1 PDCurses/doc/latin-1.man +1.1 PDCurses/doc/overview.man +1.2 PDCurses/panel/Makefile.in +1.2 PDCurses/panel/README +1.2 PDCurses/panel/panel.c +1.1 PDCurses/saa/Makefile.in +1.2 PDCurses/dos/README +1.2 PDCurses/dos/bccdos.ini +1.2 PDCurses/dos/bccdos.lrf +1.2 PDCurses/dos/bccdos.mak +1.2 PDCurses/dos/bccdos.rsp +1.2 PDCurses/dos/gccdos.lrf +1.2 PDCurses/dos/dos-bcc.rsp +1.2 PDCurses/dos/dos-tcc.rsp +1.2 PDCurses/dos/gccdos.mak +1.2 PDCurses/dos/mscdos.ini +1.2 PDCurses/dos/mscdos.lrf +1.2 PDCurses/dos/mscdos.mak +1.2 PDCurses/dos/pdcclip.c +1.2 PDCurses/dos/msvcdos.mak +1.2 PDCurses/dos/pdcdisp.c +1.2 PDCurses/dos/pdcgetsc.c +1.2 PDCurses/dos/pdcgo32.c +1.2 PDCurses/dos/pdckbd.c +1.2 PDCurses/dos/pdcprint.c +1.2 PDCurses/dos/pdcscrn.c +1.2 PDCurses/dos/pdcsetsc.c +1.2 PDCurses/dos/wccdos.lrf +1.2 PDCurses/dos/wccdos16.mak +1.2 PDCurses/dos/wccdos4g.mak +1.2 PDCurses/os2/README +1.2 PDCurses/os2/bccos2.ini +1.2 PDCurses/os2/bccos2.lrf +1.2 PDCurses/os2/bccos2.mak +1.2 PDCurses/os2/gccos2.mak +1.2 PDCurses/os2/ibmos2.ini +1.2 PDCurses/os2/iccos2.ini +1.2 PDCurses/os2/iccos2.lrf +1.2 PDCurses/os2/iccos2.mak +1.2 PDCurses/os2/os2ibm.ini +1.2 PDCurses/os2/os2-bcc.rsp +1.2 PDCurses/os2/pdcclip.c +1.2 PDCurses/os2/pdcdisp.c +1.2 PDCurses/os2/pdcgetsc.c +1.2 PDCurses/os2/pdckbd.c +1.2 PDCurses/os2/pdcprint.c +1.2 PDCurses/os2/pdcscrn.c +1.2 PDCurses/os2/pdcsetsc.c +1.2 PDCurses/os2/wccos2.lrf +1.2 PDCurses/os2/pdcurses.def +1.2 PDCurses/os2/pdcurses.lnk +1.2 PDCurses/os2/wccos2.mak +1.1 PDCurses/x11/README +1.1 PDCurses/x11/sb.c +1.1 PDCurses/x11/ScrollBox.c +1.1 PDCurses/x11/ScrollBox.h +1.1 PDCurses/x11/ScrollBoxP.h +1.1 PDCurses/x11/XCurses.def +1.1 PDCurses/x11/latin1kbd.h +1.1 PDCurses/x11/pdcclip.c +1.1 PDCurses/x11/pdcdisp.c +1.1 PDCurses/x11/pdcgetsc.c +1.1 PDCurses/x11/pdckbd.c +1.1 PDCurses/x11/pdcprint.c +1.1 PDCurses/x11/pdcscrn.c +1.1 PDCurses/x11/pdcsetsc.c +1.1 PDCurses/x11/x11.c +1.1 PDCurses/x11/xcurs32.xbm +1.1 PDCurses/x11/xcurs64.xbm +1.1 PDCurses/win32/README +1.1 PDCurses/win32/bccwin32.lrf +1.1 PDCurses/win32/bccwin32.mak +1.1 PDCurses/win32/curses.def +1.1 PDCurses/win32/gccwin32.mak +1.1 PDCurses/win32/lccwin32.mak +1.1 PDCurses/win32/mingwin32.mak +1.1 PDCurses/win32/pdcclip.c +1.1 PDCurses/win32/pdcdisp.c +1.1 PDCurses/win32/pdcgetsc.c +1.1 PDCurses/win32/pdckbd.c +1.1 PDCurses/win32/pdcprint.c +1.1 PDCurses/win32/pdcscrn.c +1.1 PDCurses/win32/pdcsetsc.c +1.1 PDCurses/win32/pdcurses.ico +1.1 PDCurses/win32/pdcurses.rc +1.1 PDCurses/win32/vcwin32.mak +1.1 PDCurses/win32/w95-bcc.rsp +1.1 PDCurses/win32/wccwin32.lrf +1.1 PDCurses/win32/wccwin32.mak +1.1 PDCurses/flexos/README +1.1 PDCurses/flexos/fo_16bit.c +1.1 PDCurses/flexos/fo_8bit.c +1.1 PDCurses/flexos/fo_gname.c +1.1 PDCurses/flexos/pdcdisp.c +1.1 PDCurses/flexos/pdcgetsc.c +1.1 PDCurses/flexos/pdckbd.c +1.1 PDCurses/flexos/pdcprint.c +1.1 PDCurses/flexos/pdcscrn.c +1.1 PDCurses/flexos/pdcsetsc.c +1.1 PDCurses/tools/Makefile.in +1.1 PDCurses/tools/manext.c +1.1 PDCurses/INSTALL +1.1 PDCurses/README +1.1 PDCurses/Makefile.in +1.1 PDCurses/aclocal.m4 +1.1 PDCurses/config.sub +1.1 PDCurses/config.guess +1.1 PDCurses/config.h.in +1.1 PDCurses/configure +1.2 PDCurses/curses.h +1.2 PDCurses/curspriv.h +1.1 PDCurses/install-sh +1.2 PDCurses/panel.h +1.1 PDCurses/maintain.er +1.1 PDCurses/makezip.cmd +1.1 PDCurses/pdc64.gif +1.1 PDCurses/readme.20 +1.1 PDCurses/readme.21 +1.1 PDCurses/readme.22 +1.1 PDCurses/readme.23 +1.1 PDCurses/readme.24 +1.2 PDCurses/x11.h +1.1 PDCurses/.label-2_4 diff --git a/Makefile.in b/Makefile.in index be6a5fb91..56f6742e6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -4,8 +4,8 @@ SHELL = /bin/sh @SET_MAKE@ -VER=25 -VER_DOT=2.5 +VER=24 +VER_DOT=2.4 PDC_DIR=PDCurses-$(VER_DOT) srcdir =@srcdir@ @@ -15,11 +15,9 @@ exec_prefix =@exec_prefix@ libdir =$(exec_prefix)/lib includedir =$(exec_prefix)/include -INSTALL =$(srcdir)/install-sh +INSTALL =@INSTALL@ +INSTALL_DATA =@INSTALL_DATA@ RANLIB =@RANLIB@ -RXLIBPRE = @RXLIBPRE@ -RXLIBPST = @RXLIBPST@ -SHLFILE = XCurses all :: pdcurses demos panel @@ -34,16 +32,14 @@ realclean :: cd tools; $(MAKE) $(MFLAGS) $@ install: - $(INSTALL) -d -m 755 $(libdir) - $(INSTALL) -d -m 755 $(includedir) - $(INSTALL) -c -m 644 $(srcdir)/curses.h $(includedir)/xcurses.h - sed -e 's/#include /#include /' < $(srcdir)/panel.h > ./xpanel.h - $(INSTALL) -m 644 ./xpanel.h $(includedir)/xpanel.h - $(INSTALL) -c -m 644 pdcurses/libXCurses.a $(libdir)/libXCurses.a - -$(RANLIB) $(libdir)/libXCurses.a - $(INSTALL) -c -m 555 pdcurses/$(RXLIBPRE)$(SHLFILE)$(RXLIBPST) $(libdir)/$(RXLIBPRE)$(SHLFILE)$(RXLIBPST) - $(INSTALL) -c -m 644 panel/libpanel.a $(libdir)/libpanel.a - -$(RANLIB) $(libdir)/libpanel.a + $(INSTALL_DATA) $(srcdir)/curses.h $(includedir)/xcurses.h + sed -e 's/#include /#include/' < panel.h > xpanel.h + $(INSTALL_DATA) $(srcdir)/xpanel.h $(includedir)/panel.h + $(INSTALL_DATA) pdcurses/libXCurses.a $(libdir)/libXCurses.a + $(INSTALL_DATA) pdcurses/$(RXLIBPRE)$(SHLFILE)$(RXLIBPST) $(libdir)/$(RXLIBPRE)$(SHLFILE)$(RXLIBPST) + $(RANLIB) $(libdir)/libXCurses.a + $(INSTALL_DATA) panel/libpanel.a $(libdir)/libpanel.a + $(RANLIB) $(libdir)/libpanel.a clean :: rm -f config.log config.cache config.status @@ -58,49 +54,46 @@ manual: zip: zip -y pdcurs$(VER) README INSTALL TODO Makefile.in config.h.in configure \ configure.in config.guess config.sub install-sh aclocal.m4 pdc64.gif \ - curses.h xcurses.h curspriv.h panel.h maintain.er readme.* makezip.cmd \ + curses.h xcurses.h curspriv.h panel.h x11.h maintain.er readme.* makezip.cmd \ pdcurses/README pdcurses/*.c demos/*.c demos/*.h \ panel/README panel/*.c \ saa/README saa/Makefile.in \ dos/README dos/*.c dos/*.ini dos/*.rsp dos/*.lnk dos/*.mak dos/*.lrf \ os2/README os2/*.c os2/*.ini os2/*.rsp os2/*.lnk os2/*.mak os2/*.lrf os2/*.def \ - x11/README x11/*.c x11/*.xbm x11/*.def x11/*.h x11/process/*.c \ - x11/process/*.c x11/process/*.h x11/thread/*.c x11/thread/*.h \ + x11/README x11/*.c x11/*.xbm x11/*.def x11/*.h \ win32/README win32/*.c win32/*.rsp win32/*.lnk win32/*.ini win32/*.mak win32/*.lrf win32/*.def win32/*.ico win32/*.rc \ flexos/README flexos/*.c doc/*.man tools/manext.c \ pdcurses/Makefile.in demos/Makefile.in panel/Makefile.in tools/Makefile.in dist: - (cd ..; tar cvf - $(PDC_DIR)/README $(PDC_DIR)/INSTALL $(PDC_DIR)/TODO $(PDC_DIR)/Makefile.in \ + (cd ..; tar cvf - $(PDC_DIR)/README $(PDC_DIR)/INSTALL $(PDC_DIR)/README $(PDC_DIR)/Makefile.in \ $(PDC_DIR)/config.h.in $(PDC_DIR)/configure $(PDC_DIR)/config.guess $(PDC_DIR)/aclocal.m4 \ - $(PDC_DIR)/config.sub $(PDC_DIR)/configure.in $(PDC_DIR)/install-sh $(PDC_DIR)/curses.h $(PDC_DIR)/xcurses.h \ + $(PDC_DIR)/config.sub $(PDC_DIR)/install-sh $(PDC_DIR)/curses.h $(PDC_DIR)/xcurses.h \ $(PDC_DIR)/curspriv.h $(PDC_DIR)/panel.h $(PDC_DIR)/pdc64.gif \ - $(PDC_DIR)/maintain.er $(PDC_DIR)/readme.* $(PDC_DIR)/makezip.cmd \ + $(PDC_DIR)/x11.h $(PDC_DIR)/maintain.er $(PDC_DIR)/readme.* $(PDC_DIR)/makezip.cmd \ $(PDC_DIR)/pdcurses/README $(PDC_DIR)/pdcurses/*.c $(PDC_DIR)/demos/*.c $(PDC_DIR)/demos/*.h $(PDC_DIR)/doc/*.man \ - $(PDC_DIR)/panel/README $(PDC_DIR)/panel/*.c $(PDC_DIR)/*.spec \ + $(PDC_DIR)/panel/README $(PDC_DIR)/panel/*.c \ $(PDC_DIR)/saa/README $(PDC_DIR)/saa/Makefile.in \ $(PDC_DIR)/dos/README $(PDC_DIR)/dos/*.c $(PDC_DIR)/dos/*.rsp $(PDC_DIR)/dos/*.lnk $(PDC_DIR)/dos/*.ini $(PDC_DIR)/dos/*.mak $(PDC_DIR)/dos/*.lrf \ $(PDC_DIR)/os2/README $(PDC_DIR)/os2/*.c $(PDC_DIR)/os2/*.rsp $(PDC_DIR)/os2/*.lnk $(PDC_DIR)/os2/*.ini $(PDC_DIR)/os2/*.mak $(PDC_DIR)/os2/*.lrf $(PDC_DIR)/os2/*.def \ $(PDC_DIR)/x11/README $(PDC_DIR)/x11/*.c $(PDC_DIR)/x11/*.xbm $(PDC_DIR)/x11/*.def $(PDC_DIR)/x11/*.h \ - $(PDC_DIR)/x11/process/*.c $(PDC_DIR)/x11/process/*.h $(PDC_DIR)/x11/thread/*.c $(PDC_DIR)/x11/thread/*.h \ $(PDC_DIR)/win32/README $(PDC_DIR)/win32/*.c $(PDC_DIR)/win32/*.rsp $(PDC_DIR)/win32/*.lnk $(PDC_DIR)/win32/*.ini $(PDC_DIR)/win32/*.mak $(PDC_DIR)/win32/*.lrf $(PDC_DIR)/win32/*.def $(PDC_DIR)/win32/*.ico $(PDC_DIR)/win32/*.rc \ $(PDC_DIR)/flexos/README $(PDC_DIR)/flexos/*.c $(PDC_DIR)/tools/manext.c \ $(PDC_DIR)/pdcurses/Makefile.in $(PDC_DIR)/demos/Makefile.in $(PDC_DIR)/tools/Makefile.in \ $(PDC_DIR)/panel/Makefile.in | gzip > PDCurses-$(VER_DOT).tar.gz) tar: - (cd ..; tar cvf - $(PDC_DIR)/README $(PDC_DIR)/INSTALL $(PDC_DIR)/TODO $(PDC_DIR)/Makefile.in \ + (cd ..; tar cvf - $(PDC_DIR)/README $(PDC_DIR)/INSTALL $(PDC_DIR)/README $(PDC_DIR)/Makefile.in \ $(PDC_DIR)/config.h.in $(PDC_DIR)/configure $(PDC_DIR)/config.guess $(PDC_DIR)/aclocal.m4 \ - $(PDC_DIR)/config.sub $(PDC_DIR)/configure.in $(PDC_DIR)/install-sh $(PDC_DIR)/curses.h $(PDC_DIR)/xcurses.h \ + $(PDC_DIR)/config.sub $(PDC_DIR)/install-sh $(PDC_DIR)/curses.h $(PDC_DIR)/xcurses.h \ $(PDC_DIR)/curspriv.h $(PDC_DIR)/panel.h $(PDC_DIR)/pdc64.gif \ - $(PDC_DIR)/maintain.er $(PDC_DIR)/readme.* $(PDC_DIR)/makezip.cmd \ + $(PDC_DIR)/x11.h $(PDC_DIR)/maintain.er $(PDC_DIR)/readme.* $(PDC_DIR)/makezip.cmd \ $(PDC_DIR)/pdcurses/README $(PDC_DIR)/pdcurses/*.c $(PDC_DIR)/demos/*.c $(PDC_DIR)/demos/*.h $(PDC_DIR)/doc/*.man \ - $(PDC_DIR)/panel/README $(PDC_DIR)/panel/*.c $(PDC_DIR)/*.spec \ + $(PDC_DIR)/panel/README $(PDC_DIR)/panel/*.c \ $(PDC_DIR)/saa/README $(PDC_DIR)/saa/Makefile.in \ $(PDC_DIR)/dos/README $(PDC_DIR)/dos/*.c $(PDC_DIR)/dos/*.rsp $(PDC_DIR)/dos/*.lnk $(PDC_DIR)/dos/*.ini $(PDC_DIR)/dos/*.mak $(PDC_DIR)/dos/*.lrf \ $(PDC_DIR)/os2/README $(PDC_DIR)/os2/*.c $(PDC_DIR)/os2/*.rsp $(PDC_DIR)/os2/*.lnk $(PDC_DIR)/os2/*.ini $(PDC_DIR)/os2/*.mak $(PDC_DIR)/os2/*.lrf $(PDC_DIR)/os2/*.def \ $(PDC_DIR)/x11/README $(PDC_DIR)/x11/*.c $(PDC_DIR)/x11/*.xbm $(PDC_DIR)/x11/*.def $(PDC_DIR)/x11/*.h \ - $(PDC_DIR)/x11/process/*.c $(PDC_DIR)/x11/process/*.h $(PDC_DIR)/x11/thread/*.c $(PDC_DIR)/x11/thread/*.h \ $(PDC_DIR)/win32/README $(PDC_DIR)/win32/*.c $(PDC_DIR)/win32/*.rsp $(PDC_DIR)/win32/*.lnk $(PDC_DIR)/win32/*.ini $(PDC_DIR)/win32/*.mak $(PDC_DIR)/win32/*.lrf $(PDC_DIR)/win32/*.def $(PDC_DIR)/win32/*.ico $(PDC_DIR)/win32/*.rc \ $(PDC_DIR)/flexos/README $(PDC_DIR)/flexos/*.c $(PDC_DIR)/tools/manext.c \ $(PDC_DIR)/pdcurses/Makefile.in $(PDC_DIR)/demos/Makefile.in $(PDC_DIR)/tools/Makefile.in \ diff --git a/PDCurses-2.4.spec b/PDCurses-2.4.spec deleted file mode 100644 index 60cfe6ff1..000000000 --- a/PDCurses-2.4.spec +++ /dev/null @@ -1,30 +0,0 @@ -Summary: Public Domain Curses -Name: PDCurses -Version: 2.4 -Release: 1 -Copyright: LGPL -Group: Development/Languages -Source: ftp://ftp.lightlink.com/pub/hessling/PDCurses/PDCurses-2.4.tar.gz -%description -PDCurses is an implementation of the curses library for X11. It provides -the ability for existing text-mode curses programs to be re-built as -native X11 applications with very little modification. -PDCurses for X11 is also known as XCurses. -For more information on PDCurses, visit http://www.lightlink.com/hessling/ -%prep -%setup - -%build -./configure -make - -%install -make install - -%files -/usr/local/lib/libXCurses.a -/usr/local/lib/libpanel.a -/usr/local/lib/libXCurses.so -/usr/local/include/xcurses.h -/usr/local/include/xpanel.h - diff --git a/README b/README index 4d27a8641..cb558d16b 100644 --- a/README +++ b/README @@ -18,9 +18,8 @@ Ports ----- - PDCurses has been ported to DOS, OS/2, X11, WIN32 and Amiga. A port - to Flexos is also included, but likely to be out of date. - A directory containing the port-specific source files exists for each + PDCurses has been ported to DOS, OS/2, X11, WIN32 and Flexos. A + directory containing the port-specific source files exists for each of these platforms. diff --git a/TODO b/TODO deleted file mode 100644 index 8c1ec629b..000000000 --- a/TODO +++ /dev/null @@ -1,8 +0,0 @@ -This file describes the features of PDCurses that are still to -be completed. - -- provide for all outstanding curses functions - -- document how resizing works - -- document how to use mouse functions that do exist diff --git a/aclocal.m4 b/aclocal.m4 index 36283871f..4b418f241 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -326,12 +326,7 @@ case "$target" in RXLIBPST=".so" ;; *linux*) - LD_RXLIB1="${CC} -shared" - RXLIBPRE="lib" - RXLIBPST=".so" - ;; - *nto-qnx*) - LD_RXLIB1="${CC} -shared" + LD_RXLIB1="${CC} -Wl,-shared" RXLIBPRE="lib" RXLIBPST=".so" ;; diff --git a/config.h.in b/config.h.in index 9656c518e..e5fccd54c 100644 --- a/config.h.in +++ b/config.h.in @@ -125,9 +125,3 @@ /* Define if you want to include LATIN1 key support */ #undef INCLUDE_LATIN1 -/* Define if you want to build XCurses with threads */ -#undef USE_THREADS - -/* Define if you want to build XCurses with processes */ -#undef USE_PROCESSES - diff --git a/configure b/configure index 281a84d84..bcc40e95e 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 +# Generated automatically using autoconf version 2.12 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -15,8 +15,6 @@ ac_help="$ac_help --enable-debug turn on debugging" ac_help="$ac_help --enable-latin1 include support for LATIN1 keys" -ac_help="$ac_help - --with-threads build XCurses with threads" ac_help="$ac_help --enable-purify link with Purify (TM)" ac_help="$ac_help @@ -59,7 +57,6 @@ mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 @@ -343,7 +340,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" + echo "configure generated by autoconf version 2.12" exit 0 ;; -with-* | --with-*) @@ -513,11 +510,9 @@ ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross -ac_exeext= -ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then @@ -539,7 +534,7 @@ mh_sysv_libdir="" all_words="$CC_LIST" ac_dir="" echo $ac_n "checking for one of the following C compilers: $all_words""... $ac_c" 1>&6 -echo "configure:543: checking for one of the following C compilers: $all_words" >&5 +echo "configure:538: checking for one of the following C compilers: $all_words" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -578,16 +573,15 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:582: checking for $ac_word" >&5 +echo "configure:577: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" @@ -608,17 +602,16 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:612: checking for $ac_word" >&5 +echo "configure:606: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do + for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then @@ -653,61 +646,25 @@ else echo "$ac_t""no" 1>&6 fi - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:663: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:695: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:654: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross -cat > conftest.$ac_ext << EOF - -#line 706 "configure" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -721,24 +678,18 @@ else ac_cv_prog_cc_works=no fi rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:737: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:688: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:742: checking whether we are using GNU C" >&5 +echo "configure:693: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -747,7 +698,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:751: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:702: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -758,15 +709,11 @@ echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes -else - GCC= -fi - -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:770: checking whether ${CC-cc} accepts -g" >&5 + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:717: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -781,24 +728,20 @@ rm -f conftest* fi echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then CFLAGS="-g -O2" else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then CFLAGS="-O2" - else - CFLAGS= fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:802: checking for POSIXized ISC" >&5 +echo "configure:745: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -862,33 +805,33 @@ esac # Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +if $ac_config_sub sun4 >/dev/null 2>&1; then : else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:871: checking host system type" >&5 +echo "configure:814: checking host system type" >&5 host_alias=$host case "$host_alias" in NONE) case $nonopt in NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + if host_alias=`$ac_config_guess`; then : else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } fi ;; *) host_alias=$nonopt ;; esac ;; esac -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host=`$ac_config_sub $host_alias` host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:892: checking target system type" >&5 +echo "configure:835: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -899,14 +842,14 @@ NONE) esac ;; esac -target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target=`$ac_config_sub $target_alias` target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:910: checking build system type" >&5 +echo "configure:853: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -917,7 +860,7 @@ NONE) esac ;; esac -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build=`$ac_config_sub $build_alias` build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` @@ -949,8 +892,6 @@ case "$target" in *pc-sco*) SYS_DEFS="-UM_XENIX -b elf" ;; - *nto-qnx*) - ;; *qnx*) on_qnx=yes SYS_DEFS="-Q" @@ -963,21 +904,21 @@ esac save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $SYS_DEFS" echo $ac_n "checking for maximum signal specifier:""... $ac_c" 1>&6 -echo "configure:967: checking for maximum signal specifier:" >&5 +echo "configure:908: checking for maximum signal specifier:" >&5 if eval "test \"`echo '$''{'mh_cv_max_signals'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else mh_found="no" for mh_sigs in NSIG __sys_nsig; do cat > conftest.$ac_ext < int main() { return $mh_sigs; ; return 0; } EOF -if { (eval echo configure:981: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:922: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* mh_found="yes"; mh_cv_max_signals="$mh_sigs" else @@ -1009,7 +950,7 @@ MH_EXTRA_LIBS="" for mh_lib in dld dl; do # AC_MSG_CHECKING(for library -l${mh_lib}) echo $ac_n "checking for main in -l$mh_lib""... $ac_c" 1>&6 -echo "configure:1013: checking for main in -l$mh_lib" >&5 +echo "configure:954: checking for main in -l$mh_lib" >&5 ac_lib_var=`echo $mh_lib'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1017,14 +958,14 @@ else ac_save_LIBS="$LIBS" LIBS="-l$mh_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1058,16 +999,15 @@ SHLIBS="${MH_EXTRA_LIBS}" # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1062: checking for $ac_word" >&5 +echo "configure:1003: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_RANLIB="ranlib" @@ -1092,30 +1032,28 @@ fi # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1101: checking for a BSD compatible install" >&5 +echo "configure:1040: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do + for ac_prog in ginstall installbsd scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. : else ac_cv_path_install="$ac_dir/$ac_prog -c" @@ -1145,12 +1083,10 @@ echo "$ac_t""$INSTALL" 1>&6 # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1154: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1090: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1178,7 +1114,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1182: checking how to run the C preprocessor" >&5 +echo "configure:1118: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1193,14 +1129,14 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1203: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +{ (eval echo configure:1139: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : else @@ -1210,31 +1146,14 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1220: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1237: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +{ (eval echo configure:1156: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : else @@ -1246,8 +1165,6 @@ else fi rm -f conftest* fi -rm -f conftest* -fi rm -f conftest* ac_cv_prog_CPP="$CPP" fi @@ -1259,21 +1176,21 @@ echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for System V IPC support""... $ac_c" 1>&6 -echo "configure:1263: checking for System V IPC support" >&5 +echo "configure:1180: checking for System V IPC support" >&5 ac_safe=`echo "sys/ipc.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/ipc.h""... $ac_c" 1>&6 -echo "configure:1266: checking for sys/ipc.h" >&5 +echo "configure:1183: checking for sys/ipc.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1276: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +{ (eval echo configure:1193: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" @@ -1300,12 +1217,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1304: checking for ANSI C header files" >&5 +echo "configure:1221: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1313,8 +1230,8 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1317: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +{ (eval echo configure:1234: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* ac_cv_header_stdc=yes @@ -1330,7 +1247,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1348,7 +1265,7 @@ 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 < EOF @@ -1369,7 +1286,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1380,7 +1297,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1301: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1419,18 +1336,18 @@ for ac_hdr in fcntl.h \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1423: checking for $ac_hdr" >&5 +echo "configure:1340: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1433: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +{ (eval echo configure:1350: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" @@ -1457,17 +1374,17 @@ done echo $ac_n "checking if compiler supports ANSI prototypes""... $ac_c" 1>&6 -echo "configure:1461: checking if compiler supports ANSI prototypes" >&5 +echo "configure:1378: checking if compiler supports ANSI prototypes" >&5 ac_compile='$ac_cv_prog_CC conftest.$ac_ext $CFLAGS $CPPFLAGS -c 1>&5 2>&5' cat > conftest.$ac_ext < int main() { extern int xxx(int, char *); ; return 0; } EOF -if { (eval echo configure:1471: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1388: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* mh_have_proto=yes; cat >> confdefs.h <<\EOF #define HAVE_PROTO 1 @@ -1485,12 +1402,12 @@ echo "$ac_t""$mh_have_proto" 1>&6 echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1489: checking for working const" >&5 +echo "configure:1406: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1460: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1560,12 +1477,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1564: checking for size_t" >&5 +echo "configure:1481: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1574,7 +1491,7 @@ else #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_size_t=yes else @@ -1593,12 +1510,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1597: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1514: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1607,7 +1524,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1611: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1528: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1628,12 +1545,12 @@ EOF fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:1632: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:1549: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1641,7 +1558,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:1645: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1562: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -1666,7 +1583,7 @@ MH_EXTRA_LIBS="" for mh_lib in socket nls; do # AC_MSG_CHECKING(for library -l${mh_lib}) echo $ac_n "checking for main in -l$mh_lib""... $ac_c" 1>&6 -echo "configure:1670: checking for main in -l$mh_lib" >&5 +echo "configure:1587: checking for main in -l$mh_lib" >&5 ac_lib_var=`echo $mh_lib'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1674,14 +1591,14 @@ else ac_save_LIBS="$LIBS" LIBS="-l$mh_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1602: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1713,7 +1630,7 @@ done echo $ac_n "checking whether $CC understand -c and -o together""... $ac_c" 1>&6 -echo "configure:1717: checking whether $CC understand -c and -o together" >&5 +echo "configure:1634: checking whether $CC understand -c and -o together" >&5 set dummy $CC; ac_cc="`echo $2 | sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" if eval "test \"`echo '$''{'ac_cv_prog_cc_${ac_cc}_c_o'+set}'`\" = set"; then @@ -1724,10 +1641,10 @@ else # existing .o file with -o, though they will create one. eval ac_cv_prog_cc_${ac_cc}_c_o=no ac_try='${CC-cc} -c conftest.c -o conftest.ooo 1>&5' -if { (eval echo configure:__oline__: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && test -f conftest.ooo && { (eval echo configure:1728: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; +if { (eval echo configure:__oline__: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && test -f conftest.ooo && { (eval echo configure:1645: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; then ac_try='${CC-cc} -c conftest.c -o conftest.ooo 1>&5' - if { (eval echo configure:__oline__: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && test -f conftest.ooo && { (eval echo configure:1731: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; + if { (eval echo configure:__oline__: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && test -f conftest.ooo && { (eval echo configure:1648: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes fi @@ -1752,13 +1669,13 @@ fi if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:1756: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:1673: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext < Autoconf TIOCGETP @@ -1776,7 +1693,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -1798,7 +1715,7 @@ echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 fi echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:1802: checking for 8-bit clean memcmp" >&5 +echo "configure:1719: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1806,7 +1723,7 @@ else ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1737: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else @@ -1831,15 +1748,15 @@ fi fi echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6 -test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" +test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.o" echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1838: checking return type of signal handlers" >&5 +echo "configure:1755: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1856,7 +1773,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1860: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1875,12 +1792,12 @@ EOF echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:1879: checking for vprintf" >&5 +echo "configure:1796: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -1927,12 +1844,12 @@ fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:1931: checking for _doprnt" >&5 +echo "configure:1848: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -1982,12 +1899,12 @@ fi for ac_func in select memmove vsscanf usleep poll do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1986: checking for $ac_func" >&5 +echo "configure:1903: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2037,7 +1954,7 @@ done echo $ac_n "checking for location of X headers""... $ac_c" 1>&6 -echo "configure:2041: checking for location of X headers" >&5 +echo "configure:1958: checking for location of X headers" >&5 mh_x11_dir="" mh_inc_dirs="\ $HOME/include/X11 \ @@ -2132,7 +2049,7 @@ case "$target" in esac echo $ac_n "checking for location of X libraries""... $ac_c" 1>&6 -echo "configure:2136: checking for location of X libraries" >&5 +echo "configure:2053: checking for location of X libraries" >&5 if test "$with_xaw3d" = yes; then MH_X11_LIBS="Xaw3d Xmu Xt X11" else @@ -2267,18 +2184,18 @@ for mh_header in DECkeysym.h Sunkeysym.h; do do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2271: checking for $ac_hdr" >&5 +echo "configure:2188: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2281: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +{ (eval echo configure:2198: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" @@ -2312,17 +2229,17 @@ CPPFLAGS="$CPPFLAGS $MH_XINC_DIR" for mh_keydef in XK_KP_Delete XK_KP_Insert XK_KP_End XK_KP_Down XK_KP_Next \ XK_KP_Left XK_KP_Right XK_KP_Home XK_KP_Up XK_KP_Prior XK_KP_Begin; do echo $ac_n "checking for $mh_keydef in keysym.h""... $ac_c" 1>&6 -echo "configure:2316: checking for $mh_keydef in keysym.h" >&5 +echo "configure:2233: checking for $mh_keydef in keysym.h" >&5 mh_upper_name="HAVE_`echo $mh_keydef | tr 'a-z' 'A-Z'`" cat > conftest.$ac_ext < int main() { int i = $mh_keydef; ; return 0; } EOF -if { (eval echo configure:2326: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2243: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* mh_have_key=yes; cat >> confdefs.h <> confdefs.h <<\EOF -#define USE_THREADS 1 -EOF - - x11type="thread" -else - cat >> confdefs.h <<\EOF -#define USE_PROCESSES 1 -EOF - - x11type="process" -fi - - # Check whether --enable-purify or --disable-purify was given. if test "${enable_purify+set}" = set; then enableval="$enable_purify" @@ -2500,10 +2394,10 @@ esac if test "$DYN_COMP" = ""; then echo $ac_n "checking compiler flags for a dynamic object""... $ac_c" 1>&6 -echo "configure:2504: checking compiler flags for a dynamic object" >&5 +echo "configure:2398: checking compiler flags for a dynamic object" >&5 cat > conftest.$ac_ext <&5; (eval $mh_compile) 2>&5; }; then + if { (eval echo configure:2413: \"$mh_compile\") 1>&5; (eval $mh_compile) 2>&5; }; then DYN_COMP="" else slash="\\" @@ -2603,7 +2497,7 @@ case "$target" in RXLIBPST=".so" ;; sparc*sunos*) - LD_RXLIB1="ld -assert pure-text" + LD_RXLIB1="ld" RXLIBPRE="lib" RXLIBPST=".so" ;; @@ -2613,12 +2507,7 @@ case "$target" in RXLIBPST=".so" ;; *linux*) - LD_RXLIB1="${CC} -shared" - RXLIBPRE="lib" - RXLIBPST=".so" - ;; - *nto-qnx*) - LD_RXLIB1="${CC} -shared" + LD_RXLIB1="${CC} -Wl,-shared" RXLIBPRE="lib" RXLIBPST=".so" ;; @@ -2632,21 +2521,21 @@ case "$target" in mh_compile='${CC-cc} -c $DYN_COMP conftest.$ac_ext 1>&5' cat > conftest.$ac_ext <&5; (eval $mh_compile) 2>&5; } && test -s conftest.o; then +if { (eval echo configure:2531: \"$mh_compile\") 1>&5; (eval $mh_compile) 2>&5; } && test -s conftest.o; then mh_dyn_link='ld -shared -o conftest.rxlib conftest.o -lc 1>&5' - if { (eval echo configure:2644: \"$mh_dyn_link\") 1>&5; (eval $mh_dyn_link) 2>&5; } && test -s conftest.rxlib; then + if { (eval echo configure:2533: \"$mh_dyn_link\") 1>&5; (eval $mh_dyn_link) 2>&5; } && test -s conftest.rxlib; then LD_RXLIB1="ld -shared" RXLIBPRE="lib" RXLIBPST=".so" else mh_dyn_link='ld -G -o conftest.rxlib conftest.o 1>&5' - if { (eval echo configure:2650: \"$mh_dyn_link\") 1>&5; (eval $mh_dyn_link) 2>&5; } && test -s conftest.rxlib; then + if { (eval echo configure:2539: \"$mh_dyn_link\") 1>&5; (eval $mh_dyn_link) 2>&5; } && test -s conftest.rxlib; then LD_RXLIB1="ld -G" RXLIBPRE="lib" RXLIBPST=".so" @@ -2714,7 +2603,7 @@ EOF # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in + case `(ac_space=' '; set) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). @@ -2781,7 +2670,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" + echo "$CONFIG_STATUS generated by autoconf version 2.12" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -2801,11 +2690,9 @@ sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF $ac_vpsub $extrasub -s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g @@ -2843,7 +2730,6 @@ s%@build_os@%$build_os%g s%@SYS_DEFS@%$SYS_DEFS%g s%@RANLIB@%$RANLIB%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@SET_MAKE@%$SET_MAKE%g s%@CPP@%$CPP%g @@ -2851,7 +2737,6 @@ s%@MH_EXTRA_LIBS@%$MH_EXTRA_LIBS%g s%@LIBOBJS@%$LIBOBJS%g s%@MH_XINC_DIR@%$MH_XINC_DIR%g s%@MH_XLIBS@%$MH_XLIBS%g -s%@x11type@%$x11type%g s%@PURIFY@%$PURIFY%g s%@EEXTRA@%$EEXTRA%g s%@CEXTRA@%$CEXTRA%g diff --git a/configure.in b/configure.in deleted file mode 100755 index 21a9c4a43..000000000 --- a/configure.in +++ /dev/null @@ -1,195 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -AC_INIT(curspriv.h) - -dnl ---------------------- check for C compiler ----------------- -dnl Checks for one of the C compilers below - change if yours not there. -CC_LIST="gcc acc cc c89" -MH_PROG_CC -AC_ISC_POSIX - -AC_CONFIG_HEADER(config.h) -dnl Checks for system first -AC_CANONICAL_SYSTEM - -on_qnx=no -case "$target" in - *hp-hpux*) - SYS_DEFS="-D_HPUX_SOURCE" - ;; - *ibm-aix*) - SYS_DEFS="-D_ALL_SOURCE" - ;; - *dec-osf*) - SYS_DEFS="-D_XOPEN_SOURCE_EXTENDED" - ;; - sparc*solaris*) - ;; - sparc*sunos*) - ;; - *linux*) - ;; - *pc-sco*) - SYS_DEFS="-UM_XENIX -b elf" - ;; - *qnx*) - on_qnx=yes - SYS_DEFS="-Q" - EEXTRA="-mf -N0x20000 -Q" - ;; -esac -AC_SUBST(SYS_DEFS) - -MH_CHECK_MAX_SIGNALS(NSIG __sys_nsig) - -dnl Check for dynamic shared library support libraries -MH_EXTRA_LIBS="" -MH_CHECK_LIB(dld dl) -SHLIBS="${MH_EXTRA_LIBS}" - -dnl Check for other programs. -AC_PROG_RANLIB -AC_PROG_INSTALL -AC_PROG_MAKE_SET - -dnl ensure that the system has System V IPC support -MH_IPC - -dnl Checks for libraries. - -dnl Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS(fcntl.h \ - limits.h \ - time.h \ - sys/time.h \ - memory.h \ - string.h \ - stdarg.h \ - sys/select.h \ - unistd.h \ - dlfcn.h \ - dl.h \ - errno.h - ) -MH_HAVE_PROTO - - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_TYPE_SIZE_T -AC_HEADER_TIME -AC_STRUCT_TM -dnl AC_CHECK_TYPE(fd_set,int) -MH_CHECK_LIB(socket nls) -AC_SUBST(MH_EXTRA_LIBS) -MH_CHECK_CC_O - -dnl Checks for library functions. -AC_PROG_GCC_TRADITIONAL -AC_FUNC_MEMCMP -AC_TYPE_SIGNAL -AC_FUNC_VPRINTF -AC_CHECK_FUNCS(select memmove vsscanf usleep poll) - -dnl Check for X includes and X libraries -MH_CHECK_X_INC -MH_CHECK_X_LIB -MH_CHECK_X_HEADERS(DECkeysym.h Sunkeysym.h) -MH_CHECK_X_KEYDEFS(XK_KP_Delete XK_KP_Insert XK_KP_End XK_KP_Down XK_KP_Next \ - XK_KP_Left XK_KP_Right XK_KP_Home XK_KP_Up XK_KP_Prior XK_KP_Begin) - -dnl --------------- allow --enable-debug to compile in debug mode -------- -AC_ARG_ENABLE(debug, - [ --enable-debug turn on debugging], - [with_debug=$enableval], - [with_debug=no], -) -cflags_g="`echo $CFLAGS | grep -c '\-g'`" -cflags_O="`echo $CFLAGS | grep -c '\-O'`" - -if test "$with_debug" = yes; then - if test "$cflags_g" = "0"; then - CFLAGS="${CFLAGS} -g" - fi - if test "$cflags_O" != "0"; then - CFLAGS="`echo ${CFLAGS} | sed -e s/-O.//`" - fi - CFLAGS="${CFLAGS} -DPDCDEBUG" -else - if test "$cflags_O" = "0"; then - CFLAGS="${CFLAGS} -O" - fi - if test "$cflags_g" != "0"; then - CFLAGS="`echo ${CFLAGS} | sed -e s/-g//`" - fi -fi -if test "$ac_cv_prog_CC" = "gcc"; then - if test "$with_debug" = yes; then - CFLAGS="${CFLAGS} -Wall" - else - CFLAGS="-O3 -Wall -fomit-frame-pointer" - fi -fi -if test "$on_qnx" = yes; then - if test "$with_debug" = yes; then - CFLAGS="-g" - else - CFLAGS="-Otax" - fi -fi - -dnl ----------------- check for LATIN1 key support ------------------- -dnl allow --enable-latin1 to include LATIN1 key support -AC_ARG_ENABLE(latin1, - [ --enable-latin1 include support for LATIN1 keys], - [with_latin1=$enableval], - [with_latin1=no], -) -if test "$with_latin1" = yes; then - AC_DEFINE(INCLUDE_LATIN1) -fi - -dnl ----------------- check for thread support ----------------------- -dnl allow --with-threads to build with threads -AC_ARG_WITH(threads, - [ --with-threads build XCurses with threads], - [with_threads=$withval], - [with_threads=no], -) -if test "$with_threads" = yes; then - AC_DEFINE(USE_THREADS) - x11type="thread" -else - AC_DEFINE(USE_PROCESSES) - x11type="process" -fi -AC_SUBST(x11type) - -dnl ----------------- check for Purify support ----------------------- -dnl allow --enable-purify to enable linking with Purify -AC_ARG_ENABLE(purify, - [ --enable-purify link with Purify (TM)], - [with_purify=$enableval], - [with_purify=no], -) -if test "$with_purify" = yes; then - PURIFY="purify" -else - PURIFY="" -fi -AC_SUBST(PURIFY) - -dnl ---------------------- check for Xaw3d library ------------------- -dnl allow --with-xaw3d to link with XCurses -AC_ARG_WITH(xaw3d, - [ --with-xaw3d link with Xaw3d], - [with_xaw3d=$withval], - [with_xaw3d=no], -) -if test "$with_xaw3d" = yes; then - AC_DEFINE(USE_XAW3D) -fi -dnl --------------- Check how to make shared libraries ------------------- -MH_SHARED_LIBRARY(XCurses) - -AC_OUTPUT(Makefile pdcurses/Makefile demos/Makefile panel/Makefile tools/Makefile saa/Makefile) diff --git a/demos/testcurs.c b/demos/testcurs.c index ad05f2529..c70e4eda0 100644 --- a/demos/testcurs.c +++ b/demos/testcurs.c @@ -33,7 +33,7 @@ #endif #ifdef PDCDEBUG -char *rcsid_testcurs = "$Id: testcurs.c,v 1.2 2001/01/10 08:27:43 mark Exp $"; +char *rcsid_testcurs = "$Id: testcurs.c,v 1.1 2001/01/10 08:27:41 mark Exp $"; #endif #include @@ -199,7 +199,7 @@ char *argv[]; #ifdef PDCDEBUG PDC_debug("initTest called\n"); #endif -/* traceon(); */ + /* traceon(); */ #ifdef XCURSES Xinitscr(argc, argv); #else @@ -823,13 +823,8 @@ int old_option,new_option; { register int i; -#ifdef XCURSES - attrset(A_PROTECT); -#else - attrset(A_BOLD); -#endif - mvaddstr(3,20,"PDCurses Test Program"); attrset(A_NORMAL); + mvaddstr(3,20,"PDCurses Test Program"); for (i=0;i -#endif -#include - -#ifdef PDCDEBUG -char *rcsid_PDCgo32 = "$Id: pdcgo32.c,v 1.1 2001/01/10 08:31:08 mark Exp $"; -#endif - - -#ifdef GO32 - -#include /* prototypes of dosmemget() and dosmemput() */ - -unsigned char getdosmembyte (int offset) -{ - unsigned char b=0; - - dosmemget (offset, sizeof(unsigned char), &b); - return b; -} - -unsigned short getdosmemword (int offset) -{ - unsigned short w=0; - - dosmemget (offset, sizeof(unsigned short), &w); - return w; -} - -void setdosmembyte (int offset, unsigned char b) -{ - dosmemput (&b, sizeof(unsigned char), offset); -} - -void setdosmemword (int offset, unsigned short w) -{ - dosmemput (&w, sizeof(unsigned short), offset); -} - -#endif - diff --git a/install-sh b/install-sh index 6b7d9f5ed..89fc9b098 100755 --- a/install-sh +++ b/install-sh @@ -1,35 +1,20 @@ #! /bin/sh # # install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. +# This comes from X11R5. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. +# from scratch. +# # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. -# -# Modified 1 Feb 2000 MHES to cater for mkdir -p -# doit="${DOITPROG-}" @@ -44,7 +29,7 @@ stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" -transformbasename="" +tranformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" @@ -53,109 +38,108 @@ chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" -mkdircmd="$mkdirprog -p" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; esac done if [ x"$src" = x ] then - echo "install: no input file specified" - exit 1 + echo "install: no input file specified" + exit 1 else - true + true fi if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad +# might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi fi ## this sed command emulates the dirname command @@ -166,7 +150,7 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then -defaultIFS=' +defaultIFS=' ' IFS="${IFS-${defaultIFS}}" @@ -179,58 +163,58 @@ IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift + pathcomp="${pathcomp}${1}" + shift - if [ ! -d "${pathcomp}" ] ; + if [ ! -d "${pathcomp}" ] ; then - $mkdircmd "${pathcomp}" - else - true - fi + $mkdirprog "${pathcomp}" + else + true + fi - pathcomp="${pathcomp}/" + pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then - $doit $instcmd $dst && + $doit $instcmd $dst && - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi # don't allow the sed command to completely eliminate the filename - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi # Make a temp file name in the proper directory. - dsttmp=$dstdir/#inst.$$# + dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name - $doit $instcmd $src $dsttmp && + $doit $instcmd $src $dsttmp && - trap "rm -f ${dsttmp}" 0 && + trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits @@ -238,15 +222,15 @@ else # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile fi && diff --git a/label.2.4 b/label.2.4 deleted file mode 100644 index 87cb1076a..000000000 --- a/label.2.4 +++ /dev/null @@ -1,178 +0,0 @@ -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/Makefile.in,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/README,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/addch.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/addchstr.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/addstr.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/attr.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/beep.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/bkgd.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/border.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/clear.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/color.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/delch.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/deleteln.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/getch.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/getstr.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/getyx.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/inch.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/inchstr.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/initscr.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/inopts.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/insch.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/insstr.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/instr.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/kernel.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/mouse.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/move.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/outopts.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/overlay.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/pad.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/pdcdebug.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/pdcutil.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/pdcwin.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/printw.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/refresh.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/scanw.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/scroll.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/slk.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/termattr.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/terminfo.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/touch.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/util.c,v -1.1 /home/mark/projects/PDCurses/pdcurses/RCS/window.c,v -1.1 /home/mark/projects/PDCurses/demos/RCS/Makefile.in,v -1.1 /home/mark/projects/PDCurses/demos/RCS/firework.c,v -1.1 /home/mark/projects/PDCurses/demos/RCS/newdemo.c,v -1.1 /home/mark/projects/PDCurses/demos/RCS/ptest.c,v -1.1 /home/mark/projects/PDCurses/demos/RCS/testcurs.c,v -1.1 /home/mark/projects/PDCurses/demos/RCS/tui.c,v -1.1 /home/mark/projects/PDCurses/demos/RCS/tui.h,v -1.1 /home/mark/projects/PDCurses/demos/RCS/tuidemo.c,v -1.1 /home/mark/projects/PDCurses/demos/RCS/xmas.c,v -1.1 /home/mark/projects/PDCurses/doc/RCS/intro.man,v -1.1 /home/mark/projects/PDCurses/doc/RCS/x11.man,v -1.1 /home/mark/projects/PDCurses/doc/RCS/latin-1.man,v -1.1 /home/mark/projects/PDCurses/doc/RCS/overview.man,v -1.2 /home/mark/projects/PDCurses/panel/RCS/Makefile.in,v -1.2 /home/mark/projects/PDCurses/panel/RCS/README,v -1.2 /home/mark/projects/PDCurses/panel/RCS/panel.c,v -1.1 /home/mark/projects/PDCurses/saa/RCS/Makefile.in,v -1.2 /home/mark/projects/PDCurses/dos/RCS/README,v -1.2 /home/mark/projects/PDCurses/dos/RCS/bccdos.ini,v -1.2 /home/mark/projects/PDCurses/dos/RCS/bccdos.lrf,v -1.2 /home/mark/projects/PDCurses/dos/RCS/bccdos.mak,v -1.2 /home/mark/projects/PDCurses/dos/RCS/bccdos.rsp,v -1.2 /home/mark/projects/PDCurses/dos/RCS/gccdos.lrf,v -1.2 /home/mark/projects/PDCurses/dos/RCS/dos-bcc.rsp,v -1.2 /home/mark/projects/PDCurses/dos/RCS/dos-tcc.rsp,v -1.2 /home/mark/projects/PDCurses/dos/RCS/gccdos.mak,v -1.2 /home/mark/projects/PDCurses/dos/RCS/mscdos.ini,v -1.2 /home/mark/projects/PDCurses/dos/RCS/mscdos.lrf,v -1.2 /home/mark/projects/PDCurses/dos/RCS/mscdos.mak,v -1.2 /home/mark/projects/PDCurses/dos/RCS/pdcclip.c,v -1.2 /home/mark/projects/PDCurses/dos/RCS/msvcdos.mak,v -1.2 /home/mark/projects/PDCurses/dos/RCS/pdcdisp.c,v -1.2 /home/mark/projects/PDCurses/dos/RCS/pdcgetsc.c,v -1.2 /home/mark/projects/PDCurses/dos/RCS/pdcgo32.c,v -1.2 /home/mark/projects/PDCurses/dos/RCS/pdckbd.c,v -1.2 /home/mark/projects/PDCurses/dos/RCS/pdcprint.c,v -1.2 /home/mark/projects/PDCurses/dos/RCS/pdcscrn.c,v -1.2 /home/mark/projects/PDCurses/dos/RCS/pdcsetsc.c,v -1.2 /home/mark/projects/PDCurses/dos/RCS/wccdos.lrf,v -1.2 /home/mark/projects/PDCurses/dos/RCS/wccdos16.mak,v -1.2 /home/mark/projects/PDCurses/dos/RCS/wccdos4g.mak,v -1.2 /home/mark/projects/PDCurses/os2/RCS/README,v -1.2 /home/mark/projects/PDCurses/os2/RCS/bccos2.ini,v -1.2 /home/mark/projects/PDCurses/os2/RCS/bccos2.lrf,v -1.2 /home/mark/projects/PDCurses/os2/RCS/bccos2.mak,v -1.2 /home/mark/projects/PDCurses/os2/RCS/gccos2.mak,v -1.2 /home/mark/projects/PDCurses/os2/RCS/ibmos2.ini,v -1.2 /home/mark/projects/PDCurses/os2/RCS/iccos2.ini,v -1.2 /home/mark/projects/PDCurses/os2/RCS/iccos2.lrf,v -1.2 /home/mark/projects/PDCurses/os2/RCS/iccos2.mak,v -1.2 /home/mark/projects/PDCurses/os2/RCS/os2ibm.ini,v -1.2 /home/mark/projects/PDCurses/os2/RCS/os2-bcc.rsp,v -1.2 /home/mark/projects/PDCurses/os2/RCS/pdcclip.c,v -1.2 /home/mark/projects/PDCurses/os2/RCS/pdcdisp.c,v -1.2 /home/mark/projects/PDCurses/os2/RCS/pdcgetsc.c,v -1.2 /home/mark/projects/PDCurses/os2/RCS/pdckbd.c,v -1.2 /home/mark/projects/PDCurses/os2/RCS/pdcprint.c,v -1.2 /home/mark/projects/PDCurses/os2/RCS/pdcscrn.c,v -1.2 /home/mark/projects/PDCurses/os2/RCS/pdcsetsc.c,v -1.2 /home/mark/projects/PDCurses/os2/RCS/wccos2.lrf,v -1.2 /home/mark/projects/PDCurses/os2/RCS/pdcurses.def,v -1.2 /home/mark/projects/PDCurses/os2/RCS/pdcurses.lnk,v -1.2 /home/mark/projects/PDCurses/os2/RCS/wccos2.mak,v -1.1 /home/mark/projects/PDCurses/x11/RCS/README,v -1.1 /home/mark/projects/PDCurses/x11/RCS/sb.c,v -1.1 /home/mark/projects/PDCurses/x11/RCS/ScrollBox.c,v -1.1 /home/mark/projects/PDCurses/x11/RCS/ScrollBox.h,v -1.1 /home/mark/projects/PDCurses/x11/RCS/ScrollBoxP.h,v -1.1 /home/mark/projects/PDCurses/x11/RCS/XCurses.def,v -1.1 /home/mark/projects/PDCurses/x11/RCS/latin1kbd.h,v -1.1 /home/mark/projects/PDCurses/x11/RCS/pdcclip.c,v -1.1 /home/mark/projects/PDCurses/x11/RCS/pdcdisp.c,v -1.1 /home/mark/projects/PDCurses/x11/RCS/pdcgetsc.c,v -1.1 /home/mark/projects/PDCurses/x11/RCS/pdcgo32.c,v -1.1 /home/mark/projects/PDCurses/x11/RCS/pdckbd.c,v -1.1 /home/mark/projects/PDCurses/x11/RCS/pdcprint.c,v -1.1 /home/mark/projects/PDCurses/x11/RCS/pdcscrn.c,v -1.1 /home/mark/projects/PDCurses/x11/RCS/pdcsetsc.c,v -1.1 /home/mark/projects/PDCurses/x11/RCS/x11.c,v -1.1 /home/mark/projects/PDCurses/x11/RCS/xcurs32.xbm,v -1.1 /home/mark/projects/PDCurses/x11/RCS/xcurs64.xbm,v -1.1 /home/mark/projects/PDCurses/win32/RCS/README,v -1.1 /home/mark/projects/PDCurses/win32/RCS/bccwin32.lrf,v -1.1 /home/mark/projects/PDCurses/win32/RCS/bccwin32.mak,v -1.1 /home/mark/projects/PDCurses/win32/RCS/curses.def,v -1.1 /home/mark/projects/PDCurses/win32/RCS/gccwin32.mak,v -1.1 /home/mark/projects/PDCurses/win32/RCS/lccwin32.mak,v -1.1 /home/mark/projects/PDCurses/win32/RCS/mingwin32.mak,v -1.1 /home/mark/projects/PDCurses/win32/RCS/pdcclip.c,v -1.1 /home/mark/projects/PDCurses/win32/RCS/pdcdisp.c,v -1.1 /home/mark/projects/PDCurses/win32/RCS/pdcgetsc.c,v -1.1 /home/mark/projects/PDCurses/win32/RCS/pdckbd.c,v -1.1 /home/mark/projects/PDCurses/win32/RCS/pdcprint.c,v -1.1 /home/mark/projects/PDCurses/win32/RCS/pdcscrn.c,v -1.1 /home/mark/projects/PDCurses/win32/RCS/pdcsetsc.c,v -1.1 /home/mark/projects/PDCurses/win32/RCS/pdcurses.ico,v -1.1 /home/mark/projects/PDCurses/win32/RCS/pdcurses.rc,v -1.1 /home/mark/projects/PDCurses/win32/RCS/vcwin32.mak,v -1.1 /home/mark/projects/PDCurses/win32/RCS/w95-bcc.rsp,v -1.1 /home/mark/projects/PDCurses/win32/RCS/wccwin32.lrf,v -1.1 /home/mark/projects/PDCurses/win32/RCS/wccwin32.mak,v -1.1 /home/mark/projects/PDCurses/flexos/RCS/README,v -1.1 /home/mark/projects/PDCurses/flexos/RCS/fo_16bit.c,v -1.1 /home/mark/projects/PDCurses/flexos/RCS/fo_8bit.c,v -1.1 /home/mark/projects/PDCurses/flexos/RCS/fo_gname.c,v -1.1 /home/mark/projects/PDCurses/flexos/RCS/pdcdisp.c,v -1.1 /home/mark/projects/PDCurses/flexos/RCS/pdcgetsc.c,v -1.1 /home/mark/projects/PDCurses/flexos/RCS/pdcgo32.c,v -1.1 /home/mark/projects/PDCurses/flexos/RCS/pdckbd.c,v -1.1 /home/mark/projects/PDCurses/flexos/RCS/pdcprint.c,v -1.1 /home/mark/projects/PDCurses/flexos/RCS/pdcscrn.c,v -1.1 /home/mark/projects/PDCurses/flexos/RCS/pdcsetsc.c,v -1.1 /home/mark/projects/PDCurses/tools/RCS/Makefile.in,v -1.1 /home/mark/projects/PDCurses/tools/RCS/manext.c,v -1.1 /home/mark/projects/PDCurses/RCS/INSTALL,v -1.1 /home/mark/projects/PDCurses/RCS/README,v -1.1 /home/mark/projects/PDCurses/RCS/Makefile.in,v -1.1 /home/mark/projects/PDCurses/RCS/aclocal.m4,v -1.1 /home/mark/projects/PDCurses/RCS/config.sub,v -1.1 /home/mark/projects/PDCurses/RCS/config.guess,v -1.1 /home/mark/projects/PDCurses/RCS/config.h.in,v -1.1 /home/mark/projects/PDCurses/RCS/configure,v -1.2 /home/mark/projects/PDCurses/RCS/curses.h,v -1.2 /home/mark/projects/PDCurses/RCS/curspriv.h,v -1.1 /home/mark/projects/PDCurses/RCS/install-sh,v -1.2 /home/mark/projects/PDCurses/RCS/panel.h,v -1.1 /home/mark/projects/PDCurses/RCS/maintain.er,v -1.1 /home/mark/projects/PDCurses/RCS/makezip.cmd,v -1.1 /home/mark/projects/PDCurses/RCS/pdc64.gif,v -1.1 /home/mark/projects/PDCurses/RCS/readme.20,v -1.1 /home/mark/projects/PDCurses/RCS/readme.21,v -1.1 /home/mark/projects/PDCurses/RCS/readme.22,v -1.1 /home/mark/projects/PDCurses/RCS/readme.23,v -1.1 /home/mark/projects/PDCurses/RCS/readme.24,v -1.2 /home/mark/projects/PDCurses/RCS/x11.h,v -1.1 /home/mark/projects/PDCurses/RCS/label.2.4,v diff --git a/pdcurses/Makefile.in b/pdcurses/Makefile.in index e347a4cde..c30f57718 100644 --- a/pdcurses/Makefile.in +++ b/pdcurses/Makefile.in @@ -10,8 +10,7 @@ THIS = Makefile @SET_MAKE@ srcdir = @srcdir@ -x11basedir = $(srcdir)/../x11 -x11dir = $(x11basedir)/@x11type@ +x11dir = $(srcdir)/../x11 VPATH = @srcdir@ prefix = @prefix@ @@ -24,7 +23,7 @@ PDCURSES_CONFIG_H =../config.h PDCURSES_CURSES_H =$(PDCURSES_HOME)/curses.h PDCURSES_CURSPRIV_H =$(PDCURSES_HOME)/curspriv.h PDCURSES_HEADERS =$(PDCURSES_CONFIG_H) $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H) -PDCURSES_X11_H =$(x11basedir)/pdcx11.h +PDCURSES_X11_H =$(PDCURSES_HOME)/x11.h INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -45,7 +44,7 @@ CC = @CC@ CFLAGS = @CFLAGS@ INCDIR = $(srcdir) -CPPFLAGS = -I$(INCDIR) -I$(srcdir)/.. -I.. @DEFS@ -DXCURSES @SYS_DEFS@ -I$(x11basedir) -I$(x11dir) +CPPFLAGS = -I$(INCDIR) -I$(srcdir)/.. -I.. @DEFS@ -DXCURSES @SYS_DEFS@ CCFLAGS = -c $(CFLAGS) $(CPPFLAGS) @MH_XINC_DIR@ @@ -128,9 +127,6 @@ pdcutil.o \ pdcwin.o X11OBJS = \ -pdcx11.o \ -x11curses.o \ -x11common.o \ x11.o \ sb.o \ ScrollBox.o @@ -187,9 +183,6 @@ pdcutil.sho \ pdcwin.sho X11SHOBJS = \ -pdcx11.sho \ -x11curses.sho \ -x11common.sho \ x11.sho \ sb.sho \ ScrollBox.sho @@ -315,29 +308,29 @@ window.o: $(srcdir)/window.c $(PDCURSES_HEADERS) $(CC) $(CCFLAGS) -o $@ $(srcdir)/window.c -pdcclip.o: $(x11basedir)/pdcclip.c $(PDCURSES_HEADERS) - $(CC) $(CCFLAGS) -o $@ $(x11basedir)/pdcclip.c +pdcclip.o: $(x11dir)/pdcclip.c $(PDCURSES_HEADERS) + $(CC) $(CCFLAGS) -o $@ $(x11dir)/pdcclip.c pdcdebug.o: $(srcdir)/pdcdebug.c $(PDCURSES_HEADERS) $(CC) $(CCFLAGS) -o $@ $(srcdir)/pdcdebug.c -pdcdisp.o: $(x11basedir)/pdcdisp.c $(PDCURSES_HEADERS) - $(CC) $(CCFLAGS) -o $@ $(x11basedir)/pdcdisp.c +pdcdisp.o: $(x11dir)/pdcdisp.c $(PDCURSES_HEADERS) + $(CC) $(CCFLAGS) -o $@ $(x11dir)/pdcdisp.c -pdcgetsc.o: $(x11basedir)/pdcgetsc.c $(PDCURSES_HEADERS) - $(CC) $(CCFLAGS) -o $@ $(x11basedir)/pdcgetsc.c +pdcgetsc.o: $(x11dir)/pdcgetsc.c $(PDCURSES_HEADERS) + $(CC) $(CCFLAGS) -o $@ $(x11dir)/pdcgetsc.c -pdckbd.o: $(x11basedir)/pdckbd.c $(PDCURSES_HEADERS) - $(CC) $(CCFLAGS) -o $@ $(x11basedir)/pdckbd.c +pdckbd.o: $(x11dir)/pdckbd.c $(PDCURSES_HEADERS) + $(CC) $(CCFLAGS) -o $@ $(x11dir)/pdckbd.c -pdcprint.o: $(x11basedir)/pdcprint.c $(PDCURSES_HEADERS) - $(CC) $(CCFLAGS) -o $@ $(x11basedir)/pdcprint.c +pdcprint.o: $(x11dir)/pdcprint.c $(PDCURSES_HEADERS) + $(CC) $(CCFLAGS) -o $@ $(x11dir)/pdcprint.c -pdcscrn.o: $(x11basedir)/pdcscrn.c $(PDCURSES_HEADERS) - $(CC) $(CCFLAGS) -o $@ $(x11basedir)/pdcscrn.c +pdcscrn.o: $(x11dir)/pdcscrn.c $(PDCURSES_HEADERS) + $(CC) $(CCFLAGS) -o $@ $(x11dir)/pdcscrn.c -pdcsetsc.o: $(x11basedir)/pdcsetsc.c $(PDCURSES_HEADERS) - $(CC) $(CCFLAGS) -o $@ $(x11basedir)/pdcsetsc.c +pdcsetsc.o: $(x11dir)/pdcsetsc.c $(PDCURSES_HEADERS) + $(CC) $(CCFLAGS) -o $@ $(x11dir)/pdcsetsc.c pdcutil.o: $(srcdir)/pdcutil.c $(PDCURSES_HEADERS) $(CC) $(CCFLAGS) -o $@ $(srcdir)/pdcutil.c @@ -345,23 +338,14 @@ pdcutil.o: $(srcdir)/pdcutil.c $(PDCURSES_HEADERS) pdcwin.o: $(srcdir)/pdcwin.c $(PDCURSES_HEADERS) $(CC) $(CCFLAGS) -o $@ $(srcdir)/pdcwin.c -pdcx11.o: $(x11basedir)/pdcx11.c $(PDCURSES_HEADERS) $(PDCURSES_X11_H) - $(CC) $(CCFLAGS) -o $@ $(x11basedir)/pdcx11.c - -ScrollBox.o: $(x11basedir)/ScrollBox.c $(PDCURSES_HEADERS) $(PDCURSES_X11_H) - $(CC) $(CCFLAGS) -o $@ $(x11basedir)/ScrollBox.c - -sb.o: $(x11basedir)/sb.c $(PDCURSES_HEADERS) - $(CC) $(CCFLAGS) -o $@ $(x11basedir)/sb.c - -x11common.o: $(x11dir)/x11common.c $(PDCURSES_HEADERS) - $(CC) $(CCFLAGS) -o $@ $(x11dir)/x11common.c - -x11.o: $(x11dir)/x11.c $(PDCURSES_HEADERS) +x11.o: $(x11dir)/x11.c $(PDCURSES_HEADERS) $(PDCURSES_X11_H) $(CC) $(CCFLAGS) -o $@ $(x11dir)/x11.c -x11curses.o: $(x11dir)/x11curses.c $(PDCURSES_HEADERS) - $(CC) $(CCFLAGS) -o $@ $(x11dir)/x11curses.c +ScrollBox.o: $(x11dir)/ScrollBox.c $(PDCURSES_HEADERS) $(PDCURSES_X11_H) + $(CC) $(CCFLAGS) -o $@ $(x11dir)/ScrollBox.c + +sb.o: $(x11dir)/sb.c $(PDCURSES_HEADERS) + $(CC) $(CCFLAGS) -o $@ $(x11dir)/sb.c addch.sho: $(srcdir)/addch.c $(PDCURSES_HEADERS) @@ -587,9 +571,9 @@ window.sho: $(srcdir)/window.c $(PDCURSES_HEADERS) $(SAVE2O) -pdcclip.sho: $(x11basedir)/pdcclip.c $(PDCURSES_HEADERS) +pdcclip.sho: $(x11dir)/pdcclip.c $(PDCURSES_HEADERS) $(O2SAVE) - $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11basedir)/pdcclip.c + $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11dir)/pdcclip.c $(O2SHO) $(SAVE2O) @@ -599,39 +583,39 @@ pdcdebug.sho: $(srcdir)/pdcdebug.c $(PDCURSES_HEADERS) $(O2SHO) $(SAVE2O) -pdcdisp.sho: $(x11basedir)/pdcdisp.c $(PDCURSES_HEADERS) +pdcdisp.sho: $(x11dir)/pdcdisp.c $(PDCURSES_HEADERS) $(O2SAVE) - $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11basedir)/pdcdisp.c + $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11dir)/pdcdisp.c $(O2SHO) $(SAVE2O) -pdcgetsc.sho: $(x11basedir)/pdcgetsc.c $(PDCURSES_HEADERS) +pdcgetsc.sho: $(x11dir)/pdcgetsc.c $(PDCURSES_HEADERS) $(O2SAVE) - $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11basedir)/pdcgetsc.c + $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11dir)/pdcgetsc.c $(O2SHO) $(SAVE2O) -pdckbd.sho: $(x11basedir)/pdckbd.c $(PDCURSES_HEADERS) +pdckbd.sho: $(x11dir)/pdckbd.c $(PDCURSES_HEADERS) $(O2SAVE) - $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11basedir)/pdckbd.c + $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11dir)/pdckbd.c $(O2SHO) $(SAVE2O) -pdcprint.sho: $(x11basedir)/pdcprint.c $(PDCURSES_HEADERS) +pdcprint.sho: $(x11dir)/pdcprint.c $(PDCURSES_HEADERS) $(O2SAVE) - $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11basedir)/pdcprint.c + $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11dir)/pdcprint.c $(O2SHO) $(SAVE2O) -pdcscrn.sho: $(x11basedir)/pdcscrn.c $(PDCURSES_HEADERS) +pdcscrn.sho: $(x11dir)/pdcscrn.c $(PDCURSES_HEADERS) $(O2SAVE) - $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11basedir)/pdcscrn.c + $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11dir)/pdcscrn.c $(O2SHO) $(SAVE2O) -pdcsetsc.sho: $(x11basedir)/pdcsetsc.c $(PDCURSES_HEADERS) +pdcsetsc.sho: $(x11dir)/pdcsetsc.c $(PDCURSES_HEADERS) $(O2SAVE) - $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11basedir)/pdcsetsc.c + $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11dir)/pdcsetsc.c $(O2SHO) $(SAVE2O) @@ -647,38 +631,20 @@ pdcwin.sho: $(srcdir)/pdcwin.c $(PDCURSES_HEADERS) $(O2SHO) $(SAVE2O) -pdcx11.sho: $(x11basedir)/pdcx11.c $(PDCURSES_HEADERS) $(PDCURSES_X11_H) +x11.sho: $(x11dir)/x11.c $(PDCURSES_HEADERS) $(PDCURSES_X11_H) $(O2SAVE) - $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11basedir)/pdcx11.c - $(O2SHO) - $(SAVE2O) - -ScrollBox.sho: $(x11basedir)/ScrollBox.c $(PDCURSES_HEADERS) $(PDCURSES_X11_H) - $(O2SAVE) - $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11basedir)/ScrollBox.c - $(O2SHO) - $(SAVE2O) - -sb.sho: $(x11basedir)/sb.c $(PDCURSES_HEADERS) - $(O2SAVE) - $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11basedir)/sb.c - $(O2SHO) - $(SAVE2O) - -x11common.sho: $(x11dir)/x11common.c $(PDCURSES_HEADERS) - $(O2SAVE) - $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11dir)/x11common.c + $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11dir)/x11.c $(O2SHO) $(SAVE2O) -x11.sho: $(x11dir)/x11.c $(PDCURSES_HEADERS) +ScrollBox.sho: $(x11dir)/ScrollBox.c $(PDCURSES_HEADERS) $(PDCURSES_X11_H) $(O2SAVE) - $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11dir)/x11.c + $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11dir)/ScrollBox.c $(O2SHO) $(SAVE2O) -x11curses.sho: $(x11dir)/x11curses.c $(PDCURSES_HEADERS) +sb.sho: $(x11dir)/sb.c $(PDCURSES_HEADERS) $(O2SAVE) - $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11dir)/x11curses.c + $(CC) $(CCFLAGS) $(DYN_COMP) $(CC2O) $(x11dir)/sb.c $(O2SHO) $(SAVE2O) diff --git a/pdcurses/border.c b/pdcurses/border.c index b27c5cb69..7f954c3e2 100644 --- a/pdcurses/border.c +++ b/pdcurses/border.c @@ -31,17 +31,13 @@ #undef whline #undef vline #undef wvline -#undef PDC_wunderline -#undef PDC_woverline -#undef PDC_leftline -#undef PDC_rightline /* undefine any macros for functions called by this module if in debug mode */ #ifdef PDCDEBUG #endif #ifdef PDCDEBUG -char *rcsid_border = "$Id: border.c,v 1.2 2001/01/10 08:26:52 mark Exp $"; +char *rcsid_border = "$Id: border.c,v 1.1 2001/01/10 08:26:51 mark Exp $"; #endif /*man-start********************************************************************* @@ -58,10 +54,6 @@ char *rcsid_border = "$Id: border.c,v 1.2 2001/01/10 08:26:52 mark Exp $"; int vline(chtype ch, int n); int whline(WINDOW *win, chtype ch, int n); int wvline(WINDOW *win, chtype ch, int n); - int PDC_wunderline(WINDOW *win, int n, bool state); - int PDC_woverline(WINDOW *win, int n, bool state); - int PDC_wleftline(WINDOW *win, int n, bool state); - int PDC_wrightline(WINDOW *win, int n, bool state); X/Open Description: The border(), wborder(), and box() routines, a border is drawn @@ -95,19 +87,15 @@ char *rcsid_border = "$Id: border.c,v 1.2 2001/01/10 08:26:52 mark Exp $"; X/Open Errors: No errors are defined for these functions. - Portability X/Open BSD SYS V PDCurses + Portability X/Open BSD SYS V Dec '88 - border - - 4.0 Y - wborder - - 4.0 Y - box Y Y Y Y - hline - - 4.0 Y - whline - - 4.0 Y - vline - - 4.0 Y - wvline - - 4.0 Y - PDC_wunderline - - - Y - PDC_woverline - - - Y - PDC_wleftline - - - Y - PDC_wrightline - - - Y + border - - 4.0 + wborder - - 4.0 + box Y Y Y + hline - - 4.0 + whline - - 4.0 + vline - - 4.0 + wvline - - 4.0 **man-end**********************************************************************/ @@ -441,191 +429,3 @@ int n; PDC_sync(win); return (OK); } -/***********************************************************************/ -#ifdef HAVE_PROTO -int PDC_CDECL PDC_wunderline(WINDOW *win, int n, bool state) -#else -int PDC_CDECL PDC_wunderline(win,n,state) -WINDOW *win; -int n; -bool state; -#endif -/***********************************************************************/ -{ - int endpos; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("PDC_wunderline() - called\n"); -#endif - - if (win == (WINDOW *)NULL) - return( ERR ); - - if (n < 1) - return( ERR ); - - endpos = min(win->_cury + n -1, win->_maxy); - - for (n = win->_cury; n <= endpos; n++) - { - if ( state ) - win->_y[n][win->_curx] |= A_UNDERLINE; /* Turn ON A_UNDERLINE */ - else - win->_y[n][win->_curx] |= ~A_UNDERLINE; /* Turn OFF A_UNDERLINE */ - - if (win->_firstch[n] == _NO_CHANGE) - { - win->_firstch[n] = win->_curx; - win->_lastch[n] = win->_curx; - } - else - { - win->_firstch[n] = min(win->_firstch[n], win->_curx); - win->_lastch[n] = max(win->_lastch[n], win->_curx); - } - } - - PDC_sync(win); - return (OK); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int PDC_CDECL PDC_woverline(WINDOW *win, int n, bool state) -#else -int PDC_CDECL PDC_woverline(win,n,state) -WINDOW *win; -int n; -bool state; -#endif -/***********************************************************************/ -{ - int endpos; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("PDC_woverline() - called\n"); -#endif - - if (win == (WINDOW *)NULL) - return( ERR ); - - if (n < 1) - return( ERR ); - - endpos = min(win->_cury + n -1, win->_maxy); - - for (n = win->_cury; n <= endpos; n++) - { - if ( state ) - win->_y[n][win->_curx] |= A_OVERLINE; /* Turn ON A_OVERLINE */ - else - win->_y[n][win->_curx] |= ~A_OVERLINE; /* Turn OFF A_OVERLINE */ - - if (win->_firstch[n] == _NO_CHANGE) - { - win->_firstch[n] = win->_curx; - win->_lastch[n] = win->_curx; - } - else - { - win->_firstch[n] = min(win->_firstch[n], win->_curx); - win->_lastch[n] = max(win->_lastch[n], win->_curx); - } - } - - PDC_sync(win); - return (OK); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int PDC_CDECL PDC_wleftline(WINDOW *win, int n, bool state) -#else -int PDC_CDECL PDC_wleftline(win,n,state) -WINDOW *win; -int n; -bool state; -#endif -/***********************************************************************/ -{ - int endpos; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("PDC_wleftline() - called\n"); -#endif - - if (win == (WINDOW *)NULL) - return( ERR ); - - if (n < 1) - return( ERR ); - - endpos = min(win->_cury + n -1, win->_maxy); - - for (n = win->_cury; n <= endpos; n++) - { - if ( state ) - win->_y[n][win->_curx] |= A_LEFTLINE; /* Turn ON A_LEFTLINE */ - else - win->_y[n][win->_curx] |= ~A_LEFTLINE; /* Turn OFF A_LEFTLINE */ - - if (win->_firstch[n] == _NO_CHANGE) - { - win->_firstch[n] = win->_curx; - win->_lastch[n] = win->_curx; - } - else - { - win->_firstch[n] = min(win->_firstch[n], win->_curx); - win->_lastch[n] = max(win->_lastch[n], win->_curx); - } - } - - PDC_sync(win); - return (OK); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int PDC_CDECL PDC_wrightline(WINDOW *win, int n, bool state) -#else -int PDC_CDECL PDC_wrightline(win,n,state) -WINDOW *win; -int n; -bool state; -#endif -/***********************************************************************/ -{ - int endpos; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("PDC_wrightline() - called\n"); -#endif - - if (win == (WINDOW *)NULL) - return( ERR ); - - if (n < 1) - return( ERR ); - - endpos = min(win->_cury + n -1, win->_maxy); - - for (n = win->_cury; n <= endpos; n++) - { - if ( state ) - win->_y[n][win->_curx] |= A_RIGHTLINE; /* Turn ON A_RIGHTLINE */ - else - win->_y[n][win->_curx] |= ~A_RIGHTLINE; /* Turn OFF A_RIGHTLINE */ - - if (win->_firstch[n] == _NO_CHANGE) - { - win->_firstch[n] = win->_curx; - win->_lastch[n] = win->_curx; - } - else - { - win->_firstch[n] = min(win->_firstch[n], win->_curx); - win->_lastch[n] = max(win->_lastch[n], win->_curx); - } - } - - PDC_sync(win); - return (OK); -} diff --git a/pdcurses/color.c b/pdcurses/color.c index 672e8d3eb..6095f4eff 100644 --- a/pdcurses/color.c +++ b/pdcurses/color.c @@ -36,7 +36,6 @@ #undef can_change_color #undef color_content #undef pair_content -#undef PDC_set_line_color /* undefine any macros for functions called by this module if in debug mode */ #ifdef PDCDEBUG @@ -49,7 +48,7 @@ static int PDC_init_pair(); #endif #ifdef PDCDEBUG -char *rcsid_color = "$Id: color.c,v 1.2 2001/01/10 08:26:56 mark Exp $"; +char *rcsid_color = "$Id: color.c,v 1.1 2001/01/10 08:26:55 mark Exp $"; #endif /*man-start********************************************************************* @@ -64,7 +63,6 @@ char *rcsid_color = "$Id: color.c,v 1.2 2001/01/10 08:26:56 mark Exp $"; bool can_change_color(void); *** int color_content(short color, short *redp, short *greenp, short *bluep); int pair_content(short pair, short *fgp, short *bgp); - int PDC_set_line_color(short color); X/Open Description: To use these routines, start_color() must be called, usually @@ -101,10 +99,6 @@ char *rcsid_color = "$Id: color.c,v 1.2 2001/01/10 08:26:56 mark Exp $"; pair_content() is used to determine what the colors of a given color-pair consist of. - PDC_set_line_color() is used to set the color, globally, for the - color of the lines drawn for the attributes: A_UNDERLINE, A_OVERLINE, - A_LEFTLINE and A_RIGHTLINE. PDCurses only feature. - NOTE: has_colors() is implemented as a macro. X/Open Return Value: @@ -114,7 +108,7 @@ char *rcsid_color = "$Id: color.c,v 1.2 2001/01/10 08:26:56 mark Exp $"; X/Open Errors: No errors are defined for this function. - Portability X/Open BSD SYS V PDCurses + Portability X/Open BSD SYS V Dec '88 start_color - - 3.2 init_pair - - 3.2 @@ -123,7 +117,6 @@ char *rcsid_color = "$Id: color.c,v 1.2 2001/01/10 08:26:56 mark Exp $"; can_change_color - - 3.2 color_content - - 3.2 pair_content - - 3.2 - PDC_set_line_color - - - Y **man-end**********************************************************************/ @@ -356,21 +349,6 @@ short *background; return(OK); } -/***********************************************************************/ -#ifdef HAVE_PROTO -int PDC_CDECL PDC_set_line_color(short color) -#else -int PDC_CDECL PDC_set_line_color(color) -short color; -#endif -/***********************************************************************/ -{ - - if (color >= COLORS || color < 0) - return(ERR); - SP->line_color = color; - return(OK); -} #if defined(CHTYPE_LONG) /***********************************************************************/ diff --git a/pdcurses/getch.c b/pdcurses/getch.c index add869366..a4d30b898 100644 --- a/pdcurses/getch.c +++ b/pdcurses/getch.c @@ -39,7 +39,7 @@ #endif #ifdef PDCDEBUG -char *rcsid_getch = "$Id: getch.c,v 1.2 2001/01/10 08:27:01 mark Exp $"; +char *rcsid_getch = "$Id: getch.c,v 1.1 2001/01/10 08:26:59 mark Exp $"; #endif /*man-start********************************************************************* @@ -160,7 +160,7 @@ extern WINDOW* _getch_win_; #else short display_key = 0x100; #endif - int waitingtenths = 0; + int waitingtenths = SP->delaytenths; #ifdef PDCDEBUG if (trace_on) PDC_debug("wgetch() - called\n"); @@ -169,9 +169,6 @@ extern WINDOW* _getch_win_; if (win == (WINDOW *)NULL) return( ERR ); - if ( SP->delaytenths ) - waitingtenths = 10*SP->delaytenths; - /* wrs (7/31/93) -- System V curses refreshes window when wgetch is called */ /* if there have been changes to it and it is not a pad */ if( (! (win->_flags & _PAD)) && (! win->_nodelay) ) @@ -282,8 +279,7 @@ extern WINDOW* _getch_win_; if (key == (-1)) { waitingtenths--; - napms(10); - continue; + napms(100); } } } @@ -297,7 +293,7 @@ extern WINDOW* _getch_win_; */ key = '\n'; } - if ( SP->echo && (key < display_key) ) + if (SP->echo && (key < display_key)) { /* * if echo is enabled @@ -305,7 +301,7 @@ extern WINDOW* _getch_win_; waddch(w, key); wrefresh(w); } - if ( (SP->raw_inp || SP->cbreak) ) + if (SP->raw_inp || SP->cbreak) { /* * if no buffering diff --git a/pdcurses/initscr.c b/pdcurses/initscr.c index a5e044bd7..4166e5ce9 100644 --- a/pdcurses/initscr.c +++ b/pdcurses/initscr.c @@ -61,7 +61,7 @@ #endif #ifdef PDCDEBUG -char *rcsid_initscr = "$Id: initscr.c,v 1.2 2001/01/10 08:27:08 mark Exp $"; +char *rcsid_initscr = "$Id: initscr.c,v 1.1 2001/01/10 08:27:06 mark Exp $"; #else char* _curses_notice = "PDCurses 2.2 - Public Domain 1994"; #endif @@ -321,8 +321,8 @@ ACS_BSSB = (chtype)13|A_ALTCHARSET; ACS_SSBB = (chtype)14|A_ALTCHARSET; ACS_BBSS = (chtype)12|A_ALTCHARSET; ACS_SBBS = (chtype)11|A_ALTCHARSET; -ACS_SBSS = (chtype)22|A_ALTCHARSET; -ACS_SSSB = (chtype)21|A_ALTCHARSET; +ACS_SBSS = (chtype)21|A_ALTCHARSET; +ACS_SSSB = (chtype)22|A_ALTCHARSET; ACS_SSBS = (chtype)23|A_ALTCHARSET; ACS_BSSS = (chtype)24|A_ALTCHARSET; ACS_BSBS = (chtype)18|A_ALTCHARSET; diff --git a/pdcurses/util.c b/pdcurses/util.c index 37b0247df..605fab73f 100644 --- a/pdcurses/util.c +++ b/pdcurses/util.c @@ -65,7 +65,7 @@ #endif #ifdef PDCDEBUG -char *rcsid_util = "$Id: util.c,v 1.2 2001/01/10 08:27:34 mark Exp $"; +char *rcsid_util = "$Id: util.c,v 1.1 2001/01/10 08:27:33 mark Exp $"; #endif /*man-start********************************************************************* @@ -349,7 +349,7 @@ extern int c_ungind; /* wungetch() push index */ #ifdef XCURSES while(XCurses_kbhit()) - (void)XCurses_rawgetch(0); + (void)XCurses_rawgetch(); #endif c_gindex = 1; /* set indices to kill buffer */ diff --git a/x11/README b/x11/README index 95d5dd4aa..62bdd4cef 100644 --- a/x11/README +++ b/x11/README @@ -9,7 +9,7 @@ Distribution Status ------------------- - The files in this directory are copyright Mark Hessling 1995-2000. + The files in this directory are copyright Mark Hessling 1995-1999. This source code made be used without restriction when used with the PDCurses library. Any other use of this source code requires written permission of the author, Mark Hessling (M.Hessling@qut.edu.au) @@ -24,16 +24,3 @@ to the calling procedure. - add proper 'flash' behaviour - -Structure ---------- - -x11.c - contains functions that are X11 specific functions that are - used by both the process and thread implementations -x11.h - #defines and includes for the X11 process/thread -x11_proc.c - contains functions that are used by the X11 (child) process - in the process implementation -curses_proc.c - contains functions that are used by the curses (parent) - process in the process implementation -x11_thread.c - -curses_thread.c - diff --git a/x11/ScrollBox.c b/x11/ScrollBox.c index acb44e3cb..f25e71d42 100644 --- a/x11/ScrollBox.c +++ b/x11/ScrollBox.c @@ -121,17 +121,15 @@ Widget w; Boolean doit; { ScrollBoxWidget sbw = (ScrollBoxWidget) w; - Widget wmain, vscroll, hscroll; + Widget main, vscroll, hscroll; Widget child; Dimension mw, mh; /* main window */ Dimension vh; /* vertical scrollbar length (height) */ Dimension hw; /* horizontal scrollbar length (width) */ Position vx; Position hy; -#if 0 Dimension th; Dimension tw; -#endif int i; if (sbw->composite.num_children != 3) @@ -150,7 +148,7 @@ Boolean doit; * Child one is the main window, two is the vertical scrollbar, * and three is the horizontal scrollbar. */ - wmain = sbw->composite.children[0]; + main = sbw->composite.children[0]; vscroll = sbw->composite.children[1]; hscroll = sbw->composite.children[2]; @@ -160,36 +158,36 @@ Boolean doit; #if 1 mw = sbw->core.width - (2 * sbw->scrollBox.h_space) - vscroll->core.width - (2 * vscroll->core.border_width) - - (2 * wmain->core.border_width); + (2 * main->core.border_width); mh = sbw->core.height - (2 * sbw->scrollBox.v_space) - hscroll->core.height - (2 * hscroll->core.border_width) - - (2 * wmain->core.border_width); + (2 * main->core.border_width); - vx = wmain->core.x + mw + sbw->scrollBox.h_space + wmain->core.border_width + vscroll->core.border_width; + vx = main->core.x + mw + sbw->scrollBox.h_space + main->core.border_width + vscroll->core.border_width; - hy = wmain->core.y + mh + sbw->scrollBox.v_space + wmain->core.border_width + hscroll->core.border_width; + hy = main->core.y + mh + sbw->scrollBox.v_space + main->core.border_width + hscroll->core.border_width; vh = mh; /* scrollbars are always same length as main window */ hw = mw; if (doit) { - XtResizeWidget(wmain, mw, mh, 1); + XtResizeWidget(main, mw, mh, 1); #else - tw = wmain->core.width + (2 * sbw->scrollBox.h_space) + + tw = main->core.width + (2 * sbw->scrollBox.h_space) + vscroll->core.width + (2 * vscroll->core.border_width) + - (2 * wmain->core.border_width); + (2 * main->core.border_width); - th = wmain->core.height + (2 * sbw->scrollBox.v_space) + + th = main->core.height + (2 * sbw->scrollBox.v_space) + hscroll->core.height - (2 * hscroll->core.border_width) + - (2 * wmain->core.border_width); + (2 * main->core.border_width); - hw = mw = wmain->core.width; - vh = mh = wmain->core.height; + hw = mw = main->core.width; + vh = mh = main->core.height; - vx = wmain->core.x + mw + sbw->scrollBox.h_space + wmain->core.border_width + vscroll->core.border_width; + vx = main->core.x + mw + sbw->scrollBox.h_space + main->core.border_width + vscroll->core.border_width; - hy = wmain->core.y + mh + sbw->scrollBox.v_space + wmain->core.border_width + hscroll->core.border_width; + hy = main->core.y + mh + sbw->scrollBox.v_space + main->core.border_width + hscroll->core.border_width; if (doit) { XtResizeWidget(w, tw, th, 1); diff --git a/x11/pdcdisp.c b/x11/pdcdisp.c index d96b8014e..0794b9c01 100644 --- a/x11/pdcdisp.c +++ b/x11/pdcdisp.c @@ -34,7 +34,7 @@ #endif #ifdef PDCDEBUG -char *rcsid_PDCdisp = "$Id: pdcdisp.c,v 1.2 2001/01/10 08:30:06 mark Exp $"; +char *rcsid_PDCdisp = "$Id: pdcdisp.c,v 1.1 2001/01/10 08:30:05 mark Exp $"; #endif /*man-start********************************************************************* @@ -198,7 +198,7 @@ int col; if (trace_on) PDC_debug("PDC_gotoxy() - called: row %d col %d\n",row,col); #endif - XCurses_display_cursor(SP->cursrow,SP->curscol,row,col,SP->visibility); + XCurses_display_cursor(SP->cursrow,SP->curscol,row,col); return(OK); } diff --git a/x11/pdckbd.c b/x11/pdckbd.c index 33077a05e..dc519acf1 100644 --- a/x11/pdckbd.c +++ b/x11/pdckbd.c @@ -25,7 +25,7 @@ #include #ifdef PDCDEBUG -char *rcsid_PDCkbd = "$Id: pdckbd.c,v 1.2 2001/01/10 08:30:10 mark Exp $"; +char *rcsid_PDCkbd = "$Id: pdckbd.c,v 1.1 2001/01/10 08:30:09 mark Exp $"; #endif /*man-start********************************************************************* @@ -240,7 +240,7 @@ extern WINDOW* _getch_win_; if (_getch_win_->_nodelay && !PDC_breakout()) /* @@ */ return( -1 ); - c = XCurses_rawgetch( SP->delaytenths ); + c = XCurses_rawgetch(); return(c); } diff --git a/x11/pdcscrn.c b/x11/pdcscrn.c index a7cd3ccc8..72d1d95d5 100644 --- a/x11/pdcscrn.c +++ b/x11/pdcscrn.c @@ -24,7 +24,7 @@ #include #ifdef PDCDEBUG -char *rcsid_PDCscrn = "$Id: pdcscrn.c,v 1.2 2001/01/10 08:30:13 mark Exp $"; +char *rcsid_PDCscrn = "$Id: pdcscrn.c,v 1.1 2001/01/10 08:30:12 mark Exp $"; #endif bool GLOBAL_sb_on=FALSE; @@ -177,7 +177,6 @@ extern bool sb_started; internal->sb_total_x = 0; internal->sb_viewport_x = 0; internal->sb_cur_x = 0; - internal->line_color = COLOR_WHITE; return( OK ); } diff --git a/x11/pdcsetsc.c b/x11/pdcsetsc.c index b871c16ac..2025f6233 100644 --- a/x11/pdcsetsc.c +++ b/x11/pdcsetsc.c @@ -24,7 +24,7 @@ #include #ifdef PDCDEBUG -char *rcsid_PDCsetsc = "$Id: pdcsetsc.c,v 1.2 2001/01/10 08:30:16 mark Exp $"; +char *rcsid_PDCsetsc = "$Id: pdcsetsc.c,v 1.1 2001/01/10 08:30:14 mark Exp $"; #endif @@ -120,18 +120,17 @@ int visibility; #endif /***********************************************************************/ { - int ret_vis = SP->visibility; + int ret_vis; #ifdef PDCDEBUG - if (trace_on) PDC_debug("PDC_curs_set() - called: visibility=%d\n",visibility); + if (trace_on) PDC_debug("PDC_curs_set() - called: visibility=%d\n",visibility); #endif - if ( visibility != -1 ) - { - SP->visibility = visibility; - } - XCurses_display_cursor(SP->cursrow,SP->curscol,SP->cursrow,SP->curscol,visibility); - return(ret_vis); + ret_vis = SP->visibility; + SP->visibility = visibility; + + XCurses_display_cursor(SP->cursrow,SP->curscol,SP->cursrow,SP->curscol); + return(ret_vis); } /*man-start********************************************************************* diff --git a/x11/pdcx11.c b/x11/pdcx11.c deleted file mode 100644 index e4f2bb086..000000000 --- a/x11/pdcx11.c +++ /dev/null @@ -1,3158 +0,0 @@ -/* -*************************************************************************** -* This file comprises part of PDCurses. PDCurses is Public Domain software. -* You may use this code for whatever purposes you desire. This software -* is provided AS IS with NO WARRANTY whatsoever. -* Should this software be used in another application, an acknowledgement -* that PDCurses code is used would be appreciated, but is not mandatory. -* -* Any changes which you make to this software which may improve or enhance -* it, should be forwarded to the current maintainer for the benefit of -* other users. -* -* The only restriction placed on this code is that no distribution of -* modified PDCurses code be made under the PDCurses name, by anyone -* other than the current maintainer. -* -* See the file maintain.er for details of the current maintainer. -* -* This file is NOT public domain software. It is Copyright, Mark Hessling -* 1994,1995. -*************************************************************************** -*/ - -#if defined(XCURSES) -#include "pdcx11.h" - - -/***************************************************************************/ -/* Default icons for XCurses applications. */ -/***************************************************************************/ -#define BIG_ICON_WIDTH 64 -#define BIG_ICON_HEIGHT 64 -static unsigned char big_icon_bitmap_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0xc0, 0x00, 0x00, - 0x00, 0x00, 0xfc, 0x03, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x07, - 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x07, 0x00, 0x18, 0x00, 0x00, - 0x00, 0x00, 0xf0, 0x0f, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1f, - 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x06, 0x00, 0x00, - 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7f, - 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xc0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xfe, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, - 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x33, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xf8, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, - 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x0e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x60, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, - 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x7f, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x98, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xfe, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, - 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xf8, 0x07, 0x00, 0x00, - 0x00, 0x00, 0xc0, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, - 0xe0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0xe0, 0x1f, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, - 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x23, 0x50, 0x1e, - 0x7c, 0xf0, 0xe0, 0x03, 0x60, 0x26, 0x50, 0x33, 0xc6, 0x98, 0x31, 0x06, - 0x30, 0x2c, 0xd0, 0x61, 0x83, 0x0d, 0x1b, 0x0c, 0x10, 0x28, 0xd0, 0x40, - 0x01, 0x05, 0x0a, 0x08, 0x10, 0x20, 0x50, 0x00, 0x01, 0x05, 0x0a, 0x08, - 0x10, 0x20, 0x50, 0x00, 0x03, 0x04, 0x1a, 0x00, 0x10, 0x20, 0x50, 0x00, - 0x06, 0x04, 0x32, 0x00, 0x10, 0x20, 0x50, 0x00, 0x7c, 0xfc, 0xe3, 0x03, - 0x10, 0x20, 0x50, 0x00, 0xc0, 0x04, 0x00, 0x06, 0x10, 0x20, 0x50, 0x00, - 0x80, 0x05, 0x00, 0x0c, 0x10, 0x20, 0x50, 0x00, 0x01, 0x05, 0x0a, 0x08, - 0x10, 0x28, 0x50, 0x00, 0x01, 0x05, 0x0a, 0x08, 0x30, 0x6c, 0x58, 0x00, - 0x83, 0x0d, 0x1b, 0x0c, 0x60, 0xc6, 0x4c, 0x00, 0xc6, 0x98, 0x31, 0x06, - 0xc0, 0x83, 0x47, 0x00, 0x7c, 0xf0, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -#define LITTLE_ICON_WIDTH 32 -#define LITTLE_ICON_HEIGHT 32 -static unsigned char little_icon_bitmap_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x07, 0x00, 0x01, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x1e, 0x40, 0x00, - 0x00, 0x3c, 0x20, 0x00, 0x00, 0x78, 0x10, 0x00, 0x00, 0xf0, 0x08, 0x00, - 0x00, 0xe0, 0x05, 0x00, 0x00, 0xc0, 0x06, 0x00, 0x00, 0x40, 0x07, 0x00, - 0x00, 0x20, 0x0f, 0x00, 0x00, 0x10, 0x1e, 0x00, 0x00, 0x08, 0x3c, 0x00, - 0x00, 0x04, 0x78, 0x00, 0x00, 0x02, 0xf0, 0x00, 0x00, 0x01, 0xe0, 0x01, - 0x80, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x4c, 0x2a, 0xc6, 0x18, 0x52, 0x5a, 0x29, 0x25, 0x42, 0x0a, 0x29, 0x25, - 0x42, 0x0a, 0xe2, 0x09, 0x42, 0x0a, 0x24, 0x10, 0x42, 0x0a, 0x29, 0x20, - 0x52, 0x0a, 0x29, 0x25, 0x8c, 0x09, 0xc6, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - - - - -struct XCursesKey -{ - int keycode; - int numkeypad; - int normal; - int shifted; - int control; - int alt; -}; -typedef struct XCursesKey XCURSESKEY; - -XCURSESKEY XCursesKeys[] = -{ -/* keycode keypad ? normal shifted control alt*/ - {XK_Left, FALSE, KEY_LEFT, KEY_SLEFT, CTL_LEFT, ALT_LEFT}, - {XK_Right, FALSE, KEY_RIGHT, KEY_SRIGHT, CTL_RIGHT, ALT_RIGHT}, - {XK_Up, FALSE, KEY_UP, KEY_UP, CTL_UP, ALT_UP}, - {XK_Down, FALSE, KEY_DOWN, KEY_DOWN, CTL_DOWN, ALT_DOWN}, - {XK_Home, FALSE, KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME}, - {XK_R7, FALSE, KEY_HOME, KEY_SHOME, CTL_HOME, ALT_HOME}, /* Sun Type 4 keyboard */ - {XK_End, FALSE, KEY_END, KEY_SEND, CTL_END, ALT_END}, - {XK_R13, FALSE, KEY_END, KEY_SEND, CTL_END, ALT_END}, /* Sun Type 4 keyboard */ - {XK_Prior, FALSE, KEY_PPAGE, KEY_SPREVIOUS, CTL_PGUP, ALT_PGUP}, - {XK_R9, FALSE, KEY_PPAGE, KEY_SPREVIOUS, CTL_PGUP, ALT_PGUP}, /* Sun Type 4 keyboard */ - {XK_Next, FALSE, KEY_NPAGE, KEY_SNEXT, CTL_PGDN, ALT_PGDN}, - {XK_R15, FALSE, KEY_NPAGE, KEY_SNEXT, CTL_PGDN, ALT_PGDN}, /* Sun Type 4 keyboard */ - {XK_Insert, FALSE, KEY_IC, KEY_SIC, CTL_INS, ALT_INS}, - {XK_Delete, FALSE, KEY_DC, KEY_SDC, CTL_DEL, ALT_DEL}, - {XK_F1, FALSE, KEY_F(1), KEY_F(13), KEY_F(25), KEY_F(37)}, - {XK_F2, FALSE, KEY_F(2), KEY_F(14), KEY_F(26), KEY_F(38)}, - {XK_F3, FALSE, KEY_F(3), KEY_F(15), KEY_F(27), KEY_F(39)}, - {XK_F4, FALSE, KEY_F(4), KEY_F(16), KEY_F(28), KEY_F(40)}, - {XK_F5, FALSE, KEY_F(5), KEY_F(17), KEY_F(29), KEY_F(41)}, - {XK_F6, FALSE, KEY_F(6), KEY_F(18), KEY_F(30), KEY_F(42)}, - {XK_F7, FALSE, KEY_F(7), KEY_F(19), KEY_F(31), KEY_F(43)}, - {XK_F8, FALSE, KEY_F(8), KEY_F(20), KEY_F(32), KEY_F(44)}, - {XK_F9, FALSE, KEY_F(9), KEY_F(21), KEY_F(33), KEY_F(45)}, - {XK_F10, FALSE, KEY_F(10), KEY_F(22), KEY_F(34), KEY_F(46)}, - {XK_F11, FALSE, KEY_F(11), KEY_F(23), KEY_F(35), KEY_F(47)}, - {XK_F12, FALSE, KEY_F(12), KEY_F(24), KEY_F(36), KEY_F(48)}, - {XK_F13, FALSE, KEY_F(13), KEY_F(25), KEY_F(37), KEY_F(49)}, - {XK_F14, FALSE, KEY_F(14), KEY_F(26), KEY_F(38), KEY_F(50)}, - {XK_F15, FALSE, KEY_F(15), KEY_F(27), KEY_F(39), KEY_F(51)}, - {XK_F16, FALSE, KEY_F(16), KEY_F(28), KEY_F(40), KEY_F(52)}, - {XK_F17, FALSE, KEY_F(17), KEY_F(29), KEY_F(41), KEY_F(53)}, - {XK_F18, FALSE, KEY_F(18), KEY_F(30), KEY_F(42), KEY_F(54)}, - {XK_F19, FALSE, KEY_F(19), KEY_F(31), KEY_F(43), KEY_F(55)}, - {XK_F20, FALSE, KEY_F(20), KEY_F(32), KEY_F(44), KEY_F(56)}, - {XK_BackSpace, FALSE, 0x08, 0x08, CTL_BKSP, ALT_BKSP}, - {XK_Tab, FALSE, 0x09, KEY_BTAB, CTL_TAB, ALT_TAB}, - {XK_Select, FALSE, KEY_SELECT, KEY_SELECT, KEY_SELECT, KEY_SELECT}, - {XK_Print, FALSE, KEY_PRINT, KEY_SPRINT, KEY_PRINT, KEY_PRINT}, - {XK_Find, FALSE, KEY_FIND, KEY_SFIND, KEY_FIND, KEY_FIND}, - {XK_Pause, FALSE, KEY_SUSPEND, KEY_SSUSPEND, KEY_SUSPEND, KEY_SUSPEND}, - {XK_Clear, FALSE, KEY_CLEAR, KEY_CLEAR, KEY_CLEAR, KEY_CLEAR}, - {XK_Cancel, FALSE, KEY_CANCEL, KEY_SCANCEL, KEY_CANCEL, KEY_CANCEL}, - {XK_Break, FALSE, KEY_BREAK, KEY_BREAK, KEY_BREAK, KEY_BREAK}, - {XK_Help, FALSE, KEY_HELP, KEY_SHELP, KEY_LHELP, KEY_HELP}, - {XK_L4, FALSE, KEY_UNDO, KEY_SUNDO, KEY_UNDO, KEY_UNDO}, - {XK_L6, FALSE, KEY_COPY, KEY_SCOPY, KEY_COPY, KEY_COPY}, - {XK_L9, FALSE, KEY_FIND, KEY_SFIND, KEY_FIND, KEY_FIND}, - {XK_Menu, FALSE, KEY_OPTIONS, KEY_SOPTIONS, KEY_OPTIONS, KEY_OPTIONS}, -#ifdef HAVE_SUNKEYSYM_H - {SunXK_F36, FALSE, KEY_F(41), KEY_F(43), KEY_F(45), KEY_F(47)}, - {SunXK_F37, FALSE, KEY_F(42), KEY_F(44), KEY_F(46), KEY_F(48)}, -#endif -#ifdef HAVE_DECKEYSYM_H - {DXK_Remove, FALSE, KEY_DC, KEY_SDC, CTL_DEL, ALT_DEL}, -#endif - {XK_Escape, FALSE, 0x1B, 0x1B, 0x1B, ALT_ESC}, - {XK_KP_Enter, TRUE, PADENTER, PADENTER, CTL_PADENTER, ALT_PADENTER}, - {XK_KP_Add, TRUE, PADPLUS, (int)'+', CTL_PADPLUS, ALT_PADPLUS}, - {XK_KP_Subtract, TRUE, PADMINUS, (int)'-', CTL_PADMINUS, ALT_PADMINUS}, - {XK_KP_Multiply, TRUE, PADSTAR, (int)'*', CTL_PADSTAR, ALT_PADSTAR}, - {XK_R6, TRUE, PADSTAR, (int)'*', CTL_PADSTAR, ALT_PADSTAR}, /* Sun Type 4 keyboard */ - {XK_KP_Divide, TRUE, PADSLASH, (int)'/', CTL_PADSLASH, ALT_PADSLASH}, - {XK_R5, TRUE, PADSLASH, (int)'/', CTL_PADSLASH, ALT_PADSLASH},/* Sun Type 4 keyboard */ - {XK_KP_Decimal, TRUE, PADSTOP, (int)'.', CTL_PADSTOP, ALT_PADSTOP}, - {XK_KP_0, TRUE, PAD0, (int)'0', CTL_PAD0, ALT_PAD0}, - {XK_KP_1, TRUE, KEY_C1, (int)'1', CTL_PAD1, ALT_PAD1}, - {XK_KP_2, TRUE, KEY_C2, (int)'2', CTL_PAD2, ALT_PAD2}, - {XK_KP_3, TRUE, KEY_C3, (int)'3', CTL_PAD3, ALT_PAD3}, - {XK_KP_4, TRUE, KEY_B1, (int)'4', CTL_PAD4, ALT_PAD4}, - {XK_KP_5, TRUE, KEY_B2, (int)'5', CTL_PAD5, ALT_PAD5}, - {XK_R11, TRUE, KEY_B2, (int)'5', CTL_PAD5, ALT_PAD5}, /* Sun Type 4 keyboard */ - {XK_KP_6, TRUE, KEY_B3, (int)'6', CTL_PAD6, ALT_PAD6}, - {XK_KP_7, TRUE, KEY_A1, (int)'7', CTL_PAD7, ALT_PAD7}, - {XK_KP_8, TRUE, KEY_A2, (int)'8', CTL_PAD8, ALT_PAD8}, - {XK_KP_9, TRUE, KEY_A3, (int)'9', CTL_PAD9, ALT_PAD9}, -/* the following added to support Sun Type 5 keyboards */ - {XK_F21, FALSE, KEY_SUSPEND, KEY_SSUSPEND, KEY_SUSPEND, KEY_SUSPEND}, - {XK_F22, FALSE, KEY_PRINT, KEY_SPRINT, KEY_PRINT, KEY_PRINT}, - {XK_F24, TRUE, PADMINUS, (int)'-', CTL_PADMINUS, ALT_PADMINUS}, - {XK_F25, TRUE, PADSLASH, (int)'/', CTL_PADSLASH, ALT_PADSLASH},/* Sun Type 4 keyboard */ - {XK_F26, TRUE, PADSTAR, (int)'*', CTL_PADSTAR, ALT_PADSTAR}, /* Sun Type 4 keyboard */ - {XK_F27, TRUE, KEY_A1, (int)'7', CTL_PAD7, ALT_PAD7}, - {XK_F29, TRUE, KEY_A3, (int)'9', CTL_PAD9, ALT_PAD9}, - {XK_F31, TRUE, KEY_B2, (int)'5', CTL_PAD5, ALT_PAD5}, - {XK_F35, TRUE, KEY_C3, (int)'3', CTL_PAD3, ALT_PAD3}, -#ifdef HAVE_XK_KP_DELETE - {XK_KP_Delete, TRUE, PADSTOP, (int)'.', CTL_PADSTOP, ALT_PADSTOP}, -#endif -#ifdef HAVE_XK_KP_INSERT - {XK_KP_Insert, TRUE, PAD0, (int)'0', CTL_PAD0, ALT_PAD0}, -#endif -#ifdef HAVE_XK_KP_END - {XK_KP_End, TRUE, KEY_C1, (int)'1', CTL_PAD1, ALT_PAD1}, -#endif -#ifdef HAVE_XK_KP_DOWN - {XK_KP_Down, TRUE, KEY_C2, (int)'2', CTL_PAD2, ALT_PAD2}, -#endif -#ifdef HAVE_XK_KP_NEXT - {XK_KP_Next, TRUE, KEY_C3, (int)'3', CTL_PAD3, ALT_PAD3}, -#endif -#ifdef HAVE_XK_KP_LEFT - {XK_KP_Left, TRUE, KEY_B1, (int)'4', CTL_PAD4, ALT_PAD4}, -#endif -#ifdef HAVE_XK_KP_BEGIN - {XK_KP_Begin, TRUE, KEY_B2, (int)'5', CTL_PAD5, ALT_PAD5}, -#endif -#ifdef HAVE_XK_KP_RIGHT - {XK_KP_Right, TRUE, KEY_B3, (int)'6', CTL_PAD6, ALT_PAD6}, -#endif -#ifdef HAVE_XK_KP_HOME - {XK_KP_Home, TRUE, KEY_A1, (int)'7', CTL_PAD7, ALT_PAD7}, -#endif -#ifdef HAVE_XK_KP_UP - {XK_KP_Up, TRUE, KEY_A2, (int)'8', CTL_PAD8, ALT_PAD8}, -#endif -#ifdef HAVE_XK_KP_PRIOR - {XK_KP_Prior, TRUE, KEY_A3, (int)'9', CTL_PAD9, ALT_PAD9}, -#endif - -#ifdef INCLUDE_LATIN1 -# include "latin1kbd.h" -#endif - - {0, 0, 0, 0, 0, 0}, -}; - -#define MAX_COMPOSE_CHARS 14 -#define MAX_COMPOSE_PRE 60 -char *compose_chars = "`'~^,/\"AaPpSs!?0123CcRr-_<>Xx.=Yy |EeIiOoUu+NnLlgDd:*TtMmVv"; -/* - ` : À È Ì Ò Ù à è ì ò ù - ' : ´ Á É Í Ó Ú Ý á é í ó ú ý ´ - ~ : Ã Ñ Õ ã ñ õ - ^ : Â Ê Î Ô Û â ê î ô û - , : ¸ Ç ç ¸ - / : Ø ø µ µ - " : ¨ Ä Ë Ï Ö Ü ä ë ï ö ü ÿ ¨ - A : Æ À Á Ã Â Å Å Ã Â ª - a : æ à á ã â å â ã ª â - P : Þ ¶ ¶ - p : þ ¶ ¶ - S : § § § º ª - s : ß § ª ¹ ² ³ º § - ! : ¡ ¡ - ? : ¿ ¿ - 1 : ¹ ½ ¼ ¹ - 0 : ° ° - 2 : ² ² - 3 : ³ ¾ ³ - C : © Ç ¢ ¢ - c : ¢ © ç ¢ ¢ - R : ® - r : ® - - : ­ ± ¬ ­ ¯ ÷ - _ : ¯ ¯ - < : « - > : « - X : ¤ × - x : × ¤ × - . : · · · - = : ¥ ¥ - Y : ¥ Ý ¥ - y : ¥ ý ÿ ¥ ¥ - : - | : ¦ ¢ ¦ Þ þ ¦ - E : È É Ê Ë Ê - e : è é ê ë ê - I : Ì Í Î Ï Î - i : ì í î ï î - O : Ò Ó Ô Õ Ö Ø © ® Õ Ô Å å - o : ° Å å ¤ õ ò ó ô õ ö ø ô º - U : Ù Ú Û Ü Û - u : ù ú û ü µ û - + : ± - N : Ñ Ñ ¬ - n : ñ ñ ¬ - L : £ £ £ - l : £ £ £ - g : ¤ - D : ° Ð - d : ° ð - : : ÷ - * : µ µ - T : Þ - t : þ - M : × - m : × - V : ¦ - v : ¦ -*/ -char compose_lookups[MAX_COMPOSE_PRE][MAX_COMPOSE_CHARS] = -{ -/* ` */ {'A','E','I','O','U','a','e','i','o','u',000,000,000,000}, -/* ' */ {' ','A','E','I','O','U','Y','a','e','i','o','u','y', 39}, -/* ~ */ {'A','N','O','a','n','o',000,000,000,000,000,000,000,000}, -/* ^ */ {'A','E','I','O','U','a','e','i','o','u',000,000,000,000}, -/* , */ {' ','C','c',',',000,000,000,000,000,000,000,000,000,000}, -/* / */ {'O','o','u','U',000,000,000,000,000,000,000,000,000,000}, -/* " */ {' ','A','E','I','O','U','a','e','i','o','u','y','\"',000}, -/* A */ {'E','`', 39,'~','^','"','o','*','-','>','_',000,000,000}, -/* a */ {'e','`', 39,'~','^','"','o','-','_','>',000,000,000,000}, -/* P */ {' ','G','!',000,000,000,000,000,000,000,000,000,000,000}, -/* p */ {' ','g','!',000,000,000,000,000,000,000,000,000,000,000}, -/* S */ {'S','!','O','0','A',000,000,000,000,000,000,000,000,000}, -/* s */ {'s','!','a','1','2','3','0','o',000,000,000,000,000,000}, -/* ! */ {' ','!',000,000,000,000,000,000,000,000,000,000,000,000}, -/* ? */ {' ','?',000,000,000,000,000,000,000,000,000,000,000,000}, -/* 0 */ {'^','*',000,000,000,000,000,000,000,000,000,000,000,000}, -/* 1 */ {' ','2','4','^',000,000,000,000,000,000,000,000,000,000}, -/* 2 */ {' ','^',000,000,000,000,000,000,000,000,000,000,000,000}, -/* 3 */ {' ','4','^',000,000,000,000,000,000,000,000,000,000,000}, -/* C */ {'O',',','$','|',000,000,000,000,000,000,000,000,000,000}, -/* c */ {'|','o',',','/','$',000,000,000,000,000,000,000,000,000}, -/* R */ {'O',000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* r */ {'o',000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* - */ {' ','+',',','-','^',':',000,000,000,000,000,000,000,000}, -/* _ */ {'_','^',000,000,000,000,000,000,000,000,000,000,000,000}, -/* < */ {'<',000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* > */ {'>',000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* X */ {'O','X',000,000,000,000,000,000,000,000,000,000,000,000}, -/* x */ {' ','o','x',000,000,000,000,000,000,000,000,000,000,000}, -/* . */ {' ','^','.',000,000,000,000,000,000,000,000,000,000,000}, -/* = */ {'Y','y',000,000,000,000,000,000,000,000,000,000,000,000}, -/* Y */ {'=', 39,'-',000,000,000,000,000,000,000,000,000,000,000}, -/* y */ {'=', 39,'"','$','-',000,000,000,000,000,000,000,000,000}, -/* */ {' ',000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* | */ {' ','c','|','P','p','^',000,000,000,000,000,000,000,000}, -/* E */ {'`', 39,'^','"','>',000,000,000,000,000,000,000,000,000}, -/* e */ {'`', 39,'^','"','>',000,000,000,000,000,000,000,000,000}, -/* I */ {'`', 39,'^','"','>',000,000,000,000,000,000,000,000,000}, -/* i */ {'`', 39,'^','"','>',000,000,000,000,000,000,000,000,000}, -/* O */ {'`', 39,'^','~','"','/','C','R','-','>','A','a',000,000}, -/* o */ {' ','A','a','x','-','`', 39,'^','~','"','/','>','_',000}, -/* U */ {'`', 39,'^','"','>',000,000,000,000,000,000,000,000,000}, -/* u */ {'`', 39,'^','"',' ','>',000,000,000,000,000,000,000,000}, -/* + */ {'-',000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* N */ {'~','-','O',000,000,000,000,000,000,000,000,000,000,000}, -/* n */ {'~','-','o',000,000,000,000,000,000,000,000,000,000,000}, -/* L */ {'$','=','-',000,000,000,000,000,000,000,000,000,000,000}, -/* l */ {'$','=','-',000,000,000,000,000,000,000,000,000,000,000}, -/* g */ {'$',000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* D */ {'E','-',000,000,000,000,000,000,000,000,000,000,000,000}, -/* d */ {'e','-',000,000,000,000,000,000,000,000,000,000,000,000}, -/* : */ {'-',000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* * */ {'m','M',000,000,000,000,000,000,000,000,000,000,000,000}, -/* T */ {'H',000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* t */ {'h',000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* M */ {'U',000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* m */ {'u',000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* V */ {'B',000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* v */ {'b',000,000,000,000,000,000,000,000,000,000,000,000,000}, -}; - -int compose_keys[MAX_COMPOSE_PRE][MAX_COMPOSE_CHARS] = -{ -/* ` */ {192,200,204,210,217,224,232,236,242,249,000,000,000,000}, -/* ' */ {180,193,201,205,211,218,221,225,233,237,243,250,253,180}, -/* ~ */ {195,209,213,227,241,245,000,000,000,000,000,000,000,000}, -/* ^ */ {194,202,206,212,219,226,234,238,244,251,000,000,000,000}, -/* , */ {184,199,231,184,000,000,000,000,000,000,000,000,000,000}, -/* / */ {216,248,181,181,000,000,000,000,000,000,000,000,000,000}, -/* " */ {168,196,203,207,214,220,228,235,239,246,252,255,168,000}, -/* A */ {198,192,193,195,194,196,197,197,195,194,170,000,000,000}, -/* a */ {230,224,225,227,226,228,229,227,170,226,000,000,000,000}, -/* P */ {222,182,182,000,000,000,000,000,000,000,000,000,000,000}, -/* p */ {254,182,182,000,000,000,000,000,000,000,000,000,000,000}, -/* S */ {167,167,167,186,170,000,000,000,000,000,000,000,000,000}, -/* s */ {223,167,170,185,178,179,186,167,000,000,000,000,000,000}, -/* ! */ {161,161,000,000,000,000,000,000,000,000,000,000,000,000}, -/* ? */ {191,191,000,000,000,000,000,000,000,000,000,000,000,000}, -/* 0 */ {176,176,000,000,000,000,000,000,000,000,000,000,000,000}, -/* 1 */ {185,189,188,185,000,000,000,000,000,000,000,000,000,000}, -/* 2 */ {178,178,000,000,000,000,000,000,000,000,000,000,000,000}, -/* 3 */ {179,190,179,000,000,000,000,000,000,000,000,000,000,000}, -/* C */ {169,199,162,162,000,000,000,000,000,000,000,000,000,000}, -/* c */ {162,169,231,162,162,000,000,000,000,000,000,000,000,000}, -/* R */ {174,000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* r */ {174,000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* - */ {173,177,172,173,175,247,000,000,000,000,000,000,000,000}, -/* _ */ {175,175,000,000,000,000,000,000,000,000,000,000,000,000}, -/* < */ {171,000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* > */ {187,000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* X */ {164,215,000,000,000,000,000,000,000,000,000,000,000,000}, -/* x */ {215,164,215,000,000,000,000,000,000,000,000,000,000,000}, -/* . */ {183,183,183,000,000,000,000,000,000,000,000,000,000,000}, -/* = */ {165,165,000,000,000,000,000,000,000,000,000,000,000,000}, -/* Y */ {165,221,165,000,000,000,000,000,000,000,000,000,000,000}, -/* y */ {165,253,255,165,165,000,000,000,000,000,000,000,000,000}, -/* */ {160,000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* | */ {166,162,166,222,254,166,000,000,000,000,000,000,000,000}, -/* E */ {200,201,202,203,202,000,000,000,000,000,000,000,000,000}, -/* e */ {232,233,234,235,234,000,000,000,000,000,000,000,000,000}, -/* I */ {204,205,206,207,206,000,000,000,000,000,000,000,000,000}, -/* i */ {236,237,238,239,238,000,000,000,000,000,000,000,000,000}, -/* O */ {210,211,212,213,214,216,169,174,213,212,197,229,000,000}, -/* o */ {176,197,229,164,245,242,243,244,245,246,248,244,186,000}, -/* U */ {217,218,219,220,219,000,000,000,000,000,000,000,000,000}, -/* u */ {249,250,251,252,181,251,000,000,000,000,000,000,000,000}, -/* + */ {177,000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* N */ {209,209,172,000,000,000,000,000,000,000,000,000,000,000}, -/* n */ {241,241,172,000,000,000,000,000,000,000,000,000,000,000}, -/* L */ {163,163,163,000,000,000,000,000,000,000,000,000,000,000}, -/* l */ {163,163,163,000,000,000,000,000,000,000,000,000,000,000}, -/* g */ {164,000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* D */ {176,208,000,000,000,000,000,000,000,000,000,000,000,000}, -/* d */ {176,240,000,000,000,000,000,000,000,000,000,000,000,000}, -/* : */ {247,000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* * */ {181,181,000,000,000,000,000,000,000,000,000,000,000,000}, -/* T */ {222,000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* t */ {254,000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* M */ {215,000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* u */ {215,000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* V */ {166,000,000,000,000,000,000,000,000,000,000,000,000,000}, -/* v */ {166,000,000,000,000,000,000,000,000,000,000,000,000,000}, -}; - - - -#define BITMAPDEPTH 1 - -/* - * X11 Variables common to both process and thread ports - */ -MOUSE_STATUS Trapped_Mouse_status; -unsigned long pdc_key_modifier=0L; -GC normal_gc,block_cursor_gc,rect_cursor_gc,normal_highlight_gc,bold_highlight_gc,border_gc; -int XCursesFontHeight,XCursesFontWidth; -int XCursesFontAscent,XCursesFontDescent; -int XCursesWindowWidth,XCursesWindowHeight; -int resizeXCursesWindowWidth=0,resizeXCursesWindowHeight=0; -char *bitmap_file=NULL; -KeySym compose_key=0; -int compose_mask=0; -int state_mask[8] = -{ - ShiftMask, - LockMask, - ControlMask, - Mod1Mask, - Mod2Mask, - Mod3Mask, - Mod4Mask, - Mod5Mask -}; -Atom wm_atom[2]; -char *XCursesClassName="XCurses"; -XtAppContext app_context; -Widget topLevel,drawing,d1,scrollBox,scrollVert,scrollHoriz; -int ReceivedMapNotify=0; -Boolean mouse_selection=False; -char *tmpsel=NULL; -unsigned long tmpsel_length=0; -int selection_start_x=0; -int selection_start_y=0; -int selection_end_x=0; -int selection_end_y=0; -Pixmap icon_pixmap; -XtResource app_resources[PDC_NUMBER_APP_RESOURCES] = -{ - { - XtNlines, - XtCLines, - XtRInt, - sizeof(int), - XtOffsetOf(AppData,lines), - XtRImmediate, - (XtPointer)24, - }, - { - XtNcols, - XtCCols, - XtRInt, - sizeof(int), - XtOffsetOf(AppData,cols), - XtRImmediate, - (XtPointer)80, - }, - { - XtNcursorColor, - XtCCursorColor, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,cursorColor), - XtRString, - (XtPointer)"Red", - }, - { - XtNcolorBlack, - XtCColorBlack, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,colorBlack), - XtRString, - (XtPointer)"Black", - }, - { - XtNcolorRed, - XtCColorRed, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,colorRed), - XtRString, - (XtPointer)"red3", - }, - { - XtNcolorGreen, - XtCColorGreen, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,colorGreen), - XtRString, - (XtPointer)"green3", - }, - { - XtNcolorYellow, - XtCColorYellow, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,colorYellow), - XtRString, - (XtPointer)"yellow3", - }, - { - XtNcolorBlue, - XtCColorBlue, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,colorBlue), - XtRString, - (XtPointer)"blue3", - }, - { - XtNcolorMagenta, - XtCColorMagenta, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,colorMagenta), - XtRString, - (XtPointer)"magenta3", - }, - { - XtNcolorCyan, - XtCColorCyan, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,colorCyan), - XtRString, - (XtPointer)"cyan3", - }, - { - XtNcolorWhite, - XtCColorWhite, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,colorWhite), - XtRString, - (XtPointer)"Grey", - }, - { - XtNcolorBoldBlack, - XtCColorBoldBlack, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,colorBoldBlack), - XtRString, - (XtPointer)"grey40", - }, - { - XtNcolorBoldRed, - XtCColorBoldRed, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,colorBoldRed), - XtRString, - (XtPointer)"red1", - }, - { - XtNcolorBoldGreen, - XtCColorBoldGreen, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,colorBoldGreen), - XtRString, - (XtPointer)"green1", - }, - { - XtNcolorBoldYellow, - XtCColorBoldYellow, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,colorBoldYellow), - XtRString, - (XtPointer)"yellow1", - }, - { - XtNcolorBoldBlue, - XtCColorBoldBlue, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,colorBoldBlue), - XtRString, - (XtPointer)"blue1", - }, - { - XtNcolorBoldMagenta, - XtCColorBoldMagenta, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,colorBoldMagenta), - XtRString, - (XtPointer)"magenta1", - }, - { - XtNcolorBoldCyan, - XtCColorBoldCyan, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,colorBoldCyan), - XtRString, - (XtPointer)"cyan1", - }, - { - XtNcolorBoldWhite, - XtCColorBoldWhite, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,colorBoldWhite), - XtRString, - (XtPointer)"White", - }, - { - XtNnormalFont, - XtCNormalFont, - XtRFontStruct, - sizeof(XFontStruct), - XtOffsetOf(AppData,normalfont), - XtRString, - (XtPointer)"7x13", - }, -/* - * boldFont used for backwards compatibility, but now ignored - */ - { - XtNboldFont, - XtCBoldFont, - XtRFontStruct, - sizeof(XFontStruct), - XtOffsetOf(AppData,boldfont), - XtRString, - (XtPointer)"7x13bold", - }, - { - XtNbitmap, - XtCBitmap, - XtRString, - MAX_PATH, - XtOffsetOf(AppData,bitmapFile), - XtRString, - (XtPointer)"", - }, - { - XtNcomposeKey, - XtCComposeKey, - XtRString, - MAX_PATH, - XtOffsetOf(AppData,composeKey), - XtRString, - (XtPointer)"", - }, - { - XtNpointer, - XtCPointer, - XtRCursor, - sizeof(Cursor), - XtOffsetOf(AppData,pointer), - XtRString, - (XtPointer)"xterm", - }, - { - XtNpointerForeColor, - XtCPointerForeColor, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,pointerForeColor), - XtRString, - (XtPointer)"Black", - }, - { - XtNpointerBackColor, - XtCPointerBackColor, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,pointerBackColor), - XtRString, - (XtPointer)"White", - }, - { - XtNshmmin, - XtCShmmin, - XtRInt, - sizeof(int), - XtOffsetOf(AppData,shmmin), - XtRImmediate, - (XtPointer)0, - }, - { - XtNborderWidth, - XtCBorderWidth, - XtRInt, - sizeof(int), - XtOffsetOf(AppData,borderWidth), - XtRImmediate, - (XtPointer)0, - }, - { - XtNborderColor, - XtCBorderColor, - XtRPixel, - sizeof(Pixel), - XtOffsetOf(AppData,borderColor), - XtRString, - (XtPointer)"Black", - }, - { - XtNdoubleClickPeriod, - XtCDoubleClickPeriod, - XtRInt, - sizeof(int), - XtOffsetOf(AppData,doubleClickPeriod), - XtRImmediate, - (XtPointer)200, - }, - { - XtNclickPeriod, - XtCClickPeriod, - XtRInt, - sizeof(int), - XtOffsetOf(AppData,clickPeriod), - XtRImmediate, - (XtPointer)100, - }, - { - XtNscrollbarWidth, - XtCScrollbarWidth, - XtRInt, - sizeof(int), - XtOffsetOf(AppData,scrollbarWidth), - XtRImmediate, - (XtPointer)0, - }, -#if 0 - { - XtNgeometry, - XtCGeometry, - XtRGeometry, - sizeof(XtWidgetGeometry), - XtOffsetOf(AppData,geometry), - XtRString, - (XtPointer)"80x25", - }, -#endif -}; -XrmOptionDescRec options[PDC_NUMBER_OPTIONS] = -{ - {"-lines", "*lines", XrmoptionSepArg, NULL }, - {"-cols", "*cols", XrmoptionSepArg, NULL }, - {"-normalFont", "*normalFont", XrmoptionSepArg, NULL }, - {"-bitmap", "*bitmap", XrmoptionSepArg, NULL }, - {"-pointer", "*pointer", XrmoptionSepArg, NULL }, - {"-shmmin", "*shmmin", XrmoptionSepArg, NULL }, - {"-composeKey", "*composeKey", XrmoptionSepArg, NULL }, - {"-clickPeriod", "*clickPeriod", XrmoptionSepArg, NULL }, - {"-doubleClickPeriod", "*doubleClickPeriod", XrmoptionSepArg, NULL }, - {"-scrollbarWidth", "*scrollbarWidth", XrmoptionSepArg, NULL }, - {"-pointerForeColor", "*pointerForeColor", XrmoptionSepArg, NULL }, - {"-pointerBackColor", "*pointerBackColor", XrmoptionSepArg, NULL }, - {"-cursorColor", "*cursorColor", XrmoptionSepArg, NULL }, - {"-colorBlack", "*colorBlack", XrmoptionSepArg, NULL }, - {"-colorRed", "*colorRed", XrmoptionSepArg, NULL }, - {"-colorGreen", "*colorGreen", XrmoptionSepArg, NULL }, - {"-colorYellow", "*colorYellow", XrmoptionSepArg, NULL }, - {"-colorBlue", "*colorBlue", XrmoptionSepArg, NULL }, - {"-colorMagenta", "*colorMagenta", XrmoptionSepArg, NULL }, - {"-colorCyan", "*colorCyan", XrmoptionSepArg, NULL }, - {"-colorWhite", "*colorWhite", XrmoptionSepArg, NULL }, - {"-colorBoldBlack", "*colorBoldBlack", XrmoptionSepArg, NULL }, - {"-colorBoldRed", "*colorBoldRed", XrmoptionSepArg, NULL }, - {"-colorBoldGreen", "*colorBoldGreen", XrmoptionSepArg, NULL }, - {"-colorBoldYellow", "*colorBoldYellow", XrmoptionSepArg, NULL }, - {"-colorBoldBlue", "*colorBoldBlue", XrmoptionSepArg, NULL }, - {"-colorBoldMagenta", "*colorBoldMagenta", XrmoptionSepArg, NULL }, - {"-colorBoldCyan", "*colorBoldCyan", XrmoptionSepArg, NULL }, - {"-colorBoldWhite", "*colorBoldWhite", XrmoptionSepArg, NULL }, -}; -XtActionsRec XCursesActions[PDC_NUMBER_XCURSES_ACTIONS] = -{ - {"XCursesButton", (XtActionProc)XCursesButton}, - {"XCursesKeyPress", (XtActionProc)XCursesKeyPress}, - {"XCursesModifierPress", (XtActionProc)XCursesModifierPress}, - {"XCursesPasteSelection", (XtActionProc)XCursesPasteSelection}, - {"string", (XtActionProc)XCursesHandleString}, -}; -char global_display_name[100]; /* large enough for DISPLAY=machine */ -Bool after_first_curses_request = False; -int colors[(2*MAX_COLORS)+2]; -/* - * End X11 Variables common to both process and thread ports - */ - - - -#if NOT_USED -#define SHM_CURSVAR 0 -#define SHM_CURSCR 1 -#define SHM_CURSCR_Y 2 -#define SHM_CURSCR_YY 3 -#define SHM_CURSCR_FIRSTCH 4 -#define SHM_CURSCR_LASTCH 5 -SCREEN *XSP; -#endif - - -/* - * Used by base curses calls - */ -MOUSE_STATUS Mouse_status; - - - - -#ifdef FOREIGN - XIM Xim; - XIC Xic; - long im_event_mask; - XIMStyles *im_supported_styles=NULL; - XIMStyle my_style=0; -#endif - - - -#if 0 - "Shift_L,: XCursesKeyPress() \n" \ - "Shift_R,: XCursesKeyPress() \n" \ - "Control_L,: XCursesKeyPress() \n" \ - "Control_R,: XCursesKeyPress() \n" \ - "Alt_L,: XCursesKeyPress() \n" \ - "Alt_R,: XCursesKeyPress() \n" \ - "Shift_L: XCursesModifierPress() \n" \ - "Shift_R: XCursesModifierPress() \n" \ - "Control_L: XCursesModifierPress() \n" \ - "Control_R: XCursesModifierPress() \n" \ - "Alt_L: XCursesModifierPress() \n" \ - "Alt_R: XCursesModifierPress() \n" -#endif - -XtTranslations XCursesTranslations; -char *defaultTranslations = -{ - ": XCursesKeyPress() \n" \ - ": XCursesButton() \n" \ - "!Ctrl : XCursesButton() \n" \ - "!Shift : XCursesButton() \n" \ - "!Ctrl : XCursesButton() \n" \ - "!Shift : XCursesButton() \n" \ - ",: XCursesPasteSelection() \n" \ - ": XCursesButton() \n" \ - ": XCursesButton() \n" \ - ": XCursesButton() \n" \ - ": XCursesButton()" -}; - - -static int opposite[8]={7,6,5,4,3,2,1,0}; - -#ifdef USE_THREADS -pthread_mutex_t key_queue_mutex = PTHREAD_MUTEX_INITIALIZER; -#endif - -int xerror(); - -#ifdef HAVE_PROTO -void say(char *msg) -#else -void say(msg) -char *msg; -#endif -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:%s",(XCursesProcess)?" X":"CURSES",msg); -#endif -} - -#ifdef HAVE_PROTO -void dummy_function( void ) -#else -void dummy_function() -#endif -{ - return; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -signal_handler XCursesSetSignal(int signo,signal_handler action) -#else -signal_handler XCursesSetSignal(signo,action) -int signo; -signal_handler action; -#endif -/***********************************************************************/ -{ -#if defined(SA_INTERRUPT) || defined(SA_RESTART) - struct sigaction sigact,osigact; - - sigact.sa_handler = action; -# ifdef SA_INTERRUPT -# ifdef SA_RESTART - sigact.sa_flags = SA_INTERRUPT | SA_RESTART; -# else - sigact.sa_flags = SA_INTERRUPT; -# endif -# else /* must be SA_RESTART */ - sigact.sa_flags = SA_RESTART; -# endif - sigemptyset(&sigact.sa_mask); - if (sigaction(signo,&sigact,&osigact) != 0) - return(SIG_ERR); - return(osigact.sa_handler); -#else /* not SA_INTERRUPT or SA_RESTART, use plain signal */ - return(signal(signo,action)); -#endif -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -RETSIGTYPE XCursesSigwinchHandler(int signo) -#else -RETSIGTYPE XCursesSigwinchHandler(signo) -int signo; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesSigwinchHandler() - called: SIGNO: %d\n",(XCursesProcess)?" X":"CURSES",signo); -#endif -#ifdef BEFORE_CHANGE_BY_G_FUCHS - /* - * Patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999 - */ - SP->resized=TRUE; -#else - SP->resized += 1; -#endif -/*---------------------------------------------------------------------*/ -/* Always trap SIGWINCH if the C library supports SIGWINCH... */ -/*---------------------------------------------------------------------*/ -#ifdef SIGWINCH - XCursesSetSignal(SIGWINCH, XCursesSigwinchHandler ); -#endif -} -/***********************************************************************/ -/* NOT USED */ -#ifdef HAVE_PROTO -int XCurses_redraw_curscr(void) -#else -int XCurses_redraw_curscr() -#endif -/***********************************************************************/ -{ - int i; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_redraw_curscr() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - for (i=0;i_maxy;i++) - XCurses_transform_line(curscr->_y[i],i,0,curscr->_maxx); - return(OK); -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCursesDisplayText(chtype *ch, int row, int x, int num_cols, bool highlight) -#else -int XCursesDisplayText(ch, row, x, num_cols, highlight) -chtype *ch; -int row,x,num_cols; -bool highlight; -#endif -/***********************************************************************/ -{ - char text[300]; - bool new_packet=FALSE; - short fore,back; - int original_x,pair_num,i,j,k,asc=XCursesFontAscent,desc=XCursesFontDescent; /* 11 and 1 */ - chtype old_attr,save_ch,attr; - int xpos,ypos; - int offset=0; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesDisplayText() - called: Row: %d X: %d NumCols: %d\n",(XCursesProcess)?" X":"CURSES", row,x,num_cols); -#endif - if (num_cols == 0) - return(OK); - -#if 0 - fprintf(stderr,"%2.2d ",x); - for (idx=0;idx %8.8x ",attr,old_attr); - } - fprintf(stderr,"\n"); -#endif - - old_attr = *ch & A_ATTRIBUTES; - save_ch = *ch; - original_x = x; - for (i=0,j=0; jline_color)+offset]); - XDrawLine(XCURSESDISPLAY,XCURSESWIN,normal_gc,xpos+(XCursesFontWidth*(k))-1,ypos-asc,xpos+(XCursesFontWidth*(k))-1,ypos+desc); - } - if ( old_attr & A_RIGHTLINE ) /* RIGHT */ - { - XSetForeground(XCURSESDISPLAY, normal_gc, colors[(SP->line_color)+offset]); - XDrawLine(XCURSESDISPLAY,XCURSESWIN,normal_gc,xpos+(XCursesFontWidth*(k+1))-1,ypos-asc,xpos+(XCursesFontWidth*(k+1))-1,ypos+desc); - } - } - if ( old_attr & A_OVERLINE ) /* ABOVE */ - { - XSetForeground(XCURSESDISPLAY, normal_gc, colors[(SP->line_color)+offset]); - XDrawLine(XCURSESDISPLAY,XCURSESWIN,normal_gc,xpos,ypos-asc,xpos+(XCursesFontWidth*i),ypos-asc); - } - - if (old_attr & A_UNDERLINE) /* UNDER */ - { - XSetForeground(XCURSESDISPLAY, normal_gc, colors[(SP->line_color)+offset]); - XDrawLine(XCURSESDISPLAY,XCURSESWIN,normal_gc,xpos,ypos+1,xpos+(XCursesFontWidth*i),ypos+1); - } - -#ifdef PDCDEBUG - if (trace_on) - PDC_debug("%s:XCursesDisplayText() - row: %d col: %d num_cols: %d fore: %d back: %d text:<%s>\n",(XCursesProcess)?" X":"CURSES",row,original_x,i,fore,back,text); -#endif - - new_packet = FALSE; - old_attr = attr; - original_x = x; - i = 0; - } - text[i++] = *(ch+j) & A_CHARTEXT; - save_ch = *(ch+j); - } - - if ((pair_num = PAIR_NUMBER(save_ch)) != 0) - { - if (pair_content(pair_num,&fore,&back) == ERR) - return(ERR); - } - else - { - fore = COLOR_WHITE; - back = COLOR_BLACK; - } - text[i] = '\0'; - if (old_attr & A_BOLD) - offset = 8; - else - offset = 0; - - if (highlight) - { - if (old_attr & A_REVERSE) - { - XSetBackground(XCURSESDISPLAY, normal_gc, colors[COLOR_BLACK]); - XSetForeground(XCURSESDISPLAY, normal_gc, colors[COLOR_WHITE+offset]); - } - else - { - XSetBackground(XCURSESDISPLAY, normal_gc, colors[fore]); - XSetForeground(XCURSESDISPLAY, normal_gc, colors[back+offset]); - } - } - else - { - if (old_attr & A_REVERSE) - { - XSetForeground(XCURSESDISPLAY, normal_gc, colors[COLOR_BLACK+offset]); - XSetBackground(XCURSESDISPLAY, normal_gc, colors[COLOR_WHITE]); - } - else - { - XSetForeground(XCURSESDISPLAY, normal_gc, colors[fore+offset]); - XSetBackground(XCURSESDISPLAY, normal_gc, colors[back]); - } - } - - makeXY(original_x,row,XCursesFontWidth,XCursesFontHeight,&xpos,&ypos); - XDrawImageString(XCURSESDISPLAY,XCURSESWIN,normal_gc,xpos,ypos,text,i); - - for (k=0;kline_color)+offset]); - XDrawLine(XCURSESDISPLAY,XCURSESWIN,normal_gc,xpos+(XCursesFontWidth*(k))-1,ypos-asc,xpos+(XCursesFontWidth*(k))-1,ypos+desc); - } - if ( old_attr & A_RIGHTLINE ) /* RIGHT */ - { - XSetForeground(XCURSESDISPLAY, normal_gc, colors[(SP->line_color)+offset]); - XDrawLine(XCURSESDISPLAY,XCURSESWIN,normal_gc,xpos+(XCursesFontWidth*(k+1))-1,ypos-asc,xpos+(XCursesFontWidth*(k+1))-1,ypos+desc); - } - } - if ( old_attr & A_OVERLINE ) /* ABOVE */ - { - XSetForeground(XCURSESDISPLAY, normal_gc, colors[(SP->line_color)+offset]); - XDrawLine(XCURSESDISPLAY,XCURSESWIN,normal_gc,xpos,ypos-asc,xpos+(XCursesFontWidth*i),ypos-asc); - } - if (old_attr & A_UNDERLINE) /* UNDER */ - { - XSetForeground(XCURSESDISPLAY, normal_gc, colors[(SP->line_color)+offset]); - XDrawLine(XCURSESDISPLAY,XCURSESWIN,normal_gc,xpos,ypos+1,xpos+(XCursesFontWidth*i),ypos+1); - } - -#ifdef PDCDEBUG - if (trace_on) - PDC_debug("%s:XCursesDisplayText() (end) row: %d col: %d num_cols: %d fore: %d back: %d text:<%s>\n",(XCursesProcess)?" X":"CURSES",row,original_x,i,fore,back,text); -#endif - - return(OK); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void get_GC(Display *display, Window win, GC *gc, XFontStruct *font_info, int fore, int back,bool highlight) -#else -void get_GC(display,win, gc, font_info,fore,back,highlight) -Display *display; -Window win; -GC *gc; -XFontStruct *font_info; -int fore,back; -bool highlight; -#endif -/***********************************************************************/ -{ - XGCValues values; - - /* Create default Graphics Context */ - *gc = XCreateGC(display,win, 0L, &values); - - /* specify font */ - XSetFont(display, *gc, font_info->fid); - - /* specify black foreground since default may be white on white */ - XSetForeground(display, *gc, colors[fore]); - XSetBackground(display, *gc, colors[back]); - if (highlight) - XSetFunction(display, *gc, GXxor); - return; -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void makeXY(int x,int y,int fontwidth,int fontheight,int *xpos,int *ypos) -#else -void makeXY(x,y,fontwidth,fontheight,xpos,ypos) -int x,y,fontwidth,fontheight,*xpos,*ypos; -#endif -/***********************************************************************/ -{ - *xpos = (x * fontwidth)+XCURSESBORDERWIDTH; - *ypos = XCURSESNORMALFONTINFO->ascent + (y * fontheight) + XCURSESBORDERWIDTH; - return; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -int get_colors(void) -#else -int get_colors() -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - say("in get_colors\n"); -#endif - - colors[0] = app_data.colorBlack; - colors[1] = app_data.colorRed; - colors[2] =app_data.colorGreen; - colors[3] = app_data.colorYellow; - colors[4] = app_data.colorBlue; - colors[5] = app_data.colorMagenta; - colors[6] = app_data.colorCyan; - colors[7] = app_data.colorWhite; - colors[8] = app_data.colorBoldBlack; - colors[9] = app_data.colorBoldRed; - colors[10] = app_data.colorBoldGreen; - colors[11] = app_data.colorBoldYellow; - colors[12] = app_data.colorBoldBlue; - colors[13] = app_data.colorBoldMagenta; - colors[14] = app_data.colorBoldCyan; - colors[15] = app_data.colorBoldWhite; - colors[COLOR_CURSOR] = XCURSESCURSORCOLOR; - colors[COLOR_BORDER] = XCURSESBORDERCOLOR; -#ifdef PDCDEBUG - say("out of get_colors\n"); -#endif - return(OK); -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCursesEndwin(void) -#else -int XCursesEndwin() -#endif -/***********************************************************************/ -{ - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesEndwin() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - if (bitmap_file != NULL) - { - XFreePixmap(XCURSESDISPLAY,icon_pixmap); - free(bitmap_file); - } - XFreeGC(XCURSESDISPLAY, normal_gc); - XFreeGC(XCURSESDISPLAY, normal_highlight_gc); - XFreeGC(XCURSESDISPLAY, bold_highlight_gc); - XFreeGC(XCURSESDISPLAY, block_cursor_gc); - XFreeGC(XCURSESDISPLAY, rect_cursor_gc); - XFreeGC(XCURSESDISPLAY, border_gc); -#ifdef FOREIGN - XDestroyIC(Xic); -#endif -#if 0 - XCloseDisplay(XCURSESDISPLAY); -#endif - return(0); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCursesRefreshScrollbar(void) -#else -int XCursesRefreshScrollbar() -#endif -/***********************************************************************/ -{ - float total_y=(float)(SP->sb_total_y); - float viewport_y=(float)(SP->sb_viewport_y); - float cur_y=(float)(SP->sb_cur_y); - float total_x=(float)(SP->sb_total_x*XCursesFontWidth); - float viewport_x=(float)(SP->sb_viewport_x*XCursesFontWidth); - float cur_x=(float)(SP->sb_cur_x*XCursesFontWidth); -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesRefreshScrollbar() - called: \n",(XCursesProcess)?" X":"CURSES"); -#endif - if (!SP->sb_on) - return(ERR); -#if 0 -fprintf(stderr,"%s:XCursesRefreshScrollbar() - vert: %f %f %f %f %f\n",(XCursesProcess)?" X":"CURSES", - total_y,viewport_y,cur_y, - cur_y/total_y,viewport_y/total_y); -fprintf(stderr,"%s:XCursesRefreshScrollbar() - horz: %f %f %f %f %f\n",(XCursesProcess)?" X":"CURSES", - total_x,viewport_x,cur_x, - cur_x/total_x,viewport_x/total_x); -#endif - if (SP->sb_total_y != 0) - XawScrollbarSetThumb(scrollVert,(float)(cur_y/total_y), - (float)(viewport_y/total_y)); - if (SP->sb_total_x != 0) - XawScrollbarSetThumb(scrollHoriz,(float)(cur_x/total_x), - (float)(viewport_x/total_x)); - return(OK); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void SetCursorColor(chtype *ch,short *fore, short *back) -#else -void SetCursorColor(ch,fore,back) -chtype *ch; -short *fore; -short *back; -#endif -/***********************************************************************/ -{ - chtype attr=0; - short f=0,b=0; - - attr = (chtype)((*ch & A_COLOR)>>24); - if (attr) - { - pair_content(attr,&f,&b); - *fore = opposite[f]; - *back = opposite[b]; - } - else - { - if (*ch & A_REVERSE) - { - *back = COLOR_BLACK; - *fore = COLOR_WHITE; - } - else - { - *back = COLOR_WHITE; - *fore = COLOR_BLACK; - } - } - return; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesGetIcon(void) -#else -void XCursesGetIcon() -#endif -/***********************************************************************/ -{ - XIconSize *icon_size; - int size_count=0; - Status rc=0; - unsigned char *bitmap_bits=NULL; - unsigned int icon_bitmap_width=0,icon_bitmap_height=0; - unsigned int file_bitmap_width=0,file_bitmap_height=0; - int max_height=0,max_width=0; - int x_hot=0,y_hot=0; - int i; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesGetIcon\n",(XCursesProcess)?" X":"CURSES"); -#endif - icon_size = XAllocIconSize(); - rc = XGetIconSizes(XtDisplay(topLevel), - RootWindowOfScreen(XtScreen(topLevel)), - &icon_size, - &size_count); - if (rc /* if the WM can advise on icon sizes... */ - && size_count) - { -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:size_count: %d rc: %d\n",(XCursesProcess)?" X":"CURSES",size_count,rc); -#endif - for (i=0;i max_width) - max_width = icon_size[i].max_width; - if (icon_size[i].max_height > max_height) - max_height = icon_size[i].max_height; -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:min: %d %d\n",(XCursesProcess)?" X":"CURSES",icon_size[i].min_width,icon_size[i].min_height); - if (trace_on) PDC_debug("%s:max: %d %d\n",(XCursesProcess)?" X":"CURSES",icon_size[i].max_width,icon_size[i].max_height); - if (trace_on) PDC_debug("%s:inc: %d %d\n",(XCursesProcess)?" X":"CURSES",icon_size[i].width_inc,icon_size[i].height_inc); -#endif - } - if (max_width >= BIG_ICON_WIDTH - && max_height >= BIG_ICON_HEIGHT) - { - icon_bitmap_width = BIG_ICON_WIDTH; - icon_bitmap_height = BIG_ICON_HEIGHT; - bitmap_bits = (unsigned char *)big_icon_bitmap_bits; - } - else - { - icon_bitmap_width = LITTLE_ICON_WIDTH; - icon_bitmap_height = LITTLE_ICON_HEIGHT; - bitmap_bits = (unsigned char *)little_icon_bitmap_bits; - } - } - else /* WM won't tell us what icon size to use, so use small icon :-( */ - { - icon_bitmap_width = LITTLE_ICON_WIDTH; - icon_bitmap_height = LITTLE_ICON_HEIGHT; - bitmap_bits = (unsigned char *)little_icon_bitmap_bits; - } - XFree((char *)icon_size); - - if (strcmp(XCURSESBITMAPFILE,"") != 0) /* supplied bitmap */ - { - rc = XReadBitmapFile(XtDisplay(topLevel), - RootWindowOfScreen(XtScreen(topLevel)), - (char *)XCURSESBITMAPFILE, - &file_bitmap_width, - &file_bitmap_height, - &icon_pixmap, - &x_hot, - &y_hot); - switch(rc) - { - case BitmapOpenFailed: - fprintf(stderr,"bitmap file %s: not found\n",XCURSESBITMAPFILE); - break; - case BitmapFileInvalid: - fprintf(stderr,"bitmap file %s: contents invalid\n",XCURSESBITMAPFILE); - break; - default: - return; - break; - } - } - icon_pixmap = XCreateBitmapFromData(XtDisplay(topLevel), - RootWindowOfScreen(XtScreen(topLevel)), - (char *)bitmap_bits, - icon_bitmap_width, - icon_bitmap_height); - return; -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesExpose(Widget w,XtPointer client_data,XEvent *event,Boolean *continue_to_dispatch) -#else -void XCursesExpose(w,client_data,event,continue_to_dispatch) -Widget w; -XtPointer client_data; -XEvent *event; -Boolean *continue_to_dispatch; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesExpose called\n",(XCursesProcess)?" X":"CURSES"); -#endif - -#if 0 -/* get all other Expose events on the queue */ - while (XCheckTypedEvent(display, Expose, &event)) -#endif - if (event->xexpose.count != 0) /* ignore all Exposes except last */ - return; - -#if 0 - XCursesDisplayScreen(FALSE); -/* - * Can we here determine largest rectangle to refresh based on all outstanding - * expose events? - */ -/* - * should refresh that portion of the screen now exposed - in XCursesProcess - * using event.x, event.y, event.width, event.height to determine row/col - * to refresh. Call XCursesDisplayText() to do the refresh. - */ - if (after_first_curses_request - && after_first_expose_event) - { - XCursesRefreshScreen(); - XCursesDisplayCursor(SP->cursrow,SP->curscol, - SP->cursrow,SP->curscol); - } - after_first_expose_event = True; -#else - if (after_first_curses_request - && ReceivedMapNotify) - XCursesDisplayScreen(FALSE); -#endif - return; -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesNonmaskable(Widget w,XtPointer client_data,XEvent *event,Boolean *continue_to_dispatch) -#else -void XCursesNonmaskable(w,client_data,event,continue_to_dispatch) -Widget w; -XtPointer client_data; -XEvent *event; -Boolean *continue_to_dispatch; -#endif -/***********************************************************************/ -{ - XClientMessageEvent *client_event=(XClientMessageEvent *)event; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesNonmaskable called: otherpid %d\n",(XCursesProcess)?" X":"CURSES",otherpid); -#endif - switch(event->type) - { - case ClientMessage: -#ifdef PDCDEBUG - say("ClientMessage received\n"); -#endif - if ((Atom)client_event->data.s[0] == wm_atom[0] - || (Atom)client_event->data.s[0] == wm_atom[1]) - XCursesExitXCursesProcess(0,SIGKILL,""); - break; - default: -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesNonmaskable - unknown event %d\n",(XCursesProcess)?" X":"CURSES",event->type); -#endif - break; - } - return; -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesModifierPress(Widget w,XEvent *event, String *params, Cardinal *nparams) -#else -void XCursesModifierPress(w,event,params,nparams) -Widget w; -XEvent *event; -String *params; -Cardinal *nparams; -#endif -/***********************************************************************/ -{ -#define STATE_NORMAL 0 -#define STATE_COMPOSE 1 -#define STATE_CHAR 2 -#ifdef FOREIGN - wchar_t buffer[120]; -#else - char buffer[120]; -#endif - int buflen=40; - int count,key; - KeySym keysym; - XComposeStatus compose; -#ifdef FOREIGN - Status status; -#endif - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesModifierPress called\n",(XCursesProcess)?" X":"CURSES"); -#endif - buffer[0] = '\0'; - count = XLookupString(&(event->xkey),buffer,buflen,&keysym, &compose); - /* - * Handle modifier keys first. - */ - - SP->return_key_modifiers = True; - -#ifdef PDCDEBUG - printf("%d: %ld %s %d %d %d\n",__LINE__,keysym, - (event->type == KeyPress) ? "Press" : "Release", - (keysym != compose_key), - (IsModifierKey(keysym)), - (SP->return_key_modifiers)); -#endif - - if (SP->return_key_modifiers) - { - key = 0; - if (keysym == XK_Shift_L) { key = KEY_SHIFT_L; } - else if (keysym == XK_Shift_R) { key = KEY_SHIFT_R; } - else if (keysym == XK_Control_L) { key = KEY_CONTROL_L; } - else if (keysym == XK_Control_R) { key = KEY_CONTROL_R; } - else if (keysym == XK_Alt_L) { key = KEY_ALT_L; } - else if (keysym == XK_Alt_R) { key = KEY_ALT_R; } - if (key) - XCursesSendKeyToCurses( (unsigned long)key, NULL ); - return; - } - return; -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesKeyPress(Widget w,XEvent *event, String *params, Cardinal *nparams) -#else -void XCursesKeyPress(w,event,params,nparams) -Widget w; -XEvent *event; -String *params; -Cardinal *nparams; -#endif -/***********************************************************************/ -{ -#define STATE_NORMAL 0 -#define STATE_COMPOSE 1 -#define STATE_CHAR 2 -#ifdef FOREIGN - wchar_t buffer[120]; -#else - char buffer[120]; -#endif - int buflen=40; - int count,key,i; - KeySym keysym; - XComposeStatus compose; - static int compose_state=STATE_NORMAL; - static int compose_index=0; - int save_visibility=0; - int char_idx=0; - int xpos,ypos; -#ifdef FOREIGN - Status status; -#endif - chtype *ch; - short fore=0,back=0; - unsigned long modifier=0; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesKeyPress called\n",(XCursesProcess)?" X":"CURSES"); -#endif - - if (event->type == KeyRelease) - return; /* ignore KeyReleases */ - - buffer[0] = '\0'; -#ifdef FOREIGN - count = XwcLookupString(Xic,&(event->xkey),buffer,buflen,&keysym, &status); - switch(status) - { - case XLookupNone: - fprintf(stderr,"XLookupNone status\n"); - break; - case XLookupKeySym: - fprintf(stderr,"XLookupKeySym status\n"); - break; - case XLookupBoth: - fprintf(stderr,"XLookupBoth status\n"); - break; - case XLookupChars: - fprintf(stderr,"XLookupChars status\n"); - break; - } -#else - count = XLookupString(&(event->xkey),buffer,buflen,&keysym, &compose); -#endif - /* - * Handle modifier keys first. - */ - -#if 0 -printf("Keypress\n"); -SP->return_key_modifiers = True; - -printf("%d: %ld %d %d %d %d\n",__LINE__,keysym, - (event->type == KeyPress), - (keysym != compose_key), - (IsModifierKey(keysym)), - (SP->return_key_modifiers)); - - if (event->type == KeyPress - && keysym != compose_key - && IsModifierKey(keysym) - && SP->return_key_modifiers) - { - save_keysym = keysym; - return; - } - -printf("%d: %ld %d %d %d %d %d\n",__LINE__,keysym, - (event->type == KeyRelease), - (keysym != compose_key), - (IsModifierKey(keysym)), - (SP->return_key_modifiers), - (keysym == save_keysym) - ); -#endif - - if (event->type == KeyPress - && keysym != compose_key - && IsModifierKey(keysym) - && SP->return_key_modifiers) - { - key = 0; - if (keysym == XK_Shift_L) { key = KEY_SHIFT_L; } - else if (keysym == XK_Shift_R) { key = KEY_SHIFT_R; } - else if (keysym == XK_Control_L) { key = KEY_CONTROL_L; } - else if (keysym == XK_Control_R) { key = KEY_CONTROL_R; } - else if (keysym == XK_Alt_L) { key = KEY_ALT_L; } - else if (keysym == XK_Alt_R) { key = KEY_ALT_R; } - if (key) - XCursesSendKeyToCurses( (unsigned long)key, NULL ); - return; - } - -/* translate keysym into curses key code */ -#ifdef PDCDEBUG - PDC_debug("%s:Key mask: %x\n",(XCursesProcess)?" X":"CURSES",event->xkey.state); - key = 0; - for (key=0;key<4;key++) - PDC_debug("%s:Keysym %x %d\n",(XCursesProcess)?" X":"CURSES",XKeycodeToKeysym(XCURSESDISPLAY,event->xkey.keycode,key),key); -#endif - -/* fprintf(stderr,"KEY: %d %s\n",keysym,XKeysymToString(keysym));*/ - key = 0; - /* - * Check if the key just pressed is the user-specified compose key - * If it is, set the compose state and exit. - */ - if (keysym == compose_key) - { -/* fprintf(stderr,"Compose key pressed\n");*/ - /* - * Change the shape of the cursor to an outline rectangle - * to indicate we are in "compose" status - */ - save_visibility = SP->visibility; - SP->visibility = 0; - XCursesDisplayCursor(SP->cursrow,SP->curscol, - SP->cursrow,SP->curscol); - SP->visibility = save_visibility;; - makeXY(SP->curscol,SP->cursrow,XCursesFontWidth,XCursesFontHeight,&xpos,&ypos); - ch = (chtype *)(Xcurscr+XCURSCR_Y_OFF(SP->cursrow)+((SP->curscol)*sizeof(chtype))); - SetCursorColor(ch,&fore,&back); - XSetForeground(XCURSESDISPLAY, rect_cursor_gc, colors[back]); - XDrawRectangle(XCURSESDISPLAY,XCURSESWIN,rect_cursor_gc,(xpos+1),(ypos-XCursesFontHeight+(XCURSESNORMALFONTINFO->descent)+1),(XCursesFontWidth-2),(XCursesFontHeight-2)); -/* fprintf(stderr,"Descent:%d Ascent:%d\n",XCURSESNORMALFONTINFO->descent,XCURSESNORMALFONTINFO->ascent);*/ - compose_state = STATE_COMPOSE; - return; - } -#if 0 - /* - * If the key just pressed is just a modifier, ignore it. - */ - if (IsModifierKey(keysym)) - { - return; - } -#endif - switch(compose_state) - { - case STATE_COMPOSE: - if (event->xkey.state & compose_mask) - { -/* fprintf(stderr,"STATE_COMPOSE: char has compose_mask\n");*/ - compose_state = STATE_NORMAL; - XCursesDisplayCursor(SP->cursrow,SP->curscol, - SP->cursrow,SP->curscol); - break; - } - if (buffer[0] != 0 - && count == 1) - key = (int)buffer[0]; -/* fprintf(stderr,"STATE_COMPOSE: state %x %x\n",event->xkey.state,compose_mask);*/ - compose_index = (-1); - for (i=0;i<(int)strlen(compose_chars);i++) - { - if ((int)compose_chars[i] == key) - { - compose_index = i; - break; - } - } -/* fprintf(stderr,"STATE_COMPOSE: %d - compose_index\n",compose_index);*/ - if (compose_index == (-1)) - { - compose_state = STATE_NORMAL; - compose_index = 0; - XCursesDisplayCursor(SP->cursrow,SP->curscol, - SP->cursrow,SP->curscol); - break; - } - compose_state = STATE_CHAR; - return; - break; - case STATE_CHAR: - if (event->xkey.state & compose_mask) - { -/* fprintf(stderr,"STATE_COMPOSE: char has compose_state\n");*/ - compose_state = STATE_NORMAL; - XCursesDisplayCursor(SP->cursrow,SP->curscol, - SP->cursrow,SP->curscol); - break; - } - if (buffer[0] != 0 - && count == 1) - key = (int)buffer[0]; - char_idx = (-1); -/* fprintf(stderr,"STATE_CHAR: %d - compose_index\n",compose_index);*/ - for (i=0;icursrow,SP->curscol, - SP->cursrow,SP->curscol); - break; - } -/* fprintf(stderr,"STATE_CHAR: %d %c - key\n",compose_keys[compose_index][char_idx],compose_keys[compose_index][char_idx]);*/ - XCursesSendKeyToCurses( (unsigned long)compose_keys[compose_index][char_idx], NULL ); - compose_state = STATE_NORMAL; - compose_index = 0; - XCursesDisplayCursor(SP->cursrow,SP->curscol, - SP->cursrow,SP->curscol); - return; - break; - default: - break; - } - /* - * To get here we are procesing "normal" keys - */ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:Keysym %x %d\n",(XCursesProcess)?" X":"CURSES",XKeycodeToKeysym(XCURSESDISPLAY,event->xkey.keycode,key),key); -#endif - if (SP->save_key_modifiers) - { - if (event->xkey.state & Mod2Mask) /* 0x10: usually, numlock modifier */ - { - modifier |= PDC_KEY_MODIFIER_NUMLOCK; - } - if (event->xkey.state & ShiftMask) /* 0x01: shift modifier */ - { - modifier |= PDC_KEY_MODIFIER_SHIFT; - } - if (event->xkey.state & ControlMask) /* 0x04: control modifier */ - { - modifier |= PDC_KEY_MODIFIER_CONTROL; - } - if (event->xkey.state & Mod1Mask) /* 0x08: usually, alt modifier */ - { - modifier |= PDC_KEY_MODIFIER_ALT; - } - } - for (i=0;XCursesKeys[i].keycode != 0;i++) - { - if (XCursesKeys[i].keycode == keysym) - { -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:State %x\n",(XCursesProcess)?" X":"CURSES",event->xkey.state); -#endif - if (XCursesKeys[i].numkeypad) - { - if (event->xkey.state & Mod2Mask /* 0x10: usually, numlock modifier */ - || event->xkey.state & ShiftMask) /* or 0x01: shift modifier */ - { - key = XCursesKeys[i].shifted; - break; - } - } - if (event->xkey.state & ShiftMask) /* 0x01: shift modifier */ - { - key = XCursesKeys[i].shifted; - break; - } - if (event->xkey.state & ControlMask) /* 0x04: control modifier */ - { - key = XCursesKeys[i].control; - break; - } - if (event->xkey.state & Mod1Mask) /* 0x08: usually, alt modifier */ - { - key = XCursesKeys[i].alt; - break; - } -/*---------------------------------------------------------------------*/ -/* To get here, we ignore all other modifiers. */ -/*---------------------------------------------------------------------*/ - key = XCursesKeys[i].normal; - break; - } - } - if (key == 0 - && buffer[0] != 0 - && count == 1) - key = (int)buffer[0]; -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:Key: %s pressed - %x Mod: %x\n",(XCursesProcess)?" X":"CURSES",XKeysymToString(keysym),key,event->xkey.state); -#endif -/*---------------------------------------------------------------------*/ -/* Handle ALT letters and numbers... */ -/*---------------------------------------------------------------------*/ - if (event->xkey.state == Mod1Mask) - { - if (key >= (int)'A' - && key <= (int)'Z') - key = ALT_A + (key - (int)('A')); - if (key >= (int)'a' - && key <= (int)'z') - key = ALT_A + (key - (int)('a')); - if (key >= (int)'0' - && key <= (int)'9') - key = ALT_0 + (key - (int)('0')); - } -/*---------------------------------------------------------------------*/ -/* After all that, send the key back to the application if is NOT zero.*/ -/*---------------------------------------------------------------------*/ - if (key) - { - key = key | modifier << 24; /* (sizeof(unsigned long) - sizeof(unsigned char)); */ - XCursesSendKeyToCurses( (unsigned long)key, NULL ); - } - return; -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesHandleString(Widget w, XEvent *event, String *params, Cardinal *nparams) -#else -void XCursesHandleString(w, event, params, nparams) -Widget w; -XEvent *event; -String *params; -Cardinal *nparams; -#endif -/***********************************************************************/ -{ - register int i=0; - unsigned char *ptr=NULL; - - if (*nparams != 1) - return; - - if ((*params)[0] == '0' - && (*params)[1] == 'x' - && (*params)[2] != '\0') - { - unsigned char c; - int total=0; - char *p; - for (p = *params+2; (c = *p); p++) - { - total *= 16; - if (isupper(c)) c = tolower(c); - if (c >= '0' && c <= '9') - total += c - '0'; - else - { - if (c >= 'a' && c <= 'f') - total += c - 'a' + 10; - else - break; - } - } - if (c == '\0') - XCursesSendKeyToCurses( (unsigned long)total, NULL ); - } - else - { - ptr = (unsigned char *)*params; - for (i=0;i<(int)strlen((char *)ptr);i++) - { - XCursesSendKeyToCurses( (unsigned long)*(ptr+i), NULL ); - } - } - return; -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesPasteSelection(Widget w,XButtonEvent *button_event) -#else -void XCursesPasteSelection(w,button_event) -Widget w; -XButtonEvent *button_event; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesPasteSelection() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - XtGetSelectionValue(w,XA_PRIMARY,XA_STRING,XCursesRequestorCallbackForPaste,(XtPointer)button_event,button_event->time); - return; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesRequestorCallbackForPaste(Widget w,XtPointer data, Atom *selection, - Atom *type, XtPointer value, - unsigned long *length, int *format) -#else -void XCursesRequestorCallbackForPaste(w,data,selection,type,value,length,format) -Widget w; -XtPointer data; -Atom *selection; -Atom *type; -XtPointer value; -unsigned long *length; -int *format; -#endif -/***********************************************************************/ -{ - int i=0,key=0; - char *string=(char *)value; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesRequestorCallbackForPaste() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - - if ((value == NULL) && (*length == 0)) - return; - - for (i=0;i<(*length);i++) - { - key = (int)(*(string+i)); - if (key == 10) /* new line - convert to ^M */ - key = 13; - XCursesSendKeyToCurses( (unsigned long)key, NULL ); - } - return; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -Boolean XCursesConvertProc(Widget w,Atom *selection, Atom *target, - Atom *type_return, XtPointer *value_return, - unsigned long *length_return, int *format_return) -#else -Boolean XCursesConvertProc(w,selection,target,type_return,value_return, - length_return,format_return) -Widget w; -Atom *selection; -Atom *target; -Atom *type_return; -XtPointer *value_return; -unsigned long *length_return; -int *format_return; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesConvertProc() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - - if (*target == XA_TARGETS(XtDisplay(topLevel))) - { - XSelectionRequestEvent *req = XtGetSelectionRequest(w, *selection, (XtRequestId)NULL); - Atom *targetP; - Atom *std_targets; - unsigned long std_length; - XmuConvertStandardSelection(topLevel, req->time, selection, - target, type_return, (XPointer*)&std_targets, &std_length, - format_return); - *value_return = XtMalloc(sizeof(Atom)*(std_length + 1)); - targetP = *(Atom**)value_return; - *length_return = std_length + 1; - *targetP++ = XA_STRING; - bcopy((char *)std_targets, (char *)targetP, sizeof(Atom)*std_length); - XtFree((char *)std_targets); - *type_return = XA_ATOM; - *format_return = sizeof(Atom) * 8; - return True; - } - else if (*target == XA_STRING) - { - char *data = XtMalloc(tmpsel_length+1); - memcpy(data,tmpsel,tmpsel_length); - *value_return = data; - *length_return = tmpsel_length; - *format_return = 8; - *type_return = XA_STRING; - return True; - } - else - { - if (XmuConvertStandardSelection(topLevel, CurrentTime, selection, target, type_return, - (XPointer*)value_return, length_return, format_return)) - return True; - else - return False; - } - return False; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesLoseOwnership(Widget w, Atom *type) -#else -void XCursesLoseOwnership(w,type) -Widget w; -Atom *type; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesLoseOwnership() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - if (tmpsel) free(tmpsel); - tmpsel = NULL; - tmpsel_length = 0; - SelectionOff(); - return; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -void ShowSelection( int start_x, int start_y, int end_x, int end_y, bool highlight ) -#else -void ShowSelection( start_x, start_y, end_x, end_y, highlight ) -int start_x, start_y, end_x, end_y; -bool highlight; -#endif -/***********************************************************************/ -{ - int i,num_cols,start_col,row; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:ShowSelection() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - - for (i=0; i< (end_y-start_y)+1; i++) - { - if (start_y == end_y) /* all one one line */ - { - start_col = start_x; - num_cols = end_x - start_x + 1; - row = start_y; - } - else if (i == 0) /* first line of multi-line stream */ - { - start_col = start_x; - num_cols = COLS - start_x; - row = start_y; - } - else if (start_y+i == end_y) /* last line of multi-line stream */ - { - start_col = 0; - num_cols = end_x + 1; - row = end_y; - } - else /* full line */ - { - start_col = 0; - num_cols = COLS; - row = start_y+i; - } - while(*(Xcurscr+XCURSCR_FLAG_OFF+row)) - /* - * Patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999 - */ - dummy_function(); /* loop until we can write to the line */ - /* - * End of patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999 - */ - - *(Xcurscr+XCURSCR_FLAG_OFF+row) = 1; - XCursesDisplayText((chtype *)(Xcurscr+XCURSCR_Y_OFF(row)+(start_col*sizeof(chtype))),row,start_col,num_cols,highlight); - *(Xcurscr+XCURSCR_FLAG_OFF+row) = 0; - } - return; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -void SelectionOff(void) -#else -void SelectionOff() -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:SelectionOff() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - XCursesDisplayScreen(FALSE); - selection_start_x = selection_start_y = selection_end_x = selection_end_y = 0; - mouse_selection = False; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -void SelectionOn(int x,int y) -#else -void SelectionOn(x,y) -int x,y; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:SelectionOn() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - selection_start_x = selection_end_x = x; - selection_start_y = selection_end_y = y; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -void SelectionExtend(int x,int y) -#else -void SelectionExtend(x,y) -int x,y; -#endif -/***********************************************************************/ -{ - int temp; - int current_start,current_end,current_start_x,current_end_x,current_start_y,current_end_y; - int new_start,new_end,new_start_x,new_end_x,new_start_y,new_end_y; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:SelectionExtend() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - - mouse_selection = True; - - /* convert x/y coordinates into start/stop */ - current_start = (selection_start_y * COLS) + selection_start_x; - current_end = (selection_end_y * COLS) + selection_end_x; - if (current_start > current_end) - { - current_start_x = selection_end_x; - current_start_y = selection_end_y; - current_end_x = selection_start_x; - current_end_y = selection_start_y; - temp = current_start; - current_start = current_end; - current_end = temp; - } - else - { - current_end_x = selection_end_x; - current_end_y = selection_end_y; - current_start_x = selection_start_x; - current_start_y = selection_start_y; - } - /* - * Now we have the current selection as a linear expression. - * Convert the new position to a linear expression. - */ - selection_end_x = x; - selection_end_y = y; - - /* convert x/y coordinates into start/stop */ - new_start = (selection_start_y * COLS) + selection_start_x; - new_end = (selection_end_y * COLS) + selection_end_x; - if (new_start > new_end) - { - new_start_x = selection_end_x; - new_start_y = selection_end_y; - new_end_x = selection_start_x; - new_end_y = selection_start_y; - temp = new_start; - new_start = new_end; - new_end = temp; - } - else - { - new_end_x = selection_end_x; - new_end_y = selection_end_y; - new_start_x = selection_start_x; - new_start_y = selection_start_y; - } - if (new_end > current_end) - ShowSelection(current_end_x, current_end_y, new_end_x, new_end_y, TRUE ); - else if (new_end < current_end) - ShowSelection(new_end_x, new_end_y, current_end_x, current_end_y, FALSE ); - else if (new_start < current_start) - ShowSelection(new_start_x, new_start_y, current_start_x, current_start_y, TRUE ); - else if (new_start > current_start) - ShowSelection(current_start_x, current_start_y, new_start_x, new_start_y, FALSE ); - else - ShowSelection(current_start_x, current_start_y, new_start_x, new_start_y, TRUE ); -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -void SelectionSet( void ) -#else -void SelectionSet() -#endif -/***********************************************************************/ -{ - int i,j,start,end,start_x,end_x,start_y,end_y,num_cols,start_col,row,num_chars; - int ch,last_nonblank,length; - chtype *ptr=NULL; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:SelectionSet() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - -/* convert x/y coordinates into start/stop */ - start = (selection_start_y * COLS) + selection_start_x; - end = (selection_end_y * COLS) + selection_end_x; - if (start == end) - { - if (tmpsel) free(tmpsel); - tmpsel = NULL; - tmpsel_length = 0; - return; - } - if (start > end) - { - start_x = selection_end_x; - start_y = selection_end_y; - end_x = selection_start_x; - end_y = selection_start_y; - } - else - { - end_x = selection_end_x; - end_y = selection_end_y; - start_x = selection_start_x; - start_y = selection_start_y; - } - length = end - start +1; - if (length > tmpsel_length) - { - if (tmpsel_length == 0) - tmpsel = (char *)malloc(length+1); - else - tmpsel = (char *)realloc(tmpsel,length+1); - } - if (!tmpsel) - { - tmpsel_length = 0; - return; - } - tmpsel_length = length; - num_chars = 0; - for (i=0; i< (end_y-start_y)+1; i++) - { - if (start_y == end_y) /* all one one line */ - { - start_col = start_x; - num_cols = end_x - start_x + 1; - row = start_y; - } - else if (i == 0) /* first line of multi-line stream */ - { - start_col = start_x; - num_cols = COLS - start_x; - row = start_y; - } - else if (start_y+i == end_y) /* last line of multi-line stream */ - { - start_col = 0; - num_cols = end_x + 1; - row = end_y; - } - else /* full line */ - { - start_col = 0; - num_cols = COLS; - row = start_y+i; - } - while(*(Xcurscr+XCURSCR_FLAG_OFF+row)) - /* - * Patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999 - */ - dummy_function(); /* loop until we can write to the line */ - /* - * End of patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999 - */ - - *(Xcurscr+XCURSCR_FLAG_OFF+row) = 1; - ptr = (chtype *)(Xcurscr+XCURSCR_Y_OFF(row)+(start_col*sizeof(chtype))); - last_nonblank = 0; - for (j=0; j= XCursesLINES - || old_x >= COLS - || new_row >= XCursesLINES - || new_x >= COLS) - return; - - /* display the character at the current cursor position */ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesDisplayCursor() - draw char at row: %d col %d\n",(XCursesProcess)?" X":"CURSES",old_row,old_x); -#endif - XCursesDisplayText((chtype *)(Xcurscr+(XCURSCR_Y_OFF(old_row)+(old_x*sizeof(chtype)))),old_row,old_x,1,FALSE); - /* display the cursor at the new cursor position */ - - switch(SP->visibility) - { - case 0: /* cursor not displayed, no more to do */ - break; - case 1: - makeXY(new_x,new_row,XCursesFontWidth,XCursesFontHeight,&xpos,&ypos); - ch = (chtype *)(Xcurscr+XCURSCR_Y_OFF(new_row)+(new_x*sizeof(chtype))); - SetCursorColor(ch,&fore,&back); - XSetForeground(XCURSESDISPLAY, rect_cursor_gc, colors[back]); - for (i=0;idescent+2;i++) - XDrawLine(XCURSESDISPLAY,XCURSESWIN,rect_cursor_gc,(xpos),(ypos-2+i),(xpos+XCursesFontWidth),(ypos-2+i)); -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesDisplayCursor() - draw line at row %d col %d\n",(XCursesProcess)?" X":"CURSES",new_row,new_x); -#endif - break; - default: -#if 0 - makeXY(new_x,new_row,XCursesFontWidth,XCursesFontHeight,&xpos,&ypos); - ch = (chtype *)(Xcurscr+XCURSCR_Y_OFF(new_row)+(new_x*sizeof(chtype))); - buf[0] = (char)(*ch & A_CHARTEXT); - buf[1] = '\0'; - XSetForeground(XCURSESDISPLAY, block_cursor_gc, colors[COLOR_BLACK]); /* use original foreground colour ? */ - XDrawImageString(XCURSESDISPLAY,XCURSESWIN,block_cursor_gc,xpos,ypos,buf,1); -#else - makeXY(new_x,new_row,XCursesFontWidth,XCursesFontHeight,&xpos,&ypos); - ch = (chtype *)(Xcurscr+XCURSCR_Y_OFF(new_row)+(new_x*sizeof(chtype))); - SetCursorColor(ch,&fore,&back); - buf[0] = (char)(*ch & A_CHARTEXT); - buf[1] = '\0'; - XSetForeground(XCURSESDISPLAY, block_cursor_gc, colors[fore]); - XSetBackground(XCURSESDISPLAY, block_cursor_gc, colors[back]); - XDrawImageString(XCURSESDISPLAY,XCURSESWIN,block_cursor_gc,xpos,ypos,buf,1); -#endif -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesDisplayCursor() - draw cursor at row: %d col %d char <%s>\n",(XCursesProcess)?" X":"CURSES",new_row,new_x,buf); -#endif - break; - } - return; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesEnterLeaveWindow(Widget w,XtPointer client_data,XEvent *event,Boolean *continue_to_dispatch) -#else -void XCursesEnterLeaveWindow(w,client_data,event,continue_to_dispatch) -Widget w; -XtPointer client_data; -XEvent *event; -Boolean *continue_to_dispatch; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesEnterLeaveWindow called\n",(XCursesProcess)?" X":"CURSES"); -#endif - switch(event->type) - { - case EnterNotify: -#ifdef PDCDEBUG - say("EnterNotify received\n"); -#endif - windowEntered = TRUE; - break; - case LeaveNotify: -#ifdef PDCDEBUG - say("LeaveNotify received\n"); -#endif - windowEntered = FALSE; - /* - * Display the cursor so it stays on while the window - * is not current - */ - XCursesDisplayCursor(SP->cursrow,SP->curscol, - SP->cursrow,SP->curscol); - break; - default: -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesEnterleaveWindow - unknown event %d\n",(XCursesProcess)?" X":"CURSES",event->type); -#endif - break; - } - return; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCurses_get_rows(void) -#else -int XCurses_get_rows() -#endif -/***********************************************************************/ -{ - return(XCursesLINES); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCurses_get_cols(void) -#else -int XCurses_get_cols() -#endif -/***********************************************************************/ -{ - return(XCursesCOLS); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -unsigned long XCurses_get_key_modifiers(void) -#else -unsigned long XCurses_get_key_modifiers() -#endif -/***********************************************************************/ -{ - return(pdc_key_modifier); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCursesSendKeyToCurses(unsigned long key, MOUSE_STATUS *ms) -#else -int XCursesSendKeyToCurses(key, ms) -unsigned long key; -MOUSE_STATUS *ms; -#endif -/***********************************************************************/ -{ - char buf[100]; /* enough for MOUSE_STATUS */ - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesSendKeyToCurses() - called: sending %d\n",(XCursesProcess)?" X":"CURSES",key); -#endif - memcpy(buf,(char *)&key,sizeof(unsigned long)); - if (write_socket(key_sock,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(1,SIGKILL,"exiting from XCursesSendKeyToCurses"); - if ( ms != NULL ) - { - memcpy(buf,(char *)&Mouse_status,sizeof(MOUSE_STATUS)); -# ifdef MOUSE_DEBUG1 - printf("%s:writing mouse stuff\n",(XCursesProcess)?" X":"CURSES"); -# endif - if ( write_socket(key_sock,buf,sizeof(MOUSE_STATUS) ) < 0 ) - XCursesExitXCursesProcess(1,SIGKILL,"exiting from XCursesSendKeyToCurses"); - } - return(0); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesButton(Widget w,XEvent *event, String *params, Cardinal *nparams) -#else -void XCursesButton(w,event,params,nparams) -Widget w; -XEvent *event; -String *params; -Cardinal *nparams; -#endif -/***********************************************************************/ -{ - int button_no=0; - static int last_button_no; - static Time last_button_press_time=0; - MOUSE_STATUS save_mouse_status; - bool send_key=TRUE; - static bool remove_release; - static bool handle_real_release; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesButton called\n",(XCursesProcess)?" X":"CURSES"); -#endif - - save_mouse_status=Mouse_status; - button_no = event->xbutton.button; - /*---------------------------------------------------------------------*/ - /* It appears that under X11R6 (at least on Linux), that an event_type */ - /* of ButtonMotion does not include the mouse button in the event. The */ - /* following code is designed to cater for this situation. */ - /*---------------------------------------------------------------------*/ - if (button_no == 0) - button_no = last_button_no; - last_button_no = button_no; - - Mouse_status.changes = 0; - switch(event->type) - { - /* - * ButtonPress - */ - case ButtonPress: - remove_release = False; - handle_real_release = False; -#ifdef MOUSE_DEBUG - printf("\nButtonPress\n"); -#endif - if ((event->xbutton.time - last_button_press_time) < XCURSESDOUBLECLICKPERIOD) - { - MOUSE_X_POS = save_mouse_status.x; - MOUSE_Y_POS = save_mouse_status.y; - BUTTON_STATUS(button_no) = BUTTON_DOUBLE_CLICKED; - SelectionOff(); - if (!(SP->_trap_mbe & BUTTON1_DOUBLE_CLICKED) - && button_no == 1) - send_key = FALSE; - if (!(SP->_trap_mbe & BUTTON2_DOUBLE_CLICKED) - && button_no == 2) - send_key = FALSE; - if (!(SP->_trap_mbe & BUTTON3_DOUBLE_CLICKED) - && button_no == 3) - send_key = FALSE; - if (send_key) - remove_release = True; - } - else - { -#if 0 - MOUSE_X_POS = (event->xbutton.x-XCURSESBORDERWIDTH) / XCursesFontWidth; - MOUSE_Y_POS = (event->xbutton.y-XCURSESBORDERWIDTH) / XCursesFontHeight; - BUTTON_STATUS(button_no) = BUTTON_PRESSED; - if (!(SP->_trap_mbe & BUTTON1_PRESSED) - && button_no == 1) - send_key = FALSE; - if (!(SP->_trap_mbe & BUTTON2_PRESSED) - && button_no == 2) - send_key = FALSE; - if (!(SP->_trap_mbe & BUTTON3_PRESSED) - && button_no == 3) - send_key = FALSE; - if (button_no == 1 - && !(event->xbutton.state & ShiftMask) - && !(event->xbutton.state & ControlMask) - && !(event->xbutton.state & Mod1Mask)) - { - SelectionOff(); - SelectionOn(MOUSE_X_POS,MOUSE_Y_POS); - } -#else - PDC_usleep( XCURSESCLICKPERIOD * 1000 ); /* microseconds to milliseconds */ - event->type = ButtonRelease; - XSendEvent(event->xbutton.display, event->xbutton.window, True, - 0, event); - last_button_press_time = event->xbutton.time; -#ifdef PDCDEBUG -printf("Pressed at: %ld\n",last_button_press_time); -#endif - return; -#endif - } - last_button_press_time = event->xbutton.time; -#ifdef PDCDEBUG -printf("Pressed at: %ld\n",last_button_press_time); -#endif - break; - /* - * MotionNotify - */ - case MotionNotify: -#ifdef MOUSE_DEBUG - printf("\nMotionNotify: y: %d x: %d Width: %d Height: %d\n",event->xbutton.y, - event->xbutton.x, - XCursesFontWidth, - XCursesFontHeight); -#endif - if (button_no == 1 - && !(event->xbutton.state & ShiftMask) - && !(event->xbutton.state & ControlMask) - && !(event->xbutton.state & Mod1Mask)) - { - MOUSE_X_POS = (event->xbutton.x-XCURSESBORDERWIDTH) / XCursesFontWidth; - MOUSE_Y_POS = (event->xbutton.y-XCURSESBORDERWIDTH) / XCursesFontHeight; - SelectionExtend(MOUSE_X_POS,MOUSE_Y_POS); - send_key = FALSE; - } - else - SelectionOff(); - /* - * Throw away mouse movements if they are in the same character position - * as the last mouse event, or if we are currently in the middle of - * a double click event. - */ - MOUSE_X_POS = (event->xbutton.x-XCURSESBORDERWIDTH) / XCursesFontWidth; - MOUSE_Y_POS = (event->xbutton.y-XCURSESBORDERWIDTH) / XCursesFontHeight; - if ((MOUSE_X_POS == save_mouse_status.x - && MOUSE_Y_POS == save_mouse_status.y) - || save_mouse_status.button[button_no-1] == BUTTON_DOUBLE_CLICKED) - { - send_key = FALSE; - break; - } - MOUSE_X_POS = (event->xbutton.x-XCURSESBORDERWIDTH) / XCursesFontWidth; - MOUSE_Y_POS = (event->xbutton.y-XCURSESBORDERWIDTH) / XCursesFontHeight; - Mouse_status.changes |= 8; - if (!(SP->_trap_mbe & BUTTON1_MOVED) - && button_no == 1) - send_key = FALSE; - if (!(SP->_trap_mbe & BUTTON2_MOVED) - && button_no == 2) - send_key = FALSE; - if (!(SP->_trap_mbe & BUTTON3_MOVED) - && button_no == 3) - send_key = FALSE; -#if 0 - if (button_no == 1 - && !(event->xbutton.state & ShiftMask) - && !(event->xbutton.state & ControlMask) - && !(event->xbutton.state & Mod1Mask)) - { - SelectionExtend(MOUSE_X_POS,MOUSE_Y_POS); - send_key = FALSE; - } - else - SelectionOff(); -#endif - break; - /* - * ButtonRelease - */ - case ButtonRelease: -#if 0 - MOUSE_X_POS = (event->xbutton.x-XCURSESBORDERWIDTH) / XCursesFontWidth; - MOUSE_Y_POS = (event->xbutton.y-XCURSESBORDERWIDTH) / XCursesFontHeight; - BUTTON_STATUS(button_no) = BUTTON_RELEASED; - if (!(SP->_trap_mbe & BUTTON1_RELEASED) - && button_no == 1) - send_key = FALSE; - if (!(SP->_trap_mbe & BUTTON2_RELEASED) - && button_no == 2) - send_key = FALSE; - if (!(SP->_trap_mbe & BUTTON3_RELEASED) - && button_no == 3) - send_key = FALSE; - if (button_no == 1 - && !(event->xbutton.state & ShiftMask) - && !(event->xbutton.state & ControlMask) - && !(event->xbutton.state & Mod1Mask) - && mouse_selection) - { - send_key = FALSE; - if (XtOwnSelection(topLevel, - XA_PRIMARY, - event->xbutton.time, - XCursesConvertProc, - XCursesLoseOwnership, - NULL) == False) - { - SelectionOff(); - } - SelectionSet(); - } - else - SelectionOff(); - break; -#else - if (remove_release) - { -#ifdef PDCDEBUG - printf("Release at: %ld - removed\n",event->xbutton.time); -#endif - return; - } - else - { - if (!handle_real_release) - { - if ((event->xbutton.time - last_button_press_time) < 100 - && (event->xbutton.time != last_button_press_time)) - { - /* - * The "real" release was shorter than usleep() time - * therefore generate a click event - */ -#ifdef PDCDEBUG - printf("Release at: %ld - click\n",event->xbutton.time); -#endif - MOUSE_X_POS = (event->xbutton.x-XCURSESBORDERWIDTH) / XCursesFontWidth; - MOUSE_Y_POS = (event->xbutton.y-XCURSESBORDERWIDTH) / XCursesFontHeight; - BUTTON_STATUS(button_no) = BUTTON_CLICKED; - if (!(SP->_trap_mbe & BUTTON1_RELEASED) - && button_no == 1) - send_key = FALSE; - if (!(SP->_trap_mbe & BUTTON2_RELEASED) - && button_no == 2) - send_key = FALSE; - if (!(SP->_trap_mbe & BUTTON3_RELEASED) - && button_no == 3) - send_key = FALSE; - if (button_no == 1 - && !(event->xbutton.state & ShiftMask) - && !(event->xbutton.state & ControlMask) - && !(event->xbutton.state & Mod1Mask) - && mouse_selection) - { - send_key = FALSE; - if (XtOwnSelection(topLevel, - XA_PRIMARY, - event->xbutton.time, - XCursesConvertProc, - XCursesLoseOwnership, - NULL) == False) - { - SelectionOff(); - } - } - else - SelectionOff(); - /* - * Ensure the "pseudo" release event is ignored - */ - remove_release = True; - handle_real_release = False; - break; - } - else - { - /* - * Button release longer than usleep() time - * therefore generate a press and wait for the - * real release to occur later. - */ -#ifdef PDCDEBUG - printf("Generated Release at: %ld - press & release\n",event->xbutton.time); -#endif - MOUSE_X_POS = (event->xbutton.x-XCURSESBORDERWIDTH) / XCursesFontWidth; - MOUSE_Y_POS = (event->xbutton.y-XCURSESBORDERWIDTH) / XCursesFontHeight; - BUTTON_STATUS(button_no) = BUTTON_PRESSED; - if (!(SP->_trap_mbe & BUTTON1_PRESSED) - && button_no == 1) - send_key = FALSE; - if (!(SP->_trap_mbe & BUTTON2_PRESSED) - && button_no == 2) - send_key = FALSE; - if (!(SP->_trap_mbe & BUTTON3_PRESSED) - && button_no == 3) - send_key = FALSE; - if (button_no == 1 - && !(event->xbutton.state & ShiftMask) - && !(event->xbutton.state & ControlMask) - && !(event->xbutton.state & Mod1Mask)) - { - SelectionOff(); - SelectionOn(MOUSE_X_POS,MOUSE_Y_POS); - } - handle_real_release = True; - break; - } - } - else - { -#ifdef PDCDEBUG - printf("Release at: %ld - released\n",event->xbutton.time); -#endif - } - } -#ifdef PDCDEBUG -printf("\nButtonRelease\n"); -#endif - MOUSE_X_POS = (event->xbutton.x-XCURSESBORDERWIDTH) / XCursesFontWidth; - MOUSE_Y_POS = (event->xbutton.y-XCURSESBORDERWIDTH) / XCursesFontHeight; - BUTTON_STATUS(button_no) = BUTTON_RELEASED; - if (!(SP->_trap_mbe & BUTTON1_RELEASED) - && button_no == 1) - send_key = FALSE; - if (!(SP->_trap_mbe & BUTTON2_RELEASED) - && button_no == 2) - send_key = FALSE; - if (!(SP->_trap_mbe & BUTTON3_RELEASED) - && button_no == 3) - send_key = FALSE; - if (button_no == 1 - && !(event->xbutton.state & ShiftMask) - && !(event->xbutton.state & ControlMask) - && !(event->xbutton.state & Mod1Mask) - && mouse_selection) - { - send_key = FALSE; - if (XtOwnSelection(topLevel, - XA_PRIMARY, - event->xbutton.time, - XCursesConvertProc, - XCursesLoseOwnership, - NULL) == False) - { - SelectionOff(); - } - SelectionSet(); - } - else - SelectionOff(); - break; -#endif - } - /* - * Set up the mouse status fields in preparation for sending... - */ - Mouse_status.changes |= (1 << (button_no-1)); - if (event->xbutton.state & ShiftMask) - BUTTON_STATUS(button_no) |= BUTTON_SHIFT; - if (event->xbutton.state & ControlMask) - BUTTON_STATUS(button_no) |= BUTTON_CONTROL; - if (event->xbutton.state & Mod1Mask) - BUTTON_STATUS(button_no) |= BUTTON_ALT; - /* - * If we are ignoring the event, or the mouse position is outside the - * bounds of the screen (because of the border), return here... - */ -#ifdef PDCDEBUG - printf("Button: %d x: %d y: %d Button status: %x Mouse status: %x\n",button_no, - MOUSE_X_POS, - MOUSE_Y_POS, - BUTTON_STATUS(button_no), - Mouse_status.changes); - printf("Send: %d Button1: %x Button2: %x Button3: %x %d %d\n", - send_key, - BUTTON_STATUS(1), - BUTTON_STATUS(2), - BUTTON_STATUS(3), - XCursesLINES,XCursesCOLS); -#endif - - if (!send_key - || MOUSE_X_POS < 0 - || MOUSE_X_POS >= XCursesCOLS - || MOUSE_Y_POS < 0 - || MOUSE_Y_POS >= XCursesLINES) - return; - -#ifdef MOUSE_DEBUG - printf("Button: %d x: %d y: %d Button status: %x Mouse status: %x\n",button_no, - MOUSE_X_POS, - MOUSE_Y_POS, - BUTTON_STATUS(button_no), - Mouse_status.changes); - printf("Send: %d Button1: %x Button2: %x Button3: %x\n",send_key, - BUTTON_STATUS(1), - BUTTON_STATUS(2), - BUTTON_STATUS(3)); -#endif - /* - * Send the KEY_MOUSE to curses program... - */ - XCursesSendKeyToCurses( (unsigned long)KEY_MOUSE, &Mouse_status ); - return; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -void Scroll_up_down(Widget w, XtPointer client_data, XtPointer call_data) -#else -void Scroll_up_down(w, client_data, call_data) -Widget w; -XtPointer client_data; -XtPointer call_data; -#endif -/***********************************************************************/ -{ - int pixels = (int) call_data; - int total_y=(SP->sb_total_y*XCursesFontHeight); - int viewport_y=(SP->sb_viewport_y*XCursesFontHeight); - int cur_y=(SP->sb_cur_y*XCursesFontHeight); - - /* - * When pixels is negative, right button pressed, move data down, - * thumb moves up. Otherwise, left button pressed, pixels - * positive, move data up, thumb down. - */ - cur_y += pixels; - - /* limit panning to size of overall */ - if (cur_y < 0) - cur_y = 0; - else - { - if (cur_y > (total_y - viewport_y)) - cur_y = (total_y - viewport_y); - } - SP->sb_cur_y = cur_y / XCursesFontHeight; - XawScrollbarSetThumb(w,(float)((float)cur_y/(float)total_y),(float)((float)viewport_y/(float)total_y)); - /* - * Send a key: if pixels negative, send KEY_SCROLL_DOWN - */ - XCursesSendKeyToCurses( (unsigned long)KEY_SF, NULL ); -#if 0 -fprintf(stderr,"Scroll_up_down: pixels %d cur_y %d\n",pixels,SP->sb_cur_y); -#endif -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -void Scroll_left_right(Widget w, XtPointer client_data, XtPointer call_data) -#else -void Scroll_left_right(w, client_data, call_data) -Widget w; -XtPointer client_data; -XtPointer call_data; -#endif -/***********************************************************************/ -{ - int pixels = (int) call_data; - int total_x=(SP->sb_total_x*XCursesFontWidth); - int viewport_x=(SP->sb_viewport_x*XCursesFontWidth); - int cur_x=(SP->sb_cur_x*XCursesFontWidth); - - /* - * When pixels is negative, right button pressed, move data down, - * thumb moves up. Otherwise, left button pressed, pixels - * positive, move data up, thumb down. - */ - cur_x += pixels; - - /* limit panning to size of overall */ - if (cur_x < 0) - cur_x = 0; - else - { - if (cur_x > (total_x - viewport_x)) - cur_x = (total_x - viewport_x); - } - SP->sb_cur_x = cur_x / XCursesFontWidth; - XawScrollbarSetThumb(w,(float)((float)cur_x/(float)total_x),(float)((float)viewport_x/(float)total_x)); - /* - * Send a key: if pixels negative, send KEY_SCROLL_DOWN - */ - XCursesSendKeyToCurses( (unsigned long)KEY_SR, NULL ); -#if 0 -fprintf(stderr,"Scroll_left_right: pixels %d cur_x %d\n",pixels,SP->sb_cur_x); -#endif -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void Thumb_up_down(Widget w, XtPointer client_data, XtPointer call_data) -#else -void Thumb_up_down(w, client_data, call_data) -Widget w; -XtPointer client_data; -XtPointer call_data; -#endif -/***********************************************************************/ -{ - float percent = *(float *) call_data; - float total_y=(float)(SP->sb_total_y); - float viewport_y=(float)(SP->sb_viewport_y); - int cur_y=SP->sb_cur_y; - -#if 0 -fprintf(stderr,"Thumb_up_down: percent %f\n",percent); -#endif - /* - * If the size of the viewport is > overall area - * simply return, as no scrolling is permitted. - */ - if (SP->sb_viewport_y >= SP->sb_total_y) - return; - if ((SP->sb_cur_y = (int)((float)total_y * percent)) >= (total_y - viewport_y)) - SP->sb_cur_y = total_y - viewport_y; - - /* SP->sb_cur_y = cur_y;*/ - XawScrollbarSetThumb(w,(float)(cur_y/total_y),(float)(viewport_y/total_y)); - /* - * Send a key: if pixels negative, send KEY_SCROLL_DOWN - */ -#if 0 -fprintf(stderr,"Thumb_up_down: percent %f cur_y %d\n",percent,SP->sb_cur_y); -#endif - XCursesSendKeyToCurses( (unsigned long)KEY_SF, NULL ); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void Thumb_left_right(Widget w, XtPointer client_data, XtPointer call_data) -#else -void Thumb_left_right(w, client_data, call_data) -Widget w; -XtPointer client_data; -XtPointer call_data; -#endif -/***********************************************************************/ -{ - float percent = *(float *) call_data; - float total_x=(float)(SP->sb_total_x); - float viewport_x=(float)(SP->sb_viewport_x); - int cur_x=SP->sb_cur_x; - -#if 0 -fprintf(stderr,"Thumb_up_down: percent %f\n",percent); -#endif - /* - * If the size of the viewport is > overall area - * simply return, as no scrolling is permitted. - */ - if (SP->sb_viewport_x >= SP->sb_total_x) - return; - if ((SP->sb_cur_x = (int)((float)total_x * percent)) >= (total_x - viewport_x)) - SP->sb_cur_x = total_x - viewport_x; - - /* SP->sb_cur_x = cur_x;*/ - XawScrollbarSetThumb(w,(float)(cur_x/total_x),(float)(viewport_x/total_x)); - /* - * Send a key: if pixels negative, send KEY_SCROLL_DOWN - */ -#if 0 -fprintf(stderr,"Thumb_up_down: percent %f cur_x %d\n",percent,SP->sb_cur_x); -#endif - XCursesSendKeyToCurses( (unsigned long)KEY_SR, NULL ); -} -#endif diff --git a/x11/pdcx11.h b/x11/pdcx11.h deleted file mode 100644 index cf0accc1a..000000000 --- a/x11/pdcx11.h +++ /dev/null @@ -1,312 +0,0 @@ -/* -*************************************************************************** -* This file comprises part of PDCurses. PDCurses is Public Domain software. -* You may use this code for whatever purposes you desire. This software -* is provided AS IS with NO WARRANTY whatsoever. -* Should this software be used in another application, an acknowledgement -* that PDCurses code is used would be appreciated, but is not mandatory. -* -* Any changes which you make to this software which may improve or enhance -* it, should be forwarded to the current maintainer for the benefit of -* other users. -* -* The only restriction placed on this code is that no distribution of -* modified PDCurses code be made under the PDCurses name, by anyone -* other than the current maintainer. -* -* See the file maintain.er for details of the current maintainer. -* -* This file is NOT public domain software. It is Copyright, Mark Hessling -* 1994-1999. M.Hessling@qut.edu.au -*************************************************************************** -*/ - -#define CURSES_LIBRARY 1 -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef HAVE_UNISTD_H -#include -#endif - -#include -#include -#include -#include - -/* - * #includes specific to running XCurses with seperate processes - */ -#ifdef USE_PROCESSES -# include -# include -# ifdef HAVE_FCNTL_H -# include -# endif -# ifdef HAVE_SYS_SELECT_H -# include /* AIX needs this for FD_ZERO etc macros */ -# endif -# include -# include -#endif - -/* - * #includes specific to running XCurses with threads - */ -#ifdef USE_THREADS -# include -#endif - -#ifdef TIME_WITH_SYS_TIME -# include -# include -#else -# ifdef HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#ifdef HAVE_ERRNO_H -# include -#endif - -#include -#include -#include - -#ifdef USE_XAW3D -#include -#include -#else -#include -#include -#endif -#include "x11/ScrollBox.h" - -#include "Xmu/StdSel.h" -#include "Xmu/Atoms.h" - -#include -#include -#if defined FOREIGN -# include -#endif - -#ifdef HAVE_DECKEYSYM_H -#include -#endif - -#ifdef HAVE_SUNKEYSYM_H -#include -#endif - -#include - -#define XtNlines "lines" -#define XtCLines "Lines" -#define XtNcols "cols" -#define XtCCols "Cols" - -#define XtCNormalFont "NormalFont" -#define XtNnormalFont "normalFont" -#define XtCBoldFont "BoldFont" -#define XtNboldFont "boldFont" - -#define XtCPointer "Pointer" -#define XtNpointer "pointer" - -#define XtCShmmin "Shmmin" -#define XtNshmmin "shmmin" - -#define XtCComposeKey "ComposeKey" -#define XtNcomposeKey "composeKey" - -#define XtCClickPeriod "ClickPeriod" -#define XtNclickPeriod "clickPeriod" - -#define XtCDoubleClickPeriod "DoubleClickPeriod" -#define XtNdoubleClickPeriod "doubleClickPeriod" - -#define XtCScrollbarWidth "ScrollbarWidth" -#define XtNscrollbarWidth "scrollbarWidth" - -#define XtCPointerForeColor "PointerForeColor" -#define XtNpointerForeColor "pointerForeColor" -#define XtCPointerBackColor "PointerBackColor" -#define XtNpointerBackColor "pointerBackColor" - -#define XtNcursorColor "cursorColor" -#define XtCCursorColor "CursorColor" - -#define XtNcolorBlack "colorBlack" -#define XtCColorBlack "ColorBlack" -#define XtNcolorRed "colorRed" -#define XtCColorRed "ColorRed" -#define XtNcolorGreen "colorGreen" -#define XtCColorGreen "ColorGreen" -#define XtNcolorYellow "colorYellow" -#define XtCColorYellow "ColorYellow" -#define XtNcolorBlue "colorBlue" -#define XtCColorBlue "ColorBlue" -#define XtNcolorMagenta "colorMagenta" -#define XtCColorMagenta "ColorMagenta" -#define XtNcolorCyan "colorCyan" -#define XtCColorCyan "ColorCyan" -#define XtNcolorWhite "colorWhite" -#define XtCColorWhite "ColorWhite" - -#define XtNcolorBoldBlack "colorBoldBlack" -#define XtCColorBoldBlack "ColorBoldBlack" -#define XtNcolorBoldRed "colorBoldRed" -#define XtCColorBoldRed "ColorBoldRed" -#define XtNcolorBoldGreen "colorBoldGreen" -#define XtCColorBoldGreen "ColorBoldGreen" -#define XtNcolorBoldYellow "colorBoldYellow" -#define XtCColorBoldYellow "ColorBoldYellow" -#define XtNcolorBoldBlue "colorBoldBlue" -#define XtCColorBoldBlue "ColorBoldBlue" -#define XtNcolorBoldMagenta "colorBoldMagenta" -#define XtCColorBoldMagenta "ColorBoldMagenta" -#define XtNcolorBoldCyan "colorBoldCyan" -#define XtCColorBoldCyan "ColorBoldCyan" -#define XtNcolorBoldWhite "colorBoldWhite" -#define XtCColorBoldWhite "ColorBoldWhite" - -#ifndef MAX_PATH -# define MAX_PATH 256 -#endif - -typedef struct -{ - int lines; - int cols; - Pixel cursorColor; - Pixel colorBlack; - Pixel colorRed; - Pixel colorGreen; - Pixel colorYellow; - Pixel colorBlue; - Pixel colorMagenta; - Pixel colorCyan; - Pixel colorWhite; - Pixel colorBoldBlack; - Pixel colorBoldRed; - Pixel colorBoldGreen; - Pixel colorBoldYellow; - Pixel colorBoldBlue; - Pixel colorBoldMagenta; - Pixel colorBoldCyan; - Pixel colorBoldWhite; - Pixel pointerForeColor; - Pixel pointerBackColor; - XFontStruct *normalfont; - XFontStruct *boldfont; - char *bitmapFile; - char *composeKey; - Cursor pointer; - int shmmin; - int borderWidth; - int borderColor; - int clickPeriod; - int doubleClickPeriod; - int scrollbarWidth; -#if 0 - XtWidgetGeometry geometry; -#endif -} AppData; -AppData app_data; - -#define XCURSESNORMALFONTINFO app_data.normalfont -#define XCURSESBOLDFONTINFO app_data.boldfont -#define XCURSESLINES app_data.lines -#define XCURSESCOLS app_data.cols -#define XCURSESBITMAPFILE app_data.bitmapFile -#define XCURSESCOMPOSEKEY app_data.composeKey -#define XCURSESPOINTER app_data.pointer -#define XCURSESPOINTERFORECOLOR app_data.pointerForeColor -#define XCURSESPOINTERBACKCOLOR app_data.pointerBackColor -#define XCURSESCURSORCOLOR app_data.cursorColor -#define XCURSESSHMMIN app_data.shmmin -#define XCURSESBORDERWIDTH app_data.borderWidth -#define XCURSESBORDERCOLOR app_data.borderColor -#define XCURSESDOUBLECLICKPERIOD app_data.doubleClickPeriod -#define XCURSESCLICKPERIOD app_data.clickPeriod -#define XCURSESSCROLLBARWIDTH app_data.scrollbarWidth -#define XCURSESGEOMETRY app_data.geometry - -#define XCURSESDISPLAY (XtDisplay(drawing)) -#define XCURSESWIN (XtWindow(drawing)) - -#define MAX_COLORS 8 /* maximum of "normal" colours */ -#define COLOR_CURSOR 16 /* colour of cursor - 1 more than 2*MAX_COLORS */ -#define COLOR_BORDER 17 /* colour of border - 2 more than 2*MAX_COLORS */ -#define PDC_NUMBER_APP_RESOURCES 32 -#define PDC_NUMBER_OPTIONS 29 -#define PDC_NUMBER_XCURSES_ACTIONS 5 - -#include "x11.h" - -extern GC normal_gc,block_cursor_gc,rect_cursor_gc,normal_highlight_gc,bold_highlight_gc,border_gc; -extern int XCursesFontHeight,XCursesFontWidth; -extern int XCursesFontAscent,XCursesFontDescent; -extern int XCursesWindowWidth,XCursesWindowHeight; -extern int resizeXCursesWindowWidth,resizeXCursesWindowHeight; -extern char *bitmap_file; -extern MOUSE_STATUS Trapped_Mouse_status; -extern unsigned long pdc_key_modifier; -extern KeySym compose_key; -extern int compose_mask; -extern int state_mask[8]; -extern Atom wm_atom[2]; -extern XtTranslations XCursesTranslations; -extern char *defaultTranslations; -extern XtActionsRec XCursesActions[PDC_NUMBER_XCURSES_ACTIONS]; -extern char *XCursesClassName; -extern XtAppContext app_context; -extern Widget topLevel,drawing,d1,scrollBox,scrollVert,scrollHoriz; -extern int ReceivedMapNotify; -extern Boolean mouse_selection; -extern char *tmpsel; -extern unsigned long tmpsel_length; -extern int selection_start_x; -extern int selection_start_y; -extern int selection_end_x; -extern int selection_end_y; -extern Pixmap icon_pixmap; -extern XtResource app_resources[PDC_NUMBER_APP_RESOURCES]; -extern XrmOptionDescRec options[PDC_NUMBER_OPTIONS]; -extern char global_display_name[100]; -extern Bool after_first_curses_request; -extern char *XCursesProgramName; -extern int colors[(2*MAX_COLORS)+2]; -extern int windowEntered; - -typedef RETSIGTYPE (*signal_handler)(); -#ifdef PROTO -void XCursesNonmaskable(Widget w,XtPointer client_data,XEvent *event,Boolean *continue_to_dispatch); -void XCursesExpose(Widget w,XtPointer client_data,XEvent *event,Boolean *continue_to_dispatch); -signal_handler XCursesSetSignal(int,signal_handler); -void XCursesGetIcon(void); -int XCursesRefreshScrollbar(void); -int XCursesSendKeyToCurses(unsigned long, MOUSE_STATUS *); -void XCursesButton(Widget,XEvent *,String *,Cardinal *); -void Scroll_up_down(Widget w, XtPointer client_data, XtPointer call_data); -void Scroll_left_right(Widget w, XtPointer client_data, XtPointer call_data); -void Thumb_up_down(Widget w, XtPointer client_data, XtPointer call_data); -void Thumb_left_right(Widget w, XtPointer client_data, XtPointer call_data); -#else -void XCursesNonmaskable(); -void XCursesExpose(); -signal_handler XCursesSetSignal(); -void XCursesGetIcon(); -int XCursesRefreshScrollbar(); -int XCursesSendKeyToCurses(); -void XCursesButton(); -void Scroll_up_down(); -void Scroll_left_right(); -void Thumb_up_down(); -void Thumb_left_right(); -#endif diff --git a/x11/process/x11.c b/x11/process/x11.c deleted file mode 100644 index 8ee9d39dc..000000000 --- a/x11/process/x11.c +++ /dev/null @@ -1,1030 +0,0 @@ -/* -*************************************************************************** -* This file comprises part of PDCurses. PDCurses is Public Domain software. -* You may use this code for whatever purposes you desire. This software -* is provided AS IS with NO WARRANTY whatsoever. -* Should this software be used in another application, an acknowledgement -* that PDCurses code is used would be appreciated, but is not mandatory. -* -* Any changes which you make to this software which may improve or enhance -* it, should be forwarded to the current maintainer for the benefit of -* other users. -* -* The only restriction placed on this code is that no distribution of -* modified PDCurses code be made under the PDCurses name, by anyone -* other than the current maintainer. -* -* See the file maintain.er for details of the current maintainer. -* -* This file is NOT public domain software. It is Copyright, Mark Hessling -* 1994-2000. -*************************************************************************** -*/ - -#include "pdcx11.h" - -static int visible_cursor=0; -int windowEntered = 1; - -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesExitXCursesProcess(int rc,int sig,char *msg) -#else -void XCursesExitXCursesProcess(rc,sig,msg) -int rc,sig; -char *msg; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesExitXCursesProcess() - called: rc:%d sig:%d %s\n",(XCursesProcess)?" X":"CURSES",rc,sig,msg); -#endif - shmdt((char *)SP); - shmdt((char *)Xcurscr); - shmctl(shmidSP,IPC_RMID,0); - shmctl(shmid_Xcurscr,IPC_RMID,0); - XCursesEndwin(); - shutdown(display_sock,2); - close(display_sock); - shutdown(exit_sock,2); - close(exit_sock); - shutdown(key_sock,2); - close(key_sock); - if (sig) - kill(otherpid,sig); /* to kill parent process */ - _exit(rc); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesDisplayScreen(bool highlight) -#else -void XCursesDisplayScreen(highlight) -bool highlight; -#endif -/***********************************************************************/ -/*---------------------------------------------------------------------*/ -/* This function re-draws the entire screen. */ -/*---------------------------------------------------------------------*/ -{ - int row=0; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesDisplayScreen() - called:\n",(XCursesProcess)?" X":"CURSES"); -#endif - for (row=0;rowcursrow,SP->curscol, - SP->cursrow,SP->curscol); - /* - * Draw the border if required - */ - if (XCURSESBORDERWIDTH) - XDrawRectangle(XCURSESDISPLAY,XCURSESWIN,border_gc, - (XCURSESBORDERWIDTH/2),(XCURSESBORDERWIDTH/2), - (XCursesWindowWidth-XCURSESBORDERWIDTH), - (XCursesWindowHeight-XCURSESBORDERWIDTH)); - return; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCursesRefreshScreen(void) -#else -int XCursesRefreshScreen() -#endif -/***********************************************************************/ -/*---------------------------------------------------------------------*/ -/* This function draws those portions of the screen that have changed. */ -/*---------------------------------------------------------------------*/ -{ - int row=0,start_col=0,num_cols=0; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesRefreshScreen() - called:\n",(XCursesProcess)?" X":"CURSES"); -#endif - for (row=0;rowcursrow,SP->curscol, - SP->cursrow,SP->curscol); - return(0); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesProcessRequestsFromCurses(XtPointer client_data,int *fid,XtInputId *id) -#else -void XCursesProcessRequestsFromCurses(client_data,fid,id) -XtPointer client_data; -int *fid; -XtInputId *id; -#endif -/***********************************************************************/ -{ - int s,idx; - int old_row,new_row; - int old_x,new_x; - int pos,num_cols; - long length; - char buf[12]; /* big enough for 2 integers */ - char title[1024]; /* big enough for window title */ - unsigned char save_atrtab[MAX_ATRTAB]; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesProcessRequestsFromCurses()\n",(XCursesProcess)?" X":"CURSES"); -#endif - - if (!ReceivedMapNotify) - return; - FD_ZERO ( &readfds ); - FD_SET ( display_sock, &readfds ); - - if ( ( s = select ( FD_SETSIZE, (FD_SET_CAST)&readfds, NULL, NULL, &socket_timeout ) ) < 0 ) - XCursesExitXCursesProcess(2,SIGKILL,"exiting from XCursesProcessRequestsFromCurses - select failed"); - - if ( s == 0 ) /* no requests pending - should never happen!*/ - return; - - if ( FD_ISSET ( display_sock, &readfds ) ) - { -/* read first integer to determine total message has been received */ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesProcessRequestsFromCurses() - before read_socket()\n",(XCursesProcess)?" X":"CURSES"); -#endif - if (read_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(3,SIGKILL,"exiting from XCursesProcessRequestsFromCurses - first read"); -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesProcessRequestsFromCurses() - after read_socket()\n",(XCursesProcess)?" X":"CURSES"); -#endif - memcpy((char *)&num_cols,buf,sizeof(int)); - after_first_curses_request = True; - - switch(num_cols) - { - case 0: break; - case CURSES_EXIT: /* request from curses to stop */ - say("CURSES_EXIT received from child\n"); - XCursesExitXCursesProcess(0,0,"XCursesProcess requested to exit by child"); - break; - case CURSES_BELL: /* request from curses to beep */ - say("CURSES_BELL received from child\n"); - XBell(XCURSESDISPLAY,50); - break; - case CURSES_CLEAR: /* request from curses to clear window */ - say("CURSES_CLEAR received from child\n"); - XClearWindow(XCURSESDISPLAY,XCURSESWIN); - break; - case CURSES_FLASH: /* request from curses to beep */ - say("CURSES_FLASH received from child\n"); -#if 0 - XFillRectangle(XCURSESDISPLAY,XCURSESWIN,normal_highlight_gc,10,10,XCursesWindowWidth-10,XCursesWindowHeight-10); - delay_output(50); - XFillRectangle(XCURSESDISPLAY,XCURSESWIN,normal_highlight_gc,10,10,XCursesWindowWidth-10,XCursesWindowHeight-10); - XCursesDisplayCursor(SP->cursrow,SP->curscol, - SP->cursrow,SP->curscol); -#endif - old_x = CURSES_CONTINUE; - memcpy(buf,(char *)&old_x,sizeof(int)); - if (write_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesProcessRequestsFromCurses"); - break; - case CURSES_REFRESH: /* request from curses to confirm completion of display */ - say("CURSES_REFRESH received from child\n"); - visible_cursor = 1; - XCursesRefreshScreen(); - XCursesDisplayCursor(SP->cursrow,SP->curscol, - SP->cursrow,SP->curscol); - old_x = CURSES_CONTINUE; - memcpy(buf,(char *)&old_x,sizeof(int)); - if (write_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesProcessRequestsFromCurses"); - break; - case CURSES_REFRESH_SCROLLBAR: /* request from curses draw scrollbar */ - XCursesRefreshScrollbar(); -#if 0 - old_x = CURSES_CONTINUE; - memcpy(buf,(char *)&old_x,sizeof(int)); - if (write_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesProcessRequestsFromCurses"); -#endif - break; - case CURSES_CURSOR: /* display cursor */ - say("CURSES_CURSOR received from child\n"); - if (read_socket(display_sock,buf,sizeof(int)*2) < 0) - XCursesExitXCursesProcess(5,SIGKILL,"exiting from CURSES_CURSOR XCursesProcessRequestsFromCurses"); - memcpy((char *)&pos,buf,sizeof(int)); - old_row = pos & 0xFF; - old_x = pos >> 8; - idx = sizeof(int); - memcpy((char *)&pos,buf+idx,sizeof(int)); - new_row = pos & 0xFF; - new_x = pos >> 8; - visible_cursor = 1; - XCursesDisplayCursor(old_row,old_x,new_row,new_x); - break; - case CURSES_DISPLAY_CURSOR: /* display cursor */ - say("CURSES_DISPLAY_CURSOR received from child. Vis now: %d\n",visible_cursor); - /* - * If the window is not active, ignore this command. The - * cursor will stay solid. - */ - if ( windowEntered ) - { - if ( visible_cursor ) - { - /* - * Cursor currently ON, turn it off - */ - int save_visibility = SP->visibility; - SP->visibility = 0; - XCursesDisplayCursor(SP->cursrow,SP->curscol, - SP->cursrow,SP->curscol); - SP->visibility = save_visibility; - visible_cursor = 0; - } - else - { - /* - * Cursor currently OFF, turn it on - */ - XCursesDisplayCursor(SP->cursrow,SP->curscol, - SP->cursrow,SP->curscol); - visible_cursor = 1; - } - } - break; - case CURSES_TITLE: /* display window title */ - say("CURSES_TITLE received from child\n"); - if (read_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(5,SIGKILL,"exiting from CURSES_TITLE XCursesProcessRequestsFromCurses"); - memcpy((char *)&pos,buf,sizeof(int)); - if (read_socket(display_sock,title,pos) < 0) - XCursesExitXCursesProcess(5,SIGKILL,"exiting from CURSES_TITLE XCursesProcessRequestsFromCurses"); - XtVaSetValues(topLevel, XtNtitle, title, NULL); - break; - case CURSES_RESIZE: /* resize window */ - after_first_curses_request = False; - say("CURSES_RESIZE received from child\n"); - SP->lines = XCursesLINES = ((resizeXCursesWindowHeight-(2*XCURSESBORDERWIDTH)) / XCursesFontHeight); - LINES = XCursesLINES - SP->linesrippedoff - SP->slklines; - SP->cols = COLS = XCursesCOLS = ((resizeXCursesWindowWidth-(2*XCURSESBORDERWIDTH)) / XCursesFontWidth); - XCursesWindowWidth = resizeXCursesWindowWidth; - XCursesWindowHeight = resizeXCursesWindowHeight; - visible_cursor = 1; - /* - * Draw the border if required - */ - if (XCURSESBORDERWIDTH) - XDrawRectangle(XCURSESDISPLAY,XCURSESWIN,border_gc, - (XCURSESBORDERWIDTH/2),(XCURSESBORDERWIDTH/2), - (XCursesWindowWidth-XCURSESBORDERWIDTH), - (XCursesWindowHeight-XCURSESBORDERWIDTH)); -/* - * detach and drop the current shared memory segment and create and attach - * to a new segment. - */ - memcpy(save_atrtab,atrtab,sizeof(save_atrtab)); - SP->XcurscrSize = XCURSCR_SIZE; - shmdt((char *)Xcurscr); - shmctl(shmid_Xcurscr,IPC_RMID,0); - if ((shmid_Xcurscr = shmget(shmkey_Xcurscr,SP->XcurscrSize+XCURSESSHMMIN,0700|IPC_CREAT)) < 0) - { - perror("Cannot allocate shared memory for curscr"); - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesProcessRequestsFromCurses"); - } - Xcurscr = (unsigned char*)shmat(shmid_Xcurscr,0,0); - memset(Xcurscr, 0, SP->XcurscrSize); - atrtab = (unsigned char *)(Xcurscr+XCURSCR_ATRTAB_OFF); - memcpy(atrtab,save_atrtab,sizeof(save_atrtab)); - - old_x = CURSES_CONTINUE; - memcpy(buf,(char *)&old_x,sizeof(int)); - if (write_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesProcessRequestsFromCurses"); - break; - case CURSES_GET_SELECTION: /* request selection contents */ - say("CURSES_GET_SELECTION received from child\n"); - old_x = CURSES_CONTINUE; - memcpy(buf,(char *)&old_x,sizeof(int)); - if (write_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesProcessRequestsFromCurses"); - XtGetSelectionValue(topLevel,XA_PRIMARY,XA_STRING,XCursesRequestorCallbackForGetSelection,(XtPointer)NULL,0); - break; - case CURSES_SET_SELECTION: /* set the selection contents */ - say("CURSES_SET_SELECTION received from child\n"); - if (read_socket(display_sock,buf,sizeof(long)) < 0) - XCursesExitXCursesProcess(5,SIGKILL,"exiting from CURSES_TITLE XCursesProcessRequestsFromCurses"); - memcpy((char *)&length,buf,sizeof(long)); - if (length > tmpsel_length) - { - if (tmpsel_length == 0) - tmpsel = (char *)malloc(length+1); - else - tmpsel = (char *)realloc(tmpsel,length+1); - } - if (!tmpsel) - { - old_x = PDC_CLIP_MEMORY_ERROR; - memcpy(buf,(char *)&old_x,sizeof(int)); - if (write_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesProcessRequestsFromCurses"); - break; - } - if (read_socket(display_sock,tmpsel,length) < 0) - XCursesExitXCursesProcess(5,SIGKILL,"exiting from CURSES_TITLE XCursesProcessRequestsFromCurses"); - tmpsel_length = length; - *(tmpsel+length) = '\0'; - if (XtOwnSelection(topLevel, - XA_PRIMARY, - CurrentTime, - XCursesConvertProc, - XCursesLoseOwnership, - NULL) == False) - { - old_x = PDC_CLIP_ACCESS_ERROR; - free(tmpsel); - tmpsel = NULL; - tmpsel_length = 0; - } - else - old_x = PDC_CLIP_SUCCESS; - SelectionOff(); - memcpy(buf,(char *)&old_x,sizeof(int)); - if (write_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesProcessRequestsFromCurses"); - break; - default: -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:Unknown request %d\n",(XCursesProcess)?" X":"CURSES",num_cols); -#endif - break; - } - } - return; -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCursesSetupX(char *display_name,int argc, char *argv[]) -#else -int XCursesSetupX(display_name,argc,argv) -char *display_name; -int arc; -char *argv[]; -#endif -/***********************************************************************/ -{ - extern bool sb_started; - - XColor pointerforecolor,pointerbackcolor; - XrmValue rmfrom,rmto; - char wait_buf[5]; - int wait_value=0,i=0; - int minwidth=0,minheight=0; - int myargc; - char *myargv[2]; -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesSetupX called\n",(XCursesProcess)?" X":"CURSES"); -#endif - - /* - * The following kludge is to force XtVaAppInitialize() to recognize the - * name of the program. Without it, a default value of "main" is used. - */ - if (argv) - { - argv[0] = XCursesProgramName; -#ifdef PDCDEBUG1 - for (i=0;i %s\n",i,argv[i]); -#endif - } - else - { - /* - * initscr() called rather than initscrX() - */ - myargv[0] = XCursesProgramName; - myargv[1] = NULL; - myargc=1; - } - - /* - * Keep open the 'write' end of the socket so the XCurses process can - * send a CURSES_EXIT to itself from within the signal handler... - */ -#if 0 - close ( display_sockets[0] ); -#else - exit_sock = display_sockets[0]; -#endif - display_sock = display_sockets[1]; - close ( key_sockets[0] ); - key_sock = key_sockets[1]; - /* - * Trap all signals when XCurses is the child process... - */ - for (i=0;i 4 - XtSetLanguageProc(NULL, (XtLanguageProc)NULL,NULL); -#endif - /* - * If a DISPLAY value has been supplied, set the env variable DISPLAY. - */ - if (display_name) - { - strcpy(global_display_name,"DISPLAY="); - strcat(global_display_name,display_name); - putenv(global_display_name); - } - /* - * Exit if no DISPLAY variable set... - */ - if (getenv("DISPLAY") == NULL) - { - fprintf(stderr,"Error: no DISPLAY variable set\n"); - kill(otherpid,SIGKILL); - return(ERR); - } - /* - * Initialise the top level widget... - */ - if (argv) - { - topLevel = XtVaAppInitialize( &app_context, - XCursesClassName, - options, - XtNumber(options), - &argc, - argv, - NULL, -/* - XtNinput, (XtArgVal)True, - XtNtitle,XCursesProgramName, - XtNname,"xcurses", -*/ - NULL); - } - else - { - topLevel = XtVaAppInitialize( &app_context, - XCursesClassName, - options, - XtNumber(options), - &myargc, - myargv, - NULL, -/* - XtNinput, (XtArgVal)True, - XtNtitle,XCursesProgramName, - XtNname,"xcurses", -*/ - NULL); - } -#ifdef PDCDEBUG1 - for (i=0;i %s\n",i,argv[i]); -#endif - - XtVaGetApplicationResources(topLevel,&app_data,app_resources,XtNumber(app_resources),NULL); - /* check application resource values here... */ - -#if 0 -printf("Width %d Height %d\n",XCURSESGEOMETRY.width,XCURSESGEOMETRY.height); -#endif - - XCursesFontWidth = XCURSESNORMALFONTINFO->max_bounds.rbearing - XCURSESNORMALFONTINFO->min_bounds.lbearing; - XCursesFontHeight = XCURSESNORMALFONTINFO->max_bounds.ascent + XCURSESNORMALFONTINFO->max_bounds.descent; - XCursesFontAscent = XCURSESNORMALFONTINFO->max_bounds.ascent; - XCursesFontDescent = XCURSESNORMALFONTINFO->max_bounds.descent; -#if 0 - /* - * Check that the bold font and normal fonts are the same size... - */ - if (XCursesFontWidth != XCURSESBOLDFONTINFO->max_bounds.rbearing - XCURSESBOLDFONTINFO->min_bounds.lbearing - || XCursesFontHeight != XCURSESBOLDFONTINFO->max_bounds.ascent + XCURSESBOLDFONTINFO->max_bounds.descent) - { - fprintf(stderr,"Error: normal font and bold font are different sizes\n"); - fprintf(stderr,"\tNormal\tBold\n"); - fprintf(stderr,"Width :\t%d\t%d\n",XCursesFontWidth,XCURSESBOLDFONTINFO->max_bounds.rbearing - XCURSESBOLDFONTINFO->min_bounds.lbearing); - fprintf(stderr,"Height:\t%d\t%d\n",XCursesFontHeight,XCURSESBOLDFONTINFO->max_bounds.ascent + XCURSESBOLDFONTINFO->max_bounds.descent); - kill(otherpid,SIGKILL); - return(ERR); - } -#endif - /* - * Calculate size of display window... - */ - XCursesCOLS = XCURSESCOLS; - XCursesLINES = XCURSESLINES; - XCursesWindowWidth = (XCursesFontWidth * XCursesCOLS) + (2 * XCURSESBORDERWIDTH); - XCursesWindowHeight = (XCursesFontHeight * XCursesLINES) + (2 * XCURSESBORDERWIDTH); - minwidth = (XCursesFontWidth*2)+(XCURSESBORDERWIDTH*2); - minheight = (XCursesFontHeight*2)+(XCURSESBORDERWIDTH*2); - /* - * Set up the icon for the application. The default is an internal one - * for XCurses. Then set various application level resources... - */ - XCursesGetIcon(); - - XtVaSetValues(topLevel, - XtNwidthInc,XCursesFontWidth, - XtNheightInc,XCursesFontHeight, - XtNminWidth,minwidth, - XtNminHeight,minheight, - XtNiconPixmap,icon_pixmap, - NULL); - /* - * Create a BOX widget in which to draw... - */ -#if 0 - fprintf(stderr,"Width: %d Height: %d sb_started: %d\n",XCursesWindowWidth+XCURSESSCROLLBARWIDTH, - XCursesWindowHeight+XCURSESSCROLLBARWIDTH,sb_started); -#endif - if (XCURSESSCROLLBARWIDTH != 0 - && sb_started) - { - scrollBox = XtVaCreateManagedWidget(XCursesProgramName,scrollBoxWidgetClass,topLevel, - XtNwidth,XCursesWindowWidth+XCURSESSCROLLBARWIDTH+8+2, - XtNheight,XCursesWindowHeight+XCURSESSCROLLBARWIDTH+8+2, - NULL); - drawing = XtVaCreateManagedWidget(XCursesProgramName,boxWidgetClass, - scrollBox, - XtNwidth,XCursesWindowWidth, - XtNheight,XCursesWindowHeight, - XtNwidthInc,XCursesFontWidth, - XtNheightInc,XCursesFontHeight, - NULL); - scrollVert = XtVaCreateManagedWidget("scrollVert", scrollbarWidgetClass, - scrollBox, - XtNorientation, XtorientVertical, - XtNheight, XCursesWindowHeight, - XtNwidth, XCURSESSCROLLBARWIDTH, - NULL); - XtAddCallback(scrollVert, XtNscrollProc, Scroll_up_down, drawing); - XtAddCallback(scrollVert, XtNjumpProc, Thumb_up_down, drawing); - scrollHoriz = XtVaCreateManagedWidget("scrollHoriz", scrollbarWidgetClass, - scrollBox, - XtNorientation, XtorientHorizontal, - XtNwidth, XCursesWindowWidth, - XtNheight, XCURSESSCROLLBARWIDTH, - NULL); - XtAddCallback(scrollHoriz, XtNscrollProc, Scroll_left_right, drawing); - XtAddCallback(scrollHoriz, XtNjumpProc, Thumb_left_right, drawing); - } - else - { - drawing = XtVaCreateManagedWidget(XCursesProgramName,boxWidgetClass,topLevel, - XtNwidth,XCursesWindowWidth, - XtNheight,XCursesWindowHeight, - NULL); - } - -#if 0 - fprintf(stderr,"Width: %d Height: %d\n",XCursesWindowWidth+XCURSESSCROLLBARWIDTH, - XCursesWindowHeight+XCURSESSCROLLBARWIDTH); -#endif -/* - XtVaSetValues(drawing, - XtNwidth,XCursesWindowWidth, - XtNheight,XCursesWindowHeight, - XtNwidthInc,XCursesFontWidth, - XtNheightInc,XCursesFontHeight, - XtNminWidth,XCursesFontWidth*2, - XtNminHeight,XCursesFontHeight*2, - XtNborderWidth,20, - NULL); -*/ - /* - * Process any default translations... - */ - XCursesTranslations = XtParseTranslationTable(defaultTranslations); - XtAugmentTranslations(drawing,XCursesTranslations); - XtAppAddActions(app_context,XCursesActions,XtNumber(XCursesActions)); - /* - * Process the supplied colors... - */ - if (get_colors() == ERR) - { - kill(otherpid,SIGKILL); - return(ERR); - } - /* - * Now have LINES and COLS. Set these in the shared SP so the - * curses program can find them... - */ - LINES = XCursesLINES; - COLS = XCursesCOLS; - if ((shmidSP = shmget(shmkeySP,sizeof(SCREEN)+XCURSESSHMMIN,0700|IPC_CREAT)) < 0) - { - perror("Cannot allocate shared memory for SCREEN"); - kill(otherpid,SIGKILL); - return(ERR); - } - SP = (SCREEN*)shmat(shmidSP,0,0); - memset(SP, 0, sizeof(SCREEN)); - SP->XcurscrSize = XCURSCR_SIZE; - SP->lines = XCursesLINES; - SP->cols = XCursesCOLS; -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:SHM size for curscr %d\n",(XCursesProcess)?" X":"CURSES",SP->XcurscrSize); -#endif - if ((shmid_Xcurscr = shmget(shmkey_Xcurscr,SP->XcurscrSize+XCURSESSHMMIN,0700|IPC_CREAT)) < 0) - { - perror("Cannot allocate shared memory for curscr"); - kill(otherpid,SIGKILL); - shmdt((char *)SP); - shmctl(shmidSP,IPC_RMID,0); - return(ERR); - } - Xcurscr = (unsigned char *)shmat(shmid_Xcurscr,0,0); - memset(Xcurscr, 0, SP->XcurscrSize); - atrtab = (unsigned char *)(Xcurscr+XCURSCR_ATRTAB_OFF); - PDC_init_atrtab(); -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:shmid_Xcurscr %d shmkey_Xcurscr %d LINES %d COLS %d\n",(XCursesProcess)?" X":"CURSES",shmid_Xcurscr,shmkey_Xcurscr,LINES,COLS); -#endif - /* - * Add Event handlers to the drawing widget... - */ - XtAddEventHandler(drawing,ExposureMask,False,XCursesExpose,NULL); - /* XtAddEventHandler(drawing,KeyPressMask|KeyReleaseMask,False,XCursesKeyPressKeyRelease,NULL); */ - /* XtAddEventHandler(drawing,ButtonPressMask|ButtonReleaseMask,False,XCursesButtonPressButtonRelease,NULL);*/ - XtAddEventHandler(drawing,StructureNotifyMask,False,XCursesStructureNotify,NULL); - XtAddEventHandler(drawing,EnterWindowMask|LeaveWindowMask,False,XCursesEnterLeaveWindow,NULL); -#if 0 - XtAddEventHandler(drawing,0,True,XCursesNonmaskable,NULL); -#endif - XtAddEventHandler(topLevel,0,True,XCursesNonmaskable,NULL); - /* - * Add input handler form display_sock (requests from curses program) - */ - XtAppAddInput(app_context,display_sock,(XtPointer)XtInputReadMask,XCursesProcessRequestsFromCurses,NULL); - /* - * Leave telling the curses process that it can start to here so that - * when the curses process makes a request, the Xcurses process can - * service the request... - */ - wait_value = CURSES_CHILD; - memcpy(wait_buf,(char *)&wait_value,sizeof(int)); - (void)write_socket(display_sock,wait_buf,sizeof(int)); - /* - * Realize the widget... - */ - XtRealizeWidget(topLevel); - /* - * Handle trapping of the WM_DELETE_WINDOW property... - */ - wm_atom[0] = XInternAtom(XtDisplay(topLevel),"WM_DELETE_WINDOW",False); - wm_atom[1] = XInternAtom(XtDisplay(topLevel),"WM_SAVE_YOURSELF",False); - /* (void)XSetWMProtocols(XtDisplay(topLevel),RootWindowOfScreen(XtScreen(topLevel)),&wm_delete_window_atom,1);*/ - /* (void)XSetWMProtocols(XtDisplay(topLevel),XCURSESWIN,&wm_delete_window_atom,1);*/ - (void)XSetWMProtocols(XtDisplay(topLevel),XtWindow(topLevel),wm_atom,2); - /* - * Create the Graphics Context for drawing. This MUST be done AFTER the - * associated widget has been realized... - */ -#ifdef PDCDEBUG - say("before get_GC\n"); -#endif - get_GC(XCURSESDISPLAY,XCURSESWIN,&normal_gc,XCURSESNORMALFONTINFO,COLOR_WHITE,COLOR_BLACK,FALSE); - get_GC(XCURSESDISPLAY,XCURSESWIN,&normal_highlight_gc,XCURSESNORMALFONTINFO,COLOR_WHITE,COLOR_BLACK,TRUE); - get_GC(XCURSESDISPLAY,XCURSESWIN,&bold_highlight_gc,XCURSESBOLDFONTINFO,COLOR_WHITE,COLOR_BLACK,TRUE); - get_GC(XCURSESDISPLAY,XCURSESWIN,&block_cursor_gc,XCURSESNORMALFONTINFO,COLOR_BLACK,COLOR_CURSOR,FALSE); - get_GC(XCURSESDISPLAY,XCURSESWIN,&rect_cursor_gc,XCURSESNORMALFONTINFO,COLOR_CURSOR,COLOR_BLACK,FALSE); - get_GC(XCURSESDISPLAY,XCURSESWIN,&border_gc,XCURSESNORMALFONTINFO,COLOR_BORDER,COLOR_BLACK,FALSE); - /* - XSetLineAttributes(XCURSESDISPLAY,normal_gc,2,LineSolid,CapButt,JoinMiter); - */ - XSetLineAttributes(XCURSESDISPLAY,rect_cursor_gc,2,LineSolid,CapButt,JoinMiter); - XSetLineAttributes(XCURSESDISPLAY,border_gc,XCURSESBORDERWIDTH,LineSolid,CapButt,JoinMiter); - /* - * Set the cursor for the application... - */ - XDefineCursor(XCURSESDISPLAY,XCURSESWIN,XCURSESPOINTER); - rmfrom.size = sizeof(Pixel); - rmto.size = sizeof(XColor); -#if XtSpecificationRelease > 4 - rmto.addr = (XPointer)&pointerforecolor; - rmfrom.addr = (XPointer)&(XCURSESPOINTERFORECOLOR); - XtConvertAndStore(drawing,XtRPixel,&rmfrom,XtRColor,&rmto); -#else - rmto.addr = (char *)&pointerforecolor; - rmfrom.addr = (char *)&(XCURSESPOINTERFORECOLOR); - XtConvert(drawing,XtRPixel,&rmfrom,XtRColor,&rmto); -#endif - rmfrom.size = sizeof(Pixel); - rmto.size = sizeof(XColor); -#if XtSpecificationRelease > 4 - rmfrom.addr = (XPointer)&(XCURSESPOINTERBACKCOLOR); - rmto.addr = (XPointer)&pointerbackcolor; - XtConvertAndStore(drawing,XtRPixel,&rmfrom,XtRColor,&rmto); -#else - rmfrom.addr = (char *)&(XCURSESPOINTERBACKCOLOR); - rmto.addr = (char *)&pointerbackcolor; - XtConvert(drawing,XtRPixel,&rmfrom,XtRColor,&rmto); -#endif - XRecolorCursor(XCURSESDISPLAY,XCURSESPOINTER,&pointerforecolor,&pointerbackcolor); - /* - * Convert the supplied compose key to a Keysym... - */ - compose_key = XStringToKeysym(XCURSESCOMPOSEKEY); - if (compose_key - && IsModifierKey(compose_key)) - { - register int i=0,j=0; - KeyCode *kcp; - XModifierKeymap *map; - KeyCode compose_keycode=XKeysymToKeycode(XCURSESDISPLAY,compose_key); - map = XGetModifierMapping(XCURSESDISPLAY); - kcp = map->modifiermap; - for (i=0;i<8;i++) - { - for (j=0;jmax_keypermod;j++,kcp++) - { - if (!*kcp) - continue; - if (compose_keycode == *kcp) - { - compose_mask = state_mask[i]; - break; - } - } - if (compose_mask) - break; - } - XFreeModifiermap(map); - } - /* fprintf(stderr,"COMPOSE KEY: %d %s STATE: %d\n",compose_key,XCURSESCOMPOSEKEY,compose_mask);*/ - -#ifdef FOREIGN - sleep(20); - if ((Xim = XOpenIM(XCURSESDISPLAY,NULL,NULL,NULL)) == NULL) - { - perror("Cannot open Input Method"); - kill(otherpid,SIGKILL); - shmdt((char *)SP); - shmdt((char *)Xcurscr); - shmctl(shmidSP,IPC_RMID,0); - shmctl(shmid_Xcurscr,IPC_RMID,0); - return(ERR); - } - XGetIMValues(Xim,XNQueryInputStyle, &im_supported_styles, NULL); - my_style = XIMPreeditNone|XIMStatusNone; - /* call XtCvtStringToFontSet ??? */ - if ((Xic = XCreateIC(Xim, XNInputStyle, my_style, - /* - - */ - NULL)) == NULL) - { - perror("ERROR: Cannot create input context"); - kill(otherpid,SIGKILL); - shmdt((char *)SP); - shmdt((char *)Xcurscr); - shmctl(shmidSP,IPC_RMID,0); - shmctl(shmid_Xcurscr,IPC_RMID,0); - return(ERR); - } - XFree(im_supported_styles); - XGetICValues(Xic, XNFilterEvents, &im_event_mask, NULL); - XtAddEventHandler(drawing,im_event_mask,False,NULL,NULL); - XSetICFocus(Xic); -#endif - /* - * Wait for events... - */ - XtAppMainLoop(app_context); - return(OK); /* won't get here */ -} -/***********************************************************************/ -#ifdef HAVE_PROTO -RETSIGTYPE XCursesSignalHandler(int signo) -#else -RETSIGTYPE XCursesSignalHandler(signo) -int signo; -#endif -/***********************************************************************/ -{ - char buf[10]; - int flag = CURSES_EXIT; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesSignalHandler() - called: %d\n",(XCursesProcess)?" X":"CURSES",signo); -#endif - /* - * Patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 04-Dec-1998 - */ - XCursesSetSignal(signo,XCursesSignalHandler); -#ifdef SIGTSTP - if (signo == SIGTSTP) { pause(); return; } -#endif -#ifdef SIGCONT - if (signo == SIGCONT) return; -#endif -#ifdef SIGCLD - if (signo == SIGCLD) return; -#endif -#ifdef SIGTTIN - if (signo == SIGTTIN) return; -#endif -#ifdef SIGWINCH - if (signo == SIGWINCH) return; -#endif - /* - * End of patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 04-Dec-1998 - */ - XCursesSetSignal(signo,SIG_IGN); - /* - * Send a CURSES_EXIT to myself... - */ - memcpy(buf,(char *)&flag,sizeof(int)); - if (write_socket(exit_sock,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(7,signo,"exitting from XCursesSignalHandler"); -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesRequestorCallbackForGetSelection(Widget w,XtPointer data, Atom *selection, - Atom *type, XtPointer value, - unsigned long *length, int *format) -#else -void XCursesRequestorCallbackForGetSelection(w,data,selection,type,value,length,format) -Widget w; -XtPointer data; -Atom *selection; -Atom *type; -XtPointer value; -unsigned long *length; -int *format; -#endif -/***********************************************************************/ -{ - int rc; - char buf[12]; /* big enough for 2 integers */ - char *string=(char *)value; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesRequestorCallbackForSelection() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - - if ((value == NULL) && (*length == 0)) - { - rc = PDC_CLIP_EMPTY; - memcpy(buf,(char *)&rc,sizeof(int)); - if (write_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesRequestorCallbackForGetSelection"); - return; - } - /* - * Here all is OK, send PDC_CLIP_SUCCESS, then length, then contents - */ - rc = PDC_CLIP_SUCCESS; - memcpy(buf,(char *)&rc,sizeof(int)); - if (write_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesRequestorCallbackForGetSelection"); - - rc = *(length); - memcpy(buf,(char *)&rc,sizeof(int)); - if (write_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesRequestorCallbackForGetSelection"); - - if (write_socket(display_sock,string,*length) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesRequestorCallbackForGetSelection"); - - return; -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesStructureNotify(Widget w,XtPointer client_data,XEvent *event,Boolean *continue_to_dispatch) -#else -void XCursesStructureNotify(w,client_data,event,continue_to_dispatch) -Widget w; -XtPointer client_data; -XEvent *event; -Boolean *continue_to_dispatch; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesStructureNotify called\n",(XCursesProcess)?" X":"CURSES"); -#endif - -#if 0 -printf("Notify: %d\n",event->type); -#endif - switch(event->type) - { - case ConfigureNotify: -#ifdef PDCDEBUG - say("ConfigureNotify received\n"); -#endif - /* window has been resized, change width and - * height to send to place_text and place_graphics - * in next Expose. - * Also will need to kill (SIGWINCH) curses process if screen - * size changes - */ - resizeXCursesWindowWidth = (event->xconfigure.width); - resizeXCursesWindowHeight = (event->xconfigure.height); - after_first_curses_request = False; -#ifdef SIGWINCH -# ifdef BEFORE_CHANGE_BY_G_FUCHS -/* - * Patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999 - */ -# else - SP->resized = 1; -# endif - kill(otherpid,SIGWINCH); -#endif -#if 000 - SP->lines = XCursesLINES = ((resizeXCursesWindowHeight-(2*XCURSESBORDERWIDTH)) / XCursesFontHeight); - LINES = XCursesLINES - SP->linesrippedoff - SP->slklines; - SP->cols = COLS = XCursesCOLS = ((resizeXCursesWindowWidth-(2*XCURSESBORDERWIDTH)) / XCursesFontWidth); -printf("X11:LINES %d COLS %d\n",SP->lines, SP->cols); -#endif - XCursesSendKeyToCurses( (unsigned long)KEY_RESIZE, NULL ); - break; - case MapNotify: -#ifdef PDCDEBUG - say("MapNotify received\n"); -#endif - ReceivedMapNotify=1; - /* - * Draw the window border - */ - if (XCURSESBORDERWIDTH) - XDrawRectangle(XCURSESDISPLAY,XCURSESWIN,border_gc, - (XCURSESBORDERWIDTH/2),(XCURSESBORDERWIDTH/2), - (XCursesWindowWidth-XCURSESBORDERWIDTH), - (XCursesWindowHeight-XCURSESBORDERWIDTH)); - break; - default: -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesStructureNotify - unknown event %d\n",(XCursesProcess)?" X":"CURSES",event->type); -#endif - break; - } - return; -} diff --git a/x11/process/x11.h b/x11/process/x11.h deleted file mode 100644 index b635656b8..000000000 --- a/x11/process/x11.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifdef HAVE_PROTO -void dummy_function(void); -void get_GC(Display *,Window, GC *, XFontStruct *,int ,int, bool ); -void makeXY(int ,int ,int ,int ,int *,int *); -int get_colors(void); -void start_event_handler(void); -int XCursesTransformLine(int ,int ,chtype ,int ,int,int,char *); -int XCursesDisplayText(chtype *, int, int, int,bool); -void XCursesDisplayScreen(bool); -void XCursesDisplayCursor( int ,int ,int ,int ); -void XCursesStructureNotify(Widget,XtPointer ,XEvent *,Boolean *); -void XCursesEnterLeaveWindow(Widget,XtPointer ,XEvent *,Boolean *); -void XCursesPasteSelection(Widget,XButtonEvent *); -void XCursesHandleString(Widget,XEvent *,String *,Cardinal *); -void XCursesKeyPress(Widget,XEvent *,String *,Cardinal *); -void XCursesModifierPress(Widget,XEvent *,String *,Cardinal *); -void XCursesButton(Widget,XEvent *,String *,Cardinal *); -Boolean XCursesConvertProc(Widget,Atom *,Atom *,Atom *,XtPointer *,unsigned long *,int *); -void XCursesLoseOwnership(Widget,Atom *); -void XCursesRequestorCallbackForPaste(Widget,XtPointer,Atom *,Atom *,XtPointer,unsigned long *,int *); -void XCursesRequestorCallbackForGetSelection(Widget,XtPointer,Atom *,Atom *,XtPointer,unsigned long *,int *); -RETSIGTYPE XCursesSignalHandler(int); -void XCursesExitXCursesProcess(int,int,char *); -void SelectionOff(void); -void SelectionOn(int,int); -void SelectionExtend(int,int); -void SelectionSet( void ); - -int write_socket(int,char *,int); -int read_socket(int,char *,int); -int XCursesSetupX(char *display_name,int argc, char *argv[]); -RETSIGTYPE XCursesSigwinchHandler(int signo); -#else -void dummy_function(void); -void get_GC(); -void makeXY(); -int get_colors(); -void start_event_handler(); -int XCursesTransformLine(); -int XCursesDisplayText(); -void XCursesDisplayScreen(); -void XCursesDisplayCursor(); -void XCursesStructureNotify(); -void XCursesEnterLeaveWindow(); -void XCursesHandleString(); -void XCursesKeyPress(); -void XCursesModifierPress(); -void XCursesButton(); -void XCursesPasteSelection(); -Boolean XCursesConvertProc(); -void XCursesLoseOwnership(); -void XCursesRequestorCallbackForPaste(); -void XCursesRequestorCallbackForGetSelection(); -RETSIGTYPE XCursesSignalHandler(); -void XCursesExitXCursesProcess(); -void SelectionOff(); -void SelectionOn(); -void SelectionExtend(); -void SelectionSet(); - -int write_socket(); -int read_socket(); -int XCursesSetupX(); -RETSIGTYPE XCursesSigwinchHandler(); -#endif - -#ifdef _HPUX_SOURCE -# define FD_SET_CAST int * -#else -# define FD_SET_CAST fd_set * -#endif -extern fd_set readfds; -extern fd_set writefds; -extern struct timeval socket_timeout; - -extern unsigned char *Xcurscr; -extern int XCursesProcess; -extern int shmidSP; -extern int shmid_Xcurscr; -extern int shmkeySP; -extern int shmkey_Xcurscr; -extern int otherpid; -extern int XCursesLINES; -extern int XCursesCOLS; -extern unsigned char *atrtab; -extern int display_sock; -extern int key_sock; -extern int display_sockets[2]; -extern int key_sockets[2]; -extern int exit_sock; diff --git a/x11/process/x11common.c b/x11/process/x11common.c deleted file mode 100644 index 8870f8bd1..000000000 --- a/x11/process/x11common.c +++ /dev/null @@ -1,143 +0,0 @@ -/* -*************************************************************************** -* This file comprises part of PDCurses. PDCurses is Public Domain software. -* You may use this code for whatever purposes you desire. This software -* is provided AS IS with NO WARRANTY whatsoever. -* Should this software be used in another application, an acknowledgement -* that PDCurses code is used would be appreciated, but is not mandatory. -* -* Any changes which you make to this software which may improve or enhance -* it, should be forwarded to the current maintainer for the benefit of -* other users. -* -* The only restriction placed on this code is that no distribution of -* modified PDCurses code be made under the PDCurses name, by anyone -* other than the current maintainer. -* -* See the file maintain.er for details of the current maintainer. -* -* This file is NOT public domain software. It is Copyright, Mark Hessling -* 1994-2000. -*************************************************************************** -*/ - -#include "pdcx11.h" -/* - * Variables specific to process port - */ -unsigned char *Xcurscr; -int XCursesProcess=1; -int shmidSP; -int shmid_Xcurscr; -int shmkeySP; -int shmkey_Xcurscr; -int otherpid; -int XCursesLINES=24; -int XCursesCOLS=80; -int display_sock; -int key_sock; -int display_sockets[2]; -int key_sockets[2]; -int exit_sock; - -fd_set readfds; -fd_set writefds; -struct timeval socket_timeout; - -/***********************************************************************/ -#ifdef HAVE_PROTO -int write_socket(int sock_num,char *buf,int len) -#else -int write_socket(sock_num,buf,len) -int sock_num; -char *buf; -int len; -#endif -/***********************************************************************/ -{ - int start=0,length=len,rc; -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:write_socket called: sock_num %d len %d\n",(XCursesProcess)?" X":"CURSES",sock_num,len); -#endif -#ifdef MOUSE_DEBUG1 -if (sock_num == key_sock) - printf("%s:write_socket(key) len: %d\n",(XCursesProcess)?" X":"CURSES",len); -#endif - while(1) - { - rc = write(sock_num,buf+start,length); - if (rc < 0 - || rc == length) - return(rc); - length -= rc; - start = rc; - } -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int read_socket(int sock_num,char *buf,int len) -#else -int read_socket(sock_num,buf,len) -int sock_num; -char *buf; -int len; -#endif -/***********************************************************************/ -{ - int start=0,length=len,rc; -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:read_socket called: sock_num %d len %d\n",(XCursesProcess)?" X":"CURSES",sock_num,len); -#endif - while(1) - { - rc = read(sock_num,buf+start,length); -#ifdef MOUSE_DEBUG1 - if (sock_num == key_sock) - printf("%s:read_socket(key) rc %d errno %d resized: %d\n",(XCursesProcess)?" X":"CURSES", - rc,errno,SP->resized); -#endif - if (rc < 0 - && sock_num == key_sock - && errno == EINTR -#ifdef BEFORE_CHANGE_BY_G_FUCHS -/* - * Patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999 - */ - && SP->resized == TRUE) - { -#ifdef MOUSE_DEBUG1 - printf("%s:continuing\n",(XCursesProcess)?" X":"CURSES"); -#endif - rc = 0; -#else - && SP->resized != FALSE) - { -#ifdef MOUSE_DEBUG1 - printf("%s:continuing\n",(XCursesProcess)?" X":"CURSES"); -#endif - rc = 0; - if (SP->resized > 1) - SP->resized = TRUE; - else - SP->resized = FALSE; -#endif - memcpy(buf,(char *)&rc,sizeof(int)); - return(0); /* must be >= 0 to avoid error */ - } - -#ifdef BEFORE_CHANGE_BY_G_FUCHS -/* - * Patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999 - */ - if (rc < 0 -#else - if (rc <= 0 -#endif - || rc == length) - return(rc); - length -= rc; - start = rc; - } -} diff --git a/x11/process/x11curses.c b/x11/process/x11curses.c deleted file mode 100644 index 48511c35c..000000000 --- a/x11/process/x11curses.c +++ /dev/null @@ -1,655 +0,0 @@ -/* -*************************************************************************** -* This file comprises part of PDCurses. PDCurses is Public Domain software. -* You may use this code for whatever purposes you desire. This software -* is provided AS IS with NO WARRANTY whatsoever. -* Should this software be used in another application, an acknowledgement -* that PDCurses code is used would be appreciated, but is not mandatory. -* -* Any changes which you make to this software which may improve or enhance -* it, should be forwarded to the current maintainer for the benefit of -* other users. -* -* The only restriction placed on this code is that no distribution of -* modified PDCurses code be made under the PDCurses name, by anyone -* other than the current maintainer. -* -* See the file maintain.er for details of the current maintainer. -* -* This file is NOT public domain software. It is Copyright, Mark Hessling -* 1994-2000. -*************************************************************************** -*/ - -/* - * This file contains functions that are called by the "curses" process; - * ie the parent process. - */ - -#include "pdcx11.h" - -#ifdef PROTO -static void XCursesExitCursesProcess(int, char *); -#else -static void XCursesExitCursesProcess(); -#endif - -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCursesResizeScreen(int nlines, int ncols) -#else -int XCursesResizeScreen(nlines, ncols) -int nlines,ncols; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesResizeScreen() - called: Lines: %d Cols: %d\n",(XCursesProcess)?" X":"CURSES",nlines,ncols); -#endif - shmdt((char *)Xcurscr); - XCursesInstructAndWait(CURSES_RESIZE); - if ((shmid_Xcurscr = shmget(shmkey_Xcurscr,SP->XcurscrSize+XCURSESSHMMIN,0700)) < 0) - { - perror("Cannot allocate shared memory for curscr"); - kill(otherpid,SIGKILL); - return(ERR); - } - XCursesLINES = SP->lines; - XCursesCOLS = SP->cols; -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:shmid_Xcurscr %d shmkey_Xcurscr %d SP->lines %d SP->cols %d\n",(XCursesProcess)?" X":"CURSES",shmid_Xcurscr,shmkey_Xcurscr,SP->lines,SP->cols); -#endif - Xcurscr = (unsigned char*)shmat(shmid_Xcurscr,0,0); - atrtab = (unsigned char *)(Xcurscr+XCURSCR_ATRTAB_OFF); - SP->resized=FALSE; - return(OK); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCurses_display_cursor(int oldrow, int oldcol, int newrow,int newcol,int visibility) -#else -int XCurses_display_cursor(oldrow,oldcol,newrow,newcol,visibility) -int oldrow,oldcol,newrow,newcol,visibility; -#endif -/***********************************************************************/ -{ - char buf[30]; - int idx,pos; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_display_cursor() - called: NEW row %d col %d, vis %d\n", - (XCursesProcess)?"X":"CURSES",newrow,newcol,visibility); -#endif - - if ( visibility == -1 ) - { - /* - * Only send the CURSES_DISPLAY_CURSOR message, no data - */ - idx = CURSES_DISPLAY_CURSOR; - memcpy(buf,(char *)&idx,sizeof(int)); - idx = sizeof(int); - } - else - { - idx = CURSES_CURSOR; - memcpy(buf,(char *)&idx,sizeof(int)); - idx = sizeof(int); - pos = oldrow + (oldcol << 8); - memcpy(buf+idx,(char *)&pos,sizeof(int)); - idx += sizeof(int); - pos = newrow + (newcol << 8); - memcpy(buf+idx,(char *)&pos,sizeof(int)); - idx += sizeof(int); - } - - if (write_socket(display_sock,buf,idx) < 0) - XCursesExitCursesProcess(1,"exitting from XCurses_display_cursor"); - - return(OK); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCurses_set_title(char *title) -#else -void XCurses_set_title(title) -char *title; -#endif -/***********************************************************************/ -{ - char buf[30]; - int idx,len; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_set_title() - called: TITLE: %s\n", - (XCursesProcess)?"X":"CURSES",title); -#endif - - idx = CURSES_TITLE; - memcpy(buf,(char *)&idx,sizeof(int)); - idx = sizeof(int); - len = strlen(title)+1; /* write nul character */ - memcpy(buf+idx,(char *)&len,sizeof(int)); - idx += sizeof(int); - - if (write_socket(display_sock,buf,idx) < 0) - XCursesExitCursesProcess(1,"exitting from XCurses_set_title"); - - if (write_socket(display_sock,title,len) < 0) - XCursesExitCursesProcess(1,"exitting from XCurses_set_title"); - - return; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCurses_refresh_scrollbar(void) -#else -int XCurses_refresh_scrollbar() -#endif -/***********************************************************************/ -{ - char buf[30]; - int idx; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_refresh_scrollbar() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - - idx = CURSES_REFRESH_SCROLLBAR; - memcpy(buf,(char *)&idx,sizeof(int)); - idx = sizeof(int); - - if (write_socket(display_sock,buf,idx) < 0) - XCursesExitCursesProcess(1,"exitting from XCurses_refresh_scrollbar"); - - return(OK); -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCurses_rawgetch( int delaytenths) -#else -int XCurses_rawgetch( delaytenths ) -int delaytenths; -#endif -/***********************************************************************/ -{ - unsigned long newkey=0; - int key=0; - char buf[100]; /* big enough for MOUSE_STATUS struct */ - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_rawgetch() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - - while(1) - { - if ( delaytenths && !XCurses_kbhit() ) - { - key = -1; - } - else - { - if (read_socket(key_sock,buf,sizeof(unsigned long)) < 0) - XCursesExitCursesProcess(2,"exiting from XCurses_rawchar"); /* what else ?? */ - memcpy((char *)&newkey,buf,sizeof(unsigned long)); - pdc_key_modifier = newkey >> 24; /*(sizeof(unsigned long) - sizeof(unsigned char)); */ - key = (int)(newkey & 0x00FFFFFF); - } -#if 0 - printf("%s:reading %d mod %ld\n",(XCursesProcess)?" X":"CURSES",key,pdc_key_modifier); -#endif - if (key == KEY_MOUSE) - { - if (read_socket(key_sock,buf,sizeof(MOUSE_STATUS)) < 0) - XCursesExitCursesProcess(2,"exitting from XCurses_rawchar"); /* what else ?? */ - memcpy((char *)&Trapped_Mouse_status,buf,sizeof(MOUSE_STATUS)); - /* - * Check if the mouse has been clicked on a slk area. If the return - * value is > 0 (indicating the - * label number, return with the KEY_F(key) value. - */ -/*fprintf(stderr,"%d %d %x\n",TRAPPED_MOUSE_Y_POS,TRAPPED_MOUSE_X_POS,SP->slk_winptr);*/ - if ((newkey = PDC_mouse_in_slk(TRAPPED_MOUSE_Y_POS,TRAPPED_MOUSE_X_POS))) - { - if (TRAPPED_BUTTON_STATUS(1) & BUTTON_PRESSED) - { - key = KEY_F(newkey); - break; - } - } - else - { - if ( key == KEY_RESIZE) - { -#if 000 - LINES = XCursesLINES = SP->lines - SP->linesrippedoff - SP->slklines; - XCursesCOLS = COLS = SP->cols; -printf("LINES %d COLS %d\n",LINES,COLS); -#endif - } - } - break; - -#ifdef MOUSE_DEBUG - printf("rawgetch-x: %d y: %d Mouse status: %x\n", - MOUSE_X_POS, - MOUSE_Y_POS, - Mouse_status.changes); - printf("rawgetch-Button1: %x Button2: %x Button3: %x\n", - BUTTON_STATUS(1), - BUTTON_STATUS(2), - BUTTON_STATUS(3)); -#endif - } - else - break; - } - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_rawgetch() - key %d returned\n",(XCursesProcess)?" X":"CURSES",key); -#endif - return(key); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCurses_get_input_fd(void) -#else -int XCurses_get_input_fd() -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_get_input_fd() - called\n",(XCursesProcess)?" X":"CURSES"); - if (trace_on) PDC_debug("%s:XCurses_get_input_fd() - returning %i\n",(XCursesProcess)?" X":"CURSES",key_sock); -#endif - return key_sock; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -bool XCurses_kbhit(void) -#else -bool XCurses_kbhit() -#endif -/***********************************************************************/ -{ - int s; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_kbhit() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - /* - * Is something ready to be read on the socket ? Must be a key. - */ - FD_ZERO( &readfds ); - FD_SET( key_sock, &readfds ); - if ( ( s = select ( FD_SETSIZE, (FD_SET_CAST)&readfds, NULL, NULL, &socket_timeout ) ) < 0 ) - XCursesExitCursesProcess(3,"child - exiting from XCurses_kbhit select failed"); - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_kbhit() - returning %s\n",(XCursesProcess)?" X":"CURSES",(s == 0) ? "FALSE" : "TRUE"); -#endif - if ( s == 0 ) - return(FALSE); - return(TRUE); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCursesInstruct(int flag) -#else -int XCursesInstruct(flag) -int flag; -#endif -/***********************************************************************/ -{ - char buf[10]; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesInstruct() - called flag %d\n",(XCursesProcess)?" X":"CURSES",flag); -#endif - /* - * Send a request to X... - */ - memcpy(buf,(char *)&flag,sizeof(int)); - if (write_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitCursesProcess(4,"exitting from XCursesInstruct"); - return(OK); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCursesInstructAndWait(int flag) -#else -int XCursesInstructAndWait(flag) -int flag; -#endif -/***********************************************************************/ -{ - int result; - char buf[10]; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesInstructAndWait() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - /* - * Tell X we want to do something... - */ - XCursesInstruct(flag); - /* - * ... wait for X to say the refresh has occurred. - */ - if (read_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitCursesProcess(5,"exiting from XCursesInstructAndWait"); - memcpy((char *)&result,buf,sizeof(int)); - if (result != CURSES_CONTINUE) - XCursesExitCursesProcess(6,"exitting from XCursesInstructAndWait - synchronization error"); - return(OK); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCurses_transform_line(chtype *ch, int row, int start_col, int num_cols) -#else -int XCurses_transform_line(ch, row, start_col, num_cols) -chtype *ch; -int row,start_col,num_cols; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_transform_line() called: row %d start_col %d num_cols %d flag %d\n", - (XCursesProcess)?"X":"CURSES",row,start_col,num_cols,*(Xcurscr+XCURSCR_FLAG_OFF+row)); -#endif - - while(*(Xcurscr+XCURSCR_FLAG_OFF+row)) - /* - * Patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999 - */ - dummy_function(); /* loop until we can write to the line */ - /* - * End of patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999 - */ - - *(Xcurscr+XCURSCR_FLAG_OFF+row) = 1; - memcpy(Xcurscr+XCURSCR_Y_OFF(row)+(start_col*sizeof(chtype)),ch,num_cols*sizeof(chtype)); -#if 1 - *((int*)(Xcurscr+XCURSCR_START_OFF+row)) = start_col; - *((int*)(Xcurscr+XCURSCR_LENGTH_OFF+row)) = num_cols; - if ( (int)*(Xcurscr+XCURSCR_START_OFF+row) != start_col ) - printf("%d difference: start_col %d mem: %d\n",__LINE__,start_col,(int)*(Xcurscr+XCURSCR_START_OFF+row) ); - if ( (int)*(Xcurscr+XCURSCR_LENGTH_OFF+row) != num_cols ) - printf("%d difference: num_cols %d mem: %d\n",__LINE__,num_cols,(int)*(Xcurscr+XCURSCR_LENGTH_OFF+row) ); -#else - *(Xcurscr+XCURSCR_START_OFF+row) = start_col; - *(Xcurscr+XCURSCR_LENGTH_OFF+row) = num_cols; -#endif - *(Xcurscr+XCURSCR_FLAG_OFF+row) = 0; - return(0); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -static int XCursesSetupCurses(void) -#else -static int XCursesSetupCurses() -#endif -/***********************************************************************/ -{ - char wait_buf[5]; - int wait_value; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesSetupCurses called\n",(XCursesProcess)?" X":"CURSES"); -#endif - close ( display_sockets[1] ); - close ( key_sockets[1] ); - display_sock = display_sockets[0]; - key_sock = key_sockets[0]; - FD_ZERO ( &readfds ); - FD_ZERO ( &writefds ); - read_socket(display_sock,wait_buf,sizeof(int)); - memcpy((char *)&wait_value,wait_buf,sizeof(int)); - if (wait_value != CURSES_CHILD) - return(ERR); - /* - * Set LINES and COLS now so that the size of the - * shared memory segment can be allocated - */ - if ((shmidSP = shmget(shmkeySP,sizeof(SCREEN)+XCURSESSHMMIN,0700)) < 0) - { - perror("Cannot allocate shared memory for SCREEN"); - kill(otherpid,SIGKILL); - return(ERR); - } - SP = (SCREEN*)shmat(shmidSP,0,0); - XCursesLINES = SP->lines; - LINES = XCursesLINES - SP->linesrippedoff - SP->slklines; - XCursesCOLS = COLS = SP->cols; - if ((shmid_Xcurscr = shmget(shmkey_Xcurscr,SP->XcurscrSize+XCURSESSHMMIN,0700)) < 0) - { - perror("Cannot allocate shared memory for curscr"); - kill(otherpid,SIGKILL); - return(ERR); - } -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:shmid_Xcurscr %d shmkey_Xcurscr %d LINES %d COLS %d\n",(XCursesProcess)?" X":"CURSES",shmid_Xcurscr,shmkey_Xcurscr,LINES,COLS); -#endif - Xcurscr = (unsigned char *)shmat(shmid_Xcurscr,0,0); - atrtab = (unsigned char *)(Xcurscr+XCURSCR_ATRTAB_OFF); - PDC_init_atrtab(); -#ifdef PDCDEBUG - say ("cursesprocess exiting from Xinitscr\n"); -#endif - /* - * Always trap SIGWINCH if the C library supports SIGWINCH... - */ - XCursesSetSignal(SIGWINCH, XCursesSigwinchHandler ); - return(OK); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCursesInitscr(char *display_name, int argc, char *argv[]) -#else -int XCursesInitscr(display_name,argc,argv) -char *display_name; -int argc; -char *argv[]; -#endif -/***********************************************************************/ -{ - int pid,rc; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesInitscr() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - -#if defined FOREIGN - if (setlocale(LC_ALL, "") == NULL) - { - fprintf(stderr, "ERROR: cannot set locale\n"); - return(ERR); - } - if (!XSupportsLocale()) - { - fprintf(stderr, "ERROR: X does not support locale\n"); - return(ERR); - } - if (XSetLocaleModifiers("") == NULL) - fprintf(stderr, "WARNING: Cannot set locale modifiers\n"); -#endif - - shmkeySP = getpid(); - memset ( &socket_timeout, '\0', sizeof ( socket_timeout ) ); - - if ( socketpair ( AF_UNIX, SOCK_STREAM, 0, display_sockets ) < 0 ) - { - fprintf(stderr, "ERROR: cannot create display socketpair\n"); - return(ERR); - } - - if ( socketpair ( AF_UNIX, SOCK_STREAM, 0, key_sockets ) < 0 ) - { - fprintf(stderr, "ERROR: cannot create key socketpair\n"); - return(ERR); - } - - pid = fork(); - switch(pid) - { - case (-1): - fprintf(stderr,"ERROR: cannot fork()\n"); - return(ERR); - break; - case 0: /* child */ - shmkey_Xcurscr = getpid(); -#ifdef XISPARENT - XCursesProcess=0; - rc = XCursesSetupCurses(); -#else - XCursesProcess=1; - otherpid = getppid(); - rc = XCursesSetupX(display_name,argc,argv); -#endif - break; - default: /* parent */ - shmkey_Xcurscr = pid; -#ifdef XISPARENT - XCursesProcess=1; - otherpid = pid; - rc = XCursesSetupX(display_name,argc,argv); -#else - XCursesProcess=0; - rc = XCursesSetupCurses(); -#endif - break; - } - return(rc); -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCurses_getclipboard( char **contents, long *length ) -#else -int XCurses_getclipboard( contents, length ) -char **contents; -long *length; -#endif -/***********************************************************************/ -{ - int result=0; - int len; - char buf[12]; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_getclipboard() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - XCursesInstructAndWait(CURSES_GET_SELECTION); - - if (read_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitCursesProcess(5,"exiting from XCurses_getclipboard"); - memcpy((char *)&result,buf,sizeof(int)); - if (result == PDC_CLIP_SUCCESS) - { - if (read_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitCursesProcess(5,"exiting from XCurses_getclipboard"); - memcpy((char *)&len,buf,sizeof(int)); - if (len != 0) - { - *contents = (char *)malloc(len+1); - if (!*contents) - XCursesExitCursesProcess(6,"exitting from XCurses_getclipboard - synchronization error"); - if (read_socket(display_sock,*contents,len) < 0) - XCursesExitCursesProcess(5,"exiting from XCurses_getclipboard"); - *length = len; - } - } - return result; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCurses_setclipboard( char *contents, long length ) -#else -int XCurses_setclipboard( contents, length ) -char *contents; -long length; -#endif -/***********************************************************************/ -{ - int rc=0; - char buf[12]; /* big enough for 2 integers */ - long len=length; -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_setclipboard() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - XCursesInstruct(CURSES_SET_SELECTION); - memcpy(buf,(char *)&len,sizeof(long)); - if (write_socket(display_sock,buf,sizeof(long)) < 0) - XCursesExitCursesProcess(5,"exiting from XCurses_setclipboard"); - if (write_socket(display_sock,contents,length) < 0) - XCursesExitCursesProcess(5,"exiting from XCurses_setclipboard"); - /* - * Wait for X to do its stuff. Now expect return code... - */ - if (read_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitCursesProcess(5,"exiting from XCurses_setclipboard"); - memcpy((char *)&rc,buf,sizeof(int)); - return rc; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesCleanupCursesProcess(int rc) -#else -void XCursesCleanupCursesProcess(rc) -int rc; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesCleanupCursesProcess() - called: %d\n",(XCursesProcess)?" X":"CURSES",rc); -#endif - shutdown(display_sock,2); - close(display_sock); - shutdown(key_sock,2); - close(key_sock); - shmdt((char *)SP); - shmdt((char *)Xcurscr); - if (rc) - _exit(rc); - else - return; -} -/***********************************************************************/ -#ifdef HAVE_PROTO -static void XCursesExitCursesProcess(int rc,char *msg) -#else -static void XCursesExitCursesProcess(rc,msg) -int rc; -char *msg; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesExitCursesProcess() - called: %d %s\n",(XCursesProcess)?" X":"CURSES",rc,msg); -#endif - endwin(); - XCursesCleanupCursesProcess(rc); - return; -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesExit(void) -#else -void XCursesExit() -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesExit() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - XCursesInstruct(CURSES_EXIT); - XCursesCleanupCursesProcess(0); - return; -} diff --git a/x11/thread/x11.c b/x11/thread/x11.c deleted file mode 100644 index 1a40e3fff..000000000 --- a/x11/thread/x11.c +++ /dev/null @@ -1,999 +0,0 @@ -/* -*************************************************************************** -* This file comprises part of PDCurses. PDCurses is Public Domain software. -* You may use this code for whatever purposes you desire. This software -* is provided AS IS with NO WARRANTY whatsoever. -* Should this software be used in another application, an acknowledgement -* that PDCurses code is used would be appreciated, but is not mandatory. -* -* Any changes which you make to this software which may improve or enhance -* it, should be forwarded to the current maintainer for the benefit of -* other users. -* -* The only restriction placed on this code is that no distribution of -* modified PDCurses code be made under the PDCurses name, by anyone -* other than the current maintainer. -* -* See the file maintain.er for details of the current maintainer. -* -* This file is NOT public domain software. It is Copyright, Mark Hessling -* 1994-2000. -*************************************************************************** -*/ - -/* - * This file contains functions that are called by the "x11" thread; - * ie the child thread. - */ - -#include "pdcx11.h" - -static int visible_cursor=0; -int windowEntered = 1; - -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesExitXCursesProcess(int rc,int sig,char *msg) -#else -void XCursesExitXCursesProcess(rc,sig,msg) -int rc,sig; -char *msg; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesExitXCursesProcess() - called: rc:%d sig:%d %s\n",(XCursesProcess)?" X":"CURSES",rc,sig,msg); -#endif - XCursesEndwin(); - close(display_sock); - close(exit_sock); - close(key_sock); - pthread_exit(rc); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesDisplayScreen(bool highlight) -#else -void XCursesDisplayScreen(highlight) -bool highlight; -#endif -/***********************************************************************/ -/*---------------------------------------------------------------------*/ -/* This function re-draws the entire screen. */ -/*---------------------------------------------------------------------*/ -{ - int row=0; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesDisplayScreen() - called:\n",(XCursesProcess)?" X":"CURSES"); -#endif - for (row=0;rowcursrow,SP->curscol, - SP->cursrow,SP->curscol); - /* - * Draw the border if required - */ - if (XCURSESBORDERWIDTH) - XDrawRectangle(XCURSESDISPLAY,XCURSESWIN,border_gc, - (XCURSESBORDERWIDTH/2),(XCURSESBORDERWIDTH/2), - (XCursesWindowWidth-XCURSESBORDERWIDTH), - (XCursesWindowHeight-XCURSESBORDERWIDTH)); - return; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCursesRefreshScreen(void) -#else -int XCursesRefreshScreen() -#endif -/***********************************************************************/ -/*---------------------------------------------------------------------*/ -/* This function draws those portions of the screen that have changed. */ -/*---------------------------------------------------------------------*/ -{ - int row=0,start_col=0,num_cols=0; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesRefreshScreen() - called:\n",(XCursesProcess)?" X":"CURSES"); -#endif - for (row=0;rowcursrow,SP->curscol, - SP->cursrow,SP->curscol); - return(0); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesProcessRequestsFromCurses(XtPointer client_data,int *fid,XtInputId *id) -#else -void XCursesProcessRequestsFromCurses(client_data,fid,id) -XtPointer client_data; -int *fid; -XtInputId *id; -#endif -/***********************************************************************/ -{ - int s,idx; - int old_row,new_row; - int old_x,new_x; - int pos,num_cols; - long length; - char buf[12]; /* big enough for 2 integers */ - char title[1024]; /* big enough for window title */ - unsigned char save_atrtab[MAX_ATRTAB]; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesProcessRequestsFromCurses()\n",(XCursesProcess)?" X":"CURSES"); -#endif - - if (!ReceivedMapNotify) - return; -#if DONT_NEED_SELECT_HERE -/* - * Do we need select() ? Surely, that's what X does with XtAppAddInput() - */ - FD_ZERO ( &readfds ); - FD_SET ( display_sock, &readfds ); - - if ( ( s = select ( FD_SETSIZE, (FD_SET_CAST)&readfds, NULL, NULL, &socket_timeout ) ) < 0 ) - XCursesExitXCursesProcess(2,SIGKILL,"exiting from XCursesProcessRequestsFromCurses - select failed"); - - if ( s == 0 ) /* no requests pending - should never happen!*/ - return; -#endif - -#ifdef DONT_NEED_SELECT_HERE - if ( FD_ISSET ( display_sock, &readfds ) ) - { -#endif -/* read first integer to determine total message has been received */ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesProcessRequestsFromCurses() - before read_socket()\n",(XCursesProcess)?" X":"CURSES"); -#endif - if (read_from_parent(dis_r,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(3,SIGKILL,"exiting from XCursesProcessRequestsFromCurses - first read"); -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesProcessRequestsFromCurses() - after read_socket()\n",(XCursesProcess)?" X":"CURSES"); -#endif - memcpy((char *)&num_cols,buf,sizeof(int)); - after_first_curses_request = True; - - switch(num_cols) - { - case 0: break; - case CURSES_EXIT: /* request from curses to stop */ - say("CURSES_EXIT received from child\n"); - XCursesExitXCursesProcess(0,0,"XCursesProcess requested to exit by child"); - break; - case CURSES_BELL: /* request from curses to beep */ - say("CURSES_BELL received from child\n"); - XBell(XCURSESDISPLAY,50); - break; - case CURSES_CLEAR: /* request from curses to clear window */ - say("CURSES_CLEAR received from child\n"); - XClearWindow(XCURSESDISPLAY,XCURSESWIN); - break; - case CURSES_FLASH: /* request from curses to beep */ - say("CURSES_FLASH received from child\n"); -#if 0 - XFillRectangle(XCURSESDISPLAY,XCURSESWIN,normal_highlight_gc,10,10,XCursesWindowWidth-10,XCursesWindowHeight-10); - delay_output(50); - XFillRectangle(XCURSESDISPLAY,XCURSESWIN,normal_highlight_gc,10,10,XCursesWindowWidth-10,XCursesWindowHeight-10); - XCursesDisplayCursor(SP->cursrow,SP->curscol, - SP->cursrow,SP->curscol); -#endif - old_x = CURSES_CONTINUE; - memcpy(buf,(char *)&old_x,sizeof(int)); - if (write_to_parent(dis_w,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesProcessRequestsFromCurses"); - break; - case CURSES_REFRESH: /* request from curses to confirm completion of display */ - say("CURSES_REFRESH received from child\n"); - visible_cursor = 1; - XCursesRefreshScreen(); - XCursesDisplayCursor(SP->cursrow,SP->curscol, - SP->cursrow,SP->curscol); - old_x = CURSES_CONTINUE; - memcpy(buf,(char *)&old_x,sizeof(int)); - if (write_to_parent(dis_w,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesProcessRequestsFromCurses"); - break; - case CURSES_REFRESH_SCROLLBAR: /* request from curses draw scrollbar */ - XCursesRefreshScrollbar(); -#if 0 - old_x = CURSES_CONTINUE; - memcpy(buf,(char *)&old_x,sizeof(int)); - if (write_to_parent(dis_w,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesProcessRequestsFromCurses"); -#endif - break; - case CURSES_CURSOR: /* display cursor */ - say("CURSES_CURSOR received from child\n"); - if (read_from_parent(dis_r,buf,sizeof(int)*2) < 0) - XCursesExitXCursesProcess(5,SIGKILL,"exiting from CURSES_CURSOR XCursesProcessRequestsFromCurses"); - memcpy((char *)&pos,buf,sizeof(int)); - old_row = pos & 0xFF; - old_x = pos >> 8; - idx = sizeof(int); - memcpy((char *)&pos,buf+idx,sizeof(int)); - new_row = pos & 0xFF; - new_x = pos >> 8; - visible_cursor = 1; - XCursesDisplayCursor(old_row,old_x,new_row,new_x); - break; - case CURSES_DISPLAY_CURSOR: /* display cursor */ - say("CURSES_DISPLAY_CURSOR received from child. Vis now: %d\n",visible_cursor); - /* - * If the window is not active, ignore this command. The - * cursor will stay solid. - */ - if ( windowEntered ) - { - if ( visible_cursor ) - { - /* - * Cursor currently ON, turn it off - */ - int save_visibility = SP->visibility; - SP->visibility = 0; - XCursesDisplayCursor(SP->cursrow,SP->curscol, - SP->cursrow,SP->curscol); - SP->visibility = save_visibility; - visible_cursor = 0; - } - else - { - /* - * Cursor currently OFF, turn it on - */ - XCursesDisplayCursor(SP->cursrow,SP->curscol, - SP->cursrow,SP->curscol); - visible_cursor = 1; - } - } - break; - case CURSES_TITLE: /* display window title */ - say("CURSES_TITLE received from child\n"); - if (read_from_parent(dis_r,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(5,SIGKILL,"exiting from CURSES_TITLE XCursesProcessRequestsFromCurses"); - memcpy((char *)&pos,buf,sizeof(int)); - if (read_from_parent(dis_r,title,pos) < 0) - XCursesExitXCursesProcess(5,SIGKILL,"exiting from CURSES_TITLE XCursesProcessRequestsFromCurses"); - XtVaSetValues(topLevel, XtNtitle, title, NULL); - break; - case CURSES_RESIZE: /* resize window */ - after_first_curses_request = False; - say("CURSES_RESIZE received from child\n"); - SP->lines = XCursesLINES = ((resizeXCursesWindowHeight-(2*XCURSESBORDERWIDTH)) / XCursesFontHeight); - LINES = XCursesLINES - SP->linesrippedoff - SP->slklines; - SP->cols = COLS = XCursesCOLS = ((resizeXCursesWindowWidth-(2*XCURSESBORDERWIDTH)) / XCursesFontWidth); - XCursesWindowWidth = resizeXCursesWindowWidth; - XCursesWindowHeight = resizeXCursesWindowHeight; - visible_cursor = 1; - /* - * Draw the border if required - */ - if (XCURSESBORDERWIDTH) - XDrawRectangle(XCURSESDISPLAY,XCURSESWIN,border_gc, - (XCURSESBORDERWIDTH/2),(XCURSESBORDERWIDTH/2), - (XCursesWindowWidth-XCURSESBORDERWIDTH), - (XCursesWindowHeight-XCURSESBORDERWIDTH)); -/* - * detach and drop the current shared memory segment and create and attach - * to a new segment. - */ - memcpy(save_atrtab,atrtab,sizeof(save_atrtab)); - SP->XcurscrSize = XCURSCR_SIZE; - shmdt((char *)Xcurscr); - shmctl(shmid_Xcurscr,IPC_RMID,0); - if ((shmid_Xcurscr = shmget(shmkey_Xcurscr,SP->XcurscrSize+XCURSESSHMMIN,0700|IPC_CREAT)) < 0) - { - perror("Cannot allocate shared memory for curscr"); - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesProcessRequestsFromCurses"); - } - Xcurscr = (unsigned char*)shmat(shmid_Xcurscr,0,0); - memset(Xcurscr, 0, SP->XcurscrSize); - atrtab = (unsigned char *)(Xcurscr+XCURSCR_ATRTAB_OFF); - memcpy(atrtab,save_atrtab,sizeof(save_atrtab)); - - old_x = CURSES_CONTINUE; - memcpy(buf,(char *)&old_x,sizeof(int)); - if (write_to_parent(dis_w,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesProcessRequestsFromCurses"); - break; - case CURSES_GET_SELECTION: /* request selection contents */ - say("CURSES_GET_SELECTION received from child\n"); - old_x = CURSES_CONTINUE; - memcpy(buf,(char *)&old_x,sizeof(int)); - if (write_to_parent(dis_w,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesProcessRequestsFromCurses"); - XtGetSelectionValue(topLevel,XA_PRIMARY,XA_STRING,XCursesRequestorCallbackForGetSelection,(XtPointer)NULL,0); - break; - case CURSES_SET_SELECTION: /* set the selection contents */ - say("CURSES_SET_SELECTION received from child\n"); - if (read_from_parent(dis_r,buf,sizeof(long)) < 0) - XCursesExitXCursesProcess(5,SIGKILL,"exiting from CURSES_SET_SELECTION XCursesProcessRequestsFromCurses"); - memcpy((char *)&length,buf,sizeof(long)); - if (length > tmpsel_length) - { - if (tmpsel_length == 0) - tmpsel = (char *)malloc(length+1); - else - tmpsel = (char *)realloc(tmpsel,length+1); - } - if (!tmpsel) - { - old_x = PDC_CLIP_MEMORY_ERROR; - memcpy(buf,(char *)&old_x,sizeof(int)); - if (write_to_parent(dis_w,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesProcessRequestsFromCurses"); - break; - } - if (read_from_parent(dis_r,tmpsel,length) < 0) - XCursesExitXCursesProcess(5,SIGKILL,"exiting from CURSES_SET_SELECTION XCursesProcessRequestsFromCurses"); - tmpsel_length = length; - *(tmpsel+length) = '\0'; - if (XtOwnSelection(topLevel, - XA_PRIMARY, - CurrentTime, - XCursesConvertProc, - XCursesLoseOwnership, - NULL) == False) - { - old_x = PDC_CLIP_ACCESS_ERROR; - free(tmpsel); - tmpsel = NULL; - tmpsel_length = 0; - } - else - old_x = PDC_CLIP_SUCCESS; - SelectionOff(); - memcpy(buf,(char *)&old_x,sizeof(int)); - if (write_to_parent(dis_w,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesProcessRequestsFromCurses"); - break; - default: -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:Unknown request %d\n",(XCursesProcess)?" X":"CURSES",num_cols); -#endif - break; -#ifdef DONT_NEED_SELECT_HERE - } -#endif - } - return; -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCursesSetupX(char *display_name,int argc, char *argv[]) -#else -int XCursesSetupX(display_name,argc,argv) -char *display_name; -int arc; -char *argv[]; -#endif -/***********************************************************************/ -{ - extern bool sb_started; - - XColor pointerforecolor,pointerbackcolor; - XrmValue rmfrom,rmto; - char wait_buf[5]; - int wait_value=0,i=0; - int minwidth=0,minheight=0; - int myargc; - char *myargv[2]; -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesSetupX called\n",(XCursesProcess)?" X":"CURSES"); -#endif - - /* - * The following kludge is to force XtVaAppInitialize() to recognize the - * name of the program. Without it, a default value of "main" is used. - */ - if (argv) - { - argv[0] = XCursesProgramName; -#ifdef PDCDEBUG1 - for (i=0;i %s\n",i,argv[i]); -#endif - } - else - { - /* - * initscr() called rather than initscrX() - */ - myargv[0] = XCursesProgramName; - myargv[1] = NULL; - myargc=1; - } - - /* - * Trap all signals when XCurses is the child process... - */ - for (i=0;i 4 - XtSetLanguageProc(NULL, (XtLanguageProc)NULL,NULL); -#endif - /* - * If a DISPLAY value has been supplied, set the env variable DISPLAY. - */ - if (display_name) - { - strcpy(global_display_name,"DISPLAY="); - strcat(global_display_name,display_name); - putenv(global_display_name); - } - /* - * Exit if no DISPLAY variable set... - */ - if (getenv("DISPLAY") == NULL) - { - fprintf(stderr,"Error: no DISPLAY variable set\n"); - kill(otherpid,SIGKILL); - return(ERR); - } - /* - * Initialise the top level widget... - */ - if (argv) - { - topLevel = XtVaAppInitialize( &app_context, - XCursesClassName, - options, - XtNumber(options), - &argc, - argv, - NULL, -/* - XtNinput, (XtArgVal)True, - XtNtitle,XCursesProgramName, - XtNname,"xcurses", -*/ - NULL); - } - else - { - topLevel = XtVaAppInitialize( &app_context, - XCursesClassName, - options, - XtNumber(options), - &myargc, - myargv, - NULL, -/* - XtNinput, (XtArgVal)True, - XtNtitle,XCursesProgramName, - XtNname,"xcurses", -*/ - NULL); - } -#ifdef PDCDEBUG1 - for (i=0;i %s\n",i,argv[i]); -#endif - - XtVaGetApplicationResources(topLevel,&app_data,app_resources,XtNumber(app_resources),NULL); - /* check application resource values here... */ - -#if 0 -printf("Width %d Height %d\n",XCURSESGEOMETRY.width,XCURSESGEOMETRY.height); -#endif - - XCursesFontWidth = XCURSESNORMALFONTINFO->max_bounds.rbearing - XCURSESNORMALFONTINFO->min_bounds.lbearing; - XCursesFontHeight = XCURSESNORMALFONTINFO->max_bounds.ascent + XCURSESNORMALFONTINFO->max_bounds.descent; - XCursesFontAscent = XCURSESNORMALFONTINFO->max_bounds.ascent; - XCursesFontDescent = XCURSESNORMALFONTINFO->max_bounds.descent; -#if 0 - /* - * Check that the bold font and normal fonts are the same size... - */ - if (XCursesFontWidth != XCURSESBOLDFONTINFO->max_bounds.rbearing - XCURSESBOLDFONTINFO->min_bounds.lbearing - || XCursesFontHeight != XCURSESBOLDFONTINFO->max_bounds.ascent + XCURSESBOLDFONTINFO->max_bounds.descent) - { - fprintf(stderr,"Error: normal font and bold font are different sizes\n"); - fprintf(stderr,"\tNormal\tBold\n"); - fprintf(stderr,"Width :\t%d\t%d\n",XCursesFontWidth,XCURSESBOLDFONTINFO->max_bounds.rbearing - XCURSESBOLDFONTINFO->min_bounds.lbearing); - fprintf(stderr,"Height:\t%d\t%d\n",XCursesFontHeight,XCURSESBOLDFONTINFO->max_bounds.ascent + XCURSESBOLDFONTINFO->max_bounds.descent); - kill(otherpid,SIGKILL); - return(ERR); - } -#endif - /* - * Calculate size of display window... - */ - XCursesCOLS = XCURSESCOLS; - XCursesLINES = XCURSESLINES; - XCursesWindowWidth = (XCursesFontWidth * XCursesCOLS) + (2 * XCURSESBORDERWIDTH); - XCursesWindowHeight = (XCursesFontHeight * XCursesLINES) + (2 * XCURSESBORDERWIDTH); - minwidth = (XCursesFontWidth*2)+(XCURSESBORDERWIDTH*2); - minheight = (XCursesFontHeight*2)+(XCURSESBORDERWIDTH*2); - /* - * Set up the icon for the application. The default is an internal one - * for XCurses. Then set various application level resources... - */ - XCursesGetIcon(); - - XtVaSetValues(topLevel, - XtNwidthInc,XCursesFontWidth, - XtNheightInc,XCursesFontHeight, - XtNminWidth,minwidth, - XtNminHeight,minheight, - XtNiconPixmap,icon_pixmap, - NULL); - /* - * Create a BOX widget in which to draw... - */ -#if 0 - fprintf(stderr,"Width: %d Height: %d sb_started: %d\n",XCursesWindowWidth+XCURSESSCROLLBARWIDTH, - XCursesWindowHeight+XCURSESSCROLLBARWIDTH,sb_started); -#endif - if (XCURSESSCROLLBARWIDTH != 0 - && sb_started) - { - scrollBox = XtVaCreateManagedWidget(XCursesProgramName,scrollBoxWidgetClass,topLevel, - XtNwidth,XCursesWindowWidth+XCURSESSCROLLBARWIDTH+8+2, - XtNheight,XCursesWindowHeight+XCURSESSCROLLBARWIDTH+8+2, - NULL); - drawing = XtVaCreateManagedWidget(XCursesProgramName,boxWidgetClass, - scrollBox, - XtNwidth,XCursesWindowWidth, - XtNheight,XCursesWindowHeight, - XtNwidthInc,XCursesFontWidth, - XtNheightInc,XCursesFontHeight, - NULL); - scrollVert = XtVaCreateManagedWidget("scrollVert", scrollbarWidgetClass, - scrollBox, - XtNorientation, XtorientVertical, - XtNheight, XCursesWindowHeight, - XtNwidth, XCURSESSCROLLBARWIDTH, - NULL); - XtAddCallback(scrollVert, XtNscrollProc, Scroll_up_down, drawing); - XtAddCallback(scrollVert, XtNjumpProc, Thumb_up_down, drawing); - scrollHoriz = XtVaCreateManagedWidget("scrollHoriz", scrollbarWidgetClass, - scrollBox, - XtNorientation, XtorientHorizontal, - XtNwidth, XCursesWindowWidth, - XtNheight, XCURSESSCROLLBARWIDTH, - NULL); - XtAddCallback(scrollHoriz, XtNscrollProc, Scroll_left_right, drawing); - XtAddCallback(scrollHoriz, XtNjumpProc, Thumb_left_right, drawing); - } - else - { - drawing = XtVaCreateManagedWidget(XCursesProgramName,boxWidgetClass,topLevel, - XtNwidth,XCursesWindowWidth, - XtNheight,XCursesWindowHeight, - NULL); - } - -#if 0 - fprintf(stderr,"Width: %d Height: %d\n",XCursesWindowWidth+XCURSESSCROLLBARWIDTH, - XCursesWindowHeight+XCURSESSCROLLBARWIDTH); -#endif -/* - XtVaSetValues(drawing, - XtNwidth,XCursesWindowWidth, - XtNheight,XCursesWindowHeight, - XtNwidthInc,XCursesFontWidth, - XtNheightInc,XCursesFontHeight, - XtNminWidth,XCursesFontWidth*2, - XtNminHeight,XCursesFontHeight*2, - XtNborderWidth,20, - NULL); -*/ - /* - * Process any default translations... - */ - XCursesTranslations = XtParseTranslationTable(defaultTranslations); - XtAugmentTranslations(drawing,XCursesTranslations); - XtAppAddActions(app_context,XCursesActions,XtNumber(XCursesActions)); - /* - * Process the supplied colors... - */ - if (get_colors() == ERR) - { - kill(otherpid,SIGKILL); - return(ERR); - } - /* - * Now have LINES and COLS. Set these in the shared SP so the - * curses program can find them... - */ - LINES = XCursesLINES; - COLS = XCursesCOLS; - if ((shmidSP = shmget(shmkeySP,sizeof(SCREEN)+XCURSESSHMMIN,0700|IPC_CREAT)) < 0) - { - perror("Cannot allocate shared memory for SCREEN"); - kill(otherpid,SIGKILL); - return(ERR); - } - SP = (SCREEN*)shmat(shmidSP,0,0); - memset(SP, 0, sizeof(SCREEN)); - SP->XcurscrSize = XCURSCR_SIZE; - SP->lines = XCursesLINES; - SP->cols = XCursesCOLS; -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:SHM size for curscr %d\n",(XCursesProcess)?" X":"CURSES",SP->XcurscrSize); -#endif - if ((shmid_Xcurscr = shmget(shmkey_Xcurscr,SP->XcurscrSize+XCURSESSHMMIN,0700|IPC_CREAT)) < 0) - { - perror("Cannot allocate shared memory for curscr"); - kill(otherpid,SIGKILL); - shmdt((char *)SP); - shmctl(shmidSP,IPC_RMID,0); - return(ERR); - } - Xcurscr = (unsigned char *)shmat(shmid_Xcurscr,0,0); - memset(Xcurscr, 0, SP->XcurscrSize); - atrtab = (unsigned char *)(Xcurscr+XCURSCR_ATRTAB_OFF); - PDC_init_atrtab(); -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:shmid_Xcurscr %d shmkey_Xcurscr %d LINES %d COLS %d\n",(XCursesProcess)?" X":"CURSES",shmid_Xcurscr,shmkey_Xcurscr,LINES,COLS); -#endif - /* - * Add Event handlers to the drawing widget... - */ - XtAddEventHandler(drawing,ExposureMask,False,XCursesExpose,NULL); - /* XtAddEventHandler(drawing,KeyPressMask|KeyReleaseMask,False,XCursesKeyPressKeyRelease,NULL); */ - /* XtAddEventHandler(drawing,ButtonPressMask|ButtonReleaseMask,False,XCursesButtonPressButtonRelease,NULL);*/ - XtAddEventHandler(drawing,StructureNotifyMask,False,XCursesStructureNotify,NULL); - XtAddEventHandler(drawing,EnterWindowMask|LeaveWindowMask,False,XCursesEnterLeaveWindow,NULL); -#if 0 - XtAddEventHandler(drawing,0,True,XCursesNonmaskable,NULL); -#endif - XtAddEventHandler(topLevel,0,True,XCursesNonmaskable,NULL); - /* - * Add input handler form display_sock (requests from curses program) - */ - XtAppAddInput(app_context,dis_r,(XtPointer)XtInputReadMask,XCursesProcessRequestsFromCurses,NULL); - /* - * Realize the widget... - */ - XtRealizeWidget(topLevel); - /* - * Handle trapping of the WM_DELETE_WINDOW property... - */ - wm_atom[0] = XInternAtom(XtDisplay(topLevel),"WM_DELETE_WINDOW",False); - wm_atom[1] = XInternAtom(XtDisplay(topLevel),"WM_SAVE_YOURSELF",False); - /* (void)XSetWMProtocols(XtDisplay(topLevel),RootWindowOfScreen(XtScreen(topLevel)),&wm_delete_window_atom,1);*/ - /* (void)XSetWMProtocols(XtDisplay(topLevel),XCURSESWIN,&wm_delete_window_atom,1);*/ - (void)XSetWMProtocols(XtDisplay(topLevel),XtWindow(topLevel),wm_atom,2); - /* - * Create the Graphics Context for drawing. This MUST be done AFTER the - * associated widget has been realized... - */ -#ifdef PDCDEBUG - say("before get_GC\n"); -#endif - get_GC(XCURSESDISPLAY,XCURSESWIN,&normal_gc,XCURSESNORMALFONTINFO,COLOR_WHITE,COLOR_BLACK,FALSE); - get_GC(XCURSESDISPLAY,XCURSESWIN,&normal_highlight_gc,XCURSESNORMALFONTINFO,COLOR_WHITE,COLOR_BLACK,TRUE); - get_GC(XCURSESDISPLAY,XCURSESWIN,&bold_highlight_gc,XCURSESBOLDFONTINFO,COLOR_WHITE,COLOR_BLACK,TRUE); - get_GC(XCURSESDISPLAY,XCURSESWIN,&block_cursor_gc,XCURSESNORMALFONTINFO,COLOR_BLACK,COLOR_CURSOR,FALSE); - get_GC(XCURSESDISPLAY,XCURSESWIN,&rect_cursor_gc,XCURSESNORMALFONTINFO,COLOR_CURSOR,COLOR_BLACK,FALSE); - get_GC(XCURSESDISPLAY,XCURSESWIN,&border_gc,XCURSESNORMALFONTINFO,COLOR_BORDER,COLOR_BLACK,FALSE); - /* - XSetLineAttributes(XCURSESDISPLAY,normal_gc,2,LineSolid,CapButt,JoinMiter); - */ - XSetLineAttributes(XCURSESDISPLAY,rect_cursor_gc,2,LineSolid,CapButt,JoinMiter); - XSetLineAttributes(XCURSESDISPLAY,border_gc,XCURSESBORDERWIDTH,LineSolid,CapButt,JoinMiter); - /* - * Set the cursor for the application... - */ - XDefineCursor(XCURSESDISPLAY,XCURSESWIN,XCURSESPOINTER); - rmfrom.size = sizeof(Pixel); - rmto.size = sizeof(XColor); -#if XtSpecificationRelease > 4 - rmto.addr = (XPointer)&pointerforecolor; - rmfrom.addr = (XPointer)&(XCURSESPOINTERFORECOLOR); - XtConvertAndStore(drawing,XtRPixel,&rmfrom,XtRColor,&rmto); -#else - rmto.addr = (char *)&pointerforecolor; - rmfrom.addr = (char *)&(XCURSESPOINTERFORECOLOR); - XtConvert(drawing,XtRPixel,&rmfrom,XtRColor,&rmto); -#endif - rmfrom.size = sizeof(Pixel); - rmto.size = sizeof(XColor); -#if XtSpecificationRelease > 4 - rmfrom.addr = (XPointer)&(XCURSESPOINTERBACKCOLOR); - rmto.addr = (XPointer)&pointerbackcolor; - XtConvertAndStore(drawing,XtRPixel,&rmfrom,XtRColor,&rmto); -#else - rmfrom.addr = (char *)&(XCURSESPOINTERBACKCOLOR); - rmto.addr = (char *)&pointerbackcolor; - XtConvert(drawing,XtRPixel,&rmfrom,XtRColor,&rmto); -#endif - XRecolorCursor(XCURSESDISPLAY,XCURSESPOINTER,&pointerforecolor,&pointerbackcolor); - /* - * Convert the supplied compose key to a Keysym... - */ - compose_key = XStringToKeysym(XCURSESCOMPOSEKEY); - if (compose_key - && IsModifierKey(compose_key)) - { - register int i=0,j=0; - KeyCode *kcp; - XModifierKeymap *map; - KeyCode compose_keycode=XKeysymToKeycode(XCURSESDISPLAY,compose_key); - map = XGetModifierMapping(XCURSESDISPLAY); - kcp = map->modifiermap; - for (i=0;i<8;i++) - { - for (j=0;jmax_keypermod;j++,kcp++) - { - if (!*kcp) - continue; - if (compose_keycode == *kcp) - { - compose_mask = state_mask[i]; - break; - } - } - if (compose_mask) - break; - } - XFreeModifiermap(map); - } - /* fprintf(stderr,"COMPOSE KEY: %d %s STATE: %d\n",compose_key,XCURSESCOMPOSEKEY,compose_mask);*/ - -#ifdef FOREIGN - sleep(20); - if ((Xim = XOpenIM(XCURSESDISPLAY,NULL,NULL,NULL)) == NULL) - { - perror("Cannot open Input Method"); - kill(otherpid,SIGKILL); - shmdt((char *)SP); - shmdt((char *)Xcurscr); - shmctl(shmidSP,IPC_RMID,0); - shmctl(shmid_Xcurscr,IPC_RMID,0); - return(ERR); - } - XGetIMValues(Xim,XNQueryInputStyle, &im_supported_styles, NULL); - my_style = XIMPreeditNone|XIMStatusNone; - /* call XtCvtStringToFontSet ??? */ - if ((Xic = XCreateIC(Xim, XNInputStyle, my_style, - /* - - */ - NULL)) == NULL) - { - perror("ERROR: Cannot create input context"); - kill(otherpid,SIGKILL); - shmdt((char *)SP); - shmdt((char *)Xcurscr); - shmctl(shmidSP,IPC_RMID,0); - shmctl(shmid_Xcurscr,IPC_RMID,0); - return(ERR); - } - XFree(im_supported_styles); - XGetICValues(Xic, XNFilterEvents, &im_event_mask, NULL); - XtAddEventHandler(drawing,im_event_mask,False,NULL,NULL); - XSetICFocus(Xic); -#endif - /* - * Leave telling the curses process that it can start to here so that - * when the curses process makes a request, the Xcurses process can - * service the request... - */ - wait_value = CURSES_CHILD; - memcpy(wait_buf,(char *)&wait_value,sizeof(int)); - (void)write_to_parent(dis_w,wait_buf,sizeof(int)); - /* - * Wait for events... - */ - XtAppMainLoop(app_context); - return(OK); /* won't get here */ -} -/***********************************************************************/ -#ifdef HAVE_PROTO -RETSIGTYPE XCursesSignalHandler(int signo) -#else -RETSIGTYPE XCursesSignalHandler(signo) -int signo; -#endif -/***********************************************************************/ -{ - char buf[10]; - int flag = CURSES_EXIT; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesSignalHandler() - called: %d\n",(XCursesProcess)?" X":"CURSES",signo); -#endif - /* - * Patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 04-Dec-1998 - */ - XCursesSetSignal(signo,XCursesSignalHandler); -#ifdef SIGTSTP - if (signo == SIGTSTP) { pause(); return; } -#endif -#ifdef SIGCONT - if (signo == SIGCONT) return; -#endif -#ifdef SIGCLD - if (signo == SIGCLD) return; -#endif -#ifdef SIGTTIN - if (signo == SIGTTIN) return; -#endif -#ifdef SIGWINCH - if (signo == SIGWINCH) return; -#endif - /* - * End of patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 04-Dec-1998 - */ - XCursesSetSignal(signo,SIG_IGN); - /* - * Send a CURSES_EXIT to myself... - */ - memcpy(buf,(char *)&flag,sizeof(int)); - if (write_socket(exit_sock,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(7,signo,"exitting from XCursesSignalHandler"); -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesRequestorCallbackForGetSelection(Widget w,XtPointer data, Atom *selection, - Atom *type, XtPointer value, - unsigned long *length, int *format) -#else -void XCursesRequestorCallbackForGetSelection(w,data,selection,type,value,length,format) -Widget w; -XtPointer data; -Atom *selection; -Atom *type; -XtPointer value; -unsigned long *length; -int *format; -#endif -/***********************************************************************/ -{ - int rc; - char buf[12]; /* big enough for 2 integers */ - char *string=(char *)value; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesRequestorCallbackForSelection() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - - if ((value == NULL) && (*length == 0)) - { - rc = PDC_CLIP_EMPTY; - memcpy(buf,(char *)&rc,sizeof(int)); - if (write_to_parent(dis_w,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesRequestorCallbackForGetSelection"); - return; - } - /* - * Here all is OK, send PDC_CLIP_SUCCESS, then length, then contents - */ - rc = PDC_CLIP_SUCCESS; - memcpy(buf,(char *)&rc,sizeof(int)); - if (write_to_parent(dis_w,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesRequestorCallbackForGetSelection"); - - rc = *(length); - memcpy(buf,(char *)&rc,sizeof(int)); - if (write_to_parent(dis_w,buf,sizeof(int)) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesRequestorCallbackForGetSelection"); - - if (write_to_parent(dis_w,string,*length) < 0) - XCursesExitXCursesProcess(4,SIGKILL,"exiting from XCursesRequestorCallbackForGetSelection"); - - return; -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesStructureNotify(Widget w,XtPointer client_data,XEvent *event,Boolean *continue_to_dispatch) -#else -void XCursesStructureNotify(w,client_data,event,continue_to_dispatch) -Widget w; -XtPointer client_data; -XEvent *event; -Boolean *continue_to_dispatch; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesStructureNotify called\n",(XCursesProcess)?" X":"CURSES"); -#endif - -#if 0 -printf("Notify: %d\n",event->type); -#endif - switch(event->type) - { - case ConfigureNotify: -#ifdef PDCDEBUG - say("ConfigureNotify received\n"); -#endif - /* window has been resized, change width and - * height to send to place_text and place_graphics - * in next Expose. - * Also will need to kill (SIGWINCH) curses process if screen - * size changes - */ - resizeXCursesWindowWidth = (event->xconfigure.width); - resizeXCursesWindowHeight = (event->xconfigure.height); - after_first_curses_request = False; -#ifdef SIGWINCH -# ifdef BEFORE_CHANGE_BY_G_FUCHS -/* - * Patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999 - */ -# else - SP->resized = 1; -# endif - kill(otherpid,SIGWINCH); -#endif -#if 000 - SP->lines = XCursesLINES = ((resizeXCursesWindowHeight-(2*XCURSESBORDERWIDTH)) / XCursesFontHeight); - LINES = XCursesLINES - SP->linesrippedoff - SP->slklines; - SP->cols = COLS = XCursesCOLS = ((resizeXCursesWindowWidth-(2*XCURSESBORDERWIDTH)) / XCursesFontWidth); -printf("X11:LINES %d COLS %d\n",SP->lines, SP->cols); -#endif - XCursesSendKeyToCurses( (unsigned long)KEY_RESIZE, NULL ); - break; - case MapNotify: -#ifdef PDCDEBUG - say("MapNotify received\n"); -#endif - ReceivedMapNotify=1; - /* - * Draw the window border - */ - if (XCURSESBORDERWIDTH) - XDrawRectangle(XCURSESDISPLAY,XCURSESWIN,border_gc, - (XCURSESBORDERWIDTH/2),(XCURSESBORDERWIDTH/2), - (XCursesWindowWidth-XCURSESBORDERWIDTH), - (XCursesWindowHeight-XCURSESBORDERWIDTH)); - break; - default: -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesStructureNotify - unknown event %d\n",(XCursesProcess)?" X":"CURSES",event->type); -#endif - break; - } - return; -} diff --git a/x11/thread/x11.h b/x11/thread/x11.h deleted file mode 100644 index 0e733eb82..000000000 --- a/x11/thread/x11.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifdef HAVE_PROTO -void dummy_function(void); -void get_GC(Display *,Window, GC *, XFontStruct *,int ,int, bool ); -void makeXY(int ,int ,int ,int ,int *,int *); -int get_colors(void); -void start_event_handler(void); -int XCursesTransformLine(int ,int ,chtype ,int ,int,int,char *); -int XCursesDisplayText(chtype *, int, int, int,bool); -void XCursesDisplayScreen(bool); -void XCursesDisplayCursor( int ,int ,int ,int ); -void XCursesStructureNotify(Widget,XtPointer ,XEvent *,Boolean *); -void XCursesEnterLeaveWindow(Widget,XtPointer ,XEvent *,Boolean *); -void XCursesPasteSelection(Widget,XButtonEvent *); -void XCursesHandleString(Widget,XEvent *,String *,Cardinal *); -void XCursesKeyPress(Widget,XEvent *,String *,Cardinal *); -void XCursesModifierPress(Widget,XEvent *,String *,Cardinal *); -Boolean XCursesConvertProc(Widget,Atom *,Atom *,Atom *,XtPointer *,unsigned long *,int *); -void XCursesLoseOwnership(Widget,Atom *); -void XCursesRequestorCallbackForPaste(Widget,XtPointer,Atom *,Atom *,XtPointer,unsigned long *,int *); -void XCursesRequestorCallbackForGetSelection(Widget,XtPointer,Atom *,Atom *,XtPointer,unsigned long *,int *); -RETSIGTYPE XCursesSignalHandler(int); -void XCursesExitXCursesProcess(int,int,char *); -void SelectionOff(void); -void SelectionOn(int,int); -void SelectionExtend(int,int); -void SelectionSet( void ); - -int write_socket(int,char *,int); -int read_socket(int,char *,int); -int XCursesSetupX(char *display_name,int argc, char *argv[]); -RETSIGTYPE XCursesSigwinchHandler(int signo); -#else -void dummy_function(void); -void get_GC(); -void makeXY(); -int get_colors(); -void start_event_handler(); -int XCursesTransformLine(); -int XCursesDisplayText(); -void XCursesDisplayScreen(); -void XCursesDisplayCursor(); -void XCursesStructureNotify(); -void XCursesEnterLeaveWindow(); -void XCursesHandleString(); -void XCursesKeyPress(); -void XCursesModifierPress(); -void XCursesPasteSelection(); -Boolean XCursesConvertProc(); -void XCursesLoseOwnership(); -void XCursesRequestorCallbackForPaste(); -void XCursesRequestorCallbackForGetSelection(); -RETSIGTYPE XCursesSignalHandler(); -void XCursesExitXCursesProcess(); -void SelectionOff(); -void SelectionOn(); -void SelectionExtend(); -void SelectionSet(); - -int write_socket(); -int read_socket(); -int XCursesSetupX(); -RETSIGTYPE XCursesSigwinchHandler(); -#endif - -#ifdef _HPUX_SOURCE -# define FD_SET_CAST int * -#else -# define FD_SET_CAST fd_set * -#endif -extern fd_set readfds; -extern fd_set writefds; -extern struct timeval socket_timeout; - -extern unsigned char *Xcurscr; -extern int XCursesLINES; -extern int XCursesCOLS; -extern unsigned char *atrtab; - -typedef struct key_queue_type -{ - int key; - MOUSE_STATUS mouse; -} key_queue_t; - -extern key_type_t key_queue; diff --git a/x11/thread/x11common.c b/x11/thread/x11common.c deleted file mode 100644 index ba13a5474..000000000 --- a/x11/thread/x11common.c +++ /dev/null @@ -1,100 +0,0 @@ -/* -*************************************************************************** -* This file comprises part of PDCurses. PDCurses is Public Domain software. -* You may use this code for whatever purposes you desire. This software -* is provided AS IS with NO WARRANTY whatsoever. -* Should this software be used in another application, an acknowledgement -* that PDCurses code is used would be appreciated, but is not mandatory. -* -* Any changes which you make to this software which may improve or enhance -* it, should be forwarded to the current maintainer for the benefit of -* other users. -* -* The only restriction placed on this code is that no distribution of -* modified PDCurses code be made under the PDCurses name, by anyone -* other than the current maintainer. -* -* See the file maintain.er for details of the current maintainer. -* -* This file is NOT public domain software. It is Copyright, Mark Hessling -* 1994-2000. -*************************************************************************** -*/ - -#include "pdcx11.h" -/* - * Variables specific to thread port - */ -unsigned char *Xcurscr; -int XCursesProcess=1; -int XCursesLINES=24; -int XCursesCOLS=80; - -/***********************************************************************/ -#ifdef HAVE_PROTO -int read_socket(int sock_num,char *buf,int len) -#else -int read_socket(sock_num,buf,len) -int sock_num; -char *buf; -int len; -#endif -/***********************************************************************/ -{ - int start=0,length=len,rc; -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:read_socket called: sock_num %d len %d\n",(XCursesProcess)?" X":"CURSES",sock_num,len); -#endif - while(1) - { - rc = read(sock_num,buf+start,length); -#ifdef MOUSE_DEBUG1 - if (sock_num == key_sock) - printf("%s:read_socket(key) rc %d errno %d resized: %d\n",(XCursesProcess)?" X":"CURSES", - rc,errno,SP->resized); -#endif - if (rc < 0 - && sock_num == key_sock - && errno == EINTR -#ifdef BEFORE_CHANGE_BY_G_FUCHS -/* - * Patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999 - */ - && SP->resized == TRUE) - { -#ifdef MOUSE_DEBUG1 - printf("%s:continuing\n",(XCursesProcess)?" X":"CURSES"); -#endif - rc = 0; -#else - && SP->resized != FALSE) - { -#ifdef MOUSE_DEBUG1 - printf("%s:continuing\n",(XCursesProcess)?" X":"CURSES"); -#endif - rc = 0; - if (SP->resized > 1) - SP->resized = TRUE; - else - SP->resized = FALSE; -#endif - memcpy(buf,(char *)&rc,sizeof(int)); - return(0); /* must be >= 0 to avoid error */ - } - -#ifdef BEFORE_CHANGE_BY_G_FUCHS -/* - * Patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999 - */ - if (rc < 0 -#else - if (rc <= 0 -#endif - || rc == length) - return(rc); - length -= rc; - start = rc; - } -} diff --git a/x11/thread/x11curses.c b/x11/thread/x11curses.c deleted file mode 100644 index a6c584086..000000000 --- a/x11/thread/x11curses.c +++ /dev/null @@ -1,675 +0,0 @@ -/* -*************************************************************************** -* This file comprises part of PDCurses. PDCurses is Public Domain software. -* You may use this code for whatever purposes you desire. This software -* is provided AS IS with NO WARRANTY whatsoever. -* Should this software be used in another application, an acknowledgement -* that PDCurses code is used would be appreciated, but is not mandatory. -* -* Any changes which you make to this software which may improve or enhance -* it, should be forwarded to the current maintainer for the benefit of -* other users. -* -* The only restriction placed on this code is that no distribution of -* modified PDCurses code be made under the PDCurses name, by anyone -* other than the current maintainer. -* -* See the file maintain.er for details of the current maintainer. -* -* This file is NOT public domain software. It is Copyright, Mark Hessling -* 1994-2000. -*************************************************************************** -*/ - -/* - * This file contains functions that are called by the "curses" thread; - * ie the parent thread. - */ - -/* - * Communications required between threads: - * - * Thread Action Name Purpose - * ----------------------------------------------------------------- - * parent write dis_w dis_pipe[1] send requests to X thread such as - * display cursor, refresh - * child read dis_r dis_pipe[0] read requests from parent thread - * parent read key_r key_pipe[0] read key/mouse/clipboard from X11 - * thread - * child write key_r key_pipe[1] write key/mouse/clipboard to parent - * thread. NOTE. PIPE_BUF size and - * size of clipboard!! - * Need a semaphore or similar to allow child thread to let the parent - * know when it has completed the actions given by a write on dis_w - * When using socketpairs, this is the same socket, as these are bidirectional - */ - -#include "pdcx11.h" - -#ifdef PROTO -static void XCursesExitCursesProcess(int, char *); -#else -static void XCursesExitCursesProcess(); -#endif - -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCursesResizeScreen(int nlines, int ncols) -#else -int XCursesResizeScreen(nlines, ncols) -int nlines,ncols; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesResizeScreen() - called: Lines: %d Cols: %d\n",(XCursesProcess)?" X":"CURSES",nlines,ncols); -#endif - shmdt((char *)Xcurscr); - XCursesInstructAndWait(CURSES_RESIZE); - if ((shmid_Xcurscr = shmget(shmkey_Xcurscr,SP->XcurscrSize+XCURSESSHMMIN,0700)) < 0) - { - perror("Cannot allocate shared memory for curscr"); - kill(otherpid,SIGKILL); - return(ERR); - } - XCursesLINES = SP->lines; - XCursesCOLS = SP->cols; -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:shmid_Xcurscr %d shmkey_Xcurscr %d SP->lines %d SP->cols %d\n",(XCursesProcess)?" X":"CURSES",shmid_Xcurscr,shmkey_Xcurscr,SP->lines,SP->cols); -#endif - Xcurscr = (unsigned char*)shmat(shmid_Xcurscr,0,0); - atrtab = (unsigned char *)(Xcurscr+XCURSCR_ATRTAB_OFF); - SP->resized=FALSE; - return(OK); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCurses_display_cursor(int oldrow, int oldcol, int newrow,int newcol,int visibility) -#else -int XCurses_display_cursor(oldrow,oldcol,newrow,newcol,visibility) -int oldrow,oldcol,newrow,newcol,visibility; -#endif -/***********************************************************************/ -{ - char buf[30]; - int idx,pos; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_display_cursor() - called: NEW row %d col %d, vis %d\n", - (XCursesProcess)?"X":"CURSES",newrow,newcol,visibility); -#endif - - if ( visibility == -1 ) - { - /* - * Only send the CURSES_DISPLAY_CURSOR message, no data - */ - idx = CURSES_DISPLAY_CURSOR; - memcpy(buf,(char *)&idx,sizeof(int)); - idx = sizeof(int); - } - else - { - idx = CURSES_CURSOR; - memcpy(buf,(char *)&idx,sizeof(int)); - idx = sizeof(int); - pos = oldrow + (oldcol << 8); - memcpy(buf+idx,(char *)&pos,sizeof(int)); - idx += sizeof(int); - pos = newrow + (newcol << 8); - memcpy(buf+idx,(char *)&pos,sizeof(int)); - idx += sizeof(int); - } - - if (write_socket(display_sock,buf,idx) < 0) - XCursesExitCursesProcess(1,"exitting from XCurses_display_cursor"); - - return(OK); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCurses_set_title(char *title) -#else -void XCurses_set_title(title) -char *title; -#endif -/***********************************************************************/ -{ - char buf[30]; - int idx,len; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_set_title() - called: TITLE: %s\n", - (XCursesProcess)?"X":"CURSES",title); -#endif - - idx = CURSES_TITLE; - memcpy(buf,(char *)&idx,sizeof(int)); - idx = sizeof(int); - len = strlen(title)+1; /* write nul character */ - memcpy(buf+idx,(char *)&len,sizeof(int)); - idx += sizeof(int); - - if (write_socket(display_sock,buf,idx) < 0) - XCursesExitCursesProcess(1,"exitting from XCurses_set_title"); - - if (write_socket(display_sock,title,len) < 0) - XCursesExitCursesProcess(1,"exitting from XCurses_set_title"); - - return; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCurses_refresh_scrollbar(void) -#else -int XCurses_refresh_scrollbar() -#endif -/***********************************************************************/ -{ - char buf[30]; - int idx; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_refresh_scrollbar() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - - idx = CURSES_REFRESH_SCROLLBAR; - memcpy(buf,(char *)&idx,sizeof(int)); - idx = sizeof(int); - - if (write_socket(display_sock,buf,idx) < 0) - XCursesExitCursesProcess(1,"exitting from XCurses_refresh_scrollbar"); - - return(OK); -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCurses_rawgetch( int delaytenths) -#else -int XCurses_rawgetch( delaytenths ) -int delaytenths; -#endif -/***********************************************************************/ -{ - unsigned long newkey=0; - int key=0; - char buf[100]; /* big enough for MOUSE_STATUS struct */ - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_rawgetch() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - - while(1) - { - if ( delaytenths && !XCurses_kbhit() ) - { - key = -1; - } - else - { - if (read_socket(key_sock,buf,sizeof(unsigned long)) < 0) - XCursesExitCursesProcess(2,"exiting from XCurses_rawchar"); /* what else ?? */ - memcpy((char *)&newkey,buf,sizeof(unsigned long)); - pdc_key_modifier = newkey >> 24; /*(sizeof(unsigned long) - sizeof(unsigned char)); */ - key = (int)(newkey & 0x00FFFFFF); - } -#if 0 - printf("%s:reading %d mod %ld\n",(XCursesProcess)?" X":"CURSES",key,pdc_key_modifier); -#endif - if (key == KEY_MOUSE) - { - if (read_socket(key_sock,buf,sizeof(MOUSE_STATUS)) < 0) - XCursesExitCursesProcess(2,"exitting from XCurses_rawchar"); /* what else ?? */ - memcpy((char *)&Trapped_Mouse_status,buf,sizeof(MOUSE_STATUS)); - /* - * Check if the mouse has been clicked on a slk area. If the return - * value is > 0 (indicating the - * label number, return with the KEY_F(key) value. - */ -/*fprintf(stderr,"%d %d %x\n",TRAPPED_MOUSE_Y_POS,TRAPPED_MOUSE_X_POS,SP->slk_winptr);*/ - if ((newkey = PDC_mouse_in_slk(TRAPPED_MOUSE_Y_POS,TRAPPED_MOUSE_X_POS))) - { - if (TRAPPED_BUTTON_STATUS(1) & BUTTON_PRESSED) - { - key = KEY_F(newkey); - break; - } - } - else - { - if ( key == KEY_RESIZE) - { -#if 000 - LINES = XCursesLINES = SP->lines - SP->linesrippedoff - SP->slklines; - XCursesCOLS = COLS = SP->cols; -printf("LINES %d COLS %d\n",LINES,COLS); -#endif - } - } - break; - -#ifdef MOUSE_DEBUG - printf("rawgetch-x: %d y: %d Mouse status: %x\n", - MOUSE_X_POS, - MOUSE_Y_POS, - Mouse_status.changes); - printf("rawgetch-Button1: %x Button2: %x Button3: %x\n", - BUTTON_STATUS(1), - BUTTON_STATUS(2), - BUTTON_STATUS(3)); -#endif - } - else - break; - } - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_rawgetch() - key %d returned\n",(XCursesProcess)?" X":"CURSES",key); -#endif - return(key); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCurses_get_input_fd(void) -#else -int XCurses_get_input_fd() -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_get_input_fd() - called\n",(XCursesProcess)?" X":"CURSES"); - if (trace_on) PDC_debug("%s:XCurses_get_input_fd() - returning %i\n",(XCursesProcess)?" X":"CURSES",key_sock); -#endif - return key_sock; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -bool XCurses_kbhit(void) -#else -bool XCurses_kbhit() -#endif -/***********************************************************************/ -{ - int s; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_kbhit() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - /* - * Is something ready to be read on the socket ? Must be a key. - */ - FD_ZERO( &readfds ); - FD_SET( key_sock, &readfds ); - if ( ( s = select ( FD_SETSIZE, (FD_SET_CAST)&readfds, NULL, NULL, &socket_timeout ) ) < 0 ) - XCursesExitCursesProcess(3,"child - exiting from XCurses_kbhit select failed"); - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_kbhit() - returning %s\n",(XCursesProcess)?" X":"CURSES",(s == 0) ? "FALSE" : "TRUE"); -#endif - if ( s == 0 ) - return(FALSE); - return(TRUE); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCursesInstruct(int flag) -#else -int XCursesInstruct(flag) -int flag; -#endif -/***********************************************************************/ -{ - char buf[10]; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesInstruct() - called flag %d\n",(XCursesProcess)?" X":"CURSES",flag); -#endif - /* - * Send a request to X... - */ - memcpy(buf,(char *)&flag,sizeof(int)); - if (write_to_child(dis_w,buf,sizeof(int)) < 0) - XCursesExitCursesProcess(4,"exitting from XCursesInstruct"); - return(OK); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCursesInstructAndWait(int flag) -#else -int XCursesInstructAndWait(flag) -int flag; -#endif -/***********************************************************************/ -{ - int result; - char buf[10]; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesInstructAndWait() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - /* - * Tell X we want to do something... - */ - XCursesInstruct(flag); - /* - * ... wait for X to say the refresh has occurred. - */ - if (read_from_chil(display_sock,buf,sizeof(int)) < 0) - XCursesExitCursesProcess(5,"exiting from XCursesInstructAndWait"); - memcpy((char *)&result,buf,sizeof(int)); - if (result != CURSES_CONTINUE) - XCursesExitCursesProcess(6,"exitting from XCursesInstructAndWait - synchronization error"); - return(OK); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCurses_transform_line(chtype *ch, int row, int start_col, int num_cols) -#else -int XCurses_transform_line(ch, row, start_col, num_cols) -chtype *ch; -int row,start_col,num_cols; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_transform_line() called: row %d start_col %d num_cols %d flag %d\n", - (XCursesProcess)?"X":"CURSES",row,start_col,num_cols,*(Xcurscr+XCURSCR_FLAG_OFF+row)); -#endif - - while(*(Xcurscr+XCURSCR_FLAG_OFF+row)) - /* - * Patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999 - */ - dummy_function(); /* loop until we can write to the line */ - /* - * End of patch by: - * Georg Fuchs, georg.fuchs@rz.uni-regensburg.de 02-Feb-1999 - */ - - *(Xcurscr+XCURSCR_FLAG_OFF+row) = 1; - memcpy(Xcurscr+XCURSCR_Y_OFF(row)+(start_col*sizeof(chtype)),ch,num_cols*sizeof(chtype)); -#if 1 - *((int*)(Xcurscr+XCURSCR_START_OFF+row)) = start_col; - *((int*)(Xcurscr+XCURSCR_LENGTH_OFF+row)) = num_cols; - if ( (int)*(Xcurscr+XCURSCR_START_OFF+row) != start_col ) - printf("%d difference: start_col %d mem: %d\n",__LINE__,start_col,(int)*(Xcurscr+XCURSCR_START_OFF+row) ); - if ( (int)*(Xcurscr+XCURSCR_LENGTH_OFF+row) != num_cols ) - printf("%d difference: num_cols %d mem: %d\n",__LINE__,num_cols,(int)*(Xcurscr+XCURSCR_LENGTH_OFF+row) ); -#else - *(Xcurscr+XCURSCR_START_OFF+row) = start_col; - *(Xcurscr+XCURSCR_LENGTH_OFF+row) = num_cols; -#endif - *(Xcurscr+XCURSCR_FLAG_OFF+row) = 0; - return(0); -} -/***********************************************************************/ -#ifdef HAVE_PROTO -static int XCursesSetupCurses(void) -#else -static int XCursesSetupCurses() -#endif -/***********************************************************************/ -{ - char wait_buf[5]; - int wait_value; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesSetupCurses called\n",(XCursesProcess)?" X":"CURSES"); -#endif - close ( display_sockets[1] ); - close ( key_sockets[1] ); - display_sock = display_sockets[0]; - key_sock = key_sockets[0]; - FD_ZERO ( &readfds ); - FD_ZERO ( &writefds ); - read_socket(display_sock,wait_buf,sizeof(int)); - memcpy((char *)&wait_value,wait_buf,sizeof(int)); - if (wait_value != CURSES_CHILD) - return(ERR); - /* - * Set LINES and COLS now so that the size of the - * shared memory segment can be allocated - */ - if ((shmidSP = shmget(shmkeySP,sizeof(SCREEN)+XCURSESSHMMIN,0700)) < 0) - { - perror("Cannot allocate shared memory for SCREEN"); - kill(otherpid,SIGKILL); - return(ERR); - } - SP = (SCREEN*)shmat(shmidSP,0,0); - XCursesLINES = SP->lines; - LINES = XCursesLINES - SP->linesrippedoff - SP->slklines; - XCursesCOLS = COLS = SP->cols; - if ((shmid_Xcurscr = shmget(shmkey_Xcurscr,SP->XcurscrSize+XCURSESSHMMIN,0700)) < 0) - { - perror("Cannot allocate shared memory for curscr"); - kill(otherpid,SIGKILL); - return(ERR); - } -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:shmid_Xcurscr %d shmkey_Xcurscr %d LINES %d COLS %d\n",(XCursesProcess)?" X":"CURSES",shmid_Xcurscr,shmkey_Xcurscr,LINES,COLS); -#endif - Xcurscr = (unsigned char *)shmat(shmid_Xcurscr,0,0); - atrtab = (unsigned char *)(Xcurscr+XCURSCR_ATRTAB_OFF); - PDC_init_atrtab(); -#ifdef PDCDEBUG - say ("cursesprocess exiting from Xinitscr\n"); -#endif - /* - * Always trap SIGWINCH if the C library supports SIGWINCH... - */ - XCursesSetSignal(SIGWINCH, XCursesSigwinchHandler ); - return(OK); -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCursesInitscr(char *display_name, int argc, char *argv[]) -#else -int XCursesInitscr(display_name,argc,argv) -char *display_name; -int argc; -char *argv[]; -#endif -/***********************************************************************/ -{ - int pid,rc; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesInitscr() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - -#if defined FOREIGN - if (setlocale(LC_ALL, "") == NULL) - { - fprintf(stderr, "ERROR: cannot set locale\n"); - return(ERR); - } -/* - * Shouldn't this code be in x11.c with the X11 thread stuff ?? - */ - if (!XSupportsLocale()) - { - fprintf(stderr, "ERROR: X does not support locale\n"); - return(ERR); - } - if (XSetLocaleModifiers("") == NULL) - fprintf(stderr, "WARNING: Cannot set locale modifiers\n"); -#endif - - if ( pipe( dis_pipe ) < 0 ) - { - fprintf(stderr, "ERROR: cannot create display pipe\n"); - return(ERR); - } - dis_r = dis_pipe[0]; - dis_w = dis_pipe[1]; - - if ( pipe( key_pipe ) < 0 ) - { - fprintf(stderr, "ERROR: cannot create key pipe\n"); - return(ERR); - } - key_r = key_pipe[0]; - key_w = key_pipe[1]; - - tid = pthread_create(&tid, XCursesSetupX(), NULL, ) - pid = fork(); - switch(pid) - { - case (-1): - fprintf(stderr,"ERROR: cannot fork()\n"); - return(ERR); - break; - case 0: /* child */ - shmkey_Xcurscr = getpid(); -#ifdef XISPARENT - XCursesProcess=0; - rc = XCursesSetupCurses(); -#else - XCursesProcess=1; - otherpid = getppid(); - rc = XCursesSetupX(display_name,argc,argv); -#endif - break; - default: /* parent */ - shmkey_Xcurscr = pid; -#ifdef XISPARENT - XCursesProcess=1; - otherpid = pid; - rc = XCursesSetupX(display_name,argc,argv); -#else - XCursesProcess=0; - rc = XCursesSetupCurses(); -#endif - break; - } - return(rc); -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCurses_getclipboard( char **contents, long *length ) -#else -int XCurses_getclipboard( contents, length ) -char **contents; -long *length; -#endif -/***********************************************************************/ -{ - int result=0; - int len; - char buf[12]; - -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_getclipboard() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - XCursesInstructAndWait(CURSES_GET_SELECTION); - - if (read_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitCursesProcess(5,"exiting from XCurses_getclipboard"); - memcpy((char *)&result,buf,sizeof(int)); - if (result == PDC_CLIP_SUCCESS) - { - if (read_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitCursesProcess(5,"exiting from XCurses_getclipboard"); - memcpy((char *)&len,buf,sizeof(int)); - if (len != 0) - { - *contents = (char *)malloc(len+1); - if (!*contents) - XCursesExitCursesProcess(6,"exitting from XCurses_getclipboard - synchronization error"); - if (read_socket(display_sock,*contents,len) < 0) - XCursesExitCursesProcess(5,"exiting from XCurses_getclipboard"); - *length = len; - } - } - return result; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -int XCurses_setclipboard( char *contents, long length ) -#else -int XCurses_setclipboard( contents, length ) -char *contents; -long length; -#endif -/***********************************************************************/ -{ - int rc=0; - char buf[12]; /* big enough for 2 integers */ - long len=length; -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCurses_setclipboard() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - XCursesInstruct(CURSES_SET_SELECTION); - memcpy(buf,(char *)&len,sizeof(long)); - if (write_socket(display_sock,buf,sizeof(long)) < 0) - XCursesExitCursesProcess(5,"exiting from XCurses_setclipboard"); - if (write_socket(display_sock,contents,length) < 0) - XCursesExitCursesProcess(5,"exiting from XCurses_setclipboard"); - /* - * Wait for X to do its stuff. Now expect return code... - */ - if (read_socket(display_sock,buf,sizeof(int)) < 0) - XCursesExitCursesProcess(5,"exiting from XCurses_setclipboard"); - memcpy((char *)&rc,buf,sizeof(int)); - return rc; -} - -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesCleanupCursesProcess(int rc) -#else -void XCursesCleanupCursesProcess(rc) -int rc; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesCleanupCursesProcess() - called: %d\n",(XCursesProcess)?" X":"CURSES",rc); -#endif - close(display_sock); - close(key_sock); - if (rc) - _exit(rc); - else - return; -} -/***********************************************************************/ -#ifdef HAVE_PROTO -static void XCursesExitCursesProcess(int rc,char *msg) -#else -static void XCursesExitCursesProcess(rc,msg) -int rc; -char *msg; -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesExitCursesProcess() - called: %d %s\n",(XCursesProcess)?" X":"CURSES",rc,msg); -#endif - endwin(); - XCursesCleanupCursesProcess(rc); - return; -} -/***********************************************************************/ -#ifdef HAVE_PROTO -void XCursesExit(void) -#else -void XCursesExit() -#endif -/***********************************************************************/ -{ -#ifdef PDCDEBUG - if (trace_on) PDC_debug("%s:XCursesExit() - called\n",(XCursesProcess)?" X":"CURSES"); -#endif - XCursesInstruct(CURSES_EXIT); - XCursesCleanupCursesProcess(0); - return; -}