*** empty log message ***
authorroot <root>
Sun, 16 Jan 2005 18:05:37 +0000 (18:05 +0000)
committerroot <root>
Sun, 16 Jan 2005 18:05:37 +0000 (18:05 +0000)
src/Makefile.in
src/keyboard.C
src/keyboard.h

index a296c5c..8bc7fcc 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.19 2004-08-20 02:19:38 root Exp $
+# $Id: Makefile.in,v 1.23 2005-01-16 18:05:37 root Exp $
 @MCOMMON@
 
 LINT = lint -DNARROWPROTO=1 $(XINC) -chapbxz
 @MCOMMON@
 
 LINT = lint -DNARROWPROTO=1 $(XINC) -chapbxz
@@ -16,6 +16,7 @@ MKDIR = @top_srcdir@/autoconf/mkinstalldirs
 #      -DDEBUG_CMD -DDEBUG_MAIN -DDEBUG_MENU -DDEBUG_MENUARROWS
 #      -DDEBUG_MENUBAR_STACKING -DDEBUG_MENU_LAYOUT -DDEBUG_RESOURCES
 #      -DDEBUG_SEARCH_PATH -DDEBUG_SIZE -DDEBUG_TTY -DDEBUG_TTYMODE
 #      -DDEBUG_CMD -DDEBUG_MAIN -DDEBUG_MENU -DDEBUG_MENUARROWS
 #      -DDEBUG_MENUBAR_STACKING -DDEBUG_MENU_LAYOUT -DDEBUG_RESOURCES
 #      -DDEBUG_SEARCH_PATH -DDEBUG_SIZE -DDEBUG_TTY -DDEBUG_TTYMODE
+#      -DDEBUG_KEYBOARD
 DEBUG=-DDEBUG_STRICT @DEBUG@
 
 first_rule: all
 DEBUG=-DDEBUG_STRICT @DEBUG@
 
 first_rule: all
@@ -25,24 +26,24 @@ LIBSRCS = command.C rxvtfont.C init.C logging.C \
        main.C menubar.C misc.C netdisp.C ptytty.C screen.C scrollbar.C \
        scrollbar-rxvt.C scrollbar-next.C scrollbar-xterm.C strings.C \
        xdefaults.C xpm.C encoding.C rxvttoolkit.C rxvtutil.C iom.C \
        main.C menubar.C misc.C netdisp.C ptytty.C screen.C scrollbar.C \
        scrollbar-rxvt.C scrollbar-next.C scrollbar-xterm.C strings.C \
        xdefaults.C xpm.C encoding.C rxvttoolkit.C rxvtutil.C iom.C \
-       scrollbar-plain.C
+       scrollbar-plain.C keyboard.C
 
 SRCS =  rxvt.C $(LIBSRCS)
 
 HDRS = command.h rxvtfont.h feature.h init.h logging.h \
        menubar.h netdisp.h rxvt.h rxvtgrx.h version.h encoding.h \
 
 SRCS =  rxvt.C $(LIBSRCS)
 
 HDRS = command.h rxvtfont.h feature.h init.h logging.h \
        menubar.h netdisp.h rxvt.h rxvtgrx.h version.h encoding.h \
-       rxvtutil.h iom.h iom_conf.h
+       rxvtutil.h iom.h iom_conf.h keyboard.h
 
 EXTRAHDRS = rxvtlib.h rxvtdaemon.h
 
 OBJS = command.o rxvtfont.o init.o logging.o \
        main.o menubar.o misc.o netdisp.o ptytty.o screen.o \
        scrollbar.o scrollbar-next.o scrollbar-rxvt.o scrollbar-xterm.o scrollbar-plain.o \
 
 EXTRAHDRS = rxvtlib.h rxvtdaemon.h
 
 OBJS = command.o rxvtfont.o init.o logging.o \
        main.o menubar.o misc.o netdisp.o ptytty.o screen.o \
        scrollbar.o scrollbar-next.o scrollbar-rxvt.o scrollbar-xterm.o scrollbar-plain.o \
-       strings.o xdefaults.o xpm.o rxvt.o encoding.o rxvttoolkit.o rxvtutil.o iom.o
+       strings.o xdefaults.o xpm.o rxvt.o encoding.o rxvttoolkit.o rxvtutil.o iom.o keyboard.o
 LIBOBJS = command.lo rxvtfont.lo init.lo logging.lo \
        main.lo menubar.lo misc.lo netdisp.lo ptytty.lo screen.lo \
        scrollbar.lo scrollbar-next.lo scrollbar-rxvt.lo scrollbar-xterm.lo scrollbar-plain.lo \
 LIBOBJS = command.lo rxvtfont.lo init.lo logging.lo \
        main.lo menubar.lo misc.lo netdisp.lo ptytty.lo screen.lo \
        scrollbar.lo scrollbar-next.lo scrollbar-rxvt.lo scrollbar-xterm.lo scrollbar-plain.lo \
-       strings.lo xdefaults.lo xpm.lo encoding.lo rxvt.lo rxvttoolkit.lo rxvtutil.lo iom.lo
+       strings.lo xdefaults.lo xpm.lo encoding.lo rxvt.lo rxvttoolkit.lo rxvtutil.lo iom.lo keyboard.lo
 
 LIBVERSION = @LIBVERSION@
 INSTALL_LIBRXVT = @INSTALL_LIBRXVT@
 
 LIBVERSION = @LIBVERSION@
 INSTALL_LIBRXVT = @INSTALL_LIBRXVT@
@@ -54,9 +55,7 @@ RXVTD_BINNAME=$(DESTDIR)$(bindir)/$(RXVT_BASENAME)d$(EXEEXT)
 RXVT_OLDNAME=$(DESTDIR)$(bindir)/$(RXVT_BASENAME)-old$(EXEEXT)
 
 INTPROS = rxvtfont.intpro logging.intpro main.intpro misc.intpro \
 RXVT_OLDNAME=$(DESTDIR)$(bindir)/$(RXVT_BASENAME)-old$(EXEEXT)
 
 INTPROS = rxvtfont.intpro logging.intpro main.intpro misc.intpro \
-       ptytty.intpro xpm.intpro
-
-DEPS =  rxvt.h rxvtlib.h ${basedir}/config.h feature.h rxvttoolkit.h
+         ptytty.intpro xpm.intpro
 
 #
 # Distribution variables
 
 #
 # Distribution variables
@@ -156,60 +155,186 @@ distdirs:
 distcopy: $(INTPROS)
        $(CP) -p $(DIST) $(basedir)/../$(VERNAME)/$(thisdir)
 
 distcopy: $(INTPROS)
        $(CP) -p $(DIST) $(basedir)/../$(VERNAME)/$(thisdir)
 
