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

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