restore FASTCALL stuff
[mesa.git] / src / glx / x11 / glx_pbuffer.c
index a03189ae3e6313d77007f1e9010314bdff304f9a..83c550559c0c596e0cab9c682f108cc269489284 100644 (file)
 
 #include <inttypes.h>
 #include "glxclient.h"
-#include <extutil.h>
-#include <Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/Xext.h>
 #include <assert.h>
 #include <string.h>
 #include "glapi.h"
 #include "glxextensions.h"
 #include "glcontextmodes.h"
-
-#ifdef IN_DOXYGEN
-#define GLX_PREFIX(x) x
-#endif /* IN_DOXYGEN */
+#include "glheader.h"
 
 static void ChangeDrawableAttribute( Display * dpy, GLXDrawable drawable,
     const CARD32 * attribs, size_t num_attribs );
@@ -277,14 +274,16 @@ CreateDrawable( Display *dpy, const __GLcontextModes * fbconfig,
 {
    xGLXCreateWindowReq * req;
    CARD32 * data;
-   unsigned int  i;
-
+   unsigned int i;
 
-   for ( i = 0 ; attrib_list[i * 2] != None ; i++ )
-      /* empty */ ;
+   i = 0;
+   if (attrib_list) {
+       while (attrib_list[i * 2] != None)
+          i++;
+   }
 
    LockDisplay(dpy);
-   GetReqExtra( GLXCreateWindow, 20 + (8 * i), req );
+   GetReqExtra( GLXCreateWindow, 8 * i, req );
    data = (CARD32 *) (req + 1);
 
    req->reqType = __glXSetupForCommand(dpy);
@@ -292,12 +291,15 @@ CreateDrawable( Display *dpy, const __GLcontextModes * fbconfig,
    req->screen = (CARD32) fbconfig->screen;
    req->fbconfig = fbconfig->fbconfigID;
    req->window = (GLXPbuffer) drawable;
+   req->glxwindow = (GLXWindow) XAllocID(dpy);
    req->numAttribs = (CARD32) i;
 
+   memcpy( data, attrib_list, 8 * i );
+   
    UnlockDisplay(dpy);
    SyncHandle();
    
-   return drawable;
+   return (GLXDrawable)req->glxwindow;
 }
 
 
@@ -354,10 +356,11 @@ CreatePbuffer( Display *dpy, const __GLcontextModes * fbconfig,
    CARD32 * data;
    unsigned int  i;
 
-
-   for ( i = 0 ; attrib_list[i * 2] != None ; i++ )
-      /* empty */ ;
-
+   i = 0;
+   if (attrib_list) {
+       while (attrib_list[i * 2])
+          i++;
+   }
 
    LockDisplay(dpy);
    id = XAllocID(dpy);
@@ -414,10 +417,10 @@ CreatePbuffer( Display *dpy, const __GLcontextModes * fbconfig,
 /**
  * Create a new pbuffer.
  */
-GLXPbufferSGIX
-GLX_PREFIX(glXCreateGLXPbufferSGIX)(Display *dpy, GLXFBConfigSGIX config,
-                                   unsigned int width, unsigned int height,
-                                   int *attrib_list)
+PUBLIC GLXPbufferSGIX
+glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config,
+                       unsigned int width, unsigned int height,
+                       int *attrib_list)
 {
    return (GLXPbufferSGIX) CreatePbuffer( dpy, (__GLcontextModes *) config,
                                          width, height,
@@ -428,9 +431,8 @@ GLX_PREFIX(glXCreateGLXPbufferSGIX)(Display *dpy, GLXFBConfigSGIX config,
 /**
  * Create a new pbuffer.
  */
-GLXPbuffer
-GLX_PREFIX(glXCreatePbuffer)(Display *dpy, GLXFBConfig config,
-                            const int *attrib_list)
+PUBLIC GLXPbuffer
+glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attrib_list)
 {
    return (GLXPbuffer) CreatePbuffer( dpy, (__GLcontextModes *) config,
                                      0, 0,
@@ -441,8 +443,8 @@ GLX_PREFIX(glXCreatePbuffer)(Display *dpy, GLXFBConfig config,
 /**
  * Destroy an existing pbuffer.
  */
-void
-GLX_PREFIX(glXDestroyPbuffer)(Display *dpy, GLXPbuffer pbuf)
+PUBLIC void
+glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf)
 {
    DestroyPbuffer( dpy, pbuf );
 }
@@ -451,9 +453,9 @@ GLX_PREFIX(glXDestroyPbuffer)(Display *dpy, GLXPbuffer pbuf)
 /**
  * Query an attribute of a drawable.
  */
-void
-GLX_PREFIX(glXQueryDrawable)(Display *dpy, GLXDrawable drawable,
-                                  int attribute, unsigned int *value)
+PUBLIC void
+glXQueryDrawable(Display *dpy, GLXDrawable drawable,
+                int attribute, unsigned int *value)
 {
    GetDrawableAttribute( dpy, drawable, attribute, value );
 }
@@ -462,9 +464,9 @@ GLX_PREFIX(glXQueryDrawable)(Display *dpy, GLXDrawable drawable,
 /**
  * Query an attribute of a pbuffer.
  */
-int
-GLX_PREFIX(glXQueryGLXPbufferSGIX)(Display *dpy, GLXPbufferSGIX drawable,
-                                  int attribute, unsigned int *value)
+PUBLIC int
+glXQueryGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX drawable,
+                      int attribute, unsigned int *value)
 {
    return GetDrawableAttribute( dpy, drawable, attribute, value );
 }
@@ -473,9 +475,8 @@ GLX_PREFIX(glXQueryGLXPbufferSGIX)(Display *dpy, GLXPbufferSGIX drawable,
 /**
  * Select the event mask for a drawable.
  */
-void
-GLX_PREFIX(glXSelectEvent)(Display *dpy, GLXDrawable drawable,
-                          unsigned long mask)
+PUBLIC void
+glXSelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask)
 {
    CARD32 attribs[2];
 
@@ -489,9 +490,8 @@ GLX_PREFIX(glXSelectEvent)(Display *dpy, GLXDrawable drawable,
 /**
  * Get the selected event mask for a drawable.
  */
-void
-GLX_PREFIX(glXGetSelectedEvent)(Display *dpy, GLXDrawable drawable,
-                               unsigned long *mask)
+PUBLIC void
+glXGetSelectedEvent(Display *dpy, GLXDrawable drawable, unsigned long *mask)
 {
    unsigned int value;
 
@@ -506,9 +506,9 @@ GLX_PREFIX(glXGetSelectedEvent)(Display *dpy, GLXDrawable drawable,
 }
 
 
-GLXPixmap
-GLX_PREFIX(glXCreatePixmap)( Display *dpy, GLXFBConfig config, Pixmap pixmap,
-                            const int *attrib_list )
+PUBLIC GLXPixmap
+glXCreatePixmap( Display *dpy, GLXFBConfig config, Pixmap pixmap,
+                const int *attrib_list )
 {
    return CreateDrawable( dpy, (__GLcontextModes *) config,
                          (Drawable) pixmap, attrib_list,
@@ -516,9 +516,9 @@ GLX_PREFIX(glXCreatePixmap)( Display *dpy, GLXFBConfig config, Pixmap pixmap,
 }
 
 
-GLXWindow
-GLX_PREFIX(glXCreateWindow)( Display *dpy, GLXFBConfig config, Window win,
-                            const int *attrib_list )
+PUBLIC GLXWindow
+glXCreateWindow( Display *dpy, GLXFBConfig config, Window win,
+                const int *attrib_list )
 {
    return CreateDrawable( dpy, (__GLcontextModes *) config,
                          (Drawable) win, attrib_list,
@@ -526,31 +526,31 @@ GLX_PREFIX(glXCreateWindow)( Display *dpy, GLXFBConfig config, Window win,
 }
 
 
-void
-GLX_PREFIX(glXDestroyPixmap)(Display *dpy, GLXPixmap pixmap)
+PUBLIC void
+glXDestroyPixmap(Display *dpy, GLXPixmap pixmap)
 {
    DestroyDrawable( dpy, (GLXDrawable) pixmap, X_GLXDestroyPixmap );
 }
 
 
-void
-GLX_PREFIX(glXDestroyWindow)(Display *dpy, GLXWindow win)
+PUBLIC void
+glXDestroyWindow(Display *dpy, GLXWindow win)
 {
    DestroyDrawable( dpy, (GLXDrawable) win, X_GLXDestroyWindow );
 }
 
 
-GLX_ALIAS_VOID(glXDestroyGLXPbufferSGIX,
+PUBLIC GLX_ALIAS_VOID(glXDestroyGLXPbufferSGIX,
          (Display *dpy, GLXPbufferSGIX pbuf),
          (dpy, pbuf),
          glXDestroyPbuffer)
 
-GLX_ALIAS_VOID(glXSelectEventSGIX,
+PUBLIC GLX_ALIAS_VOID(glXSelectEventSGIX,
          (Display *dpy, GLXDrawable drawable, unsigned long mask),
          (dpy, drawable, mask),
          glXSelectEvent)
 
-GLX_ALIAS_VOID(glXGetSelectedEventSGIX,
+PUBLIC GLX_ALIAS_VOID(glXGetSelectedEventSGIX,
          (Display *dpy, GLXDrawable drawable, unsigned long *mask),
          (dpy, drawable, mask),
          glXGetSelectedEvent)