|
|
1.1 root 1: /*
2: * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * The contents of this file constitute Original Code as defined in and
7: * are subject to the Apple Public Source License Version 1.1 (the
8: * "License"). You may not use this file except in compliance with the
9: * License. Please obtain a copy of the License at
10: * http://www.apple.com/publicsource and read it before using this file.
11: *
12: * This Original Code and all software distributed under the License are
13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17: * License for the specific language governing rights and limitations
18: * under the License.
19: *
20: * @APPLE_LICENSE_HEADER_END@
21: */
22: /*
23: * @OSF_COPYRIGHT@
24: */
25: /*
26: * Mach Operating System
27: * Copyright (c) 1991,1990,1989 Carnegie Mellon University
28: * All Rights Reserved.
29: *
30: * Permission to use, copy, modify and distribute this software and its
31: * documentation is hereby granted, provided that both the copyright
32: * notice and this permission notice appear in all copies of the
33: * software, derivative works or modified versions, and any portions
34: * thereof, and that both notices appear in supporting documentation.
35: *
36: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
37: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
38: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
39: *
40: * Carnegie Mellon requests users of this software to return to
41: *
42: * Software Distribution Coordinator or [email protected]
43: * School of Computer Science
44: * Carnegie Mellon University
45: * Pittsburgh PA 15213-3890
46: *
47: * any improvements or extensions that they make and grant Carnegie Mellon
48: * the rights to redistribute these changes.
49: */
50: /*
51: */
52: /*
53: * File: screen.h
54: * Author: Alessandro Forin, Carnegie Mellon University
55: * Date: 9/90
56: *
57: * Definitions for the Generic Screen Driver.
58: */
59:
60: #ifndef _SCREEN_H_
61: #define _SCREEN_H_
62:
63: /*
64: * Most of these structures are defined so that the
65: * resulting structure mapped to user space appears
66: * to be compatible with the one used by the DEC X
67: * servers (pm_info..). Keep it that way and the
68: * X servers will keep on running.
69: */
70:
71: /*
72: * Generic structures and defines
73: */
74:
75: /* colors */
76: typedef struct {
77: unsigned short red;
78: unsigned short green;
79: unsigned short blue;
80: } color_map_t;
81:
82: typedef struct {
83: short unused;
84: unsigned short index;
85: color_map_t value;
86: } color_map_entry_t;
87:
88: typedef struct {
89: unsigned int Bg_rgb[3];
90: unsigned int Fg_rgb[3];
91: } cursor_color_t;
92:
93: /* generic input event */
94: typedef struct {
95: short x; /* x position */
96: short y; /* y position */
97: unsigned int time; /* 1 millisecond units */
98:
99: unsigned char type; /* button up/down/raw or motion */
100: # define EVT_BUTTON_UP 0
101: # define EVT_BUTTON_DOWN 1
102: # define EVT_BUTTON_RAW 2
103: # define EVT_PTR_MOTION 3
104:
105: unsigned char key; /* the key (button only) */
106: # define KEY_LEFT_BUTTON 1
107: # define KEY_MIDDLE_BUTTON 2
108: # define KEY_RIGHT_BUTTON 3
109: # define KEY_TBL_LEFT_BUTTON 0
110: # define KEY_TBL_FRONT_BUTTON 1
111: # define KEY_TBL_RIGHT_BUTTON 2
112: # define KEY_TBL_BACK_BUTTON 3
113:
114: unsigned char index; /* which instance of device */
115:
116: unsigned char device; /* which device */
117: # define DEV_NULL 0
118: # define DEV_MOUSE 1
119: # define DEV_KEYBD 2
120: # define DEV_TABLET 3
121: # define DEV_AUX 4
122: # define DEV_CONSOLE 5
123: # define DEV_KNOB 8
124: # define DEV_JOYSTICK 9
125:
126: } screen_event_t;
127:
128: /* timed coordinate info */
129: typedef struct {
130: unsigned int time;
131: short x, y;
132: } screen_timed_point_t;
133:
134: /* queue of input events, and ring of mouse motions track */
135: typedef struct {
136: screen_event_t *events;
137: unsigned int q_size;
138: unsigned int q_head;
139: unsigned int q_tail;
140: unsigned long timestamp;
141: screen_timed_point_t *track;
142: unsigned int t_size;
143: unsigned int t_next;
144: } screen_evque_t;
145:
146: /* mouse/cursor position */
147: typedef struct {
148: short x;
149: short y;
150: } screen_point_t;
151:
152: /* mouse motion bounding boxes */
153: typedef struct {
154: short bottom;
155: short right;
156: short left;
157: short top;
158: } screen_rect_t;
159:
160: /*
161: * Here it is, each field is marked as
162: *
163: * Kset : kernel sets it unconditionally
164: * Kuse : kernel uses it, safely
165: * Kdep : kernel might depend on it
166: */
167: typedef struct {
168: screen_evque_t evque; /* Kset, Kuse */
169: short mouse_buttons; /* Kset */
170: screen_point_t xx3 /*tablet*/;
171: short xx4 /*tswitches*/;
172: screen_point_t cursor; /* Kset */
173: short row; /* Kdep */
174: short col; /* Kdep */
175: short max_row; /* Kdep */
176: short max_col; /* Kdep */
177: short max_x; /* Kset */
178: short max_y; /* Kset */
179: short max_cur_x; /* Kdep */
180: short max_cur_y; /* Kdep */
181: int version; /* Kset */
182: union {
183: struct {
184: unsigned char * bitmap; /* Kset */
185: short * x16 /*scanmap*/;
186: short * x17 /*cursorbits*/;
187: short * x18 /*pmaddr*/;
188: unsigned char * planemask; /* Kset */
189: } pm;
190: struct {
191: int x15 /* flags */;
192: int * gram /* Kset */;
193: int * rb_addr /* Kset */;
194: int rb_phys /* Kset */;
195: int rb_size /* Kset */;
196: } gx;
197: } dev_dep_1;
198: screen_point_t mouse_loc; /* Kdep */
199: screen_rect_t mouse_box; /* Kdep */
200: short mouse_threshold;/* Kuse */
201: short mouse_scale; /* Kuse */
202: short min_cur_x; /* Kdep */
203: short min_cur_y; /* Kdep */
204: union {
205: struct {
206: int x26 /*dev_type*/;
207: char * x27 /*framebuffer*/;
208: char * x28 /*volatile struct bt459 *bt459*/;
209: int x29 /*slot*/;
210: char cursor_sprite[1024];/* Kset */
211: unsigned char Bg_color[3]; /* Kset */
212: unsigned char Fg_color[3]; /* Kset */
213: int tablet_scale_x; /* Kuse */
214: int tablet_scale_y; /* Kuse */
215: } pm;
216: struct {
217: char * gxo /* Kset */;
218: char stamp_width /* Kset */;
219: char stamp_height /* Kset */;
220: char nplanes /* Kset */;
221: char x27_4 /* n10_present */;
222: char x28_1 /* dplanes */;
223: char zplanes /* Kset */;
224: char zzplanes /* Kset */;
225: unsigned char cursor_sprite[1024] /* Kuse */;
226: char x285_0 /* padding for next, which was int */;
227: unsigned char Fg_color[4] /* Kuse */;
228: unsigned char Bg_color[4] /* Kuse */;
229: unsigned short cmap_index /* Kuse */;
230: unsigned short cmap_count /* Kuse */;
231: unsigned int colormap[256] /* Kuse */;
232: int * stic_dma_rb /* Kset */;
233: int * stic_reg /* Kset */;
234: int ptpt_phys /* Kdep */;
235: int ptpt_size /* Kdep */;
236: int * ptpt_pgin /* Kset */;
237: } gx;
238: } dev_dep_2;
239: short frame_scanline_width; /* in pixels, Kset */
240: short frame_height; /* in scanlines, Kset */
241: /*
242: * Event queues are allocated right after that
243: */
244: #define MAX_EVENTS 64
245: #define MAX_TRACK 100
246: screen_event_t event_queue[MAX_EVENTS]; /* Kset */
247: screen_timed_point_t point_track[MAX_TRACK]; /* Kset */
248: /*
249: * Some like it hot
250: */
251: unsigned int event_id;
252: int interrupt_info;
253: } user_info_t;
254:
255:
256: /*
257: * Screen get_status codes and arguments
258: */
259: #include <sys/ioctl.h>
260:
261: /* Get size (and offset) of mapped info */
262: #define SCREEN_GET_OFFSETS _IOR('q', 6, unsigned **)
263:
264: /* Get screen status flags */
265: #define SCREEN_STATUS_FLAGS _IOR('q', 22, int *)
266: # define MONO_SCREEN 0x01
267: # define COLOR_SCREEN 0x02
268: # define SCREEN_BEING_UPDATED 0x04
269:
270: /*
271: * Screen set_status codes and arguments
272: */
273:
274: /* start/stop screen saver, control fading interval */
275: #define SCREEN_FADE _IOW('q', 114, int) /* fade screen */
276: # define NO_FADE -1
277:
278: /* Turn video on/off manually */
279: #define SCREEN_ON _IO('q', 10)
280: #define SCREEN_OFF _IO('q', 11)
281:
282: /* Fixup pointers inside mapped info structure */
283: #define SCREEN_ADJ_MAPPED_INFO _IOR('q', 1, user_info_t *)
284:
285: /* Initialize anything that needs to, hw-wise */
286: #define SCREEN_INIT _IO('q', 4)
287:
288: /* Position cursor to a specific spot */
289: #define SCREEN_SET_CURSOR _IOW('q', 2, screen_point_t)
290:
291: /* Load Bg/Fg colors for cursor */
292: #define SCREEN_SET_CURSOR_COLOR _IOW('q', 3, cursor_color_t)
293:
294: /* Load cursor sprite, small cursor form */
295: typedef unsigned short cursor_sprite_t[32];
296:
297: #define SCREEN_LOAD_CURSOR _IOW('q', 7, cursor_sprite_t)
298:
299: /* Load cursor sprite, large 64x64 cursor form */
300: typedef char cursor_sprite_long_t[1024];
301:
302: #define SCREEN_LOAD_CURSOR_LONG _IOW('q', 13, cursor_sprite_long_t)
303:
304: /* Modify a given entry in the color map (VDAC) */
305: #define SCREEN_SET_CMAP_ENTRY _IOW('q', 12, color_map_entry_t)
306:
307: /* Return some other information about hardware (optional) */
308: typedef struct {
309: int frame_width;
310: int frame_height;
311: int frame_visible_width;
312: int frame_visible_height;
313: } screen_hw_info_t;
314: #define SCREEN_HARDWARE_INFO _IOR('q', 23, screen_hw_info_t)
315:
316: /* Screen-dependent, unspecified (and despised) */
317: #define SCREEN_HARDWARE_DEP _IO('q', 24)
318:
319: #endif /* _SCREEN_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.