1: /* 2: * The Sun X drivers are a product of Sun Microsystems, Inc. and are provided 3: * for unrestricted use provided that this legend is included on all tape 4: * media and as a part of the software program in whole or part. Users 5: * may copy or modify these drivers without charge, but are not authorized 6: * to license or distribute them to anyone else except as part of a product or 7: * program developed by the user. 8: * 9: * THE SUN X DRIVERS ARE PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND 10: * INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A 11: * PARTICULAR PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE 12: * PRACTICE. 13: * 14: * The Sun X Drivers are provided with no support and without any obligation 15: * on the part of Sun Microsystems, Inc. to assist in their use, correction, 16: * modification or enhancement. 17: * 18: * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 19: * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THE SUN X 20: * DRIVERS OR ANY PART THEREOF. 21: * 22: * In no event will Sun Microsystems, Inc. be liable for any lost revenue 23: * or profits or other special, indirect and consequential damages, even if 24: * Sun has been advised of the possibility of such damages. 25: * 26: * Sun Microsystems, Inc. 27: * 2550 Garcia Avenue 28: * Mountain View, California 94043 29: */ 30: 31: /*- 32: * Copyright 1985, Massachusetts Institute of Technology 33: * Copyright (c) 1986 by Sun Microsystems, Inc. 34: * 35: * @(#)Xsun.h 2.1 86/01/28 36: * 37: */ 38: 39: #include <stdio.h> 40: #include <X/X.h> 41: #include <pixrect/pixrect_hs.h> 42: #include "../X/vsinput.h" 43: #include "../X/Xdev.h" 44: 45: 46: #define ConstantPixmap 0x0 /* kinds of pixmaps on sun, constant */ 47: #define BitmapPixmap 0x1 /* and ones with associated bitmaps */ 48: #define ZColorPixmap 0x2 /* and 8-bit color ones */ 49: #define XYColorPixmap 0x3 /* in both styles */ 50: #define CanBeTiled 1 /* this pixmap can be tiled */ 51: #define CannotBeTiled 0 /* this pixmap cannont be tiled */ 52: 53: #define InvertFlag 0x10 /* pixmap source should be inverted */ 54: #define PTYPE(x) (((int) (x)->kind) & 0xf) 55: #define PINVERT(x) (((int) (x)->kind) >> 4) 56: 57: typedef struct _fontpriv { 58: int maxwidth; /* maximum width found in the font */ 59: int wpitch; /* number of bytes/line in strike */ 60: short *widths; /* width table (in pixels) */ 61: short *leftarray; /* leftarray */ 62: BITMAP *strike; /* the font stike bitmap itself */ 63: long *chrs; /* chars in independent bitmaps */ 64: char **fltable; /* beginning of each strike line */ 65: } FontPriv; 66: 67: typedef struct _curspriv { 68: struct pixrect *top; /* The cursor image */ 69: BITMAP *top_bit; 70: struct pixrect *bot; /* The cursor image */ 71: BITMAP *bot_bit; 72: struct pixrect *sv; /* The pixels underneath */ 73: int fore, back; 74: } CursPriv; 75: 76: #define CDATA(x) ((CursPriv *) x->data) 77: 78: #define F_DATA(x) ((struct pixfont *) x->data) 79: 80: #define BDATA(x) ((VSArea *) x->data) 81: 82: #define PDATA(x) ((BITMAP *) x->data) 83: 84: #define SUN_FROM_X_OP(func) (Sun_From_X_Op[func]) 85: 86: short Sun_From_X_Op[]; 87: 88: #define CURSOR_WIDTH 16 89: #define CURSOR_HEIGHT 16 90: 91: #define GetNextClip(clips, cleft, ctop, cwidth, cheight) \ 92: { \ 93: CLIP *cl = clips++; \ 94: cleft = cl->left; \ 95: ctop = cl->top; \ 96: cwidth = cl->width; \ 97: cheight = cl->height; \ 98: } 99: 100: #define OverLap(x1, y1, w1, h1, x2, y2, w2, h2) \ 101: ((x1 < x2+w2) && (y1 < y2+h2) && (x2 < x1+w1) && (y2 < y1+h1)) 102: 103: #define imin(i,j) (i<j?i:j) 104: 105: #define imax(i,j) (i>j?i:j) 106: 107: #define SetZmask(pr, zm) { \ 108: extern private_czmask; \ 109: if (*(char *)(zm) != (char)private_czmask) { \ 110: pr_putattributes(pr, (zm)); \ 111: private_czmask = *(zm); \ 112: }}