-# -----------------------------------------------------------------------
-# DO NOT DELETE: nice dependency list follows
-#
-
-rxvtfont.h: encoding.h rxvtutil.h
-rxvtlib.h: rxvttoolkit.h rxvtfont.h
-rxvtdaemon.o:       rxvtdaemon.C $(DEPS) rxvtdaemon.h
-rxvtd.o:            rxvtd.C     $(DEPS) rxvtdaemon.h rxvtutil.h
-rxvtc.o:            rxvtc.C     $(DEPS) rxvtdaemon.h rxvtutil.h
-
-command.o:          command.C   $(DEPS) command.h version.h
-rxvtfont.o:         rxvtfont.C  $(DEPS) rxvtfont.h
-init.o:             init.C      $(DEPS) init.h rxvtfont.h
-logging.o:          logging.C   $(DEPS) logging.intpro logging.h
-main.o:             main.C      $(DEPS) main.intpro
-menubar.o:          menubar.C   $(DEPS) menubar.h version.h
-misc.o:             misc.C      $(DEPS) misc.intpro
-netdisp.o:          netdisp.C   $(DEPS) netdisp.h
-ptytty.o:           ptytty.C    $(DEPS) ptytty.intpro
-rxvt.o:             rxvt.C      $(DEPS) 
-screen.o:           screen.C    $(DEPS) rxvtfont.h
-scrollbar.o:        scrollbar.C $(DEPS)
-scrollbar-rxvt.o:   scrollbar-rxvt.C  $(DEPS)
-scrollbar-next.o:   scrollbar-next.C  $(DEPS)
-scrollbar-xterm.o:  scrollbar-xterm.C $(DEPS)
-scrollbar-plain.o:  scrollbar-plain.C $(DEPS)
-strings.o:          strings.C   $(DEPS)
-xdefaults.o:        xdefaults.C $(DEPS) version.h
-xpm.o:              xpm.C       $(DEPS) xpm.intpro
-encoding.o:         encoding.C $(DEPS) encoding.h
-rxvttoolkit.o:      rxvttoolkit.C      $(DEPS)
-iom.o:              iom.C      $(DEPS) iom.h
-
-command.lo:         command.C   $(DEPS) version.h
-rxvtfont.lo:        rxvtfont.C  $(DEPS) rxvtfont.h encoding.h
-init.lo:            init.C      $(DEPS) init.intpro    init.h  
-logging.lo:         logging.C   $(DEPS) logging.intpro logging.h
-main.lo:            main.C      $(DEPS) main.intpro
-menubar.lo:         menubar.C   $(DEPS) version.h
-misc.lo:            misc.C      $(DEPS) misc.intpro
-netdisp.lo:         netdisp.C   $(DEPS) netdisp.h
-ptytty.lo:          ptytty.C    $(DEPS) ptytty.intpro
-rxvt.lo:            rxvt.C      $(DEPS) 
-screen.lo:          screen.C    $(DEPS) rxvtfont.h
-scrollbar.lo:       scrollbar.C $(DEPS)
-scrollbar-rxvt.lo:  scrollbar-rxvt.C  $(DEPS)
-scrollbar-next.lo:  scrollbar-next.C  $(DEPS)
-scrollbar-xterm.lo: scrollbar-xterm.C $(DEPS)
-scrollbar-plain.lo: scrollbar-plain.C $(DEPS)
-strings.lo:         strings.C   $(DEPS)
-xdefaults.lo:       xdefaults.C $(DEPS) version.h
-xpm.lo:             xpm.C       $(DEPS) xpm.intpro
-encoding.lo:        encoding.C $(DEPS) encoding.h
-rxvttoolkit.lo:     rxvttoolkit.C      $(DEPS)
-iom.lo:             iom.C      $(DEPS) iom.h
+depend:
+       makedepend -f Makefile.in -I. -Y *.C >/dev/null 2>&1
+       makedepend -f Makefile.in -I. -Y *.C -a -o .lo >/dev/null 2>&1
 
 
+# DO NOT DELETE: nice dependency list follows
 
 
+command.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+command.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+command.o: salloc.h menubar.h version.h command.h keyboard.h
+encoding.o: ../config.h encoding.h table/iso8859_1.h table/iso8859_15.h
+encoding.o: table/iso8859_2.h table/iso8859_3.h table/iso8859_4.h
+encoding.o: table/iso8859_5.h table/iso8859_6.h table/iso8859_7.h
+encoding.o: table/iso8859_8.h table/iso8859_9.h table/iso8859_10.h
+encoding.o: table/iso8859_11.h table/iso8859_13.h table/iso8859_14.h
+encoding.o: table/iso8859_16.h table/koi8_r.h table/koi8_u.h
+encoding.o: table/ksc5601_1987_0.h table/big5.h table/gbk_0.h
+encoding.o: table/gb2312_1980_0.h table/cns11643_1992_1.h
+encoding.o: table/cns11643_1992_2.h table/cns11643_1992_3.h
+encoding.o: table/cns11643_1992_4.h table/cns11643_1992_5.h
+encoding.o: table/cns11643_1992_6.h table/cns11643_1992_7.h
+encoding.o: table/cns11643_1992_f.h table/big5_ext.h table/big5_plus.h
+encoding.o: table/viscii.h table/jis0201_1976_0.h table/jis0208_1990_0.h
+encoding.o: table/jis0212_1990_0.h table/jis0213_1.h table/jis0213_2.h
+encoding.o: table/compose.h table/category.h
+init.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvtfont.h
+init.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h
+init.o: menubar.h init.h
+iom.o: iom.h iom_conf.h rxvtutil.h callback.h
+keyboard.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+keyboard.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+keyboard.o: salloc.h menubar.h keyboard.h command.h
+logging.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+logging.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+logging.o: salloc.h menubar.h logging.h logging.intpro
+main.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvtfont.h
+main.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h
+main.o: menubar.h main.intpro keyboard.h
+menubar.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+menubar.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+menubar.o: salloc.h menubar.h version.h
+misc.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvtfont.h
+misc.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h
+misc.o: menubar.h misc.intpro
+netdisp.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+netdisp.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+netdisp.o: salloc.h menubar.h
+ptytty.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+ptytty.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+ptytty.o: salloc.h menubar.h
+rxvt.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvtfont.h
+rxvt.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h
+rxvt.o: menubar.h
+rxvtc.o: ../config.h rxvtdaemon.h rxvtutil.h rxvt.h rxvtlib.h ptytty.h
+rxvtc.o: feature.h encoding.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h
+rxvtc.o: callback.h salloc.h menubar.h
+rxvtd.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+rxvtd.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+rxvtd.o: salloc.h menubar.h rxvtdaemon.h
+rxvtdaemon.o: rxvtdaemon.h rxvtutil.h
+rxvtfont.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+rxvtfont.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+rxvtfont.o: salloc.h menubar.h table/linedraw.h
+rxvttoolkit.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+rxvttoolkit.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h
+rxvttoolkit.o: callback.h salloc.h menubar.h
+rxvtutil.o: rxvtutil.h
+salloc.o: salloc.h
+screen.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+screen.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+screen.o: salloc.h menubar.h salloc.C
+scrollbar-next.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+scrollbar-next.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h
+scrollbar-next.o: callback.h salloc.h menubar.h
+scrollbar-plain.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+scrollbar-plain.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h
+scrollbar-plain.o: callback.h salloc.h menubar.h
+scrollbar-rxvt.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+scrollbar-rxvt.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h
+scrollbar-rxvt.o: callback.h salloc.h menubar.h
+scrollbar-xterm.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+scrollbar-xterm.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h
+scrollbar-xterm.o: callback.h salloc.h menubar.h
+scrollbar.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+scrollbar.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+scrollbar.o: salloc.h menubar.h
+strings.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+strings.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+strings.o: salloc.h menubar.h
+xdefaults.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+xdefaults.o: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+xdefaults.o: salloc.h menubar.h version.h keyboard.h
+xpm.o: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvtfont.h
+xpm.o: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h
+xpm.o: menubar.h xpm.intpro
+
+command.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+command.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+command.lo: salloc.h menubar.h version.h command.h keyboard.h
+encoding.lo: ../config.h encoding.h table/iso8859_1.h table/iso8859_15.h
+encoding.lo: table/iso8859_2.h table/iso8859_3.h table/iso8859_4.h
+encoding.lo: table/iso8859_5.h table/iso8859_6.h table/iso8859_7.h
+encoding.lo: table/iso8859_8.h table/iso8859_9.h table/iso8859_10.h
+encoding.lo: table/iso8859_11.h table/iso8859_13.h table/iso8859_14.h
+encoding.lo: table/iso8859_16.h table/koi8_r.h table/koi8_u.h
+encoding.lo: table/ksc5601_1987_0.h table/big5.h table/gbk_0.h
+encoding.lo: table/gb2312_1980_0.h table/cns11643_1992_1.h
+encoding.lo: table/cns11643_1992_2.h table/cns11643_1992_3.h
+encoding.lo: table/cns11643_1992_4.h table/cns11643_1992_5.h
+encoding.lo: table/cns11643_1992_6.h table/cns11643_1992_7.h
+encoding.lo: table/cns11643_1992_f.h table/big5_ext.h table/big5_plus.h
+encoding.lo: table/viscii.h table/jis0201_1976_0.h table/jis0208_1990_0.h
+encoding.lo: table/jis0212_1990_0.h table/jis0213_1.h table/jis0213_2.h
+encoding.lo: table/compose.h table/category.h
+init.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+init.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+init.lo: salloc.h menubar.h init.h
+iom.lo: iom.h iom_conf.h rxvtutil.h callback.h
+keyboard.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+keyboard.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+keyboard.lo: salloc.h menubar.h keyboard.h command.h
+logging.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+logging.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+logging.lo: salloc.h menubar.h logging.h logging.intpro
+main.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+main.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+main.lo: salloc.h menubar.h main.intpro keyboard.h
+menubar.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+menubar.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+menubar.lo: salloc.h menubar.h version.h
+misc.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+misc.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+misc.lo: salloc.h menubar.h misc.intpro
+netdisp.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+netdisp.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+netdisp.lo: salloc.h menubar.h
+ptytty.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+ptytty.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+ptytty.lo: salloc.h menubar.h
+rxvt.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+rxvt.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+rxvt.lo: salloc.h menubar.h
+rxvtc.lo: ../config.h rxvtdaemon.h rxvtutil.h rxvt.h rxvtlib.h ptytty.h
+rxvtc.lo: feature.h encoding.h rxvtfont.h rxvttoolkit.h iom.h iom_conf.h
+rxvtc.lo: callback.h salloc.h menubar.h
+rxvtd.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+rxvtd.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+rxvtd.lo: salloc.h menubar.h rxvtdaemon.h
+rxvtdaemon.lo: rxvtdaemon.h rxvtutil.h
+rxvtfont.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+rxvtfont.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+rxvtfont.lo: salloc.h menubar.h table/linedraw.h
+rxvttoolkit.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+rxvttoolkit.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h
+rxvttoolkit.lo: callback.h salloc.h menubar.h
+rxvtutil.lo: rxvtutil.h
+salloc.lo: salloc.h
+screen.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+screen.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+screen.lo: salloc.h menubar.h salloc.C
+scrollbar-next.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+scrollbar-next.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h
+scrollbar-next.lo: callback.h salloc.h menubar.h
+scrollbar-plain.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h
+scrollbar-plain.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h
+scrollbar-plain.lo: iom_conf.h callback.h salloc.h menubar.h
+scrollbar-rxvt.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+scrollbar-rxvt.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h
+scrollbar-rxvt.lo: callback.h salloc.h menubar.h
+scrollbar-xterm.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h
+scrollbar-xterm.lo: encoding.h rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h
+scrollbar-xterm.lo: iom_conf.h callback.h salloc.h menubar.h
+scrollbar.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+scrollbar.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+scrollbar.lo: salloc.h menubar.h
+strings.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+strings.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+strings.lo: salloc.h menubar.h
+xdefaults.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h
+xdefaults.lo: rxvtfont.h rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h
+xdefaults.lo: salloc.h menubar.h version.h keyboard.h
+xpm.lo: ../config.h rxvt.h rxvtlib.h ptytty.h feature.h encoding.h rxvtfont.h
+xpm.lo: rxvtutil.h rxvttoolkit.h iom.h iom_conf.h callback.h salloc.h
+xpm.lo: menubar.h xpm.intpro
index 5491125..4fdf020 100644 (file)
 
 ////////////////////////////////////////////////////////////////////////////////
 // default keycode translation map and keyevent handlers
 
 ////////////////////////////////////////////////////////////////////////////////
 // default keycode translation map and keyevent handlers
