Annotation of researchv9/X11/src/X.V11R1/clients/xterm/input.c, revision 1.1

1.1     ! root        1: /*
        !             2:  *     $Source: /u1/X11/clients/xterm/RCS/input.c,v $
        !             3:  *     $Header: input.c,v 1.14 87/09/11 08:16:45 toddb Exp $
        !             4:  */
        !             5: 
        !             6: #ifndef lint
        !             7: static char *rcsid_input_c = "$Header: input.c,v 1.14 87/09/11 08:16:45 toddb Exp $";
        !             8: #endif lint
        !             9: 
        !            10: #include <X11/copyright.h>
        !            11: 
        !            12: /*
        !            13:  * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
        !            14:  *
        !            15:  *                         All Rights Reserved
        !            16:  *
        !            17:  * Permission to use, copy, modify, and distribute this software and its
        !            18:  * documentation for any purpose and without fee is hereby granted,
        !            19:  * provided that the above copyright notice appear in all copies and that
        !            20:  * both that copyright notice and this permission notice appear in
        !            21:  * supporting documentation, and that the name of Digital Equipment
        !            22:  * Corporation not be used in advertising or publicity pertaining to
        !            23:  * distribution of the software without specific, written prior permission.
        !            24:  *
        !            25:  *
        !            26:  * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
        !            27:  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
        !            28:  * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
        !            29:  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
        !            30:  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
        !            31:  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
        !            32:  * SOFTWARE.
        !            33:  */
        !            34: 
        !            35: /* input.c */
        !            36: 
        !            37: #ifndef lint
        !            38: static char rcs_id[] = "$Header: input.c,v 1.14 87/09/11 08:16:45 toddb Exp $";
        !            39: #endif lint
        !            40: 
        !            41: #include <X11/Xlib.h>
        !            42: #include <X11/keysym.h>
        !            43: #include <X11/Intrinsic.h>
        !            44: #include <X11/Xutil.h>
        !            45: #include <stdio.h>
        !            46: #include "ptyx.h"
        !            47: 
        !            48: int MetaMode = 1;      /* prefix with ESC when Meta Key is down */
        !            49: 
        !            50: static XComposeStatus compose_status = {NULL, 0};
        !            51: static char *kypd_num = " XXXXXXXX\tXXX\rXXXxxxxXXXXXXXXXXXXXXXXXXXXX*+,-.\\0123456789XXX=";
        !            52: static char *kypd_apl = " ABCDEFGHIJKLMNOPQRSTUVWXYZ??????abcdefghijklmnopqrstuvwxyzXXX";
        !            53: static char *cur = "DACB";
        !            54: 
        !            55: Input (keyboard, screen, event)
        !            56: register TKeyboard     *keyboard;
        !            57: register TScreen               *screen;
        !            58: register XKeyPressedEvent *event;
        !            59: {
        !            60: 
        !            61: #define STRBUFSIZE 100
        !            62: 
        !            63:         char strbuf[STRBUFSIZE];
        !            64:        register char *string;
        !            65:        register int col, key = FALSE;
        !            66:        int     pty     = screen->respond;
        !            67:        int     nbytes;
        !            68:        int     keycode;
        !            69:        ANSI    reply;
        !            70: 
        !            71:        nbytes = XLookupString (event, strbuf, STRBUFSIZE, 
        !            72:                &keycode, &compose_status);
        !            73: 
        !            74:        string = &strbuf[0];
        !            75:        reply.a_pintro = 0;
        !            76:        reply.a_final = 0;
        !            77:        reply.a_nparam = 0;
        !            78:        reply.a_inters = 0;
        !            79: 
        !            80:        if (IsPFKey(keycode)) {
        !            81:                reply.a_type = SS3;
        !            82:                unparseseq(&reply, pty);
        !            83:                unparseputc((char)(keycode-XK_KP_F1+'P'), pty);
        !            84:                key = TRUE;
        !            85:        } else if (IsKeypadKey(keycode)) {
        !            86:                if (keyboard->flags & KYPD_APL) {
        !            87:                        reply.a_type   = SS3;
        !            88:                        unparseseq(&reply, pty);
        !            89:                        unparseputc(kypd_apl[keycode-XK_KP_Space], pty);
        !            90:                } else
        !            91:                        unparseputc(kypd_num[keycode-XK_KP_Space], pty);
        !            92:                key = TRUE;
        !            93:         } else if (IsCursorKey(keycode)) {
        !            94:                        if (keyboard->flags & CURSOR_APL) {
        !            95:                        reply.a_type = SS3;
        !            96:                        unparseseq(&reply, pty);
        !            97:                        unparseputc(cur[keycode-XK_Left], pty);
        !            98:                } else {
        !            99:                        reply.a_type = CSI;
        !           100:                        reply.a_final = cur[keycode-XK_Left];
        !           101:                        unparseseq(&reply, pty);
        !           102:                }
        !           103:                key = TRUE;
        !           104:         } else if (IsFunctionKey(keycode) || IsMiscFunctionKey(keycode)) {
        !           105:                reply.a_type = CSI;
        !           106:                reply.a_nparam = 1;
        !           107:                reply.a_param[0] = funcvalue(keycode);
        !           108:                reply.a_final = '~';
        !           109:                if (reply.a_param[0] > 0)
        !           110:                        unparseseq(&reply, pty);
        !           111:                key = TRUE;
        !           112:        } else if (nbytes > 0) {
        !           113:                if(screen->TekGIN) {
        !           114:                        TekEnqMouse(*string++);
        !           115:                        TekGINoff();
        !           116:                        nbytes--;
        !           117:                }
        !           118:                if ((nbytes == 1) && MetaMode && (event->state & Mod1Mask))
        !           119:                        unparseputc(033, pty);
        !           120:                while (nbytes-- > 0)
        !           121:                        unparseputc(*string++, pty);
        !           122:                key = TRUE;
        !           123:        }
        !           124:        if(key && !screen->TekEmu) {
        !           125:                if(screen->scrollkey && screen->topline != 0)
        !           126:                        WindowScroll(screen, 0);
        !           127:                if(screen->marginbell) {
        !           128:                        col = screen->max_col - screen->nmarginbell;
        !           129:                        if(screen->bellarmed >= 0) {
        !           130:                                if(screen->bellarmed == screen->cur_row) {
        !           131:                                        if(screen->cur_col >= col) {
        !           132:                                                if(screen->cur_col == col)
        !           133:                                                        Bell();
        !           134:                                                screen->bellarmed = -1;
        !           135:                                        }
        !           136:                                } else
        !           137:                                        screen->bellarmed = screen->cur_col <
        !           138:                                         col ? screen->cur_row : -1;
        !           139:                        } else if(screen->cur_col < col)
        !           140:                                screen->bellarmed = screen->cur_row;
        !           141:                }
        !           142:        }
        !           143: #ifdef ENABLE_PRINT
        !           144:        if (keycode == XK_F2) TekPrint();
        !           145: #endif
        !           146:        return;
        !           147: }
        !           148: 
        !           149: funcvalue(keycode)
        !           150: {
        !           151:        switch (keycode) {
        !           152:                case XK_F1:     return(11);
        !           153:                case XK_F2:     return(12);
        !           154:                case XK_F3:     return(13);
        !           155:                case XK_F4:     return(14);
        !           156:                case XK_F5:     return(15);
        !           157:                case XK_F6:     return(17);
        !           158:                case XK_F7:     return(18);
        !           159:                case XK_F8:     return(19);
        !           160:                case XK_F9:     return(20);
        !           161:                case XK_F10:    return(21);
        !           162:                case XK_F11:    return(23);
        !           163:                case XK_F12:    return(24);
        !           164:                case XK_F13:    return(25);
        !           165:                case XK_F14:    return(26);
        !           166:                case XK_F15:    return(28);
        !           167:                case XK_Help:   return(28);
        !           168:                case XK_F16:    return(29);
        !           169:                case XK_Menu:   return(29);
        !           170:                case XK_F17:    return(31);
        !           171:                case XK_F18:    return(32);
        !           172:                case XK_F19:    return(33);
        !           173:                case XK_F20:    return(34);
        !           174: 
        !           175:                case XK_Find :  return(1);
        !           176:                case XK_Insert: return(2);
        !           177:                case XK_Delete: return(3);
        !           178:                case XK_Select: return(4);
        !           179:                case XK_Prior:  return(5);
        !           180:                case XK_Next:   return(6);
        !           181:                default:        return(-1);
        !           182:        }
        !           183: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.