Annotation of researchv9/X11/src/X.V11R1/clients/uwm/uwm.h, revision 1.1.1.1

1.1       root        1: /* $Header: uwm.h,v 1.4 87/08/21 13:31:43 swick Exp $ */
                      2:  
                      3: #include <X11/copyright.h>
                      4: 
                      5: /*
                      6:  * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
                      7:  *
                      8:  *                         All Rights Reserved
                      9:  *
                     10:  * Permission to use, copy, modify, and distribute this software and its
                     11:  * documentation for any purpose and without fee is hereby granted,
                     12:  * provided that the above copyright notice appear in all copies and that
                     13:  * both that copyright notice and this permission notice appear in
                     14:  * supporting documentation, and that the name of Digital Equipment
                     15:  * Corporation not be used in advertising or publicity pertaining to
                     16:  * distribution of the software without specific, written prior permission.
                     17:  *
                     18:  *
                     19:  * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
                     20:  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
                     21:  * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
                     22:  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
                     23:  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
                     24:  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
                     25:  * SOFTWARE.
                     26:  */
                     27: 
                     28:  
                     29:  
                     30: /*
                     31:  * MODIFICATION HISTORY
                     32:  *
                     33:  * 000 -- M. Gancarz, DEC Ultrix Engineering Group
                     34:  * 001 -- R. Kittell, DEC Storage A/D May 19, 1986
                     35:  *  Added global vars for warp options.
                     36:  * 002 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
                     37:  *  Western Software Lab, Port to X11
                     38:  */
                     39:  
                     40: #include <errno.h>
                     41: #include <stdio.h>
                     42: #include <strings.h>
                     43: #include <X11/Xlib.h>
                     44: 
                     45:  
                     46: #define MIN(x, y)      ((x) <= (y) ? (x) : (y))
                     47: #define MAX(x, y)      ((x) >= (y) ? (x) : (y))
                     48: #define VOLUME_PERCENTAGE(x)   ((x)*14) 
                     49: #define ModMask 0xFF
                     50: #define ButtonMask(b)  (((b)==Button1) ? Button1Mask : \
                     51:                          (((b)==Button2) ? Button2Mask : Button3Mask))
                     52: 
                     53: #define FALSE  False
                     54: #define TRUE   True
                     55:  
                     56: 
                     57: #define DEF_DELTA              1
                     58: #define DEF_FONT               "6x10"
                     59: #define DEF_FUNC               GXcopy
                     60: #define DEF_ICON_BORDER_WIDTH  2
                     61: #define DEF_ICON_PADDING       4
                     62: #define DEF_POP_BORDER_WIDTH   2
                     63: #define DEF_POP_PADDING                4
                     64: #define DEF_MENU_BORDER_WIDTH  2
                     65: #define DEF_MENU_PADDING       4
                     66: #define DEF_VOLUME             4
                     67: #define DEF_PUSH               5
                     68:  
                     69: #define INIT_PTEXT             {'0', '0', '0', 'x', '0', '0', '0'}
                     70: #define TEMPFILE               "/tmp/uwm.XXXXXX"
                     71: #define SYSFILE                        "/usr/lib/X11/uwm/system.uwmrc"
                     72:  
                     73: #define CURSOR_WIDTH           16
                     74: #define CURSOR_HEIGHT          16
                     75:  
                     76: #define MAX_ZAP_VECTORS                8
                     77: #define MAX_BOX_VECTORS                16
                     78:  
                     79: #define DRAW_WIDTH             0       /* use fastest hardware draw */
                     80: #define DRAW_VALUE             0xfd
                     81: #define DRAW_FUNC              GXxor
                     82: #define DRAW_PLANES            1
                     83:  
                     84: #define ROOT                   0x1
                     85: #define WINDOW                 0x2
                     86: #define ICON                   0x4
                     87:  
                     88: #define FAILURE                        0
                     89: #define NAME_LEN               256     /* Maximum length of filenames. */
                     90: #define EVENTMASK              (ButtonPressMask | ButtonReleaseMask)
                     91:  
                     92: #define DrawBox() XDrawSegments(dpy, RootWindow(dpy, scr),DrawGC,box,num_vectors)
                     93: #define DrawZap() XDrawSegments(dpy, RootWindow(dpy, scr),DrawGC,zap,num_vectors)
                     94:  
                     95: /*
                     96:  * Keyword table entry.
                     97:  */
                     98: typedef struct _keyword {
                     99:     char *name;
                    100:     int type;
                    101:     Bool *bptr;
                    102:     int *nptr;
                    103:     char *sptr;
                    104:     Bool (*fptr)();
                    105: } Keyword;
                    106:  
                    107: /*
                    108:  * Keyword table type entry.
                    109:  */
                    110: #define IsString       1
                    111: #define IsBoolTrue     2
                    112: #define IsBoolFalse    3
                    113: #define IsFunction     4
                    114: #define IsMenuMap      5
                    115: #define IsMenu         6
                    116: #define IsDownFunction 7
                    117: #define IsParser       8
                    118: #define IsNumeric      9
                    119: #define IsQuitFunction 10
                    120:  
                    121: /*
                    122:  * Button/key binding type.
                    123:  */
                    124: typedef struct _binding {
                    125:     struct _binding *next;
                    126:     int context;
                    127:     int mask;
                    128:     int button;
                    129:     Bool (*func)();
                    130:     char *menuname;
                    131:     struct _menuinfo *menu;
                    132: } Binding;
                    133:  
                    134: /*
                    135:  * Key expression type.
                    136:  */
                    137: typedef struct _keyexpr {
                    138:     char *name;
                    139:     int mask;
                    140: } KeyExpr;
                    141:  
                    142: /*
                    143:  * Context expression type.
                    144:  */
                    145: typedef struct _contexpr {
                    146:     char *name;
                    147:     int mask;
                    148: } ContExpr;
                    149:  
                    150: /*
                    151:  * Button modifier type.
                    152:  */
                    153: typedef struct _buttonmodifier {
                    154:     char *name;
                    155:     int mask;
                    156: } ButtonModifier;
                    157:  
                    158: /*
                    159:  * Button modifier mask definitions.
                    160:  * bits 13 and 14 unused in key masks, according to X.h
                    161:  * steal bit 15, since we don't use AnyModifier
                    162:  */
                    163: 
                    164: #define DeltaMotion    (1<<13)
                    165: #define ButtonUp       (1<<14)
                    166: #define ButtonDown     AnyModifier
                    167: #define ButtonMods     DeltaMotion+ButtonUp+ButtonDown
                    168: 
                    169: /* 
                    170:  * Button and mask redefinitions, for X11
                    171:  */
                    172: #define LeftMask       Button1Mask
                    173: #define MiddleMask     Button2Mask
                    174: #define RightMask      Button3Mask
                    175: #define LeftButton     Button1
                    176: #define MiddleButton   Button2
                    177: #define RightButton    Button3
                    178:  
                    179: /*
                    180:  * MenuInfo data type.
                    181:  */
                    182: typedef struct _menuinfo {
                    183:     char *name;                        /* Name of this menu. */
                    184:     Window w;                  /* Menu window. */
                    185:     int iheight;               /* Height of an item. */
                    186:     int width;                 /* Width of this menu. */
                    187:     int height;                        /* Height of this menu. */
                    188:     Pixmap image;              /* Saved image of the menu. */
                    189:     char *foreground;          /* Name of foreground color. */
                    190:     char *background;          /* Name of background color. */
                    191:     char *fghighlight;         /* Name of hightlight foreground color. */
                    192:     char *bghighlight;         /* Name of highlight background color. */
                    193:     XColor fg;                 /* Foreground color definition. */
                    194:     XColor bg;                 /* Background color definition. */
                    195:     XColor hlfg;               /* Foreground highlight color definition. */
                    196:     XColor hlbg;               /* Background highlight color definition. */
                    197:     struct _menuline *line;    /* Linked list of menu items. */
                    198: } MenuInfo;
                    199:  
                    200: /*
                    201:  * Menu Line data type.
                    202:  */
                    203: typedef struct _menuline {
                    204:     struct _menuline *next;    /* Pointer to next line. */
                    205:     char *name;                        /* Name of this line. */
                    206:     int type;                  /* IsShellCommand, IsText, IsTextNL... */
                    207:     Window w;                  /* Subwindow for this line. */
                    208:     char *text;                        /* Text string to be acted upon. */
                    209:     Bool (*func)();            /* Window manager function to be invoked. */
                    210:     struct _menuinfo *menu;    /* Menu to be invoked. */
                    211:     char *foreground;          /* Name of foreground color. */
                    212:     char *background;          /* Name of background color. */
                    213:     XColor fg;                 /* Foreground color definition. */
                    214:     XColor bg;                 /* Background color definition. */
                    215: } MenuLine;
                    216:  
                    217: /*
                    218:  * MenuLine->type definitions.
                    219:  */
                    220: #define IsShellCommand         1
                    221: #define IsText                 2
                    222: #define IsTextNL               3
                    223: #define IsUwmFunction          4
                    224: #define IsMenuFunction         5
                    225: #define IsImmFunction          6     /* Immediate (context-less) function. */
                    226:  
                    227: /*
                    228:  * Menu Link data type.  Used by the parser when creating a linked list
                    229:  * of menus.
                    230:  */
                    231: typedef struct _menulink {
                    232:     struct _menulink *next;    /* Pointer to next MenuLink. */
                    233:     struct _menuinfo *menu;    /* Pointer to the menu in this link. */
                    234: } MenuLink;
                    235: 
                    236: typedef int Pixel;
                    237:  
                    238: /*
                    239:  * External variable definitions.
                    240:  */
                    241: extern int errno;
                    242: extern Window Pop;             /* Pop-up dimension display window. */
                    243: extern Window Frozen;          /* Contains window id of "gridded" window. */
                    244: extern XFontStruct *IFontInfo; /* Icon text font information. */
                    245: extern XFontStruct *PFontInfo; /* Pop-up text font information. */
                    246: extern XFontStruct *MFontInfo; /* Menu text font information. */
                    247: extern Pixmap GrayPixmap;      /* Gray pixmap. */
                    248: extern Pixel IBorder;          /* Icon window border pixmap. */
                    249: extern Pixmap IBackground;     /* Icon window background pixmap. */
                    250: extern Pixel PBorder;          /* Pop-Up Window border pixmap. */
                    251: extern Pixel PBackground;      /* Pop-up Window background pixmap. */
                    252: extern Pixel MBorder;          /* Menu Window border pixmap. */
                    253: extern Pixel MBackground;      /* Menu Window background pixmap. */
                    254: extern Cursor ArrowCrossCursor; /* Arrow cross cursor. */
                    255: extern Cursor TextCursor;      /* Text cursor used in icon windows. */
                    256: extern Cursor IconCursor;      /* Icon Cursor. */
                    257: extern Cursor MenuCursor;      /* Menu cursor. */
                    258: extern Cursor MenuMaskCursor;  /* Menu mask cursor. */
                    259: extern Cursor LeftButtonCursor;        /* Left button main cursor. */
                    260: extern Cursor MiddleButtonCursor;/* Middle button main cursor. */
                    261: extern Cursor RightButtonCursor;/* Right button main cursor. */
                    262: extern Cursor TargetCursor;    /* Target (select-a-window) cursor. */
                    263: extern int ScreenWidth;                /* Display screen width. */
                    264: extern int ScreenHeight;       /* Display screen height. */
                    265: extern int ITextForground;     /* Icon window text forground color. */
                    266: extern int ITextBackground;    /* Icon window text background color. */
                    267: extern int IBorderWidth;       /* Icon window border width. */
                    268: extern int PTextForground;     /* Pop-up window text forground color. */
                    269: extern int PTextBackground;    /* Pop-up window text background color. */
                    270: extern int PWidth;             /* Pop-up window width (including borders). */
                    271: extern int PHeight;            /* Pop-up window height (including borders). */
                    272: extern int PBorderWidth;       /* Pop-up window border width. */
                    273: extern int MTextForground;     /* Menu window text forground color. */
                    274: extern int MTextBackground;    /* Menu window text background color. */
                    275: extern int MBorderWidth;       /* Menu window border width. */
                    276: extern int PPadding;           /* Pop-up window padding. */
                    277: extern int Delay;              /* Delay between clicks of double click. */
                    278: extern int Delta;              /* Mouse movement slop. */
                    279: extern int HIconPad;           /* Icon horizontal padding. */
                    280: extern int VIconPad;           /* Icon vertical padding. */
                    281: extern int HMenuPad;           /* Menu horizontal padding. */
                    282: extern int VMenuPad;           /* Menu vertical padding. */
                    283: extern int MaxColors;          /* Maximum number of colors to use. */
                    284: extern int Pushval;            /* Number of pixels to push window by. */
                    285: extern int Volume;             /* Audible alarm volume. */
                    286: extern int status;             /* Routine return status. */
                    287: extern int Maxfd;              /* Maximum file descriptors for select(2). */
                    288: extern MenuLink *Menus;                /* Linked list of menus. */
                    289: extern GC  IconGC;             /* graphics context for icon */
                    290: extern GC  PopGC;              /* graphics context for pop */
                    291: extern GC  MenuGC;             /* graphics context for menu */
                    292: extern GC  MenuInvGC;          /* graphics context for menu background */
                    293: extern GC  DrawGC;             /* graphics context for zap */
                    294:  
                    295: extern Bool Autoselect;                /* Warp mouse to default menu selection? */
                    296: extern Bool Freeze;            /* Freeze server during move/resize? */
                    297: extern Bool Grid;              /* Should the m/r box contain a 9 seg. grid. */
                    298: extern Bool NWindow;           /* Normalize windows? */
                    299: extern Bool NIcon;             /* Normalize icons? */
                    300: extern Bool Push;              /* Relative=TRUE, Absolute=FALSE. */
                    301: extern Bool Reverse;           /* Reverse video? */
                    302: extern Bool WarpOnRaise;       /* Warp to upper right corner on raise. */
                    303: extern Bool WarpOnIconify;      /* Warp to icon center on iconify. */
                    304: extern Bool WarpOnDeIconify;    /* Warp to upper right corner on de-iconify. */
                    305: extern Bool Zap;               /* Should the the zap effect be used. */
                    306: extern Bool FocusSetByUser;     /* True if f.focus called */
                    307:  
                    308: extern char PText[];           /* Pop-up window dummy text. */
                    309: extern int PTextSize;          /* Pop-up window dummy text size. */
                    310:  
                    311: extern int Lineno;             /* Line count for parser. */
                    312: extern Bool Startup_File_Error;        /* Startup file error flag. */
                    313: extern char Startup_File[];    /* Startup file name. */
                    314: extern char IFontName[];       /* Icon font name. */
                    315: extern char PFontName[];       /* Pop-up font name. */
                    316: extern char MFontName[];       /* Menu font name. */
                    317: extern char **Argv;            /* Pointer to command line parameters. */
                    318: extern char **Environ;         /* Pointer to environment. */
                    319:  
                    320: extern char *DefaultBindings[];        /* Default bindings string array. */
                    321: extern Keyword KeywordTable[]; /* Keyword lookup table. */
                    322: extern Binding *Blist;         /* Button/key bindings list. */
                    323: extern KeyExpr KeyExprTbl[];   /* Key expression table. */
                    324: extern ContExpr ContExprTbl[]; /* Context expression table. */
                    325: extern ButtonModifier ButtModTbl[];/* Button modifier table. */
                    326: 
                    327: extern int scr;
                    328: extern Display *dpy;           /* Display info pointer. */
                    329:  
                    330: #ifdef PROFIL
                    331: int ptrap();
                    332: #endif
                    333:  
                    334: /*
                    335:  * External routine typing.
                    336:  */
                    337: extern Bool Beep();
                    338: extern Bool CircleDown();
                    339: extern Bool CircleUp();
                    340: extern Bool Continue();
                    341: extern Bool Focus();
                    342: extern Bool GetButton();
                    343: extern Bool Iconify();
                    344: extern Bool Lower();
                    345: extern Bool Menu();
                    346: extern Bool Move();
                    347: extern Bool MoveOpaque();
                    348: extern Bool NewIconify();
                    349: extern Bool Pause();
                    350: extern Bool PushDown();
                    351: extern Bool PushLeft();
                    352: extern Bool PushRight();
                    353: extern Bool PushUp();
                    354: extern Bool Quit();
                    355: extern Bool Raise();
                    356: extern Bool Redraw();
                    357: extern Bool Refresh();
                    358: extern Bool ResetBindings();
                    359: extern Bool ResetMenus();
                    360: extern Bool ResetVariables();
                    361: extern Bool Resize();
                    362: extern Bool Restart();
                    363: extern int StoreCursors();
                    364: extern int StoreBox();
                    365: extern int StoreGridBox();
                    366: extern int StoreZap();
                    367: extern int Error();
                    368: extern int XError();
                    369: extern int CreateMenus();
                    370:  
                    371: extern char *stash();
                    372: extern char *GetIconName();

unix.superglobalmegacorp.com

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