-keyevent_handler keysym_translator;
-keyevent_handler keyrange_translator;
-keyevent_handler keyrange_translator_meta8;
-keyevent_handler keylist_translator;
 
 
-keysym_t keyboard_manager::stock_keymap_[] =
-{
+keysym_t keyboard_manager::stock_keymap[] = {
   /* examples */
   /* examples */
-  /*        keysym,                state, range,                   handler,             str*/
-//{XK_ISO_Left_Tab,                    0,     1,         keysym_translator,           "\033[Z"},
-//{            'a',                    0,    26, keyrange_translator_meta8,           "a" "%c"},
-//{            'a',          ControlMask,    26, keyrange_translator_meta8,          "\ 1" "%c"},
-//{        XK_Left,                    0,     4,        keylist_translator,   "DACBZ" "\033[Z"},
-//{        XK_Left,            ShiftMask,     4,        keylist_translator,   "dacbZ" "\033[Z"},
-//{        XK_Left,          ControlMask,     4,        keylist_translator,   "dacbZ" "\033OZ"},
-//{         XK_Tab,          ControlMask,     1,         keysym_translator,      "\033<C-Tab>"},
-//{  XK_apostrophe,          ControlMask,     1,         keysym_translator,        "\033<C-'>"},
-//{       XK_slash,          ControlMask,     1,         keysym_translator,        "\033<C-/>"},
-//{   XK_semicolon,          ControlMask,     1,         keysym_translator,        "\033<C-;>"},
-//{       XK_grave,          ControlMask,     1,         keysym_translator,        "\033<C-`>"},
-//{       XK_comma,          ControlMask,     1,         keysym_translator,     "\033<C-\054>"},
-//{      XK_Return,          ControlMask,     1,         keysym_translator,    "\033<C-Return>"},
-//{      XK_Return,            ShiftMask,     1,         keysym_translator,    "\033<S-Return>"},
-//{            ' ',            ShiftMask,     1,         keysym_translator,    "\033<S-Space>"},
-//{            '.',          ControlMask,     1,         keysym_translator,        "\033<C-.>"},
-//{            '0',          ControlMask,    10,       keyrange_translator,   "0" "\033<C-%c>"},
-//{            '0', MetaMask|ControlMask,    10,       keyrange_translator, "0" "\033<M-C-%c>"},
-//{            'a', MetaMask|ControlMask,    26,       keyrange_translator, "a" "\033<M-C-%c>"},
+  /*        keysym,                state, range,        handler,             str */
+//{XK_ISO_Left_Tab,                    0,     1,         NORMAL,           "\033[Z"},
+//{            'a',                    0,    26,    RANGE_META8,           "a" "%c"},
+//{            'a',          ControlMask,    26,    RANGE_META8,          "\ 1" "%c"},
+//{        XK_Left,                    0,     4,           LIST,   "DACBZ" "\033[Z"},
+//{        XK_Left,            ShiftMask,     4,           LIST,   "dacbZ" "\033[Z"},
+//{        XK_Left,          ControlMask,     4,           LIST,   "dacbZ" "\033OZ"},
+//{         XK_Tab,          ControlMask,     1,         NORMAL,      "\033<C-Tab>"},
+//{  XK_apostrophe,          ControlMask,     1,         NORMAL,        "\033<C-'>"},
+//{       XK_slash,          ControlMask,     1,         NORMAL,        "\033<C-/>"},
+//{   XK_semicolon,          ControlMask,     1,         NORMAL,        "\033<C-;>"},
+//{       XK_grave,          ControlMask,     1,         NORMAL,        "\033<C-`>"},
+//{       XK_comma,          ControlMask,     1,         NORMAL,     "\033<C-\054>"},
+//{      XK_Return,          ControlMask,     1,         NORMAL,    "\033<C-Return>"},
+//{      XK_Return,            ShiftMask,     1,         NORMAL,    "\033<S-Return>"},
+//{            ' ',            ShiftMask,     1,         NORMAL,    "\033<S-Space>"},
+//{            '.',          ControlMask,     1,         NORMAL,        "\033<C-.>"},
+//{            '0',          ControlMask,    10,          RANGE,   "0" "\033<C-%c>"},
+//{            '0', MetaMask|ControlMask,    10,          RANGE, "0" "\033<M-C-%c>"},
+//{            'a', MetaMask|ControlMask,    26,          RANGE, "a" "\033<M-C-%c>"},
 };
 
 };
 
