1
#ifndef __win32_x11_h__
2
#define __win32_x11_h__
4
/* Copyright (c) Nate Robins, 1997. */
6
/* This program is freely distributable without licensing fees
7
and is provided without guarantee or warrantee expressed or
8
implied. This program is -not- in the public domain. */
15
/* These definitions are missing from windows.h */
18
/* Type definitions (conversions) */
19
typedef int Visual; /* Win32 equivalent of X11 type */
21
typedef HPALETTE Colormap;
22
typedef PIXELFORMATDESCRIPTOR XVisualInfo;
26
typedef HCURSOR Cursor;
28
typedef int Atom; /* dummies */
32
#define True TRUE /* Win32 equivalents of X11 booleans */
35
#define None 0L /* universal null resource or null atom */
37
/* Input Event Masks. Used as event-mask window attribute and as arguments
38
to Grab requests. Not to be confused with event names. */
40
#define NoEventMask 0L
41
#define KeyPressMask (1L<<0)
42
#define KeyReleaseMask (1L<<1)
43
#define ButtonPressMask (1L<<2)
44
#define ButtonReleaseMask (1L<<3)
45
#define EnterWindowMask (1L<<4)
46
#define LeaveWindowMask (1L<<5)
47
#define PointerMotionMask (1L<<6)
48
#define PointerMotionHintMask (1L<<7)
49
#define Button1MotionMask (1L<<8)
50
#define Button2MotionMask (1L<<9)
51
#define Button3MotionMask (1L<<10)
52
#define Button4MotionMask (1L<<11)
53
#define Button5MotionMask (1L<<12)
54
#define ButtonMotionMask (1L<<13)
55
#define KeymapStateMask (1L<<14)
56
#define ExposureMask (1L<<15)
57
#define VisibilityChangeMask (1L<<16)
58
#define StructureNotifyMask (1L<<17)
59
#define ResizeRedirectMask (1L<<18)
60
#define SubstructureNotifyMask (1L<<19)
61
#define SubstructureRedirectMask (1L<<20)
62
#define FocusChangeMask (1L<<21)
63
#define PropertyChangeMask (1L<<22)
64
#define ColormapChangeMask (1L<<23)
65
#define OwnerGrabButtonMask (1L<<24)
67
/* Key masks. Used as modifiers to GrabButton and GrabKey, results of
68
QueryPointer, state in various key-, mouse-, and button-related
71
#define ShiftMask (1<<0)
72
#define LockMask (1<<1)
73
#define ControlMask (1<<2)
74
#define Mod1Mask (1<<3)
75
#define Mod2Mask (1<<4)
76
#define Mod3Mask (1<<5)
77
#define Mod4Mask (1<<6)
78
#define Mod5Mask (1<<7)
80
/* Window classes used by CreateWindow */
81
/* Note that CopyFromParent is already defined as 0 above */
86
/* Window attributes for CreateWindow and ChangeWindowAttributes */
88
#define CWBackPixmap (1L<<0)
89
#define CWBackPixel (1L<<1)
90
#define CWBorderPixmap (1L<<2)
91
#define CWBorderPixel (1L<<3)
92
#define CWBitGravity (1L<<4)
93
#define CWWinGravity (1L<<5)
94
#define CWBackingStore (1L<<6)
95
#define CWBackingPlanes (1L<<7)
96
#define CWBackingPixel (1L<<8)
97
#define CWOverrideRedirect (1L<<9)
98
#define CWSaveUnder (1L<<10)
99
#define CWEventMask (1L<<11)
100
#define CWDontPropagate (1L<<12)
101
#define CWColormap (1L<<13)
102
#define CWCursor (1L<<14)
104
/* ConfigureWindow structure */
108
#define CWWidth (1<<2)
109
#define CWHeight (1<<3)
110
#define CWBorderWidth (1<<4)
111
#define CWSibling (1<<5)
112
#define CWStackMode (1<<6)
115
/* Used in GetWindowAttributes reply */
118
#define IsUnviewable 1
121
/* Window stacking method (in configureWindow) */
129
/* For CreateColormap */
131
#define AllocNone 0 /* create map with no entries */
132
#define AllocAll 1 /* allocate entire map writeable */
135
/* Flags used in StoreNamedColor, StoreColors */
138
#define DoGreen (1<<1)
139
#define DoBlue (1<<2)
142
* Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
143
* value (x, y, width, height) was found in the parsed string.
145
#define NoValue 0x0000
146
#define XValue 0x0001
147
#define YValue 0x0002
148
#define WidthValue 0x0004
149
#define HeightValue 0x0008
150
#define AllValues 0x000F
151
#define XNegative 0x0010
152
#define YNegative 0x0020
154
/* flags argument in size hints */
155
#define USPosition (1L << 0) /* user specified x, y */
156
#define USSize (1L << 1) /* user specified width, height */
158
/* definitions for initial window state */
159
#define WithdrawnState 0 /* for windows that are not mapped */
160
#define NormalState 1 /* most applications want to start this way */
161
#define IconicState 3 /* application wants to start as an icon */
162
#define GameModeState 4 /* Win32 GLUT only (not in Xlib!). */
164
/* Type definitions */
167
unsigned int background_pixmap; /* background pixmap */
168
unsigned long background_pixel; /* background pixel */
169
unsigned long border_pixel; /* border pixel value */
170
long event_mask; /* set of events that should be saved */
171
long do_not_propagate_mask; /* set of events that should not propagate */
172
Bool override_redirect; /* boolean value for override-redirect */
173
Colormap colormap; /* color map to be associated with window */
174
} XSetWindowAttributes;
178
unsigned short red, green, blue;
179
char flags; /* do_red, do_green, do_blue */
183
unsigned char *value; /* same as Property routines */
184
Atom encoding; /* prop type */
185
int format; /* prop data format: 8, 16, or 32 */
186
unsigned long nitems; /* number of data items in value */
190
long flags; /* marks which fields in this structure are defined */
191
int x, y; /* obsolete for new window mgrs, but clients */
192
int width, height; /* should set so old wm's don't mess up */
195
/* Functions emulated by macros. */
197
#define XFreeColormap(display, colormap) \
198
DeleteObject(colormap)
200
#define XCreateFontCursor(display, shape) \
201
LoadCursor(NULL, shape)
203
#define XDefineCursor(display, window, cursor) \
206
#define XFlush(display) \
209
#define DisplayWidth(display, screen) \
210
GetSystemMetrics(SM_CXSCREEN)
212
#define DisplayHeight(display, screen) \
213
GetSystemMetrics(SM_CYSCREEN)
215
#define XMapWindow(display, window) \
216
ShowWindow(window, SW_SHOWNORMAL)
218
#define XUnmapWindow(display, window) \
219
ShowWindow(window, SW_HIDE)
221
#define XIconifyWindow(display, window, screen) \
222
ShowWindow(window, SW_MINIMIZE)
224
#define XWithdrawWindow(display, window, screen) \
225
ShowWindow(window, SW_HIDE)
227
#define XLowerWindow(display, window) \
228
SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE)
230
#define XSetWMName(display, window, tp) \
231
SetWindowText(window, (const char *)(tp)->value)
233
/* There really isn't a way to set the icon name separate from the
234
windows name in Win32, so, just set the windows name. */
235
#define XSetWMIconName(display, window, tp) \
236
XSetWMName(display, window, tp)
238
#define XDestroyWindow(display, window) \
239
DestroyWindow(window)
241
/* Anything that needs to be freed was allocated with malloc in our
242
fake X windows library for Win32, so free it with plain old
244
#define XFree(data) \
247
/* Nothing to be done for this...the pointer is always 'ungrabbed'
249
#define XUngrabPointer(display, time) \
252
/* Function prototypes. */
254
extern XVisualInfo* XGetVisualInfo(
257
XVisualInfo* ttemplate, /* Avoid class with C++ keyword. */
260
extern Colormap XCreateColormap(
266
extern void XAllocColorCells(
270
unsigned long plane_masks_return[],
271
unsigned int nplanes,
272
unsigned long pixels_return[],
273
unsigned int npixels);
275
extern void XStoreColor(
280
extern void XSetWindowColormap(
285
extern Bool XTranslateCoordinates(
287
Window src, Window dst,
288
int src_x, int src_y,
289
int* dest_x_return, int* dest_y_return,
290
Window* child_return);
292
extern Status XGetGeometry(
296
int* x_return, int* y_return,
297
unsigned int* width_return, unsigned int* height_return,
298
unsigned int *border_width_return,
299
unsigned int* depth_return);
301
extern int DisplayWidthMM(
305
extern int DisplayHeightMM(
309
extern void XWarpPointer(
311
Window src, Window dst,
312
int src_x, int src_y,
313
int src_width, int src_height,
314
int dst_x, int dst_y);
316
extern int XParseGeometry(
319
unsigned int* width, unsigned int* height);
324
#endif /* __win32_x11_h__ */