]>
Commit | Line | Data |
---|---|---|
6ec507fd JS |
1 | /* |
2 | * Xlib compatibility | |
3 | */ | |
4 | ||
c79a329d JS |
5 | #ifndef _DUMMY_XLIBH_ |
6 | #define _DUMMY_XLIBH_ | |
7 | ||
8 | #include <XtoNX.h> | |
256d631a JS |
9 | |
10 | /* Data types */ | |
11 | ||
c79a329d | 12 | typedef GR_PALETTE* Colormap; |
e941874b JS |
13 | typedef GR_DRAW_ID Drawable ; |
14 | typedef int Status; | |
c79a329d JS |
15 | typedef unsigned long VisualID; |
16 | typedef int Bool; | |
17 | typedef long XID; | |
18 | typedef XID KeySym; | |
19 | /* typedef unsigned long Time; */ | |
e941874b JS |
20 | |
21 | #define Success 0 | |
22 | #define GrabSuccess Success | |
23 | #define GrabNotViewable (Success+1) | |
24 | #define InputOutput 1 | |
25 | #define InputOnly 2 | |
26 | #define IsUnmapped 0 | |
27 | #define IsUnviewable 1 | |
28 | #define IsViewable 2 | |
c79a329d JS |
29 | /* Is this right? */ |
30 | #define PropertyChangeMask GR_EVENT_MASK_SELECTION_CHANGED | |
31 | #define GraphicsExpose GR_EVENT_TYPE_EXPOSURE | |
32 | #define GraphicsExposeMask GR_EVENT_MASK_EXPOSURE | |
33 | ||
34 | #define XSynchronize(display,sync) | |
35 | #define XDefaultRootWindow(d) GR_ROOT_WINDOW_ID | |
36 | #define XFreePixmap(d, p) GrDestroyWindow(p) | |
37 | #define XFreeCursor(d, c) GrDestroyCursor(c) | |
38 | #define DefaultVisual(d, s) ((Visual*) NULL) | |
39 | ||
40 | /* These defines are wrongly defined in XtoNX.h, IMHO, | |
41 | * since they reference a static global. | |
42 | * Redefined as functions, below. | |
43 | */ | |
44 | ||
45 | #undef DisplayWidth | |
46 | #undef DisplayHeight | |
47 | #undef DefaultDepth | |
48 | ||
49 | /* | |
50 | * Data structure used by color operations | |
51 | */ | |
52 | typedef struct { | |
53 | unsigned long pixel; | |
54 | unsigned short red, green, blue; | |
55 | char flags; /* do_red, do_green, do_blue */ | |
56 | char pad; | |
57 | } XColor; | |
58 | ||
59 | typedef struct { | |
60 | int type; | |
61 | Display *display; /* Display the event was read from */ | |
62 | XID resourceid; /* resource id */ | |
63 | unsigned long serial; /* serial number of failed request */ | |
64 | unsigned char error_code; /* error code of failed request */ | |
65 | unsigned char request_code; /* Major op-code of failed request */ | |
66 | unsigned char minor_code; /* Minor op-code of failed request */ | |
67 | } XErrorEvent; | |
68 | ||
69 | /* | |
70 | * Visual structure; contains information about colormapping possible. | |
71 | */ | |
72 | typedef struct { | |
73 | void *ext_data; /* hook for extension to hang data */ | |
74 | VisualID visualid; /* visual id of this visual */ | |
75 | #if defined(__cplusplus) || defined(c_plusplus) | |
76 | int c_class; /* C++ class of screen (monochrome, etc.) */ | |
77 | #else | |
78 | int class; /* class of screen (monochrome, etc.) */ | |
79 | #endif | |
80 | unsigned long red_mask, green_mask, blue_mask; /* mask values */ | |
81 | int bits_per_rgb; /* log base 2 of distinct color values */ | |
82 | int map_entries; /* color map entries */ | |
83 | } Visual; | |
84 | ||
85 | /* | |
86 | * Depth structure; contains information for each possible depth. | |
87 | */ | |
88 | typedef struct { | |
89 | int depth; /* this depth (Z) of the depth */ | |
90 | int nvisuals; /* number of Visual types at this depth */ | |
91 | Visual *visuals; /* list of visuals possible at this depth */ | |
92 | } Depth; | |
93 | ||
94 | /* | |
95 | * Information about the screen. The contents of this structure are | |
96 | * implementation dependent. A Screen should be treated as opaque | |
97 | * by application code. | |
98 | */ | |
99 | ||
100 | struct _XDisplay; /* Forward declare before use for C++ */ | |
101 | ||
102 | typedef struct { | |
103 | void *ext_data; /* hook for extension to hang data */ | |
104 | struct _XDisplay *display;/* back pointer to display structure */ | |
105 | Window root; /* Root window id. */ | |
106 | int width, height; /* width and height of screen */ | |
107 | int mwidth, mheight; /* width and height of in millimeters */ | |
108 | int ndepths; /* number of depths possible */ | |
109 | Depth *depths; /* list of allowable depths on the screen */ | |
110 | int root_depth; /* bits per pixel */ | |
111 | Visual *root_visual; /* root visual */ | |
112 | GC default_gc; /* GC for the root root visual */ | |
113 | Colormap cmap; /* default color map */ | |
114 | unsigned long white_pixel; | |
115 | unsigned long black_pixel; /* White and Black pixel values */ | |
116 | int max_maps, min_maps; /* max and min color maps */ | |
117 | int backing_store; /* Never, WhenMapped, Always */ | |
118 | Bool save_unders; | |
119 | long root_input_mask; /* initial root input mask */ | |
120 | } Screen; | |
121 | ||
e941874b JS |
122 | |
123 | typedef struct { | |
124 | int x, y; /* location of window */ | |
125 | int width, height; /* width and height of window */ | |
126 | int border_width; /* border width of window */ | |
127 | int depth; /* depth of window */ | |
128 | Visual *visual; /* the associated visual structure */ | |
129 | Window root; /* root of screen containing window */ | |
c79a329d | 130 | int _class; /* InputOutput, InputOnly*/ |
e941874b JS |
131 | int bit_gravity; /* one of the bit gravity values */ |
132 | int win_gravity; /* one of the window gravity values */ | |
133 | int backing_store; /* NotUseful, WhenMapped, Always */ | |
134 | unsigned long backing_planes;/* planes to be preserved if possible */ | |
135 | unsigned long backing_pixel;/* value to be used when restoring planes */ | |
136 | Bool save_under; /* boolean, should bits under be saved? */ | |
137 | Colormap colormap; /* color map to be associated with window */ | |
138 | Bool map_installed; /* boolean, is color map currently installed*/ | |
139 | int map_state; /* IsUnmapped, IsUnviewable, IsViewable */ | |
140 | long all_event_masks; /* set of events all people have interest in*/ | |
141 | long your_event_mask; /* my event mask */ | |
142 | long do_not_propagate_mask;/* set of events that should not propagate */ | |
143 | Bool override_redirect; /* boolean value for override-redirect */ | |
144 | Screen *screen; /* back pointer to correct screen */ | |
145 | } XWindowAttributes; | |
256d631a | 146 | |
c79a329d JS |
147 | typedef int (*XErrorHandler) ( /* WARNING, this type not in Xlib spec */ |
148 | Display* /* display */, | |
149 | XErrorEvent* /* error_event */ | |
150 | ); | |
151 | ||
256d631a JS |
152 | /* events*/ |
153 | ||
154 | /* What should this be? */ | |
155 | #if 0 | |
156 | #ifndef ResizeRequest | |
157 | #define ResizeRequest ?? | |
158 | #endif | |
159 | #endif | |
160 | ||
161 | #ifndef MotionNotify | |
162 | #define MotionNotify GR_EVENT_TYPE_MOUSE_POSITION | |
163 | #define PointerMotionMask GR_EVENT_MASK_MOUSE_POSITION | |
164 | #endif | |
165 | ||
166 | #ifndef FocusIn | |
167 | #define FocusIn GR_EVENT_TYPE_FOCUS_IN | |
168 | #define FocusOut GR_EVENT_TYPE_FOCUS_OUT | |
169 | #define FocusChangeMask GR_EVENT_MASK_FOCUS_IN|GR_EVENT_MASK_FOCUS_OUT | |
170 | #endif | |
171 | ||
172 | /* Fuunctions */ | |
173 | ||
174 | #ifdef __cpluplus | |
175 | extern "C" { | |
176 | #endif | |
177 | ||
c79a329d | 178 | Colormap DefaultColormapOfScreen(Screen* /* screen */) ; |
e941874b JS |
179 | int XSetGraphicsExposures( Display* /* display */, GC /* gc */, Bool /* graphics_exposures */) ; |
180 | int XWarpPointer( Display* /* display */, Window /* srcW */, Window /* srcW */, | |
181 | int /* srcX */, int /* srcY */, | |
182 | unsigned int /* srcWidth */, | |
183 | unsigned int /* srcHeight */, | |
184 | int destX, int destY); | |
185 | int XSetInputFocus(Display* /* display */, Window focus, int /* revert_to */, Time /* time */) ; | |
186 | int XGetInputFocus(Display* /* display */, Window* /* focus_return */, int* /* revert_to_return */) ; | |
187 | int XGrabPointer(Display* /* display */, Window /* grab_window */, | |
188 | Bool /* owner_events */, unsigned int /* event_mask */, | |
189 | int /* pointer_mode */, int /* keyboard_mode */, | |
190 | Window /* confine_to */, Cursor /* cursor */, Time /* time */) ; | |
191 | int XUngrabPointer(Display /* display */, Time /* time */) ; | |
192 | int XCopyArea(Display* /* display */, Drawable src, Drawable dest, GC gc, | |
193 | int src_x, int src_y, unsigned int width, unsigned int height, | |
194 | int dest_x, int dest_y) ; | |
195 | int XCopyPlane(Display* /* display */, Drawable src, Drawable dest, GC gc, | |
196 | int src_x, int src_y, unsigned int width, unsigned int height, | |
197 | int dest_x, int dest_y, unsigned long /* plane */) ; | |
256d631a | 198 | |
c79a329d JS |
199 | XErrorHandler XSetErrorHandler (XErrorHandler /* handler */); |
200 | Display *XOpenDisplay(const char *name); | |
201 | Screen *XScreenOfDisplay(Display* /* display */, | |
202 | int /* screen_number */); | |
203 | int DisplayWidth(Display* /* display */, int /* screen */); | |
204 | int DisplayHeight(Display* /* display */, int /* screen */); | |
205 | int DefaultDepth(Display* /* display */, int /* screen */); | |
206 | int XAllocColor(Display* /* display */, Colormap /* cmap */, | |
207 | XColor* color); | |
208 | int XParseColor(Display* display, Colormap cmap, | |
209 | const char* cname, XColor* color); | |
210 | ||
256d631a JS |
211 | #ifdef __cpluplus |
212 | } | |
213 | #endif | |
214 | ||
c79a329d | 215 | #define XMaxRequestSize(display) 16384 |
256d631a | 216 | |
c79a329d JS |
217 | #endif |
218 | /* _DUMMY_XLIBH_ */ |