-void output_string (rxvt_term *rt,
-                    const char *str)
+static void
+output_string (rxvt_term *rt, const char *str)
 {
   assert (rt && str);
 {
   assert (rt && str);
+
   if (strncmp (str, "proto:", 6) == 0)
   if (strncmp (str, "proto:", 6) == 0)
-    rt->cmd_write ((unsigned char*)str + 6, strlen (str) - 6);
+    rt->cmd_write ((unsigned char *)str + 6, strlen (str) - 6);
   else
   else
-    rt->tt_write ((unsigned char*)str, strlen (str));
+    rt->tt_write ((unsigned char *)str, strlen (str));
 }
 
 }
 
-void output_string_meta8 (rxvt_term *rt,
-                          unsigned int state,
-                          char buf[],
-                          int buflen)
+static void
+output_string_meta8 (rxvt_term *rt, unsigned int state, char *buf, int buflen)
 {
   if (state & rt->ModMetaMask)
     {
 #ifdef META8_OPTION
 {
   if (state & rt->ModMetaMask)
     {
 #ifdef META8_OPTION
-      if(rt->meta_char == 0x80) /* set 8-bit on */
+      if (rt->meta_char == 0x80)       /* set 8-bit on */
         {
           for (char *ch = buf; ch < buf + buflen; ch++)
             *ch |= 0x80;
         }
         {
           for (char *ch = buf; ch < buf + buflen; ch++)
             *ch |= 0x80;
         }
-      else if(rt->meta_char == C0_ESC) /* escape prefix */
+      else if (rt->meta_char == C0_ESC)        /* escape prefix */
 #endif
         {
 #endif
         {
-          const unsigned char ch = C0_ESC;
+          const unsigned char
+            ch = C0_ESC;
           rt->tt_write (&ch, 1);
         }
     }
 
           rt->tt_write (&ch, 1);
         }
     }
 
-  rt->tt_write ((unsigned char*)buf, buflen);
+  rt->tt_write ((unsigned char *) buf, buflen);
 }
 
 }
 
-int format_keyrange_string (keysym_t *key,
-                            KeySym keysym,
-                            char buf[],
-                            int bufsize)
+static int
+format_keyrange_string (const char *str, int keysym_offset, char *buf, int bufsize)
 {
 {
-  int len;
+  int len = snprintf (buf, bufsize, str + 1, keysym_offset + str [0]);
 
 
-  assert (key->str);
-  len = snprintf (buf, bufsize, key->str + 1,
-                  keysym - key->keysym + (int)(key->str[0]));
   if (len >= bufsize)
     {
       fprintf (stderr, "buffer overflowed!\n");
   if (len >= bufsize)
     {
       fprintf (stderr, "buffer overflowed!\n");
-      buf[bufsize-1] = '\0';
+      buf[bufsize - 1] = '\0';
     }
   else if (len < 0)
     {
     }
   else if (len < 0)
     {
-      perror("keyrange_translator()");
+      perror ("keyrange_translator()");
     }
 
   return len;
 }
 
     }
 
   return len;
 }
 
-bool format_keylist_string (keysym_t *key,
-                            KeySym keysym,
-                            char buf[],
-                            int bufsize)
-{
-  char *p;
-
-  assert (key->str);
-  strncpy (buf, key->str + key->range + 1, bufsize);
-  buf[bufsize-1] = '\0';
-
-  p = strchr (buf, key->str[key->range]);
-  if (p)
-    {
-      *p = key->str[keysym - key->keysym];
-      return true;
-    }
-  else
-    {
-      fprintf (stderr, "invalid str for keylist_translator()!\n");
-      return false;
-    }
-}
-
-/////////////////////////////////////////////////////////////////
-void keysym_translator (rxvt_term *rt,
-                        keysym_t *key,
-                        KeySym keysym,
-                        unsigned int state)
-{
-  output_string (rt, key->str);
-}
-
-void keyrange_translator (rxvt_term *rt,
-                          keysym_t *key,
-                          KeySym keysym,
-                          unsigned int state)
-{
-  char buf[STRING_MAX];
-
-  if (format_keyrange_string (key, keysym, buf, sizeof(buf)) > 0)
-    output_string (rt, buf);
-}
-
-void keyrange_translator_meta8 (rxvt_term *rt,
-                                keysym_t *key,
-                                KeySym keysym,
-                                unsigned int state)
-{
-  int len;
-  char buf[STRING_MAX];
-
-  len = format_keyrange_string (key, keysym, buf, sizeof(buf));
-  if (len > 0)
-    output_string_meta8 (rt, state, buf, len);
-}
-
-void keylist_translator (rxvt_term *rt,
-                         keysym_t *key,
-                         KeySym keysym,
-                         unsigned int state)
-{
-  char buf[STRING_MAX];
-
-  format_keylist_string (key, keysym, buf, sizeof(buf));
-  output_string (rt, buf);
-}
-
 ////////////////////////////////////////////////////////////////////////////////
 // return: #bits of '1'
 ////////////////////////////////////////////////////////////////////////////////
 // return: #bits of '1'
