1: #ifndef lint
2: static char *rcsid_util_c = "$Header: util.c,v 10.2 86/02/01 16:21:36 tony Rel $";
3: #endif lint
4: #ifdef sun
5: /*
6: * The Sun X drivers are a product of Sun Microsystems, Inc. and are provided
7: * for unrestricted use provided that this legend is included on all tape
8: * media and as a part of the software program in whole or part. Users
9: * may copy or modify these drivers without charge, but are not authorized
10: * to license or distribute them to anyone else except as part of a product or
11: * program developed by the user.
12: *
13: * THE SUN X DRIVERS ARE PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND
14: * INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A
15: * PARTICULAR PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE
16: * PRACTICE.
17: *
18: * The Sun X Drivers are provided with no support and without any obligation
19: * on the part of Sun Microsystems, Inc. to assist in their use, correction,
20: * modification or enhancement.
21: *
22: * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
23: * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THE SUN X
24: * DRIVERS OR ANY PART THEREOF.
25: *
26: * In no event will Sun Microsystems, Inc. be liable for any lost revenue
27: * or profits or other special, indirect and consequential damages, even if
28: * Sun has been advised of the possibility of such damages.
29: *
30: * Sun Microsystems, Inc.
31: * 2550 Garcia Avenue
32: * Mountain View, California 94043
33: */
34:
35: #ifndef lint
36: static char sccsid[] = "@(#)util.c 2.1 86/01/28 Copyright 1986 Sun Micro";
37: #endif
38:
39: /*-
40: * Copyright (c) 1986 by Sun Microsystems, Inc.
41: */
42:
43: /* util.c Various utilities
44: *
45: * SoundBell Generate audible bell
46: * SetKeyClick Control key click
47: * SetAutoRepeat Control auto repeat
48: * SetLockLED Control Lock LED
49: * SetVideo Disable/enable video
50: * QueryShape Determine shapes
51: * ResolveColors does nothing
52: * StoreColors does nothing
53: */
54:
55: /*
56: * ToDo:
57: * Implement SetVideo
58: * Implement SoundBell(!)
59: */
60:
61: #include "Xsun.h"
62:
63: extern int vsdev;
64:
65: /* Sound bell, volume between 0 (quiet) and 7 (loud) */
66:
67: SoundBell (volume)
68: int volume;
69: {
70: return (0);
71: }
72:
73: /* Set key click, volume between -1 (default), 0 (off) and 8 (loud) */
74:
75: SetKeyClick (volume)
76: int volume;
77: {
78: return (0);
79: }
80:
81: /* Set autorepeat */
82:
83: SetAutoRepeat (onoff)
84: int onoff;
85: {
86: return (0);
87: }
88:
89: int SetVideo(onoff)
90: int onoff;
91: {
92: return(0);
93: }
94:
95: QueryShape (shape, width, height)
96: int shape;
97: short *width, *height;
98: {
99: /* Cursors & tiles unrestricted */
100: }
101:
102: SetLockLED (onoff)
103: int onoff;
104: {
105: return (0);
106: }
107:
108: ResolveColor (red, green, blue)
109: unsigned short *red, *green, *blue;
110: {
111: *red &= ~0377;
112: *green &= ~0377;
113: *blue &= ~0377;
114: }
115:
116: StoreColors (count, entries)
117: int count;
118: ColorDef *entries;
119:
120: {
121: /* XXX - should keep interal shadow of color map and rewrite whole */
122: extern struct pixrect *PixRect;
123: while (count--) {
124: u_char r, g, b;
125:
126: r = (u_char) (entries->red>>8);
127: g = (u_char) (entries->green>>8);
128: b = (u_char) (entries->blue>>8);
129: pr_putcolormap(PixRect, entries->pixel, 1, &r, &g, &b);
130: entries++;
131: }
132: }
133:
134: extern u_char InvPix[];
135:
136: InvertPixelOrder(p, n)
137: register unsigned short *p;
138: register int n;
139: {
140: for (; n--; p++) {
141: register unsigned short l = (*p & 0xff), h = (*p >> 8)&0xff;
142: unsigned short old = *p;
143:
144: *p = (unsigned short) ((InvPix[l] << 8) | InvPix[h]);
145: }
146: }
147: #endif sun
Defined functions
Defined variables