#ifndef __win32_x11_h__
#define __win32_x11_h__
#ifdef __MINGW32__
#include <GL/gl.h>
#endif
#include <stdlib.h>
#include <windows.h>
typedef int Visual;
typedef HWND Window;
typedef HPALETTE Colormap;
typedef PIXELFORMATDESCRIPTOR XVisualInfo;
typedef BOOL Bool;
typedef MSG XEvent;
typedef HDC Display;
typedef HCURSOR Cursor;
typedef int Atom;
typedef int XDevice;
typedef int Status;
#define True TRUE
#define False FALSE
#define None 0L
#define NoEventMask 0L
#define KeyPressMask (1L<<0)
#define KeyReleaseMask (1L<<1)
#define ButtonPressMask (1L<<2)
#define ButtonReleaseMask (1L<<3)
#define EnterWindowMask (1L<<4)
#define LeaveWindowMask (1L<<5)
#define PointerMotionMask (1L<<6)
#define PointerMotionHintMask (1L<<7)
#define Button1MotionMask (1L<<8)
#define Button2MotionMask (1L<<9)
#define Button3MotionMask (1L<<10)
#define Button4MotionMask (1L<<11)
#define Button5MotionMask (1L<<12)
#define ButtonMotionMask (1L<<13)
#define KeymapStateMask (1L<<14)
#define ExposureMask (1L<<15)
#define VisibilityChangeMask (1L<<16)
#define StructureNotifyMask (1L<<17)
#define ResizeRedirectMask (1L<<18)
#define SubstructureNotifyMask (1L<<19)
#define SubstructureRedirectMask (1L<<20)
#define FocusChangeMask (1L<<21)
#define PropertyChangeMask (1L<<22)
#define ColormapChangeMask (1L<<23)
#define OwnerGrabButtonMask (1L<<24)
#define ShiftMask (1<<0)
#define LockMask (1<<1)
#define ControlMask (1<<2)
#define Mod1Mask (1<<3)
#define Mod2Mask (1<<4)
#define Mod3Mask (1<<5)
#define Mod4Mask (1<<6)
#define Mod5Mask (1<<7)
#define InputOutput 1
#define InputOnly 2
#define CWBackPixmap (1L<<0)
#define CWBackPixel (1L<<1)
#define CWBorderPixmap (1L<<2)
#define CWBorderPixel (1L<<3)
#define CWBitGravity (1L<<4)
#define CWWinGravity (1L<<5)
#define CWBackingStore (1L<<6)
#define CWBackingPlanes (1L<<7)
#define CWBackingPixel (1L<<8)
#define CWOverrideRedirect (1L<<9)
#define CWSaveUnder (1L<<10)
#define CWEventMask (1L<<11)
#define CWDontPropagate (1L<<12)
#define CWColormap (1L<<13)
#define CWCursor (1L<<14)
#define CWX (1<<0)
#define CWY (1<<1)
#define CWWidth (1<<2)
#define CWHeight (1<<3)
#define CWBorderWidth (1<<4)
#define CWSibling (1<<5)
#define CWStackMode (1<<6)
#define IsUnmapped 0
#define IsUnviewable 1
#define IsViewable 2
#define Above 0
#define Below 1
#define TopIf 2
#define BottomIf 3
#define Opposite 4
#define AllocNone 0
#define AllocAll 1
#define DoRed (1<<0)
#define DoGreen (1<<1)
#define DoBlue (1<<2)
#define NoValue 0x0000
#define XValue 0x0001
#define YValue 0x0002
#define WidthValue 0x0004
#define HeightValue 0x0008
#define AllValues 0x000F
#define XNegative 0x0010
#define YNegative 0x0020
#define USPosition (1L << 0)
#define USSize (1L << 1)
#define WithdrawnState 0
#define NormalState 1
#define IconicState 3
#define GameModeState 4
typedef struct {
unsigned int background_pixmap;
unsigned long background_pixel;
unsigned long border_pixel;
long event_mask;
long do_not_propagate_mask;
Bool override_redirect;
Colormap colormap;
} XSetWindowAttributes;
typedef struct {
unsigned long pixel;
unsigned short red, green, blue;
char flags;
} XColor;
typedef struct {
unsigned char *value;
Atom encoding;
int format;
unsigned long nitems;
} XTextProperty;
typedef struct {
long flags;
int x, y;
int width, height;
} XSizeHints;
#define XFreeColormap(display, colormap) \
DeleteObject(colormap)
#define XCreateFontCursor(display, shape) \
LoadCursor(NULL, shape)
#define XDefineCursor(display, window, cursor) \
SetCursor(cursor)
#define XFlush(display) \
#define DisplayWidth(display, screen) \
GetSystemMetrics(SM_CXSCREEN)
#define DisplayHeight(display, screen) \
GetSystemMetrics(SM_CYSCREEN)
#define XMapWindow(display, window) \
ShowWindow(window, SW_SHOWNORMAL)
#define XUnmapWindow(display, window) \
ShowWindow(window, SW_HIDE)
#define XIconifyWindow(display, window, screen) \
ShowWindow(window, SW_MINIMIZE)
#define XWithdrawWindow(display, window, screen) \
ShowWindow(window, SW_HIDE)
#define XLowerWindow(display, window) \
SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE)
#define XSetWMName(display, window, tp) \
SetWindowText(window, (tp)->value)
#define XSetWMIconName(display, window, tp) \
XSetWMName(display, window, tp)
#define XDestroyWindow(display, window) \
DestroyWindow(window)
#define XFree(data) \
free(data)
#define XUngrabPointer(display, time) \
extern XVisualInfo* XGetVisualInfo(
Display* display,
long mask,
XVisualInfo* ttemplate,
int*nitems);
extern Colormap XCreateColormap(
Display* display,
Window root,
Visual* visual,
int alloc);
extern void XAllocColorCells(
Display* display,
Colormap colormap,
Bool contig,
unsigned long plane_masks_return[],
unsigned int nplanes,
unsigned long pixels_return[],
unsigned int npixels);
extern void XStoreColor(
Display* display,
Colormap colormap,
XColor* color);
extern void XSetWindowColormap(
Display* display,
Window window,
Colormap colormap);
extern Bool XTranslateCoordinates(
Display *display,
Window src, Window dst,
int src_x, int src_y,
int* dest_x_return, int* dest_y_return,
Window* child_return);
extern Status XGetGeometry(
Display* display,
Window window,
Window* root_return,
int* x_return, int* y_return,
unsigned int* width_return, unsigned int* height_return,
unsigned int *border_width_return,
unsigned int* depth_return);
extern int DisplayWidthMM(
Display* display,
int screen);
extern int DisplayHeightMM(
Display* display,
int screen);
extern void XWarpPointer(
Display* display,
Window src, Window dst,
int src_x, int src_y,
int src_width, int src_height,
int dst_x, int dst_y);
extern int XParseGeometry(
char* string,
int* x, int* y,
unsigned int* width, unsigned int* height);
extern int XPending(
Display* display);
#endif