-int
+static int
 bitcount (unsigned int n)
 {
   int i;
 bitcount (unsigned int n)
 {
   int i;
-  for (i = 0; n; ++i, n &= (n - 1));
+
+  for (i = 0; n; ++i, n &= (n - 1))
+    ;
+
   return i;
 }
 
 // return: priority_of_a - priority_of_b
   return i;
 }
 
 // return: priority_of_a - priority_of_b
-int
+static int
 compare_priority (keysym_t *a, keysym_t *b)
 {
   assert (a && b);
 
   // (the more '1's in state; the less range): the greater priority
 compare_priority (keysym_t *a, keysym_t *b)
 {
   assert (a && b);
 
   // (the more '1's in state; the less range): the greater priority
-  int ca = bitcount (a->state/* & AllModMask*/);
-  int cb = bitcount (b->state/* & AllModMask*/);
+  int ca = bitcount (a->state /* & OtherModMask */);
+  int cb = bitcount (b->state /* & OtherModMask */);
+
   if (ca != cb)
     return ca - cb;
 //else if (a->state != b->state) // this behavior is to be disscussed
   if (ca != cb)
     return ca - cb;
 //else if (a->state != b->state) // this behavior is to be disscussed
@@ -192,11 +118,10 @@ compare_priority (keysym_t *a, keysym_t *b)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-keyboard_manager::keyboard_manager (rxvt_term *rt)
-  :term_(rt)
+keyboard_manager::keyboard_manager ()
 {
 {
-  keymap_.reserve (256);
-  hash_[0] = 1; // hash_[0] != 0 indicates uninitialized data
+  keymap.reserve (256);
+  hash[0] = 1;                 // hash[0] != 0 indicates uninitialized data
 }
 
 keyboard_manager::~keyboard_manager ()
 }
 
 keyboard_manager::~keyboard_manager ()
@@ -207,23 +132,23 @@ keyboard_manager::~keyboard_manager ()
 void
 keyboard_manager::clear ()
 {
 void
 keyboard_manager::clear ()
 {
-  keymap_.clear ();
-  hash_[0] = 2;
+  keymap.clear ();
+  hash [0] = 2;
 
 
-  for(unsigned int i = 0;i < user_translations_.size();++i)
+  for (unsigned int i = 0; i < user_translations.size (); ++i)
     {
     {
-      delete[] user_translations_[i];
-      user_translations_[i] = 0;
+      free ((void *)user_translations [i]);
+      user_translations [i] = 0;
     }
 
     }
 
-  for(unsigned int i = 0;i < user_keymap_.size();++i)
+  for (unsigned int i = 0; i < user_keymap.size (); ++i)
     {
     {
-      delete user_keymap_[i];
-      user_keymap_[i] = 0;
+      delete user_keymap [i];
+      user_keymap [i] = 0;
     }
 
     }
 
-  user_keymap_.clear();
-  user_translations_.clear();
+  user_keymap.clear ();
+  user_translations.clear ();
 }
 
 // a wrapper for register_keymap,
 }
 
 // a wrapper for register_keymap,
@@ -232,47 +157,51 @@ keyboard_manager::clear ()
 // the string 'trans' is copied to an internal managed buffer,
 // so the caller can free memory of 'trans' at any time.
 void
 // the string 'trans' is copied to an internal managed buffer,
 // so the caller can free memory of 'trans' at any time.
 void
-keyboard_manager::register_user_translation (KeySym keysym,
-                                             unsigned int state,
-                                             const char *trans)
+keyboard_manager::register_user_translation (KeySym keysym, unsigned int state, const char *trans)
 {
 {
-  assert(trans);
+  assert (trans);
 
   keysym_t *key = new keysym_t;
 
   keysym_t *key = new keysym_t;
-  const char *translation = new char[1+strlen(trans)];
+  wchar_t *wc = rxvt_mbstowcs (trans);
+  const char *translation = rxvt_wcstoutf8 (wc);
+  free (wc);
 
 
-  if(key && translation)
+  if (key && translation)
     {
       key->keysym = keysym;
     {
       key->keysym = keysym;
-      key->state = state;
-      key->range = 1;
-      key->str = translation;
+      key->state  = state;
+      key->range  = 1;
+      key->str    = translation;
+      key->type   = keysym_t::NORMAL;
 
 
-      if (strncmp (trans, "list", 4) == 0)
-        {
-          const char *p = &trans[4];
-          if (*p && (p = strchr (p+1, *p)))
-            if ((p - trans - 5 > 1) && strchr (p+1, *p))
-              {
-                strcpy (translation, trans+5);
-                key->range = p - trans - 5;
-                key->handler = keylist_translator;
-              }
-        }
-      if (key->range == 1)
+      if (strncmp (translation, "list", 4) == 0 && translation [4])
         {
         {
-          strcpy (translation, trans);
-          key->handler = keysym_translator;
+          char *middle = strchr  (translation + 5, translation [4]);
+          char *suffix = strrchr (translation + 5, translation [4]);
+          
+          if (suffix && middle && suffix > middle + 1)
+            {
+              key->type  = keysym_t::LIST;
+              key->range = suffix - middle - 1;
+
+              strcpy (translation, translation + 4);
+            }
+          else
+            {
+              key->range = 1;
+              rxvt_warn ("cannot parse list-type keysym '%s', treating as normal keysym.\n", translation);
+            }
         }
         }
+      else
 
 
-      user_keymap_.push_back (key);
-      user_translations_.push_back (translation);
+      user_keymap.push_back (key);
+      user_translations.push_back (translation);
       register_keymap (key);
     }
   else
     {
       delete key;
       register_keymap (key);
     }
   else
     {
       delete key;
-      delete[] translation;
+      free ((void *)translation);
       rxvt_fatal ("out of memory, aborting.\n");
     }
 }
       rxvt_fatal ("out of memory, aborting.\n");
     }
 }
@@ -281,86 +210,143 @@ void
 keyboard_manager::register_keymap (keysym_t *key)
 {
   assert (key);
 keyboard_manager::register_keymap (keysym_t *key)
 {
   assert (key);
-  assert (key->handler);
   assert (key->range >= 1);
 
   assert (key->range >= 1);
 
-  if (keymap_.size () == keymap_.capacity ())
-    keymap_.reserve (keymap_.size () * 2);
+  if (keymap.size () == keymap.capacity ())
+    keymap.reserve (keymap.size () * 2);
 
 
-  keymap_.push_back (key);
-  hash_[0] = 3;
+  keymap.push_back (key);
+  hash[0] = 3;
 }
 
 void
 keyboard_manager::register_done ()
 {
 }
 
 void
 keyboard_manager::register_done ()
 {
-  unsigned int i, n = sizeof(stock_keymap_)/sizeof(keysym_t);
+  unsigned int i, n = sizeof (stock_keymap) / sizeof (keysym_t);
 
 
-  if(keymap_.back() != &stock_keymap_[n-1])
-    for(i = 0;i < n;++i)
-      register_keymap(&stock_keymap_[i]);
+  if (keymap.back () != &stock_keymap[n - 1])
+    for (i = 0; i < n; ++i)
+      register_keymap (&stock_keymap[i]);
 
   purge_duplicate_keymap ();
 
 
   purge_duplicate_keymap ();
 
-  for (i = 0; i < keymap_.size(); ++i)
+#if TO_BE_DONE_INSIDE_dispatch
+  for (i = 0; i < keymap.size (); ++i)
     {
     {
-      keysym_t *key = keymap_[i];
+      keysym_t *key = keymap[i];
+
+      assert (bitcount (term_->ModMetaMask) == 1 && "call me after ModMetaMask was set!");
 
 
-      assert (bitcount (term_->ModMetaMask) == 1
-              && "call me after ModMetaMask was set!");
       if (key->state & MetaMask)
         {
           //key->state &= ~MetaMask;
           key->state |= term_->ModMetaMask;
         }
 
       if (key->state & MetaMask)
         {
           //key->state &= ~MetaMask;
           key->state |= term_->ModMetaMask;
         }
 
-      assert (bitcount (term_->ModNumLockMask) == 1
-              && "call me after ModNumLockMask was set!");
+      assert (bitcount (term_->ModNumLockMask) == 1 && "call me after ModNumLockMask was set!");
+
       if (key->state & NumLockMask)
         {
           //key->state &= ~NumLockMask;
           key->state |= term_->ModNumLockMask;
         }
     }
       if (key->state & NumLockMask)
         {
           //key->state &= ~NumLockMask;
           key->state |= term_->ModNumLockMask;
         }
     }
+#endif
 
   setup_hash ();
 }
 
 
   setup_hash ();
 }
 
-bool keyboard_manager::dispatch (KeySym keysym, unsigned int state)
+bool
+keyboard_manager::dispatch (rxvt_term *term, KeySym keysym, unsigned int state)
 {
 {
-  assert(hash_[0] == 0 && "register_done() need to be called");
+  assert (hash[0] == 0 && "register_done() need to be called");
 
   int index = find_keysym (keysym, state);
 
   if (index >= 0)
     {
 
   int index = find_keysym (keysym, state);
 
   if (index >= 0)
     {
-      assert (term_ && keymap_[index] && keymap_[index]->handler);
-      keymap_[index]->handler (term_, keymap_[index], keysym, state);
+      assert (term && keymap [index]);
+      const keysym_t &key = *keymap [index];
+
+      int keysym_offset = keysym - key.keysym;
+
+      wchar_t *wc = rxvt_utf8towcs (key.str);
+      char *str = rxvt_wcstombs (wc);
+      // TODO: do translations, unescaping etc, here (allow \u escape etc.)
+      free (wc);
+
+      switch (key.type)
+        {
+         case keysym_t::NORMAL:
+            output_string (term, str);
+            break;
+
+          case keysym_t::RANGE:
+            {
+              char buf[STRING_MAX];
+
+              if (format_keyrange_string (str, keysym_offset, buf, sizeof (buf)) > 0)
+                output_string (term, buf);
+            }
+            break;
+
+          case keysym_t::RANGE_META8:
+            {
+              int len;
+              char buf[STRING_MAX];
+
+              len = format_keyrange_string (str, keysym_offset, buf, sizeof (buf));
+              if (len > 0)
+                output_string_meta8 (term, state, buf, len);
+            }
+            break;
+
+          case keysym_t::LIST:
+            {
+              char buf[STRING_MAX];
+
+              char *prefix, *middle, *suffix;
+
+              prefix = str;
+              middle = strchr  (prefix + 1, *prefix);
+              suffix = strrchr (middle + 1, *prefix);
+
+              memcpy (buf, prefix + 1, middle - prefix - 1);
+              buf [middle - prefix - 1] = middle [keysym_offset + 1];
+              strcpy (buf + (middle - prefix), suffix + 1);
+
+              output_string (term, buf);
+            }
+            break;
+        }
+
+      free (str);
+
       return true;
     }
   else
       return true;
     }
   else
-  {
-    // fprintf(stderr,"[%x:%x]",state,keysym);
-    return false;
-  }
+    {
+      // fprintf(stderr,"[%x:%x]",state,keysym);
+      return false;
+    }
 }
 
 }
 
-// purge duplicate keymap_ entries
-void
-keyboard_manager::purge_duplicate_keymap ()
+// purge duplicate keymap entries
+void keyboard_manager::purge_duplicate_keymap ()
 {
 {
-  for (unsigned int i = 0; i < keymap_.size (); ++i)
+  for (unsigned int i = 0; i < keymap.size (); ++i)
     {
       for (unsigned int j = 0; j < i; ++j)
         {
     {
       for (unsigned int j = 0; j < i; ++j)
         {
-          if (keymap_[i] == keymap_[j])
+          if (keymap[i] == keymap[j])
             {
             {
-              while (keymap_[i] == keymap_.back ())
-                keymap_.pop_back ();
-              if (i < keymap_.size ())
+              while (keymap[i] == keymap.back ())
+                keymap.pop_back ();
+
+              if (i < keymap.size ())
                 {
                 {
-                  keymap_[i] = keymap_.back ();
-                  keymap_.pop_back ();
+                  keymap[i] = keymap.back ();
+                  keymap.pop_back ();
                 }
               break;
             }
                 }
               break;
             }
@@ -372,30 +358,30 @@ void
 keyboard_manager::setup_hash ()
 {
   unsigned int i, index, hashkey;
 keyboard_manager::setup_hash ()
 {
   unsigned int i, index, hashkey;
-  vector<keysym_t *> sorted_keymap;
-  u16 hash_budget_size[KEYSYM_HASH_BUDGETS];     // size of each budget
-  u16 hash_budget_counter[KEYSYM_HASH_BUDGETS];  // #elements in each budget
+  vector <keysym_t *> sorted_keymap;
+  uint16_t hash_budget_size[KEYSYM_HASH_BUDGETS];      // size of each budget
+  uint16_t hash_budget_counter[KEYSYM_HASH_BUDGETS];   // #elements in each budget
 
   memset (hash_budget_size, 0, sizeof (hash_budget_size));
   memset (hash_budget_counter, 0, sizeof (hash_budget_counter));
 
   // count keysyms for corresponding hash budgets
 
   memset (hash_budget_size, 0, sizeof (hash_budget_size));
   memset (hash_budget_counter, 0, sizeof (hash_budget_counter));
 
   // count keysyms for corresponding hash budgets
-  for (i = 0; i < keymap_.size (); ++i)
+  for (i = 0; i < keymap.size (); ++i)
     {
     {
-      assert (keymap_[i]);
-      hashkey = (keymap_[i]->keysym & KEYSYM_HASH_MASK);
+      assert (keymap[i]);
+      hashkey = (keymap[i]->keysym & KEYSYM_HASH_MASK);
       ++hash_budget_size[hashkey];
     }
 
   // keysym A with range>1 is counted one more time for
   // every keysym B lies in its range
       ++hash_budget_size[hashkey];
     }
 
   // keysym A with range>1 is counted one more time for
   // every keysym B lies in its range
-  for (i = 0; i < keymap_.size (); ++i)
+  for (i = 0; i < keymap.size (); ++i)
     {
     {
-      if (keymap_[i]->range > 1)
+      if (keymap[i]->range > 1)
         {
         {
-          for (int j = min (keymap_[i]->range, KEYSYM_HASH_BUDGETS) - 1;j > 0; --j)
+          for (int j = min (keymap[i]->range, KEYSYM_HASH_BUDGETS) - 1; j > 0; --j)
             {
             {
-              hashkey = ((keymap_[i]->keysym + j) & KEYSYM_HASH_MASK);
+              hashkey = ((keymap[i]->keysym + j) & KEYSYM_HASH_MASK);
               if (hash_budget_size[hashkey])
                 ++hash_budget_size[hashkey];
             }
               if (hash_budget_size[hashkey])
                 ++hash_budget_size[hashkey];
             }
@@ -404,53 +390,57 @@ keyboard_manager::setup_hash ()
 
   // now we know the size of each budget
   // compute the index of each budget
 
   // now we know the size of each budget
   // compute the index of each budget
-  hash_[0] = 0;
-  for (index = 0,i = 1; i < KEYSYM_HASH_BUDGETS; ++i)
+  hash[0] = 0;
+  for (index = 0, i = 1; i < KEYSYM_HASH_BUDGETS; ++i)
     {
     {
-      index += hash_budget_size[i-1];
-      hash_[i] = (hash_budget_size[i] ? index : hash_[i-1]);
+      index += hash_budget_size[i - 1];
+      hash[i] = (hash_budget_size[i] ? index : hash[i - 1]);
     }
     }
+
   // and allocate just enough space
   // and allocate just enough space
-  //sorted_keymap.reserve (hash_[i - 1] + hash_budget_size[i - 1]);
-  sorted_keymap.insert (sorted_keymap.begin(), index + hash_budget_size[i - 1], 0);
+  //sorted_keymap.reserve (hash[i - 1] + hash_budget_size[i - 1]);
+  sorted_keymap.insert (sorted_keymap.begin (), index + hash_budget_size[i - 1], 0);
 
   // fill in sorted_keymap
   // it is sorted in each budget
 
   // fill in sorted_keymap
   // it is sorted in each budget
-  for (i = 0; i < keymap_.size (); ++i)
+  for (i = 0; i < keymap.size (); ++i)
     {
     {
-      for (int j = min (keymap_[i]->range, KEYSYM_HASH_BUDGETS) - 1;j >= 0; --j)
+      for (int j = min (keymap[i]->range, KEYSYM_HASH_BUDGETS) - 1; j >= 0; --j)
         {
         {
-          hashkey = ((keymap_[i]->keysym + j) & KEYSYM_HASH_MASK);
+          hashkey = ((keymap[i]->keysym + j) & KEYSYM_HASH_MASK);
+
           if (hash_budget_size[hashkey])
             {
           if (hash_budget_size[hashkey])
             {
-              index = hash_[hashkey] + hash_budget_counter[hashkey];
-              while (index > hash_[hashkey] &&
-                     compare_priority (keymap_[i],
-                                       sorted_keymap[index - 1]) > 0)
+              index = hash[hashkey] + hash_budget_counter[hashkey];
+
+              while (index > hash[hashkey]
+                     && compare_priority (keymap[i], sorted_keymap[index - 1]) > 0)
                 {
                   sorted_keymap[index] = sorted_keymap[index - 1];
                   --index;
                 }
                 {
                   sorted_keymap[index] = sorted_keymap[index - 1];
                   --index;
                 }
-              sorted_keymap[index] = keymap_[i];
+
+              sorted_keymap[index] = keymap[i];
               ++hash_budget_counter[hashkey];
             }
         }
     }
 
               ++hash_budget_counter[hashkey];
             }
         }
     }
 
-  keymap_.swap (sorted_keymap);
+  keymap.swap (sorted_keymap);
 
 #if defined (DEBUG_STRICT) || defined (DEBUG_KEYBOARD)
   // check for invariants
   for (i = 0; i < KEYSYM_HASH_BUDGETS; ++i)
     {
 
 #if defined (DEBUG_STRICT) || defined (DEBUG_KEYBOARD)
   // check for invariants
   for (i = 0; i < KEYSYM_HASH_BUDGETS; ++i)
     {
-      index = hash_[i];
+      index = hash[i];
       for (int j = 0; j < hash_budget_size[i]; ++j)
         {
       for (int j = 0; j < hash_budget_size[i]; ++j)
         {
-          if (keymap_[index + j]->range == 1)
-            assert (i == (keymap_[index + j]->keysym & KEYSYM_HASH_MASK));
+          if (keymap[index + j]->range == 1)
+            assert (i == (keymap[index + j]->keysym & KEYSYM_HASH_MASK));
+
           if (j)
           if (j)
-            assert (compare_priority (keymap_[index + j - 1],
-                                      keymap_[index + j]) >= 0);
+            assert (compare_priority (keymap[index + j - 1],
+                    keymap[index + j]) >= 0);
         }
     }
 
         }
     }
 
@@ -460,13 +450,11 @@ keyboard_manager::setup_hash ()
       keysym_t *a = sorted_keymap[i];
       for (int j = 0; j < a->range; ++j)
         {
       keysym_t *a = sorted_keymap[i];
       for (int j = 0; j < a->range; ++j)
         {
-          int index = find_keysym (a->keysym + j, a->state & AllModMask);
+          int index = find_keysym (a->keysym + j, a->state & OtherModMask);
           assert (index >= 0);
           assert (index >= 0);
-          keysym_t *b = keymap_[index];
-          assert (i == (signed)index || // the normally expected result
-              (a->keysym + j) >= b->keysym &&
-              (a->keysym + j) <= (b->keysym + b->range) &&
-              compare_priority (a, b) <= 0); // is effectively the same
+          keysym_t *b = keymap[index];
+          assert (i == (signed) index ||       // the normally expected result
+            (a->keysym + j) >= b->keysym && (a->keysym + j) <= (b->keysym + b->range) && compare_priority (a, b) <= 0);        // is effectively the same
         }
     }
 #endif
         }
     }
 #endif
@@ -475,22 +463,19 @@ keyboard_manager::setup_hash ()
 int
 keyboard_manager::find_keysym (KeySym keysym, unsigned int state)
 {
 int
 keyboard_manager::find_keysym (KeySym keysym, unsigned int state)
 {
-  int hashkey = (keysym & KEYSYM_HASH_MASK);
-  unsigned int index = hash_[hashkey];
+  int hashkey = keysym & KEYSYM_HASH_MASK;
+  unsigned int index = hash [hashkey];
 
 
-  for (;index < keymap_.size(); ++index)
+  for (; index < keymap.size (); ++index)
     {
     {
-      keysym_t *key = keymap_[index];
+      keysym_t *key = keymap[index];
       assert (key);
       assert (key);
-      if (key->keysym <= keysym &&
-          key->keysym + key->range > keysym &&
+
+      if (key->keysym <= keysym && key->keysym + key->range > keysym
           // match only the specified bits in state and ignore others
           // match only the specified bits in state and ignore others
-          (key->state & (unsigned int)AllModMask) == (key->state & state))
-        {
-          return index;
-        }
-      else if (key->keysym > keysym &&
-               key->range == 1)
+          && (key->state & OtherModMask) == (key->state & state))
+        return index;
+      else if (key->keysym > keysym && key->range == 1)
         return -1;
     }
 
         return -1;
     }
 
index 75b837a..f4a869d 100644 (file)
@@ -1,55 +1,61 @@
 #ifndef KEYBOARD_H_
 #define KEYBOARD_H_
 
 #ifndef KEYBOARD_H_
 #define KEYBOARD_H_
 
+#include <inttypes.h>
+
 #include "feature.h"
 #include "rxvtutil.h"
 
 #ifdef KEYSYM_RESOURCE
 
 #include "feature.h"
 #include "rxvtutil.h"
 
 #ifdef KEYSYM_RESOURCE
 
-#define KEYSYM_HASH_BITS        9       /* lowest #bits of keysym is used as hash key */
+#define KEYSYM_HASH_BITS        4       /* lowest #bits of keysym is used as hash key */
 #define KEYSYM_HASH_BUDGETS     (1<<KEYSYM_HASH_BITS)
 #define KEYSYM_HASH_MASK        (KEYSYM_HASH_BUDGETS-1)
 
 #define MetaMask                0x0100
 #define NumLockMask             0x0200
 #define KEYSYM_HASH_BUDGETS     (1<<KEYSYM_HASH_BITS)
 #define KEYSYM_HASH_MASK        (KEYSYM_HASH_BUDGETS-1)
 
 #define MetaMask                0x0100
 #define NumLockMask             0x0200
-#define AllModMask              (ShiftMask | LockMask | ControlMask \
+#define AppKeypadMask           0x0400
+#define OtherModMask            (ShiftMask | LockMask | ControlMask \
                                 | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask)
 
                                 | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask)
 
-#if (AllModMask & (MetaMask | NumLockMask)) != 0
-#error redefine MetaMask or NumLockMask!
+#if (OtherModMask & (MetaMask | NumLockMask | AppKeypadMask)) != 0
+# error FATAL: MetaMask, NumLockMask and/or AppKeypadMask clashes with X modifiers!
 #endif
 
 struct rxvt_term;
 struct keysym_t;
 #endif
 
 struct rxvt_term;
 struct keysym_t;
+
 typedef void (keyevent_handler) (rxvt_term *rt,
                                  keysym_t *key,
                                  KeySym keysym,
                                  unsigned int state);
 typedef void (keyevent_handler) (rxvt_term *rt,
                                  keysym_t *key,
                                  KeySym keysym,
                                  unsigned int state);
-typedef unsigned short u16;
 
 struct keysym_t
 {
 
 struct keysym_t
 {
-  KeySym            keysym;
+  enum keysym_type {
+    NORMAL, RANGE, RANGE_META8, LIST
+  };
+
+  KeySym      keysym;
   /* only the lower 8 bits of state are used for matching according to X.h */
   /* the higher bits are preserved for Meta/NumLock keys */
   /* which are mapped to corresponding lower bits at register time */
   /* only the lower 8 bits of state are used for matching according to X.h */
   /* the higher bits are preserved for Meta/NumLock keys */
   /* which are mapped to corresponding lower bits at register time */
-  u16               state;    /* indicates each modifiers' DOWN/UP status         */
-  u16               range;    /* =1: single keysym; >1: a of range keysyms        */
-  keyevent_handler *handler;  /* event handler                                    */
-  const char       *str;      /* would normally be a keycode translation          */
+  uint16_t    state;    /* indicates each modifiers' DOWN/UP status         */
+  uint16_t    range;    /* =1: single keysym; >1: a of range keysyms        */
+  keysym_type type;
+  const char  *str;      /* would normally be a keycode translation in UTF-8 */
 };
 
 };
 
-
 class keyboard_manager
 {
 public:
 class keyboard_manager
 {
 public:
-  keyboard_manager (rxvt_term *rt);
+  keyboard_manager ();
   ~keyboard_manager ();
 
   void clear ();
   void register_user_translation (KeySym keysym, unsigned int state, const char *trans);
   void register_done ();        // call this to make newly registered keymaps take effect
   ~keyboard_manager ();
 
   void clear ();
   void register_user_translation (KeySym keysym, unsigned int state, const char *trans);
   void register_done ();        // call this to make newly registered keymaps take effect
-  bool dispatch (KeySym keysym, unsigned int state);
+  bool dispatch (rxvt_term *term, KeySym keysym, unsigned int state);
 
 private:
   void register_keymap (keysym_t *key);
 
 private:
   void register_keymap (keysym_t *key);
@@ -58,18 +64,16 @@ private:
   int find_keysym (KeySym keysym, unsigned int state);
 
 private:
   int find_keysym (KeySym keysym, unsigned int state);
 
 private:
-  rxvt_term * const term_;
-
-  u16 hash_[KEYSYM_HASH_BUDGETS];               //
-  vector<keysym_t *> keymap_;
+  uint16_t hash[KEYSYM_HASH_BUDGETS];
+  vector<keysym_t *> keymap;
 
   // stock keymaps are all static data
 
   // stock keymaps are all static data
-  static keysym_t stock_keymap_[];
-  // user keymaps and their .string are dynamicly allocated and freed
-  vector<keysym_t *> user_keymap_;
-  vector<const char *> user_translations_;
+  static keysym_t stock_keymap[];
+  // user keymaps and their .string are dynamicaly allocated and freed
+  vector<keysym_t *> user_keymap;
+  vector<const char *> user_translations;
 };
 
 #endif /* KEYSYM_RESOURCE */
 #endif /* KEYBOARD_H_ */
 };
 
 #endif /* KEYSYM_RESOURCE */
 #endif /* KEYBOARD_H_ */
-// vim:et:ts=2:sw=2
+// vim:et:sw=2