9 #pragma interface "Xlib.h"
12 /* Move away the typedef in XtoNX.h */
13 #define XFontStruct XFontStruct1
20 typedef GR_PALETTE
* Colormap
;
21 typedef GR_DRAW_ID Drawable
;
23 typedef unsigned long VisualID
;
26 typedef GR_SCANCODE KeySym
;
27 typedef GR_EVENT_KEYSTROKE XKeyEvent
;
33 short lbearing
; /* origin to left edge of raster */
34 short rbearing
; /* origin to right edge of raster */
35 short width
; /* advance to next char's origin */
36 short ascent
; /* baseline to top edge of raster */
37 short descent
; /* baseline to bottom edge of raster */
38 unsigned short attributes
; /* per char flags (not predefined) */
41 /* Configure window value mask bits */
44 #define CWWidth (1<<2)
45 #define CWHeight (1<<3)
46 #define CWBorderWidth (1<<4)
47 #define CWSibling (1<<5)
48 #define CWStackMode (1<<6)
60 /* typedef unsigned long Time; */
63 #define GrabSuccess Success
64 #define GrabNotViewable (Success+1)
68 #define IsUnviewable 1
71 #define PropertyChangeMask GR_EVENT_MASK_SELECTION_CHANGED
72 #define GraphicsExpose GR_EVENT_TYPE_EXPOSURE
73 #define GraphicsExposeMask GR_EVENT_MASK_EXPOSURE
74 #define ColormapChangeMask 0
77 #define LineOnOffDash 0
80 #define CapProjecting 0
85 #define IncludeInferiors 0
86 #define ClipByChildren 0
90 #define NoEventMask GR_EVENT_MASK_NONE
91 #define RevertToParent 0
93 #define GrabModeAsync 0
95 #define GXcopy GR_MODE_COPY
96 #define GXclear GR_MODE_CLEAR
98 #define GXxor GR_MODE_OR
100 #define GXinvert GR_MODE_INVERT
101 #define GXorReverse GR_MODE_ORREVERSE
102 #define GXandReverse GR_MODE_ANDREVERSE
103 #define GXand GR_MODE_AND
104 #define GXor GR_MODE_OR
105 #define GXandInverted GR_MODE_ANDINVERTED
106 #define GXnoop GR_MODE_NOOP
107 #define GXnor GR_MODE_NOR
108 #define GXequiv GR_MODE_EQUIV
109 #define GXcopyInverted GR_MODE_COPYINVERTED
110 #define GXorInverted GR_MODE_ORINVERTED
111 #define GXnand GR_MODE_NAND
112 #define GXset GR_MODE_SET
114 inline void wxNoop() { /* Do nothing */ }
116 #define XSynchronize(display,sync)
117 #define XDefaultRootWindow(d) GR_ROOT_WINDOW_ID
118 #define RootWindowOfScreen(s) GR_ROOT_WINDOW_ID
119 #define XFreePixmap(d, p) GrDestroyWindow(p)
120 #define XFreeCursor(d, c) GrDestroyCursor(c)
121 #define XFreeGC(d, gc) GrDestroyGC(gc)
122 #define XSetBackground(d, gc, c) GrSetGCBackground(gc, c)
123 #define DefaultVisual(d, s) ((Visual*) NULL)
124 #define DefaultColormap(d, s) DefaultColormapOfScreen((Screen*) NULL)
125 #define DefaultScreenOfDisplay(d) 0
126 #define XSetFillStyle(d, gc, s) wxNoop()
127 #define XSetLineAttributes(d, gc, a, b, c, e) wxNoop()
128 #define XSetClipMask(d, gc, m) wxNoop()
129 #define XSetTSOrigin(d, gc, x, y) wxNoop()
130 #define XFillArc(d, w, gc, x, y, rx, ry, a1, a2) GrArcAngle(w, gc, x, y, rx, ry, a1, a2, GR_PIE)
131 #define XDrawArc(d, w, gc, x, y, rx, ry, a1, a2) GrArcAngle(w, gc, x, y, rx, ry, a1, a2, GR_ARC)
132 #define XDrawPoint(d, w, gc, x, y) GrPoint(w, gc, x, y)
133 #define XFillPolygon(d, w, gc, p, n, s, m) GrFillPoly(w, gc, n, p)
134 #define XDrawRectangle(d, w, gc, x, y, width, height) GrRect(w, gc, x, y, width, height)
135 #define XSetClipOrigin(d, gc, x, y) GrSetGCClipOrigin(gc, x, y)
136 #define XSetRegion(d, gc, r) GrSetGCRegion(gc, r)
137 #define XSetTile(d, gc, p) wxNoop()
138 #define XSetStipple(d, gc, p) wxNoop()
139 #define XSetSubwindowMode(d, gc, mode) wxNoop()
140 #define XFreeColormap(d, cmap) wxNoop()
141 #define XSetTransientForHint(d, w, p) wxNoop()
142 #define XUnionRegion(sr1,sr2,r) GrUnionRegion(r,sr1,sr2)
143 #define XIntersectRegion(sr1,sr2,r) GrIntersectRegion(r,sr1,sr2)
144 #define XEqualRegion(r1, r2) GrEqualRegion(r1, r2)
145 #define XEmptyRegion(r) GrEmptyRegion(r)
146 #define XOffsetRegion(r, x, y) GrOffsetRegion(r, x, y)
147 #define XClipBox(r, rect) GrGetRegionBox(r, rect)
148 #define XPointInRegion(r, x, y) GrPointInRegion(r, x, y)
149 #define XXorRegion(sr1, sr2, r) GrXorRegion(r, sr1, sr2)
150 /* TODO: Cannot find equivalent for this. */
151 #define XIconifyWindow(d, w, s) 0
152 #define XCreateWindowWithColor(d,p,x,y,w,h,bw,depth,cl,vis,backColor,foreColor) \
153 GrNewWindow(p,x,y,w,h,bw,backColor,foreColor)
154 #define XLookupString(event, buf, len, sym, status) (*sym = (event)->scancode)
155 #define XBell(a, b) GrBell()
156 #define DisplayWidthMM(d, s) 100
157 #define DisplayHeightMM(d, s) 100
159 /* These defines are wrongly defined in XtoNX.h, IMHO,
160 * since they reference a static global.
161 * Redefined as functions, below.
169 * Data structure used by color operations
173 unsigned short red
, green
, blue
;
174 char flags
; /* do_red, do_green, do_blue */
180 Display
*display
; /* Display the event was read from */
181 XID resourceid
; /* resource id */
182 unsigned long serial
; /* serial number of failed request */
183 unsigned char error_code
; /* error code of failed request */
184 unsigned char request_code
; /* Major op-code of failed request */
185 unsigned char minor_code
; /* Minor op-code of failed request */
189 * Visual structure; contains information about colormapping possible.
192 void *ext_data
; /* hook for extension to hang data */
193 VisualID visualid
; /* visual id of this visual */
194 #if defined(__cplusplus) || defined(c_plusplus)
195 int c_class
; /* C++ class of screen (monochrome, etc.) */
197 int class; /* class of screen (monochrome, etc.) */
199 unsigned long red_mask
, green_mask
, blue_mask
; /* mask values */
200 int bits_per_rgb
; /* log base 2 of distinct color values */
201 int map_entries
; /* color map entries */
205 * Depth structure; contains information for each possible depth.
208 int depth
; /* this depth (Z) of the depth */
209 int nvisuals
; /* number of Visual types at this depth */
210 Visual
*visuals
; /* list of visuals possible at this depth */
214 * Information about the screen. The contents of this structure are
215 * implementation dependent. A Screen should be treated as opaque
216 * by application code.
219 struct _XDisplay
; /* Forward declare before use for C++ */
222 void *ext_data
; /* hook for extension to hang data */
223 struct _XDisplay
*display
;/* back pointer to display structure */
224 Window root
; /* Root window id. */
225 int width
, height
; /* width and height of screen */
226 int mwidth
, mheight
; /* width and height of in millimeters */
227 int ndepths
; /* number of depths possible */
228 Depth
*depths
; /* list of allowable depths on the screen */
229 int root_depth
; /* bits per pixel */
230 Visual
*root_visual
; /* root visual */
231 GC default_gc
; /* GC for the root root visual */
232 Colormap cmap
; /* default color map */
233 unsigned long white_pixel
;
234 unsigned long black_pixel
; /* White and Black pixel values */
235 int max_maps
, min_maps
; /* max and min color maps */
236 int backing_store
; /* Never, WhenMapped, Always */
238 long root_input_mask
; /* initial root input mask */
243 int x
, y
; /* location of window */
244 int width
, height
; /* width and height of window */
245 int border_width
; /* border width of window */
246 int depth
; /* depth of window */
247 Visual
*visual
; /* the associated visual structure */
248 Window root
; /* root of screen containing window */
249 int _class
; /* InputOutput, InputOnly*/
250 int bit_gravity
; /* one of the bit gravity values */
251 int win_gravity
; /* one of the window gravity values */
252 int backing_store
; /* NotUseful, WhenMapped, Always */
253 unsigned long backing_planes
;/* planes to be preserved if possible */
254 unsigned long backing_pixel
;/* value to be used when restoring planes */
255 Bool save_under
; /* boolean, should bits under be saved? */
256 Colormap colormap
; /* color map to be associated with window */
257 Bool map_installed
; /* boolean, is color map currently installed*/
258 int map_state
; /* IsUnmapped, IsUnviewable, IsViewable */
259 long all_event_masks
; /* set of events all people have interest in*/
260 long your_event_mask
; /* my event mask */
261 long do_not_propagate_mask
;/* set of events that should not propagate */
262 Bool override_redirect
; /* boolean value for override-redirect */
263 Screen
*screen
; /* back pointer to correct screen */
266 typedef int (*XErrorHandler
) ( /* WARNING, this type not in Xlib spec */
267 Display
* /* display */,
268 XErrorEvent
* /* error_event */
273 /* What should this be? */
275 #ifndef ResizeRequest
276 #define ResizeRequest ??
281 #define MotionNotify GR_EVENT_TYPE_MOUSE_POSITION
282 #define PointerMotionMask GR_EVENT_MASK_MOUSE_POSITION
285 #define ButtonMotionMask GR_EVENT_MASK_MOUSE_POSITION
286 #define KeymapStateMask 0
287 #define StructureNotifyMask GR_EVENT_MASK_UPDATE
290 #define FocusIn GR_EVENT_TYPE_FOCUS_IN
291 #define FocusOut GR_EVENT_TYPE_FOCUS_OUT
292 #define FocusChangeMask GR_EVENT_MASK_FOCUS_IN|GR_EVENT_MASK_FOCUS_OUT
301 Display
*XOpenDisplay(char *name
);
302 Colormap
DefaultColormapOfScreen(Screen
* /* screen */) ;
303 int XSetGraphicsExposures( Display
* /* display */, GC
/* gc */, Bool
/* graphics_exposures */) ;
304 int XWarpPointer( Display
* /* display */, Window
/* srcW */, Window
/* destW */,
305 int /* srcX */, int /* srcY */,
306 unsigned int /* srcWidth */,
307 unsigned int /* srcHeight */,
308 int destX
, int destY
);
309 int XSetInputFocus(Display
* /* display */, Window focus
, int /* revert_to */, Time
/* time */) ;
310 int XGetInputFocus(Display
* /* display */, Window
* /* focus_return */, int* /* revert_to_return */) ;
311 int XGrabPointer(Display
* /* display */, Window
/* grab_window */,
312 Bool
/* owner_events */, unsigned int /* event_mask */,
313 int /* pointer_mode */, int /* keyboard_mode */,
314 Window
/* confine_to */, Cursor
/* cursor */, Time
/* time */) ;
315 int XUngrabPointer(Display
* /* display */, Time
/* time */) ;
316 int XCopyArea(Display
* /* display */, Drawable src
, Drawable dest
, GC gc
,
317 int src_x
, int src_y
, unsigned int width
, unsigned int height
,
318 int dest_x
, int dest_y
) ;
319 int XCopyPlane(Display
* /* display */, Drawable src
, Drawable dest
, GC gc
,
320 int src_x
, int src_y
, unsigned int width
, unsigned int height
,
321 int dest_x
, int dest_y
, unsigned long /* plane */) ;
323 XErrorHandler
XSetErrorHandler (XErrorHandler
/* handler */);
324 Screen
*XScreenOfDisplay(Display
* /* display */,
325 int /* screen_number */);
326 int DisplayWidth(Display
* /* display */, int /* screen */);
327 int DisplayHeight(Display
* /* display */, int /* screen */);
328 int DefaultDepth(Display
* /* display */, int /* screen */);
329 int XAllocColor(Display
* /* display */, Colormap
/* cmap */,
331 int XParseColor(Display
* display
, Colormap cmap
,
332 const char* cname
, XColor
* color
);
333 int XDrawLine(Display
* display
, Window win
, GC gc
,
334 int x1
, int y1
, int x2
, int y2
);
335 int XTextExtents( XFontStruct
* font
, char* s
, int len
, int* direction
,
336 int* ascent
, int* descent2
, XCharStruct
* overall
);
337 int XPending(Display
*d
);
338 XFontStruct
* XLoadQueryFont(Display
* display
, const char* fontSpec
);
339 int XFreeFont(Display
* display
, XFontStruct
* fontStruct
);
340 int XQueryColor(Display
* display
, Colormap cmap
, XColor
* color
);
341 Status
XGetWindowAttributes(Display
* display
, Window w
,
342 XWindowAttributes
* window_attributes
);
344 int XConfigureWindow(Display
* display
, Window w
, int mask
, XWindowChanges
* changes
);
345 int XTranslateCoordinates(Display
* display
, Window srcWindow
, Window destWindow
, int srcX
, int srcY
, int* destX
, int* destY
, Window
* childReturn
);
351 #define XMaxRequestSize(display) 16384