BSD 4_3_Tahoe release
[unix-history] / usr / src / new / X / libsun / Xsun.h
CommitLineData
95f51977
C
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
57typedef 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
67typedef 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 */
ca67e7b4 73 int fore, back, c_func;
95f51977
C
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])
ca67e7b4
C
85#define SUN_FROM_X_OP_INVERT(func) (Sun_From_X_Op[SSMap[func|0x10]])
86extern char SSMap[];
95f51977
C
87
88short Sun_From_X_Op[];
89
90#define CURSOR_WIDTH 16
91#define CURSOR_HEIGHT 16
92
93#define GetNextClip(clips, cleft, ctop, cwidth, cheight) \
94 { \
95 CLIP *cl = clips++; \
96 cleft = cl->left; \
97 ctop = cl->top; \
98 cwidth = cl->width; \
99 cheight = cl->height; \
100 }
101
102#define OverLap(x1, y1, w1, h1, x2, y2, w2, h2) \
103 ((x1 < x2+w2) && (y1 < y2+h2) && (x2 < x1+w1) && (y2 < y1+h1))
104
105#define imin(i,j) (i<j?i:j)
106
107#define imax(i,j) (i>j?i:j)
108
109#define SetZmask(pr, zm) { \
110 extern private_czmask; \
111 if (*(char *)(zm) != (char)private_czmask) { \
112 pr_putattributes(pr, (zm)); \
113 private_czmask = *(zm); \
114 }}