summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2007-07-28 13:50:49 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2007-07-28 13:50:49 +0000
commit8e7afb01e471a98ba7020064dbd5e00c88821af2 (patch)
treefc4bfcf7e500d2d59e9c590f7fa7a8f0651fe340 /lib
parentd52a5f57ef8d97fbca86abca55f299ea8701c711 (diff)
Bring in GLw from XF4, to replace the Mesa version. This version
has Motif support enabled using a couple of hacks that Mesa didn't pick up. ok mbalmer@
Diffstat (limited to 'lib')
-rw-r--r--lib/libGLw/GLwDAUtil.c84
-rw-r--r--lib/libGLw/GLwDrawA.c732
-rw-r--r--lib/libGLw/GLwDrawA.h226
-rw-r--r--lib/libGLw/GLwDrawAP.h127
-rw-r--r--lib/libGLw/GLwM1DrawA.c55
-rw-r--r--lib/libGLw/GLwM2DrawA.c55
-rw-r--r--lib/libGLw/GLwMDrawA.h47
-rw-r--r--lib/libGLw/GLwMDrawAP.h47
-rw-r--r--lib/libGLw/GLwXm/PrimitiveP.h90
-rw-r--r--lib/libGLw/GLwXm/Xm.h143
-rw-r--r--lib/libGLw/GLwXm/XmP.h67
-rw-r--r--lib/libGLw/GLwXm/XmStrDefs.h121
-rw-r--r--lib/libGLw/Makefile17
-rw-r--r--lib/libGLw/shlib_version2
14 files changed, 1803 insertions, 10 deletions
diff --git a/lib/libGLw/GLwDAUtil.c b/lib/libGLw/GLwDAUtil.c
new file mode 100644
index 000000000..d4f8e7b7b
--- /dev/null
+++ b/lib/libGLw/GLwDAUtil.c
@@ -0,0 +1,84 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/* utility routines for GLX.
+ * Since these routines are used both in the Motif and X versions of
+ * the widget, they cannot peek directly into the structure
+ *
+ */
+
+/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glw/GLwDAUtil.c,v 1.3tsi Exp $ */
+
+#include <X11/IntrinsicP.h>
+#include <X11/StringDefs.h>
+#include <GL/glx.h>
+#include <GL/gl.h>
+
+/*
+ * By default only a static library is created because most of the UNIX
+ * loaders, if not all, complain about unresolved symbols even if the
+ * application doesn't use the modules in which such symbols are referenced.
+ * However, if your system supports libraries with weak symbols (e.g.
+ * Solaris, FreeBSD and Linux) it is possible to fool the loader using these
+ * weak symbols.
+ */
+#ifdef USE_XM_STUBS
+#ifdef __OpenBSD__
+#include <sys/cdefs.h>
+__weak_alias(_XmPrimitiveHighlightPixmapDefault, _Xm_Stub_Pointer_);
+__weak_alias(_XmHighlightColorDefault, _Xm_Stub_Pointer_);
+__weak_alias(_XmForegroundColorDefault, _Xm_Stub_Pointer_);
+__weak_alias(_XmBackgroundColorDefault, _Xm_Stub_Pointer_);
+__weak_alias(_XmStrings, _Xm_Stub_Pointer_);
+__weak_alias(xmPrimitiveClassRec, _Xm_Stub_Pointer_);
+#else
+#pragma weak _XmPrimitiveHighlightPixmapDefault = _Xm_Stub_Pointer_
+#pragma weak _XmHighlightColorDefault = _Xm_Stub_Pointer_
+#pragma weak _XmForegroundColorDefault = _Xm_Stub_Pointer_
+#pragma weak _XmBackgroundColorDefault = _Xm_Stub_Pointer_
+#pragma weak _XmStrings = _Xm_Stub_Pointer_
+#pragma weak xmPrimitiveClassRec = _Xm_Stub_Pointer_
+#endif
+XtPointer _Xm_Stub_Pointer_ = NULL;
+#endif
+
+void GLwDrawingAreaMakeCurrent (Widget w, GLXContext ctx)
+{
+ glXMakeCurrent (XtDisplay(w), XtWindow(w), ctx);
+}
+
+void GLwDrawingAreaSwapBuffers (Widget w)
+{
+ glXSwapBuffers (XtDisplay(w), XtWindow(w));
+}
diff --git a/lib/libGLw/GLwDrawA.c b/lib/libGLw/GLwDrawA.c
new file mode 100644
index 000000000..8056bd0ca
--- /dev/null
+++ b/lib/libGLw/GLwDrawA.c
@@ -0,0 +1,732 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+/* $XFree86$ */
+
+#include <stdio.h>
+#include <GL/glx.h>
+#include <GL/gl.h>
+#ifdef __GLX_MOTIF
+#include "GLwMDrawAP.h"
+#else /* not __GLX_MOTIF */
+#include "GLwDrawAP.h"
+#include <X11/IntrinsicP.h>
+#include <X11/StringDefs.h>
+#endif /* __GLX_MOTIF */
+#include <assert.h>
+
+#ifdef __GLX_MOTIF
+/* The MOTIF version differs only in the inclusion of the primitive
+ * widget class and in a vew variable and type name differences.
+ * Rather than put ifdefs all over the place, we just use a few defines
+ * to make it use motif types and names
+ */
+#define GLwDrawingAreaWidget GLwMDrawingAreaWidget
+#define GLwDrawingAreaClassRec GLwMDrawingAreaClassRec
+#define glwDrawingAreaClassRec glwMDrawingAreaClassRec
+#define glwDrawingAreaWidgetClass glwMDrawingAreaWidgetClass
+#define GLwDrawingAreaRec GLwMDrawingAreaRec
+#endif /* __GLX_MOTIF */
+
+/* forward definitions */
+/* resource default procs */
+static void createColormap(GLwDrawingAreaWidget w,
+ int offset, XrmValue *value);
+
+/* widget methods */
+static void Initialize(GLwDrawingAreaWidget req, GLwDrawingAreaWidget new,
+ ArgList args, Cardinal *num_args);
+static void Realize(Widget w, Mask *valueMask,
+ XSetWindowAttributes *attributes);
+static void Redraw(GLwDrawingAreaWidget w, XEvent *event, Region region);
+static void Resize(GLwDrawingAreaWidget glw);
+static void Destroy(GLwDrawingAreaWidget glw);
+
+#define offset(field) XtOffset(GLwDrawingAreaWidget, glwDrawingArea.field)
+
+static char defaultTranslations[] =
+#ifdef __GLX_MOTIF
+ "<Key>osfHelp:PrimitiveHelp() \n"
+#endif
+ "<KeyDown>: glwInput() \n\
+ <KeyUp>: glwInput() \n\
+ <BtnDown>: glwInput() \n\
+ <BtnUp>: glwInput() \n\
+ <BtnMotion>: glwInput() ";
+
+static void glwInput(GLwDrawingAreaWidget glw, XEvent *event,
+ String *, Cardinal *);
+
+static XtActionsRec actions[] = {
+ { "glwInput", (XtActionProc) glwInput }, /* key or mouse input */
+};
+
+/*
+ * There is a bit of unusual handling of the resources here.
+ * Because Xt insists on allocating the colormap resource when it is
+ * processing the core resources (even if we redeclare the colormap
+ * resource here, we need to do a little trick. When Xt first allocates
+ * the colormap, we allow it to allocate the default one, since we have
+ * not yet determined the appropriate visual (which is determined from
+ * resources parsed after the colormap). We also let it allocate colors
+ * in that default colormap.
+ *
+ * In the initialize proc we calculate the actual visual. Then, we
+ * reobtain the colormap resource using XtGetApplicationResources in
+ * the initialize proc. If requested, we also reallocate colors in
+ * that colormap using the same method.
+ */
+
+static XtResource resources[] = {
+ /* The GLX attributes. Add any new attributes here */
+
+ {GLwNbufferSize, GLwCBufferSize, XtRInt, sizeof (int),
+ offset(bufferSize), XtRImmediate, (XtPointer) 0},
+
+ {GLwNlevel, GLwCLevel, XtRInt, sizeof (int),
+ offset(level), XtRImmediate, (XtPointer) 0},
+
+ {GLwNrgba, GLwCRgba, XtRBoolean, sizeof (Boolean),
+ offset(rgba), XtRImmediate, (XtPointer) FALSE},
+
+ {GLwNdoublebuffer, GLwCDoublebuffer, XtRBoolean, sizeof (Boolean),
+ offset(doublebuffer), XtRImmediate, (XtPointer) FALSE},
+
+ {GLwNstereo, GLwCStereo, XtRBoolean, sizeof (Boolean),
+ offset(stereo), XtRImmediate, (XtPointer) FALSE},
+
+ {GLwNauxBuffers, GLwCAuxBuffers, XtRInt, sizeof (int),
+ offset(auxBuffers), XtRImmediate, (XtPointer) 0},
+
+ {GLwNredSize, GLwCColorSize, XtRInt, sizeof (int),
+ offset(redSize), XtRImmediate, (XtPointer) 1},
+
+ {GLwNgreenSize, GLwCColorSize, XtRInt, sizeof (int),
+ offset(greenSize), XtRImmediate, (XtPointer) 1},
+
+ {GLwNblueSize, GLwCColorSize, XtRInt, sizeof (int),
+ offset(blueSize), XtRImmediate, (XtPointer) 1},
+
+ {GLwNalphaSize, GLwCAlphaSize, XtRInt, sizeof (int),
+ offset(alphaSize), XtRImmediate, (XtPointer) 0},
+
+ {GLwNdepthSize, GLwCDepthSize, XtRInt, sizeof (int),
+ offset(depthSize), XtRImmediate, (XtPointer) 0},
+
+ {GLwNstencilSize, GLwCStencilSize, XtRInt, sizeof (int),
+ offset(stencilSize), XtRImmediate, (XtPointer) 0},
+
+ {GLwNaccumRedSize, GLwCAccumColorSize, XtRInt, sizeof (int),
+ offset(accumRedSize), XtRImmediate, (XtPointer) 0},
+
+ {GLwNaccumGreenSize, GLwCAccumColorSize, XtRInt, sizeof (int),
+ offset(accumGreenSize), XtRImmediate, (XtPointer) 0},
+
+ {GLwNaccumBlueSize, GLwCAccumColorSize, XtRInt, sizeof (int),
+ offset(accumBlueSize), XtRImmediate, (XtPointer) 0},
+
+ {GLwNaccumAlphaSize, GLwCAccumAlphaSize, XtRInt, sizeof (int),
+ offset(accumAlphaSize), XtRImmediate, (XtPointer) 0},
+
+ /* the attribute list */
+ {GLwNattribList, GLwCAttribList, XtRPointer, sizeof(int *),
+ offset(attribList), XtRImmediate, (XtPointer) NULL},
+
+ /* the visual info */
+ {GLwNvisualInfo, GLwCVisualInfo, GLwRVisualInfo, sizeof (XVisualInfo *),
+ offset(visualInfo), XtRImmediate, (XtPointer) NULL},
+
+/* miscellaneous resources */
+ {GLwNinstallColormap, GLwCInstallColormap, XtRBoolean, sizeof (Boolean),
+ offset(installColormap), XtRImmediate, (XtPointer) TRUE},
+
+ {GLwNallocateBackground, GLwCAllocateColors, XtRBoolean, sizeof (Boolean),
+ offset(allocateBackground), XtRImmediate, (XtPointer) FALSE},
+
+ {GLwNallocateOtherColors, GLwCAllocateColors, XtRBoolean, sizeof (Boolean),
+ offset(allocateOtherColors), XtRImmediate, (XtPointer) FALSE},
+
+ {GLwNinstallBackground, GLwCInstallBackground, XtRBoolean, sizeof (Boolean),
+ offset(installBackground), XtRImmediate, (XtPointer) TRUE},
+
+ {GLwNginitCallback, GLwCCallback, XtRCallback, sizeof (XtCallbackList),
+ offset(ginitCallback), XtRImmediate, (XtPointer) NULL},
+
+ {GLwNinputCallback, GLwCCallback, XtRCallback, sizeof (XtCallbackList),
+ offset(inputCallback), XtRImmediate, (XtPointer) NULL},
+
+ {GLwNresizeCallback, GLwCCallback, XtRCallback, sizeof (XtCallbackList),
+ offset(resizeCallback), XtRImmediate, (XtPointer) NULL},
+
+ {GLwNexposeCallback, GLwCCallback, XtRCallback, sizeof (XtCallbackList),
+ offset(exposeCallback), XtRImmediate, (XtPointer) NULL},
+
+#ifdef __GLX_MOTIF
+ /* Changes to Motif primitive resources */
+ {XmNtraversalOn, XmCTraversalOn, XmRBoolean, sizeof (Boolean),
+ XtOffset (GLwDrawingAreaWidget, primitive.traversal_on), XmRImmediate,
+ (XtPointer) FALSE},
+
+ /* highlighting is normally disabled, as when Motif tries to disable
+ * highlighting, it tries to reset the color back to the parent's
+ * background (usually Motif blue). Unfortunately, that is in a
+ * different colormap, and doesn't work too well.
+ */
+ {XmNhighlightOnEnter, XmCHighlightOnEnter, XmRBoolean, sizeof (Boolean),
+ XtOffset (GLwDrawingAreaWidget, primitive.highlight_on_enter),
+ XmRImmediate, (XtPointer) FALSE},
+
+ {XmNhighlightThickness, XmCHighlightThickness, XmRHorizontalDimension,
+ sizeof (Dimension),
+ XtOffset (GLwDrawingAreaWidget, primitive.highlight_thickness),
+ XmRImmediate, (XtPointer) 0},
+
+#endif /* __GLX_MOTIF */
+};
+
+/* The following resources are reobtained using XtGetApplicationResources
+ * in the initialize proc.
+ */
+/* The colormap */
+static XtResource initializeResources[] = {
+ /* reobtain the colormap with the new visual */
+ {XtNcolormap, XtCColormap, XtRColormap, sizeof(Colormap),
+ XtOffset(GLwDrawingAreaWidget, core.colormap),
+ XtRCallProc,(XtPointer) createColormap},
+};
+
+/* reallocate any colors we need in the new colormap */
+
+/* The background is obtained only if the allocateBackground resource is TRUE*/
+static XtResource backgroundResources[] = {
+#ifdef __GLX_MOTIF
+ {
+ XmNbackground, XmCBackground, XmRPixel,
+ sizeof (Pixel), XtOffset(GLwDrawingAreaWidget, core.background_pixel),
+ XmRCallProc, (XtPointer) _XmBackgroundColorDefault
+ },
+ {
+ XmNbackgroundPixmap, XmCPixmap, XmRXmBackgroundPixmap,
+ sizeof (Pixmap), XtOffset(GLwDrawingAreaWidget, core.background_pixmap),
+ XmRImmediate, (XtPointer) XmUNSPECIFIED_PIXMAP
+ },
+
+#else /* ! __GLX_MOTIF */
+ {XtNbackground, XtCBackground, XtRPixel,sizeof(Pixel),
+ XtOffset(GLwDrawingAreaWidget,core.background_pixel),
+ XtRString, (XtPointer)"XtDefaultBackground"},
+ {XtNbackgroundPixmap, XtCPixmap, XtRPixmap, sizeof(Pixmap),
+ XtOffset(GLwDrawingAreaWidget,core.background_pixmap),
+ XtRImmediate, (XtPointer)XtUnspecifiedPixmap},
+#endif /* __GLX_MOTIF */
+};
+
+/* The other colors such as the foreground are allocated only if
+ * allocateOtherColors are set. These resources only exist in Motif.
+ */
+
+#ifdef __GLX_MOTIF
+static XtResource otherColorResources[] = {
+ {
+ XmNforeground, XmCForeground, XmRPixel,
+ sizeof (Pixel), XtOffset(GLwDrawingAreaWidget, primitive.foreground),
+ XmRCallProc, (XtPointer) _XmForegroundColorDefault
+ },
+
+ {
+ XmNhighlightColor, XmCHighlightColor, XmRPixel, sizeof (Pixel),
+ XtOffset(GLwDrawingAreaWidget, primitive.highlight_color),
+ XmRCallProc, (XtPointer) _XmHighlightColorDefault
+ },
+
+ {
+ XmNhighlightPixmap, XmCHighlightPixmap, XmRPrimHighlightPixmap,
+ sizeof (Pixmap),
+ XtOffset(GLwDrawingAreaWidget, primitive.highlight_pixmap),
+ XmRCallProc, (XtPointer) _XmPrimitiveHighlightPixmapDefault
+ },
+};
+#endif /* __GLX_MOTIF */
+
+struct attribInfo
+{
+ int offset;
+ int attribute;
+};
+
+static struct attribInfo intAttribs[] =
+{
+ { offset(bufferSize), GLX_BUFFER_SIZE },
+ { offset(level), GLX_LEVEL },
+ { offset(auxBuffers), GLX_AUX_BUFFERS },
+ { offset(redSize), GLX_RED_SIZE },
+ { offset(greenSize), GLX_GREEN_SIZE },
+ { offset(blueSize), GLX_BLUE_SIZE },
+ { offset(alphaSize), GLX_ALPHA_SIZE },
+ { offset(depthSize), GLX_DEPTH_SIZE },
+ { offset(stencilSize), GLX_STENCIL_SIZE },
+ { offset(accumRedSize), GLX_ACCUM_RED_SIZE },
+ { offset(accumGreenSize), GLX_ACCUM_GREEN_SIZE },
+ { offset(accumBlueSize), GLX_ACCUM_BLUE_SIZE },
+ { offset(accumAlphaSize), GLX_ACCUM_ALPHA_SIZE },
+ { 0, None },
+};
+
+static struct attribInfo booleanAttribs[] =
+{
+ { offset(rgba), GLX_RGBA },
+ { offset(doublebuffer), GLX_DOUBLEBUFFER },
+ { offset(stereo), GLX_STEREO },
+ { 0, None },
+};
+
+#undef offset
+
+
+GLwDrawingAreaClassRec glwDrawingAreaClassRec =
+{
+ { /* core fields */
+#ifdef __GLX_MOTIF
+ /* superclass */ (WidgetClass) &xmPrimitiveClassRec,
+ /* class_name */ "GLwMDrawingArea",
+#else /* not __GLX_MOTIF */
+ /* superclass */ (WidgetClass) &widgetClassRec,
+ /* class_name */ "GLwDrawingArea",
+#endif /* __GLX_MOTIF */
+ /* widget_size */ sizeof(GLwDrawingAreaRec),
+ /* class_initialize */ NULL,
+ /* class_part_initialize */ NULL,
+ /* class_inited */ FALSE,
+ /* initialize */ (XtInitProc) Initialize,
+ /* initialize_hook */ NULL,
+ /* realize */ Realize,
+ /* actions */ actions,
+ /* num_actions */ XtNumber(actions),
+ /* resources */ resources,
+ /* num_resources */ XtNumber(resources),
+ /* xrm_class */ NULLQUARK,
+ /* compress_motion */ TRUE,
+ /* compress_exposure */ TRUE,
+ /* compress_enterleave */ TRUE,
+ /* visible_interest */ TRUE,
+ /* destroy */ (XtWidgetProc) Destroy,
+ /* resize */ (XtWidgetProc) Resize,
+ /* expose */ (XtExposeProc) Redraw,
+ /* set_values */ NULL,
+ /* set_values_hook */ NULL,
+ /* set_values_almost */ XtInheritSetValuesAlmost,
+ /* get_values_hook */ NULL,
+ /* accept_focus */ NULL,
+ /* version */ XtVersion,
+ /* callback_private */ NULL,
+ /* tm_table */ defaultTranslations,
+ /* query_geometry */ XtInheritQueryGeometry,
+ /* display_accelerator */ XtInheritDisplayAccelerator,
+ /* extension */ NULL
+ },
+#ifdef __GLX_MOTIF /* primitive resources */
+ {
+ /* border_highlight */ XmInheritBorderHighlight,
+ /* border_unhighlight */ XmInheritBorderUnhighlight,
+ /* translations */ XtInheritTranslations,
+ /* arm_and_activate */ NULL,
+ /* get_resources */ NULL,
+ /* num get_resources */ 0,
+ /* extension */ NULL,
+ }
+#endif /* __GLX_MOTIF */
+};
+
+WidgetClass glwDrawingAreaWidgetClass = (WidgetClass)&glwDrawingAreaClassRec;
+
+static void error(Widget w, char *string)
+{
+ char buf[100];
+#ifdef __GLX_MOTIF
+ sprintf (buf, "GLwMDrawingArea: %s\n", string);
+#else
+ sprintf (buf, "GLwDrawingArea: %s\n", string);
+#endif
+ XtAppError(XtWidgetToApplicationContext(w), buf);
+}
+
+static void warning(Widget w, char *string)
+{
+ char buf[100];
+#ifdef __GLX_MOTIF
+ sprintf (buf, "GLwMDraw: %s\n", string);
+#else
+ sprintf (buf, "GLwDraw: %s\n", string);
+#endif
+ XtAppWarning(XtWidgetToApplicationContext(w), buf);
+}
+
+/* resource initialization methods */
+/* Initialize the attribList based on the attributes */
+static void createAttribList(GLwDrawingAreaWidget w)
+{
+ int listLength;
+ register struct attribInfo *ap;
+ int *ip;
+
+ /* first find out how long a list we need */
+ listLength=1; /* include the terminating NULL */
+ for (ap = booleanAttribs; ap->attribute; ap++)
+ {
+ if (*(Boolean *)(((char *)w)+ap->offset))
+ listLength++; /* one word for a boolean */
+ }
+ for (ap = intAttribs; ap->attribute; ap++)
+ {
+ if (*(int *)(((char *)w)+ap->offset))
+ listLength+=2; /* one word for an int */
+ }
+ w->glwDrawingArea.attribList = (int *)XtMalloc(listLength*sizeof(int));
+ ip = w->glwDrawingArea.attribList;
+ for (ap = booleanAttribs; ap->attribute; ap++)
+ {
+ if (*(Boolean *)(((char *)w)+ap->offset))
+ *ip++ = ap->attribute;
+ }
+ for (ap = intAttribs; ap->attribute; ap++)
+ {
+ if (*(int *)(((char *)w)+ap->offset))
+ {
+ *ip++ = ap->attribute;
+ *ip++ = *(int *)(((char *)w)+ap->offset);
+ }
+ }
+ *ip = None;
+}
+
+/* Initialize the visualInfo based on the attribute list */
+static void createVisualInfo(GLwDrawingAreaWidget w)
+{
+ assert(w->glwDrawingArea.attribList);
+ w->glwDrawingArea.visualInfo = glXChooseVisual(XtDisplay(w),
+ XScreenNumberOfScreen(XtScreen(w)),
+ w->glwDrawingArea.attribList);
+ if (!w->glwDrawingArea.visualInfo)
+ error((Widget)w,"requested visual not supported");
+}
+
+/* Initialize the colormap based on the visual info.
+ * This routine maintains a cache of visual-infos to colormaps. If two
+ * widgets share the same visual info, they share the same colormap.
+ * This function is called by the callProc of the colormap resource entry.
+ */
+static void createColormap(GLwDrawingAreaWidget w,
+ int offset, XrmValue *value)
+{
+ static struct cmapCache
+ {
+ Visual *visual;
+ Colormap cmap;
+ int screen;
+ } *cmapCache;
+ static int cacheEntries=0;
+ static int cacheMalloced=0;
+
+ register int i;
+
+ assert(w->glwDrawingArea.visualInfo);
+
+ /* see if we can find it in the cache */
+ for (i=0; i<cacheEntries; i++)
+ if (cmapCache[i].visual == w->glwDrawingArea.visualInfo->visual &&
+ cmapCache[i].screen == w->glwDrawingArea.visualInfo->screen)
+ {
+ value->addr = (XtPointer) (&cmapCache[i].cmap);
+ return;
+ }
+ /* not in the cache, create a new entry */
+ if (cacheEntries >= cacheMalloced)
+ {
+ /* need to malloc a new one. Since we are likely to have only a
+ * few colormaps, we allocate one the first time, and double
+ * each subsequent time.
+ */
+ if (cacheMalloced == 0)
+ {
+ cacheMalloced = 1;
+ cmapCache = (struct cmapCache *)XtMalloc(sizeof(struct cmapCache));
+ }
+ else
+ {
+ cacheMalloced <<= 1;
+ cmapCache = (struct cmapCache *)XtRealloc((char *) cmapCache,
+ sizeof(struct cmapCache)*
+ cacheMalloced);
+ }
+ }
+
+ cmapCache[cacheEntries].cmap = XCreateColormap (XtDisplay(w),
+ RootWindow(XtDisplay(w),
+ w->glwDrawingArea.visualInfo->screen),
+ w->glwDrawingArea.visualInfo->visual,
+ AllocNone);
+ cmapCache[cacheEntries].visual = w->glwDrawingArea.visualInfo->visual;
+ cmapCache[cacheEntries].screen = w->glwDrawingArea.visualInfo->screen;
+ value->addr = (XtPointer) (&cmapCache[cacheEntries++].cmap);
+}
+
+static void
+Initialize (GLwDrawingAreaWidget req, GLwDrawingAreaWidget new,
+ ArgList args, Cardinal *num_args)
+{
+
+ if (req->core.width == 0)
+ new->core.width = 100;
+ if (req->core.height == 0)
+ new->core.width = 100;
+
+ /* create the attribute list if needed */
+ if (new->glwDrawingArea.attribList == NULL)
+ {
+ new->glwDrawingArea.myList = TRUE;
+ createAttribList(new);
+ }
+ else
+ new->glwDrawingArea.myList = FALSE;
+
+ /* determine the visual info if needed */
+ if (new->glwDrawingArea.visualInfo == NULL)
+ {
+ new->glwDrawingArea.myVisual = TRUE;
+ createVisualInfo(new);
+ }
+ else
+ new->glwDrawingArea.myVisual = FALSE;
+
+ new->core.depth = new->glwDrawingArea.visualInfo->depth;
+
+ /* Reobtain the colormap and colors in it using XtGetApplicationResources*/
+ XtGetApplicationResources((Widget) new, new,
+ initializeResources,
+ XtNumber(initializeResources),
+ args, *num_args);
+
+ /* obtain the color resources if appropriate */
+ if (req->glwDrawingArea.allocateBackground)
+ XtGetApplicationResources((Widget) new, new,
+ backgroundResources,
+ XtNumber(backgroundResources),
+ args, *num_args);
+
+#ifdef __GLX_MOTIF
+ if (req->glwDrawingArea.allocateOtherColors)
+ XtGetApplicationResources((Widget) new, new,
+ otherColorResources,
+ XtNumber(otherColorResources),
+ args, *num_args);
+#endif /* __GLX_MOTIF */
+
+}
+
+static void
+Realize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes)
+{
+ register GLwDrawingAreaWidget glw = (GLwDrawingAreaWidget)w;
+ GLwDrawingAreaCallbackStruct cb;
+
+ /* if we haven't requested that the background be both installed and
+ * allocated, don't install it.
+ */
+ if (!(glw->glwDrawingArea.installBackground &&
+ glw->glwDrawingArea.allocateBackground))
+ *valueMask &= ~CWBackPixel;
+
+ XtCreateWindow (w, (unsigned int)InputOutput,
+ glw->glwDrawingArea.visualInfo->visual,
+ *valueMask, attributes);
+
+ /* if appropriate, call XSetWMColormapWindows to install the colormap */
+ if (glw->glwDrawingArea.installColormap)
+ {
+ Widget parentShell = XtParent(w);
+ Status status;
+ Window *windowsReturn;
+ int countReturn;
+
+ while (parentShell && !XtIsShell(parentShell))
+ parentShell = XtParent(parentShell);
+ if (parentShell && XtWindow(parentShell))
+ {
+ /* check to see if there is already a property */
+ status = XGetWMColormapWindows(XtDisplay(parentShell),
+ XtWindow(parentShell),
+ &windowsReturn, &countReturn);
+
+ /* if no property, just create one */
+ if (!status)
+ {
+ Window windows[2];
+ windows[0] = XtWindow(w);
+ windows[1] = XtWindow(parentShell);
+ XSetWMColormapWindows(XtDisplay(parentShell),
+ XtWindow(parentShell),
+ windows, 2);
+ }
+ /* there was a property, add myself to the beginning */
+ else
+ {
+ Window *windows = (Window *)XtMalloc((sizeof(Window))*
+ (countReturn+1));
+ register int i;
+ windows[0] = XtWindow(w);
+ for (i=0; i<countReturn; i++)
+ windows[i+1] = windowsReturn[i];
+ XSetWMColormapWindows(XtDisplay(parentShell),
+ XtWindow(parentShell),
+ windows, countReturn+1);
+ XtFree((char *) windows);
+ XFree((char *) windowsReturn);
+ }
+ }
+ else
+ warning((Widget)w,
+ "Could not set colormap property on parent shell");
+ }
+ cb.reason = GLwCR_GINIT;
+ cb.event = NULL;
+ cb.width = glw->core.width;
+ cb.height = glw->core.height;
+ XtCallCallbackList((Widget) glw, glw->glwDrawingArea.ginitCallback, &cb);
+}
+
+static void
+Redraw(GLwDrawingAreaWidget w, XEvent *event, Region region)
+{
+ GLwDrawingAreaCallbackStruct cb;
+
+ cb.reason = GLwCR_EXPOSE;
+ cb.event = event;
+ cb.width = w->core.width;
+ cb.height = w->core.height;
+ XtCallCallbackList ((Widget) w, w->glwDrawingArea.exposeCallback, &cb);
+}
+
+static void
+Resize(GLwDrawingAreaWidget glw)
+{
+ GLwDrawingAreaCallbackStruct cb;
+
+ /* if we get a resize event before being realized, we can't handle it */
+ if (!XtIsRealized((Widget)glw))
+ return;
+ cb.reason = GLwCR_RESIZE;
+ cb.event = NULL;
+ cb.width = glw->core.width;
+ cb.height = glw->core.height;
+ XtCallCallbackList ((Widget) glw, glw->glwDrawingArea.resizeCallback, &cb);
+}
+
+static void
+Destroy(GLwDrawingAreaWidget glw)
+{
+ if (glw->glwDrawingArea.myList && glw->glwDrawingArea.attribList)
+ XtFree ((XtPointer)glw->glwDrawingArea.attribList);
+ if (glw->glwDrawingArea.myVisual && glw->glwDrawingArea.visualInfo)
+ XFree ((XtPointer)glw->glwDrawingArea.visualInfo);
+
+ /* if my colormap was installed, remove it */
+ if (glw->glwDrawingArea.installColormap)
+ {
+ Widget parentShell = XtParent(glw);
+ Status status;
+ Window *windowsReturn;
+ int countReturn;
+ register int i;
+
+ /* find the parent shell */
+ while (parentShell && !XtIsShell(parentShell))
+ parentShell = XtParent(parentShell);
+
+ if (parentShell && XtWindow(parentShell))
+ {
+ /* make sure there is a property */
+ status = XGetWMColormapWindows(XtDisplay(parentShell),
+ XtWindow(parentShell),
+ &windowsReturn, &countReturn);
+
+ /* if no property, just return. If there was a property,
+ * continue
+ */
+ if (status)
+ {
+ /* search for a match */
+ for (i=0; i<countReturn; i++)
+ {
+ if (windowsReturn[i] == XtWindow(glw))
+ {
+ /* we found a match, now copu the rest down */
+ for (i++; i<countReturn; i++)
+ {
+ windowsReturn[i-1] = windowsReturn[i];
+ }
+ XSetWMColormapWindows(XtDisplay(parentShell),
+ XtWindow(parentShell),
+ windowsReturn, countReturn-1);
+ break; /* from outer for */
+ }
+ }
+ XFree((char *) windowsReturn);
+ }
+ }
+ }
+}
+
+/* Action routine for keyboard and mouse events */
+/* ARGSUSED */
+static void glwInput (GLwDrawingAreaWidget glw, XEvent *event,
+ String * params, Cardinal * numParams)
+{
+ GLwDrawingAreaCallbackStruct cb;
+
+ cb.reason = GLwCR_INPUT;
+ cb.event = event;
+ cb.width = glw->core.width;
+ cb.height = glw->core.height;
+ XtCallCallbackList ((Widget) glw, glw->glwDrawingArea.inputCallback, &cb);
+}
+
+#ifdef __GLX_MOTIF
+/* Provide a Motif-style create routine */
+Widget GLwCreateMDrawingArea(Widget parent, char *name,
+ ArgList arglist, Cardinal argcount)
+{
+ return (XtCreateWidget (name, glwMDrawingAreaWidgetClass, parent, arglist,
+ argcount));
+}
+#endif
diff --git a/lib/libGLw/GLwDrawA.h b/lib/libGLw/GLwDrawA.h
new file mode 100644
index 000000000..5da21a9a0
--- /dev/null
+++ b/lib/libGLw/GLwDrawA.h
@@ -0,0 +1,226 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+/*
+** This file has been slightly modified from the original by Carlos A. M. dos
+** Santos <casantos@cpmet.ufpel.tche.br> for integration into XFree86 source
+** tree and for generating both Motif(TM) 1.2 and 2.x versions of the widgets
+** in the same library.
+*/
+/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawA.h,v 1.3 2001/05/02 13:37:45 dawes Exp $ */
+
+#ifndef _GLwDrawA_h
+#define _GLwDrawA_h
+
+#ifdef __GLX_MOTIF
+# ifndef __GLX_INCLUDE_XM_H /* Defined during library compilation */
+# include <Xm/Xm.h> /* We need to know about XmVERSION early */
+# endif
+#endif
+
+#include <GL/glx.h>
+#include <GL/gl.h>
+
+/****************************************************************
+ *
+ * GLwDrawingArea widgets
+ *
+ ****************************************************************/
+
+/* Resources:
+
+ Name Class RepType Default Value
+ ---- ----- ------- -------------
+ attribList AttribList int * NULL
+ visualInfo VisualInfo VisualInfo NULL
+ installColormap InstallColormap Boolean TRUE
+ allocateBackground AllocateColors Boolean FALSE
+ allocateOtherColors AllocateColors Boolean FALSE
+ installBackground InstallBackground Boolean TRUE
+ exposeCallback Callback Pointer NULL
+ ginitCallback Callback Pointer NULL
+ inputCallback Callback Pointer NULL
+ resizeCallback Callback Pointer NULL
+
+*** The following resources all correspond to the GLX configuration
+*** attributes and are used to create the attribList if it is NULL
+ bufferSize BufferSize int 0
+ level Level int 0
+ rgba Rgba Boolean FALSE
+ doublebuffer Doublebuffer Boolean FALSE
+ stereo Stereo Boolean FALSE
+ auxBuffers AuxBuffers int 0
+ redSize ColorSize int 1
+ greenSize ColorSize int 1
+ blueSize ColorSize int 1
+ alphaSize AlphaSize int 0
+ depthSize DepthSize int 0
+ stencilSize StencilSize int 0
+ accumRedSize AccumColorSize int 0
+ accumGreenSize AccumColorSize int 0
+ accumBlueSize AccumColorSize int 0
+ accumAlphaSize AccumAlphaSize int 0
+*/
+
+#define GLwNattribList "attribList"
+#define GLwCAttribList "AttribList"
+#define GLwNvisualInfo "visualInfo"
+#define GLwCVisualInfo "VisualInfo"
+#define GLwRVisualInfo "VisualInfo"
+
+#define GLwNinstallColormap "installColormap"
+#define GLwCInstallColormap "InstallColormap"
+#define GLwNallocateBackground "allocateBackground"
+#define GLwNallocateOtherColors "allocateOtherColors"
+#define GLwCAllocateColors "AllocateColors"
+#define GLwNinstallBackground "installBackground"
+#define GLwCInstallBackground "InstallBackground"
+
+#define GLwCCallback "Callback"
+#define GLwNexposeCallback "exposeCallback"
+#define GLwNginitCallback "ginitCallback"
+#define GLwNresizeCallback "resizeCallback"
+#define GLwNinputCallback "inputCallback"
+
+#define GLwNbufferSize "bufferSize"
+#define GLwCBufferSize "BufferSize"
+#define GLwNlevel "level"
+#define GLwCLevel "Level"
+#define GLwNrgba "rgba"
+#define GLwCRgba "Rgba"
+#define GLwNdoublebuffer "doublebuffer"
+#define GLwCDoublebuffer "Doublebuffer"
+#define GLwNstereo "stereo"
+#define GLwCStereo "Stereo"
+#define GLwNauxBuffers "auxBuffers"
+#define GLwCAuxBuffers "AuxBuffers"
+#define GLwNredSize "redSize"
+#define GLwNgreenSize "greenSize"
+#define GLwNblueSize "blueSize"
+#define GLwCColorSize "ColorSize"
+#define GLwNalphaSize "alphaSize"
+#define GLwCAlphaSize "AlphaSize"
+#define GLwNdepthSize "depthSize"
+#define GLwCDepthSize "DepthSize"
+#define GLwNstencilSize "stencilSize"
+#define GLwCStencilSize "StencilSize"
+#define GLwNaccumRedSize "accumRedSize"
+#define GLwNaccumGreenSize "accumGreenSize"
+#define GLwNaccumBlueSize "accumBlueSize"
+#define GLwCAccumColorSize "AccumColorSize"
+#define GLwNaccumAlphaSize "accumAlphaSize"
+#define GLwCAccumAlphaSize "AccumAlphaSize"
+
+#ifdef __GLX_MOTIF
+
+#if XmVERSION == 1
+/*
+# define _GLwMDrawingAreaClassRec _GLwM1DrawingAreaClassRec
+# define _GLwMDrawingAreaRec _GLwM1DrawingAreaRec
+*/
+# define glwMDrawingAreaWidgetClass glwM1DrawingAreaWidgetClass
+# define glwMDrawingAreaClassRec glwM1DrawingAreaClassRec
+# define GLwCreateMDrawingArea GLwCreateM1DrawingArea
+#elif XmVERSION == 2
+/*
+# define _GLwMDrawingAreaClassRec _GLwM2DrawingAreaClassRec
+# define _GLwMDrawingAreaRec _GLwM2DrawingAreaRec
+*/
+# define glwMDrawingAreaWidgetClass glwM2DrawingAreaWidgetClass
+# define glwMDrawingAreaClassRec glwM2DrawingAreaClassRec
+# define GLwCreateMDrawingArea GLwCreateM2DrawingArea
+#else
+#error "Sorry, unknown Motif version."
+#endif /* XmVERSION */
+
+typedef struct _GLwMDrawingAreaClassRec *GLwMDrawingAreaWidgetClass;
+typedef struct _GLwMDrawingAreaRec *GLwMDrawingAreaWidget;
+
+extern WidgetClass glwMDrawingAreaWidgetClass;
+
+#else /* not __GLX_MOTIF */
+
+typedef struct _GLwDrawingAreaClassRec *GLwDrawingAreaWidgetClass;
+typedef struct _GLwDrawingAreaRec *GLwDrawingAreaWidget;
+
+extern WidgetClass glwDrawingAreaWidgetClass;
+
+#endif /* __GLX_MOTIF */
+
+/* Callback reasons */
+#ifdef __GLX_MOTIF
+#define GLwCR_EXPOSE XmCR_EXPOSE
+#define GLwCR_RESIZE XmCR_RESIZE
+#define GLwCR_INPUT XmCR_INPUT
+#else /* not __GLX_MOTIF */
+/* The same values as Motif, but don't use Motif constants */
+#define GLwCR_EXPOSE 38
+#define GLwCR_RESIZE 39
+#define GLwCR_INPUT 40
+#endif /* __GLX_MOTIF */
+
+#define GLwCR_GINIT 32135 /* Arbitrary number that should neverr clash*/
+
+typedef struct
+{
+ int reason;
+ XEvent *event;
+ Dimension width, height; /* for resize callback */
+} GLwDrawingAreaCallbackStruct;
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/* front ends to glXMakeCurrent and glXSwapBuffers */
+extern void GLwDrawingAreaMakeCurrent (Widget w, GLXContext ctx);
+extern void GLwDrawingAreaSwapBuffers (Widget w);
+
+#ifdef __GLX_MOTIF
+#ifdef _NO_PROTO
+extern Widget GLwCreateMDrawingArea ();
+#else /* _NO_PROTO */
+
+extern Widget GLwCreateMDrawingArea (Widget parent, char *name,
+ ArgList arglist, Cardinal argcount);
+#endif /* _NO_PROTO */
+
+#endif /* __GLX_MOTIF */
+
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* _GLwDrawA_h */
diff --git a/lib/libGLw/GLwDrawAP.h b/lib/libGLw/GLwDrawAP.h
new file mode 100644
index 000000000..a02ce642b
--- /dev/null
+++ b/lib/libGLw/GLwDrawAP.h
@@ -0,0 +1,127 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+/*
+** This file has been slightly modified from the original by Carlos A. M. dos
+** Santos <casantos@cpmet.ufpel.tche.br> for integration into XFree86 source
+** tree and for generating both Motif(TM) 1.2 and 2.x versions of the widgets
+** in the same library.
+*/
+/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glw/GLwDrawAP.h,v 1.2 2000/11/02 20:39:07 dawes Exp $ */
+
+#ifndef _GLwDrawAP_h
+#define _GLwDrawAP_h
+
+#ifdef __GLX_MOTIF
+# ifndef __GLX_INCLUDE_PRIMITIVE_P_H /* Used during library compilation */
+# include <Xm/PrimitiveP.h>
+# endif
+# include <GL/GLwMDrawA.h> /* includes IntrinsicP.h */
+#else
+# include <X11/IntrinsicP.h>
+# include <GL/GLwDrawA.h>
+#endif
+
+typedef struct _GLwDrawingAreaClassPart
+{
+ char* extension;
+} GLwDrawingAreaClassPart;
+
+#ifdef __GLX_MOTIF
+typedef struct _GLwMDrawingAreaClassRec {
+ CoreClassPart core_class;
+ XmPrimitiveClassPart primitive_class;
+ GLwDrawingAreaClassPart glwDrawingArea_class;
+} GLwMDrawingAreaClassRec;
+
+extern GLwMDrawingAreaClassRec glwMDrawingAreaClassRec;
+
+#else /* not __GLX_MOTIF */
+
+typedef struct _GLwDrawingAreaClassRec {
+ CoreClassPart core_class;
+ GLwDrawingAreaClassPart glwDrawingArea_class;
+} GLwDrawingAreaClassRec;
+
+extern GLwDrawingAreaClassRec glwDrawingAreaClassRec;
+#endif /* __GLX_MOTIF */
+
+typedef struct {
+ /* resources */
+ int * attribList;
+ XVisualInfo * visualInfo;
+ Boolean myList; /* TRUE if we malloced the attribList*/
+ Boolean myVisual; /* TRUE if we created the visualInfo*/
+ Boolean installColormap;
+ Boolean allocateBackground;
+ Boolean allocateOtherColors;
+ Boolean installBackground;
+ XtCallbackList ginitCallback;
+ XtCallbackList resizeCallback;
+ XtCallbackList exposeCallback;
+ XtCallbackList inputCallback;
+ /* specific attributes; add as we get new attributes */
+ int bufferSize;
+ int level;
+ Boolean rgba;
+ Boolean doublebuffer;
+ Boolean stereo;
+ int auxBuffers;
+ int redSize;
+ int greenSize;
+ int blueSize;
+ int alphaSize;
+ int depthSize;
+ int stencilSize;
+ int accumRedSize;
+ int accumGreenSize;
+ int accumBlueSize;
+ int accumAlphaSize;
+} GLwDrawingAreaPart;
+
+#ifdef __GLX_MOTIF
+typedef struct _GLwMDrawingAreaRec {
+ CorePart core;
+ XmPrimitivePart primitive;
+ GLwDrawingAreaPart glwDrawingArea;
+} GLwMDrawingAreaRec;
+#else /* not __GLX_MOTIF */
+typedef struct _GLwDrawingAreaRec {
+ CorePart core;
+ GLwDrawingAreaPart glwDrawingArea;
+} GLwDrawingAreaRec;
+#endif /* __GLX_MOTIF */
+
+#endif /* _GLwDrawP_h */
diff --git a/lib/libGLw/GLwM1DrawA.c b/lib/libGLw/GLwM1DrawA.c
new file mode 100644
index 000000000..4301c817f
--- /dev/null
+++ b/lib/libGLw/GLwM1DrawA.c
@@ -0,0 +1,55 @@
+/*
+ * (c) Copyright 1993, Silicon Graphics, Inc.
+ * ALL RIGHTS RESERVED
+ * Permission to use, copy, modify, and distribute this software for
+ * any purpose and without fee is hereby granted, provided that the above
+ * copyright notice appear in all copies and that both the copyright notice
+ * and this permission notice appear in supporting documentation, and that
+ * the name of Silicon Graphics, Inc. not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission.
+ *
+ * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
+ * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
+ * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+ * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
+ * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
+ * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
+ * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
+ * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
+ * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
+ * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ *
+ * US Government Users Restricted Rights
+ * Use, duplication, or disclosure by the Government is subject to
+ * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
+ * (c)(1)(ii) of the Rights in Technical Data and Computer Software
+ * clause at DFARS 252.227-7013 and/or in similar or successor
+ * clauses in the FAR or the DOD or NASA FAR Supplement.
+ * Unpublished-- rights reserved under the copyright laws of the
+ * United States. Contractor/manufacturer is Silicon Graphics,
+ * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
+ *
+ * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
+ */
+/* $XFree86$ */
+
+#define __GLX_MOTIF 1
+
+#define XmVERSION 1
+#define XmREVISION 2
+#define XmVersion (XmVERSION * 1000 + XmREVISION)
+#define XmVERSION_STRING "GLwDrawingArea fake M*tif 1.X"
+#define XmUPDATE_LEVEL 0
+
+/* Include our fake Motif headers */
+#include "GLwXm/Xm.h"
+#include "GLwXm/PrimitiveP.h"
+
+#define __GLX_INCLUDE_XM_H
+#define __GLX_INCLUDE_PRIMITIVE_P_H
+
+#include "GLwDrawA.c"
diff --git a/lib/libGLw/GLwM2DrawA.c b/lib/libGLw/GLwM2DrawA.c
new file mode 100644
index 000000000..bd93260f9
--- /dev/null
+++ b/lib/libGLw/GLwM2DrawA.c
@@ -0,0 +1,55 @@
+/*
+ * (c) Copyright 1993, Silicon Graphics, Inc.
+ * ALL RIGHTS RESERVED
+ * Permission to use, copy, modify, and distribute this software for
+ * any purpose and without fee is hereby granted, provided that the above
+ * copyright notice appear in all copies and that both the copyright notice
+ * and this permission notice appear in supporting documentation, and that
+ * the name of Silicon Graphics, Inc. not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission.
+ *
+ * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
+ * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
+ * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+ * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
+ * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
+ * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
+ * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
+ * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
+ * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
+ * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ *
+ * US Government Users Restricted Rights
+ * Use, duplication, or disclosure by the Government is subject to
+ * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
+ * (c)(1)(ii) of the Rights in Technical Data and Computer Software
+ * clause at DFARS 252.227-7013 and/or in similar or successor
+ * clauses in the FAR or the DOD or NASA FAR Supplement.
+ * Unpublished-- rights reserved under the copyright laws of the
+ * United States. Contractor/manufacturer is Silicon Graphics,
+ * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
+ *
+ * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
+ */
+/* $XFree86$ */
+
+#define __GLX_MOTIF 2
+
+#define XmVERSION 2
+#define XmREVISION 0
+#define XmVersion (XmVERSION * 1000 + XmREVISION)
+#define XmVERSION_STRING "GLwDrawingArea fake M*tif 2.X"
+#define XmUPDATE_LEVEL 0
+
+/* Include our fake Motif headers */
+#include "GLwXm/Xm.h"
+#include "GLwXm/PrimitiveP.h"
+
+#define __GLX_INCLUDE_XM_H
+#define __GLX_INCLUDE_PRIMITIVE_P_H
+
+#include "GLwDrawA.c"
diff --git a/lib/libGLw/GLwMDrawA.h b/lib/libGLw/GLwMDrawA.h
new file mode 100644
index 000000000..95e210adc
--- /dev/null
+++ b/lib/libGLw/GLwMDrawA.h
@@ -0,0 +1,47 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+/*
+** This file has been slightly modified from the original by Carlos A. M. dos
+** Santos <casantos@cpmet.ufpel.tche.br> for integration into XFree86 source
+** tree and for generating both Motif(TM) 1.2 and 2.x versions of the widgets
+** in the same library.
+*/
+/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawA.h,v 1.2 2000/11/02 20:39:07 dawes Exp $ */
+
+#ifndef __GLX_MOTIF
+#define __GLX_MOTIF 1
+#endif
+#include <GL/GLwDrawA.h>
diff --git a/lib/libGLw/GLwMDrawAP.h b/lib/libGLw/GLwMDrawAP.h
new file mode 100644
index 000000000..2ee3eed5a
--- /dev/null
+++ b/lib/libGLw/GLwMDrawAP.h
@@ -0,0 +1,47 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+*/
+
+/*
+** This file has been slightly modified from the original by Carlos A. M. dos
+** Santos <casantos@cpmet.ufpel.tche.br> for integration into XFree86 source
+** tree and for generating both Motif(TM) 1.2 and 2.x versions of the widgets
+** in the same library.
+*/
+/* $XFree86: xc/extras/ogl-sample/main/gfx/lib/glw/GLwMDrawAP.h,v 1.2 2000/11/02 20:39:07 dawes Exp $ */
+
+#ifndef __GLX_MOTIF
+#define __GLX_MOTIF 1
+#endif
+#include <GL/GLwDrawAP.h>
diff --git a/lib/libGLw/GLwXm/PrimitiveP.h b/lib/libGLw/GLwXm/PrimitiveP.h
new file mode 100644
index 000000000..d38d0d165
--- /dev/null
+++ b/lib/libGLw/GLwXm/PrimitiveP.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2000 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+/* $XFree86$ */
+
+/*
+ * This file is a fake Motif(TM) header intended to allow the compilation of
+ * libGLw without having a real Motif. Do not use this file to compile any
+ * application because it declares only a small subset of the API!
+ */
+
+#ifndef GLWXM_PRIMITIVE_P_H
+#define GLWXM_PRIMITIVE_P_H
+
+#include "GLwXm/XmP.h"
+
+/* primitive instance part */
+typedef struct {
+ Pixel foreground;
+ Dimension shadow_thickness;
+ Pixel top_shadow_color;
+ Pixmap top_shadow_pixmap;
+ Pixel bottom_shadow_color;
+ Pixmap bottom_shadow_pixmap;
+ Dimension highlight_thickness;
+ Pixel highlight_color;
+ Pixmap highlight_pixmap;
+ XtCallbackList help_callback;
+ XtPointer user_data;
+ Boolean traversal_on;
+ Boolean highlight_on_enter;
+ Boolean have_traversal;
+ unsigned char unit_type;
+ XmNavigationType navigation_type;
+ Boolean highlight_drawn;
+ Boolean highlighted;
+ GC highlight_GC;
+ GC top_shadow_GC;
+ GC bottom_shadow_GC;
+#if XmVERSION > 1
+ XtCallbackList convert_callback;
+ XtCallbackList popup_handler_callback;
+ XmDirection layout_direction;
+#endif
+} XmPrimitivePart;
+
+/* primitive class part */
+typedef struct {
+ XtWidgetProc border_highlight;
+ XtWidgetProc border_unhighlight;
+ String translations;
+ XtActionProc arm_and_activate;
+ XmSyntheticResource *syn_resources;
+ int num_syn_resources;
+ XtPointer extension;
+} XmPrimitiveClassPart;
+
+/* class record */
+typedef struct _XmPrimitiveClassRec {
+ CoreClassPart core_class;
+ XmPrimitiveClassPart primitive_class;
+} XmPrimitiveClassRec;
+
+/* declare class record */
+extern XmPrimitiveClassRec xmPrimitiveClassRec;
+
+#endif /* GLWXM_PRIMITIVE_P_H */
diff --git a/lib/libGLw/GLwXm/Xm.h b/lib/libGLw/GLwXm/Xm.h
new file mode 100644
index 000000000..f344eec50
--- /dev/null
+++ b/lib/libGLw/GLwXm/Xm.h
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2000 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+/* $XFree86$ */
+
+/*
+ * This file is a fake Motif(TM) header intended to allow the compilation of
+ * libGLw without having a real Motif. Do not use this file to compile any
+ * application because it declares only a small subset of the API!
+ */
+
+#ifndef GLWXM_H
+#define GLWXM_H
+
+#include <X11/Intrinsic.h>
+#include <X11/Shell.h>
+#include <X11/Xatom.h>
+#include "GLwXm/XmStrDefs.h"
+
+enum {
+ XmATTACH_NONE,
+ XmATTACH_FORM,
+ XmATTACH_OPPOSITE_FORM,
+ XmATTACH_WIDGET,
+ XmATTACH_OPPOSITE_WIDGET,
+ XmATTACH_POSITION,
+ XmATTACH_SELF
+};
+
+enum {
+ XmCR_NONE,
+ XmCR_HELP,
+ XmCR_VALUE_CHANGED,
+ XmCR_INCREMENT,
+ XmCR_DECREMENT,
+ XmCR_PAGE_INCREMENT,
+ XmCR_PAGE_DECREMENT,
+ XmCR_TO_TOP,
+ XmCR_TO_BOTTOM,
+ XmCR_DRAG,
+ XmCR_ACTIVATE,
+ XmCR_ARM,
+ XmCR_DISARM,
+ XmCR_DUMMY13,
+ XmCR_DUMMY14,
+ XmCR_DUMMY15,
+ XmCR_MAP,
+ XmCR_UNMAP,
+ XmCR_FOCUS,
+ XmCR_LOSING_FOCUS,
+ XmCR_MODIFYING_TEXT_VALUE,
+ XmCR_MOVING_INSERT_CURSOR,
+ XmCR_EXECUTE,
+ XmCR_SINGLE_SELECT,
+ XmCR_MULTIPLE_SELECT,
+ XmCR_EXTENDED_SELECT,
+ XmCR_BROWSE_SELECT,
+ XmCR_DEFAULT_ACTION,
+ XmCR_CLIPBOARD_DATA_REQUEST,
+ XmCR_CLIPBOARD_DATA_DELETE,
+ XmCR_CASCADING,
+ XmCR_OK,
+ XmCR_CANCEL,
+ XmCR_DUMMY33,
+ XmCR_APPLY,
+ XmCR_NO_MATCH,
+ XmCR_COMMAND_ENTERED,
+ XmCR_COMMAND_CHANGED,
+ XmCR_EXPOSE,
+ XmCR_RESIZE,
+ XmCR_INPUT,
+ XmCR_GAIN_PRIMARY,
+ XmCR_LOSE_PRIMARY,
+ XmCR_CREATE,
+ XmCR_TEAR_OFF_ACTIVATE,
+ XmCR_TEAR_OFF_DEACTIVATE,
+ XmCR_OBSCURED_TRAVERSAL,
+#if XmVERSION < 2
+ XmCR_PROTOCOLS
+#else
+ XmCR_FOCUS_MOVED,
+ XmCR_DUMMY48,
+ XmCR_DUMMY49,
+ XmCR_DUMMY50,
+ XmCR_DUMMY51,
+ XmCR_DUMMY52,
+ XmCR_DUMMY53,
+ XmCR_REPOST,
+ XmCR_COLLAPSED,
+ XmCR_EXPANDED,
+ XmCR_SELECT,
+ XmCR_DRAG_START,
+ XmCR_NO_FONT,
+ XmCR_NO_RENDITION,
+ XmCR_POST,
+ XmCR_SPIN_NEXT,
+ XmCR_SPIN_PRIOR,
+ XmCR_SPIN_FIRST,
+ XmCR_SPIN_LAST,
+ XmCR_PAGE_SCROLLER_INCREMENT,
+ XmCR_PAGE_SCROLLER_DECREMENT,
+ XmCR_MAJOR_TAB,
+ XmCR_MINOR_TAB,
+ XmCR_PROTOCOLS = 6666
+#endif
+};
+
+typedef unsigned char XmDirection;
+
+typedef struct {
+ int reason;
+ XEvent *event;
+ Window window;
+} XmDrawingAreaCallbackStruct;
+
+#define XmUNSPECIFIED_PIXMAP 2
+
+typedef unsigned char XmNavigationType;
+
+#endif /* GLWXM_H */
diff --git a/lib/libGLw/GLwXm/XmP.h b/lib/libGLw/GLwXm/XmP.h
new file mode 100644
index 000000000..d54cbc37f
--- /dev/null
+++ b/lib/libGLw/GLwXm/XmP.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2000 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+/* $XFree86$ */
+
+/*
+ * This file is a fake Motif(TM) header intended to allow the compilation of
+ * libGLw without having a real Motif. Do not use this file to compile any
+ * application because it declares only a small subset of the API!
+ */
+
+#ifndef GLWXM_P_H
+#define GLWXM_P_H
+
+#include "GLwXm/Xm.h"
+#include <X11/IntrinsicP.h>
+
+#define XmInheritBorderHighlight ((XtWidgetProc) _XtInherit)
+#define XmInheritBorderUnhighlight ((XtWidgetProc) _XtInherit)
+
+void _XmBackgroundColorDefault(Widget widget, int offset, XrmValue *value);
+void _XmForegroundColorDefault(Widget widget, int offset, XrmValue *value);
+void _XmHighlightColorDefault(Widget widget, int offset, XrmValue *value);
+void _XmPrimitiveHighlightPixmapDefault(Widget widget, int offset,
+ XrmValue *value);
+
+typedef enum {
+ XmSYNTHETIC_NONE,
+ XmSYNTHETIC_LOAD
+} XmImportOperator;
+
+typedef void (*XmExportProc)(Widget, int, XtArgVal *);
+
+typedef XmImportOperator (*XmImportProc)(Widget, int, XtArgVal*);
+
+typedef struct _XmSyntheticResource {
+ String resource_name;
+ Cardinal resource_size;
+ Cardinal resource_offset;
+ XmExportProc export_proc;
+ XmImportProc import_proc;
+} XmSyntheticResource;
+
+#endif /* GLWXM_P_H */
diff --git a/lib/libGLw/GLwXm/XmStrDefs.h b/lib/libGLw/GLwXm/XmStrDefs.h
new file mode 100644
index 000000000..1e42c5ec4
--- /dev/null
+++ b/lib/libGLw/GLwXm/XmStrDefs.h
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2000 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the XFree86 Project shall
+ * not be used in advertising or otherwise to promote the sale, use or other
+ * dealings in this Software without prior written authorization from the
+ * XFree86 Project.
+ */
+/* $XFree86$ */
+
+/*
+ * This file is a fake Motif(TM) header intended to allow the compilation of
+ * libGLw without having a real Motif. Do not use this file to compile any
+ * application because it declares only a small subset of the API!
+ */
+
+#ifndef GLWXM_STRDEFS_H
+#define GLWXM_STRDEFS_H
+
+#ifndef _XmConst
+#define _XmConst /**/
+#endif
+
+#ifdef XMSTRINGDEFINES
+
+#define XmCBackgroundPixmap "BackgroundPixmap"
+#define XmRBackgroundPixmap "BackgroundPixmap"
+#define XmRBooleanDimension "BooleanDimension"
+#define XmNbottomAttachment "bottomAttachment"
+#define XmNbottomWidget "bottomWidget"
+#define XmCForegroundThreshold "ForegroundThreshold"
+#define XmNforegroundThreshold "foregroundThreshold"
+#define XmCHighlightColor "HighlightColor"
+#define XmNhighlightColor "highlightColor"
+#define XmCHighlightOnEnter "HighlightOnEnter"
+#define XmNhighlightOnEnter "highlightOnEnter"
+#define XmCHighlightThickness "HighlightThickness"
+#define XmNhighlightThickness "highlightThickness"
+#define XmCHighlightPixmap "HighlightPixmap"
+#define XmNhighlightPixmap "highlightPixmap"
+#define XmRHighlightPixmap "HighlightPixmap"
+#define XmRHorizontalDimension "HorizontalDimension"
+#define XmNleftAttachment "leftAttachment"
+#define XmNrightAttachment "rightAttachment"
+#define XmRStringDirection "StringDirection"
+#define XmNtopAttachment "topAttachment"
+#define XmCTraversalOn "TraversalOn"
+#define XmNtraversalOn "traversalOn"
+#define XmRXmBackgroundPixmap "XmBackgroundPixmap"
+
+#else /* XMSTRINGDEFINES */
+
+extern _XmConst char _XmStrings[];
+
+#define XmCBackgroundPixmap ((char *)&_XmStrings[299])
+#define XmRBackgroundPixmap ((char *)&_XmStrings[10844])
+#define XmRBooleanDimension ((char *)&_XmStrings[10872])
+#define XmNbottomAttachment ((char *)&_XmStrings[5017])
+#define XmNbottomWidget ((char *)&_XmStrings[5099])
+#define XmCHighlightColor ((char *)&_XmStrings[1844])
+#define XmNhighlightColor ((char *)&_XmStrings[6996])
+#define XmCHighlightOnEnter ((char *)&_XmStrings[1859])
+#define XmNhighlightOnEnter ((char *)&_XmStrings[7011])
+#define XmCHighlightThickness ((char *)&_XmStrings[1892])
+#define XmNhighlightThickness ((char *)&_XmStrings[7044])
+#define XmCForegroundThreshold ((char *)&_XmStrings[1808])
+#define XmNforegroundThreshold ((char *)&_XmStrings[6914])
+#define XmCHighlightPixmap ((char *)&_XmStrings[1876])
+#define XmNhighlightPixmap ((char *)&_XmStrings[7028])
+#define XmRHighlightPixmap ((char *)&_XmStrings[11299])
+#define XmRHorizontalDimension ((char *)&_XmStrings[11315])
+#define XmNleftAttachment ((char *)&_XmStrings[7523])
+#define XmNrightAttachment ((char *)&_XmStrings[9077])
+#define XmRStringDirection ((char *)&_XmStrings[11981])
+#define XmNtopAttachment ((char *)&_XmStrings[10165])
+#define XmCTraversalOn ((char *)&_XmStrings[4318])
+#define XmNtraversalOn ((char *)&_XmStrings[10361])
+#define XmRXmBackgroundPixmap ((char *)&_XmStrings[12210])
+
+#endif /* XMSTRINGDEFINES */
+
+/* copy Xt constant definitions */
+#include <X11/StringDefs.h>
+
+#define XmCBackground XtCBackground
+#define XmNbackground XtNbackground
+#define XmNbackgroundPixmap XtNbackgroundPixmap
+#define XmCBoolean XtCBoolean
+#define XmRBoolean XtRBoolean
+#define XmRCallProc XtRCallProc
+#define XmCForeground XtCForeground
+#define XmNforeground XtNforeground
+#define XmRImmediate XtRImmediate
+#define XmRPixel XtRPixel
+#define XmCPixmap XtCPixmap
+#define XmNpixmap XtNpixmap
+#define XmRPixmap XtRPixmap
+#define XmRPrimHighlightPixmap XmRHighlightPixmap
+#define XmRString XtRString
+#define XmRStringArray XtRStringArray
+#define XmRStringTable XtRStringTable
+
+#endif /* GLWXM_STRDEFS_H */
diff --git a/lib/libGLw/Makefile b/lib/libGLw/Makefile
index 521d82807..6bc143ff4 100644
--- a/lib/libGLw/Makefile
+++ b/lib/libGLw/Makefile
@@ -1,17 +1,17 @@
-# $OpenBSD: Makefile,v 1.5 2007/04/07 15:37:50 matthieu Exp $
-
-DIST= ${.CURDIR}/../../dist/Mesa
-GLW= ${DIST}/src/glw
+# $OpenBSD: Makefile,v 1.6 2007/07/28 13:50:48 matthieu Exp $
DEBUG?=
LIB= GLw
-CPPFLAGS += -I${DIST}/include \
- -I${X11BASE}/include
+CPPFLAGS += -I${X11BASE}/include \
+ -I${.CURDIR} -DUSE_XM_STUBS
SRCS= \
- GLwDrawA.c
+ GLwDrawA.c \
+ GLwDAUtil.c \
+ GLwM1DrawA.c \
+ GLwM2DrawA.c
INCS= \
GLwDrawA.h \
@@ -22,7 +22,7 @@ INCS= \
obj: _xenocara_obj
includes:
- cd ${GLW}; for i in ${INCS}; do \
+ cd ${.CURDIR}; for i in ${INCS}; do \
j="cmp -s $$i ${DESTDIR}${INCSDIR}/GL/$$i || \
${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \
$$i ${DESTDIR}${INCSDIR}/GL"; \
@@ -37,4 +37,3 @@ NOPROFILE=
.include <bsd.lib.mk>
.include <bsd.xorg.mk>
-.PATH: ${GLW}
diff --git a/lib/libGLw/shlib_version b/lib/libGLw/shlib_version
index 3066b9771..900b4048a 100644
--- a/lib/libGLw/shlib_version
+++ b/lib/libGLw/shlib_version
@@ -1,2 +1,2 @@
major=5
-minor=0
+minor=1