home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 5 / MA_Cover_5.iso / ppc / mesa / src-glut / win32_x11.h < prev   
Encoding:
C/C++ Source or Header  |  1998-01-31  |  8.0 KB  |  297 lines

  1. #ifndef __win32_x11_h__
  2. #define __win32_x11_h__
  3.  
  4. /* Copyright (c) Nate Robins, 1997. */
  5.  
  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. */
  9.  
  10.  
  11. #include <windows.h>
  12.  
  13.  
  14. /* Type definitions (conversions) */
  15. typedef int Visual;            /* Win32 equivalent of X11 type */
  16. typedef HWND Window;
  17. typedef HPALETTE Colormap;
  18. typedef PIXELFORMATDESCRIPTOR XVisualInfo;
  19. typedef BOOL Bool;
  20. typedef MSG XEvent;
  21. typedef HDC Display;
  22. typedef HCURSOR Cursor;
  23.  
  24. typedef int Atom;            /* dummies */
  25. typedef int XDevice;
  26. typedef int Status;
  27.  
  28. #define True  TRUE            /* Win32 equivalents of X11 booleans */
  29. #define False FALSE
  30.  
  31.  
  32. #define None                 0L    /* universal null resource or null atom */
  33.  
  34. /* Input Event Masks. Used as event-mask window attribute and as arguments
  35.    to Grab requests.  Not to be confused with event names.  */
  36.  
  37. #define NoEventMask            0L
  38. #define KeyPressMask            (1L<<0)  
  39. #define KeyReleaseMask            (1L<<1)  
  40. #define ButtonPressMask            (1L<<2)  
  41. #define ButtonReleaseMask        (1L<<3)  
  42. #define EnterWindowMask            (1L<<4)  
  43. #define LeaveWindowMask            (1L<<5)  
  44. #define PointerMotionMask        (1L<<6)  
  45. #define PointerMotionHintMask        (1L<<7)  
  46. #define Button1MotionMask        (1L<<8)  
  47. #define Button2MotionMask        (1L<<9)  
  48. #define Button3MotionMask        (1L<<10) 
  49. #define Button4MotionMask        (1L<<11) 
  50. #define Button5MotionMask        (1L<<12) 
  51. #define ButtonMotionMask        (1L<<13) 
  52. #define KeymapStateMask            (1L<<14)
  53. #define ExposureMask            (1L<<15) 
  54. #define VisibilityChangeMask        (1L<<16) 
  55. #define StructureNotifyMask        (1L<<17) 
  56. #define ResizeRedirectMask        (1L<<18) 
  57. #define SubstructureNotifyMask        (1L<<19) 
  58. #define SubstructureRedirectMask    (1L<<20) 
  59. #define FocusChangeMask            (1L<<21) 
  60. #define PropertyChangeMask        (1L<<22) 
  61. #define ColormapChangeMask        (1L<<23) 
  62. #define OwnerGrabButtonMask        (1L<<24) 
  63.  
  64. /* Key masks. Used as modifiers to GrabButton and GrabKey, results of
  65.    QueryPointer, state in various key-, mouse-, and button-related
  66.    events. */
  67.  
  68. #define ShiftMask        (1<<0)
  69. #define LockMask        (1<<1)
  70. #define ControlMask        (1<<2)
  71. #define Mod1Mask        (1<<3)
  72. #define Mod2Mask        (1<<4)
  73. #define Mod3Mask        (1<<5)
  74. #define Mod4Mask        (1<<6)
  75. #define Mod5Mask        (1<<7)
  76.  
  77. /* Window classes used by CreateWindow */
  78. /* Note that CopyFromParent is already defined as 0 above */
  79.  
  80. #define InputOutput        1
  81. #define InputOnly        2
  82.  
  83. /* Window attributes for CreateWindow and ChangeWindowAttributes */
  84.  
  85. #define CWBackPixmap        (1L<<0)
  86. #define CWBackPixel        (1L<<1)
  87. #define CWBorderPixmap        (1L<<2)
  88. #define CWBorderPixel           (1L<<3)
  89. #define CWBitGravity        (1L<<4)
  90. #define CWWinGravity        (1L<<5)
  91. #define CWBackingStore          (1L<<6)
  92. #define CWBackingPlanes            (1L<<7)
  93. #define CWBackingPixel            (1L<<8)
  94. #define CWOverrideRedirect    (1L<<9)
  95. #define CWSaveUnder        (1L<<10)
  96. #define CWEventMask        (1L<<11)
  97. #define CWDontPropagate            (1L<<12)
  98. #define CWColormap        (1L<<13)
  99. #define CWCursor            (1L<<14)
  100.  
  101. /* ConfigureWindow structure */
  102.  
  103. #define CWX            (1<<0)
  104. #define CWY            (1<<1)
  105. #define CWWidth            (1<<2)
  106. #define CWHeight        (1<<3)
  107. #define CWBorderWidth        (1<<4)
  108. #define CWSibling        (1<<5)
  109. #define CWStackMode        (1<<6)
  110.  
  111.  
  112. /* Used in GetWindowAttributes reply */
  113.  
  114. #define IsUnmapped        0
  115. #define IsUnviewable        1
  116. #define IsViewable        2
  117.  
  118. /* Window stacking method (in configureWindow) */
  119.  
  120. #define Above                   0
  121. #define Below                   1
  122. #define TopIf                   2
  123. #define BottomIf                3
  124. #define Opposite                4
  125.  
  126. /* For CreateColormap */
  127.  
  128. #define AllocNone        0    /* create map with no entries */
  129. #define AllocAll        1    /* allocate entire map writeable */
  130.  
  131.  
  132. /* Flags used in StoreNamedColor, StoreColors */
  133.  
  134. #define DoRed            (1<<0)
  135. #define DoGreen            (1<<1)
  136. #define DoBlue            (1<<2)
  137.  
  138. /* 
  139.  * Bitmask returned by XParseGeometry().  Each bit tells if the corresponding
  140.  * value (x, y, width, height) was found in the parsed string.
  141.  */
  142. #define NoValue        0x0000
  143. #define XValue      0x0001
  144. #define YValue        0x0002
  145. #define WidthValue      0x0004
  146. #define HeightValue      0x0008
  147. #define AllValues     0x000F
  148. #define XNegative     0x0010
  149. #define YNegative     0x0020
  150.  
  151. /* flags argument in size hints */
  152. #define USPosition    (1L << 0) /* user specified x, y */
  153. #define USSize        (1L << 1) /* user specified width, height */
  154.  
  155. /* definitions for initial window state */
  156. #define WithdrawnState 0    /* for windows that are not mapped */
  157. #define NormalState 1    /* most applications want to start this way */
  158. #define IconicState 3    /* application wants to start as an icon */
  159.  
  160.  
  161. /* Type definitions */
  162.  
  163. typedef struct {
  164.     unsigned int background_pixmap;    /* background pixmap */
  165.     unsigned long background_pixel;    /* background pixel */
  166.     unsigned long border_pixel;    /* border pixel value */
  167.     long event_mask;        /* set of events that should be saved */
  168.     long do_not_propagate_mask;    /* set of events that should not propagate */
  169.     Bool override_redirect;       /* boolean value for override-redirect */
  170.     Colormap colormap;           /* color map to be associated with window */
  171. } XSetWindowAttributes;
  172.  
  173. typedef struct {
  174.   unsigned long pixel;
  175.   unsigned short red, green, blue;
  176.   char flags;  /* do_red, do_green, do_blue */
  177. } XColor;
  178.  
  179. typedef struct {
  180.   unsigned char *value;       /* same as Property routines */
  181.   Atom encoding;       /* prop type */
  182.   int format;           /* prop data format: 8, 16, or 32 */
  183.   unsigned long nitems;       /* number of data items in value */
  184. } XTextProperty;
  185.  
  186. typedef struct {
  187.   long flags;            /* marks which fields in this structure are defined */
  188.   int x, y;        /* obsolete for new window mgrs, but clients */
  189.   int width, height;    /* should set so old wm's don't mess up */
  190. } XSizeHints;
  191.  
  192.  
  193. /* Function prototypes */
  194.  
  195. Window
  196. XCreateWindow(Display* display, Window parent, int x, int y,
  197.           unsigned int width, unsigned int height, unsigned int border,
  198.           int depth, unsigned int class, Visual* visual, 
  199.           unsigned long valuemask, XSetWindowAttributes* attributes);
  200.  
  201. XVisualInfo*
  202. XGetVisualInfo(Display* display, long mask, XVisualInfo* template, int*nitems);
  203.  
  204. Colormap
  205. XCreateColormap(Display* display, Window root, Visual* visual, int alloc);
  206.  
  207. void
  208. XAllocColorCells(Display* display, Colormap colormap, Bool contig, 
  209.          unsigned long plane_masks_return[], unsigned int nplanes,
  210.          unsigned long pixels_return[], unsigned int npixels);
  211.  
  212. void
  213. XStoreColor(Display* display, Colormap colormap, XColor* color);
  214.  
  215. void
  216. XSetWindowColormap(Display* display, Window window, Colormap colormap);
  217.  
  218. void
  219. XFreeColormap(Display* display, Colormap colormap);
  220.  
  221. Cursor
  222. XCreateFontCursor(Display* display, char* shape);
  223.  
  224. void
  225. XDefineCursor(Display* display, Window window, Cursor cursor);
  226.  
  227. void
  228. XFlush(Display* display);
  229.  
  230. Bool
  231. XTranslateCoordinates(Display *display, Window src, Window dst, 
  232.               int src_x, int src_y, 
  233.               int* dest_x_return, int* dest_y_return,
  234.               Window* child_return);
  235.  
  236. Status
  237. XGetGeometry(Display* display, Window window, Window* root_return, 
  238.          int* x_return, int* y_return, 
  239.          unsigned int* width_return, unsigned int* height_return,
  240.          unsigned int *border_width_return, unsigned int* depth_return);
  241.  
  242. int
  243. DisplayWidth(Display* display, int screen);
  244.  
  245. int
  246. DisplayHeight(Display* display, int screen);
  247.  
  248. int
  249. DisplayWidthMM(Display* display, int screen);
  250.  
  251. int
  252. DisplayHeightMM(Display* display, int screen);
  253.  
  254. void
  255. XMapWindow(Display* display, Window window);
  256.  
  257. void
  258. XUnmapWindow(Display* display, Window window);
  259.  
  260. void
  261. XIconifyWindow(Display* display, Window window, int screen);
  262.  
  263. void
  264. XWithdrawWindow(Display* display, Window window, int screen);
  265.  
  266. void
  267. XLowerWindow(Display* display, Window window);
  268.  
  269. void
  270. XWarpPointer(Display* display, Window src, Window dst, 
  271.          int src_x, int src_y, int src_width, int src_height, 
  272.          int dst_x, int dst_y);
  273.  
  274. void
  275. XSetWMName(Display* display, Window window, XTextProperty *tp);
  276.  
  277. void
  278. XSetWMIconName(Display* display, Window window, XTextProperty *tp);
  279.  
  280. int
  281. XPending(Display* display);
  282.  
  283. void
  284. XDestroyWindow(Display* display, Window window);
  285.  
  286. void
  287. XFree(void* data);
  288.  
  289. void
  290. XUngrabPointer(Display* display, int time);
  291.  
  292. int
  293. XParseGeometry(char* string, int* x, int* y, 
  294.            unsigned int* width, unsigned int* height);
  295.  
  296. #endif /* __win32_x11_h__ */
  297.