]> git.saurik.com Git - wxWidgets.git/blame - include/wx/x11/nanox/X11/Xlib.h
Minor fixes to buffered stream in connection
[wxWidgets.git] / include / wx / x11 / nanox / X11 / Xlib.h
CommitLineData
6ec507fd
JS
1/*
2 * Xlib compatibility
3 */
4
c79a329d
JS
5#ifndef _DUMMY_XLIBH_
6#define _DUMMY_XLIBH_
7
788519c6
JS
8/* Move away the typedef in XtoNX.h */
9#define XFontStruct XFontStruct1
c79a329d 10#include <XtoNX.h>
788519c6
JS
11#undef XFontStruct
12#undef XCharStruct
256d631a
JS
13
14/* Data types */
15
c79a329d 16typedef GR_PALETTE* Colormap;
e941874b
JS
17typedef GR_DRAW_ID Drawable ;
18typedef int Status;
c79a329d
JS
19typedef unsigned long VisualID;
20typedef int Bool;
21typedef long XID;
22typedef XID KeySym;
788519c6
JS
23typedef struct {
24 GR_FONT_INFO info;
25 GR_FONT_ID fid;
26} XFontStruct;
27typedef struct {
28 short lbearing; /* origin to left edge of raster */
29 short rbearing; /* origin to right edge of raster */
30 short width; /* advance to next char's origin */
31 short ascent; /* baseline to top edge of raster */
32 short descent; /* baseline to bottom edge of raster */
33 unsigned short attributes; /* per char flags (not predefined) */
34} XCharStruct;
35
36
c79a329d 37/* typedef unsigned long Time; */
e941874b
JS
38
39#define Success 0
40#define GrabSuccess Success
41#define GrabNotViewable (Success+1)
42#define InputOutput 1
43#define InputOnly 2
44#define IsUnmapped 0
45#define IsUnviewable 1
46#define IsViewable 2
c79a329d
JS
47/* Is this right? */
48#define PropertyChangeMask GR_EVENT_MASK_SELECTION_CHANGED
49#define GraphicsExpose GR_EVENT_TYPE_EXPOSURE
50#define GraphicsExposeMask GR_EVENT_MASK_EXPOSURE
788519c6
JS
51#define ColormapChangeMask 0
52#define FillSolid 0
53#define LineSolid 0
54#define LineOnOffDash 0
55#define CapNotLast 0
56#define CapRound 0
57#define CapProjecting 0
58#define CapButt 0
59#define JoinRound 0
60#define JoinBevel 0
61#define JoinMiter 0
62#define IncludeInferiors 0
63#define ClipByChildren 0
64#define DoRed 0
65#define DoGreen 0
66#define DoBlue 0
67
68#define GXcopy GR_MODE_COPY
69#define GXclear GR_MODE_CLEAR
70#ifndef GXxor
71#define GXxor GR_MODE_OR
72#endif
73#define GXinvert GR_MODE_INVERT
74#define GXorReverse GR_MODE_ORREVERSE
75#define GXandReverse GR_MODE_ANDREVERSE
76#define GXand GR_MODE_AND
77#define GXor GR_MODE_OR
78#define GXandInverted GR_MODE_ANDINVERTED
79#define GXnoop GR_MODE_NOOP
80#define GXnor GR_MODE_NOR
81#define GXequiv GR_MODE_EQUIV
82#define GXcopyInverted GR_MODE_COPYINVERTED
83#define GXorInverted GR_MODE_ORINVERTED
84#define GXnand GR_MODE_NAND
85#define GXset GR_MODE_SET
86
87inline void wxNoop() { /* Do nothing */ }
c79a329d
JS
88
89#define XSynchronize(display,sync)
90#define XDefaultRootWindow(d) GR_ROOT_WINDOW_ID
91#define XFreePixmap(d, p) GrDestroyWindow(p)
92#define XFreeCursor(d, c) GrDestroyCursor(c)
788519c6
JS
93#define XFreeGC(d, gc) GrDestroyGC(gc)
94#define XSetBackground(d, gc, c) GrSetGCBackground(gc, c)
c79a329d 95#define DefaultVisual(d, s) ((Visual*) NULL)
788519c6
JS
96#define DefaultColormap(d, s) DefaultColormapOfScreen((Screen*) NULL)
97#define XSetFillStyle(d, gc, s) wxNoop()
98#define XSetLineAttributes(d, gc, a, b, c, e) wxNoop()
99#define XSetClipMask(d, gc, m) wxNoop()
100#define XSetTSOrigin(d, gc, x, y) wxNoop()
101#define XFillArc(d, w, gc, x, y, rx, ry, a1, a2) GrArcAngle(w, gc, x, y, rx, ry, a1, a2, GR_PIE)
102#define XDrawArc(d, w, gc, x, y, rx, ry, a1, a2) GrArcAngle(w, gc, x, y, rx, ry, a1, a2, GR_ARC)
103#define XDrawPoint(d, w, gc, x, y) GrPoint(w, gc, x, y)
104#define XFillPolygon(d, w, gc, p, n, s, m) GrFillPoly(w, gc, n, p)
105#define XDrawRectangle(d, w, gc, x, y, width, height) GrRect(w, gc, x, y, width, height)
106#define XSetClipOrigin(d, gc, x, y) GrSetGCClipOrigin(gc, x, y)
107#define XSetRegion(d, gc, r) GrSetGCRegion(gc, r)
108#define XSetTile(d, gc, p) wxNoop()
109#define XSetStipple(d, gc, p) wxNoop()
110#define XSetSubwindowMode(d, gc, mode) wxNoop()
111#define XFreeColormap(d, cmap) wxNoop()
112#define XSetTransientForHint(d, w, p) wxNoop()
113#define XUnionRegion(sr1,sr2,r) GrUnionRegion(r,sr1,sr2)
114#define XIntersectRegion(sr1,sr2,r) GrIntersectRegion(r,sr1,sr2)
115#define XEqualRegion(r1, r2) GrEqualRegion(r1, r2)
116#define XEmptyRegion(r) GrEmptyRegion(r)
117#define XOffsetRegion(r, x, y) GrOffsetRegion(r, x, y)
118#define XClipBox(r, rect) GrGetRegionBox(r, rect)
119#define XPointInRegion(r, x, y) GrPointInRegion(r, x, y)
120#define XXorRegion(sr1, sr2, r) GrXorRegion(r, sr1, sr2)
121
c79a329d
JS
122
123/* These defines are wrongly defined in XtoNX.h, IMHO,
124 * since they reference a static global.
125 * Redefined as functions, below.
126 */
127
128#undef DisplayWidth
129#undef DisplayHeight
130#undef DefaultDepth
131
132/*
133 * Data structure used by color operations
134 */
135typedef struct {
136 unsigned long pixel;
137 unsigned short red, green, blue;
138 char flags; /* do_red, do_green, do_blue */
139 char pad;
140} XColor;
141
142typedef struct {
143 int type;
144 Display *display; /* Display the event was read from */
145 XID resourceid; /* resource id */
146 unsigned long serial; /* serial number of failed request */
147 unsigned char error_code; /* error code of failed request */
148 unsigned char request_code; /* Major op-code of failed request */
149 unsigned char minor_code; /* Minor op-code of failed request */
150} XErrorEvent;
151
152/*
153 * Visual structure; contains information about colormapping possible.
154 */
155typedef struct {
156 void *ext_data; /* hook for extension to hang data */
157 VisualID visualid; /* visual id of this visual */
158#if defined(__cplusplus) || defined(c_plusplus)
159 int c_class; /* C++ class of screen (monochrome, etc.) */
160#else
161 int class; /* class of screen (monochrome, etc.) */
162#endif
163 unsigned long red_mask, green_mask, blue_mask; /* mask values */
164 int bits_per_rgb; /* log base 2 of distinct color values */
165 int map_entries; /* color map entries */
166} Visual;
167
168/*
169 * Depth structure; contains information for each possible depth.
170 */
171typedef struct {
172 int depth; /* this depth (Z) of the depth */
173 int nvisuals; /* number of Visual types at this depth */
174 Visual *visuals; /* list of visuals possible at this depth */
175} Depth;
176
177/*
178 * Information about the screen. The contents of this structure are
179 * implementation dependent. A Screen should be treated as opaque
180 * by application code.
181 */
182
183struct _XDisplay; /* Forward declare before use for C++ */
184
185typedef struct {
186 void *ext_data; /* hook for extension to hang data */
187 struct _XDisplay *display;/* back pointer to display structure */
188 Window root; /* Root window id. */
189 int width, height; /* width and height of screen */
190 int mwidth, mheight; /* width and height of in millimeters */
191 int ndepths; /* number of depths possible */
192 Depth *depths; /* list of allowable depths on the screen */
193 int root_depth; /* bits per pixel */
194 Visual *root_visual; /* root visual */
195 GC default_gc; /* GC for the root root visual */
196 Colormap cmap; /* default color map */
197 unsigned long white_pixel;
198 unsigned long black_pixel; /* White and Black pixel values */
199 int max_maps, min_maps; /* max and min color maps */
200 int backing_store; /* Never, WhenMapped, Always */
201 Bool save_unders;
202 long root_input_mask; /* initial root input mask */
203} Screen;
204
e941874b
JS
205
206typedef struct {
207 int x, y; /* location of window */
208 int width, height; /* width and height of window */
209 int border_width; /* border width of window */
210 int depth; /* depth of window */
211 Visual *visual; /* the associated visual structure */
212 Window root; /* root of screen containing window */
c79a329d 213 int _class; /* InputOutput, InputOnly*/
e941874b
JS
214 int bit_gravity; /* one of the bit gravity values */
215 int win_gravity; /* one of the window gravity values */
216 int backing_store; /* NotUseful, WhenMapped, Always */
217 unsigned long backing_planes;/* planes to be preserved if possible */
218 unsigned long backing_pixel;/* value to be used when restoring planes */
219 Bool save_under; /* boolean, should bits under be saved? */
220 Colormap colormap; /* color map to be associated with window */
221 Bool map_installed; /* boolean, is color map currently installed*/
222 int map_state; /* IsUnmapped, IsUnviewable, IsViewable */
223 long all_event_masks; /* set of events all people have interest in*/
224 long your_event_mask; /* my event mask */
225 long do_not_propagate_mask;/* set of events that should not propagate */
226 Bool override_redirect; /* boolean value for override-redirect */
227 Screen *screen; /* back pointer to correct screen */
228} XWindowAttributes;
256d631a 229
c79a329d
JS
230typedef int (*XErrorHandler) ( /* WARNING, this type not in Xlib spec */
231 Display* /* display */,
232 XErrorEvent* /* error_event */
233);
234
256d631a
JS
235/* events*/
236
237/* What should this be? */
238#if 0
239#ifndef ResizeRequest
240#define ResizeRequest ??
241#endif
242#endif
243
244#ifndef MotionNotify
245#define MotionNotify GR_EVENT_TYPE_MOUSE_POSITION
246#define PointerMotionMask GR_EVENT_MASK_MOUSE_POSITION
247#endif
248
788519c6
JS
249#define ButtonMotionMask GR_EVENT_MASK_MOUSE_POSITION
250#define KeymapStateMask 0
251#define StructureNotifyMask GR_EVENT_MASK_UPDATE
252
256d631a
JS
253#ifndef FocusIn
254#define FocusIn GR_EVENT_TYPE_FOCUS_IN
255#define FocusOut GR_EVENT_TYPE_FOCUS_OUT
256#define FocusChangeMask GR_EVENT_MASK_FOCUS_IN|GR_EVENT_MASK_FOCUS_OUT
257#endif
258
259/* Fuunctions */
260
261#ifdef __cpluplus
262extern "C" {
263#endif
264
c79a329d 265Colormap DefaultColormapOfScreen(Screen* /* screen */) ;
e941874b 266int XSetGraphicsExposures( Display* /* display */, GC /* gc */, Bool /* graphics_exposures */) ;
788519c6 267int XWarpPointer( Display* /* display */, Window /* srcW */, Window /* destW */,
e941874b
JS
268 int /* srcX */, int /* srcY */,
269 unsigned int /* srcWidth */,
270 unsigned int /* srcHeight */,
271 int destX, int destY);
272int XSetInputFocus(Display* /* display */, Window focus, int /* revert_to */, Time /* time */) ;
273int XGetInputFocus(Display* /* display */, Window* /* focus_return */, int* /* revert_to_return */) ;
274int XGrabPointer(Display* /* display */, Window /* grab_window */,
275 Bool /* owner_events */, unsigned int /* event_mask */,
276 int /* pointer_mode */, int /* keyboard_mode */,
277 Window /* confine_to */, Cursor /* cursor */, Time /* time */) ;
278int XUngrabPointer(Display /* display */, Time /* time */) ;
279int XCopyArea(Display* /* display */, Drawable src, Drawable dest, GC gc,
280 int src_x, int src_y, unsigned int width, unsigned int height,
281 int dest_x, int dest_y) ;
282int XCopyPlane(Display* /* display */, Drawable src, Drawable dest, GC gc,
283 int src_x, int src_y, unsigned int width, unsigned int height,
284 int dest_x, int dest_y, unsigned long /* plane */) ;
256d631a 285
c79a329d 286XErrorHandler XSetErrorHandler (XErrorHandler /* handler */);
788519c6 287Display *XOpenDisplay(char *name);
c79a329d
JS
288Screen *XScreenOfDisplay(Display* /* display */,
289 int /* screen_number */);
290int DisplayWidth(Display* /* display */, int /* screen */);
291int DisplayHeight(Display* /* display */, int /* screen */);
292int DefaultDepth(Display* /* display */, int /* screen */);
293int XAllocColor(Display* /* display */, Colormap /* cmap */,
294 XColor* color);
295int XParseColor(Display* display, Colormap cmap,
296 const char* cname, XColor* color);
788519c6
JS
297int XDrawLine(Display* display, Window win, GC gc,
298 int x1, int y1, int x2, int y2);
299int XTextExtents( XFontStruct* font, char* s, int len, int* direction,
300 int* ascent, int* descent2, XCharStruct* overall);
301int XPending(Display *d);
302XFontStruct* XLoadQueryFont(Display* display, const char* fontSpec);
303int XFreeFont(Display* display, XFontStruct* fontStruct);
304int XQueryColor(Display* display, Colormap cmap, XColor* color);
c79a329d 305
256d631a
JS
306#ifdef __cpluplus
307}
308#endif
309
c79a329d 310#define XMaxRequestSize(display) 16384
256d631a 311
c79a329d
JS
312#endif
313 /* _DUMMY_XLIBH_ */