aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/dmx
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-26 14:23:28 +0200
committermarha <marha@users.sourceforge.net>2012-03-26 14:23:28 +0200
commit76bcc36ed305418a3ddc5752d287ede894243e1b (patch)
treebacb320c825768471ce56f058f17ce863d592376 /xorg-server/hw/dmx
parent7d894e32566b710952c44cbc71939ad1d9e2fa8d (diff)
parent0f834b91a4768673833ab4917e87d86c237bb1a6 (diff)
downloadvcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.gz
vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.bz2
vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.zip
Merge remote-tracking branch 'origin/released'
Conflicts: pixman/pixman/pixman-mmx.c xorg-server/Xext/shm.c xorg-server/Xext/syncsrv.h xorg-server/Xext/xvmain.c xorg-server/Xi/exevents.c xorg-server/Xi/opendev.c xorg-server/composite/compalloc.c xorg-server/composite/compoverlay.c xorg-server/dix/colormap.c xorg-server/dix/devices.c xorg-server/dix/dispatch.c xorg-server/dix/dixfonts.c xorg-server/dix/eventconvert.c xorg-server/dix/events.c xorg-server/dix/gc.c xorg-server/dix/getevents.c xorg-server/dix/main.c xorg-server/dix/privates.c xorg-server/dix/registry.c xorg-server/dix/resource.c xorg-server/exa/exa_accel.c xorg-server/exa/exa_migration_classic.c xorg-server/exa/exa_unaccel.c xorg-server/fb/fb.h xorg-server/fb/fbcopy.c xorg-server/fb/fbpixmap.c xorg-server/glx/dispatch.h xorg-server/glx/glapi.h xorg-server/glx/glapi_gentable.c xorg-server/glx/glapitable.h xorg-server/glx/glprocs.h xorg-server/glx/glxcmds.c xorg-server/glx/glxcmdsswap.c xorg-server/glx/glxdricommon.c xorg-server/glx/glxdriswrast.c xorg-server/glx/glxext.c xorg-server/glx/indirect_dispatch.c xorg-server/glx/indirect_dispatch.h xorg-server/glx/indirect_dispatch_swap.c xorg-server/glx/indirect_size.h xorg-server/glx/indirect_size_get.h xorg-server/glx/indirect_table.c xorg-server/glx/indirect_util.c xorg-server/glx/rensize.c xorg-server/glx/single2swap.c xorg-server/glx/singlepix.c xorg-server/glx/singlepixswap.c xorg-server/glx/singlesize.c xorg-server/hw/dmx/dmxinit.c xorg-server/hw/kdrive/ephyr/ephyr.c xorg-server/hw/kdrive/ephyr/hostx.c xorg-server/hw/kdrive/ephyr/hostx.h xorg-server/hw/kdrive/src/kinput.c xorg-server/hw/xfree86/common/compiler.h xorg-server/hw/xwin/InitInput.c xorg-server/hw/xwin/InitOutput.c xorg-server/hw/xwin/ddraw.h xorg-server/hw/xwin/glx/glwrap.c xorg-server/hw/xwin/glx/indirect.c xorg-server/hw/xwin/glx/wgl_ext_api.h xorg-server/hw/xwin/glx/winpriv.c xorg-server/hw/xwin/win.h xorg-server/hw/xwin/winallpriv.c xorg-server/hw/xwin/winauth.c xorg-server/hw/xwin/winclipboard.h xorg-server/hw/xwin/winclipboardinit.c xorg-server/hw/xwin/winclipboardthread.c xorg-server/hw/xwin/winclipboardunicode.c xorg-server/hw/xwin/winclipboardwndproc.c xorg-server/hw/xwin/winclipboardwrappers.c xorg-server/hw/xwin/winclipboardxevents.c xorg-server/hw/xwin/wincmap.c xorg-server/hw/xwin/winconfig.c xorg-server/hw/xwin/wincreatewnd.c xorg-server/hw/xwin/wincursor.c xorg-server/hw/xwin/windialogs.c xorg-server/hw/xwin/winengine.c xorg-server/hw/xwin/winerror.c xorg-server/hw/xwin/wingc.c xorg-server/hw/xwin/wingetsp.c xorg-server/hw/xwin/winkeybd.c xorg-server/hw/xwin/winkeybd.h xorg-server/hw/xwin/winlayouts.h xorg-server/hw/xwin/winmisc.c xorg-server/hw/xwin/winmonitors.c xorg-server/hw/xwin/winmouse.c xorg-server/hw/xwin/winmsg.c xorg-server/hw/xwin/winmsg.h xorg-server/hw/xwin/winmultiwindowclass.c xorg-server/hw/xwin/winmultiwindowicons.c xorg-server/hw/xwin/winmultiwindowshape.c xorg-server/hw/xwin/winmultiwindowwindow.c xorg-server/hw/xwin/winmultiwindowwm.c xorg-server/hw/xwin/winmultiwindowwndproc.c xorg-server/hw/xwin/winnativegdi.c xorg-server/hw/xwin/winpfbdd.c xorg-server/hw/xwin/winpixmap.c xorg-server/hw/xwin/winpolyline.c xorg-server/hw/xwin/winprefs.c xorg-server/hw/xwin/winprocarg.c xorg-server/hw/xwin/winregistry.c xorg-server/hw/xwin/winscrinit.c xorg-server/hw/xwin/winsetsp.c xorg-server/hw/xwin/winshaddd.c xorg-server/hw/xwin/winshadddnl.c xorg-server/hw/xwin/winshadgdi.c xorg-server/hw/xwin/wintrayicon.c xorg-server/hw/xwin/winwin32rootless.c xorg-server/hw/xwin/winwin32rootlesswindow.c xorg-server/hw/xwin/winwin32rootlesswndproc.c xorg-server/hw/xwin/winwindow.c xorg-server/hw/xwin/winwindow.h xorg-server/hw/xwin/winwindowswm.c xorg-server/hw/xwin/winwndproc.c xorg-server/include/callback.h xorg-server/include/dixstruct.h xorg-server/include/misc.h xorg-server/include/os.h xorg-server/include/scrnintstr.h xorg-server/mi/micmap.c xorg-server/mi/miinitext.c xorg-server/mi/mioverlay.c xorg-server/mi/misprite.c xorg-server/mi/mivaltree.c xorg-server/mi/miwindow.c xorg-server/miext/damage/damage.c xorg-server/miext/rootless/rootlessGC.c xorg-server/miext/rootless/rootlessWindow.c xorg-server/os/WaitFor.c xorg-server/os/access.c xorg-server/os/connection.c xorg-server/os/io.c xorg-server/os/log.c xorg-server/os/osinit.c xorg-server/os/utils.c xorg-server/os/xdmcp.c xorg-server/os/xprintf.c xorg-server/os/xstrans.c xorg-server/render/mipict.c xorg-server/xkb/xkbActions.c xorg-server/xkb/xkbInit.c xorg-server/xkeyboard-config/compat/default.in
Diffstat (limited to 'xorg-server/hw/dmx')
-rw-r--r--xorg-server/hw/dmx/config/Canvas.c132
-rw-r--r--xorg-server/hw/dmx/config/dmxcompat.c160
-rw-r--r--xorg-server/hw/dmx/config/dmxconfig.c340
-rw-r--r--xorg-server/hw/dmx/config/dmxparse.c1295
-rw-r--r--xorg-server/hw/dmx/config/dmxparse.h329
-rw-r--r--xorg-server/hw/dmx/config/dmxprint.c373
-rw-r--r--xorg-server/hw/dmx/config/dmxtodmx.c7
-rw-r--r--xorg-server/hw/dmx/config/vdltodmx.c10
-rw-r--r--xorg-server/hw/dmx/config/xdmxconfig.c1263
-rw-r--r--xorg-server/hw/dmx/dmx.c782
-rw-r--r--xorg-server/hw/dmx/dmx_glxvisuals.c1202
-rw-r--r--xorg-server/hw/dmx/dmx_glxvisuals.h26
-rw-r--r--xorg-server/hw/dmx/dmxcb.c161
-rw-r--r--xorg-server/hw/dmx/dmxcmap.c434
-rw-r--r--xorg-server/hw/dmx/dmxcursor.c2012
-rw-r--r--xorg-server/hw/dmx/dmxdpms.c117
-rw-r--r--xorg-server/hw/dmx/dmxextension.c1770
-rw-r--r--xorg-server/hw/dmx/dmxextension.h99
-rw-r--r--xorg-server/hw/dmx/dmxfont.c1123
-rw-r--r--xorg-server/hw/dmx/dmxgc.c382
-rw-r--r--xorg-server/hw/dmx/dmxgcops.c476
-rw-r--r--xorg-server/hw/dmx/dmxinit.c850
-rw-r--r--xorg-server/hw/dmx/dmxinput.c27
-rw-r--r--xorg-server/hw/dmx/dmxinput.h78
-rw-r--r--xorg-server/hw/dmx/dmxlog.c310
-rw-r--r--xorg-server/hw/dmx/dmxpict.c2517
-rw-r--r--xorg-server/hw/dmx/dmxpict.h236
-rw-r--r--xorg-server/hw/dmx/dmxpixmap.c513
-rw-r--r--xorg-server/hw/dmx/dmxprop.c241
-rw-r--r--xorg-server/hw/dmx/dmxprop.h13
-rw-r--r--xorg-server/hw/dmx/dmxscrinit.c1047
-rw-r--r--xorg-server/hw/dmx/dmxshadow.c141
-rw-r--r--xorg-server/hw/dmx/dmxstat.c459
-rw-r--r--xorg-server/hw/dmx/dmxsync.c400
-rw-r--r--xorg-server/hw/dmx/dmxvisual.c82
-rw-r--r--xorg-server/hw/dmx/dmxwindow.c1019
-rw-r--r--xorg-server/hw/dmx/dmxwindow.h267
-rw-r--r--xorg-server/hw/dmx/examples/dmxaddinput.c20
-rw-r--r--xorg-server/hw/dmx/examples/dmxaddscreen.c61
-rw-r--r--xorg-server/hw/dmx/examples/dmxinfo.c129
-rw-r--r--xorg-server/hw/dmx/examples/dmxreconfig.c139
-rw-r--r--xorg-server/hw/dmx/examples/dmxresize.c27
-rw-r--r--xorg-server/hw/dmx/examples/dmxrminput.c13
-rw-r--r--xorg-server/hw/dmx/examples/dmxrmscreen.c15
-rw-r--r--xorg-server/hw/dmx/examples/dmxwininfo.c748
-rw-r--r--xorg-server/hw/dmx/examples/ev.c218
-rw-r--r--xorg-server/hw/dmx/examples/evi.c21
-rw-r--r--xorg-server/hw/dmx/examples/res.c32
-rw-r--r--xorg-server/hw/dmx/examples/xbell.c45
-rw-r--r--xorg-server/hw/dmx/examples/xinput.c215
-rw-r--r--xorg-server/hw/dmx/examples/xled.c28
-rw-r--r--xorg-server/hw/dmx/examples/xtest.c14
-rw-r--r--xorg-server/hw/dmx/glxProxy/compsize.c866
-rw-r--r--xorg-server/hw/dmx/glxProxy/g_disptab.c1128
-rw-r--r--xorg-server/hw/dmx/glxProxy/g_disptab.h1252
-rw-r--r--xorg-server/hw/dmx/glxProxy/g_renderswap.c2735
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxcmds.c4513
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxcmdsswap.c927
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxext.c1013
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxext.h149
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxfbconfig.c212
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxfbconfig.h5
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxscreens.c499
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxserver.h189
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxsingle.c1332
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxswap.c1100
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxutil.c71
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxutil.h83
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxvendor.c753
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxvendor.h27
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxvisuals.c310
-rw-r--r--xorg-server/hw/dmx/glxProxy/glxvisuals.h88
-rw-r--r--xorg-server/hw/dmx/glxProxy/render2swap.c219
-rw-r--r--xorg-server/hw/dmx/glxProxy/renderpixswap.c789
-rw-r--r--xorg-server/hw/dmx/input/ChkNotMaskEv.c68
-rw-r--r--xorg-server/hw/dmx/input/dmxarg.c69
-rw-r--r--xorg-server/hw/dmx/input/dmxbackend.c1281
-rw-r--r--xorg-server/hw/dmx/input/dmxcommon.c1367
-rw-r--r--xorg-server/hw/dmx/input/dmxconsole.c2119
-rw-r--r--xorg-server/hw/dmx/input/dmxdetach.c4
-rw-r--r--xorg-server/hw/dmx/input/dmxdummy.c50
-rw-r--r--xorg-server/hw/dmx/input/dmxevents.c412
-rw-r--r--xorg-server/hw/dmx/input/dmxinputinit.c829
-rw-r--r--xorg-server/hw/dmx/input/dmxinputinit.h575
-rw-r--r--xorg-server/hw/dmx/input/dmxmap.c28
-rw-r--r--xorg-server/hw/dmx/input/dmxmotion.c290
-rw-r--r--xorg-server/hw/dmx/input/dmxmotion.h11
-rw-r--r--xorg-server/hw/dmx/input/dmxsigio.c115
-rw-r--r--xorg-server/hw/dmx/input/dmxxinput.c151
-rw-r--r--xorg-server/hw/dmx/input/lnx-keyboard.c1116
-rw-r--r--xorg-server/hw/dmx/input/lnx-ms.c669
-rw-r--r--xorg-server/hw/dmx/input/lnx-ps2.c607
-rw-r--r--xorg-server/hw/dmx/input/usb-common.c331
-rw-r--r--xorg-server/hw/dmx/input/usb-common.h15
-rw-r--r--xorg-server/hw/dmx/input/usb-keyboard.c921
-rw-r--r--xorg-server/hw/dmx/input/usb-keyboard.h17
-rw-r--r--xorg-server/hw/dmx/input/usb-mouse.c67
-rw-r--r--xorg-server/hw/dmx/input/usb-mouse.h17
-rw-r--r--xorg-server/hw/dmx/input/usb-other.c85
-rw-r--r--xorg-server/hw/dmx/input/usb-other.h17
100 files changed, 27258 insertions, 24651 deletions
diff --git a/xorg-server/hw/dmx/config/Canvas.c b/xorg-server/hw/dmx/config/Canvas.c
index c2eba876a..34a47a2bf 100644
--- a/xorg-server/hw/dmx/config/Canvas.c
+++ b/xorg-server/hw/dmx/config/Canvas.c
@@ -60,100 +60,106 @@
#include <X11/StringDefs.h>
#include "CanvasP.h"
-static void CanvasInitialize(Widget request, Widget w,
- ArgList args, Cardinal *num_args)
+static void
+CanvasInitialize(Widget request, Widget w, ArgList args, Cardinal * num_args)
{
}
-static void CanvasExpose(Widget w, XEvent *event, Region region)
+static void
+CanvasExpose(Widget w, XEvent * event, Region region)
{
CanvasExposeDataRec data;
- data.w = w;
- data.event = event;
+ data.w = w;
+ data.event = event;
data.region = region;
-
- if (!XtIsRealized(w)) return;
- XtCallCallbacks(w, XtNcanvasExposeCallback, (XtPointer)&data);
+
+ if (!XtIsRealized(w))
+ return;
+ XtCallCallbacks(w, XtNcanvasExposeCallback, (XtPointer) & data);
}
-static void CanvasResize(Widget w)
+static void
+CanvasResize(Widget w)
{
- if (!XtIsRealized(w)) return;
- XtCallCallbacks(w, XtNcanvasResizeCallback, (XtPointer)w);
+ if (!XtIsRealized(w))
+ return;
+ XtCallCallbacks(w, XtNcanvasResizeCallback, (XtPointer) w);
}
-static void CanvasAction(Widget w, XEvent *event,
- String *params, Cardinal *num_params)
+static void
+CanvasAction(Widget w, XEvent * event, String * params, Cardinal * num_params)
{
- XtCallCallbacks(w, XtNcallback, (XtPointer)event);
+ XtCallCallbacks(w, XtNcallback, (XtPointer) event);
}
#define offset(field) XtOffsetOf(CanvasRec, canvas.field)
static XtResource resources[] = {
- { XtNcallback, XtCCallback, XtRCallback,
- sizeof(XtCallbackList), offset(input_callback), XtRCallback, NULL },
- { XtNcanvasExposeCallback, XtCcanvasExposeCallback, XtRCallback,
- sizeof(XtCallbackList), offset(expose_callback), XtRCallback, NULL },
- { XtNcanvasResizeCallback, XtCcanvasResizeCallback, XtRCallback,
- sizeof(XtCallbackList), offset(resize_callback), XtRCallback, NULL },
+ {XtNcallback, XtCCallback, XtRCallback,
+ sizeof(XtCallbackList), offset(input_callback), XtRCallback, NULL}
+ ,
+ {XtNcanvasExposeCallback, XtCcanvasExposeCallback, XtRCallback,
+ sizeof(XtCallbackList), offset(expose_callback), XtRCallback, NULL}
+ ,
+ {XtNcanvasResizeCallback, XtCcanvasResizeCallback, XtRCallback,
+ sizeof(XtCallbackList), offset(resize_callback), XtRCallback, NULL}
+ ,
};
+
#undef offset
-static XtActionsRec actions[] =
-{
- {"canvas", CanvasAction},
+static XtActionsRec actions[] = {
+ {"canvas", CanvasAction},
};
-static char translations[] =
-"<Key>: canvas()\n\
+static char translations[] = "<Key>: canvas()\n\
<Motion>: canvas()\n\
<BtnDown>: canvas()\n\
<BtnUp>: canvas()\n\
-"
-;
+";
#define Superclass (&widgetClassRec)
CanvasClassRec canvasClassRec = {
/* core */
{
- (WidgetClass)Superclass, /* superclass */
- "Canvas", /* class_name */
- sizeof(CanvasRec), /* widget_size */
- NULL, /* class_initialize */
- NULL, /* class_part_initialize */
- False, /* class_inited */
- CanvasInitialize, /* initialize */
- NULL, /* initialize_hook */
- XtInheritRealize, /* realize */
- actions, /* actions */
- XtNumber(actions), /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- NULL, /* destroy */
- CanvasResize, /* resize */
- CanvasExpose, /* expose */
- NULL, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- translations, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
+ (WidgetClass) Superclass, /* superclass */
+ "Canvas", /* class_name */
+ sizeof(CanvasRec), /* widget_size */
+ NULL, /* class_initialize */
+ NULL, /* class_part_initialize */
+ False, /* class_inited */
+ CanvasInitialize, /* initialize */
+ NULL, /* initialize_hook */
+ XtInheritRealize, /* realize */
+ actions, /* actions */
+ XtNumber(actions), /* num_actions */
+ resources, /* resources */
+ XtNumber(resources), /* num_resources */
+ NULLQUARK, /* xrm_class */
+ True, /* compress_motion */
+ True, /* compress_exposure */
+ True, /* compress_enterleave */
+ False, /* visible_interest */
+ NULL, /* destroy */
+ CanvasResize, /* resize */
+ CanvasExpose, /* expose */
+ NULL, /* set_values */
+ NULL, /* set_values_hook */
+ XtInheritSetValuesAlmost, /* set_values_almost */
+ NULL, /* get_values_hook */
+ NULL, /* accept_focus */
+ XtVersion, /* version */
+ NULL, /* callback_private */
+ translations, /* tm_table */
+ XtInheritQueryGeometry, /* query_geometry */
+ XtInheritDisplayAccelerator, /* display_accelerator */
+ NULL, /* extension */
+ }
+ ,
/* canvas */
{
- NULL, /* extension */
- }
+ NULL, /* extension */
+ }
};
-WidgetClass canvasWidgetClass = (WidgetClass)&canvasClassRec;
+WidgetClass canvasWidgetClass = (WidgetClass) & canvasClassRec;
diff --git a/xorg-server/hw/dmx/config/dmxcompat.c b/xorg-server/hw/dmx/config/dmxcompat.c
index 1c72084fa..bd9f12738 100644
--- a/xorg-server/hw/dmx/config/dmxcompat.c
+++ b/xorg-server/hw/dmx/config/dmxcompat.c
@@ -52,80 +52,84 @@
#include <string.h>
#include <ctype.h>
-static int dmxVDLReadLine(FILE *str, char *buf, int len)
+static int
+dmxVDLReadLine(FILE * str, char *buf, int len)
{
- if (fgets(buf, len, str)) return strlen(buf);
+ if (fgets(buf, len, str))
+ return strlen(buf);
return 0;
}
-static int dmxVDLCount(const char *buf)
+static int
+dmxVDLCount(const char *buf)
{
return strtol(buf, NULL, 10);
}
-static void dmxVDLVirtualEntry(const char *buf,
- char *name, int *len,
- int *x, int *y)
+static void
+dmxVDLVirtualEntry(const char *buf, char *name, int *len, int *x, int *y)
{
- char *end;
+ char *end;
const char *s;
- char *d;
- int start;
-
+ char *d;
+ int start;
+
*x = strtol(buf, &end, 10);
*y = strtol(end, &end, 10);
for (s = end, d = name, start = 1; *s && *s != '['; ++s) {
- if (start && isspace(*s)) continue;
- *d++ = *s;
+ if (start && isspace(*s))
+ continue;
+ *d++ = *s;
start = 0;
}
*d = '\0';
- while (d > name && isspace(d[-1])) *--d = '\0'; /* remove trailing space */
+ while (d > name && isspace(d[-1]))
+ *--d = '\0'; /* remove trailing space */
*len = strlen(name);
}
-static void dmxVDLDisplayEntry(const char *buf,
- char *name, int *len,
- int *x, int *y,
- int *xoff, int *yoff,
- int *xorig, int *yorig)
+static void
+dmxVDLDisplayEntry(const char *buf,
+ char *name, int *len,
+ int *x, int *y, int *xoff, int *yoff, int *xorig, int *yorig)
{
const char *pt;
- char *end;
-
- pt = strchr(buf, ' ');
- strlcpy(name, buf, 1+pt-buf);
- *len = strlen(name);
-
- *x = strtol(pt, &end, 10);
- *y = strtol(end, &end, 10);
+ char *end;
+
+ pt = strchr(buf, ' ');
+ strlcpy(name, buf, 1 + pt - buf);
+ *len = strlen(name);
+
+ *x = strtol(pt, &end, 10);
+ *y = strtol(end, &end, 10);
*xorig = strtol(end, &end, 10);
*yorig = strtol(end, &end, 10);
- *xoff = strtol(end, &end, 10);
- *yoff = strtol(end, NULL, 10);
+ *xoff = strtol(end, &end, 10);
+ *yoff = strtol(end, NULL, 10);
}
/** Read from the VDL format \a filename and return a newly allocated \a
* DMXConfigEntryPtr */
-DMXConfigEntryPtr dmxVDLRead(const char *filename)
+DMXConfigEntryPtr
+dmxVDLRead(const char *filename)
{
- FILE *str;
- char buf[2048]; /* RATS: Use ok */
- char *pt;
- int lineno = 0;
- DMXConfigEntryPtr entry = NULL;
+ FILE *str;
+ char buf[2048]; /* RATS: Use ok */
+ char *pt;
+ int lineno = 0;
+ DMXConfigEntryPtr entry = NULL;
DMXConfigVirtualPtr virtual = NULL;
- DMXConfigSubPtr sub = NULL;
+ DMXConfigSubPtr sub = NULL;
DMXConfigDisplayPtr display = NULL;
- DMXConfigFullDimPtr fdim = NULL;
- int vcount = 0;
- int dcount = 0;
- int icount = 0;
- int x, y, xoff, yoff, xorig, yorig;
- char name[2048]; /* RATS: Use ok */
- const char *tmp;
- int len;
+ DMXConfigFullDimPtr fdim = NULL;
+ int vcount = 0;
+ int dcount = 0;
+ int icount = 0;
+ int x, y, xoff, yoff, xorig, yorig;
+ char name[2048]; /* RATS: Use ok */
+ const char *tmp;
+ int len;
enum {
simulateFlag,
virtualCount,
@@ -134,15 +138,18 @@ DMXConfigEntryPtr dmxVDLRead(const char *filename)
displayEntry,
ignoreCount,
ignoreEntry
- } state = simulateFlag;
+ } state = simulateFlag;
- if (!filename) str = stdin;
- else str = fopen(filename, "r");
- if (!str) return NULL;
+ if (!filename)
+ str = stdin;
+ else
+ str = fopen(filename, "r");
+ if (!str)
+ return NULL;
while (dmxVDLReadLine(str, buf, sizeof(buf))) {
DMXConfigCommentPtr comment = NULL;
-
+
++lineno;
for (pt = buf; *pt; pt++)
if (*pt == '\r' || *pt == '\n') {
@@ -166,7 +173,7 @@ DMXConfigEntryPtr dmxVDLRead(const char *filename)
case virtualEntry:
len = sizeof(name);
dmxVDLVirtualEntry(buf, name, &len, &x, &y);
- tmp = dmxConfigCopyString(name, len);
+ tmp = dmxConfigCopyString(name, len);
virtual = dmxConfigCreateVirtual(NULL,
dmxConfigCreateString(T_STRING,
lineno,
@@ -186,41 +193,29 @@ DMXConfigEntryPtr dmxVDLRead(const char *filename)
case displayEntry:
dmxVDLDisplayEntry(buf, name, &len, &x, &y, &xoff, &yoff,
&xorig, &yorig);
- tmp = dmxConfigCopyString(name, len);
- fdim = dmxConfigCreateFullDim(
- dmxConfigCreatePartDim(
- dmxConfigCreatePair(T_DIMENSION,
- lineno,
- NULL,
- x, y, 0, 0),
- dmxConfigCreatePair(T_OFFSET,
- lineno,
- NULL,
- xoff, yoff,
- xoff, yoff)),
- NULL);
- display = dmxConfigCreateDisplay(NULL,
- dmxConfigCreateString(T_STRING,
- lineno,
- NULL,
- tmp),
- fdim,
- dmxConfigCreatePair(T_ORIGIN,
- lineno,
- NULL,
- xorig, yorig,
- 0, 0),
- NULL);
+ tmp = dmxConfigCopyString(name, len);
+ fdim =
+ dmxConfigCreateFullDim(dmxConfigCreatePartDim
+ (dmxConfigCreatePair
+ (T_DIMENSION, lineno, NULL, x, y, 0, 0),
+ dmxConfigCreatePair(T_OFFSET, lineno,
+ NULL, xoff, yoff,
+ xoff, yoff)), NULL);
+ display =
+ dmxConfigCreateDisplay(NULL,
+ dmxConfigCreateString(T_STRING, lineno,
+ NULL, tmp), fdim,
+ dmxConfigCreatePair(T_ORIGIN, lineno,
+ NULL, xorig, yorig,
+ 0, 0), NULL);
sub = dmxConfigAddSub(sub, dmxConfigSubDisplay(display));
if (!--dcount) {
- state = ignoreCount;
+ state = ignoreCount;
virtual->subentry = sub;
- entry = dmxConfigAddEntry(entry,
- dmxConfigVirtual,
- NULL,
- virtual);
- virtual = NULL;
- sub = NULL;
+ entry = dmxConfigAddEntry(entry,
+ dmxConfigVirtual, NULL, virtual);
+ virtual = NULL;
+ sub = NULL;
}
break;
case ignoreCount:
@@ -228,7 +223,8 @@ DMXConfigEntryPtr dmxVDLRead(const char *filename)
state = ignoreEntry;
break;
case ignoreEntry:
- if (!--icount) state = virtualEntry;
+ if (!--icount)
+ state = virtualEntry;
break;
}
}
diff --git a/xorg-server/hw/dmx/config/dmxconfig.c b/xorg-server/hw/dmx/config/dmxconfig.c
index a31e5f7f7..2cc9ab396 100644
--- a/xorg-server/hw/dmx/config/dmxconfig.c
+++ b/xorg-server/hw/dmx/config/dmxconfig.c
@@ -34,7 +34,6 @@
/** \file
* Provides interface for reading DMX configuration files and for
* combining that information with command-line configuration parameters. */
-
#ifdef HAVE_DMX_CONFIG_H
#include <dmx-config.h>
@@ -49,7 +48,7 @@
#include "dmxstat.h"
#include "parser.h"
-extern int yyparse(void);
+extern int yyparse(void);
extern FILE *yyin;
static char *dmxXkbRules;
@@ -60,35 +59,39 @@ static char *dmxXkbOptions;
/** Stores lists of configuration information. */
typedef struct DMXConfigListStruct {
- const char *name;
+ const char *name;
struct DMXConfigListStruct *next;
} DMXConfigList, *DMXConfigListPtr;
/** This stucture stores the parsed configuration information. */
typedef struct DMXConfigCmdStruct {
- const char *filename;
- const char *config;
+ const char *filename;
+ const char *config;
DMXConfigList *displays;
DMXConfigList *inputs;
DMXConfigList *xinputs;
} DMXConfigCmd, *DMXConfigCmdPtr;
-DMXConfigEntryPtr dmxConfigEntry;
-static DMXConfigCmd dmxConfigCmd;
+DMXConfigEntryPtr dmxConfigEntry;
+static DMXConfigCmd dmxConfigCmd;
static int dmxDisplaysFromCommandLine;
/** Make a note that \a display is the name of an X11 display that
* should be initialized as a backend (output) display. Called from
* #ddxProcessArgument. */
-void dmxConfigStoreDisplay(const char *display)
+void
+dmxConfigStoreDisplay(const char *display)
{
DMXConfigListPtr entry = malloc(sizeof(*entry));
+
entry->name = strdup(display);
entry->next = NULL;
- if (!dmxConfigCmd.displays) dmxConfigCmd.displays = entry;
+ if (!dmxConfigCmd.displays)
+ dmxConfigCmd.displays = entry;
else {
DMXConfigList *pt;
+
for (pt = dmxConfigCmd.displays; pt->next; pt = pt->next);
if (!pt)
dmxLog(dmxFatal, "dmxConfigStoreDisplay: end of list non-NULL\n");
@@ -99,14 +102,18 @@ void dmxConfigStoreDisplay(const char *display)
/** Make a note that \a input is the name of an X11 display that should
* be used for input (either a backend or a console input device). */
-void dmxConfigStoreInput(const char *input)
+void
+dmxConfigStoreInput(const char *input)
{
DMXConfigListPtr entry = malloc(sizeof(*entry));
+
entry->name = strdup(input);
entry->next = NULL;
- if (!dmxConfigCmd.inputs) dmxConfigCmd.inputs = entry;
+ if (!dmxConfigCmd.inputs)
+ dmxConfigCmd.inputs = entry;
else {
DMXConfigList *pt;
+
for (pt = dmxConfigCmd.inputs; pt->next; pt = pt->next);
if (!pt)
dmxLog(dmxFatal, "dmxConfigStoreInput: end of list non-NULL\n");
@@ -116,14 +123,18 @@ void dmxConfigStoreInput(const char *input)
/** Make a note that \a input is the name of an X11 display that should
* be used for input from XInput extension devices. */
-void dmxConfigStoreXInput(const char *input)
+void
+dmxConfigStoreXInput(const char *input)
{
DMXConfigListPtr entry = malloc(sizeof(*entry));
+
entry->name = strdup(input);
entry->next = NULL;
- if (!dmxConfigCmd.xinputs) dmxConfigCmd.xinputs = entry;
+ if (!dmxConfigCmd.xinputs)
+ dmxConfigCmd.xinputs = entry;
else {
DMXConfigList *pt;
+
for (pt = dmxConfigCmd.xinputs; pt->next; pt = pt->next);
if (!pt)
dmxLog(dmxFatal, "dmxConfigStoreXInput: end of list non-NULL\n");
@@ -132,7 +143,8 @@ void dmxConfigStoreXInput(const char *input)
}
/** Make a note that \a file is the configuration file. */
-void dmxConfigStoreFile(const char *file)
+void
+dmxConfigStoreFile(const char *file)
{
if (dmxConfigCmd.filename)
dmxLog(dmxFatal, "Only one -configfile allowed\n");
@@ -141,79 +153,89 @@ void dmxConfigStoreFile(const char *file)
/** Make a note that \a config should be used as the configuration for
* current instantiation of the DMX server. */
-void dmxConfigStoreConfig(const char *config)
+void
+dmxConfigStoreConfig(const char *config)
{
- if (dmxConfigCmd.config) dmxLog(dmxFatal, "Only one -config allowed\n");
+ if (dmxConfigCmd.config)
+ dmxLog(dmxFatal, "Only one -config allowed\n");
dmxConfigCmd.config = strdup(config);
}
-static int dmxConfigReadFile(const char *filename, int debug)
+static int
+dmxConfigReadFile(const char *filename, int debug)
{
FILE *str;
- if (!(str = fopen(filename, "r"))) return -1;
+ if (!(str = fopen(filename, "r")))
+ return -1;
dmxLog(dmxInfo, "Reading configuration file \"%s\"\n", filename);
- yyin = str;
+ yyin = str;
yydebug = debug;
yyparse();
fclose(str);
return 0;
}
-static const char *dmxConfigMatch(const char *target, DMXConfigEntryPtr entry)
+static const char *
+dmxConfigMatch(const char *target, DMXConfigEntryPtr entry)
{
- DMXConfigVirtualPtr v = entry->virtual;
- const char *name = NULL;
-
- if (v && v->name) name = v->name;
-
- if (v && !dmxConfigCmd.config) return v->name ? v->name : "<noname>";
- if (!name) return NULL;
- if (!strcmp(name, target)) return name;
+ DMXConfigVirtualPtr v = entry->virtual;
+ const char *name = NULL;
+
+ if (v && v->name)
+ name = v->name;
+
+ if (v && !dmxConfigCmd.config)
+ return v->name ? v->name : "<noname>";
+ if (!name)
+ return NULL;
+ if (!strcmp(name, target))
+ return name;
return NULL;
}
-static DMXScreenInfo *dmxConfigAddDisplay(const char *name,
- int scrnWidth, int scrnHeight,
- int scrnX, int scrnY,
- int scrnXSign, int scrnYSign,
- int rootWidth, int rootHeight,
- int rootX, int rootY,
- int rootXSign, int rootYSign)
+static DMXScreenInfo *
+dmxConfigAddDisplay(const char *name,
+ int scrnWidth, int scrnHeight,
+ int scrnX, int scrnY,
+ int scrnXSign, int scrnYSign,
+ int rootWidth, int rootHeight,
+ int rootX, int rootY, int rootXSign, int rootYSign)
{
DMXScreenInfo *dmxScreen;
-
+
if (!(dmxScreens = realloc(dmxScreens,
- (dmxNumScreens+1) * sizeof(*dmxScreens))))
+ (dmxNumScreens + 1) * sizeof(*dmxScreens))))
dmxLog(dmxFatal,
"dmxConfigAddDisplay: realloc failed for screen %d (%s)\n",
dmxNumScreens, name);
-
+
dmxScreen = &dmxScreens[dmxNumScreens];
memset(dmxScreen, 0, sizeof(*dmxScreen));
- dmxScreen->name = name;
- dmxScreen->index = dmxNumScreens;
- dmxScreen->scrnWidth = scrnWidth;
+ dmxScreen->name = name;
+ dmxScreen->index = dmxNumScreens;
+ dmxScreen->scrnWidth = scrnWidth;
dmxScreen->scrnHeight = scrnHeight;
- dmxScreen->scrnX = scrnX;
- dmxScreen->scrnY = scrnY;
- dmxScreen->scrnXSign = scrnXSign;
- dmxScreen->scrnYSign = scrnYSign;
- dmxScreen->rootWidth = rootWidth;
+ dmxScreen->scrnX = scrnX;
+ dmxScreen->scrnY = scrnY;
+ dmxScreen->scrnXSign = scrnXSign;
+ dmxScreen->scrnYSign = scrnYSign;
+ dmxScreen->rootWidth = rootWidth;
dmxScreen->rootHeight = rootHeight;
- dmxScreen->rootX = rootX;
- dmxScreen->rootY = rootY;
- dmxScreen->stat = dmxStatAlloc();
+ dmxScreen->rootX = rootX;
+ dmxScreen->rootY = rootY;
+ dmxScreen->stat = dmxStatAlloc();
++dmxNumScreens;
return dmxScreen;
}
-DMXInputInfo *dmxConfigAddInput(const char *name, int core)
+DMXInputInfo *
+dmxConfigAddInput(const char *name, int core)
{
DMXInputInfo *dmxInput;
if (!(dmxInputs = realloc(dmxInputs,
- (dmxNumInputs+1) * sizeof(*dmxInputs))))
+ (dmxNumInputs + 1) * sizeof(*dmxInputs))))
dmxLog(dmxFatal,
"dmxConfigAddInput: realloc failed for input %d (%s)\n",
dmxNumInputs, name);
@@ -221,71 +243,79 @@ DMXInputInfo *dmxConfigAddInput(const char *name, int core)
dmxInput = &dmxInputs[dmxNumInputs];
memset(dmxInput, 0, sizeof(*dmxInput));
- dmxInput->name = name;
+ dmxInput->name = name;
dmxInput->inputIdx = dmxNumInputs;
- dmxInput->scrnIdx = -1;
- dmxInput->core = core;
+ dmxInput->scrnIdx = -1;
+ dmxInput->core = core;
++dmxNumInputs;
return dmxInput;
}
-static void dmxConfigCopyFromDisplay(DMXConfigDisplayPtr d)
+static void
+dmxConfigCopyFromDisplay(DMXConfigDisplayPtr d)
{
DMXScreenInfo *dmxScreen;
- dmxScreen = dmxConfigAddDisplay(d->name,
- d->scrnWidth, d->scrnHeight,
- d->scrnX, d->scrnY,
- d->scrnXSign, d->scrnYSign,
- d->rootWidth, d->rootHeight,
- d->rootX, d->rootY,
- d->rootXSign, d->rootXSign);
- dmxScreen->where = PosAbsolute;
+ dmxScreen = dmxConfigAddDisplay(d->name,
+ d->scrnWidth, d->scrnHeight,
+ d->scrnX, d->scrnY,
+ d->scrnXSign, d->scrnYSign,
+ d->rootWidth, d->rootHeight,
+ d->rootX, d->rootY,
+ d->rootXSign, d->rootXSign);
+ dmxScreen->where = PosAbsolute;
dmxScreen->whereX = d->rootXOrigin;
dmxScreen->whereY = d->rootYOrigin;
}
-static void dmxConfigCopyFromWall(DMXConfigWallPtr w)
+static void
+dmxConfigCopyFromWall(DMXConfigWallPtr w)
{
DMXConfigStringPtr pt;
- DMXScreenInfo *dmxScreen;
- int edge = dmxNumScreens;
- int last = dmxNumScreens;
+ DMXScreenInfo *dmxScreen;
+ int edge = dmxNumScreens;
+ int last = dmxNumScreens;
- if (!w->xwall && !w->ywall) { /* Try to make it square */
+ if (!w->xwall && !w->ywall) { /* Try to make it square */
int count;
- for (pt = w->nameList, count = 0; pt; pt = pt->next) ++count;
+
+ for (pt = w->nameList, count = 0; pt; pt = pt->next)
+ ++count;
w->xwall = sqrt(count) + .5;
}
for (pt = w->nameList; pt; pt = pt->next) {
dmxScreen = dmxConfigAddDisplay(pt->string, w->width, w->height,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
- if (pt == w->nameList) { /* Upper left */
- dmxScreen->where = PosAbsolute;
+ if (pt == w->nameList) { /* Upper left */
+ dmxScreen->where = PosAbsolute;
dmxScreen->whereX = 0;
dmxScreen->whereY = 0;
- } else if (w->xwall) { /* Tile left to right, then top to bottom */
- if (!((dmxNumScreens-1) % w->xwall)) {
- dmxScreen->where = PosBelow;
+ }
+ else if (w->xwall) { /* Tile left to right, then top to bottom */
+ if (!((dmxNumScreens - 1) % w->xwall)) {
+ dmxScreen->where = PosBelow;
dmxScreen->whereRefScreen = edge;
- edge = dmxNumScreens-1;
- } else {
- dmxScreen->where = PosRightOf;
+ edge = dmxNumScreens - 1;
+ }
+ else {
+ dmxScreen->where = PosRightOf;
dmxScreen->whereRefScreen = last;
}
- } else { /* Tile top to bottom, then left to right */
- if (!((dmxNumScreens-1) % w->ywall)) {
- dmxScreen->where = PosRightOf;
+ }
+ else { /* Tile top to bottom, then left to right */
+ if (!((dmxNumScreens - 1) % w->ywall)) {
+ dmxScreen->where = PosRightOf;
dmxScreen->whereRefScreen = edge;
- edge = dmxNumScreens-1;
- } else {
- dmxScreen->where = PosBelow;
+ edge = dmxNumScreens - 1;
+ }
+ else {
+ dmxScreen->where = PosBelow;
dmxScreen->whereRefScreen = last;
}
}
- last = dmxNumScreens-1;
+ last = dmxNumScreens - 1;
if (dmxScreen->where == PosAbsolute)
dmxLog(dmxInfo, "Added %s at %d %d\n",
pt->string, dmxScreen->whereX, dmxScreen->whereY);
@@ -297,60 +327,79 @@ static void dmxConfigCopyFromWall(DMXConfigWallPtr w)
}
}
-static void dmxConfigCopyFromOption(DMXConfigOptionPtr o)
+static void
+dmxConfigCopyFromOption(DMXConfigOptionPtr o)
{
DMXConfigStringPtr pt;
- int argc = 0;
- char **argv = NULL;
+ int argc = 0;
+ char **argv = NULL;
- if (serverGeneration != 1) return; /* FIXME: only do once, for now */
- if (!o || !o->string) return;
+ if (serverGeneration != 1)
+ return; /* FIXME: only do once, for now */
+ if (!o || !o->string)
+ return;
for (pt = o->option; pt; pt = pt->next) {
if (pt->string) {
++argc;
- argv = realloc(argv, (argc+1) * sizeof(*argv));
- argv[argc] = (char *)pt->string;
+ argv = realloc(argv, (argc + 1) * sizeof(*argv));
+ argv[argc] = (char *) pt->string;
}
}
argv[0] = NULL;
- ProcessCommandLine(argc+1, argv);
+ ProcessCommandLine(argc + 1, argv);
free(argv);
}
-static void dmxConfigCopyFromParam(DMXConfigParamPtr p)
+static void
+dmxConfigCopyFromParam(DMXConfigParamPtr p)
{
const char **argv;
- int argc;
-
+ int argc;
+
if ((argv = dmxConfigLookupParam(p, "xkbrules", &argc)) && argc == 2) {
dmxConfigSetXkbRules(argv[1]);
- } else if ((argv = dmxConfigLookupParam(p, "xkbmodel", &argc))
- && argc == 2) {
+ }
+ else if ((argv = dmxConfigLookupParam(p, "xkbmodel", &argc))
+ && argc == 2) {
dmxConfigSetXkbModel(argv[1]);
- } else if ((argv = dmxConfigLookupParam(p, "xkblayout", &argc))
- && argc == 2) {
+ }
+ else if ((argv = dmxConfigLookupParam(p, "xkblayout", &argc))
+ && argc == 2) {
dmxConfigSetXkbLayout(argv[1]);
- } else if ((argv = dmxConfigLookupParam(p, "xkbvariant", &argc))
- && argc == 2) {
+ }
+ else if ((argv = dmxConfigLookupParam(p, "xkbvariant", &argc))
+ && argc == 2) {
dmxConfigSetXkbVariant(argv[1]);
- } else if ((argv = dmxConfigLookupParam(p, "xkboptions", &argc))
- && argc == 2) {
+ }
+ else if ((argv = dmxConfigLookupParam(p, "xkboptions", &argc))
+ && argc == 2) {
dmxConfigSetXkbOptions(argv[1]);
}
}
-static void dmxConfigCopyData(DMXConfigVirtualPtr v)
+static void
+dmxConfigCopyData(DMXConfigVirtualPtr v)
{
DMXConfigSubPtr sub;
-
- if (v->dim) dmxSetWidthHeight(v->dim->x, v->dim->y);
- else dmxSetWidthHeight(0, 0);
+
+ if (v->dim)
+ dmxSetWidthHeight(v->dim->x, v->dim->y);
+ else
+ dmxSetWidthHeight(0, 0);
for (sub = v->subentry; sub; sub = sub->next) {
switch (sub->type) {
- case dmxConfigDisplay: dmxConfigCopyFromDisplay(sub->display); break;
- case dmxConfigWall: dmxConfigCopyFromWall(sub->wall); break;
- case dmxConfigOption: dmxConfigCopyFromOption(sub->option); break;
- case dmxConfigParam: dmxConfigCopyFromParam(sub->param); break;
+ case dmxConfigDisplay:
+ dmxConfigCopyFromDisplay(sub->display);
+ break;
+ case dmxConfigWall:
+ dmxConfigCopyFromWall(sub->wall);
+ break;
+ case dmxConfigOption:
+ dmxConfigCopyFromOption(sub->option);
+ break;
+ case dmxConfigParam:
+ dmxConfigCopyFromParam(sub->param);
+ break;
default:
dmxLog(dmxFatal,
"dmxConfigCopyData: not a display, wall, or value\n");
@@ -358,25 +407,29 @@ static void dmxConfigCopyData(DMXConfigVirtualPtr v)
}
}
-static void dmxConfigFromCommandLine(void)
+static void
+dmxConfigFromCommandLine(void)
{
DMXConfigListPtr pt;
-
+
dmxLog(dmxInfo, "Using configuration from command line\n");
for (pt = dmxConfigCmd.displays; pt; pt = pt->next) {
DMXScreenInfo *dmxScreen = dmxConfigAddDisplay(pt->name,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0);
+
if (dmxNumScreens == 1) {
- dmxScreen->where = PosAbsolute;
+ dmxScreen->where = PosAbsolute;
dmxScreen->whereX = 0;
dmxScreen->whereY = 0;
dmxLog(dmxInfo, "Added %s at %d %d\n",
dmxScreen->name, dmxScreen->whereX, dmxScreen->whereY);
- } else {
- dmxScreen->where = PosRightOf;
+ }
+ else {
+ dmxScreen->where = PosRightOf;
dmxScreen->whereRefScreen = dmxNumScreens - 2;
- if (dmxScreen->whereRefScreen < 0) dmxScreen->whereRefScreen = 0;
+ if (dmxScreen->whereRefScreen < 0)
+ dmxScreen->whereRefScreen = 0;
dmxLog(dmxInfo, "Added %s %s %s\n",
dmxScreen->name,
dmxScreen->where == PosBelow ? "below" : "right of",
@@ -385,14 +438,16 @@ static void dmxConfigFromCommandLine(void)
}
}
-static void dmxConfigFromConfigFile(void)
+static void
+dmxConfigFromConfigFile(void)
{
DMXConfigEntryPtr pt;
- const char *name;
+ const char *name;
for (pt = dmxConfigEntry; pt; pt = pt->next) {
- /* FIXME -- if an input is specified, use it */
- if (pt->type != dmxConfigVirtual) continue;
+ /* FIXME -- if an input is specified, use it */
+ if (pt->type != dmxConfigVirtual)
+ continue;
if ((name = dmxConfigMatch(dmxConfigCmd.config, pt))) {
dmxLog(dmxInfo, "Using configuration \"%s\"\n", name);
dmxConfigCopyData(pt->virtual);
@@ -403,22 +458,26 @@ static void dmxConfigFromConfigFile(void)
dmxConfigCmd.config, dmxConfigCmd.filename);
}
-static void dmxConfigConfigInputs(void)
+static void
+dmxConfigConfigInputs(void)
{
DMXConfigListPtr pt;
- if (dmxNumInputs) return;
-
- if (dmxConfigCmd.inputs) { /* Use command line */
+ if (dmxNumInputs)
+ return;
+
+ if (dmxConfigCmd.inputs) { /* Use command line */
for (pt = dmxConfigCmd.inputs; pt; pt = pt->next)
dmxConfigAddInput(pt->name, TRUE);
- } else if (dmxNumScreens) { /* Use first display */
+ }
+ else if (dmxNumScreens) { /* Use first display */
dmxConfigAddInput(dmxScreens[0].name, TRUE);
- } else { /* Use dummy */
+ }
+ else { /* Use dummy */
dmxConfigAddInput("dummy", TRUE);
}
- if (dmxConfigCmd.xinputs) { /* Non-core devices from command line */
+ if (dmxConfigCmd.xinputs) { /* Non-core devices from command line */
for (pt = dmxConfigCmd.xinputs; pt; pt = pt->next)
dmxConfigAddInput(pt->name, FALSE);
}
@@ -427,7 +486,8 @@ static void dmxConfigConfigInputs(void)
/** Set up the appropriate global variables so that the DMX server will
* be initialized using the configuration specified in the config file
* and on the command line. */
-void dmxConfigConfigure(void)
+void
+dmxConfigConfigure(void)
{
if (dmxConfigEntry) {
dmxConfigFreeEntry(dmxConfigEntry);
@@ -440,7 +500,8 @@ void dmxConfigConfigure(void)
dmxConfigCmd.filename);
dmxConfigReadFile(dmxConfigCmd.filename, 0);
dmxConfigFromConfigFile();
- } else {
+ }
+ else {
if (dmxConfigCmd.config)
dmxLog(dmxWarning,
"Configuration name (%s) without configuration file\n",
@@ -454,11 +515,13 @@ void dmxConfigConfigure(void)
* sets MAXSCREENS to that value. This is difficult since the number
* depends on the command line (which is easy to count) or on the config
* file, which has to be parsed. */
-void dmxConfigSetMaxScreens(void)
+void
+dmxConfigSetMaxScreens(void)
{
static int processing = 0;
- if (processing) return; /* Prevent reentry via ProcessCommandLine */
+ if (processing)
+ return; /* Prevent reentry via ProcessCommandLine */
processing = 1;
if (dmxConfigCmd.filename) {
if (!dmxNumScreens)
@@ -466,7 +529,8 @@ void dmxConfigSetMaxScreens(void)
#ifndef MAXSCREENS
SetMaxScreens(dmxNumScreens);
#endif
- } else
+ }
+ else
#ifndef MAXSCREENS
SetMaxScreens(dmxDisplaysFromCommandLine);
#endif
@@ -490,8 +554,8 @@ void dmxConfigSetMaxScreens(void)
return (char *)(dmx##glob ? dmx##glob : def); \
}
-GEN(rules, XkbRules, XKB_DFLT_RULES)
-GEN(model, XkbModel, XKB_DFLT_MODEL)
-GEN(layout, XkbLayout, XKB_DFLT_LAYOUT)
-GEN(variant, XkbVariant, XKB_DFLT_VARIANT)
-GEN(options, XkbOptions, XKB_DFLT_OPTIONS)
+GEN(rules, XkbRules, XKB_DFLT_RULES)
+ GEN(model, XkbModel, XKB_DFLT_MODEL)
+ GEN(layout, XkbLayout, XKB_DFLT_LAYOUT)
+ GEN(variant, XkbVariant, XKB_DFLT_VARIANT)
+ GEN(options, XkbOptions, XKB_DFLT_OPTIONS)
diff --git a/xorg-server/hw/dmx/config/dmxparse.c b/xorg-server/hw/dmx/config/dmxparse.c
index f75151eac..cf510844d 100644
--- a/xorg-server/hw/dmx/config/dmxparse.c
+++ b/xorg-server/hw/dmx/config/dmxparse.c
@@ -1,607 +1,688 @@
-/*
- * Copyright 2002 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- *
- * This file provides support routines and helper functions to be used
- * by the DMX configuration file parser.
- *
- * Because the DMX configuration file parsing should be capable of being
- * used in a stand-alone fashion (i.e., independent from the DMX server
- * source tree), no dependencies on other DMX routines are made. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include "dmxparse.h"
-
-/** A general error logging routine that does not depend on the dmxLog
- * functions. */
-void dmxConfigLog(const char *format, ...)
-{
- va_list args;
-
- va_start(args, format);
- vprintf(format, args); /* RATS: All calls to dmxConfigLog from
- * dmxparse.c and dmxprint.c use a
- * trusted format. */
- va_end(args);
-}
-
-void *dmxConfigAlloc(unsigned long bytes)
-{
- void *area = calloc(1, bytes);
- if (!area) {
- dmxConfigLog("dmxConfigAlloc: out of memory\n");
- return NULL;
- }
- return area;
-}
-
-void *dmxConfigRealloc(void *orig, unsigned long orig_bytes,
- unsigned long bytes)
-{
- unsigned char *area = realloc(orig, bytes);
- if (!area) {
- dmxConfigLog("dmxConfigRealloc: out of memory\n");
- return NULL;
- }
- memset(area + orig_bytes, 0, bytes - orig_bytes);
- return area;
-}
-
-const char *dmxConfigCopyString(const char *string, int length)
-{
- char *copy;
-
- if (!length) length = strlen(string);
- copy = dmxConfigAlloc(length + 1);
- if (length) strncpy(copy, string, length);
- copy[length] = '\0';
- return copy;
-}
-
-void dmxConfigFree(void *area)
-{
- free(area);
-}
-
-DMXConfigTokenPtr dmxConfigCreateToken(int token, int line,
- const char *comment)
-{
- DMXConfigTokenPtr pToken = dmxConfigAlloc(sizeof(*pToken));
- pToken->token = token;
- pToken->line = line;
- pToken->comment = comment;
- return pToken;
-}
-
-void dmxConfigFreeToken(DMXConfigTokenPtr p)
-{
- if (!p) return;
- dmxConfigFree((void *)p->comment);
- dmxConfigFree(p);
-}
-
-DMXConfigStringPtr dmxConfigCreateString(int token, int line,
- const char *comment,
- const char *string)
-{
- DMXConfigStringPtr pString = dmxConfigAlloc(sizeof(*pString));
-
- pString->token = token;
- pString->line = line;
- pString->comment = comment;
- pString->string = string;
- return pString;
-}
-
-void dmxConfigFreeString(DMXConfigStringPtr p)
-{
- DMXConfigStringPtr next;
-
- if (!p) return;
- do {
- next = p->next;
- dmxConfigFree((void *)p->comment);
- dmxConfigFree((void *)p->string);
- dmxConfigFree(p);
- } while ((p = next));
-}
-
-DMXConfigNumberPtr dmxConfigCreateNumber(int token, int line,
- const char *comment,
- int number)
-{
- DMXConfigNumberPtr pNumber = dmxConfigAlloc(sizeof(*pNumber));
-
- pNumber->token = token;
- pNumber->line = line;
- pNumber->comment = comment;
- pNumber->number = number;
- return pNumber;
-}
-
-void dmxConfigFreeNumber(DMXConfigNumberPtr p)
-{
- if (!p) return;
- dmxConfigFree((void *)p->comment);
- dmxConfigFree(p);
-}
-
-DMXConfigPairPtr dmxConfigCreatePair(int token, int line,
- const char *comment,
- int x, int y,
- int xsign, int ysign)
-{
- DMXConfigPairPtr pPair = dmxConfigAlloc(sizeof(*pPair));
-
- pPair->token = token;
- pPair->line = line;
- pPair->comment = comment;
- pPair->x = x;
- pPair->y = y;
- pPair->xsign = (xsign < 0) ? -1 : 1;
- pPair->ysign = (ysign < 0) ? -1 : 1;
- return pPair;
-}
-
-void dmxConfigFreePair(DMXConfigPairPtr p)
-{
- if (!p) return;
- dmxConfigFree((void *)p->comment);
- dmxConfigFree(p);
-}
-
-DMXConfigCommentPtr dmxConfigCreateComment(int token, int line,
- const char *comment)
-{
- DMXConfigCommentPtr pComment = dmxConfigAlloc(sizeof(*pComment));
-
- pComment->token = token;
- pComment->line = line;
- pComment->comment = comment;
- return pComment;
-}
-
-void dmxConfigFreeComment(DMXConfigCommentPtr p)
-{
- if (!p) return;
- dmxConfigFree((void *)p->comment);
- dmxConfigFree(p);
-}
-
-DMXConfigPartDimPtr dmxConfigCreatePartDim(DMXConfigPairPtr pDim,
- DMXConfigPairPtr pOffset)
-{
- DMXConfigPartDimPtr pPart = dmxConfigAlloc(sizeof(*pPart));
- pPart->dim = pDim;
- pPart->offset = pOffset;
- return pPart;
-}
-
-void dmxConfigFreePartDim(DMXConfigPartDimPtr p)
-{
- if (!p) return;
- dmxConfigFreePair(p->dim);
- dmxConfigFreePair(p->offset);
- dmxConfigFree(p);
-}
-
-DMXConfigFullDimPtr dmxConfigCreateFullDim(DMXConfigPartDimPtr pScrn,
- DMXConfigPartDimPtr pRoot)
-{
- DMXConfigFullDimPtr pFull = dmxConfigAlloc(sizeof(*pFull));
- pFull->scrn = pScrn;
- pFull->root = pRoot;
- return pFull;
-}
-
-void dmxConfigFreeFullDim(DMXConfigFullDimPtr p)
-{
- if (!p) return;
- dmxConfigFreePartDim(p->scrn);
- dmxConfigFreePartDim(p->root);
- dmxConfigFree(p);
-}
-
-DMXConfigDisplayPtr dmxConfigCreateDisplay(DMXConfigTokenPtr pStart,
- DMXConfigStringPtr pName,
- DMXConfigFullDimPtr pDim,
- DMXConfigPairPtr pOrigin,
- DMXConfigTokenPtr pEnd)
-{
- DMXConfigDisplayPtr pDisplay = dmxConfigAlloc(sizeof(*pDisplay));
-
- pDisplay->start = pStart;
- pDisplay->dname = pName;
- pDisplay->dim = pDim;
- pDisplay->origin = pOrigin;
- pDisplay->end = pEnd;
-
- pDisplay->name = pName ? pName->string : NULL;
- pDisplay->rootXOrigin = pOrigin ? pOrigin->x : 0;
- pDisplay->rootYOrigin = pOrigin ? pOrigin->y : 0;
-
- if (pDim && pDim->scrn && pDim->scrn->dim) {
- pDisplay->scrnWidth = pDim->scrn->dim->x;
- pDisplay->scrnHeight = pDim->scrn->dim->y;
- }
- if (pDim && pDim->scrn && pDim->scrn->offset) {
- pDisplay->scrnX = pDim->scrn->offset->x;
- pDisplay->scrnY = pDim->scrn->offset->y;
- pDisplay->scrnXSign = pDim->scrn->offset->xsign;
- pDisplay->scrnYSign = pDim->scrn->offset->ysign;
- }
-
- if (pDim && pDim->root) {
- if (pDim->root->dim) {
- pDisplay->rootWidth = pDim->root->dim->x;
- pDisplay->rootHeight = pDim->root->dim->y;
- }
- if (pDim->root->offset) {
- pDisplay->rootX = pDim->root->offset->x;
- pDisplay->rootY = pDim->root->offset->y;
- pDisplay->rootXSign = pDim->root->offset->xsign;
- pDisplay->rootYSign = pDim->root->offset->ysign;
- }
- } else { /* If no root specification, copy width
- * and height from scrn -- leave offset
- * as zero, since it is relative to
- * scrn. */
- pDisplay->rootWidth = pDisplay->scrnWidth;
- pDisplay->rootHeight = pDisplay->scrnHeight;
- }
-
-
- return pDisplay;
-}
-
-void dmxConfigFreeDisplay(DMXConfigDisplayPtr p)
-{
- if (!p) return;
- dmxConfigFreeToken(p->start);
- dmxConfigFreeString(p->dname);
- dmxConfigFreeFullDim(p->dim);
- dmxConfigFreeToken(p->end);
- dmxConfigFree(p);
-}
-
-DMXConfigWallPtr dmxConfigCreateWall(DMXConfigTokenPtr pStart,
- DMXConfigPairPtr pWallDim,
- DMXConfigPairPtr pDisplayDim,
- DMXConfigStringPtr pNameList,
- DMXConfigTokenPtr pEnd)
-{
- DMXConfigWallPtr pWall = dmxConfigAlloc(sizeof(*pWall));
-
- pWall->start = pStart;
- pWall->wallDim = pWallDim;
- pWall->displayDim = pDisplayDim;
- pWall->nameList = pNameList;
- pWall->end = pEnd;
-
- pWall->width = pDisplayDim ? pDisplayDim->x : 0;
- pWall->height = pDisplayDim ? pDisplayDim->y : 0;
- pWall->xwall = pWallDim ? pWallDim->x : 0;
- pWall->ywall = pWallDim ? pWallDim->y : 0;
-
- return pWall;
-}
-
-void dmxConfigFreeWall(DMXConfigWallPtr p)
-{
- if (!p) return;
- dmxConfigFreeToken(p->start);
- dmxConfigFreePair(p->wallDim);
- dmxConfigFreePair(p->displayDim);
- dmxConfigFreeString(p->nameList);
- dmxConfigFreeToken(p->end);
- dmxConfigFree(p);
-}
-
-DMXConfigOptionPtr dmxConfigCreateOption(DMXConfigTokenPtr pStart,
- DMXConfigStringPtr pOption,
- DMXConfigTokenPtr pEnd)
-{
- int length = 0;
- int offset = 0;
- DMXConfigStringPtr p;
- DMXConfigOptionPtr option = dmxConfigAlloc(sizeof(*option));
-
- for (p = pOption; p; p = p->next) {
- if (p->string) length += strlen(p->string) + 1;
- }
-
- option->string = dmxConfigAlloc(length + 1);
-
- for (p = pOption; p; p = p->next) {
- if (p->string) {
- int len = strlen(p->string);
- strncpy(option->string + offset, p->string, len);
- offset += len;
- if (p->next) option->string[offset++] = ' ';
- }
- }
- option->string[offset] = '\0';
-
- option->start = pStart;
- option->option = pOption;
- option->end = pEnd;
-
- return option;
-}
-
-void dmxConfigFreeOption(DMXConfigOptionPtr p)
-{
- if (!p) return;
- free(p->string);
- dmxConfigFreeToken(p->start);
- dmxConfigFreeString(p->option);
- dmxConfigFreeToken(p->end);
- dmxConfigFree(p);
-}
-
-const char **dmxConfigLookupParam(DMXConfigParamPtr p, const char *key,
- int *argc)
-{
- DMXConfigParamPtr pt;
-
- for (pt = p; pt; pt = pt->next) {
- if (pt->argv && !strcasecmp(pt->argv[0], key)) {
- *argc = pt->argc;
- return pt->argv;
- }
- }
- *argc = 0;
- return NULL;
-}
-
-DMXConfigParamPtr dmxConfigCreateParam(DMXConfigTokenPtr pStart,
- DMXConfigTokenPtr pOpen,
- DMXConfigStringPtr pParam,
- DMXConfigTokenPtr pClose,
- DMXConfigTokenPtr pEnd)
-{
- DMXConfigParamPtr param = dmxConfigAlloc(sizeof(*param));
- DMXConfigStringPtr pt;
-
- param->argc = 0;
- param->argv = NULL;
- for (pt = pParam; pt; pt = pt->next) {
- if (pt->string) {
- param->argv = realloc(param->argv,
- (param->argc+2) * sizeof(*param->argv));
- param->argv[param->argc] = pt->string;
- ++param->argc;
- }
- }
- if (param->argv) param->argv[param->argc] = NULL;
-
- param->start = pStart;
- param->open = pOpen;
- param->param = pParam;
- param->close = pClose;
- param->end = pEnd;
-
- return param;
-}
-
-void dmxConfigFreeParam(DMXConfigParamPtr p)
-{
- DMXConfigParamPtr next;
-
- if (!p) return;
- do {
- next = p->next;
- dmxConfigFreeToken(p->start);
- dmxConfigFreeToken(p->open);
- dmxConfigFreeString(p->param);
- dmxConfigFreeToken(p->close);
- dmxConfigFreeToken(p->end);
- dmxConfigFree(p->argv);
- dmxConfigFree(p);
- } while ((p = next));
-}
-
-DMXConfigSubPtr dmxConfigCreateSub(DMXConfigType type,
- DMXConfigCommentPtr comment,
- DMXConfigDisplayPtr display,
- DMXConfigWallPtr wall,
- DMXConfigOptionPtr option,
- DMXConfigParamPtr param)
-{
- DMXConfigSubPtr pSub = dmxConfigAlloc(sizeof(*pSub));
- pSub->type = type;
- switch (type) {
- case dmxConfigComment: pSub->comment = comment; break;
- case dmxConfigDisplay: pSub->display = display; break;
- case dmxConfigWall: pSub->wall = wall; break;
- case dmxConfigOption: pSub->option = option; break;
- case dmxConfigParam: pSub->param = param; break;
- default: dmxConfigLog("Type %d not supported in subentry\n", type); break;
- }
- return pSub;
-}
-
-void dmxConfigFreeSub(DMXConfigSubPtr sub)
-{
- DMXConfigSubPtr pt;
-
- for (pt = sub; pt; pt = pt->next) {
- switch (pt->type) {
- case dmxConfigComment: dmxConfigFreeComment(pt->comment); break;
- case dmxConfigDisplay: dmxConfigFreeDisplay(pt->display); break;
- case dmxConfigWall: dmxConfigFreeWall(pt->wall); break;
- case dmxConfigOption: dmxConfigFreeOption(pt->option); break;
- case dmxConfigParam: dmxConfigFreeParam(pt->param); break;
- default:
- dmxConfigLog("Type %d not supported in subentry\n", pt->type);
- break;
- }
- }
- dmxConfigFree(sub);
-}
-
-DMXConfigSubPtr dmxConfigSubComment(DMXConfigCommentPtr comment)
-{
- return dmxConfigCreateSub(dmxConfigComment, comment, NULL, NULL, NULL,
- NULL);
-}
-
-DMXConfigSubPtr dmxConfigSubDisplay(DMXConfigDisplayPtr display)
-{
- return dmxConfigCreateSub(dmxConfigDisplay, NULL, display, NULL, NULL,
- NULL);
-}
-
-DMXConfigSubPtr dmxConfigSubWall(DMXConfigWallPtr wall)
-{
- return dmxConfigCreateSub(dmxConfigWall, NULL, NULL, wall, NULL, NULL);
-}
-
-DMXConfigSubPtr dmxConfigSubOption(DMXConfigOptionPtr option)
-{
- return dmxConfigCreateSub(dmxConfigOption, NULL, NULL, NULL, option, NULL);
-}
-
-DMXConfigSubPtr dmxConfigSubParam(DMXConfigParamPtr param)
-{
- return dmxConfigCreateSub(dmxConfigParam, NULL, NULL, NULL, NULL, param);
-}
-
-extern DMXConfigSubPtr dmxConfigAddSub(DMXConfigSubPtr head,
- DMXConfigSubPtr sub)
-{
- DMXConfigSubPtr pt;
-
- if (!head) return sub;
- for (pt = head; pt->next; pt = pt->next);
- pt->next = sub;
- return head;
-}
-
-DMXConfigVirtualPtr dmxConfigCreateVirtual(DMXConfigTokenPtr pStart,
- DMXConfigStringPtr pName,
- DMXConfigPairPtr pDim,
- DMXConfigTokenPtr pOpen,
- DMXConfigSubPtr pSubentry,
- DMXConfigTokenPtr pClose)
-{
- DMXConfigVirtualPtr pVirtual = dmxConfigAlloc(sizeof(*pVirtual));
-
- pVirtual->start = pStart;
- pVirtual->vname = pName;
- pVirtual->dim = pDim;
- pVirtual->open = pOpen;
- pVirtual->subentry = pSubentry;
- pVirtual->close = pClose;
-
- pVirtual->name = pName ? pName->string : NULL;
- pVirtual->width = pDim ? pDim->x : 0;
- pVirtual->height = pDim ? pDim->y : 0;
-
- return pVirtual;
-}
-
-void dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual)
-{
- dmxConfigFreeToken(virtual->start);
- dmxConfigFreeString(virtual->vname);
- dmxConfigFreePair(virtual->dim);
- dmxConfigFreeToken(virtual->open);
- dmxConfigFreeSub(virtual->subentry);
- dmxConfigFreeToken(virtual->close);
- dmxConfigFree(virtual);
-}
-
-DMXConfigEntryPtr dmxConfigCreateEntry(DMXConfigType type,
- DMXConfigCommentPtr comment,
- DMXConfigVirtualPtr virtual)
-{
- DMXConfigEntryPtr pEntry = dmxConfigAlloc(sizeof(*pEntry));
- pEntry->type = type;
- switch (type) {
- case dmxConfigComment: pEntry->comment = comment; break;
- case dmxConfigVirtual: pEntry->virtual = virtual; break;
- default: dmxConfigLog("Type %d not supported in entry\n", type); break;
- }
- return pEntry;
-}
-
-void dmxConfigFreeEntry(DMXConfigEntryPtr entry)
-{
- DMXConfigEntryPtr pt;
-
- for (pt = entry; pt; pt = pt->next) {
- switch (pt->type) {
- case dmxConfigComment: dmxConfigFreeComment(pt->comment); break;
- case dmxConfigVirtual: dmxConfigFreeVirtual(pt->virtual); break;
- default:
- dmxConfigLog("Type %d not supported in entry\n", pt->type);
- break;
- }
- }
- dmxConfigFree(entry);
-}
-
-DMXConfigEntryPtr dmxConfigAddEntry(DMXConfigEntryPtr head,
- DMXConfigType type,
- DMXConfigCommentPtr comment,
- DMXConfigVirtualPtr virtual)
-{
- DMXConfigEntryPtr child = dmxConfigCreateEntry(type, comment, virtual);
- DMXConfigEntryPtr pt;
-
- if (!head) return child;
-
- for (pt = head; pt->next; pt = pt->next);
- pt->next = child;
-
- return head;
-}
-
-DMXConfigEntryPtr dmxConfigEntryComment(DMXConfigCommentPtr comment)
-{
- return dmxConfigCreateEntry(dmxConfigComment, comment, NULL);
-}
-
-DMXConfigEntryPtr dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual)
-{
- return dmxConfigCreateEntry(dmxConfigVirtual, NULL, virtual);
-}
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This file provides support routines and helper functions to be used
+ * by the DMX configuration file parser.
+ *
+ * Because the DMX configuration file parsing should be capable of being
+ * used in a stand-alone fashion (i.e., independent from the DMX server
+ * source tree), no dependencies on other DMX routines are made. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include "dmxparse.h"
+
+/** A general error logging routine that does not depend on the dmxLog
+ * functions. */
+void
+dmxConfigLog(const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+ vprintf(format, args); /* RATS: All calls to dmxConfigLog from
+ * dmxparse.c and dmxprint.c use a
+ * trusted format. */
+ va_end(args);
+}
+
+void *
+dmxConfigAlloc(unsigned long bytes)
+{
+ void *area = calloc(1, bytes);
+
+ if (!area) {
+ dmxConfigLog("dmxConfigAlloc: out of memory\n");
+ return NULL;
+ }
+ return area;
+}
+
+void *
+dmxConfigRealloc(void *orig, unsigned long orig_bytes, unsigned long bytes)
+{
+ unsigned char *area = realloc(orig, bytes);
+
+ if (!area) {
+ dmxConfigLog("dmxConfigRealloc: out of memory\n");
+ return NULL;
+ }
+ memset(area + orig_bytes, 0, bytes - orig_bytes);
+ return area;
+}
+
+const char *
+dmxConfigCopyString(const char *string, int length)
+{
+ char *copy;
+
+ if (!length)
+ length = strlen(string);
+ copy = dmxConfigAlloc(length + 1);
+ if (length)
+ strncpy(copy, string, length);
+ copy[length] = '\0';
+ return copy;
+}
+
+void
+dmxConfigFree(void *area)
+{
+ free(area);
+}
+
+DMXConfigTokenPtr
+dmxConfigCreateToken(int token, int line, const char *comment)
+{
+ DMXConfigTokenPtr pToken = dmxConfigAlloc(sizeof(*pToken));
+
+ pToken->token = token;
+ pToken->line = line;
+ pToken->comment = comment;
+ return pToken;
+}
+
+void
+dmxConfigFreeToken(DMXConfigTokenPtr p)
+{
+ if (!p)
+ return;
+ dmxConfigFree((void *) p->comment);
+ dmxConfigFree(p);
+}
+
+DMXConfigStringPtr
+dmxConfigCreateString(int token, int line,
+ const char *comment, const char *string)
+{
+ DMXConfigStringPtr pString = dmxConfigAlloc(sizeof(*pString));
+
+ pString->token = token;
+ pString->line = line;
+ pString->comment = comment;
+ pString->string = string;
+ return pString;
+}
+
+void
+dmxConfigFreeString(DMXConfigStringPtr p)
+{
+ DMXConfigStringPtr next;
+
+ if (!p)
+ return;
+ do {
+ next = p->next;
+ dmxConfigFree((void *) p->comment);
+ dmxConfigFree((void *) p->string);
+ dmxConfigFree(p);
+ } while ((p = next));
+}
+
+DMXConfigNumberPtr
+dmxConfigCreateNumber(int token, int line, const char *comment, int number)
+{
+ DMXConfigNumberPtr pNumber = dmxConfigAlloc(sizeof(*pNumber));
+
+ pNumber->token = token;
+ pNumber->line = line;
+ pNumber->comment = comment;
+ pNumber->number = number;
+ return pNumber;
+}
+
+void
+dmxConfigFreeNumber(DMXConfigNumberPtr p)
+{
+ if (!p)
+ return;
+ dmxConfigFree((void *) p->comment);
+ dmxConfigFree(p);
+}
+
+DMXConfigPairPtr
+dmxConfigCreatePair(int token, int line,
+ const char *comment, int x, int y, int xsign, int ysign)
+{
+ DMXConfigPairPtr pPair = dmxConfigAlloc(sizeof(*pPair));
+
+ pPair->token = token;
+ pPair->line = line;
+ pPair->comment = comment;
+ pPair->x = x;
+ pPair->y = y;
+ pPair->xsign = (xsign < 0) ? -1 : 1;
+ pPair->ysign = (ysign < 0) ? -1 : 1;
+ return pPair;
+}
+
+void
+dmxConfigFreePair(DMXConfigPairPtr p)
+{
+ if (!p)
+ return;
+ dmxConfigFree((void *) p->comment);
+ dmxConfigFree(p);
+}
+
+DMXConfigCommentPtr
+dmxConfigCreateComment(int token, int line, const char *comment)
+{
+ DMXConfigCommentPtr pComment = dmxConfigAlloc(sizeof(*pComment));
+
+ pComment->token = token;
+ pComment->line = line;
+ pComment->comment = comment;
+ return pComment;
+}
+
+void
+dmxConfigFreeComment(DMXConfigCommentPtr p)
+{
+ if (!p)
+ return;
+ dmxConfigFree((void *) p->comment);
+ dmxConfigFree(p);
+}
+
+DMXConfigPartDimPtr
+dmxConfigCreatePartDim(DMXConfigPairPtr pDim, DMXConfigPairPtr pOffset)
+{
+ DMXConfigPartDimPtr pPart = dmxConfigAlloc(sizeof(*pPart));
+
+ pPart->dim = pDim;
+ pPart->offset = pOffset;
+ return pPart;
+}
+
+void
+dmxConfigFreePartDim(DMXConfigPartDimPtr p)
+{
+ if (!p)
+ return;
+ dmxConfigFreePair(p->dim);
+ dmxConfigFreePair(p->offset);
+ dmxConfigFree(p);
+}
+
+DMXConfigFullDimPtr
+dmxConfigCreateFullDim(DMXConfigPartDimPtr pScrn, DMXConfigPartDimPtr pRoot)
+{
+ DMXConfigFullDimPtr pFull = dmxConfigAlloc(sizeof(*pFull));
+
+ pFull->scrn = pScrn;
+ pFull->root = pRoot;
+ return pFull;
+}
+
+void
+dmxConfigFreeFullDim(DMXConfigFullDimPtr p)
+{
+ if (!p)
+ return;
+ dmxConfigFreePartDim(p->scrn);
+ dmxConfigFreePartDim(p->root);
+ dmxConfigFree(p);
+}
+
+DMXConfigDisplayPtr
+dmxConfigCreateDisplay(DMXConfigTokenPtr pStart,
+ DMXConfigStringPtr pName,
+ DMXConfigFullDimPtr pDim,
+ DMXConfigPairPtr pOrigin, DMXConfigTokenPtr pEnd)
+{
+ DMXConfigDisplayPtr pDisplay = dmxConfigAlloc(sizeof(*pDisplay));
+
+ pDisplay->start = pStart;
+ pDisplay->dname = pName;
+ pDisplay->dim = pDim;
+ pDisplay->origin = pOrigin;
+ pDisplay->end = pEnd;
+
+ pDisplay->name = pName ? pName->string : NULL;
+ pDisplay->rootXOrigin = pOrigin ? pOrigin->x : 0;
+ pDisplay->rootYOrigin = pOrigin ? pOrigin->y : 0;
+
+ if (pDim && pDim->scrn && pDim->scrn->dim) {
+ pDisplay->scrnWidth = pDim->scrn->dim->x;
+ pDisplay->scrnHeight = pDim->scrn->dim->y;
+ }
+ if (pDim && pDim->scrn && pDim->scrn->offset) {
+ pDisplay->scrnX = pDim->scrn->offset->x;
+ pDisplay->scrnY = pDim->scrn->offset->y;
+ pDisplay->scrnXSign = pDim->scrn->offset->xsign;
+ pDisplay->scrnYSign = pDim->scrn->offset->ysign;
+ }
+
+ if (pDim && pDim->root) {
+ if (pDim->root->dim) {
+ pDisplay->rootWidth = pDim->root->dim->x;
+ pDisplay->rootHeight = pDim->root->dim->y;
+ }
+ if (pDim->root->offset) {
+ pDisplay->rootX = pDim->root->offset->x;
+ pDisplay->rootY = pDim->root->offset->y;
+ pDisplay->rootXSign = pDim->root->offset->xsign;
+ pDisplay->rootYSign = pDim->root->offset->ysign;
+ }
+ }
+ else { /* If no root specification, copy width
+ * and height from scrn -- leave offset
+ * as zero, since it is relative to
+ * scrn. */
+ pDisplay->rootWidth = pDisplay->scrnWidth;
+ pDisplay->rootHeight = pDisplay->scrnHeight;
+ }
+
+ return pDisplay;
+}
+
+void
+dmxConfigFreeDisplay(DMXConfigDisplayPtr p)
+{
+ if (!p)
+ return;
+ dmxConfigFreeToken(p->start);
+ dmxConfigFreeString(p->dname);
+ dmxConfigFreeFullDim(p->dim);
+ dmxConfigFreeToken(p->end);
+ dmxConfigFree(p);
+}
+
+DMXConfigWallPtr
+dmxConfigCreateWall(DMXConfigTokenPtr pStart,
+ DMXConfigPairPtr pWallDim,
+ DMXConfigPairPtr pDisplayDim,
+ DMXConfigStringPtr pNameList, DMXConfigTokenPtr pEnd)
+{
+ DMXConfigWallPtr pWall = dmxConfigAlloc(sizeof(*pWall));
+
+ pWall->start = pStart;
+ pWall->wallDim = pWallDim;
+ pWall->displayDim = pDisplayDim;
+ pWall->nameList = pNameList;
+ pWall->end = pEnd;
+
+ pWall->width = pDisplayDim ? pDisplayDim->x : 0;
+ pWall->height = pDisplayDim ? pDisplayDim->y : 0;
+ pWall->xwall = pWallDim ? pWallDim->x : 0;
+ pWall->ywall = pWallDim ? pWallDim->y : 0;
+
+ return pWall;
+}
+
+void
+dmxConfigFreeWall(DMXConfigWallPtr p)
+{
+ if (!p)
+ return;
+ dmxConfigFreeToken(p->start);
+ dmxConfigFreePair(p->wallDim);
+ dmxConfigFreePair(p->displayDim);
+ dmxConfigFreeString(p->nameList);
+ dmxConfigFreeToken(p->end);
+ dmxConfigFree(p);
+}
+
+DMXConfigOptionPtr
+dmxConfigCreateOption(DMXConfigTokenPtr pStart,
+ DMXConfigStringPtr pOption, DMXConfigTokenPtr pEnd)
+{
+ int length = 0;
+ int offset = 0;
+ DMXConfigStringPtr p;
+ DMXConfigOptionPtr option = dmxConfigAlloc(sizeof(*option));
+
+ for (p = pOption; p; p = p->next) {
+ if (p->string)
+ length += strlen(p->string) + 1;
+ }
+
+ option->string = dmxConfigAlloc(length + 1);
+
+ for (p = pOption; p; p = p->next) {
+ if (p->string) {
+ int len = strlen(p->string);
+
+ strncpy(option->string + offset, p->string, len);
+ offset += len;
+ if (p->next)
+ option->string[offset++] = ' ';
+ }
+ }
+ option->string[offset] = '\0';
+
+ option->start = pStart;
+ option->option = pOption;
+ option->end = pEnd;
+
+ return option;
+}
+
+void
+dmxConfigFreeOption(DMXConfigOptionPtr p)
+{
+ if (!p)
+ return;
+ free(p->string);
+ dmxConfigFreeToken(p->start);
+ dmxConfigFreeString(p->option);
+ dmxConfigFreeToken(p->end);
+ dmxConfigFree(p);
+}
+
+const char **
+dmxConfigLookupParam(DMXConfigParamPtr p, const char *key, int *argc)
+{
+ DMXConfigParamPtr pt;
+
+ for (pt = p; pt; pt = pt->next) {
+ if (pt->argv && !strcasecmp(pt->argv[0], key)) {
+ *argc = pt->argc;
+ return pt->argv;
+ }
+ }
+ *argc = 0;
+ return NULL;
+}
+
+DMXConfigParamPtr
+dmxConfigCreateParam(DMXConfigTokenPtr pStart,
+ DMXConfigTokenPtr pOpen,
+ DMXConfigStringPtr pParam,
+ DMXConfigTokenPtr pClose, DMXConfigTokenPtr pEnd)
+{
+ DMXConfigParamPtr param = dmxConfigAlloc(sizeof(*param));
+ DMXConfigStringPtr pt;
+
+ param->argc = 0;
+ param->argv = NULL;
+ for (pt = pParam; pt; pt = pt->next) {
+ if (pt->string) {
+ param->argv = realloc(param->argv,
+ (param->argc + 2) * sizeof(*param->argv));
+ param->argv[param->argc] = pt->string;
+ ++param->argc;
+ }
+ }
+ if (param->argv)
+ param->argv[param->argc] = NULL;
+
+ param->start = pStart;
+ param->open = pOpen;
+ param->param = pParam;
+ param->close = pClose;
+ param->end = pEnd;
+
+ return param;
+}
+
+void
+dmxConfigFreeParam(DMXConfigParamPtr p)
+{
+ DMXConfigParamPtr next;
+
+ if (!p)
+ return;
+ do {
+ next = p->next;
+ dmxConfigFreeToken(p->start);
+ dmxConfigFreeToken(p->open);
+ dmxConfigFreeString(p->param);
+ dmxConfigFreeToken(p->close);
+ dmxConfigFreeToken(p->end);
+ dmxConfigFree(p->argv);
+ dmxConfigFree(p);
+ } while ((p = next));
+}
+
+DMXConfigSubPtr
+dmxConfigCreateSub(DMXConfigType type,
+ DMXConfigCommentPtr comment,
+ DMXConfigDisplayPtr display,
+ DMXConfigWallPtr wall,
+ DMXConfigOptionPtr option, DMXConfigParamPtr param)
+{
+ DMXConfigSubPtr pSub = dmxConfigAlloc(sizeof(*pSub));
+
+ pSub->type = type;
+ switch (type) {
+ case dmxConfigComment:
+ pSub->comment = comment;
+ break;
+ case dmxConfigDisplay:
+ pSub->display = display;
+ break;
+ case dmxConfigWall:
+ pSub->wall = wall;
+ break;
+ case dmxConfigOption:
+ pSub->option = option;
+ break;
+ case dmxConfigParam:
+ pSub->param = param;
+ break;
+ default:
+ dmxConfigLog("Type %d not supported in subentry\n", type);
+ break;
+ }
+ return pSub;
+}
+
+void
+dmxConfigFreeSub(DMXConfigSubPtr sub)
+{
+ DMXConfigSubPtr pt;
+
+ for (pt = sub; pt; pt = pt->next) {
+ switch (pt->type) {
+ case dmxConfigComment:
+ dmxConfigFreeComment(pt->comment);
+ break;
+ case dmxConfigDisplay:
+ dmxConfigFreeDisplay(pt->display);
+ break;
+ case dmxConfigWall:
+ dmxConfigFreeWall(pt->wall);
+ break;
+ case dmxConfigOption:
+ dmxConfigFreeOption(pt->option);
+ break;
+ case dmxConfigParam:
+ dmxConfigFreeParam(pt->param);
+ break;
+ default:
+ dmxConfigLog("Type %d not supported in subentry\n", pt->type);
+ break;
+ }
+ }
+ dmxConfigFree(sub);
+}
+
+DMXConfigSubPtr
+dmxConfigSubComment(DMXConfigCommentPtr comment)
+{
+ return dmxConfigCreateSub(dmxConfigComment, comment, NULL, NULL, NULL,
+ NULL);
+}
+
+DMXConfigSubPtr
+dmxConfigSubDisplay(DMXConfigDisplayPtr display)
+{
+ return dmxConfigCreateSub(dmxConfigDisplay, NULL, display, NULL, NULL,
+ NULL);
+}
+
+DMXConfigSubPtr
+dmxConfigSubWall(DMXConfigWallPtr wall)
+{
+ return dmxConfigCreateSub(dmxConfigWall, NULL, NULL, wall, NULL, NULL);
+}
+
+DMXConfigSubPtr
+dmxConfigSubOption(DMXConfigOptionPtr option)
+{
+ return dmxConfigCreateSub(dmxConfigOption, NULL, NULL, NULL, option, NULL);
+}
+
+DMXConfigSubPtr
+dmxConfigSubParam(DMXConfigParamPtr param)
+{
+ return dmxConfigCreateSub(dmxConfigParam, NULL, NULL, NULL, NULL, param);
+}
+
+extern DMXConfigSubPtr
+dmxConfigAddSub(DMXConfigSubPtr head, DMXConfigSubPtr sub)
+{
+ DMXConfigSubPtr pt;
+
+ if (!head)
+ return sub;
+ for (pt = head; pt->next; pt = pt->next);
+ pt->next = sub;
+ return head;
+}
+
+DMXConfigVirtualPtr
+dmxConfigCreateVirtual(DMXConfigTokenPtr pStart,
+ DMXConfigStringPtr pName,
+ DMXConfigPairPtr pDim,
+ DMXConfigTokenPtr pOpen,
+ DMXConfigSubPtr pSubentry, DMXConfigTokenPtr pClose)
+{
+ DMXConfigVirtualPtr pVirtual = dmxConfigAlloc(sizeof(*pVirtual));
+
+ pVirtual->start = pStart;
+ pVirtual->vname = pName;
+ pVirtual->dim = pDim;
+ pVirtual->open = pOpen;
+ pVirtual->subentry = pSubentry;
+ pVirtual->close = pClose;
+
+ pVirtual->name = pName ? pName->string : NULL;
+ pVirtual->width = pDim ? pDim->x : 0;
+ pVirtual->height = pDim ? pDim->y : 0;
+
+ return pVirtual;
+}
+
+void
+dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual)
+{
+ dmxConfigFreeToken(virtual->start);
+ dmxConfigFreeString(virtual->vname);
+ dmxConfigFreePair(virtual->dim);
+ dmxConfigFreeToken(virtual->open);
+ dmxConfigFreeSub(virtual->subentry);
+ dmxConfigFreeToken(virtual->close);
+ dmxConfigFree(virtual);
+}
+
+DMXConfigEntryPtr
+dmxConfigCreateEntry(DMXConfigType type,
+ DMXConfigCommentPtr comment, DMXConfigVirtualPtr virtual)
+{
+ DMXConfigEntryPtr pEntry = dmxConfigAlloc(sizeof(*pEntry));
+
+ pEntry->type = type;
+ switch (type) {
+ case dmxConfigComment:
+ pEntry->comment = comment;
+ break;
+ case dmxConfigVirtual:
+ pEntry->virtual = virtual;
+ break;
+ default:
+ dmxConfigLog("Type %d not supported in entry\n", type);
+ break;
+ }
+ return pEntry;
+}
+
+void
+dmxConfigFreeEntry(DMXConfigEntryPtr entry)
+{
+ DMXConfigEntryPtr pt;
+
+ for (pt = entry; pt; pt = pt->next) {
+ switch (pt->type) {
+ case dmxConfigComment:
+ dmxConfigFreeComment(pt->comment);
+ break;
+ case dmxConfigVirtual:
+ dmxConfigFreeVirtual(pt->virtual);
+ break;
+ default:
+ dmxConfigLog("Type %d not supported in entry\n", pt->type);
+ break;
+ }
+ }
+ dmxConfigFree(entry);
+}
+
+DMXConfigEntryPtr
+dmxConfigAddEntry(DMXConfigEntryPtr head,
+ DMXConfigType type,
+ DMXConfigCommentPtr comment, DMXConfigVirtualPtr virtual)
+{
+ DMXConfigEntryPtr child = dmxConfigCreateEntry(type, comment, virtual);
+ DMXConfigEntryPtr pt;
+
+ if (!head)
+ return child;
+
+ for (pt = head; pt->next; pt = pt->next);
+ pt->next = child;
+
+ return head;
+}
+
+DMXConfigEntryPtr
+dmxConfigEntryComment(DMXConfigCommentPtr comment)
+{
+ return dmxConfigCreateEntry(dmxConfigComment, comment, NULL);
+}
+
+DMXConfigEntryPtr
+dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual)
+{
+ return dmxConfigCreateEntry(dmxConfigVirtual, NULL, virtual);
+}
diff --git a/xorg-server/hw/dmx/config/dmxparse.h b/xorg-server/hw/dmx/config/dmxparse.h
index de81d23b7..7d31b6309 100644
--- a/xorg-server/hw/dmx/config/dmxparse.h
+++ b/xorg-server/hw/dmx/config/dmxparse.h
@@ -41,44 +41,44 @@
/** Stores tokens not stored in other structures (e.g., keywords and ;) */
typedef struct _DMXConfigToken {
- int token;
- int line;
- const char *comment;
+ int token;
+ int line;
+ const char *comment;
} DMXConfigToken, *DMXConfigTokenPtr;
/** Stores parsed strings. */
typedef struct _DMXConfigString {
- int token;
- int line;
- const char *comment;
- const char *string;
- struct _DMXConfigString *next;
+ int token;
+ int line;
+ const char *comment;
+ const char *string;
+ struct _DMXConfigString *next;
} DMXConfigString, *DMXConfigStringPtr;
/** Stores parsed numbers. */
typedef struct _DMXConfigNumber {
- int token;
- int line;
- const char *comment;
- int number;
+ int token;
+ int line;
+ const char *comment;
+ int number;
} DMXConfigNumber, *DMXConfigNumberPtr;
/** Stores parsed pairs (e.g., x y) */
typedef struct _DMXConfigPair {
- int token;
- int line;
- const char *comment;
- int x;
- int y;
- int xsign;
- int ysign;
+ int token;
+ int line;
+ const char *comment;
+ int x;
+ int y;
+ int xsign;
+ int ysign;
} DMXConfigPair, *DMXConfigPairPtr;
/** Stores parsed comments not stored with a token. */
typedef struct _DMXConfigComment {
- int token;
- int line;
- const char *comment;
+ int token;
+ int line;
+ const char *comment;
} DMXConfigComment, *DMXConfigCommentPtr;
typedef enum {
@@ -92,206 +92,201 @@ typedef enum {
/** Stores a geometry specification. */
typedef struct _DMXConfigPartDim {
- DMXConfigPairPtr dim;
- DMXConfigPairPtr offset;
+ DMXConfigPairPtr dim;
+ DMXConfigPairPtr offset;
} DMXConfigPartDim, *DMXConfigPartDimPtr;
/** Stores a pair of geometry specifications. */
typedef struct _DMXConfigFullDim {
- DMXConfigPartDimPtr scrn;
- DMXConfigPartDimPtr root;
+ DMXConfigPartDimPtr scrn;
+ DMXConfigPartDimPtr root;
} DMXConfigFullDim, *DMXConfigFullDimPtr;
/** Stores parsed display information. */
typedef struct _DMXConfigDisplay {
- /* Summary information */
- const char *name;
- /* Screen Window Geometry */
- int scrnWidth, scrnHeight;
- int scrnX, scrnY;
- int scrnXSign, scrnYSign;
- /* Root Window Geometry */
- int rootWidth, rootHeight;
- int rootX, rootY;
- int rootXSign, rootYSign;
- /* Origin in global space */
- int rootXOrigin, rootYOrigin;
-
- /* Raw configuration information */
- DMXConfigTokenPtr start;
- DMXConfigStringPtr dname;
- DMXConfigFullDimPtr dim;
- DMXConfigPairPtr origin;
- DMXConfigTokenPtr end;
+ /* Summary information */
+ const char *name;
+ /* Screen Window Geometry */
+ int scrnWidth, scrnHeight;
+ int scrnX, scrnY;
+ int scrnXSign, scrnYSign;
+ /* Root Window Geometry */
+ int rootWidth, rootHeight;
+ int rootX, rootY;
+ int rootXSign, rootYSign;
+ /* Origin in global space */
+ int rootXOrigin, rootYOrigin;
+
+ /* Raw configuration information */
+ DMXConfigTokenPtr start;
+ DMXConfigStringPtr dname;
+ DMXConfigFullDimPtr dim;
+ DMXConfigPairPtr origin;
+ DMXConfigTokenPtr end;
} DMXConfigDisplay, *DMXConfigDisplayPtr;
/** Stores parsed wall information. */
typedef struct _DMXConfigWall {
- /* Summary information */
- int width, height; /* dimensions of displays */
- int xwall, ywall; /* dimensions of wall, in tiles */
+ /* Summary information */
+ int width, height; /* dimensions of displays */
+ int xwall, ywall; /* dimensions of wall, in tiles */
-
- /* Raw configuration informaiton */
- DMXConfigTokenPtr start;
- DMXConfigPairPtr wallDim;
- DMXConfigPairPtr displayDim;
- DMXConfigStringPtr nameList;
- DMXConfigTokenPtr end;
+ /* Raw configuration informaiton */
+ DMXConfigTokenPtr start;
+ DMXConfigPairPtr wallDim;
+ DMXConfigPairPtr displayDim;
+ DMXConfigStringPtr nameList;
+ DMXConfigTokenPtr end;
} DMXConfigWall, *DMXConfigWallPtr;
/** Stores parsed option information. */
typedef struct _DMXConfigOption {
- /* Summary information */
- char *string;
-
- /* Raw configuration informaiton */
- DMXConfigTokenPtr start;
- DMXConfigStringPtr option;
- DMXConfigTokenPtr end;
+ /* Summary information */
+ char *string;
+
+ /* Raw configuration informaiton */
+ DMXConfigTokenPtr start;
+ DMXConfigStringPtr option;
+ DMXConfigTokenPtr end;
} DMXConfigOption, *DMXConfigOptionPtr;
/** Stores parsed param information. */
typedef struct _DMXConfigParam {
- int argc;
- const char **argv;
-
- DMXConfigTokenPtr start;
- DMXConfigTokenPtr open;
- DMXConfigStringPtr param;
- DMXConfigTokenPtr close;
- DMXConfigTokenPtr end; /* Either open/close OR end */
- struct _DMXConfigParam *next;
+ int argc;
+ const char **argv;
+
+ DMXConfigTokenPtr start;
+ DMXConfigTokenPtr open;
+ DMXConfigStringPtr param;
+ DMXConfigTokenPtr close;
+ DMXConfigTokenPtr end; /* Either open/close OR end */
+ struct _DMXConfigParam *next;
} DMXConfigParam, *DMXConfigParamPtr;
/** Stores options under an entry (subentry). */
typedef struct _DMXConfigSub {
- DMXConfigType type;
- DMXConfigCommentPtr comment;
- DMXConfigDisplayPtr display;
- DMXConfigWallPtr wall;
- DMXConfigOptionPtr option;
- DMXConfigParamPtr param;
- struct _DMXConfigSub *next;
+ DMXConfigType type;
+ DMXConfigCommentPtr comment;
+ DMXConfigDisplayPtr display;
+ DMXConfigWallPtr wall;
+ DMXConfigOptionPtr option;
+ DMXConfigParamPtr param;
+ struct _DMXConfigSub *next;
} DMXConfigSub, *DMXConfigSubPtr;
/** Stores parsed virtual information. */
typedef struct _DMXConfigVirtual {
- /* Summary information */
- const char *name;
- int width, height;
+ /* Summary information */
+ const char *name;
+ int width, height;
- /* Raw configuration information */
- DMXConfigTokenPtr start;
- DMXConfigStringPtr vname;
- DMXConfigPairPtr dim;
- DMXConfigTokenPtr open;
- DMXConfigSubPtr subentry;
- DMXConfigTokenPtr close;
+ /* Raw configuration information */
+ DMXConfigTokenPtr start;
+ DMXConfigStringPtr vname;
+ DMXConfigPairPtr dim;
+ DMXConfigTokenPtr open;
+ DMXConfigSubPtr subentry;
+ DMXConfigTokenPtr close;
} DMXConfigVirtual, *DMXConfigVirtualPtr;
/** Heads entry storage. */
typedef struct _DMXConfigEntry {
- DMXConfigType type;
- DMXConfigCommentPtr comment;
- DMXConfigVirtualPtr virtual;
- struct _DMXConfigEntry *next;
+ DMXConfigType type;
+ DMXConfigCommentPtr comment;
+ DMXConfigVirtualPtr virtual;
+ struct _DMXConfigEntry *next;
} DMXConfigEntry, *DMXConfigEntryPtr;
-extern DMXConfigEntryPtr dmxConfigEntry;
+extern DMXConfigEntryPtr dmxConfigEntry;
-extern int yylex(void);
-extern int yydebug;
-extern void yyerror(const char *message);
+extern int yylex(void);
+extern int yydebug;
+extern void yyerror(const char *message);
-extern void dmxConfigLog(const char *format, ...);
-extern void *dmxConfigAlloc(unsigned long bytes);
-extern void *dmxConfigRealloc(void *orig,
- unsigned long orig_bytes,
- unsigned long bytes);
-extern const char *dmxConfigCopyString(const char *string,
- int length);
-extern void dmxConfigFree(void *area);
-extern DMXConfigTokenPtr dmxConfigCreateToken(int token, int line,
- const char *comment);
-extern void dmxConfigFreeToken(DMXConfigTokenPtr p);
-extern DMXConfigStringPtr dmxConfigCreateString(int token, int line,
- const char *comment,
- const char *string);
-extern void dmxConfigFreeString(DMXConfigStringPtr p);
-extern DMXConfigNumberPtr dmxConfigCreateNumber(int token, int line,
- const char *comment,
- int number);
-extern void dmxConfigFreeNumber(DMXConfigNumberPtr p);
-extern DMXConfigPairPtr dmxConfigCreatePair(int token, int line,
- const char *comment,
- int x, int y,
- int xsign, int ysign);
-extern void dmxConfigFreePair(DMXConfigPairPtr p);
+extern void dmxConfigLog(const char *format, ...);
+extern void *dmxConfigAlloc(unsigned long bytes);
+extern void *dmxConfigRealloc(void *orig,
+ unsigned long orig_bytes, unsigned long bytes);
+extern const char *dmxConfigCopyString(const char *string, int length);
+extern void dmxConfigFree(void *area);
+extern DMXConfigTokenPtr dmxConfigCreateToken(int token, int line,
+ const char *comment);
+extern void dmxConfigFreeToken(DMXConfigTokenPtr p);
+extern DMXConfigStringPtr dmxConfigCreateString(int token, int line,
+ const char *comment,
+ const char *string);
+extern void dmxConfigFreeString(DMXConfigStringPtr p);
+extern DMXConfigNumberPtr dmxConfigCreateNumber(int token, int line,
+ const char *comment,
+ int number);
+extern void dmxConfigFreeNumber(DMXConfigNumberPtr p);
+extern DMXConfigPairPtr dmxConfigCreatePair(int token, int line,
+ const char *comment,
+ int x, int y, int xsign, int ysign);
+extern void dmxConfigFreePair(DMXConfigPairPtr p);
extern DMXConfigCommentPtr dmxConfigCreateComment(int token, int line,
const char *comment);
-extern void dmxConfigFreeComment(DMXConfigCommentPtr p);
+extern void dmxConfigFreeComment(DMXConfigCommentPtr p);
extern DMXConfigPartDimPtr dmxConfigCreatePartDim(DMXConfigPairPtr pDim,
DMXConfigPairPtr pOffset);
-extern void dmxConfigFreePartDim(DMXConfigPartDimPtr p);
+extern void dmxConfigFreePartDim(DMXConfigPartDimPtr p);
extern DMXConfigFullDimPtr dmxConfigCreateFullDim(DMXConfigPartDimPtr pScrn,
DMXConfigPartDimPtr pRoot);
-extern void dmxConfigFreeFullDim(DMXConfigFullDimPtr p);
+extern void dmxConfigFreeFullDim(DMXConfigFullDimPtr p);
extern DMXConfigDisplayPtr dmxConfigCreateDisplay(DMXConfigTokenPtr pStart,
DMXConfigStringPtr pName,
DMXConfigFullDimPtr pDim,
DMXConfigPairPtr pOrigin,
DMXConfigTokenPtr pEnd);
-extern void dmxConfigFreeDisplay(DMXConfigDisplayPtr p);
-extern DMXConfigWallPtr dmxConfigCreateWall(DMXConfigTokenPtr pStart,
- DMXConfigPairPtr pWallDim,
- DMXConfigPairPtr pDisplayDim,
- DMXConfigStringPtr pNameList,
- DMXConfigTokenPtr pEnd);
-extern void dmxConfigFreeWall(DMXConfigWallPtr p);
-extern DMXConfigOptionPtr dmxConfigCreateOption(DMXConfigTokenPtr pStart,
- DMXConfigStringPtr pOption,
- DMXConfigTokenPtr pEnd);
-extern void dmxConfigFreeOption(DMXConfigOptionPtr p);
-extern DMXConfigParamPtr dmxConfigCreateParam(DMXConfigTokenPtr pStart,
- DMXConfigTokenPtr pOpen,
- DMXConfigStringPtr pParam,
- DMXConfigTokenPtr pClose,
+extern void dmxConfigFreeDisplay(DMXConfigDisplayPtr p);
+extern DMXConfigWallPtr dmxConfigCreateWall(DMXConfigTokenPtr pStart,
+ DMXConfigPairPtr pWallDim,
+ DMXConfigPairPtr pDisplayDim,
+ DMXConfigStringPtr pNameList,
+ DMXConfigTokenPtr pEnd);
+extern void dmxConfigFreeWall(DMXConfigWallPtr p);
+extern DMXConfigOptionPtr dmxConfigCreateOption(DMXConfigTokenPtr pStart,
+ DMXConfigStringPtr pOption,
DMXConfigTokenPtr pEnd);
-extern void dmxConfigFreeParam(DMXConfigParamPtr p);
-extern const char **dmxConfigLookupParam(DMXConfigParamPtr p,
- const char *key,
- int *argc);
-extern DMXConfigSubPtr dmxConfigCreateSub(DMXConfigType type,
- DMXConfigCommentPtr comment,
- DMXConfigDisplayPtr display,
- DMXConfigWallPtr wall,
- DMXConfigOptionPtr option,
- DMXConfigParamPtr param);
-extern void dmxConfigFreeSub(DMXConfigSubPtr sub);
-extern DMXConfigSubPtr dmxConfigSubComment(DMXConfigCommentPtr comment);
-extern DMXConfigSubPtr dmxConfigSubDisplay(DMXConfigDisplayPtr display);
-extern DMXConfigSubPtr dmxConfigSubWall(DMXConfigWallPtr wall);
-extern DMXConfigSubPtr dmxConfigSubOption(DMXConfigOptionPtr option);
-extern DMXConfigSubPtr dmxConfigSubParam(DMXConfigParamPtr param);
-extern DMXConfigSubPtr dmxConfigAddSub(DMXConfigSubPtr head,
- DMXConfigSubPtr sub);
+extern void dmxConfigFreeOption(DMXConfigOptionPtr p);
+extern DMXConfigParamPtr dmxConfigCreateParam(DMXConfigTokenPtr pStart,
+ DMXConfigTokenPtr pOpen,
+ DMXConfigStringPtr pParam,
+ DMXConfigTokenPtr pClose,
+ DMXConfigTokenPtr pEnd);
+extern void dmxConfigFreeParam(DMXConfigParamPtr p);
+extern const char **dmxConfigLookupParam(DMXConfigParamPtr p,
+ const char *key, int *argc);
+extern DMXConfigSubPtr dmxConfigCreateSub(DMXConfigType type,
+ DMXConfigCommentPtr comment,
+ DMXConfigDisplayPtr display,
+ DMXConfigWallPtr wall,
+ DMXConfigOptionPtr option,
+ DMXConfigParamPtr param);
+extern void dmxConfigFreeSub(DMXConfigSubPtr sub);
+extern DMXConfigSubPtr dmxConfigSubComment(DMXConfigCommentPtr comment);
+extern DMXConfigSubPtr dmxConfigSubDisplay(DMXConfigDisplayPtr display);
+extern DMXConfigSubPtr dmxConfigSubWall(DMXConfigWallPtr wall);
+extern DMXConfigSubPtr dmxConfigSubOption(DMXConfigOptionPtr option);
+extern DMXConfigSubPtr dmxConfigSubParam(DMXConfigParamPtr param);
+extern DMXConfigSubPtr dmxConfigAddSub(DMXConfigSubPtr head,
+ DMXConfigSubPtr sub);
extern DMXConfigVirtualPtr dmxConfigCreateVirtual(DMXConfigTokenPtr pStart,
DMXConfigStringPtr pName,
DMXConfigPairPtr pDim,
DMXConfigTokenPtr pOpen,
DMXConfigSubPtr pSubentry,
DMXConfigTokenPtr pClose);
-extern void dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual);
-extern DMXConfigEntryPtr dmxConfigCreateEntry(DMXConfigType type,
- DMXConfigCommentPtr comment,
- DMXConfigVirtualPtr virtual);
-extern void dmxConfigFreeEntry(DMXConfigEntryPtr entry);
-extern DMXConfigEntryPtr dmxConfigAddEntry(DMXConfigEntryPtr head,
- DMXConfigType type,
- DMXConfigCommentPtr comment,
- DMXConfigVirtualPtr virtual);
-extern DMXConfigEntryPtr dmxConfigEntryComment(DMXConfigCommentPtr comment);
-extern DMXConfigEntryPtr dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual);
+extern void dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual);
+extern DMXConfigEntryPtr dmxConfigCreateEntry(DMXConfigType type,
+ DMXConfigCommentPtr comment,
+ DMXConfigVirtualPtr virtual);
+extern void dmxConfigFreeEntry(DMXConfigEntryPtr entry);
+extern DMXConfigEntryPtr dmxConfigAddEntry(DMXConfigEntryPtr head,
+ DMXConfigType type,
+ DMXConfigCommentPtr comment,
+ DMXConfigVirtualPtr virtual);
+extern DMXConfigEntryPtr dmxConfigEntryComment(DMXConfigCommentPtr comment);
+extern DMXConfigEntryPtr dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual);
#endif
diff --git a/xorg-server/hw/dmx/config/dmxprint.c b/xorg-server/hw/dmx/config/dmxprint.c
index 599ebf5df..3145fb56a 100644
--- a/xorg-server/hw/dmx/config/dmxprint.c
+++ b/xorg-server/hw/dmx/config/dmxprint.c
@@ -52,100 +52,126 @@
#include <stdarg.h>
#include <ctype.h>
-static FILE *str = NULL;
-static int indent = 0;
-static int pos = 0;
+static FILE *str = NULL;
+static int indent = 0;
+static int pos = 0;
/** Stack of indentation information used for pretty-printing
* configuration information. */
static struct stack {
- int base;
- int comment;
- int step;
+ int base;
+ int comment;
+ int step;
struct stack *next;
-} *stack, initialStack = { 0, 0, 4, NULL };
+} *stack, initialStack = {
+0, 0, 4, NULL};
-static void dmxConfigIndent(void)
+static void
+dmxConfigIndent(void)
{
int i;
- if (indent < 0) indent = 0;
- if (indent > 40) indent = 40;
- for (i = 0; i < indent; i++) fprintf(str, " ");
+
+ if (indent < 0)
+ indent = 0;
+ if (indent > 40)
+ indent = 40;
+ for (i = 0; i < indent; i++)
+ fprintf(str, " ");
}
-static void dmxConfigNewline(void)
+static void
+dmxConfigNewline(void)
{
- if (pos) fprintf(str, "\n");
+ if (pos)
+ fprintf(str, "\n");
pos = 0;
}
-static void dmxConfigPushState(int base, int comment, int step)
+static void
+dmxConfigPushState(int base, int comment, int step)
{
struct stack *new = dmxConfigAlloc(sizeof(*new));
- new->base = base;
+
+ new->base = base;
new->comment = comment;
- new->step = step;
- new->next = stack;
- stack = new;
- indent = base;
+ new->step = step;
+ new->next = stack;
+ stack = new;
+ indent = base;
dmxConfigNewline();
}
-static void dmxConfigPushComment(void)
+static void
+dmxConfigPushComment(void)
{
- if (stack) indent = stack->comment;
+ if (stack)
+ indent = stack->comment;
}
-static void dmxConfigPushStep(void)
+static void
+dmxConfigPushStep(void)
{
- if (stack) indent = stack->step;
+ if (stack)
+ indent = stack->step;
}
-static void dmxConfigPopState(void)
+static void
+dmxConfigPopState(void)
{
struct stack *old = stack;
- if (!stack) return;
+ if (!stack)
+ return;
indent = old->base;
- stack = old->next;
- if (!stack) dmxConfigLog("Stack underflow\n");
+ stack = old->next;
+ if (!stack)
+ dmxConfigLog("Stack underflow\n");
dmxConfigFree(old);
dmxConfigNewline();
}
-static void dmxConfigOutput(int addSpace, int doNewline, const char *comment,
- const char *format, ...)
+static void
+dmxConfigOutput(int addSpace, int doNewline, const char *comment,
+ const char *format, ...)
{
va_list args;
- if (!pos) dmxConfigIndent();
- else if (addSpace) fprintf(str, " ");
+ if (!pos)
+ dmxConfigIndent();
+ else if (addSpace)
+ fprintf(str, " ");
if (format) {
va_start(args, format);
- /* RATS: This hasn't been audited -- it
- * could probably result in a buffer
- * overflow. */
- pos += vfprintf(str, format, args); /* assumes no newlines! */
+ /* RATS: This hasn't been audited -- it
+ * could probably result in a buffer
+ * overflow. */
+ pos += vfprintf(str, format, args); /* assumes no newlines! */
va_end(args);
}
if (comment) {
- if (pos) fprintf(str, " ");
+ if (pos)
+ fprintf(str, " ");
pos += fprintf(str, "#%s", comment);
dmxConfigNewline();
dmxConfigPushComment();
- } else if (doNewline) dmxConfigNewline();
+ }
+ else if (doNewline)
+ dmxConfigNewline();
}
-static void dmxConfigPrintComment(DMXConfigCommentPtr p)
+static void
+dmxConfigPrintComment(DMXConfigCommentPtr p)
{
dmxConfigOutput(1, 1, p->comment, NULL);
}
-static void dmxConfigPrintTokenFlag(DMXConfigTokenPtr p, int flag)
+static void
+dmxConfigPrintTokenFlag(DMXConfigTokenPtr p, int flag)
{
- if (!p) return;
+ if (!p)
+ return;
switch (p->token) {
case T_VIRTUAL:
dmxConfigPushState(0, 4, 4);
@@ -169,14 +195,16 @@ static void dmxConfigPrintTokenFlag(DMXConfigTokenPtr p, int flag)
break;
case ';':
dmxConfigOutput(0, 1, p->comment, ";");
- if (flag) dmxConfigPopState();
+ if (flag)
+ dmxConfigPopState();
break;
case '{':
dmxConfigOutput(1, 1, p->comment, "{");
dmxConfigPushStep();
break;
case '}':
- if (flag) dmxConfigPopState();
+ if (flag)
+ dmxConfigPopState();
dmxConfigOutput(0, 1, p->comment, "}");
break;
case '/':
@@ -187,49 +215,66 @@ static void dmxConfigPrintTokenFlag(DMXConfigTokenPtr p, int flag)
}
}
-static void dmxConfigPrintToken(DMXConfigTokenPtr p)
+static void
+dmxConfigPrintToken(DMXConfigTokenPtr p)
{
dmxConfigPrintTokenFlag(p, 1);
}
-static void dmxConfigPrintTokenNopop(DMXConfigTokenPtr p)
+static void
+dmxConfigPrintTokenNopop(DMXConfigTokenPtr p)
{
dmxConfigPrintTokenFlag(p, 0);
}
-static int dmxConfigPrintQuotedString(const char *s)
+static int
+dmxConfigPrintQuotedString(const char *s)
{
const char *pt;
- if (!s || !s[0]) return 1; /* Quote empty string */
- for (pt = s; *pt; ++pt) if (isspace(*pt)) return 1;
+ if (!s || !s[0])
+ return 1; /* Quote empty string */
+ for (pt = s; *pt; ++pt)
+ if (isspace(*pt))
+ return 1;
return 0;
}
-static void dmxConfigPrintString(DMXConfigStringPtr p, int quote)
+static void
+dmxConfigPrintString(DMXConfigStringPtr p, int quote)
{
DMXConfigStringPtr pt;
-
- if (!p) return;
+
+ if (!p)
+ return;
for (pt = p; pt; pt = pt->next) {
if (quote && dmxConfigPrintQuotedString(pt->string)) {
dmxConfigOutput(1, 0, pt->comment, "\"%s\"",
pt->string ? pt->string : "");
- } else
+ }
+ else
dmxConfigOutput(1, 0, pt->comment, "%s",
pt->string ? pt->string : "");
}
}
-static int dmxConfigPrintPair(DMXConfigPairPtr p, int addSpace)
+static int
+dmxConfigPrintPair(DMXConfigPairPtr p, int addSpace)
{
const char *format = NULL;
-
- if (!p) return 0;
+
+ if (!p)
+ return 0;
switch (p->token) {
- case T_ORIGIN: format = "@%dx%d"; break;
- case T_DIMENSION: format = "%dx%d"; break;
- case T_OFFSET: format = "%c%d%c%d"; break;
+ case T_ORIGIN:
+ format = "@%dx%d";
+ break;
+ case T_DIMENSION:
+ format = "%dx%d";
+ break;
+ case T_OFFSET:
+ format = "%c%d%c%d";
+ break;
}
if (p->token == T_OFFSET) {
if (!p->comment && !p->x && !p->y && p->xsign >= 0 && p->ysign >= 0)
@@ -237,69 +282,79 @@ static int dmxConfigPrintPair(DMXConfigPairPtr p, int addSpace)
dmxConfigOutput(addSpace, 0, p->comment, format,
p->xsign < 0 ? '-' : '+', p->x,
p->ysign < 0 ? '-' : '+', p->y);
- } else {
- if (!p->comment && !p->x && !p->y) return 0;
+ }
+ else {
+ if (!p->comment && !p->x && !p->y)
+ return 0;
dmxConfigOutput(addSpace, 0, p->comment, format, p->x, p->y);
}
return 1;
}
-static void dmxConfigPrintDisplay(DMXConfigDisplayPtr p)
+static void
+dmxConfigPrintDisplay(DMXConfigDisplayPtr p)
{
- DMXConfigToken dummyStart = { T_DISPLAY, 0, NULL };
- DMXConfigToken dummyEnd = { ';', 0, NULL };
- DMXConfigToken dummySep = { '/', 0, NULL };
- DMXConfigString dummyName = { T_STRING, 0, NULL, NULL, NULL };
- DMXConfigPair dummySDim = { T_DIMENSION, 0, NULL, 0, 0, 0, 0 };
- DMXConfigPair dummySOffset = { T_OFFSET, 0, NULL, 0, 0, 0, 0 };
- DMXConfigPair dummyRDim = { T_DIMENSION, 0, NULL, 0, 0, 0, 0 };
- DMXConfigPair dummyROffset = { T_OFFSET, 0, NULL, 0, 0, 0, 0 };
- DMXConfigPair dummyOrigin = { T_ORIGIN, 0, NULL, 0, 0, 0, 0 };
- int output;
-
- if (p->dname) p->dname->string = p->name;
- else dummyName.string = p->name;
-
+ DMXConfigToken dummyStart = { T_DISPLAY, 0, NULL };
+ DMXConfigToken dummyEnd = { ';', 0, NULL };
+ DMXConfigToken dummySep = { '/', 0, NULL };
+ DMXConfigString dummyName = { T_STRING, 0, NULL, NULL, NULL };
+ DMXConfigPair dummySDim = { T_DIMENSION, 0, NULL, 0, 0, 0, 0 };
+ DMXConfigPair dummySOffset = { T_OFFSET, 0, NULL, 0, 0, 0, 0 };
+ DMXConfigPair dummyRDim = { T_DIMENSION, 0, NULL, 0, 0, 0, 0 };
+ DMXConfigPair dummyROffset = { T_OFFSET, 0, NULL, 0, 0, 0, 0 };
+ DMXConfigPair dummyOrigin = { T_ORIGIN, 0, NULL, 0, 0, 0, 0 };
+ int output;
+
+ if (p->dname)
+ p->dname->string = p->name;
+ else
+ dummyName.string = p->name;
+
if (p->dim && p->dim->scrn && p->dim->scrn->dim) {
- p->dim->scrn->dim->x = p->scrnWidth;
- p->dim->scrn->dim->y = p->scrnHeight;
- } else {
- dummySDim.x = p->scrnWidth;
- dummySDim.y = p->scrnHeight;
+ p->dim->scrn->dim->x = p->scrnWidth;
+ p->dim->scrn->dim->y = p->scrnHeight;
+ }
+ else {
+ dummySDim.x = p->scrnWidth;
+ dummySDim.y = p->scrnHeight;
}
if (p->dim && p->dim->scrn && p->dim->scrn->offset) {
p->dim->scrn->offset->x = p->scrnX;
p->dim->scrn->offset->y = p->scrnY;
- } else {
- dummySOffset.x = p->scrnX;
- dummySOffset.y = p->scrnY;
}
-
+ else {
+ dummySOffset.x = p->scrnX;
+ dummySOffset.y = p->scrnY;
+ }
+
if (p->dim && p->dim->root && p->dim->root->dim) {
- p->dim->root->dim->x = p->rootWidth;
- p->dim->root->dim->y = p->rootHeight;
- } else {
- dummyRDim.x = p->rootWidth;
- dummyRDim.y = p->rootHeight;
+ p->dim->root->dim->x = p->rootWidth;
+ p->dim->root->dim->y = p->rootHeight;
+ }
+ else {
+ dummyRDim.x = p->rootWidth;
+ dummyRDim.y = p->rootHeight;
}
if (p->dim && p->dim->root && p->dim->root->offset) {
p->dim->root->offset->x = p->rootX;
p->dim->root->offset->y = p->rootY;
- } else {
- dummyROffset.x = p->rootX;
- dummyROffset.y = p->rootY;
+ }
+ else {
+ dummyROffset.x = p->rootX;
+ dummyROffset.y = p->rootY;
}
if (p->origin) {
- p->origin->x = p->rootXOrigin, p->origin->y = p->rootYOrigin;
- p->origin->xsign = p->rootXSign, p->origin->ysign = p->rootYSign;
- } else {
- dummyOrigin.x = p->rootXOrigin, dummyOrigin.y = p->rootYOrigin;
- dummyOrigin.xsign = p->rootXSign, dummyOrigin.ysign = p->rootYSign;
+ p->origin->x = p->rootXOrigin, p->origin->y = p->rootYOrigin;
+ p->origin->xsign = p->rootXSign, p->origin->ysign = p->rootYSign;
+ }
+ else {
+ dummyOrigin.x = p->rootXOrigin, dummyOrigin.y = p->rootYOrigin;
+ dummyOrigin.xsign = p->rootXSign, dummyOrigin.ysign = p->rootYSign;
}
-
+
dmxConfigPrintToken(p->start ? p->start : &dummyStart);
dmxConfigPrintString(p->dname ? p->dname : &dummyName, 1);
@@ -313,9 +368,7 @@ static void dmxConfigPrintDisplay(DMXConfigDisplayPtr p)
dmxConfigPrintPair(&dummySOffset, !output);
if (p->scrnWidth != p->rootWidth
- || p->scrnHeight != p->rootHeight
- || p->rootX
- || p->rootY) {
+ || p->scrnHeight != p->rootHeight || p->rootX || p->rootY) {
dmxConfigPrintToken(&dummySep);
if (p->dim && p->dim->root && p->dim->root->dim)
output = dmxConfigPrintPair(p->dim->root->dim, 1);
@@ -331,7 +384,8 @@ static void dmxConfigPrintDisplay(DMXConfigDisplayPtr p)
dmxConfigPrintToken(p->end ? p->end : &dummyEnd);
}
-static void dmxConfigPrintWall(DMXConfigWallPtr p)
+static void
+dmxConfigPrintWall(DMXConfigWallPtr p)
{
dmxConfigPrintToken(p->start);
dmxConfigPrintPair(p->wallDim, 1);
@@ -340,11 +394,12 @@ static void dmxConfigPrintWall(DMXConfigWallPtr p)
dmxConfigPrintToken(p->end);
}
-static void dmxConfigPrintOption(DMXConfigOptionPtr p)
+static void
+dmxConfigPrintOption(DMXConfigOptionPtr p)
{
- DMXConfigToken dummyStart = { T_OPTION, 0, NULL };
+ DMXConfigToken dummyStart = { T_OPTION, 0, NULL };
DMXConfigString dummyOption = { T_STRING, 0, NULL, NULL, NULL };
- DMXConfigToken dummyEnd = { ';', 0, NULL };
+ DMXConfigToken dummyEnd = { ';', 0, NULL };
dummyOption.string = p->string;
@@ -353,41 +408,59 @@ static void dmxConfigPrintOption(DMXConfigOptionPtr p)
dmxConfigPrintToken(p->end ? p->end : &dummyEnd);
}
-static void dmxConfigPrintParam(DMXConfigParamPtr p)
+static void
+dmxConfigPrintParam(DMXConfigParamPtr p)
{
- if (!p) return;
+ if (!p)
+ return;
if (p->start) {
if (p->open && p->close) {
dmxConfigPrintToken(p->start);
dmxConfigPrintToken(p->open);
dmxConfigPrintParam(p->next);
dmxConfigPrintToken(p->close);
- } else if (p->end && p->param) {
+ }
+ else if (p->end && p->param) {
dmxConfigPrintToken(p->start);
dmxConfigPrintString(p->param, 1);
dmxConfigPrintToken(p->end);
- } else
+ }
+ else
dmxConfigLog("dmxConfigPrintParam: cannot handle format (a)\n");
- } else if (p->end && p->param) {
+ }
+ else if (p->end && p->param) {
dmxConfigPrintString(p->param, 1);
dmxConfigPrintTokenNopop(p->end);
dmxConfigPrintParam(p->next);
- } else
+ }
+ else
dmxConfigLog("dmxConfigPrintParam: cannot handle format (b)\n");
}
-static void dmxConfigPrintSub(DMXConfigSubPtr p)
+static void
+dmxConfigPrintSub(DMXConfigSubPtr p)
{
DMXConfigSubPtr pt;
- if (!p) return;
+ if (!p)
+ return;
for (pt = p; pt; pt = pt->next) {
switch (pt->type) {
- case dmxConfigComment: dmxConfigPrintComment(pt->comment); break;
- case dmxConfigDisplay: dmxConfigPrintDisplay(pt->display); break;
- case dmxConfigWall: dmxConfigPrintWall(pt->wall); break;
- case dmxConfigOption: dmxConfigPrintOption(pt->option); break;
- case dmxConfigParam: dmxConfigPrintParam(pt->param); break;
+ case dmxConfigComment:
+ dmxConfigPrintComment(pt->comment);
+ break;
+ case dmxConfigDisplay:
+ dmxConfigPrintDisplay(pt->display);
+ break;
+ case dmxConfigWall:
+ dmxConfigPrintWall(pt->wall);
+ break;
+ case dmxConfigOption:
+ dmxConfigPrintOption(pt->option);
+ break;
+ case dmxConfigParam:
+ dmxConfigPrintParam(pt->param);
+ break;
default:
dmxConfigLog("dmxConfigPrintSub:"
" cannot handle type %d in subentry\n", pt->type);
@@ -395,20 +468,24 @@ static void dmxConfigPrintSub(DMXConfigSubPtr p)
}
}
-static void dmxConfigPrintVirtual(DMXConfigVirtualPtr p)
+static void
+dmxConfigPrintVirtual(DMXConfigVirtualPtr p)
{
- DMXConfigToken dummyStart = { T_VIRTUAL, 0, NULL };
- DMXConfigToken dummyOpen = { '{', 0, NULL };
- DMXConfigToken dummyClose = { '}', 0, NULL };
- DMXConfigString dummyName = { T_STRING, 0, NULL, NULL, NULL };
- DMXConfigPair dummyDim = { T_DIMENSION, 0, NULL, 0, 0 };
-
- if (p->vname) p->vname->string = p->name;
- else dummyName.string = p->name;
+ DMXConfigToken dummyStart = { T_VIRTUAL, 0, NULL };
+ DMXConfigToken dummyOpen = { '{', 0, NULL };
+ DMXConfigToken dummyClose = { '}', 0, NULL };
+ DMXConfigString dummyName = { T_STRING, 0, NULL, NULL, NULL };
+ DMXConfigPair dummyDim = { T_DIMENSION, 0, NULL, 0, 0 };
+
+ if (p->vname)
+ p->vname->string = p->name;
+ else
+ dummyName.string = p->name;
- if (p->dim) p->dim->x = p->width, p->dim->y = p->height;
- else dummyDim.x = p->width, dummyDim.y = p->height;
-
+ if (p->dim)
+ p->dim->x = p->width, p->dim->y = p->height;
+ else
+ dummyDim.x = p->width, dummyDim.y = p->height;
dmxConfigPrintToken(p->start ? p->start : &dummyStart);
dmxConfigPrintString(p->vname ? p->vname : &dummyName, 1);
@@ -420,36 +497,48 @@ static void dmxConfigPrintVirtual(DMXConfigVirtualPtr p)
/** The configuration information in \a entry will be pretty-printed to
* the \a stream. If \a stream is NULL, then stdout will be used. */
-void dmxConfigPrint(FILE *stream, DMXConfigEntryPtr entry)
+void
+dmxConfigPrint(FILE * stream, DMXConfigEntryPtr entry)
{
DMXConfigEntryPtr pt;
- if (!stream) str = stdout;
- else str = stream;
-
+ if (!stream)
+ str = stdout;
+ else
+ str = stream;
+
stack = &initialStack;
-
+
for (pt = entry; pt; pt = pt->next) {
switch (pt->type) {
- case dmxConfigComment: dmxConfigPrintComment(pt->comment); break;
- case dmxConfigVirtual: dmxConfigPrintVirtual(pt->virtual); break;
+ case dmxConfigComment:
+ dmxConfigPrintComment(pt->comment);
+ break;
+ case dmxConfigVirtual:
+ dmxConfigPrintVirtual(pt->virtual);
+ break;
default:
dmxConfigLog("dmxConfigPrint: cannot handle type %d in entry\n",
pt->type);
}
}
- if (pos) dmxConfigNewline();
+ if (pos)
+ dmxConfigNewline();
}
/** The configuration information in \a p will be pretty-printed to the
* \a stream. If \a stream is NULL, then stdout will be used. */
-void dmxConfigVirtualPrint(FILE *stream, DMXConfigVirtualPtr p)
+void
+dmxConfigVirtualPrint(FILE * stream, DMXConfigVirtualPtr p)
{
- if (!stream) str = stdout;
- else str = stream;
+ if (!stream)
+ str = stdout;
+ else
+ str = stream;
stack = &initialStack;
-
+
dmxConfigPrintVirtual(p);
- if (pos) dmxConfigNewline();
+ if (pos)
+ dmxConfigNewline();
}
diff --git a/xorg-server/hw/dmx/config/dmxtodmx.c b/xorg-server/hw/dmx/config/dmxtodmx.c
index 0d4ee4c09..66342091e 100644
--- a/xorg-server/hw/dmx/config/dmxtodmx.c
+++ b/xorg-server/hw/dmx/config/dmxtodmx.c
@@ -37,10 +37,11 @@
#include "dmxprint.h"
#include "dmxcompat.h"
-extern int yyparse(void);
-extern FILE *yyin;
+extern int yyparse(void);
+extern FILE *yyin;
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
yydebug = 0;
yyparse();
diff --git a/xorg-server/hw/dmx/config/vdltodmx.c b/xorg-server/hw/dmx/config/vdltodmx.c
index 69563f16c..007416b33 100644
--- a/xorg-server/hw/dmx/config/vdltodmx.c
+++ b/xorg-server/hw/dmx/config/vdltodmx.c
@@ -36,18 +36,20 @@
#include "dmxprint.h"
#include "dmxcompat.h"
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
DMXConfigEntryPtr entry;
- FILE *str;
+ FILE *str;
- if (argc != 2 && argc !=3) {
+ if (argc != 2 && argc != 3) {
fprintf(stderr, "Usage: vdltodmx inFile [outFile]\n");
return 1;
}
if (argc == 2) {
str = stdout;
- } else if (!(str = fopen(argv[2], "w"))) {
+ }
+ else if (!(str = fopen(argv[2], "w"))) {
fprintf(stderr, "Cannot open %s for write\n", argv[2]);
return 2;
}
diff --git a/xorg-server/hw/dmx/config/xdmxconfig.c b/xorg-server/hw/dmx/config/xdmxconfig.c
index 3165ba000..f30841244 100644
--- a/xorg-server/hw/dmx/config/xdmxconfig.c
+++ b/xorg-server/hw/dmx/config/xdmxconfig.c
@@ -34,7 +34,7 @@
#ifdef HAVE_DMX_CONFIG_H
#include <dmx-config.h>
#endif
-
+
#include <stdio.h>
#include <stdlib.h>
#include <X11/Intrinsic.h>
@@ -55,8 +55,8 @@
#include "dmxprint.h"
#include "dmxlog.h"
-extern int yyparse(void);
-extern FILE *yyin;
+extern int yyparse(void);
+extern FILE *yyin;
#define DMX_INFO "xdmxconfig v0.9\nCopyright 2002 Red Hat Inc.\n"
@@ -67,329 +67,379 @@ extern FILE *yyin;
#define DMX_CANVAS_WIDTH 400
#define DMX_CANVAS_HEIGHT 500
-DMXConfigEntryPtr dmxConfigEntry;
+DMXConfigEntryPtr dmxConfigEntry;
static DMXConfigVirtualPtr dmxConfigCurrent, dmxConfigNewVirtual;
static DMXConfigDisplayPtr dmxConfigCurrentDisplay, dmxConfigNewDisplay;
-static int dmxConfigGrabbed, dmxConfigGrabbedFine;
-static int dmxConfigGrabbedX, dmxConfigGrabbedY;
-static char *dmxConfigFilename;
-static GC dmxConfigGC, dmxConfigGCRev, dmxConfigGCHL;
-static int dmxConfigGCInit = 0;
-static Dimension dmxConfigWidgetWidth, dmxConfigWidgetHeight;
-static Dimension dmxConfigWallWidth, dmxConfigWallHeight;
-static double dmxConfigScaleX, dmxConfigScaleY;
-static int dmxConfigNotSaved;
+static int dmxConfigGrabbed, dmxConfigGrabbedFine;
+static int dmxConfigGrabbedX, dmxConfigGrabbedY;
+static char *dmxConfigFilename;
+static GC dmxConfigGC, dmxConfigGCRev, dmxConfigGCHL;
+static int dmxConfigGCInit = 0;
+static Dimension dmxConfigWidgetWidth, dmxConfigWidgetHeight;
+static Dimension dmxConfigWallWidth, dmxConfigWallHeight;
+static double dmxConfigScaleX, dmxConfigScaleY;
+static int dmxConfigNotSaved;
static enum {
dmxConfigStateOpen,
dmxConfigStateSave
-} dmxConfigState;
+} dmxConfigState;
/* Global widgets */
-static Widget canvas;
-static Widget cnamebox, cdimbox;
-static Widget openpopup, opendialog;
-static Widget namebox, dimbox, rtbox, origbox;
-static Widget okbutton, buttonpopup;
-static Widget ecbutton, dcbutton;
-static Widget ndbutton0, ndbutton1, edbutton, ddbutton;
-static Widget ecpopup, ecdialog0, ecdialog1;
-static Widget edpopup, eddialog0, eddialog1, eddialog2;
-static Widget aboutpopup, quitpopup;
-
-static void dmxConfigCanvasGCs(void)
+static Widget canvas;
+static Widget cnamebox, cdimbox;
+static Widget openpopup, opendialog;
+static Widget namebox, dimbox, rtbox, origbox;
+static Widget okbutton, buttonpopup;
+static Widget ecbutton, dcbutton;
+static Widget ndbutton0, ndbutton1, edbutton, ddbutton;
+static Widget ecpopup, ecdialog0, ecdialog1;
+static Widget edpopup, eddialog0, eddialog1, eddialog2;
+static Widget aboutpopup, quitpopup;
+
+static void
+dmxConfigCanvasGCs(void)
{
- Display *dpy = XtDisplay(canvas);
- Window win = XtWindow(canvas);
- XGCValues gcvals;
+ Display *dpy = XtDisplay(canvas);
+ Window win = XtWindow(canvas);
+ XGCValues gcvals;
unsigned long mask;
- Colormap colormap;
- XColor fg, bg, hl, tmp;
-
- if (dmxConfigGCInit++) return;
+ Colormap colormap;
+ XColor fg, bg, hl, tmp;
+
+ if (dmxConfigGCInit++)
+ return;
XtVaGetValues(canvas, XtNcolormap, &colormap, NULL);
XAllocNamedColor(XtDisplay(canvas), colormap, "black", &bg, &tmp);
XAllocNamedColor(XtDisplay(canvas), colormap, "white", &fg, &tmp);
- XAllocNamedColor(XtDisplay(canvas), colormap, "red", &hl, &tmp);
+ XAllocNamedColor(XtDisplay(canvas), colormap, "red", &hl, &tmp);
mask = (GCFunction | GCPlaneMask | GCClipMask | GCForeground |
GCBackground | GCLineWidth | GCLineStyle | GCCapStyle |
GCFillStyle);
- /* FIXME: copy this from widget */
- gcvals.function = GXcopy;
+ /* FIXME: copy this from widget */
+ gcvals.function = GXcopy;
gcvals.plane_mask = AllPlanes;
- gcvals.clip_mask = None;
+ gcvals.clip_mask = None;
gcvals.foreground = fg.pixel;
gcvals.background = bg.pixel;
gcvals.line_width = 0;
gcvals.line_style = LineSolid;
- gcvals.cap_style = CapNotLast;
+ gcvals.cap_style = CapNotLast;
gcvals.fill_style = FillSolid;
-
- dmxConfigGC = XCreateGC(dpy, win, mask, &gcvals);
+
+ dmxConfigGC = XCreateGC(dpy, win, mask, &gcvals);
gcvals.foreground = hl.pixel;
- dmxConfigGCHL = XCreateGC(dpy, win, mask, &gcvals);
+ dmxConfigGCHL = XCreateGC(dpy, win, mask, &gcvals);
gcvals.foreground = bg.pixel;
gcvals.background = fg.pixel;
- dmxConfigGCRev = XCreateGC(dpy, win, mask, &gcvals);
+ dmxConfigGCRev = XCreateGC(dpy, win, mask, &gcvals);
}
-static void dmxConfigGetDims(int *maxWidth, int *maxHeight)
+static void
+dmxConfigGetDims(int *maxWidth, int *maxHeight)
{
- DMXConfigSubPtr pt;
+ DMXConfigSubPtr pt;
DMXConfigEntryPtr e;
-
- *maxWidth = dmxConfigWallWidth = 0;
+
+ *maxWidth = dmxConfigWallWidth = 0;
*maxHeight = dmxConfigWallHeight = 0;
- if (!dmxConfigCurrent) return;
-
- dmxConfigWallWidth = dmxConfigCurrent->width;
+ if (!dmxConfigCurrent)
+ return;
+
+ dmxConfigWallWidth = dmxConfigCurrent->width;
dmxConfigWallHeight = dmxConfigCurrent->height;
if (!dmxConfigWallWidth || !dmxConfigWallHeight) {
for (pt = dmxConfigCurrent->subentry; pt; pt = pt->next) {
if (pt->type == dmxConfigDisplay) {
- int x = pt->display->scrnWidth + pt->display->rootXOrigin;
+ int x = pt->display->scrnWidth + pt->display->rootXOrigin;
int y = pt->display->scrnHeight + pt->display->rootYOrigin;
- if (x > dmxConfigWallWidth) dmxConfigWallWidth = x;
- if (y > dmxConfigWallHeight) dmxConfigWallHeight = y;
+
+ if (x > dmxConfigWallWidth)
+ dmxConfigWallWidth = x;
+ if (y > dmxConfigWallHeight)
+ dmxConfigWallHeight = y;
}
}
}
- /* Compute maximums */
+ /* Compute maximums */
*maxWidth = *maxHeight = 0;
for (e = dmxConfigEntry; e; e = e->next) {
- if (e->type != dmxConfigVirtual) continue;
+ if (e->type != dmxConfigVirtual)
+ continue;
for (pt = e->virtual->subentry; pt; pt = pt->next) {
if (pt->type == dmxConfigDisplay) {
- int x = pt->display->scrnWidth + pt->display->rootXOrigin;
+ int x = pt->display->scrnWidth + pt->display->rootXOrigin;
int y = pt->display->scrnHeight + pt->display->rootYOrigin;
- if (x > *maxWidth) *maxWidth = x;
- if (y > *maxHeight) *maxHeight = y;
+
+ if (x > *maxWidth)
+ *maxWidth = x;
+ if (y > *maxHeight)
+ *maxHeight = y;
}
}
}
- if (dmxConfigWallWidth > *maxWidth) *maxWidth = dmxConfigWallWidth;
- if (dmxConfigWallHeight > *maxHeight) *maxHeight = dmxConfigWallHeight;
+ if (dmxConfigWallWidth > *maxWidth)
+ *maxWidth = dmxConfigWallWidth;
+ if (dmxConfigWallHeight > *maxHeight)
+ *maxHeight = dmxConfigWallHeight;
+}
+
+static int
+scalex(int x)
+{
+ return (int) ((x * dmxConfigScaleX) + .5);
+}
+
+static int
+scaley(int y)
+{
+ return (int) ((y * dmxConfigScaleY) + .5);
+}
+
+static int
+unscalex(int x)
+{
+ return (int) ((x / dmxConfigScaleX) + .5);
}
-static int scalex(int x) { return (int)((x * dmxConfigScaleX) + .5); }
-static int scaley(int y) { return (int)((y * dmxConfigScaleY) + .5); }
-static int unscalex(int x) { return (int)((x / dmxConfigScaleX) + .5); }
-static int unscaley(int y) { return (int)((y / dmxConfigScaleY) + .5); }
+static int
+unscaley(int y)
+{
+ return (int) ((y / dmxConfigScaleY) + .5);
+}
-static void dmxConfigDataUpdate(void)
+static void
+dmxConfigDataUpdate(void)
{
- /* FIXME: could result in buffer overflows */
- char cnambuf[512];
- char cdimbuf[128];
- char nambuf[512];
- char dimbuf[128];
- char rtbuf[128];
- char offbuf[128];
+ /* FIXME: could result in buffer overflows */
+ char cnambuf[512];
+ char cdimbuf[128];
+ char nambuf[512];
+ char dimbuf[128];
+ char rtbuf[128];
+ char offbuf[128];
const char *name;
if (!dmxConfigCurrent) {
- XtVaSetValues(cnamebox, XtNlabel, "", XtNsensitive, False, NULL);
- XtVaSetValues(cdimbox, XtNlabel, "", XtNsensitive, False, NULL);
- XtVaSetValues(ecbutton, XtNsensitive, False, NULL);
- XtVaSetValues(dcbutton, XtNsensitive, False, NULL);
- XtVaSetValues(ndbutton0, XtNsensitive, False, NULL);
- XtVaSetValues(ndbutton1, XtNsensitive, False, NULL);
- } else {
+ XtVaSetValues(cnamebox, XtNlabel, "", XtNsensitive, False, NULL);
+ XtVaSetValues(cdimbox, XtNlabel, "", XtNsensitive, False, NULL);
+ XtVaSetValues(ecbutton, XtNsensitive, False, NULL);
+ XtVaSetValues(dcbutton, XtNsensitive, False, NULL);
+ XtVaSetValues(ndbutton0, XtNsensitive, False, NULL);
+ XtVaSetValues(ndbutton1, XtNsensitive, False, NULL);
+ }
+ else {
name = dmxConfigCurrent->name;
snprintf(cnambuf, sizeof(cnambuf), "%s", name ? name : "");
snprintf(cdimbuf, sizeof(cdimbuf), "%dx%d",
- dmxConfigWallWidth, dmxConfigWallHeight);
- XtVaSetValues(cnamebox, XtNlabel, cnambuf, XtNsensitive, True, NULL);
- XtVaSetValues(cdimbox, XtNlabel, cdimbuf, XtNsensitive, True, NULL);
- XtVaSetValues(ecbutton, XtNsensitive, True, NULL);
- XtVaSetValues(dcbutton, XtNsensitive, True, NULL);
- XtVaSetValues(ndbutton0, XtNsensitive, True, NULL);
- XtVaSetValues(ndbutton1, XtNsensitive, True, NULL);
+ dmxConfigWallWidth, dmxConfigWallHeight);
+ XtVaSetValues(cnamebox, XtNlabel, cnambuf, XtNsensitive, True, NULL);
+ XtVaSetValues(cdimbox, XtNlabel, cdimbuf, XtNsensitive, True, NULL);
+ XtVaSetValues(ecbutton, XtNsensitive, True, NULL);
+ XtVaSetValues(dcbutton, XtNsensitive, True, NULL);
+ XtVaSetValues(ndbutton0, XtNsensitive, True, NULL);
+ XtVaSetValues(ndbutton1, XtNsensitive, True, NULL);
}
-
+
if (!dmxConfigCurrentDisplay) {
XtVaSetValues(namebox, XtNlabel, "", XtNsensitive, False, NULL);
- XtVaSetValues(dimbox, XtNlabel, "", XtNsensitive, False, NULL);
- XtVaSetValues(rtbox, XtNlabel, "", XtNsensitive, False, NULL);
+ XtVaSetValues(dimbox, XtNlabel, "", XtNsensitive, False, NULL);
+ XtVaSetValues(rtbox, XtNlabel, "", XtNsensitive, False, NULL);
XtVaSetValues(origbox, XtNlabel, "", XtNsensitive, False, NULL);
- XtVaSetValues(edbutton, XtNsensitive, False, NULL);
- XtVaSetValues(ddbutton, XtNsensitive, False, NULL);
- } else {
+ XtVaSetValues(edbutton, XtNsensitive, False, NULL);
+ XtVaSetValues(ddbutton, XtNsensitive, False, NULL);
+ }
+ else {
name = dmxConfigCurrentDisplay->name;
snprintf(nambuf, sizeof(nambuf), "%s", name ? name : "");
snprintf(dimbuf, sizeof(dimbuf), "%dx%d%c%d%c%d",
- dmxConfigCurrentDisplay->scrnWidth,
- dmxConfigCurrentDisplay->scrnHeight,
- dmxConfigCurrentDisplay->scrnXSign < 0 ? '-' : '+',
- dmxConfigCurrentDisplay->scrnX,
- dmxConfigCurrentDisplay->scrnYSign < 0 ? '-' : '+',
- dmxConfigCurrentDisplay->scrnY);
+ dmxConfigCurrentDisplay->scrnWidth,
+ dmxConfigCurrentDisplay->scrnHeight,
+ dmxConfigCurrentDisplay->scrnXSign < 0 ? '-' : '+',
+ dmxConfigCurrentDisplay->scrnX,
+ dmxConfigCurrentDisplay->scrnYSign < 0 ? '-' : '+',
+ dmxConfigCurrentDisplay->scrnY);
snprintf(rtbuf, sizeof(dimbuf), "%dx%d%c%d%c%d",
- dmxConfigCurrentDisplay->rootWidth,
- dmxConfigCurrentDisplay->rootHeight,
- dmxConfigCurrentDisplay->rootXSign < 0 ? '-' : '+',
- dmxConfigCurrentDisplay->rootX,
- dmxConfigCurrentDisplay->rootYSign < 0 ? '-' : '+',
- dmxConfigCurrentDisplay->rootY);
+ dmxConfigCurrentDisplay->rootWidth,
+ dmxConfigCurrentDisplay->rootHeight,
+ dmxConfigCurrentDisplay->rootXSign < 0 ? '-' : '+',
+ dmxConfigCurrentDisplay->rootX,
+ dmxConfigCurrentDisplay->rootYSign < 0 ? '-' : '+',
+ dmxConfigCurrentDisplay->rootY);
snprintf(offbuf, sizeof(offbuf), "@%dx%d",
- dmxConfigCurrentDisplay->rootXOrigin,
- dmxConfigCurrentDisplay->rootYOrigin);
+ dmxConfigCurrentDisplay->rootXOrigin,
+ dmxConfigCurrentDisplay->rootYOrigin);
XtVaSetValues(namebox, XtNlabel, nambuf, XtNsensitive, True, NULL);
- XtVaSetValues(dimbox, XtNlabel, dimbuf, XtNsensitive, True, NULL);
- XtVaSetValues(rtbox, XtNlabel, rtbuf, XtNsensitive, True, NULL);
+ XtVaSetValues(dimbox, XtNlabel, dimbuf, XtNsensitive, True, NULL);
+ XtVaSetValues(rtbox, XtNlabel, rtbuf, XtNsensitive, True, NULL);
XtVaSetValues(origbox, XtNlabel, offbuf, XtNsensitive, True, NULL);
- XtVaSetValues(edbutton, XtNsensitive, True, NULL);
- XtVaSetValues(ddbutton, XtNsensitive, True, NULL);
+ XtVaSetValues(edbutton, XtNsensitive, True, NULL);
+ XtVaSetValues(ddbutton, XtNsensitive, True, NULL);
}
}
-static void dmxConfigCanvasUpdate(void)
+static void
+dmxConfigCanvasUpdate(void)
{
DMXConfigSubPtr pt;
- Display *dpy = XtDisplay(canvas);
- Window win = XtWindow(canvas);
- GContext gcontext = XGContextFromGC(dmxConfigGC);
- XFontStruct *fs;
- int w, h;
+ Display *dpy = XtDisplay(canvas);
+ Window win = XtWindow(canvas);
+ GContext gcontext = XGContextFromGC(dmxConfigGC);
+ XFontStruct *fs;
+ int w, h;
XFillRectangle(dpy, win, dmxConfigGCRev,
0, 0, dmxConfigWidgetWidth, dmxConfigWidgetHeight);
dmxConfigDataUpdate();
- if (!dmxConfigCurrent) return;
+ if (!dmxConfigCurrent)
+ return;
w = scalex(dmxConfigWallWidth);
h = scaley(dmxConfigWallHeight);
- if (w > dmxConfigWidgetWidth - 1) w = dmxConfigWidgetWidth - 1;
- if (h > dmxConfigWidgetHeight - 1) h = dmxConfigWidgetHeight - 1;
+ if (w > dmxConfigWidgetWidth - 1)
+ w = dmxConfigWidgetWidth - 1;
+ if (h > dmxConfigWidgetHeight - 1)
+ h = dmxConfigWidgetHeight - 1;
XDrawRectangle(dpy, win, dmxConfigGC, 0, 0, w, h);
fs = XQueryFont(dpy, gcontext);
for (pt = dmxConfigCurrent->subentry; pt; pt = pt->next) {
int x, y, len;
int xo = 3, yo = fs->ascent + fs->descent + 2;
- GC gc;
-
- if (pt->type != dmxConfigDisplay) continue;
- gc = (pt->display == dmxConfigCurrentDisplay
- ? dmxConfigGCHL
- : dmxConfigGC);
- x = scalex(pt->display->rootXOrigin);
- y = scaley(pt->display->rootYOrigin);
- w = scalex(pt->display->scrnWidth);
- h = scaley(pt->display->scrnHeight);
+ GC gc;
+
+ if (pt->type != dmxConfigDisplay)
+ continue;
+ gc = (pt->display == dmxConfigCurrentDisplay
+ ? dmxConfigGCHL : dmxConfigGC);
+ x = scalex(pt->display->rootXOrigin);
+ y = scaley(pt->display->rootYOrigin);
+ w = scalex(pt->display->scrnWidth);
+ h = scaley(pt->display->scrnHeight);
len = pt->display->name ? strlen(pt->display->name) : 0;
- if (x > dmxConfigWidgetWidth - 1) x = dmxConfigWidgetWidth - 1;
- if (y > dmxConfigWidgetHeight - 1) y = dmxConfigWidgetHeight - 1;
+ if (x > dmxConfigWidgetWidth - 1)
+ x = dmxConfigWidgetWidth - 1;
+ if (y > dmxConfigWidgetHeight - 1)
+ y = dmxConfigWidgetHeight - 1;
XDrawRectangle(dpy, win, gc, x, y, w, h);
if (fs && len) {
while (len && XTextWidth(fs, pt->display->name, len) >= w - 2 * xo)
--len;
if (len)
- XDrawString(dpy, win, gc, x+xo, y+yo, pt->display->name, len);
+ XDrawString(dpy, win, gc, x + xo, y + yo, pt->display->name,
+ len);
}
}
- if (fs) XFreeFontInfo(NULL, fs, 0);
+ if (fs)
+ XFreeFontInfo(NULL, fs, 0);
}
-static void dmxConfigCanvasDraw(Region region)
+static void
+dmxConfigCanvasDraw(Region region)
{
Display *dpy = XtDisplay(canvas);
- int maxWidth, maxHeight;
-
+ int maxWidth, maxHeight;
+
dmxConfigCanvasGCs();
if (region) {
- XSetRegion(dpy, dmxConfigGC, region);
+ XSetRegion(dpy, dmxConfigGC, region);
XSetRegion(dpy, dmxConfigGCRev, region);
- XSetRegion(dpy, dmxConfigGCHL, region);
+ XSetRegion(dpy, dmxConfigGCHL, region);
}
XtVaGetValues(canvas,
XtNwidth, &dmxConfigWidgetWidth,
- XtNheight, &dmxConfigWidgetHeight,
- NULL);
+ XtNheight, &dmxConfigWidgetHeight, NULL);
dmxConfigGetDims(&maxWidth, &maxHeight);
- dmxConfigScaleX = (double)dmxConfigWidgetWidth / maxWidth;
- dmxConfigScaleY = (double)dmxConfigWidgetHeight / maxHeight;
- if (dmxConfigScaleX > dmxConfigScaleY) dmxConfigScaleX = dmxConfigScaleY;
- if (dmxConfigScaleY > dmxConfigScaleX) dmxConfigScaleY = dmxConfigScaleX;
+ dmxConfigScaleX = (double) dmxConfigWidgetWidth / maxWidth;
+ dmxConfigScaleY = (double) dmxConfigWidgetHeight / maxHeight;
+ if (dmxConfigScaleX > dmxConfigScaleY)
+ dmxConfigScaleX = dmxConfigScaleY;
+ if (dmxConfigScaleY > dmxConfigScaleX)
+ dmxConfigScaleY = dmxConfigScaleX;
dmxConfigCanvasUpdate();
if (region) {
- XSetClipMask(dpy, dmxConfigGC, None);
+ XSetClipMask(dpy, dmxConfigGC, None);
XSetClipMask(dpy, dmxConfigGCRev, None);
- XSetClipMask(dpy, dmxConfigGCHL, None);
+ XSetClipMask(dpy, dmxConfigGCHL, None);
}
}
-static void dmxConfigSelectCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigSelectCallback(Widget w, XtPointer closure, XtPointer callData)
{
dmxConfigCurrent = closure;
dmxConfigVirtualPrint(stdout, dmxConfigCurrent);
dmxConfigCanvasDraw(NULL);
}
-static void dmxConfigCopystrings(void)
+static void
+dmxConfigCopystrings(void)
{
DMXConfigEntryPtr pt;
- DMXConfigSubPtr sub;
+ DMXConfigSubPtr sub;
- if (!dmxConfigCurrent) return;
+ if (!dmxConfigCurrent)
+ return;
- /* FIXME: this is all a per-config file
- * memory leak */
+ /* FIXME: this is all a per-config file
+ * memory leak */
for (pt = dmxConfigEntry; pt; pt = pt->next) {
if (pt->type == dmxConfigVirtual) {
pt->virtual->name = XtNewString(pt->virtual->name
- ? pt->virtual->name
- : "");
+ ? pt->virtual->name : "");
for (sub = pt->virtual->subentry; sub; sub = sub->next) {
- if (sub->type != dmxConfigDisplay) continue;
+ if (sub->type != dmxConfigDisplay)
+ continue;
sub->display->name = XtNewString(sub->display->name
- ? sub->display->name
- : "");
+ ? sub->display->name : "");
}
}
}
}
-static void dmxConfigGetValueString(char **d, Widget w)
+static void
+dmxConfigGetValueString(char **d, Widget w)
{
const char *tmp = XawDialogGetValueString(w);
- if (*d) XtFree(*d);
+
+ if (*d)
+ XtFree(*d);
*d = XtNewString(tmp);
}
-static void dmxConfigSetupCnamemenu(void)
+static void
+dmxConfigSetupCnamemenu(void)
{
- static Widget cnamemenu = NULL;
- Widget w;
+ static Widget cnamemenu = NULL;
+ Widget w;
DMXConfigEntryPtr pt;
- if (cnamemenu) XtDestroyWidget(cnamemenu);
+ if (cnamemenu)
+ XtDestroyWidget(cnamemenu);
cnamemenu = NULL;
- if (!dmxConfigCurrent) return;
+ if (!dmxConfigCurrent)
+ return;
cnamemenu = XtVaCreatePopupShell("cnamemenu", simpleMenuWidgetClass,
- cnamebox,
- NULL);
-
+ cnamebox, NULL);
+
for (pt = dmxConfigEntry; pt; pt = pt->next) {
if (pt->type == dmxConfigVirtual) {
w = XtVaCreateManagedWidget(pt->virtual->name
? pt->virtual->name
: "",
- smeBSBObjectClass, cnamemenu,
- NULL);
- XtAddCallback(w, XtNcallback,
- dmxConfigSelectCallback, pt->virtual);
+ smeBSBObjectClass, cnamemenu, NULL);
+ XtAddCallback(w, XtNcallback, dmxConfigSelectCallback, pt->virtual);
}
}
}
-static void dmxConfigReadFile(void)
+static void
+dmxConfigReadFile(void)
{
- FILE *str;
+ FILE *str;
DMXConfigEntryPtr pt;
if (!(str = fopen(dmxConfigFilename, "r"))) {
@@ -397,7 +447,7 @@ static void dmxConfigReadFile(void)
dmxConfigFilename);
return;
}
- yyin = str;
+ yyin = str;
yydebug = 0;
yyparse();
fclose(str);
@@ -410,8 +460,6 @@ static void dmxConfigReadFile(void)
}
}
-
-
if (XtIsRealized(canvas)) {
dmxConfigCopystrings();
dmxConfigSetupCnamemenu();
@@ -420,9 +468,10 @@ static void dmxConfigReadFile(void)
dmxConfigVirtualPrint(stdout, dmxConfigCurrent);
}
-static void dmxConfigWriteFile(void)
+static void
+dmxConfigWriteFile(void)
{
- FILE *str;
+ FILE *str;
if (!(str = fopen(dmxConfigFilename, "w"))) {
dmxLog(dmxWarning, "Unable to write configuration file %s\n",
@@ -433,31 +482,36 @@ static void dmxConfigWriteFile(void)
fclose(str);
}
-static DMXConfigDisplayPtr dmxConfigFindDisplay(int x, int y)
+static DMXConfigDisplayPtr
+dmxConfigFindDisplay(int x, int y)
{
DMXConfigSubPtr pt;
- if (!dmxConfigCurrent) return NULL;
+ if (!dmxConfigCurrent)
+ return NULL;
for (pt = dmxConfigCurrent->subentry; pt; pt = pt->next) {
DMXConfigDisplayPtr d = pt->display;
- if (pt->type != dmxConfigDisplay) continue;
+
+ if (pt->type != dmxConfigDisplay)
+ continue;
if (x >= scalex(d->rootXOrigin)
&& x <= scalex(d->rootXOrigin + d->scrnWidth)
&& y >= scaley(d->rootYOrigin)
- && y <= scaley(d->rootYOrigin + d->scrnHeight)) return d;
+ && y <= scaley(d->rootYOrigin + d->scrnHeight))
+ return d;
}
return NULL;
}
-static void dmxConfigSetPopupPosition(Widget popup)
+static void
+dmxConfigSetPopupPosition(Widget popup)
{
- Position x, y;
- Window t1, t2;
- int root_x, root_y;
- int temp_x, temp_y;
+ Position x, y;
+ Window t1, t2;
+ int root_x, root_y;
+ int temp_x, temp_y;
unsigned int temp;
-
XtRealizeWidget(popup);
if (!XQueryPointer(XtDisplay(popup), XtWindow(popup), &t1, &t2,
&root_x, &root_y, &temp_x, &temp_y, &temp))
@@ -468,13 +522,15 @@ static void dmxConfigSetPopupPosition(Widget popup)
XtVaSetValues(popup, XtNx, x, XtNy, y, NULL);
}
-static void dmxConfigPlaceMenu(Widget w, XEvent *event,
- String *params, Cardinal *num_params)
+static void
+dmxConfigPlaceMenu(Widget w, XEvent * event,
+ String * params, Cardinal * num_params)
{
dmxConfigSetPopupPosition(buttonpopup);
}
-static void dmxConfigMove(int deltaX, int deltaY)
+static void
+dmxConfigMove(int deltaX, int deltaY)
{
dmxConfigCurrentDisplay->rootXOrigin += deltaX;
dmxConfigCurrentDisplay->rootYOrigin += deltaY;
@@ -492,40 +548,44 @@ static void dmxConfigMove(int deltaX, int deltaY)
dmxConfigNotSaved = 1;
}
-static void dmxConfigCanvasInput(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigCanvasInput(Widget w, XtPointer closure, XtPointer callData)
{
- XEvent *e = (XEvent *)callData;
+ XEvent *e = (XEvent *) callData;
DMXConfigDisplayPtr display = NULL;
switch (e->type) {
case ButtonPress:
if (e->xbutton.button == Button1) {
- dmxConfigGrabbed = 1;
+ dmxConfigGrabbed = 1;
dmxConfigGrabbedFine = 0;
- dmxConfigGrabbedX = e->xbutton.x;
- dmxConfigGrabbedY = e->xbutton.y;
+ dmxConfigGrabbedX = e->xbutton.x;
+ dmxConfigGrabbedY = e->xbutton.y;
}
if (e->xbutton.button == Button2) {
- dmxConfigGrabbed = 1;
+ dmxConfigGrabbed = 1;
dmxConfigGrabbedFine = 1;
- dmxConfigGrabbedX = e->xbutton.x;
- dmxConfigGrabbedY = e->xbutton.y;
+ dmxConfigGrabbedX = e->xbutton.x;
+ dmxConfigGrabbedY = e->xbutton.y;
}
break;
case ButtonRelease:
- if (e->xbutton.button == Button1) dmxConfigGrabbed = 0;
- if (e->xbutton.button == Button2) dmxConfigGrabbed = 0;
+ if (e->xbutton.button == Button1)
+ dmxConfigGrabbed = 0;
+ if (e->xbutton.button == Button2)
+ dmxConfigGrabbed = 0;
break;
case MotionNotify:
if (dmxConfigGrabbed && dmxConfigCurrentDisplay) {
int deltaX = e->xmotion.x - dmxConfigGrabbedX;
int deltaY = e->xmotion.y - dmxConfigGrabbedY;
+
dmxConfigMove(dmxConfigGrabbedFine ? deltaX : unscalex(deltaX),
dmxConfigGrabbedFine ? deltaY : unscaley(deltaY));
dmxConfigGrabbedX = e->xmotion.x;
dmxConfigGrabbedY = e->xmotion.y;
- } else {
+ }
+ else {
display = dmxConfigFindDisplay(e->xmotion.x, e->xmotion.y);
if (display != dmxConfigCurrentDisplay) {
dmxConfigCurrentDisplay = display;
@@ -535,31 +595,39 @@ static void dmxConfigCanvasInput(Widget w, XtPointer closure,
break;
case KeyPress:
switch (XLookupKeysym(&e->xkey, 0)) {
- case XK_Right: dmxConfigMove(1,0); break;
- case XK_Left: dmxConfigMove(-1,0); break;
- case XK_Down: dmxConfigMove(0,1); break;
- case XK_Up: dmxConfigMove(0,-1); break;
+ case XK_Right:
+ dmxConfigMove(1, 0);
+ break;
+ case XK_Left:
+ dmxConfigMove(-1, 0);
+ break;
+ case XK_Down:
+ dmxConfigMove(0, 1);
+ break;
+ case XK_Up:
+ dmxConfigMove(0, -1);
+ break;
}
break;
}
}
-static void dmxConfigCanvasResize(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigCanvasResize(Widget w, XtPointer closure, XtPointer callData)
{
dmxConfigCanvasDraw(NULL);
}
-static void dmxConfigCanvasExpose(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigCanvasExpose(Widget w, XtPointer closure, XtPointer callData)
{
- CanvasExposeDataPtr data = (CanvasExposeDataPtr)callData;
+ CanvasExposeDataPtr data = (CanvasExposeDataPtr) callData;
dmxConfigCanvasDraw(data->region);
}
-static void dmxConfigOpenCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigOpenCallback(Widget w, XtPointer closure, XtPointer callData)
{
dmxConfigState = dmxConfigStateOpen;
XtVaSetValues(okbutton, XtNlabel, "Open", NULL);
@@ -567,8 +635,8 @@ static void dmxConfigOpenCallback(Widget w, XtPointer closure,
XtPopup(openpopup, XtGrabExclusive);
}
-static void dmxConfigSaveCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigSaveCallback(Widget w, XtPointer closure, XtPointer callData)
{
dmxConfigState = dmxConfigStateSave;
XtVaSetValues(okbutton, XtNlabel, "Save", NULL);
@@ -576,69 +644,73 @@ static void dmxConfigSaveCallback(Widget w, XtPointer closure,
XtPopup(openpopup, XtGrabExclusive);
}
-static void dmxConfigOkCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigOkCallback(Widget w, XtPointer closure, XtPointer callData)
{
dmxConfigGetValueString(&dmxConfigFilename, opendialog);
XtPopdown(openpopup);
- if (dmxConfigState == dmxConfigStateOpen) dmxConfigReadFile();
- else dmxConfigWriteFile();
+ if (dmxConfigState == dmxConfigStateOpen)
+ dmxConfigReadFile();
+ else
+ dmxConfigWriteFile();
dmxConfigNotSaved = 0;
}
-static void dmxConfigCanCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigCanCallback(Widget w, XtPointer closure, XtPointer callData)
{
XtPopdown(openpopup);
}
-static void dmxConfigECCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigECCallback(Widget w, XtPointer closure, XtPointer callData)
{
char buf[256]; /* RATS: Only used in snprintf */
-
- if (!dmxConfigCurrent) return;
+
+ if (!dmxConfigCurrent)
+ return;
dmxConfigSetPopupPosition(ecpopup);
XtVaSetValues(ecdialog0, XtNvalue,
- dmxConfigCurrent->name ? dmxConfigCurrent->name : "",
- NULL);
+ dmxConfigCurrent->name ? dmxConfigCurrent->name : "", NULL);
snprintf(buf, sizeof(buf), "%dx%d",
- dmxConfigCurrent->width, dmxConfigCurrent->height);
+ dmxConfigCurrent->width, dmxConfigCurrent->height);
XtVaSetValues(ecdialog1, XtNvalue, buf, NULL);
XtPopup(ecpopup, XtGrabExclusive);
}
-static void dmxConfigNCCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigNCCallback(Widget w, XtPointer closure, XtPointer callData)
{
- int width = 1280*2, height = 1024*2;
+ int width = 1280 * 2, height = 1024 * 2;
if (dmxConfigCurrent) {
- width = dmxConfigCurrent->width;
+ width = dmxConfigCurrent->width;
height = dmxConfigCurrent->height;
}
- dmxConfigCurrent = dmxConfigCreateVirtual(NULL, NULL, NULL,
- NULL, NULL, NULL);
- dmxConfigNewVirtual = dmxConfigCurrent;
- dmxConfigCurrent->width = width;
+ dmxConfigCurrent = dmxConfigCreateVirtual(NULL, NULL, NULL,
+ NULL, NULL, NULL);
+ dmxConfigNewVirtual = dmxConfigCurrent;
+ dmxConfigCurrent->width = width;
dmxConfigCurrent->height = height;
dmxConfigEntry = dmxConfigAddEntry(dmxConfigEntry, dmxConfigVirtual, NULL,
dmxConfigCurrent);
dmxConfigECCallback(w, closure, callData);
}
-static void dmxConfigDCCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigDCCallback(Widget w, XtPointer closure, XtPointer callData)
{
DMXConfigEntryPtr pt;
- if (!dmxConfigEntry) return;
+ if (!dmxConfigEntry)
+ return;
if (dmxConfigEntry
&& dmxConfigEntry->type == dmxConfigVirtual
&& dmxConfigEntry->virtual == dmxConfigCurrent) {
dmxConfigEntry = dmxConfigEntry->next;
- } else {
+ }
+ else {
for (pt = dmxConfigEntry; pt && pt->next; pt = pt->next)
if (pt->next->type == dmxConfigVirtual
&& pt->next->virtual == dmxConfigCurrent) {
@@ -647,10 +719,10 @@ static void dmxConfigDCCallback(Widget w, XtPointer closure,
}
}
dmxConfigFreeVirtual(dmxConfigCurrent);
- dmxConfigCurrent = NULL;
+ dmxConfigCurrent = NULL;
dmxConfigCurrentDisplay = NULL;
- /* Make the first entry current */
+ /* Make the first entry current */
for (pt = dmxConfigEntry; pt; pt = pt->next) {
if (pt->type == dmxConfigVirtual) {
dmxConfigCurrent = pt->virtual;
@@ -662,93 +734,96 @@ static void dmxConfigDCCallback(Widget w, XtPointer closure,
dmxConfigCanvasDraw(NULL);
}
-static void dmxConfigECOkCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigECOkCallback(Widget w, XtPointer closure, XtPointer callData)
{
const char *value;
- char *endpt;
+ char *endpt;
- dmxConfigGetValueString((char **)&dmxConfigCurrent->name, ecdialog0);
- value = XawDialogGetValueString(ecdialog1);
- dmxConfigCurrent->width = strtol(value, &endpt, 10);
- dmxConfigCurrent->height = strtol(endpt+1, NULL, 10);
+ dmxConfigGetValueString((char **) &dmxConfigCurrent->name, ecdialog0);
+ value = XawDialogGetValueString(ecdialog1);
+ dmxConfigCurrent->width = strtol(value, &endpt, 10);
+ dmxConfigCurrent->height = strtol(endpt + 1, NULL, 10);
XtPopdown(ecpopup);
dmxConfigCurrentDisplay = NULL;
- dmxConfigNewVirtual = NULL;
+ dmxConfigNewVirtual = NULL;
dmxConfigSetupCnamemenu();
dmxConfigCanvasDraw(NULL);
dmxConfigNotSaved = 1;
}
-static void dmxConfigECCanCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigECCanCallback(Widget w, XtPointer closure, XtPointer callData)
{
- if (dmxConfigNewVirtual) dmxConfigDCCallback(w, closure, callData);
- dmxConfigNewVirtual = NULL;
+ if (dmxConfigNewVirtual)
+ dmxConfigDCCallback(w, closure, callData);
+ dmxConfigNewVirtual = NULL;
XtPopdown(ecpopup);
}
-static void dmxConfigEDCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigEDCallback(Widget w, XtPointer closure, XtPointer callData)
{
char buf[256]; /* RATS: Only used in snprintf */
-
- if (!dmxConfigCurrent || !dmxConfigCurrentDisplay) return;
+
+ if (!dmxConfigCurrent || !dmxConfigCurrentDisplay)
+ return;
dmxConfigSetPopupPosition(edpopup);
XtVaSetValues(eddialog0, XtNvalue,
dmxConfigCurrentDisplay->name
- ? dmxConfigCurrentDisplay->name
- : "",
- NULL);
+ ? dmxConfigCurrentDisplay->name : "", NULL);
snprintf(buf, sizeof(buf), "%dx%d%c%d%c%d",
- dmxConfigCurrentDisplay->scrnWidth,
- dmxConfigCurrentDisplay->scrnHeight,
- dmxConfigCurrentDisplay->scrnXSign < 0 ? '-' : '+',
- dmxConfigCurrentDisplay->scrnY,
- dmxConfigCurrentDisplay->scrnYSign < 0 ? '-' : '+',
- dmxConfigCurrentDisplay->scrnY);
+ dmxConfigCurrentDisplay->scrnWidth,
+ dmxConfigCurrentDisplay->scrnHeight,
+ dmxConfigCurrentDisplay->scrnXSign < 0 ? '-' : '+',
+ dmxConfigCurrentDisplay->scrnY,
+ dmxConfigCurrentDisplay->scrnYSign < 0 ? '-' : '+',
+ dmxConfigCurrentDisplay->scrnY);
XtVaSetValues(eddialog1, XtNvalue, buf, NULL);
snprintf(buf, sizeof(buf), "@%dx%d",
- dmxConfigCurrentDisplay->rootXOrigin,
- dmxConfigCurrentDisplay->rootYOrigin);
+ dmxConfigCurrentDisplay->rootXOrigin,
+ dmxConfigCurrentDisplay->rootYOrigin);
XtVaSetValues(eddialog2, XtNvalue, buf, NULL);
XtPopup(edpopup, XtGrabExclusive);
}
-static void dmxConfigNDCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigNDCallback(Widget w, XtPointer closure, XtPointer callData)
{
int width = 1280, height = 1024;
- if (!dmxConfigCurrent) return;
+ if (!dmxConfigCurrent)
+ return;
if (dmxConfigCurrentDisplay) {
- width = dmxConfigCurrentDisplay->scrnWidth;
+ width = dmxConfigCurrentDisplay->scrnWidth;
height = dmxConfigCurrentDisplay->scrnHeight;
}
dmxConfigCurrentDisplay = dmxConfigCreateDisplay(NULL, NULL, NULL,
NULL, NULL);
- dmxConfigNewDisplay = dmxConfigCurrentDisplay;
- dmxConfigCurrentDisplay->scrnWidth = width;
+ dmxConfigNewDisplay = dmxConfigCurrentDisplay;
+ dmxConfigCurrentDisplay->scrnWidth = width;
dmxConfigCurrentDisplay->scrnHeight = height;
-
+
dmxConfigCurrent->subentry
= dmxConfigAddSub(dmxConfigCurrent->subentry,
dmxConfigSubDisplay(dmxConfigCurrentDisplay));
dmxConfigEDCallback(w, closure, callData);
}
-static void dmxConfigDDCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigDDCallback(Widget w, XtPointer closure, XtPointer callData)
{
DMXConfigSubPtr pt;
- if (!dmxConfigCurrent || !dmxConfigCurrentDisplay) return;
- /* First */
+ if (!dmxConfigCurrent || !dmxConfigCurrentDisplay)
+ return;
+ /* First */
if (dmxConfigCurrent->subentry
&& dmxConfigCurrent->subentry->type == dmxConfigDisplay
&& dmxConfigCurrent->subentry->display == dmxConfigCurrentDisplay) {
dmxConfigCurrent->subentry = dmxConfigCurrent->subentry->next;
- } else {
+ }
+ else {
for (pt = dmxConfigCurrent->subentry; pt && pt->next; pt = pt->next)
if (pt->next->type == dmxConfigDisplay
&& pt->next->display == dmxConfigCurrentDisplay) {
@@ -762,21 +837,21 @@ static void dmxConfigDDCallback(Widget w, XtPointer closure,
dmxConfigCanvasDraw(NULL);
}
-static void dmxConfigAboutCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigAboutCallback(Widget w, XtPointer closure, XtPointer callData)
{
dmxConfigSetPopupPosition(aboutpopup);
XtPopup(aboutpopup, XtGrabExclusive);
}
-static void dmxConfigAboutOkCallback(Widget w, XtPointer closure,
- XtPointer CallData)
+static void
+dmxConfigAboutOkCallback(Widget w, XtPointer closure, XtPointer CallData)
{
XtPopdown(aboutpopup);
}
-static void dmxConfigQuitCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigQuitCallback(Widget w, XtPointer closure, XtPointer callData)
{
if (dmxConfigNotSaved) {
dmxConfigSetPopupPosition(quitpopup);
@@ -786,77 +861,82 @@ static void dmxConfigQuitCallback(Widget w, XtPointer closure,
exit(0);
}
-static void dmxConfigQuitOkCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigQuitOkCallback(Widget w, XtPointer closure, XtPointer callData)
{
XtPopdown(quitpopup);
exit(0);
}
-static void dmxConfigQuitCanCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigQuitCanCallback(Widget w, XtPointer closure, XtPointer callData)
{
XtPopdown(quitpopup);
}
-static void dmxConfigEDOkCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigEDOkCallback(Widget w, XtPointer closure, XtPointer callData)
{
char *value;
char *endpt;
-
+
dmxConfigNewDisplay = NULL;
- dmxConfigGetValueString((char **)&dmxConfigCurrentDisplay->name,
+ dmxConfigGetValueString((char **) &dmxConfigCurrentDisplay->name,
eddialog0);
- value = XawDialogGetValueString(eddialog1);
+ value = XawDialogGetValueString(eddialog1);
if (*value == '-' || *value == '+') {
- dmxConfigCurrentDisplay->scrnWidth = 0;
+ dmxConfigCurrentDisplay->scrnWidth = 0;
dmxConfigCurrentDisplay->scrnHeight = 0;
- endpt = value;
- } else {
- dmxConfigCurrentDisplay->scrnWidth = strtol(value, &endpt, 10);
- dmxConfigCurrentDisplay->scrnHeight = strtol(endpt+1, &endpt, 10);
+ endpt = value;
+ }
+ else {
+ dmxConfigCurrentDisplay->scrnWidth = strtol(value, &endpt, 10);
+ dmxConfigCurrentDisplay->scrnHeight = strtol(endpt + 1, &endpt, 10);
}
if (*endpt) {
- dmxConfigCurrentDisplay->scrnXSign = (*endpt == '-') ? -1 : 1;
- dmxConfigCurrentDisplay->scrnX = strtol(endpt+1, &endpt, 10);
- dmxConfigCurrentDisplay->scrnYSign = (*endpt == '-') ? -1 : 1;
- dmxConfigCurrentDisplay->scrnY = strtol(endpt+1, NULL, 10);
+ dmxConfigCurrentDisplay->scrnXSign = (*endpt == '-') ? -1 : 1;
+ dmxConfigCurrentDisplay->scrnX = strtol(endpt + 1, &endpt, 10);
+ dmxConfigCurrentDisplay->scrnYSign = (*endpt == '-') ? -1 : 1;
+ dmxConfigCurrentDisplay->scrnY = strtol(endpt + 1, NULL, 10);
}
if (dmxConfigCurrentDisplay->scrnX < 0)
dmxConfigCurrentDisplay->scrnX = -dmxConfigCurrentDisplay->scrnX;
if (dmxConfigCurrentDisplay->scrnY < 0)
dmxConfigCurrentDisplay->scrnY = -dmxConfigCurrentDisplay->scrnY;
- value = XawDialogGetValueString(eddialog2);
- dmxConfigCurrentDisplay->rootXOrigin = strtol(value+1, &endpt, 10);
- dmxConfigCurrentDisplay->rootYOrigin = strtol(endpt+1, NULL, 10);
+ value = XawDialogGetValueString(eddialog2);
+ dmxConfigCurrentDisplay->rootXOrigin = strtol(value + 1, &endpt, 10);
+ dmxConfigCurrentDisplay->rootYOrigin = strtol(endpt + 1, NULL, 10);
XtPopdown(edpopup);
dmxConfigSetupCnamemenu();
dmxConfigCanvasDraw(NULL);
dmxConfigNotSaved = 1;
}
-static void dmxConfigEDCanCallback(Widget w, XtPointer closure,
- XtPointer callData)
+static void
+dmxConfigEDCanCallback(Widget w, XtPointer closure, XtPointer callData)
{
- if (dmxConfigNewDisplay) dmxConfigDDCallback(w, closure, callData);
+ if (dmxConfigNewDisplay)
+ dmxConfigDDCallback(w, closure, callData);
dmxConfigNewDisplay = NULL;
XtPopdown(edpopup);
}
-static void dmxConfigOkAction(Widget w, XEvent *event,
- String *params, Cardinal *num_params)
+static void
+dmxConfigOkAction(Widget w, XEvent * event,
+ String * params, Cardinal * num_params)
{
Widget p = XtParent(w);
Widget t;
- if (p == opendialog) dmxConfigOkCallback(w, NULL, NULL);
+ if (p == opendialog)
+ dmxConfigOkCallback(w, NULL, NULL);
if (p == ecdialog0) {
t = XtNameToWidget(ecdialog1, "value");
XWarpPointer(XtDisplay(t), None, XtWindow(t), 0, 0, 0, 0, 0, 10);
}
- if (p == ecdialog1) dmxConfigECOkCallback(w, NULL, NULL);
+ if (p == ecdialog1)
+ dmxConfigECOkCallback(w, NULL, NULL);
if (p == eddialog0) {
t = XtNameToWidget(eddialog1, "value");
@@ -866,322 +946,285 @@ static void dmxConfigOkAction(Widget w, XEvent *event,
t = XtNameToWidget(eddialog2, "value");
XWarpPointer(XtDisplay(t), None, XtWindow(t), 0, 0, 0, 0, 0, 10);
}
- if (p == eddialog2) dmxConfigEDOkCallback(w, NULL, NULL);
+ if (p == eddialog2)
+ dmxConfigEDOkCallback(w, NULL, NULL);
}
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- XtAppContext appContext;
- Widget toplevel;
- Widget parent, menubox, bottombox, databox, canvasbox;
- Widget filebutton, helpbutton;
- Widget filemenu, openbutton, savebutton, quitbutton;
- Widget helpmenu, aboutbutton, aboutbox, aboutok;
- Widget quitbox, quitok, quitcan;
- Widget ncbutton;
- Widget canbutton;
- Widget ecbox, ecokbutton, eccanbutton;
- Widget edbox, edokbutton;
- Widget edcanbutton;
- /* FIXME: add meta-i, ctrl,meta-z,v? */
- const char *opentrans = "<Key>Return: openOk()\n\
+ XtAppContext appContext;
+ Widget toplevel;
+ Widget parent, menubox, bottombox, databox, canvasbox;
+ Widget filebutton, helpbutton;
+ Widget filemenu, openbutton, savebutton, quitbutton;
+ Widget helpmenu, aboutbutton, aboutbox, aboutok;
+ Widget quitbox, quitok, quitcan;
+ Widget ncbutton;
+ Widget canbutton;
+ Widget ecbox, ecokbutton, eccanbutton;
+ Widget edbox, edokbutton;
+ Widget edcanbutton;
+
+ /* FIXME: add meta-i, ctrl,meta-z,v? */
+ const char *opentrans = "<Key>Return: openOk()\n\
<Key>Linefeed: openOk()\n\
Ctrl<Key>M: openOk()\n\
Ctrl<Key>J: openOk()\n\
Ctrl<Key>O: noop()\n\
Ctrl<Key>N: noop()\n\
Ctrl<Key>P: noop()";
- const char *canvastrans =
+ const char *canvastrans =
"<Btn3Down>: placeMenu() XtMenuPopup(buttonpopup)";
- XtActionsRec actiontable[] = {
- { "openOk", dmxConfigOkAction },
- { "placeMenu", dmxConfigPlaceMenu },
- { "noop", NULL }
+ XtActionsRec actiontable[] = {
+ {"openOk", dmxConfigOkAction},
+ {"placeMenu", dmxConfigPlaceMenu},
+ {"noop", NULL}
};
dmxConfigFilename = XtNewString((argc >= 2) ? argv[1] : "");
- toplevel = XtVaAppInitialize(&appContext, "XDmxconfig",
- NULL, 0,
- &argc, argv,
- NULL,
- NULL);
-
- /* Main boxes */
- parent = XtVaCreateManagedWidget("parent", formWidgetClass, toplevel,
- XtNorientation, XtorientVertical,
- XtNwidth, DMX_MAIN_WIDTH,
- XtNheight, DMX_MAIN_HEIGHT,
- NULL);
- menubox = XtVaCreateManagedWidget("menubox", boxWidgetClass, parent,
- XtNborderWidth, 0,
- XtNorientation, XtorientHorizontal,
- XtNtop, XtChainTop,
- NULL);
- bottombox = XtVaCreateManagedWidget("bottombox", formWidgetClass, parent,
- XtNborderWidth, 0,
- XtNfromVert, menubox,
- XtNorientation, XtorientHorizontal,
- NULL);
- databox = XtVaCreateManagedWidget("databox", formWidgetClass,
- bottombox,
- XtNborderWidth, 0,
- XtNhorizDistance, 0,
- XtNwidth, DMX_DATA_WIDTH,
- XtNheight, DMX_DATA_HEIGHT,
- XtNleft, XtChainLeft,
- XtNorientation, XtorientVertical,
- NULL);
-
- /* Data */
- cnamebox = XtVaCreateManagedWidget("cnamebox", menuButtonWidgetClass,
- databox,
- XtNtop, XtChainTop,
- XtNjustify, XtJustifyLeft,
- XtNwidth, DMX_DATA_WIDTH,
- XtNlabel, "",
- XtNmenuName, "cnamemenu",
- NULL);
- cdimbox = XtVaCreateManagedWidget("cdimbox", labelWidgetClass,
- databox,
- XtNfromVert, cnamebox,
- XtNjustify, XtJustifyLeft,
- XtNwidth, DMX_DATA_WIDTH,
- XtNlabel, "",
- NULL);
- namebox = XtVaCreateManagedWidget("namebox", labelWidgetClass, databox,
- XtNfromVert, cdimbox,
- XtNjustify, XtJustifyLeft,
- XtNwidth, DMX_DATA_WIDTH,
- XtNlabel, "",
- NULL);
- dimbox = XtVaCreateManagedWidget("dimbox", labelWidgetClass,
- databox,
- XtNfromVert, namebox,
- XtNjustify, XtJustifyLeft,
- XtNwidth, DMX_DATA_WIDTH,
- XtNlabel, "",
- NULL);
- rtbox = XtVaCreateManagedWidget("rtbox", labelWidgetClass,
- databox,
- XtNfromVert, dimbox,
- XtNjustify, XtJustifyLeft,
- XtNwidth, DMX_DATA_WIDTH,
- XtNlabel, "",
- NULL);
- origbox = XtVaCreateManagedWidget("origbox", labelWidgetClass,
- databox,
- XtNfromVert, rtbox,
- XtNjustify, XtJustifyLeft,
- XtNwidth, DMX_DATA_WIDTH,
- XtNlabel, "",
- NULL);
-
- /* Canvas */
- canvasbox = XtVaCreateManagedWidget("canvasbox", boxWidgetClass,
- bottombox,
- XtNborderWidth, 0,
- XtNwidth, DMX_CANVAS_WIDTH,
- XtNheight, DMX_CANVAS_HEIGHT,
- XtNfromHoriz, databox,
- NULL);
-
- canvas = XtVaCreateManagedWidget("canvas", canvasWidgetClass,
- canvasbox,
- XtNwidth, DMX_CANVAS_WIDTH,
- XtNheight, DMX_CANVAS_HEIGHT,
- NULL);
-
-
- /* Main menu buttons */
- filebutton = XtVaCreateManagedWidget("File", menuButtonWidgetClass,
- menubox,
- XtNmenuName, "filemenu",
- NULL);
- helpbutton = XtVaCreateManagedWidget("Help", menuButtonWidgetClass,
- menubox,
- XtNmenuName, "helpmenu",
- NULL);
-
-
- /* File submenu buttons */
- filemenu = XtVaCreatePopupShell("filemenu", simpleMenuWidgetClass,
- filebutton, NULL);
- openbutton = XtVaCreateManagedWidget("Open File", smeBSBObjectClass,
- filemenu, NULL);
- savebutton = XtVaCreateManagedWidget("Save File", smeBSBObjectClass,
- filemenu,
- NULL);
- ncbutton = XtVaCreateManagedWidget("New Global", smeBSBObjectClass,
- filemenu, NULL);
- ecbutton = XtVaCreateManagedWidget("Edit Global", smeBSBObjectClass,
- filemenu,
- NULL);
- dcbutton = XtVaCreateManagedWidget("Delete Global", smeBSBObjectClass,
- filemenu,
- NULL);
- ndbutton0 = XtVaCreateManagedWidget("New Display", smeBSBObjectClass,
- filemenu,
- NULL);
- quitbutton = XtVaCreateManagedWidget("Quit", smeBSBObjectClass,
- filemenu, NULL);
-
- /* Help submenu button */
- helpmenu = XtVaCreatePopupShell("helpmenu", simpleMenuWidgetClass,
- helpbutton, NULL);
- aboutbutton = XtVaCreateManagedWidget("About", smeBSBObjectClass,
- helpmenu, NULL);
-
- /* Open popup */
- openpopup = XtVaCreatePopupShell("openpopup", transientShellWidgetClass,
- toplevel, NULL);
- opendialog = XtVaCreateManagedWidget("opendialog", dialogWidgetClass,
- openpopup,
- XtNlabel, "Filename: ",
- XtNvalue, dmxConfigFilename,
- NULL);
- okbutton = XtVaCreateManagedWidget("Open", commandWidgetClass,
- opendialog, NULL);
- canbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass,
- opendialog, NULL);
-
- /* EC popup */
- ecpopup = XtVaCreatePopupShell("ecpopup", transientShellWidgetClass,
- toplevel, NULL);
- ecbox = XtVaCreateManagedWidget("ecbox", boxWidgetClass,
- ecpopup, NULL);
- ecdialog0 = XtVaCreateManagedWidget("ecdialog0", dialogWidgetClass,
- ecbox,
- XtNlabel, "Name: ",
- XtNvalue, "",
- NULL);
- ecdialog1 = XtVaCreateManagedWidget("ecdialog1", dialogWidgetClass,
- ecbox,
- XtNlabel, "Dimension: ",
- XtNvalue, "",
- NULL);
- ecokbutton = XtVaCreateManagedWidget("OK", commandWidgetClass,
- ecbox, NULL);
- eccanbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass,
- ecbox, NULL);
-
- /* ED popup */
- edpopup = XtVaCreatePopupShell("edpopup", transientShellWidgetClass,
- toplevel, NULL);
- edbox = XtVaCreateManagedWidget("edbox", boxWidgetClass,
- edpopup, NULL);
- eddialog0 = XtVaCreateManagedWidget("eddialog0", dialogWidgetClass,
- edbox,
- XtNlabel, "Display Name: ",
- XtNvalue, "",
- NULL);
- eddialog1 = XtVaCreateManagedWidget("eddialog1", dialogWidgetClass,
- edbox,
- XtNlabel, "Geometry: ",
- XtNvalue, "",
- NULL);
- eddialog2 = XtVaCreateManagedWidget("eddialog2", dialogWidgetClass,
- edbox,
- XtNlabel, "Offset: ",
- XtNvalue, "",
- NULL);
- edokbutton = XtVaCreateManagedWidget("OK", commandWidgetClass,
- edbox, NULL);
- edcanbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass,
- edbox, NULL);
-
- /* About popup */
- aboutpopup = XtVaCreatePopupShell("aboutpopup",transientShellWidgetClass,
- toplevel, NULL);
- aboutbox = XtVaCreateManagedWidget("aboutbox", boxWidgetClass,
- aboutpopup, NULL);
- XtVaCreateManagedWidget("abouttext", labelWidgetClass,
- aboutbox,
- XtNlabel, DMX_INFO,
- NULL);
- aboutok = XtVaCreateManagedWidget("OK", commandWidgetClass,
- aboutbox, NULL);
-
- /* Quit popup */
- quitpopup = XtVaCreatePopupShell("quitpopup",transientShellWidgetClass,
- toplevel, NULL);
- quitbox = XtVaCreateManagedWidget("quitbox", boxWidgetClass,
- quitpopup, NULL);
- XtVaCreateManagedWidget("quittext", labelWidgetClass,
- quitbox,
- XtNlabel,
- "Changes to the configuration\n"
- "been made that have not yet\n"
- "been saved. Do you want to\n"
- "quit without saving?",
- NULL);
- quitok = XtVaCreateManagedWidget("Quit WITHOUT Saving",
- commandWidgetClass,
- quitbox, NULL);
- quitcan = XtVaCreateManagedWidget("Continue Editing",
- commandWidgetClass,
- quitbox, NULL);
-
- /* Button popup */
- buttonpopup = XtVaCreatePopupShell("buttonpopup", simpleMenuWidgetClass,
- toplevel, NULL);
- ndbutton1 = XtVaCreateManagedWidget("New Display", smeBSBObjectClass,
- buttonpopup,
- NULL);
- edbutton = XtVaCreateManagedWidget("Edit Display", smeBSBObjectClass,
- buttonpopup,
- NULL);
- ddbutton = XtVaCreateManagedWidget("Delete Display", smeBSBObjectClass,
- buttonpopup,
- NULL);
-
- /* Callbacks */
- XtAddCallback(openbutton, XtNcallback, dmxConfigOpenCallback, NULL);
- XtAddCallback(savebutton, XtNcallback, dmxConfigSaveCallback, NULL);
- XtAddCallback(okbutton, XtNcallback, dmxConfigOkCallback, NULL);
- XtAddCallback(canbutton, XtNcallback, dmxConfigCanCallback, NULL);
-
+ toplevel = XtVaAppInitialize(&appContext, "XDmxconfig",
+ NULL, 0, &argc, argv, NULL, NULL);
+
+ /* Main boxes */
+ parent = XtVaCreateManagedWidget("parent", formWidgetClass, toplevel,
+ XtNorientation, XtorientVertical,
+ XtNwidth, DMX_MAIN_WIDTH,
+ XtNheight, DMX_MAIN_HEIGHT, NULL);
+ menubox = XtVaCreateManagedWidget("menubox", boxWidgetClass, parent,
+ XtNborderWidth, 0,
+ XtNorientation, XtorientHorizontal,
+ XtNtop, XtChainTop, NULL);
+ bottombox = XtVaCreateManagedWidget("bottombox", formWidgetClass, parent,
+ XtNborderWidth, 0,
+ XtNfromVert, menubox,
+ XtNorientation, XtorientHorizontal,
+ NULL);
+ databox = XtVaCreateManagedWidget("databox", formWidgetClass,
+ bottombox,
+ XtNborderWidth, 0,
+ XtNhorizDistance, 0,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNheight, DMX_DATA_HEIGHT,
+ XtNleft, XtChainLeft,
+ XtNorientation, XtorientVertical, NULL);
+
+ /* Data */
+ cnamebox = XtVaCreateManagedWidget("cnamebox", menuButtonWidgetClass,
+ databox,
+ XtNtop, XtChainTop,
+ XtNjustify, XtJustifyLeft,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNlabel, "",
+ XtNmenuName, "cnamemenu", NULL);
+ cdimbox = XtVaCreateManagedWidget("cdimbox", labelWidgetClass,
+ databox,
+ XtNfromVert, cnamebox,
+ XtNjustify, XtJustifyLeft,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNlabel, "", NULL);
+ namebox = XtVaCreateManagedWidget("namebox", labelWidgetClass, databox,
+ XtNfromVert, cdimbox,
+ XtNjustify, XtJustifyLeft,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNlabel, "", NULL);
+ dimbox = XtVaCreateManagedWidget("dimbox", labelWidgetClass,
+ databox,
+ XtNfromVert, namebox,
+ XtNjustify, XtJustifyLeft,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNlabel, "", NULL);
+ rtbox = XtVaCreateManagedWidget("rtbox", labelWidgetClass,
+ databox,
+ XtNfromVert, dimbox,
+ XtNjustify, XtJustifyLeft,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNlabel, "", NULL);
+ origbox = XtVaCreateManagedWidget("origbox", labelWidgetClass,
+ databox,
+ XtNfromVert, rtbox,
+ XtNjustify, XtJustifyLeft,
+ XtNwidth, DMX_DATA_WIDTH,
+ XtNlabel, "", NULL);
+
+ /* Canvas */
+ canvasbox = XtVaCreateManagedWidget("canvasbox", boxWidgetClass,
+ bottombox,
+ XtNborderWidth, 0,
+ XtNwidth, DMX_CANVAS_WIDTH,
+ XtNheight, DMX_CANVAS_HEIGHT,
+ XtNfromHoriz, databox, NULL);
+
+ canvas = XtVaCreateManagedWidget("canvas", canvasWidgetClass,
+ canvasbox,
+ XtNwidth, DMX_CANVAS_WIDTH,
+ XtNheight, DMX_CANVAS_HEIGHT, NULL);
+
+ /* Main menu buttons */
+ filebutton = XtVaCreateManagedWidget("File", menuButtonWidgetClass,
+ menubox,
+ XtNmenuName, "filemenu", NULL);
+ helpbutton = XtVaCreateManagedWidget("Help", menuButtonWidgetClass,
+ menubox,
+ XtNmenuName, "helpmenu", NULL);
+
+ /* File submenu buttons */
+ filemenu = XtVaCreatePopupShell("filemenu", simpleMenuWidgetClass,
+ filebutton, NULL);
+ openbutton = XtVaCreateManagedWidget("Open File", smeBSBObjectClass,
+ filemenu, NULL);
+ savebutton = XtVaCreateManagedWidget("Save File", smeBSBObjectClass,
+ filemenu, NULL);
+ ncbutton = XtVaCreateManagedWidget("New Global", smeBSBObjectClass,
+ filemenu, NULL);
+ ecbutton = XtVaCreateManagedWidget("Edit Global", smeBSBObjectClass,
+ filemenu, NULL);
+ dcbutton = XtVaCreateManagedWidget("Delete Global", smeBSBObjectClass,
+ filemenu, NULL);
+ ndbutton0 = XtVaCreateManagedWidget("New Display", smeBSBObjectClass,
+ filemenu, NULL);
+ quitbutton = XtVaCreateManagedWidget("Quit", smeBSBObjectClass,
+ filemenu, NULL);
+
+ /* Help submenu button */
+ helpmenu = XtVaCreatePopupShell("helpmenu", simpleMenuWidgetClass,
+ helpbutton, NULL);
+ aboutbutton = XtVaCreateManagedWidget("About", smeBSBObjectClass,
+ helpmenu, NULL);
+
+ /* Open popup */
+ openpopup = XtVaCreatePopupShell("openpopup", transientShellWidgetClass,
+ toplevel, NULL);
+ opendialog = XtVaCreateManagedWidget("opendialog", dialogWidgetClass,
+ openpopup,
+ XtNlabel, "Filename: ",
+ XtNvalue, dmxConfigFilename, NULL);
+ okbutton = XtVaCreateManagedWidget("Open", commandWidgetClass,
+ opendialog, NULL);
+ canbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass,
+ opendialog, NULL);
+
+ /* EC popup */
+ ecpopup = XtVaCreatePopupShell("ecpopup", transientShellWidgetClass,
+ toplevel, NULL);
+ ecbox = XtVaCreateManagedWidget("ecbox", boxWidgetClass, ecpopup, NULL);
+ ecdialog0 = XtVaCreateManagedWidget("ecdialog0", dialogWidgetClass,
+ ecbox,
+ XtNlabel, "Name: ",
+ XtNvalue, "", NULL);
+ ecdialog1 = XtVaCreateManagedWidget("ecdialog1", dialogWidgetClass,
+ ecbox,
+ XtNlabel, "Dimension: ",
+ XtNvalue, "", NULL);
+ ecokbutton = XtVaCreateManagedWidget("OK", commandWidgetClass, ecbox, NULL);
+ eccanbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass,
+ ecbox, NULL);
+
+ /* ED popup */
+ edpopup = XtVaCreatePopupShell("edpopup", transientShellWidgetClass,
+ toplevel, NULL);
+ edbox = XtVaCreateManagedWidget("edbox", boxWidgetClass, edpopup, NULL);
+ eddialog0 = XtVaCreateManagedWidget("eddialog0", dialogWidgetClass,
+ edbox,
+ XtNlabel, "Display Name: ",
+ XtNvalue, "", NULL);
+ eddialog1 = XtVaCreateManagedWidget("eddialog1", dialogWidgetClass,
+ edbox,
+ XtNlabel, "Geometry: ",
+ XtNvalue, "", NULL);
+ eddialog2 = XtVaCreateManagedWidget("eddialog2", dialogWidgetClass,
+ edbox,
+ XtNlabel, "Offset: ",
+ XtNvalue, "", NULL);
+ edokbutton = XtVaCreateManagedWidget("OK", commandWidgetClass, edbox, NULL);
+ edcanbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass,
+ edbox, NULL);
+
+ /* About popup */
+ aboutpopup = XtVaCreatePopupShell("aboutpopup", transientShellWidgetClass,
+ toplevel, NULL);
+ aboutbox = XtVaCreateManagedWidget("aboutbox", boxWidgetClass,
+ aboutpopup, NULL);
+ XtVaCreateManagedWidget("abouttext", labelWidgetClass,
+ aboutbox, XtNlabel, DMX_INFO, NULL);
+ aboutok = XtVaCreateManagedWidget("OK", commandWidgetClass, aboutbox, NULL);
+
+ /* Quit popup */
+ quitpopup = XtVaCreatePopupShell("quitpopup", transientShellWidgetClass,
+ toplevel, NULL);
+ quitbox = XtVaCreateManagedWidget("quitbox", boxWidgetClass,
+ quitpopup, NULL);
+ XtVaCreateManagedWidget("quittext", labelWidgetClass,
+ quitbox,
+ XtNlabel,
+ "Changes to the configuration\n"
+ "been made that have not yet\n"
+ "been saved. Do you want to\n"
+ "quit without saving?", NULL);
+ quitok = XtVaCreateManagedWidget("Quit WITHOUT Saving",
+ commandWidgetClass, quitbox, NULL);
+ quitcan = XtVaCreateManagedWidget("Continue Editing",
+ commandWidgetClass, quitbox, NULL);
+
+ /* Button popup */
+ buttonpopup = XtVaCreatePopupShell("buttonpopup", simpleMenuWidgetClass,
+ toplevel, NULL);
+ ndbutton1 = XtVaCreateManagedWidget("New Display", smeBSBObjectClass,
+ buttonpopup, NULL);
+ edbutton = XtVaCreateManagedWidget("Edit Display", smeBSBObjectClass,
+ buttonpopup, NULL);
+ ddbutton = XtVaCreateManagedWidget("Delete Display", smeBSBObjectClass,
+ buttonpopup, NULL);
+
+ /* Callbacks */
+ XtAddCallback(openbutton, XtNcallback, dmxConfigOpenCallback, NULL);
+ XtAddCallback(savebutton, XtNcallback, dmxConfigSaveCallback, NULL);
+ XtAddCallback(okbutton, XtNcallback, dmxConfigOkCallback, NULL);
+ XtAddCallback(canbutton, XtNcallback, dmxConfigCanCallback, NULL);
+
XtAppAddActions(appContext, actiontable, XtNumber(actiontable));
XtOverrideTranslations(canvas, XtParseTranslationTable(canvastrans));
XtOverrideTranslations(XtNameToWidget(opendialog, "value"),
- XtParseTranslationTable(opentrans));
+ XtParseTranslationTable(opentrans));
XtOverrideTranslations(XtNameToWidget(ecdialog0, "value"),
- XtParseTranslationTable(opentrans));
+ XtParseTranslationTable(opentrans));
XtOverrideTranslations(XtNameToWidget(ecdialog1, "value"),
- XtParseTranslationTable(opentrans));
+ XtParseTranslationTable(opentrans));
XtOverrideTranslations(XtNameToWidget(eddialog0, "value"),
- XtParseTranslationTable(opentrans));
+ XtParseTranslationTable(opentrans));
XtOverrideTranslations(XtNameToWidget(eddialog1, "value"),
- XtParseTranslationTable(opentrans));
+ XtParseTranslationTable(opentrans));
XtOverrideTranslations(XtNameToWidget(eddialog2, "value"),
- XtParseTranslationTable(opentrans));
-
- XtAddCallback(ncbutton, XtNcallback, dmxConfigNCCallback, NULL);
- XtAddCallback(ecbutton, XtNcallback, dmxConfigECCallback, NULL);
- XtAddCallback(ecokbutton, XtNcallback, dmxConfigECOkCallback, NULL);
- XtAddCallback(eccanbutton, XtNcallback, dmxConfigECCanCallback, NULL);
- XtAddCallback(dcbutton, XtNcallback, dmxConfigDCCallback, NULL);
-
- XtAddCallback(ndbutton0, XtNcallback, dmxConfigNDCallback, NULL);
- XtAddCallback(ndbutton1, XtNcallback, dmxConfigNDCallback, NULL);
- XtAddCallback(edbutton, XtNcallback, dmxConfigEDCallback, NULL);
- XtAddCallback(ddbutton, XtNcallback, dmxConfigDDCallback, NULL);
- XtAddCallback(edokbutton, XtNcallback, dmxConfigEDOkCallback, NULL);
- XtAddCallback(edcanbutton, XtNcallback, dmxConfigEDCanCallback, NULL);
-
- XtAddCallback(aboutbutton, XtNcallback, dmxConfigAboutCallback, NULL);
- XtAddCallback(aboutok, XtNcallback, dmxConfigAboutOkCallback, NULL);
- XtAddCallback(quitok, XtNcallback, dmxConfigQuitOkCallback, NULL);
- XtAddCallback(quitcan, XtNcallback, dmxConfigQuitCanCallback, NULL);
-
- XtAddCallback(quitbutton, XtNcallback, dmxConfigQuitCallback, NULL);
-
- XtAddCallback(canvas, XtNcallback, dmxConfigCanvasInput, NULL);
- XtAddCallback(canvas, XtNcanvasExposeCallback, dmxConfigCanvasExpose,NULL);
- XtAddCallback(canvas, XtNcanvasResizeCallback, dmxConfigCanvasResize,NULL);
-
- if (dmxConfigFilename) dmxConfigReadFile();
-
+ XtParseTranslationTable(opentrans));
+
+ XtAddCallback(ncbutton, XtNcallback, dmxConfigNCCallback, NULL);
+ XtAddCallback(ecbutton, XtNcallback, dmxConfigECCallback, NULL);
+ XtAddCallback(ecokbutton, XtNcallback, dmxConfigECOkCallback, NULL);
+ XtAddCallback(eccanbutton, XtNcallback, dmxConfigECCanCallback, NULL);
+ XtAddCallback(dcbutton, XtNcallback, dmxConfigDCCallback, NULL);
+
+ XtAddCallback(ndbutton0, XtNcallback, dmxConfigNDCallback, NULL);
+ XtAddCallback(ndbutton1, XtNcallback, dmxConfigNDCallback, NULL);
+ XtAddCallback(edbutton, XtNcallback, dmxConfigEDCallback, NULL);
+ XtAddCallback(ddbutton, XtNcallback, dmxConfigDDCallback, NULL);
+ XtAddCallback(edokbutton, XtNcallback, dmxConfigEDOkCallback, NULL);
+ XtAddCallback(edcanbutton, XtNcallback, dmxConfigEDCanCallback, NULL);
+
+ XtAddCallback(aboutbutton, XtNcallback, dmxConfigAboutCallback, NULL);
+ XtAddCallback(aboutok, XtNcallback, dmxConfigAboutOkCallback, NULL);
+ XtAddCallback(quitok, XtNcallback, dmxConfigQuitOkCallback, NULL);
+ XtAddCallback(quitcan, XtNcallback, dmxConfigQuitCanCallback, NULL);
+
+ XtAddCallback(quitbutton, XtNcallback, dmxConfigQuitCallback, NULL);
+
+ XtAddCallback(canvas, XtNcallback, dmxConfigCanvasInput, NULL);
+ XtAddCallback(canvas, XtNcanvasExposeCallback, dmxConfigCanvasExpose, NULL);
+ XtAddCallback(canvas, XtNcanvasResizeCallback, dmxConfigCanvasResize, NULL);
+
+ if (dmxConfigFilename)
+ dmxConfigReadFile();
+
XtRealizeWidget(toplevel);
dmxConfigCopystrings();
dmxConfigSetupCnamemenu();
diff --git a/xorg-server/hw/dmx/dmx.c b/xorg-server/hw/dmx/dmx.c
index 01a744849..add0e5390 100644
--- a/xorg-server/hw/dmx/dmx.c
+++ b/xorg-server/hw/dmx/dmx.c
@@ -62,16 +62,15 @@
#ifdef PANORAMIX
#include "panoramiX.h"
extern unsigned long XRT_WINDOW;
-extern int PanoramiXNumScreens;
+extern int PanoramiXNumScreens;
#endif
extern void DMXExtensionInit(void);
static unsigned char DMXCode;
-
-
-static int _DMXXineramaActive(void)
+static int
+_DMXXineramaActive(void)
{
#ifdef PANORAMIX
return !noPanoramiXExtension;
@@ -79,31 +78,51 @@ static int _DMXXineramaActive(void)
return 0;
}
-static void dmxSetScreenAttribute(int bit, DMXScreenAttributesPtr attr,
- CARD32 value)
+static void
+dmxSetScreenAttribute(int bit, DMXScreenAttributesPtr attr, CARD32 value)
{
switch (1 << bit) {
- case DMXScreenWindowWidth: attr->screenWindowWidth = value; break;
- case DMXScreenWindowHeight: attr->screenWindowHeight = value; break;
- case DMXScreenWindowXoffset: attr->screenWindowXoffset = value; break;
- case DMXScreenWindowYoffset: attr->screenWindowYoffset = value; break;
- case DMXRootWindowWidth: attr->rootWindowWidth = value; break;
- case DMXRootWindowHeight: attr->rootWindowHeight = value; break;
- case DMXRootWindowXoffset: attr->rootWindowXoffset = value; break;
- case DMXRootWindowYoffset: attr->rootWindowYoffset = value; break;
- case DMXRootWindowXorigin: attr->rootWindowXorigin = value; break;
- case DMXRootWindowYorigin: attr->rootWindowYorigin = value; break;
+ case DMXScreenWindowWidth:
+ attr->screenWindowWidth = value;
+ break;
+ case DMXScreenWindowHeight:
+ attr->screenWindowHeight = value;
+ break;
+ case DMXScreenWindowXoffset:
+ attr->screenWindowXoffset = value;
+ break;
+ case DMXScreenWindowYoffset:
+ attr->screenWindowYoffset = value;
+ break;
+ case DMXRootWindowWidth:
+ attr->rootWindowWidth = value;
+ break;
+ case DMXRootWindowHeight:
+ attr->rootWindowHeight = value;
+ break;
+ case DMXRootWindowXoffset:
+ attr->rootWindowXoffset = value;
+ break;
+ case DMXRootWindowYoffset:
+ attr->rootWindowYoffset = value;
+ break;
+ case DMXRootWindowXorigin:
+ attr->rootWindowXorigin = value;
+ break;
+ case DMXRootWindowYorigin:
+ attr->rootWindowYorigin = value;
+ break;
}
}
-static int dmxFetchScreenAttributes(unsigned int mask,
- DMXScreenAttributesPtr attr,
- CARD32 *value_list)
+static int
+dmxFetchScreenAttributes(unsigned int mask,
+ DMXScreenAttributesPtr attr, CARD32 *value_list)
{
- int i;
+ int i;
CARD32 *value = value_list;
- int count = 0;
-
+ int count = 0;
+
for (i = 0; i < 32; i++) {
if (mask & (1 << i)) {
dmxSetScreenAttribute(i, attr, *value);
@@ -114,52 +133,66 @@ static int dmxFetchScreenAttributes(unsigned int mask,
return count;
}
-static void dmxSetDesktopAttribute(int bit, DMXDesktopAttributesPtr attr,
- CARD32 value)
+static void
+dmxSetDesktopAttribute(int bit, DMXDesktopAttributesPtr attr, CARD32 value)
{
switch (1 << bit) {
- case DMXDesktopWidth: attr->width = value; break;
- case DMXDesktopHeight: attr->height = value; break;
- case DMXDesktopShiftX: attr->shiftX = value; break;
- case DMXDesktopShiftY: attr->shiftY = value; break;
+ case DMXDesktopWidth:
+ attr->width = value;
+ break;
+ case DMXDesktopHeight:
+ attr->height = value;
+ break;
+ case DMXDesktopShiftX:
+ attr->shiftX = value;
+ break;
+ case DMXDesktopShiftY:
+ attr->shiftY = value;
+ break;
}
}
-static int dmxFetchDesktopAttributes(unsigned int mask,
- DMXDesktopAttributesPtr attr,
- CARD32 *value_list)
+static int
+dmxFetchDesktopAttributes(unsigned int mask,
+ DMXDesktopAttributesPtr attr, CARD32 *value_list)
{
- int i;
+ int i;
CARD32 *value = value_list;
- int count = 0;
-
+ int count = 0;
+
for (i = 0; i < 32; i++) {
if (mask & (1 << i)) {
dmxSetDesktopAttribute(i, attr, *value);
- ++value;
+ ++value;
++count;
}
}
return count;
}
-static void dmxSetInputAttribute(int bit, DMXInputAttributesPtr attr,
- CARD32 value)
+static void
+dmxSetInputAttribute(int bit, DMXInputAttributesPtr attr, CARD32 value)
{
switch (1 << bit) {
- case DMXInputType: attr->inputType = value; break;
- case DMXInputPhysicalScreen: attr->physicalScreen = value; break;
- case DMXInputSendsCore: attr->sendsCore = !!value; break;
+ case DMXInputType:
+ attr->inputType = value;
+ break;
+ case DMXInputPhysicalScreen:
+ attr->physicalScreen = value;
+ break;
+ case DMXInputSendsCore:
+ attr->sendsCore = ! !value;
+ break;
}
}
-static int dmxFetchInputAttributes(unsigned int mask,
- DMXInputAttributesPtr attr,
- CARD32 *value_list)
+static int
+dmxFetchInputAttributes(unsigned int mask,
+ DMXInputAttributesPtr attr, CARD32 *value_list)
{
- int i;
+ int i;
CARD32 *value = value_list;
- int count = 0;
+ int count = 0;
for (i = 0; i < 32; i++) {
if (mask & (1 << i)) {
@@ -171,30 +204,32 @@ static int dmxFetchInputAttributes(unsigned int mask,
return count;
}
-static int ProcDMXQueryVersion(ClientPtr client)
+static int
+ProcDMXQueryVersion(ClientPtr client)
{
xDMXQueryVersionReply rep;
REQUEST_SIZE_MATCH(xDMXQueryVersionReq);
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.majorVersion = SERVER_DMX_MAJOR_VERSION;
- rep.minorVersion = SERVER_DMX_MINOR_VERSION;
- rep.patchVersion = SERVER_DMX_PATCH_VERSION;
+ rep.length = 0;
+ rep.majorVersion = SERVER_DMX_MAJOR_VERSION;
+ rep.minorVersion = SERVER_DMX_MINOR_VERSION;
+ rep.patchVersion = SERVER_DMX_PATCH_VERSION;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.majorVersion);
- swapl(&rep.minorVersion);
- swapl(&rep.patchVersion);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swapl(&rep.majorVersion);
+ swapl(&rep.minorVersion);
+ swapl(&rep.patchVersion);
}
- WriteToClient(client, sizeof(xDMXQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDMXQueryVersionReply), (char *) &rep);
return Success;
}
-static int ProcDMXSync(ClientPtr client)
+static int
+ProcDMXSync(ClientPtr client)
{
xDMXSyncReply rep;
@@ -202,41 +237,43 @@ static int ProcDMXSync(ClientPtr client)
dmxFlushPendingSyncs();
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = 0;
+ rep.length = 0;
+ rep.status = 0;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.status);
}
- WriteToClient(client, sizeof(xDMXSyncReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDMXSyncReply), (char *) &rep);
return Success;
}
-static int ProcDMXForceWindowCreation(ClientPtr client)
+static int
+ProcDMXForceWindowCreation(ClientPtr client)
{
xDMXForceWindowCreationReply rep;
+
REQUEST(xDMXForceWindowCreationReq);
- WindowPtr pWin;
+ WindowPtr pWin;
REQUEST_SIZE_MATCH(xDMXForceWindowCreationReq);
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
PanoramiXRes *win;
- int i;
+ int i;
- if (Success != dixLookupResourceByType((pointer*) &win,
- stuff->window, XRT_WINDOW,
- client, DixReadAccess))
- return -1; /* BadWindow */
+ if (Success != dixLookupResourceByType((pointer *) &win,
+ stuff->window, XRT_WINDOW,
+ client, DixReadAccess))
+ return -1; /* BadWindow */
FOR_NSCREENS(i) {
if (Success != dixLookupWindow(&pWin, win->info[i].id, client,
- DixReadAccess))
- return -1; /* BadWindow */
+ DixReadAccess))
+ return -1; /* BadWindow */
dmxForceWindowCreation(pWin);
}
@@ -244,80 +281,84 @@ static int ProcDMXForceWindowCreation(ClientPtr client)
}
#endif
- if (Success != dixLookupWindow(&pWin, stuff->window, client,
- DixReadAccess))
- return -1; /* BadWindow */
+ if (Success != dixLookupWindow(&pWin, stuff->window, client, DixReadAccess))
+ return -1; /* BadWindow */
dmxForceWindowCreation(pWin);
- doreply:
+ doreply:
dmxFlushPendingSyncs();
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = 0;
+ rep.length = 0;
+ rep.status = 0;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.status);
}
- WriteToClient(client, sizeof(xDMXForceWindowCreationReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDMXForceWindowCreationReply), (char *) &rep);
return Success;
}
-static int ProcDMXGetScreenCount(ClientPtr client)
+static int
+ProcDMXGetScreenCount(ClientPtr client)
{
xDMXGetScreenCountReply rep;
REQUEST_SIZE_MATCH(xDMXGetScreenCountReq);
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.screenCount = dmxGetNumScreens();
+ rep.length = 0;
+ rep.screenCount = dmxGetNumScreens();
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.screenCount);
}
- WriteToClient(client, sizeof(xDMXGetScreenCountReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDMXGetScreenCountReply), (char *) &rep);
return Success;
}
-static int ProcDMXGetScreenAttributes(ClientPtr client)
+static int
+ProcDMXGetScreenAttributes(ClientPtr client)
{
REQUEST(xDMXGetScreenAttributesReq);
xDMXGetScreenAttributesReply rep;
- int length;
- int paddedLength;
- DMXScreenAttributesRec attr;
+ int length;
+ int paddedLength;
+ DMXScreenAttributesRec attr;
REQUEST_SIZE_MATCH(xDMXGetScreenAttributesReq);
if (stuff->physicalScreen < 0
- || stuff->physicalScreen >= dmxGetNumScreens()) return BadValue;
+ || stuff->physicalScreen >= dmxGetNumScreens())
+ return BadValue;
if (!dmxGetScreenAttributes(stuff->physicalScreen, &attr))
return BadValue;
- rep.logicalScreen = attr.logicalScreen;
- rep.screenWindowWidth = attr.screenWindowWidth;
- rep.screenWindowHeight = attr.screenWindowHeight;
+ rep.logicalScreen = attr.logicalScreen;
+ rep.screenWindowWidth = attr.screenWindowWidth;
+ rep.screenWindowHeight = attr.screenWindowHeight;
rep.screenWindowXoffset = attr.screenWindowXoffset;
rep.screenWindowYoffset = attr.screenWindowYoffset;
- rep.rootWindowWidth = attr.rootWindowWidth;
- rep.rootWindowHeight = attr.rootWindowHeight;
- rep.rootWindowXoffset = attr.rootWindowXoffset;
- rep.rootWindowYoffset = attr.rootWindowYoffset;
- rep.rootWindowXorigin = attr.rootWindowXorigin;
- rep.rootWindowYorigin = attr.rootWindowYorigin;
-
- length = attr.displayName ? strlen(attr.displayName) : 0;
- paddedLength = pad_to_int32(length);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = bytes_to_int32((sizeof(xDMXGetScreenAttributesReply) - sizeof(xGenericReply))
- + paddedLength);
- rep.displayNameLength = length;
+ rep.rootWindowWidth = attr.rootWindowWidth;
+ rep.rootWindowHeight = attr.rootWindowHeight;
+ rep.rootWindowXoffset = attr.rootWindowXoffset;
+ rep.rootWindowYoffset = attr.rootWindowYoffset;
+ rep.rootWindowXorigin = attr.rootWindowXorigin;
+ rep.rootWindowYorigin = attr.rootWindowYorigin;
+
+ length = attr.displayName ? strlen(attr.displayName) : 0;
+ paddedLength = pad_to_int32(length);
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length =
+ bytes_to_int32((sizeof(xDMXGetScreenAttributesReply) -
+ sizeof(xGenericReply))
+ + paddedLength);
+ rep.displayNameLength = length;
if (client->swapped) {
swaps(&rep.sequenceNumber);
@@ -335,49 +376,55 @@ static int ProcDMXGetScreenAttributes(ClientPtr client)
swaps(&rep.rootWindowXorigin);
swaps(&rep.rootWindowYorigin);
}
- WriteToClient(client, sizeof(xDMXGetScreenAttributesReply), (char *)&rep);
- if (length) WriteToClient(client, length, (char *)attr.displayName);
+ WriteToClient(client, sizeof(xDMXGetScreenAttributesReply), (char *) &rep);
+ if (length)
+ WriteToClient(client, length, (char *) attr.displayName);
return Success;
}
-static int ProcDMXChangeScreensAttributes(ClientPtr client)
+static int
+ProcDMXChangeScreensAttributes(ClientPtr client)
{
REQUEST(xDMXChangeScreensAttributesReq);
xDMXChangeScreensAttributesReply rep;
- int status = DMX_BAD_XINERAMA;
- unsigned int mask = 0;
- unsigned int i;
- CARD32 *screen_list;
- CARD32 *mask_list;
- CARD32 *value_list;
- DMXScreenAttributesPtr attribs;
- int errorScreen = 0;
- unsigned int len;
- int ones = 0;
-
+ int status = DMX_BAD_XINERAMA;
+ unsigned int mask = 0;
+ unsigned int i;
+ CARD32 *screen_list;
+ CARD32 *mask_list;
+ CARD32 *value_list;
+ DMXScreenAttributesPtr attribs;
+ int errorScreen = 0;
+ unsigned int len;
+ int ones = 0;
REQUEST_AT_LEAST_SIZE(xDMXChangeScreensAttributesReq);
- len = client->req_len - bytes_to_int32(sizeof(xDMXChangeScreensAttributesReq));
+ len =
+ client->req_len -
+ bytes_to_int32(sizeof(xDMXChangeScreensAttributesReq));
if (len < stuff->screenCount + stuff->maskCount)
return BadLength;
- screen_list = (CARD32 *)(stuff + 1);
- mask_list = &screen_list[stuff->screenCount];
- value_list = &mask_list[stuff->maskCount];
+ screen_list = (CARD32 *) (stuff + 1);
+ mask_list = &screen_list[stuff->screenCount];
+ value_list = &mask_list[stuff->maskCount];
- for (i = 0; i < stuff->maskCount; i++) ones += Ones(mask_list[i]);
+ for (i = 0; i < stuff->maskCount; i++)
+ ones += Ones(mask_list[i]);
if (len != stuff->screenCount + stuff->maskCount + ones)
return BadLength;
-
- if (!_DMXXineramaActive()) goto noxinerama;
+
+ if (!_DMXXineramaActive())
+ goto noxinerama;
if (!(attribs = malloc(stuff->screenCount * sizeof(*attribs))))
return BadAlloc;
for (i = 0; i < stuff->screenCount; i++) {
int count;
-
- if (i < stuff->maskCount) mask = mask_list[i];
+
+ if (i < stuff->maskCount)
+ mask = mask_list[i];
dmxGetScreenAttributes(screen_list[i], &attribs[i]);
count = dmxFetchScreenAttributes(mask, &attribs[i], value_list);
value_list += count;
@@ -385,21 +432,20 @@ static int ProcDMXChangeScreensAttributes(ClientPtr client)
#if PANORAMIX
status = dmxConfigureScreenWindows(stuff->screenCount,
- screen_list,
- attribs,
- &errorScreen);
+ screen_list, attribs, &errorScreen);
#endif
free(attribs);
- if (status == BadValue) return status;
+ if (status == BadValue)
+ return status;
- noxinerama:
- rep.type = X_Reply;
+ noxinerama:
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
- rep.errorScreen = errorScreen;
+ rep.length = 0;
+ rep.status = status;
+ rep.errorScreen = errorScreen;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -407,34 +453,34 @@ static int ProcDMXChangeScreensAttributes(ClientPtr client)
swapl(&rep.errorScreen);
}
WriteToClient(client,
- sizeof(xDMXChangeScreensAttributesReply),
- (char *)&rep);
+ sizeof(xDMXChangeScreensAttributesReply), (char *) &rep);
return Success;
}
-static int ProcDMXAddScreen(ClientPtr client)
+static int
+ProcDMXAddScreen(ClientPtr client)
{
REQUEST(xDMXAddScreenReq);
- xDMXAddScreenReply rep;
- int status = 0;
- CARD32 *value_list;
+ xDMXAddScreenReply rep;
+ int status = 0;
+ CARD32 *value_list;
DMXScreenAttributesRec attr;
- int count;
- char *name;
- int len;
- int paddedLength;
+ int count;
+ char *name;
+ int len;
+ int paddedLength;
REQUEST_AT_LEAST_SIZE(xDMXAddScreenReq);
paddedLength = pad_to_int32(stuff->displayNameLength);
- len = client->req_len - bytes_to_int32(sizeof(xDMXAddScreenReq));
- if (len != Ones(stuff->valueMask) + paddedLength/4)
+ len = client->req_len - bytes_to_int32(sizeof(xDMXAddScreenReq));
+ if (len != Ones(stuff->valueMask) + paddedLength / 4)
return BadLength;
memset(&attr, 0, sizeof(attr));
dmxGetScreenAttributes(stuff->physicalScreen, &attr);
- value_list = (CARD32 *)(stuff + 1);
- count = dmxFetchScreenAttributes(stuff->valueMask, &attr, value_list);
-
+ value_list = (CARD32 *) (stuff + 1);
+ count = dmxFetchScreenAttributes(stuff->valueMask, &attr, value_list);
+
if (!(name = malloc(stuff->displayNameLength + 1 + 4)))
return BadAlloc;
memcpy(name, &value_list[count], stuff->displayNameLength);
@@ -445,10 +491,10 @@ static int ProcDMXAddScreen(ClientPtr client)
free(name);
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
+ rep.length = 0;
+ rep.status = status;
rep.physicalScreen = stuff->physicalScreen;
if (client->swapped) {
swaps(&rep.sequenceNumber);
@@ -456,63 +502,60 @@ static int ProcDMXAddScreen(ClientPtr client)
swapl(&rep.status);
swapl(&rep.physicalScreen);
}
- WriteToClient(client,
- sizeof(xDMXAddScreenReply),
- (char *)&rep);
+ WriteToClient(client, sizeof(xDMXAddScreenReply), (char *) &rep);
return Success;
}
-static int ProcDMXRemoveScreen(ClientPtr client)
+static int
+ProcDMXRemoveScreen(ClientPtr client)
{
REQUEST(xDMXRemoveScreenReq);
xDMXRemoveScreenReply rep;
- int status = 0;
+ int status = 0;
REQUEST_SIZE_MATCH(xDMXRemoveScreenReq);
status = dmxDetachScreen(stuff->physicalScreen);
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
+ rep.length = 0;
+ rep.status = status;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.status);
}
- WriteToClient(client,
- sizeof(xDMXRemoveScreenReply),
- (char *)&rep);
+ WriteToClient(client, sizeof(xDMXRemoveScreenReply), (char *) &rep);
return Success;
}
-
#ifdef PANORAMIX
-static int dmxPopulatePanoramiX(ClientPtr client, Window window,
- CARD32 *screens, CARD32 *windows,
- xRectangle *pos, xRectangle *vis)
+static int
+dmxPopulatePanoramiX(ClientPtr client, Window window,
+ CARD32 *screens, CARD32 *windows,
+ xRectangle *pos, xRectangle *vis)
{
- WindowPtr pWin;
- PanoramiXRes *win;
- int i;
- int count = 0;
+ WindowPtr pWin;
+ PanoramiXRes *win;
+ int i;
+ int count = 0;
DMXWindowAttributesRec attr;
-
- if (Success != dixLookupResourceByType((pointer*) &win,
- window, XRT_WINDOW,
- client, DixReadAccess))
- return -1; /* BadWindow */
-
+
+ if (Success != dixLookupResourceByType((pointer *) &win,
+ window, XRT_WINDOW,
+ client, DixReadAccess))
+ return -1; /* BadWindow */
+
FOR_NSCREENS(i) {
if (Success != dixLookupWindow(&pWin, win->info[i].id, client,
- DixReadAccess))
+ DixReadAccess))
return -1; /* BadWindow */
if (dmxGetWindowAttributes(pWin, &attr)) {
screens[count] = attr.screen;
windows[count] = attr.window;
- pos[count] = attr.pos;
- vis[count] = attr.vis;
+ pos[count] = attr.pos;
+ vis[count] = attr.vis;
++count; /* Only count existing windows */
}
}
@@ -520,46 +563,49 @@ static int dmxPopulatePanoramiX(ClientPtr client, Window window,
}
#endif
-static int dmxPopulate(ClientPtr client, Window window, CARD32 *screens,
- CARD32 *windows, xRectangle *pos, xRectangle *vis)
+static int
+dmxPopulate(ClientPtr client, Window window, CARD32 *screens,
+ CARD32 *windows, xRectangle *pos, xRectangle *vis)
{
- WindowPtr pWin;
+ WindowPtr pWin;
DMXWindowAttributesRec attr;
#ifdef PANORAMIX
if (!noPanoramiXExtension)
- return dmxPopulatePanoramiX(client, window, screens, windows,
- pos, vis);
+ return dmxPopulatePanoramiX(client, window, screens, windows, pos, vis);
#endif
-
+
if (Success != dixLookupWindow(&pWin, window, client, DixReadAccess))
- return -1; /* BadWindow */
+ return -1; /* BadWindow */
dmxGetWindowAttributes(pWin, &attr);
*screens = attr.screen;
*windows = attr.window;
- *pos = attr.pos;
- *vis = attr.vis;
+ *pos = attr.pos;
+ *vis = attr.vis;
return 1;
}
-static int dmxMaxNumScreens(void)
+static int
+dmxMaxNumScreens(void)
{
#ifdef PANORAMIX
- if (!noPanoramiXExtension) return PanoramiXNumScreens;
+ if (!noPanoramiXExtension)
+ return PanoramiXNumScreens;
#endif
return 1;
}
-static int ProcDMXGetWindowAttributes(ClientPtr client)
+static int
+ProcDMXGetWindowAttributes(ClientPtr client)
{
REQUEST(xDMXGetWindowAttributesReq);
xDMXGetWindowAttributesReply rep;
- int i;
- CARD32 *screens;
- CARD32 *windows;
- xRectangle *pos, *vis;
- int count = dmxMaxNumScreens();
+ int i;
+ CARD32 *screens;
+ CARD32 *windows;
+ xRectangle *pos, *vis;
+ int count = dmxMaxNumScreens();
REQUEST_SIZE_MATCH(xDMXGetWindowAttributesReq);
@@ -590,10 +636,10 @@ static int ProcDMXGetWindowAttributes(ClientPtr client)
return BadWindow;
}
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = count * 6;
- rep.screenCount = count;
+ rep.length = count * 6;
+ rep.screenCount = count;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -601,12 +647,12 @@ static int ProcDMXGetWindowAttributes(ClientPtr client)
for (i = 0; i < count; i++) {
swapl(&screens[i]);
swapl(&windows[i]);
-
+
swaps(&pos[i].x);
swaps(&pos[i].y);
swaps(&pos[i].width);
swaps(&pos[i].height);
-
+
swaps(&vis[i].x);
swaps(&vis[i].y);
swaps(&vis[i].width);
@@ -616,12 +662,12 @@ static int ProcDMXGetWindowAttributes(ClientPtr client)
dmxFlushPendingSyncs();
- WriteToClient(client, sizeof(xDMXGetWindowAttributesReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDMXGetWindowAttributesReply), (char *) &rep);
if (count) {
- WriteToClient(client, count * sizeof(*screens), (char *)screens);
- WriteToClient(client, count * sizeof(*windows), (char *)windows);
- WriteToClient(client, count * sizeof(*pos), (char *)pos);
- WriteToClient(client, count * sizeof(*vis), (char *)vis);
+ WriteToClient(client, count * sizeof(*screens), (char *) screens);
+ WriteToClient(client, count * sizeof(*windows), (char *) windows);
+ WriteToClient(client, count * sizeof(*pos), (char *) pos);
+ WriteToClient(client, count * sizeof(*vis), (char *) vis);
}
free(vis);
@@ -632,23 +678,24 @@ static int ProcDMXGetWindowAttributes(ClientPtr client)
return Success;
}
-static int ProcDMXGetDesktopAttributes(ClientPtr client)
+static int
+ProcDMXGetDesktopAttributes(ClientPtr client)
{
xDMXGetDesktopAttributesReply rep;
- DMXDesktopAttributesRec attr;
+ DMXDesktopAttributesRec attr;
REQUEST_SIZE_MATCH(xDMXGetDesktopAttributesReq);
dmxGetDesktopAttributes(&attr);
- rep.width = attr.width;
- rep.height = attr.height;
- rep.shiftX = attr.shiftX;
- rep.shiftY = attr.shiftY;
+ rep.width = attr.width;
+ rep.height = attr.height;
+ rep.shiftX = attr.shiftX;
+ rep.shiftY = attr.shiftY;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
+ rep.type = X_Reply;
+ rep.sequenceNumber = client->sequence;
+ rep.length = 0;
if (client->swapped) {
swaps(&rep.sequenceNumber);
@@ -658,95 +705,100 @@ static int ProcDMXGetDesktopAttributes(ClientPtr client)
swaps(&rep.shiftX);
swaps(&rep.shiftY);
}
- WriteToClient(client, sizeof(xDMXGetDesktopAttributesReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDMXGetDesktopAttributesReply), (char *) &rep);
return Success;
}
-static int ProcDMXChangeDesktopAttributes(ClientPtr client)
+static int
+ProcDMXChangeDesktopAttributes(ClientPtr client)
{
REQUEST(xDMXChangeDesktopAttributesReq);
xDMXChangeDesktopAttributesReply rep;
- int status = DMX_BAD_XINERAMA;
- CARD32 *value_list;
- DMXDesktopAttributesRec attr;
- int len;
+ int status = DMX_BAD_XINERAMA;
+ CARD32 *value_list;
+ DMXDesktopAttributesRec attr;
+ int len;
REQUEST_AT_LEAST_SIZE(xDMXChangeDesktopAttributesReq);
len = client->req_len - (sizeof(xDMXChangeDesktopAttributesReq) >> 2);
if (len != Ones(stuff->valueMask))
return BadLength;
- if (!_DMXXineramaActive()) goto noxinerama;
+ if (!_DMXXineramaActive())
+ goto noxinerama;
+
+ value_list = (CARD32 *) (stuff + 1);
- value_list = (CARD32 *)(stuff + 1);
-
dmxGetDesktopAttributes(&attr);
dmxFetchDesktopAttributes(stuff->valueMask, &attr, value_list);
#if PANORAMIX
status = dmxConfigureDesktop(&attr);
#endif
- if (status == BadValue) return status;
+ if (status == BadValue)
+ return status;
- noxinerama:
- rep.type = X_Reply;
+ noxinerama:
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
+ rep.length = 0;
+ rep.status = status;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.status);
}
WriteToClient(client,
- sizeof(xDMXChangeDesktopAttributesReply),
- (char *)&rep);
+ sizeof(xDMXChangeDesktopAttributesReply), (char *) &rep);
return Success;
}
-static int ProcDMXGetInputCount(ClientPtr client)
+static int
+ProcDMXGetInputCount(ClientPtr client)
{
xDMXGetInputCountReply rep;
REQUEST_SIZE_MATCH(xDMXGetInputCountReq);
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.inputCount = dmxGetInputCount();
+ rep.length = 0;
+ rep.inputCount = dmxGetInputCount();
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.inputCount);
}
- WriteToClient(client, sizeof(xDMXGetInputCountReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDMXGetInputCountReply), (char *) &rep);
return Success;
}
-static int ProcDMXGetInputAttributes(ClientPtr client)
+static int
+ProcDMXGetInputAttributes(ClientPtr client)
{
REQUEST(xDMXGetInputAttributesReq);
xDMXGetInputAttributesReply rep;
- int length;
- int paddedLength;
- DMXInputAttributesRec attr;
+ int length;
+ int paddedLength;
+ DMXInputAttributesRec attr;
REQUEST_SIZE_MATCH(xDMXGetInputAttributesReq);
- if (dmxGetInputAttributes(stuff->deviceId, &attr)) return BadValue;
- rep.inputType = attr.inputType;
+ if (dmxGetInputAttributes(stuff->deviceId, &attr))
+ return BadValue;
+ rep.inputType = attr.inputType;
rep.physicalScreen = attr.physicalScreen;
- rep.physicalId = attr.physicalId;
- rep.isCore = attr.isCore;
- rep.sendsCore = attr.sendsCore;
- rep.detached = attr.detached;
-
- length = attr.name ? strlen(attr.name) : 0;
- paddedLength = pad_to_int32(length);
- rep.type = X_Reply;
+ rep.physicalId = attr.physicalId;
+ rep.isCore = attr.isCore;
+ rep.sendsCore = attr.sendsCore;
+ rep.detached = attr.detached;
+
+ length = attr.name ? strlen(attr.name) : 0;
+ paddedLength = pad_to_int32(length);
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = bytes_to_int32(paddedLength);
- rep.nameLength = length;
+ rep.length = bytes_to_int32(paddedLength);
+ rep.nameLength = length;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -755,34 +807,36 @@ static int ProcDMXGetInputAttributes(ClientPtr client)
swapl(&rep.physicalId);
swapl(&rep.nameLength);
}
- WriteToClient(client, sizeof(xDMXGetInputAttributesReply), (char *)&rep);
- if (length) WriteToClient(client, length, (char *)attr.name);
+ WriteToClient(client, sizeof(xDMXGetInputAttributesReply), (char *) &rep);
+ if (length)
+ WriteToClient(client, length, (char *) attr.name);
return Success;
}
-static int ProcDMXAddInput(ClientPtr client)
+static int
+ProcDMXAddInput(ClientPtr client)
{
REQUEST(xDMXAddInputReq);
- xDMXAddInputReply rep;
- int status = 0;
- CARD32 *value_list;
- DMXInputAttributesRec attr;
- int count;
- char *name;
- int len;
- int paddedLength;
- int id = -1;
+ xDMXAddInputReply rep;
+ int status = 0;
+ CARD32 *value_list;
+ DMXInputAttributesRec attr;
+ int count;
+ char *name;
+ int len;
+ int paddedLength;
+ int id = -1;
REQUEST_AT_LEAST_SIZE(xDMXAddInputReq);
paddedLength = pad_to_int32(stuff->displayNameLength);
- len = client->req_len - (sizeof(xDMXAddInputReq) >> 2);
- if (len != Ones(stuff->valueMask) + paddedLength/4)
+ len = client->req_len - (sizeof(xDMXAddInputReq) >> 2);
+ if (len != Ones(stuff->valueMask) + paddedLength / 4)
return BadLength;
memset(&attr, 0, sizeof(attr));
- value_list = (CARD32 *)(stuff + 1);
- count = dmxFetchInputAttributes(stuff->valueMask, &attr, value_list);
-
+ value_list = (CARD32 *) (stuff + 1);
+ count = dmxFetchInputAttributes(stuff->valueMask, &attr, value_list);
+
if (!(name = malloc(stuff->displayNameLength + 1 + 4)))
return BadAlloc;
memcpy(name, &value_list[count], stuff->displayNameLength);
@@ -793,81 +847,100 @@ static int ProcDMXAddInput(ClientPtr client)
free(name);
- if (status) return status;
+ if (status)
+ return status;
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
- rep.physicalId = id;
+ rep.length = 0;
+ rep.status = status;
+ rep.physicalId = id;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.status);
swapl(&rep.physicalId);
}
- WriteToClient(client, sizeof(xDMXAddInputReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDMXAddInputReply), (char *) &rep);
return Success;
}
-static int ProcDMXRemoveInput(ClientPtr client)
+static int
+ProcDMXRemoveInput(ClientPtr client)
{
REQUEST(xDMXRemoveInputReq);
- xDMXRemoveInputReply rep;
- int status = 0;
+ xDMXRemoveInputReply rep;
+ int status = 0;
REQUEST_SIZE_MATCH(xDMXRemoveInputReq);
status = dmxRemoveInput(stuff->physicalId);
- if (status) return status;
+ if (status)
+ return status;
- rep.type = X_Reply;
+ rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.status = status;
+ rep.length = 0;
+ rep.status = status;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.status);
}
- WriteToClient(client, sizeof(xDMXRemoveInputReply), (char *)&rep);
+ WriteToClient(client, sizeof(xDMXRemoveInputReply), (char *) &rep);
return Success;
}
-static int ProcDMXDispatch(ClientPtr client)
+static int
+ProcDMXDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
- case X_DMXQueryVersion: return ProcDMXQueryVersion(client);
- case X_DMXSync: return ProcDMXSync(client);
- case X_DMXForceWindowCreation: return ProcDMXForceWindowCreation(client);
- case X_DMXGetScreenCount: return ProcDMXGetScreenCount(client);
- case X_DMXGetScreenAttributes: return ProcDMXGetScreenAttributes(client);
+ case X_DMXQueryVersion:
+ return ProcDMXQueryVersion(client);
+ case X_DMXSync:
+ return ProcDMXSync(client);
+ case X_DMXForceWindowCreation:
+ return ProcDMXForceWindowCreation(client);
+ case X_DMXGetScreenCount:
+ return ProcDMXGetScreenCount(client);
+ case X_DMXGetScreenAttributes:
+ return ProcDMXGetScreenAttributes(client);
case X_DMXChangeScreensAttributes:
return ProcDMXChangeScreensAttributes(client);
- case X_DMXAddScreen: return ProcDMXAddScreen(client);
- case X_DMXRemoveScreen: return ProcDMXRemoveScreen(client);
- case X_DMXGetWindowAttributes: return ProcDMXGetWindowAttributes(client);
- case X_DMXGetDesktopAttributes: return ProcDMXGetDesktopAttributes(client);
+ case X_DMXAddScreen:
+ return ProcDMXAddScreen(client);
+ case X_DMXRemoveScreen:
+ return ProcDMXRemoveScreen(client);
+ case X_DMXGetWindowAttributes:
+ return ProcDMXGetWindowAttributes(client);
+ case X_DMXGetDesktopAttributes:
+ return ProcDMXGetDesktopAttributes(client);
case X_DMXChangeDesktopAttributes:
return ProcDMXChangeDesktopAttributes(client);
- case X_DMXGetInputCount: return ProcDMXGetInputCount(client);
- case X_DMXGetInputAttributes: return ProcDMXGetInputAttributes(client);
- case X_DMXAddInput: return ProcDMXAddInput(client);
- case X_DMXRemoveInput: return ProcDMXRemoveInput(client);
-
+ case X_DMXGetInputCount:
+ return ProcDMXGetInputCount(client);
+ case X_DMXGetInputAttributes:
+ return ProcDMXGetInputAttributes(client);
+ case X_DMXAddInput:
+ return ProcDMXAddInput(client);
+ case X_DMXRemoveInput:
+ return ProcDMXRemoveInput(client);
+
case X_DMXGetScreenInformationDEPRECATED:
case X_DMXForceWindowCreationDEPRECATED:
case X_DMXReconfigureScreenDEPRECATED:
return BadImplementation;
- default: return BadRequest;
+ default:
+ return BadRequest;
}
}
-static int SProcDMXQueryVersion(ClientPtr client)
+static int
+SProcDMXQueryVersion(ClientPtr client)
{
REQUEST(xDMXQueryVersionReq);
@@ -876,7 +949,8 @@ static int SProcDMXQueryVersion(ClientPtr client)
return ProcDMXQueryVersion(client);
}
-static int SProcDMXSync(ClientPtr client)
+static int
+SProcDMXSync(ClientPtr client)
{
REQUEST(xDMXSyncReq);
@@ -885,7 +959,8 @@ static int SProcDMXSync(ClientPtr client)
return ProcDMXSync(client);
}
-static int SProcDMXForceWindowCreation(ClientPtr client)
+static int
+SProcDMXForceWindowCreation(ClientPtr client)
{
REQUEST(xDMXForceWindowCreationReq);
@@ -895,7 +970,8 @@ static int SProcDMXForceWindowCreation(ClientPtr client)
return ProcDMXForceWindowCreation(client);
}
-static int SProcDMXGetScreenCount(ClientPtr client)
+static int
+SProcDMXGetScreenCount(ClientPtr client)
{
REQUEST(xDMXGetScreenCountReq);
@@ -904,7 +980,8 @@ static int SProcDMXGetScreenCount(ClientPtr client)
return ProcDMXGetScreenCount(client);
}
-static int SProcDMXGetScreenAttributes(ClientPtr client)
+static int
+SProcDMXGetScreenAttributes(ClientPtr client)
{
REQUEST(xDMXGetScreenAttributesReq);
@@ -914,7 +991,8 @@ static int SProcDMXGetScreenAttributes(ClientPtr client)
return ProcDMXGetScreenAttributes(client);
}
-static int SProcDMXChangeScreensAttributes(ClientPtr client)
+static int
+SProcDMXChangeScreensAttributes(ClientPtr client)
{
REQUEST(xDMXChangeScreensAttributesReq);
@@ -926,9 +1004,11 @@ static int SProcDMXChangeScreensAttributes(ClientPtr client)
return ProcDMXGetScreenAttributes(client);
}
-static int SProcDMXAddScreen(ClientPtr client)
+static int
+SProcDMXAddScreen(ClientPtr client)
{
int paddedLength;
+
REQUEST(xDMXAddScreenReq);
swaps(&stuff->length);
@@ -936,11 +1016,12 @@ static int SProcDMXAddScreen(ClientPtr client)
swapl(&stuff->displayNameLength);
swapl(&stuff->valueMask);
paddedLength = pad_to_int32(stuff->displayNameLength);
- SwapLongs((CARD32 *)(stuff+1), LengthRestL(stuff) - paddedLength/4);
+ SwapLongs((CARD32 *) (stuff + 1), LengthRestL(stuff) - paddedLength / 4);
return ProcDMXAddScreen(client);
}
-static int SProcDMXRemoveScreen(ClientPtr client)
+static int
+SProcDMXRemoveScreen(ClientPtr client)
{
REQUEST(xDMXRemoveScreenReq);
@@ -950,7 +1031,8 @@ static int SProcDMXRemoveScreen(ClientPtr client)
return ProcDMXRemoveScreen(client);
}
-static int SProcDMXGetWindowAttributes(ClientPtr client)
+static int
+SProcDMXGetWindowAttributes(ClientPtr client)
{
REQUEST(xDMXGetWindowAttributesReq);
@@ -960,7 +1042,8 @@ static int SProcDMXGetWindowAttributes(ClientPtr client)
return ProcDMXGetWindowAttributes(client);
}
-static int SProcDMXGetDesktopAttributes(ClientPtr client)
+static int
+SProcDMXGetDesktopAttributes(ClientPtr client)
{
REQUEST(xDMXGetDesktopAttributesReq);
@@ -969,7 +1052,8 @@ static int SProcDMXGetDesktopAttributes(ClientPtr client)
return ProcDMXGetDesktopAttributes(client);
}
-static int SProcDMXChangeDesktopAttributes(ClientPtr client)
+static int
+SProcDMXChangeDesktopAttributes(ClientPtr client)
{
REQUEST(xDMXChangeDesktopAttributesReq);
@@ -980,7 +1064,8 @@ static int SProcDMXChangeDesktopAttributes(ClientPtr client)
return ProcDMXChangeDesktopAttributes(client);
}
-static int SProcDMXGetInputCount(ClientPtr client)
+static int
+SProcDMXGetInputCount(ClientPtr client)
{
REQUEST(xDMXGetInputCountReq);
@@ -989,7 +1074,8 @@ static int SProcDMXGetInputCount(ClientPtr client)
return ProcDMXGetInputCount(client);
}
-static int SProcDMXGetInputAttributes(ClientPtr client)
+static int
+SProcDMXGetInputAttributes(ClientPtr client)
{
REQUEST(xDMXGetInputAttributesReq);
@@ -999,9 +1085,11 @@ static int SProcDMXGetInputAttributes(ClientPtr client)
return ProcDMXGetInputAttributes(client);
}
-static int SProcDMXAddInput(ClientPtr client)
+static int
+SProcDMXAddInput(ClientPtr client)
{
int paddedLength;
+
REQUEST(xDMXAddInputReq);
swaps(&stuff->length);
@@ -1009,11 +1097,12 @@ static int SProcDMXAddInput(ClientPtr client)
swapl(&stuff->displayNameLength);
swapl(&stuff->valueMask);
paddedLength = pad_to_int32(stuff->displayNameLength);
- SwapLongs((CARD32 *)(stuff+1), LengthRestL(stuff) - paddedLength/4);
+ SwapLongs((CARD32 *) (stuff + 1), LengthRestL(stuff) - paddedLength / 4);
return ProcDMXAddInput(client);
}
-static int SProcDMXRemoveInput(ClientPtr client)
+static int
+SProcDMXRemoveInput(ClientPtr client)
{
REQUEST(xDMXRemoveInputReq);
@@ -1023,46 +1112,61 @@ static int SProcDMXRemoveInput(ClientPtr client)
return ProcDMXRemoveInput(client);
}
-static int SProcDMXDispatch (ClientPtr client)
+static int
+SProcDMXDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
- case X_DMXQueryVersion: return SProcDMXQueryVersion(client);
- case X_DMXSync: return SProcDMXSync(client);
- case X_DMXForceWindowCreation: return SProcDMXForceWindowCreation(client);
- case X_DMXGetScreenCount: return SProcDMXGetScreenCount(client);
- case X_DMXGetScreenAttributes: return SProcDMXGetScreenAttributes(client);
+ case X_DMXQueryVersion:
+ return SProcDMXQueryVersion(client);
+ case X_DMXSync:
+ return SProcDMXSync(client);
+ case X_DMXForceWindowCreation:
+ return SProcDMXForceWindowCreation(client);
+ case X_DMXGetScreenCount:
+ return SProcDMXGetScreenCount(client);
+ case X_DMXGetScreenAttributes:
+ return SProcDMXGetScreenAttributes(client);
case X_DMXChangeScreensAttributes:
return SProcDMXChangeScreensAttributes(client);
- case X_DMXAddScreen: return SProcDMXAddScreen(client);
- case X_DMXRemoveScreen: return SProcDMXRemoveScreen(client);
- case X_DMXGetWindowAttributes: return SProcDMXGetWindowAttributes(client);
+ case X_DMXAddScreen:
+ return SProcDMXAddScreen(client);
+ case X_DMXRemoveScreen:
+ return SProcDMXRemoveScreen(client);
+ case X_DMXGetWindowAttributes:
+ return SProcDMXGetWindowAttributes(client);
case X_DMXGetDesktopAttributes:
return SProcDMXGetDesktopAttributes(client);
case X_DMXChangeDesktopAttributes:
return SProcDMXChangeDesktopAttributes(client);
- case X_DMXGetInputCount: return SProcDMXGetInputCount(client);
- case X_DMXGetInputAttributes: return SProcDMXGetInputAttributes(client);
- case X_DMXAddInput: return SProcDMXAddInput(client);
- case X_DMXRemoveInput: return SProcDMXRemoveInput(client);
-
+ case X_DMXGetInputCount:
+ return SProcDMXGetInputCount(client);
+ case X_DMXGetInputAttributes:
+ return SProcDMXGetInputAttributes(client);
+ case X_DMXAddInput:
+ return SProcDMXAddInput(client);
+ case X_DMXRemoveInput:
+ return SProcDMXRemoveInput(client);
+
case X_DMXGetScreenInformationDEPRECATED:
case X_DMXForceWindowCreationDEPRECATED:
case X_DMXReconfigureScreenDEPRECATED:
return BadImplementation;
- default: return BadRequest;
+ default:
+ return BadRequest;
}
}
/** Initialize the extension. */
-void DMXExtensionInit(void)
+void
+DMXExtensionInit(void)
{
ExtensionEntry *extEntry;
-
+
if ((extEntry = AddExtension(DMX_EXTENSION_NAME, 0, 0,
ProcDMXDispatch, SProcDMXDispatch,
NULL, StandardMinorOpcode)))
- DMXCode = extEntry->base;
+ DMXCode = extEntry->base;
}
diff --git a/xorg-server/hw/dmx/dmx_glxvisuals.c b/xorg-server/hw/dmx/dmx_glxvisuals.c
index dd77bd23a..9fcc0e58d 100644
--- a/xorg-server/hw/dmx/dmx_glxvisuals.c
+++ b/xorg-server/hw/dmx/dmx_glxvisuals.c
@@ -1,601 +1,601 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * 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 including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include <GL/glx.h>
-#include <GL/glxproto.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-
-#include "dmx_glxvisuals.h"
-
-__GLXvisualConfig *GetGLXVisualConfigs(Display *dpy, int screen, int *nconfigs)
-{
- xGLXGetVisualConfigsReq *req;
- xGLXGetVisualConfigsReply reply;
- __GLXvisualConfig *config, *configs;
- GLint i, j, nvisuals, nprops;
- INT32 *props, *p;
- int majorOpcode, dummy;
- int num_good_visuals;
-
- if (!XQueryExtension(dpy, "GLX", &majorOpcode, &dummy, &dummy)) {
- return NULL;
- }
-
- /* Send the glXGetVisualConfigs request */
- LockDisplay(dpy);
- GetReq(GLXGetVisualConfigs,req);
- req->reqType = majorOpcode;
- req->glxCode = X_GLXGetVisualConfigs;
- req->screen = screen;
- if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
- /* Something is busted. Punt. */
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
-
- nvisuals = (int)reply.numVisuals;
- if (!nvisuals) {
- /* This screen does not support GL rendering */
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
-
- /* Check number of properties per visual */
- nprops = (int)reply.numProps;
- if (nprops < __GLX_MIN_CONFIG_PROPS) {
- /* Huh? Not in protocol defined limits. Punt */
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
- props = (INT32*) Xmalloc(nprops * __GLX_SIZE_CARD32);
- if (!props) {
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
-
- /* Allocate memory for our config structure */
- config = (__GLXvisualConfig*)
- Xmalloc(nvisuals * sizeof(__GLXvisualConfig));
- if (!config) {
- free(props);
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
- memset(config, 0, nvisuals * sizeof(__GLXvisualConfig));
- configs = config;
- num_good_visuals = 0;
-
- /* Convert config structure into our format */
- for (i=0; i<nvisuals; i++) {
-
- /* Read config structure */
- _XRead(dpy, (char *)props, (nprops * __GLX_SIZE_CARD32));
-
- /* fill in default values */
- config->visualRating = GLX_NONE_EXT;
- config->transparentPixel = GLX_NONE_EXT;
-
- /* Copy in the first set of properties */
- config->vid = props[0];
- config->class = props[1];
-
- config->rgba = (Bool) props[2];
-
- config->redSize = props[3];
- config->greenSize = props[4];
- config->blueSize = props[5];
- config->alphaSize = props[6];
-
- config->accumRedSize = props[7];
- config->accumGreenSize = props[8];
- config->accumBlueSize = props[9];
- config->accumAlphaSize = props[10];
-
- config->doubleBuffer = (Bool) props[11];
- config->stereo = (Bool) props[12];
-
- config->bufferSize = props[13];
- config->depthSize = props[14];
- config->stencilSize = props[15];
-
- config->auxBuffers = props[16];
- config->level = props[17];
-
- /* Process remaining properties */
- p = &props[18];
- for (j=__GLX_MIN_CONFIG_PROPS; j<nprops; j+=2) {
- int property = *p++;
- int value = *p++;
-
- switch (property) {
- case GLX_SAMPLES_SGIS:
- config->multiSampleSize = value;
- break;
- case GLX_SAMPLE_BUFFERS_SGIS:
- config->nMultiSampleBuffers = value;
- break;
-
- case GLX_TRANSPARENT_TYPE_EXT:
- config->transparentPixel = value;
- break;
- case GLX_TRANSPARENT_INDEX_VALUE_EXT:
- config->transparentIndex = value;
- break;
- case GLX_TRANSPARENT_RED_VALUE_EXT:
- config->transparentRed = value;
- break;
- case GLX_TRANSPARENT_GREEN_VALUE_EXT:
- config->transparentGreen = value;
- break;
- case GLX_TRANSPARENT_BLUE_VALUE_EXT:
- config->transparentBlue = value;
- break;
- case GLX_TRANSPARENT_ALPHA_VALUE_EXT:
- config->transparentAlpha = value;
- break;
-
- case GLX_VISUAL_CAVEAT_EXT:
- config->visualRating = value;
- break;
-
- /* visualSelectGroup is an internal used property */
- case GLX_VISUAL_SELECT_GROUP_SGIX:
- config->visualSelectGroup = value;
- break;
-
- default :
- /* Ignore properties we don't recognize */
- break;
- }
- } /* for j */
-
- /*
- // filter out overlay visuals (dmx does not support overlays)
- */
- if (config->level == 0) {
- config++;
- num_good_visuals++;
- }
-
- } /* for i */
-
- UnlockDisplay(dpy);
-
- nvisuals = num_good_visuals;
-
- config = configs;
- for (i=0; i<nvisuals; i++) {
- /* XXX hack to fill-in mask info (need a better way to do this) */
- {
- XVisualInfo *vis, template;
- int n;
-
- template.screen = screen;
- template.visualid = config->vid;
- vis = XGetVisualInfo(dpy, VisualScreenMask|VisualIDMask,
- &template, &n);
-
- if (vis != NULL) {
- config->redMask = vis->red_mask;
- config->greenMask = vis->green_mask;
- config->blueMask = vis->blue_mask;
- config->alphaMask = 0; /* XXX */
- free(vis);
- }
- }
- config++;
- } /* for i */
-
- XFree(props);
- SyncHandle();
-
- *nconfigs = nvisuals;
- return configs;
-}
-
-
-__GLXFBConfig *GetGLXFBConfigs(Display *dpy, int glxMajorOpcode, int *nconfigs)
-{
- xGLXGetFBConfigsReq *req;
- xGLXGetFBConfigsReply reply;
- __GLXFBConfig *config, *fbconfigs;
- GLint i, j, numFBConfigs, numAttribs;
- INT32 *attrs, *p;
- int screen = DefaultScreen( dpy );
- int numValidConfigs = 0;
-
- /* Send the glXGetFBConfigs request */
- LockDisplay(dpy);
- GetReq(GLXGetFBConfigs, req);
- req->reqType = glxMajorOpcode;
- req->glxCode = X_GLXGetFBConfigs;
- req->screen = screen;
-
- *nconfigs = 0;
-
- if (!_XReply(dpy, (xReply*) &reply, 0, False)) {
- /* Something is busted. Punt. */
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
-
- numFBConfigs = (int)reply.numFBConfigs;
- if (!numFBConfigs) {
- /* This screen does not support GL rendering */
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
-
- numAttribs = (int)reply.numAttribs;
- if (!numAttribs) {
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
-
- attrs = (INT32*) Xmalloc(2*numAttribs * __GLX_SIZE_CARD32);
- if (!attrs) {
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
-
- /* Allocate memory for our config structure */
- config = (__GLXFBConfig*)
- Xmalloc(numFBConfigs * sizeof(__GLXFBConfig));
- if (!config) {
- free(attrs);
- UnlockDisplay(dpy);
- SyncHandle();
- return NULL;
- }
- memset(config, 0, numFBConfigs * sizeof(__GLXFBConfig));
- fbconfigs = config;
-
- /* Convert attribute list into our format */
- for (i=0; i<numFBConfigs; i++) {
-
- /* Fill in default properties */
- config->transparentType = GLX_NONE_EXT;
- config->visualCaveat = GLX_NONE_EXT;
- config->minRed = 0.;
- config->maxRed = 1.;
- config->minGreen = 0.;
- config->maxGreen = 1.;
- config->minBlue = 0.;
- config->maxBlue = 1.;
- config->minAlpha = 0.;
- config->maxAlpha = 1.;
-
- /* Read attribute list */
- _XRead(dpy, (char *)attrs, (2*numAttribs * __GLX_SIZE_CARD32));
-
- p = attrs;
- for (j=0; j<numAttribs; j++) {
- int attribute = *p++;
- int value = *p++;
-
- switch (attribute) {
- /* core attributes */
- case GLX_FBCONFIG_ID:
- config->id = value;
- break;
- case GLX_BUFFER_SIZE:
- config->indexBits = value;
- break;
- case GLX_LEVEL:
- config->level = value;
- break;
- case GLX_DOUBLEBUFFER:
- config->doubleBufferMode = value;
- break;
- case GLX_STEREO:
- config->stereoMode = value;
- break;
- case GLX_AUX_BUFFERS:
- config->maxAuxBuffers = value;
- break;
- case GLX_RED_SIZE:
- config->redBits = value;
- break;
- case GLX_GREEN_SIZE:
- config->greenBits = value;
- break;
- case GLX_BLUE_SIZE:
- config->blueBits = value;
- break;
- case GLX_ALPHA_SIZE:
- config->alphaBits = value;
- break;
- case GLX_DEPTH_SIZE:
- config->depthBits = value;
- break;
- case GLX_STENCIL_SIZE:
- config->stencilBits = value;
- break;
- case GLX_ACCUM_RED_SIZE:
- config->accumRedBits = value;
- break;
- case GLX_ACCUM_GREEN_SIZE:
- config->accumGreenBits = value;
- break;
- case GLX_ACCUM_BLUE_SIZE:
- config->accumBlueBits = value;
- break;
- case GLX_ACCUM_ALPHA_SIZE:
- config->accumAlphaBits = value;
- break;
- case GLX_RENDER_TYPE:
- config->renderType = value;
- break;
- case GLX_DRAWABLE_TYPE:
- config->drawableType = value;
- break;
- case GLX_X_VISUAL_TYPE:
- config->visualType = value;
- break;
- case GLX_CONFIG_CAVEAT:
- config->visualCaveat = value;
- break;
- case GLX_TRANSPARENT_TYPE:
- config->transparentType = value;
- break;
- case GLX_TRANSPARENT_INDEX_VALUE:
- config->transparentIndex = value;
- break;
- case GLX_TRANSPARENT_RED_VALUE:
- config->transparentRed = value;
- break;
- case GLX_TRANSPARENT_GREEN_VALUE:
- config->transparentGreen = value;
- break;
- case GLX_TRANSPARENT_BLUE_VALUE:
- config->transparentBlue = value;
- break;
- case GLX_TRANSPARENT_ALPHA_VALUE:
- config->transparentAlpha = value;
- break;
- case GLX_MAX_PBUFFER_WIDTH:
- config->maxPbufferWidth = value;
- break;
- case GLX_MAX_PBUFFER_HEIGHT:
- config->maxPbufferHeight = value;
- break;
- case GLX_MAX_PBUFFER_PIXELS:
- config->maxPbufferPixels = value;
- break;
- case GLX_VISUAL_ID:
- config->associatedVisualId = value;
- break;
-
- /* visualSelectGroup is an internal used property */
- case GLX_VISUAL_SELECT_GROUP_SGIX:
- config->visualSelectGroup = value;
- break;
-
- /* SGIS_multisample attributes */
- case GLX_SAMPLES_SGIS:
- config->multiSampleSize = value;
- break;
- case GLX_SAMPLE_BUFFERS_SGIS:
- config->nMultiSampleBuffers = value;
- break;
-
- /* SGIX_pbuffer specific attributes */
- case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
- config->optimalPbufferWidth = value;
- break;
- case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
- config->optimalPbufferHeight = value;
- break;
-
- default:
- /* Ignore attributes we don't recognize */
- break;
- }
- } /* for j */
-
- /* Fill in derived values */
- config->screen = screen;
-
- config->rgbMode = config->renderType & GLX_RGBA_BIT;
- config->colorIndexMode = !config->rgbMode;
-
- config->haveAccumBuffer =
- config->accumRedBits > 0 ||
- config->accumGreenBits > 0 ||
- config->accumBlueBits > 0;
- /* Can't have alpha without color */
-
- config->haveDepthBuffer = config->depthBits > 0;
- config->haveStencilBuffer = config->stencilBits > 0;
-
- /* overlay visuals are not valid for now */
- if (!config->level) {
- config++;
- numValidConfigs++;
- }
-
- } /* for i */
- UnlockDisplay(dpy);
-
- config = fbconfigs;
- for (i=0; i<numValidConfigs; i++) {
-
- /* XXX hack to fill-in mask info (need a better way to do this) */
- if (config->associatedVisualId != 0) {
- XVisualInfo *vis, template;
- int n;
-
- template.screen = screen;
- template.visualid = config->associatedVisualId;
- vis = XGetVisualInfo(dpy, VisualScreenMask|VisualIDMask,
- &template, &n);
-
- if (vis != NULL) {
- config->redMask = (GLuint)vis->red_mask;
- config->greenMask = (GLuint)vis->green_mask;
- config->blueMask = (GLuint)vis->blue_mask;
- config->alphaMask = 0; /* XXX */
- free(vis);
- }
- }
-
- config++;
- } /* for i */
-
- XFree(attrs);
- SyncHandle();
-
- *nconfigs = numValidConfigs;
- return fbconfigs;
-}
-
-__GLXvisualConfig *
-GetGLXVisualConfigsFromFBConfigs(__GLXFBConfig *fbconfigs, int nfbconfigs,
- XVisualInfo *visuals, int nvisuals,
- __GLXvisualConfig *glxConfigs, int nGlxConfigs,
- int *nconfigs)
-{
- __GLXvisualConfig *configs = NULL;
- int i;
-
- if (!fbconfigs || !nfbconfigs || !nconfigs) return NULL;
- *nconfigs = 0;
-
- /* Allocate memory for our config structure */
- configs = (__GLXvisualConfig*)
- Xmalloc(nfbconfigs * sizeof(__GLXvisualConfig));
- if (!configs) {
- return NULL;
- }
- memset(configs, 0, nfbconfigs * sizeof(__GLXvisualConfig));
-
- for (i=0; i<nfbconfigs; i++) {
- __GLXFBConfig *fbcfg = &fbconfigs[i];
-
- if (fbcfg->associatedVisualId > 0) {
- __GLXvisualConfig *cfg = configs + (*nconfigs);
- int j;
- XVisualInfo *vinfo = NULL;
-
- for (j=0; j<nvisuals; j++) {
- if (visuals[j].visualid == fbcfg->associatedVisualId) {
- vinfo = &visuals[j];
- break;
- }
- }
- if (!vinfo) continue;
-
- /* skip 16 bit colormap visuals */
- if (vinfo->depth == 16 &&
- vinfo->class != TrueColor &&
- vinfo->class != DirectColor ) {
- continue;
- }
-
- (*nconfigs)++;
-
- /*
- * if the same visualid exists in the glx configs,
- * copy the glx attributes from the glx config
- */
- for (j=0; j<nGlxConfigs; j++) {
- if (glxConfigs[j].vid == vinfo->visualid)
- break;
- }
- if (j < nGlxConfigs) {
- memcpy(cfg, &glxConfigs[j], sizeof(__GLXvisualConfig) );
- continue;
- }
-
- /*
- * make glx attributes from the FB config attributes
- */
- cfg->vid = fbcfg->associatedVisualId;
- cfg->class = vinfo->class;
- cfg->rgba = !(fbcfg->renderType & GLX_COLOR_INDEX_BIT_SGIX);
- cfg->redSize = fbcfg->redBits;
- cfg->greenSize = fbcfg->greenBits;
- cfg->blueSize = fbcfg->blueBits;
- cfg->alphaSize = fbcfg->alphaBits;
- cfg->redMask = fbcfg->redMask;
- cfg->greenMask = fbcfg->greenMask;
- cfg->blueMask = fbcfg->blueMask;
- cfg->alphaMask = fbcfg->alphaMask;
- cfg->accumRedSize = fbcfg->accumRedBits;
- cfg->accumGreenSize = fbcfg->accumGreenBits;
- cfg->accumBlueSize = fbcfg->accumBlueBits;
- cfg->accumAlphaSize = fbcfg->accumAlphaBits;
- cfg->doubleBuffer = fbcfg->doubleBufferMode;
- cfg->stereo = fbcfg->stereoMode;
- if (vinfo->class == TrueColor || vinfo->class == DirectColor) {
- cfg->bufferSize = (fbcfg->rgbMode ? (fbcfg->redBits +
- fbcfg->greenBits +
- fbcfg->blueBits +
- fbcfg->alphaBits)
- : fbcfg->indexBits );
- }
- else {
- cfg->bufferSize = vinfo->depth;
- }
- cfg->depthSize = fbcfg->depthBits;
- cfg->stencilSize = fbcfg->stencilBits;
- cfg->auxBuffers = fbcfg->maxAuxBuffers;
- cfg->level = fbcfg->level;
- cfg->visualRating = fbcfg->visualCaveat;
- cfg->transparentPixel = fbcfg->transparentType;
- cfg->transparentRed = fbcfg->transparentRed;
- cfg->transparentGreen = fbcfg->transparentGreen;
- cfg->transparentBlue = fbcfg->transparentBlue;
- cfg->transparentAlpha = fbcfg->transparentAlpha;
- cfg->transparentIndex = fbcfg->transparentIndex;
- cfg->multiSampleSize = fbcfg->multiSampleSize;
- cfg->nMultiSampleBuffers = fbcfg->nMultiSampleBuffers;
- cfg->visualSelectGroup = fbcfg->visualSelectGroup;
- }
- }
-
- return configs;
-}
-
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * 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 including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * 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
+ * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include <GL/glx.h>
+#include <GL/glxproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+
+#include "dmx_glxvisuals.h"
+
+__GLXvisualConfig *
+GetGLXVisualConfigs(Display * dpy, int screen, int *nconfigs)
+{
+ xGLXGetVisualConfigsReq *req;
+ xGLXGetVisualConfigsReply reply;
+ __GLXvisualConfig *config, *configs;
+ GLint i, j, nvisuals, nprops;
+ INT32 *props, *p;
+ int majorOpcode, dummy;
+ int num_good_visuals;
+
+ if (!XQueryExtension(dpy, "GLX", &majorOpcode, &dummy, &dummy)) {
+ return NULL;
+ }
+
+ /* Send the glXGetVisualConfigs request */
+ LockDisplay(dpy);
+ GetReq(GLXGetVisualConfigs, req);
+ req->reqType = majorOpcode;
+ req->glxCode = X_GLXGetVisualConfigs;
+ req->screen = screen;
+ if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+ /* Something is busted. Punt. */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ nvisuals = (int) reply.numVisuals;
+ if (!nvisuals) {
+ /* This screen does not support GL rendering */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ /* Check number of properties per visual */
+ nprops = (int) reply.numProps;
+ if (nprops < __GLX_MIN_CONFIG_PROPS) {
+ /* Huh? Not in protocol defined limits. Punt */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+ props = (INT32 *) Xmalloc(nprops * __GLX_SIZE_CARD32);
+ if (!props) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ /* Allocate memory for our config structure */
+ config = (__GLXvisualConfig *)
+ Xmalloc(nvisuals * sizeof(__GLXvisualConfig));
+ if (!config) {
+ free(props);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+ memset(config, 0, nvisuals * sizeof(__GLXvisualConfig));
+ configs = config;
+ num_good_visuals = 0;
+
+ /* Convert config structure into our format */
+ for (i = 0; i < nvisuals; i++) {
+
+ /* Read config structure */
+ _XRead(dpy, (char *) props, (nprops * __GLX_SIZE_CARD32));
+
+ /* fill in default values */
+ config->visualRating = GLX_NONE_EXT;
+ config->transparentPixel = GLX_NONE_EXT;
+
+ /* Copy in the first set of properties */
+ config->vid = props[0];
+ config->class = props[1];
+
+ config->rgba = (Bool) props[2];
+
+ config->redSize = props[3];
+ config->greenSize = props[4];
+ config->blueSize = props[5];
+ config->alphaSize = props[6];
+
+ config->accumRedSize = props[7];
+ config->accumGreenSize = props[8];
+ config->accumBlueSize = props[9];
+ config->accumAlphaSize = props[10];
+
+ config->doubleBuffer = (Bool) props[11];
+ config->stereo = (Bool) props[12];
+
+ config->bufferSize = props[13];
+ config->depthSize = props[14];
+ config->stencilSize = props[15];
+
+ config->auxBuffers = props[16];
+ config->level = props[17];
+
+ /* Process remaining properties */
+ p = &props[18];
+ for (j = __GLX_MIN_CONFIG_PROPS; j < nprops; j += 2) {
+ int property = *p++;
+ int value = *p++;
+
+ switch (property) {
+ case GLX_SAMPLES_SGIS:
+ config->multiSampleSize = value;
+ break;
+ case GLX_SAMPLE_BUFFERS_SGIS:
+ config->nMultiSampleBuffers = value;
+ break;
+
+ case GLX_TRANSPARENT_TYPE_EXT:
+ config->transparentPixel = value;
+ break;
+ case GLX_TRANSPARENT_INDEX_VALUE_EXT:
+ config->transparentIndex = value;
+ break;
+ case GLX_TRANSPARENT_RED_VALUE_EXT:
+ config->transparentRed = value;
+ break;
+ case GLX_TRANSPARENT_GREEN_VALUE_EXT:
+ config->transparentGreen = value;
+ break;
+ case GLX_TRANSPARENT_BLUE_VALUE_EXT:
+ config->transparentBlue = value;
+ break;
+ case GLX_TRANSPARENT_ALPHA_VALUE_EXT:
+ config->transparentAlpha = value;
+ break;
+
+ case GLX_VISUAL_CAVEAT_EXT:
+ config->visualRating = value;
+ break;
+
+ /* visualSelectGroup is an internal used property */
+ case GLX_VISUAL_SELECT_GROUP_SGIX:
+ config->visualSelectGroup = value;
+ break;
+
+ default:
+ /* Ignore properties we don't recognize */
+ break;
+ }
+ } /* for j */
+
+ /*
+ // filter out overlay visuals (dmx does not support overlays)
+ */
+ if (config->level == 0) {
+ config++;
+ num_good_visuals++;
+ }
+
+ } /* for i */
+
+ UnlockDisplay(dpy);
+
+ nvisuals = num_good_visuals;
+
+ config = configs;
+ for (i = 0; i < nvisuals; i++) {
+ /* XXX hack to fill-in mask info (need a better way to do this) */
+ {
+ XVisualInfo *vis, template;
+ int n;
+
+ template.screen = screen;
+ template.visualid = config->vid;
+ vis = XGetVisualInfo(dpy, VisualScreenMask | VisualIDMask,
+ &template, &n);
+
+ if (vis != NULL) {
+ config->redMask = vis->red_mask;
+ config->greenMask = vis->green_mask;
+ config->blueMask = vis->blue_mask;
+ config->alphaMask = 0; /* XXX */
+ free(vis);
+ }
+ }
+ config++;
+ } /* for i */
+
+ XFree(props);
+ SyncHandle();
+
+ *nconfigs = nvisuals;
+ return configs;
+}
+
+__GLXFBConfig *
+GetGLXFBConfigs(Display * dpy, int glxMajorOpcode, int *nconfigs)
+{
+ xGLXGetFBConfigsReq *req;
+ xGLXGetFBConfigsReply reply;
+ __GLXFBConfig *config, *fbconfigs;
+ GLint i, j, numFBConfigs, numAttribs;
+ INT32 *attrs, *p;
+ int screen = DefaultScreen(dpy);
+ int numValidConfigs = 0;
+
+ /* Send the glXGetFBConfigs request */
+ LockDisplay(dpy);
+ GetReq(GLXGetFBConfigs, req);
+ req->reqType = glxMajorOpcode;
+ req->glxCode = X_GLXGetFBConfigs;
+ req->screen = screen;
+
+ *nconfigs = 0;
+
+ if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+ /* Something is busted. Punt. */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ numFBConfigs = (int) reply.numFBConfigs;
+ if (!numFBConfigs) {
+ /* This screen does not support GL rendering */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ numAttribs = (int) reply.numAttribs;
+ if (!numAttribs) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ attrs = (INT32 *) Xmalloc(2 * numAttribs * __GLX_SIZE_CARD32);
+ if (!attrs) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ /* Allocate memory for our config structure */
+ config = (__GLXFBConfig *)
+ Xmalloc(numFBConfigs * sizeof(__GLXFBConfig));
+ if (!config) {
+ free(attrs);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+ memset(config, 0, numFBConfigs * sizeof(__GLXFBConfig));
+ fbconfigs = config;
+
+ /* Convert attribute list into our format */
+ for (i = 0; i < numFBConfigs; i++) {
+
+ /* Fill in default properties */
+ config->transparentType = GLX_NONE_EXT;
+ config->visualCaveat = GLX_NONE_EXT;
+ config->minRed = 0.;
+ config->maxRed = 1.;
+ config->minGreen = 0.;
+ config->maxGreen = 1.;
+ config->minBlue = 0.;
+ config->maxBlue = 1.;
+ config->minAlpha = 0.;
+ config->maxAlpha = 1.;
+
+ /* Read attribute list */
+ _XRead(dpy, (char *) attrs, (2 * numAttribs * __GLX_SIZE_CARD32));
+
+ p = attrs;
+ for (j = 0; j < numAttribs; j++) {
+ int attribute = *p++;
+ int value = *p++;
+
+ switch (attribute) {
+ /* core attributes */
+ case GLX_FBCONFIG_ID:
+ config->id = value;
+ break;
+ case GLX_BUFFER_SIZE:
+ config->indexBits = value;
+ break;
+ case GLX_LEVEL:
+ config->level = value;
+ break;
+ case GLX_DOUBLEBUFFER:
+ config->doubleBufferMode = value;
+ break;
+ case GLX_STEREO:
+ config->stereoMode = value;
+ break;
+ case GLX_AUX_BUFFERS:
+ config->maxAuxBuffers = value;
+ break;
+ case GLX_RED_SIZE:
+ config->redBits = value;
+ break;
+ case GLX_GREEN_SIZE:
+ config->greenBits = value;
+ break;
+ case GLX_BLUE_SIZE:
+ config->blueBits = value;
+ break;
+ case GLX_ALPHA_SIZE:
+ config->alphaBits = value;
+ break;
+ case GLX_DEPTH_SIZE:
+ config->depthBits = value;
+ break;
+ case GLX_STENCIL_SIZE:
+ config->stencilBits = value;
+ break;
+ case GLX_ACCUM_RED_SIZE:
+ config->accumRedBits = value;
+ break;
+ case GLX_ACCUM_GREEN_SIZE:
+ config->accumGreenBits = value;
+ break;
+ case GLX_ACCUM_BLUE_SIZE:
+ config->accumBlueBits = value;
+ break;
+ case GLX_ACCUM_ALPHA_SIZE:
+ config->accumAlphaBits = value;
+ break;
+ case GLX_RENDER_TYPE:
+ config->renderType = value;
+ break;
+ case GLX_DRAWABLE_TYPE:
+ config->drawableType = value;
+ break;
+ case GLX_X_VISUAL_TYPE:
+ config->visualType = value;
+ break;
+ case GLX_CONFIG_CAVEAT:
+ config->visualCaveat = value;
+ break;
+ case GLX_TRANSPARENT_TYPE:
+ config->transparentType = value;
+ break;
+ case GLX_TRANSPARENT_INDEX_VALUE:
+ config->transparentIndex = value;
+ break;
+ case GLX_TRANSPARENT_RED_VALUE:
+ config->transparentRed = value;
+ break;
+ case GLX_TRANSPARENT_GREEN_VALUE:
+ config->transparentGreen = value;
+ break;
+ case GLX_TRANSPARENT_BLUE_VALUE:
+ config->transparentBlue = value;
+ break;
+ case GLX_TRANSPARENT_ALPHA_VALUE:
+ config->transparentAlpha = value;
+ break;
+ case GLX_MAX_PBUFFER_WIDTH:
+ config->maxPbufferWidth = value;
+ break;
+ case GLX_MAX_PBUFFER_HEIGHT:
+ config->maxPbufferHeight = value;
+ break;
+ case GLX_MAX_PBUFFER_PIXELS:
+ config->maxPbufferPixels = value;
+ break;
+ case GLX_VISUAL_ID:
+ config->associatedVisualId = value;
+ break;
+
+ /* visualSelectGroup is an internal used property */
+ case GLX_VISUAL_SELECT_GROUP_SGIX:
+ config->visualSelectGroup = value;
+ break;
+
+ /* SGIS_multisample attributes */
+ case GLX_SAMPLES_SGIS:
+ config->multiSampleSize = value;
+ break;
+ case GLX_SAMPLE_BUFFERS_SGIS:
+ config->nMultiSampleBuffers = value;
+ break;
+
+ /* SGIX_pbuffer specific attributes */
+ case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX:
+ config->optimalPbufferWidth = value;
+ break;
+ case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX:
+ config->optimalPbufferHeight = value;
+ break;
+
+ default:
+ /* Ignore attributes we don't recognize */
+ break;
+ }
+ } /* for j */
+
+ /* Fill in derived values */
+ config->screen = screen;
+
+ config->rgbMode = config->renderType & GLX_RGBA_BIT;
+ config->colorIndexMode = !config->rgbMode;
+
+ config->haveAccumBuffer =
+ config->accumRedBits > 0 ||
+ config->accumGreenBits > 0 || config->accumBlueBits > 0;
+ /* Can't have alpha without color */
+
+ config->haveDepthBuffer = config->depthBits > 0;
+ config->haveStencilBuffer = config->stencilBits > 0;
+
+ /* overlay visuals are not valid for now */
+ if (!config->level) {
+ config++;
+ numValidConfigs++;
+ }
+
+ } /* for i */
+ UnlockDisplay(dpy);
+
+ config = fbconfigs;
+ for (i = 0; i < numValidConfigs; i++) {
+
+ /* XXX hack to fill-in mask info (need a better way to do this) */
+ if (config->associatedVisualId != 0) {
+ XVisualInfo *vis, template;
+ int n;
+
+ template.screen = screen;
+ template.visualid = config->associatedVisualId;
+ vis = XGetVisualInfo(dpy, VisualScreenMask | VisualIDMask,
+ &template, &n);
+
+ if (vis != NULL) {
+ config->redMask = (GLuint) vis->red_mask;
+ config->greenMask = (GLuint) vis->green_mask;
+ config->blueMask = (GLuint) vis->blue_mask;
+ config->alphaMask = 0; /* XXX */
+ free(vis);
+ }
+ }
+
+ config++;
+ } /* for i */
+
+ XFree(attrs);
+ SyncHandle();
+
+ *nconfigs = numValidConfigs;
+ return fbconfigs;
+}
+
+__GLXvisualConfig *
+GetGLXVisualConfigsFromFBConfigs(__GLXFBConfig * fbconfigs, int nfbconfigs,
+ XVisualInfo * visuals, int nvisuals,
+ __GLXvisualConfig * glxConfigs,
+ int nGlxConfigs, int *nconfigs)
+{
+ __GLXvisualConfig *configs = NULL;
+ int i;
+
+ if (!fbconfigs || !nfbconfigs || !nconfigs)
+ return NULL;
+ *nconfigs = 0;
+
+ /* Allocate memory for our config structure */
+ configs = (__GLXvisualConfig *)
+ Xmalloc(nfbconfigs * sizeof(__GLXvisualConfig));
+ if (!configs) {
+ return NULL;
+ }
+ memset(configs, 0, nfbconfigs * sizeof(__GLXvisualConfig));
+
+ for (i = 0; i < nfbconfigs; i++) {
+ __GLXFBConfig *fbcfg = &fbconfigs[i];
+
+ if (fbcfg->associatedVisualId > 0) {
+ __GLXvisualConfig *cfg = configs + (*nconfigs);
+ int j;
+ XVisualInfo *vinfo = NULL;
+
+ for (j = 0; j < nvisuals; j++) {
+ if (visuals[j].visualid == fbcfg->associatedVisualId) {
+ vinfo = &visuals[j];
+ break;
+ }
+ }
+ if (!vinfo)
+ continue;
+
+ /* skip 16 bit colormap visuals */
+ if (vinfo->depth == 16 &&
+ vinfo->class != TrueColor && vinfo->class != DirectColor) {
+ continue;
+ }
+
+ (*nconfigs)++;
+
+ /*
+ * if the same visualid exists in the glx configs,
+ * copy the glx attributes from the glx config
+ */
+ for (j = 0; j < nGlxConfigs; j++) {
+ if (glxConfigs[j].vid == vinfo->visualid)
+ break;
+ }
+ if (j < nGlxConfigs) {
+ memcpy(cfg, &glxConfigs[j], sizeof(__GLXvisualConfig));
+ continue;
+ }
+
+ /*
+ * make glx attributes from the FB config attributes
+ */
+ cfg->vid = fbcfg->associatedVisualId;
+ cfg->class = vinfo->class;
+ cfg->rgba = !(fbcfg->renderType & GLX_COLOR_INDEX_BIT_SGIX);
+ cfg->redSize = fbcfg->redBits;
+ cfg->greenSize = fbcfg->greenBits;
+ cfg->blueSize = fbcfg->blueBits;
+ cfg->alphaSize = fbcfg->alphaBits;
+ cfg->redMask = fbcfg->redMask;
+ cfg->greenMask = fbcfg->greenMask;
+ cfg->blueMask = fbcfg->blueMask;
+ cfg->alphaMask = fbcfg->alphaMask;
+ cfg->accumRedSize = fbcfg->accumRedBits;
+ cfg->accumGreenSize = fbcfg->accumGreenBits;
+ cfg->accumBlueSize = fbcfg->accumBlueBits;
+ cfg->accumAlphaSize = fbcfg->accumAlphaBits;
+ cfg->doubleBuffer = fbcfg->doubleBufferMode;
+ cfg->stereo = fbcfg->stereoMode;
+ if (vinfo->class == TrueColor || vinfo->class == DirectColor) {
+ cfg->bufferSize = (fbcfg->rgbMode ? (fbcfg->redBits +
+ fbcfg->greenBits +
+ fbcfg->blueBits +
+ fbcfg->alphaBits)
+ : fbcfg->indexBits);
+ }
+ else {
+ cfg->bufferSize = vinfo->depth;
+ }
+ cfg->depthSize = fbcfg->depthBits;
+ cfg->stencilSize = fbcfg->stencilBits;
+ cfg->auxBuffers = fbcfg->maxAuxBuffers;
+ cfg->level = fbcfg->level;
+ cfg->visualRating = fbcfg->visualCaveat;
+ cfg->transparentPixel = fbcfg->transparentType;
+ cfg->transparentRed = fbcfg->transparentRed;
+ cfg->transparentGreen = fbcfg->transparentGreen;
+ cfg->transparentBlue = fbcfg->transparentBlue;
+ cfg->transparentAlpha = fbcfg->transparentAlpha;
+ cfg->transparentIndex = fbcfg->transparentIndex;
+ cfg->multiSampleSize = fbcfg->multiSampleSize;
+ cfg->nMultiSampleBuffers = fbcfg->nMultiSampleBuffers;
+ cfg->visualSelectGroup = fbcfg->visualSelectGroup;
+ }
+ }
+
+ return configs;
+}
diff --git a/xorg-server/hw/dmx/dmx_glxvisuals.h b/xorg-server/hw/dmx/dmx_glxvisuals.h
index 477e92391..54c3b44ca 100644
--- a/xorg-server/hw/dmx/dmx_glxvisuals.h
+++ b/xorg-server/hw/dmx/dmx_glxvisuals.h
@@ -39,21 +39,19 @@ typedef struct {
int x_visual_class;
} dmxGlxVisualPrivate;
-__GLXvisualConfig *GetGLXVisualConfigs(Display *dpy,
- int screen,
- int *nconfigs);
+__GLXvisualConfig *GetGLXVisualConfigs(Display * dpy,
+ int screen, int *nconfigs);
-__GLXFBConfig *GetGLXFBConfigs(Display *dpy,
- int glxMajorOpcode,
- int *nconfigs);
+__GLXFBConfig *GetGLXFBConfigs(Display * dpy,
+ int glxMajorOpcode, int *nconfigs);
-__GLXvisualConfig *GetGLXVisualConfigsFromFBConfigs(__GLXFBConfig *fbconfigs,
- int nfbconfigs,
- XVisualInfo *visuals,
- int nvisuals,
- __GLXvisualConfig
- *glxConfigs,
- int nGlxConfigs,
- int *nconfigs);
+__GLXvisualConfig *GetGLXVisualConfigsFromFBConfigs(__GLXFBConfig * fbconfigs,
+ int nfbconfigs,
+ XVisualInfo * visuals,
+ int nvisuals,
+ __GLXvisualConfig
+ * glxConfigs,
+ int nGlxConfigs,
+ int *nconfigs);
#endif
diff --git a/xorg-server/hw/dmx/dmxcb.c b/xorg-server/hw/dmx/dmxcb.c
index d0eb35117..86015f395 100644
--- a/xorg-server/hw/dmx/dmxcb.c
+++ b/xorg-server/hw/dmx/dmxcb.c
@@ -43,40 +43,42 @@
#include "dmxinput.h"
#include "dmxlog.h"
-extern int connBlockScreenStart;
+extern int connBlockScreenStart;
#ifdef PANORAMIX
#include "panoramiXsrv.h"
-extern int PanoramiXPixWidth;
-extern int PanoramiXPixHeight;
-extern int PanoramiXNumScreens;
+extern int PanoramiXPixWidth;
+extern int PanoramiXPixHeight;
+extern int PanoramiXNumScreens;
#endif
- int dmxGlobalWidth, dmxGlobalHeight;
+int dmxGlobalWidth, dmxGlobalHeight;
/** We may want the wall dimensions to be different from the bounding
* box dimensions that Xinerama computes, so save those and update them
* here.
*/
-void dmxSetWidthHeight(int width, int height)
+void
+dmxSetWidthHeight(int width, int height)
{
- dmxGlobalWidth = width;
+ dmxGlobalWidth = width;
dmxGlobalHeight = height;
}
/** Computes the global bounding box for DMX. This may be larger than
* the one computed by Xinerama because of the DMX configuration
* file. */
-void dmxComputeWidthHeight(DMXRecomputeFlag flag)
+void
+dmxComputeWidthHeight(DMXRecomputeFlag flag)
{
- int i;
+ int i;
DMXScreenInfo *dmxScreen;
- int w = 0;
- int h = 0;
-
+ int w = 0;
+ int h = 0;
+
for (i = 0; i < dmxNumScreens; i++) {
- /* Don't use root* here because this is
- * the global bounding box. */
+ /* Don't use root* here because this is
+ * the global bounding box. */
dmxScreen = &dmxScreens[i];
if (w < dmxScreen->scrnWidth + dmxScreen->rootXOrigin)
w = dmxScreen->scrnWidth + dmxScreen->rootXOrigin;
@@ -85,7 +87,8 @@ void dmxComputeWidthHeight(DMXRecomputeFlag flag)
}
if (!dmxGlobalWidth && !dmxGlobalHeight) {
dmxLog(dmxInfo, "Using %dx%d as global bounding box\n", w, h);
- } else {
+ }
+ else {
switch (flag) {
case DMX_NO_RECOMPUTE_BOUNDING_BOX:
dmxLog(dmxInfo,
@@ -101,20 +104,21 @@ void dmxComputeWidthHeight(DMXRecomputeFlag flag)
break;
}
}
-
- dmxGlobalWidth = w;
+
+ dmxGlobalWidth = w;
dmxGlobalHeight = h;
}
/** A callback routine that hooks into Xinerama and provides a
* convenient place to print summary log information during server
* startup. This routine does not modify any values. */
-void dmxConnectionBlockCallback(void)
+void
+dmxConnectionBlockCallback(void)
{
- xWindowRoot *root = (xWindowRoot *)(ConnectionInfo+connBlockScreenStart);
- int offset = connBlockScreenStart + sizeof(xWindowRoot);
- int i;
- Bool *found = NULL;
+ xWindowRoot *root = (xWindowRoot *) (ConnectionInfo + connBlockScreenStart);
+ int offset = connBlockScreenStart + sizeof(xWindowRoot);
+ int i;
+ Bool *found = NULL;
MAXSCREENSALLOC(found);
if (!found)
@@ -130,22 +134,24 @@ void dmxConnectionBlockCallback(void)
"Changing Xinerama dimensions from %d %d to %d %d\n",
PanoramiXPixWidth, PanoramiXPixHeight,
dmxGlobalWidth, dmxGlobalHeight);
- PanoramiXPixWidth = root->pixWidth = dmxGlobalWidth;
+ PanoramiXPixWidth = root->pixWidth = dmxGlobalWidth;
PanoramiXPixHeight = root->pixHeight = dmxGlobalHeight;
- } else {
- dmxGlobalWidth = PanoramiXPixWidth;
+ }
+ else {
+ dmxGlobalWidth = PanoramiXPixWidth;
dmxGlobalHeight = PanoramiXPixHeight;
}
dmxLog(dmxInfo, "%d screens configured with Xinerama (%d %d)\n",
PanoramiXNumScreens, PanoramiXPixWidth, PanoramiXPixHeight);
- FOR_NSCREENS(i) found[i] = FALSE;
- } else {
+ FOR_NSCREENS(i) found[i] = FALSE;
+ }
+ else {
#endif
- /* This never happens because we're
- * either called from a Xinerama
- * callback or during reconfiguration
- * (which only works with Xinerama on).
- * In any case, be reasonable. */
+ /* This never happens because we're
+ * either called from a Xinerama
+ * callback or during reconfiguration
+ * (which only works with Xinerama on).
+ * In any case, be reasonable. */
dmxLog(dmxInfo, "%d screens configured (%d %d)\n",
screenInfo.numScreens, root->pixWidth, root->pixHeight);
#ifdef PANORAMIX
@@ -153,46 +159,48 @@ void dmxConnectionBlockCallback(void)
#endif
for (i = 0; i < root->nDepths; i++) {
- xDepth *depth = (xDepth *)(ConnectionInfo + offset);
- int voffset = offset + sizeof(xDepth);
- xVisualType *visual = (xVisualType *)(ConnectionInfo + voffset);
- int j;
-
+ xDepth *depth = (xDepth *) (ConnectionInfo + offset);
+ int voffset = offset + sizeof(xDepth);
+ xVisualType *visual = (xVisualType *) (ConnectionInfo + voffset);
+ int j;
+
dmxLog(dmxInfo, "%d visuals at depth %d:\n",
depth->nVisuals, depth->depth);
for (j = 0; j < depth->nVisuals; j++, visual++) {
XVisualInfo vi;
-
- vi.visual = NULL;
- vi.visualid = visual->visualID;
- vi.screen = 0;
- vi.depth = depth->depth;
- vi.class = visual->class;
- vi.red_mask = visual->redMask;
- vi.green_mask = visual->greenMask;
- vi.blue_mask = visual->blueMask;
+
+ vi.visual = NULL;
+ vi.visualid = visual->visualID;
+ vi.screen = 0;
+ vi.depth = depth->depth;
+ vi.class = visual->class;
+ vi.red_mask = visual->redMask;
+ vi.green_mask = visual->greenMask;
+ vi.blue_mask = visual->blueMask;
vi.colormap_size = visual->colormapEntries;
- vi.bits_per_rgb = visual->bitsPerRGB;
+ vi.bits_per_rgb = visual->bitsPerRGB;
dmxLogVisual(NULL, &vi, 0);
#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- int k;
- FOR_NSCREENS(k) {
- DMXScreenInfo *dmxScreen = &dmxScreens[k];
-
- if (dmxScreen->beDisplay) {
- XVisualInfo *pvi =
- &dmxScreen->beVisuals[dmxScreen->beDefVisualIndex];
- if (pvi->depth == depth->depth &&
- pvi->class == visual->class)
- found[k] = TRUE;
- } else {
- /* Screen #k is detatched, so it always succeeds */
- found[k] = TRUE;
- }
- }
- }
+ if (!noPanoramiXExtension) {
+ int k;
+
+ FOR_NSCREENS(k) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[k];
+
+ if (dmxScreen->beDisplay) {
+ XVisualInfo *pvi =
+ &dmxScreen->beVisuals[dmxScreen->beDefVisualIndex];
+ if (pvi->depth == depth->depth &&
+ pvi->class == visual->class)
+ found[k] = TRUE;
+ }
+ else {
+ /* Screen #k is detatched, so it always succeeds */
+ found[k] = TRUE;
+ }
+ }
+ }
#endif
}
offset = voffset + depth->nVisuals * sizeof(xVisualType);
@@ -203,18 +211,19 @@ void dmxConnectionBlockCallback(void)
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- Bool fatal = FALSE;
- FOR_NSCREENS(i) {
- fatal |= !found[i];
- if (!found[i]) {
- dmxLog(dmxError,
- "The default visual for screen #%d does not match "
- "any of the\n", i);
- dmxLog(dmxError,
- "consolidated visuals from Xinerama (listed above)\n");
- }
- }
- if (fatal)
+ Bool fatal = FALSE;
+
+ FOR_NSCREENS(i) {
+ fatal |= !found[i];
+ if (!found[i]) {
+ dmxLog(dmxError,
+ "The default visual for screen #%d does not match "
+ "any of the\n", i);
+ dmxLog(dmxError,
+ "consolidated visuals from Xinerama (listed above)\n");
+ }
+ }
+ if (fatal)
dmxLog(dmxFatal,
"dmxConnectionBlockCallback: invalid screen(s) found");
}
diff --git a/xorg-server/hw/dmx/dmxcmap.c b/xorg-server/hw/dmx/dmxcmap.c
index 1cdc481f0..450627b40 100644
--- a/xorg-server/hw/dmx/dmxcmap.c
+++ b/xorg-server/hw/dmx/dmxcmap.c
@@ -1,212 +1,222 @@
-/*
- * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <kem@redhat.com>
- *
- */
-
-/** \file
- * Colormap support. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxlog.h"
-#include "dmxsync.h"
-#include "dmxcmap.h"
-#include "dmxvisual.h"
-
-#include "micmap.h"
-
-static Bool dmxAllocateColormapPrivates(ColormapPtr pColormap)
-{
- dmxColormapPrivPtr pCmapPriv;
-
- pCmapPriv = (dmxColormapPrivPtr)malloc(sizeof(*pCmapPriv));
- if (!pCmapPriv)
- return FALSE;
- pCmapPriv->cmap = (Colormap)0;
-
- DMX_SET_COLORMAP_PRIV(pColormap, pCmapPriv);
-
- return TRUE;
-}
-
-/** Create \a pColormap on the back-end server. */
-Bool dmxBECreateColormap(ColormapPtr pColormap)
-{
- ScreenPtr pScreen = pColormap->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
- VisualPtr pVisual = pColormap->pVisual;
- Visual *visual = dmxLookupVisual(pScreen, pVisual);
-
- if (visual) {
- pCmapPriv->cmap = XCreateColormap(dmxScreen->beDisplay,
- dmxScreen->scrnWin,
- visual,
- (pVisual->class & DynamicClass ?
- AllocAll : AllocNone));
- return pCmapPriv->cmap != 0;
- }
- else {
- dmxLog(dmxWarning, "dmxBECreateColormap: No visual found\n");
- return 0;
- }
-}
-
-/** Create colormap on back-end server associated with \a pColormap's
- * screen. */
-Bool dmxCreateColormap(ColormapPtr pColormap)
-{
- ScreenPtr pScreen = pColormap->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- Bool ret = TRUE;
-
- if (!dmxAllocateColormapPrivates(pColormap))
- return FALSE;
-
- if (dmxScreen->beDisplay) {
- if (!dmxBECreateColormap(pColormap))
- return FALSE;
- }
-
- DMX_UNWRAP(CreateColormap, dmxScreen, pScreen);
- if (pScreen->CreateColormap)
- ret = pScreen->CreateColormap(pColormap);
- DMX_WRAP(CreateColormap, dmxCreateColormap, dmxScreen, pScreen);
-
- return ret;
-}
-
-/** Destroy \a pColormap on the back-end server. */
-Bool dmxBEFreeColormap(ColormapPtr pColormap)
-{
- ScreenPtr pScreen = pColormap->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
-
- if (pCmapPriv->cmap) {
- XFreeColormap(dmxScreen->beDisplay, pCmapPriv->cmap);
- pCmapPriv->cmap = (Colormap)0;
- return TRUE;
- }
-
- return FALSE;
-}
-
-/** Destroy colormap on back-end server associated with \a pColormap's
- * screen. */
-void dmxDestroyColormap(ColormapPtr pColormap)
-{
- ScreenPtr pScreen = pColormap->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
-
- if (dmxScreen->beDisplay)
- dmxBEFreeColormap(pColormap);
- free(pCmapPriv);
- DMX_SET_COLORMAP_PRIV(pColormap, NULL);
-
- DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen);
- if (pScreen->DestroyColormap)
- pScreen->DestroyColormap(pColormap);
- DMX_WRAP(DestroyColormap, dmxDestroyColormap, dmxScreen, pScreen);
-}
-
-/** Install colormap on back-end server associated with \a pColormap's
- * screen. */
-void dmxInstallColormap(ColormapPtr pColormap)
-{
- ScreenPtr pScreen = pColormap->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
-
- DMX_UNWRAP(InstallColormap, dmxScreen, pScreen);
- if (pScreen->InstallColormap)
- pScreen->InstallColormap(pColormap);
- DMX_WRAP(InstallColormap, dmxInstallColormap, dmxScreen, pScreen);
-
- if (dmxScreen->beDisplay) {
- XInstallColormap(dmxScreen->beDisplay, pCmapPriv->cmap);
- dmxSync(dmxScreen, FALSE);
- }
-}
-
-/** Store colors in \a pColormap on back-end server associated with \a
- * pColormap's screen. */
-void dmxStoreColors(ColormapPtr pColormap, int ndef, xColorItem *pdef)
-{
- ScreenPtr pScreen = pColormap->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
-
- if (dmxScreen->beDisplay && (pColormap->pVisual->class & DynamicClass)) {
- XColor *color = malloc(sizeof(*color) * ndef);
- int i;
-
- if (color) {
- for (i = 0; i < ndef; i++) {
- color[i].pixel = pdef[i].pixel;
- color[i].red = pdef[i].red;
- color[i].blue = pdef[i].blue;
- color[i].green = pdef[i].green;
- color[i].flags = pdef[i].flags;
- color[i].pad = pdef[i].pad;
- }
- XStoreColors(dmxScreen->beDisplay, pCmapPriv->cmap, color, ndef);
- free(color);
- } else { /* xalloc failed, so fallback */
- XColor c;
- for (i = 0; i < ndef; i++) {
- c.pixel = pdef[i].pixel;
- c.red = pdef[i].red;
- c.blue = pdef[i].blue;
- c.green = pdef[i].green;
- c.flags = pdef[i].flags;
- c.pad = pdef[i].pad;
- XStoreColor(dmxScreen->beDisplay, pCmapPriv->cmap, &c);
- }
- }
- dmxSync(dmxScreen, FALSE);
- }
-
- DMX_UNWRAP(StoreColors, dmxScreen, pScreen);
- if (pScreen->StoreColors)
- pScreen->StoreColors(pColormap, ndef, pdef);
- DMX_WRAP(StoreColors, dmxStoreColors, dmxScreen, pScreen);
-}
-
-/** Create the DMX server's default colormap. */
-Bool dmxCreateDefColormap(ScreenPtr pScreen)
-{
- return miCreateDefColormap(pScreen);
-}
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Colormap support. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxlog.h"
+#include "dmxsync.h"
+#include "dmxcmap.h"
+#include "dmxvisual.h"
+
+#include "micmap.h"
+
+static Bool
+dmxAllocateColormapPrivates(ColormapPtr pColormap)
+{
+ dmxColormapPrivPtr pCmapPriv;
+
+ pCmapPriv = (dmxColormapPrivPtr) malloc(sizeof(*pCmapPriv));
+ if (!pCmapPriv)
+ return FALSE;
+ pCmapPriv->cmap = (Colormap) 0;
+
+ DMX_SET_COLORMAP_PRIV(pColormap, pCmapPriv);
+
+ return TRUE;
+}
+
+/** Create \a pColormap on the back-end server. */
+Bool
+dmxBECreateColormap(ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
+ VisualPtr pVisual = pColormap->pVisual;
+ Visual *visual = dmxLookupVisual(pScreen, pVisual);
+
+ if (visual) {
+ pCmapPriv->cmap = XCreateColormap(dmxScreen->beDisplay,
+ dmxScreen->scrnWin,
+ visual,
+ (pVisual->class & DynamicClass ?
+ AllocAll : AllocNone));
+ return pCmapPriv->cmap != 0;
+ }
+ else {
+ dmxLog(dmxWarning, "dmxBECreateColormap: No visual found\n");
+ return 0;
+ }
+}
+
+/** Create colormap on back-end server associated with \a pColormap's
+ * screen. */
+Bool
+dmxCreateColormap(ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ Bool ret = TRUE;
+
+ if (!dmxAllocateColormapPrivates(pColormap))
+ return FALSE;
+
+ if (dmxScreen->beDisplay) {
+ if (!dmxBECreateColormap(pColormap))
+ return FALSE;
+ }
+
+ DMX_UNWRAP(CreateColormap, dmxScreen, pScreen);
+ if (pScreen->CreateColormap)
+ ret = pScreen->CreateColormap(pColormap);
+ DMX_WRAP(CreateColormap, dmxCreateColormap, dmxScreen, pScreen);
+
+ return ret;
+}
+
+/** Destroy \a pColormap on the back-end server. */
+Bool
+dmxBEFreeColormap(ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
+
+ if (pCmapPriv->cmap) {
+ XFreeColormap(dmxScreen->beDisplay, pCmapPriv->cmap);
+ pCmapPriv->cmap = (Colormap) 0;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/** Destroy colormap on back-end server associated with \a pColormap's
+ * screen. */
+void
+dmxDestroyColormap(ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
+
+ if (dmxScreen->beDisplay)
+ dmxBEFreeColormap(pColormap);
+ free(pCmapPriv);
+ DMX_SET_COLORMAP_PRIV(pColormap, NULL);
+
+ DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen);
+ if (pScreen->DestroyColormap)
+ pScreen->DestroyColormap(pColormap);
+ DMX_WRAP(DestroyColormap, dmxDestroyColormap, dmxScreen, pScreen);
+}
+
+/** Install colormap on back-end server associated with \a pColormap's
+ * screen. */
+void
+dmxInstallColormap(ColormapPtr pColormap)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
+
+ DMX_UNWRAP(InstallColormap, dmxScreen, pScreen);
+ if (pScreen->InstallColormap)
+ pScreen->InstallColormap(pColormap);
+ DMX_WRAP(InstallColormap, dmxInstallColormap, dmxScreen, pScreen);
+
+ if (dmxScreen->beDisplay) {
+ XInstallColormap(dmxScreen->beDisplay, pCmapPriv->cmap);
+ dmxSync(dmxScreen, FALSE);
+ }
+}
+
+/** Store colors in \a pColormap on back-end server associated with \a
+ * pColormap's screen. */
+void
+dmxStoreColors(ColormapPtr pColormap, int ndef, xColorItem * pdef)
+{
+ ScreenPtr pScreen = pColormap->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap);
+
+ if (dmxScreen->beDisplay && (pColormap->pVisual->class & DynamicClass)) {
+ XColor *color = malloc(sizeof(*color) * ndef);
+ int i;
+
+ if (color) {
+ for (i = 0; i < ndef; i++) {
+ color[i].pixel = pdef[i].pixel;
+ color[i].red = pdef[i].red;
+ color[i].blue = pdef[i].blue;
+ color[i].green = pdef[i].green;
+ color[i].flags = pdef[i].flags;
+ color[i].pad = pdef[i].pad;
+ }
+ XStoreColors(dmxScreen->beDisplay, pCmapPriv->cmap, color, ndef);
+ free(color);
+ }
+ else { /* xalloc failed, so fallback */
+ XColor c;
+
+ for (i = 0; i < ndef; i++) {
+ c.pixel = pdef[i].pixel;
+ c.red = pdef[i].red;
+ c.blue = pdef[i].blue;
+ c.green = pdef[i].green;
+ c.flags = pdef[i].flags;
+ c.pad = pdef[i].pad;
+ XStoreColor(dmxScreen->beDisplay, pCmapPriv->cmap, &c);
+ }
+ }
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ DMX_UNWRAP(StoreColors, dmxScreen, pScreen);
+ if (pScreen->StoreColors)
+ pScreen->StoreColors(pColormap, ndef, pdef);
+ DMX_WRAP(StoreColors, dmxStoreColors, dmxScreen, pScreen);
+}
+
+/** Create the DMX server's default colormap. */
+Bool
+dmxCreateDefColormap(ScreenPtr pScreen)
+{
+ return miCreateDefColormap(pScreen);
+}
diff --git a/xorg-server/hw/dmx/dmxcursor.c b/xorg-server/hw/dmx/dmxcursor.c
index 19f5a4139..1a77c7d78 100644
--- a/xorg-server/hw/dmx/dmxcursor.c
+++ b/xorg-server/hw/dmx/dmxcursor.c
@@ -1,989 +1,1023 @@
-/*
- * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * David H. Dawes <dawes@xfree86.org>
- * Kevin E. Martin <kem@redhat.com>
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- * This file contains code than supports cursor movement, including the
- * code that initializes and reinitializes the screen positions and
- * computes screen overlap.
- *
- * "This code is based very closely on the XFree86 equivalent
- * (xfree86/common/xf86Cursor.c)." --David Dawes.
- *
- * "This code was then extensively re-written, as explained here."
- * --Rik Faith
- *
- * The code in xf86Cursor.c used edge lists to implement the
- * CursorOffScreen function. The edge list computation was complex
- * (especially in the face of arbitrarily overlapping screens) compared
- * with the speed savings in the CursorOffScreen function. The new
- * implementation has erred on the side of correctness, readability, and
- * maintainability over efficiency. For the common (non-edge) case, the
- * dmxCursorOffScreen function does avoid a loop over all the screens.
- * When the cursor has left the screen, all the screens are searched,
- * and the first screen (in dmxScreens order) containing the cursor will
- * be returned. If run-time profiling shows that this routing is a
- * performance bottle-neck, then an edge list may have to be
- * reimplemented. An edge list algorithm is O(edges) whereas the new
- * algorithm is O(dmxNumScreens). Since edges is usually 1-3 and
- * dmxNumScreens may be 30-60 for large backend walls, this trade off
- * may be compelling.
- *
- * The xf86InitOrigins routine uses bit masks during the computation and
- * is therefore limited to the length of a word (e.g., 32 or 64 bits)
- * screens. Because Xdmx is expected to be used with a large number of
- * backend displays, this limitation was removed. The new
- * implementation has erred on the side of readability over efficiency,
- * using the dmxSL* routines to manage a screen list instead of a
- * bitmap, and a function call to decrease the length of the main
- * routine. Both algorithms are of the same order, and both are called
- * only at server generation time, so trading clarity and long-term
- * maintainability for efficiency does not seem justified in this case.
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#define DMX_CURSOR_DEBUG 0
-
-#include "dmx.h"
-#include "dmxsync.h"
-#include "dmxcursor.h"
-#include "dmxlog.h"
-#include "dmxprop.h"
-#include "dmxinput.h"
-
-#include "mipointer.h"
-#include "windowstr.h"
-#include "globals.h"
-#include "cursorstr.h"
-#include "dixevents.h" /* For GetSpriteCursor() */
-#include "inputstr.h" /* for inputInfo.pointer */
-
-#if DMX_CURSOR_DEBUG
-#define DMXDBG0(f) dmxLog(dmxDebug,f)
-#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a)
-#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
-#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
-#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d)
-#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
-#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g)
-#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
-#else
-#define DMXDBG0(f)
-#define DMXDBG1(f,a)
-#define DMXDBG2(f,a,b)
-#define DMXDBG3(f,a,b,c)
-#define DMXDBG4(f,a,b,c,d)
-#define DMXDBG5(f,a,b,c,d,e)
-#define DMXDBG6(f,a,b,c,d,e,g)
-#define DMXDBG7(f,a,b,c,d,e,g,h)
-#endif
-
-static int dmxCursorDoMultiCursors = 1;
-
-/** Turn off support for displaying multiple cursors on overlapped
- back-end displays. See #dmxCursorDoMultiCursors. */
-void dmxCursorNoMulti(void)
-{
- dmxCursorDoMultiCursors = 0;
-}
-
-static Bool dmxCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
-{
- DMXScreenInfo *dmxScreen;
- int i;
- int localX = *x;
- int localY = *y;
- int globalX;
- int globalY;
-
- if (screenInfo.numScreens == 1)
- return FALSE;
-
- /* On current screen? */
- dmxScreen = &dmxScreens[(*ppScreen)->myNum];
- if (localX >= 0
- && localX < dmxScreen->rootWidth
- && localY >= 0
- && localY < dmxScreen->rootHeight)
- return FALSE;
-
- /* Convert to global coordinate space */
- globalX = dmxScreen->rootXOrigin + localX;
- globalY = dmxScreen->rootYOrigin + localY;
-
- /* Is cursor on the current screen?
- * This efficiently exits this routine
- * for the most common case. */
- if (ppScreen && *ppScreen) {
- dmxScreen = &dmxScreens[(*ppScreen)->myNum];
- if (globalX >= dmxScreen->rootXOrigin
- && globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth
- && globalY >= dmxScreen->rootYOrigin
- && globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight)
- return FALSE;
- }
-
- /* Find first screen cursor is on */
- for (i = 0; i < dmxNumScreens; i++) {
- dmxScreen = &dmxScreens[i];
- if (globalX >= dmxScreen->rootXOrigin
- && globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth
- && globalY >= dmxScreen->rootYOrigin
- && globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight) {
- if (dmxScreen->index == (*ppScreen)->myNum)
- return FALSE;
- *ppScreen = screenInfo.screens[dmxScreen->index];
- *x = globalX - dmxScreen->rootXOrigin;
- *y = globalY - dmxScreen->rootYOrigin;
- return TRUE;
- }
- }
- return FALSE;
-}
-
-static void dmxCrossScreen(ScreenPtr pScreen, Bool entering)
-{
-}
-
-static void dmxWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
-{
- DMXDBG3("dmxWarpCursor(%d,%d,%d)\n", pScreen->myNum, x, y);
-#if 11 /*BP*/
- /* This call is depracated. Replace with???? */
- miPointerWarpCursor(pDev, pScreen, x, y);
-#else
- pScreen->SetCursorPosition(pDev, pScreen, x, y, FALSE);
-#endif
-}
-
-miPointerScreenFuncRec dmxPointerCursorFuncs =
-{
- dmxCursorOffScreen,
- dmxCrossScreen,
- dmxWarpCursor,
- NULL,
- NULL,
-};
-
-
-/** Create a list of screens that we'll manipulate. */
-static int *dmxSLCreate(void)
-{
- int *list = malloc(dmxNumScreens * sizeof(*list));
- int i;
-
- for (i = 0; i < dmxNumScreens; i++)
- list[i] = 1;
- return list;
-}
-
-/** Free list. */
-static void dmxSLFree(int *list)
-{
- free(list);
-}
-
-/** Find next uninitialized entry in list. */
-static int dmxSLFindNext(int *list)
-{
- int i;
- for (i = 0; i < dmxNumScreens; i++)
- if (list[i])
- return i;
- return -1;
-}
-
-/** Make one pass over all the screens and return the number updated. */
-static int dmxTryComputeScreenOrigins(int *screensLeft)
-{
- ScreenPtr pScreen, refScreen;
- DMXScreenInfo *screen;
- int i, ref;
- int changed = 0;
-
- for (i = 0; i < dmxNumScreens; i++) {
- if (!screensLeft[i])
- continue;
- screen = &dmxScreens[i];
- pScreen = screenInfo.screens[i];
- switch (screen->where) {
- case PosAbsolute:
- pScreen->x = screen->whereX;
- pScreen->y = screen->whereY;
- ++changed, screensLeft[i] = 0;
- break;
- case PosRelative:
- ref = screen->whereRefScreen;
- if (screensLeft[ref])
- break;
- refScreen = screenInfo.screens[ref];
- pScreen->x = refScreen->x + screen->whereX;
- pScreen->y = refScreen->y + screen->whereY;
- ++changed, screensLeft[i] = 0;
- break;
- case PosRightOf:
- ref = screen->whereRefScreen;
- if (screensLeft[ref])
- break;
- refScreen = screenInfo.screens[ref];
- pScreen->x = refScreen->x + refScreen->width;
- pScreen->y = refScreen->y;
- ++changed, screensLeft[i] = 0;
- break;
- case PosLeftOf:
- ref = screen->whereRefScreen;
- if (screensLeft[ref])
- break;
- refScreen = screenInfo.screens[ref];
- pScreen->x = refScreen->x - pScreen->width;
- pScreen->y = refScreen->y;
- ++changed, screensLeft[i] = 0;
- break;
- case PosBelow:
- ref = screen->whereRefScreen;
- if (screensLeft[ref])
- break;
- refScreen = screenInfo.screens[ref];
- pScreen->x = refScreen->x;
- pScreen->y = refScreen->y + refScreen->height;
- ++changed, screensLeft[i] = 0;
- break;
- case PosAbove:
- ref = screen->whereRefScreen;
- if (screensLeft[ref])
- break;
- refScreen = screenInfo.screens[ref];
- pScreen->x = refScreen->x;
- pScreen->y = refScreen->y - pScreen->height;
- ++changed, screensLeft[i] = 0;
- break;
- case PosNone:
- dmxLog(dmxFatal, "No position information for screen %d\n", i);
- }
- }
- return changed;
-}
-
-static void dmxComputeScreenOrigins(void)
-{
- ScreenPtr pScreen;
- int *screensLeft;
- int i, ref;
- int minX, minY;
-
- /* Compute origins based on
- * configuration information. */
- screensLeft = dmxSLCreate();
- while ((i = dmxSLFindNext(screensLeft)) >= 0) {
- while (dmxTryComputeScreenOrigins(screensLeft));
- if ((i = dmxSLFindNext(screensLeft)) >= 0) {
- /* All of the remaining screens are referencing each other.
- * Assign a value to one of them and go through again. This
- * guarantees that we will eventually terminate.
- */
- ref = dmxScreens[i].whereRefScreen;
- pScreen = screenInfo.screens[ref];
- pScreen->x = pScreen->y = 0;
- screensLeft[ref] = 0;
- }
- }
- dmxSLFree(screensLeft);
-
-
- /* Justify the topmost and leftmost to
- * (0,0). */
- minX = screenInfo.screens[0]->x;
- minY = screenInfo.screens[0]->y;
- for (i = 1; i < dmxNumScreens; i++) { /* Compute minX, minY */
- if (screenInfo.screens[i]->x < minX)
- minX = screenInfo.screens[i]->x;
- if (screenInfo.screens[i]->y < minY)
- minY = screenInfo.screens[i]->y;
- }
- if (minX || minY) {
- for (i = 0; i < dmxNumScreens; i++) {
- screenInfo.screens[i]->x -= minX;
- screenInfo.screens[i]->y -= minY;
- }
- }
-}
-
-/** Recompute origin information in the #dmxScreens list. This is
- * called from #dmxInitOrigins. */
-void dmxReInitOrigins(void)
-{
- int i;
-
- if (dmxNumScreens > MAXSCREENS)
- dmxLog(dmxFatal, "dmxNumScreens = %d > MAXSCREENS = %d\n",
- dmxNumScreens, MAXSCREENS);
-
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- dmxLogOutput(dmxScreen,
- "s=%dx%d%+d%+d r=%dx%d%+d%+d @%d,%d"
- " (be=%dx%d depth=%d bpp=%d)\n",
- dmxScreen->scrnWidth, dmxScreen->scrnHeight,
- dmxScreen->scrnX, dmxScreen->scrnY,
-
- dmxScreen->rootWidth, dmxScreen->rootHeight,
- dmxScreen->rootX, dmxScreen->rootY,
-
- dmxScreen->rootXOrigin, dmxScreen->rootYOrigin,
- dmxScreen->beWidth, dmxScreen->beHeight,
- dmxScreen->beDepth, dmxScreen->beBPP);
- }
-}
-
-/** Initialize screen origins (and relative position). This is called
- * for each server generation. For dynamic reconfiguration, use
- * #dmxReInitOrigins() instead. */
-void dmxInitOrigins(void)
-{
- int i;
-
- if (dmxNumScreens > MAXSCREENS)
- dmxLog(dmxFatal, "dmxNumScreens = %d > MAXSCREENS = %d\n",
- dmxNumScreens, MAXSCREENS);
-
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- dmxLogOutput(dmxScreen,
- "(request) s=%dx%d%+d%+d r=%dx%d%+d%+d @%d,%d (%d)"
- " (be=%dx%d depth=%d bpp=%d)\n",
- dmxScreen->scrnWidth, dmxScreen->scrnHeight,
- dmxScreen->scrnX, dmxScreen->scrnY,
-
- dmxScreen->rootWidth, dmxScreen->rootHeight,
- dmxScreen->rootX, dmxScreen->rootY,
-
- dmxScreen->whereX, dmxScreen->whereY,
- dmxScreen->where,
-
- dmxScreen->beWidth, dmxScreen->beHeight,
- dmxScreen->beDepth, dmxScreen->beBPP);
- }
-
- dmxComputeScreenOrigins();
-
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- dmxScreen->rootXOrigin = screenInfo.screens[i]->x;
- dmxScreen->rootYOrigin = screenInfo.screens[i]->y;
- }
-
- dmxReInitOrigins();
-}
-
-/** Returns non-zero if the global \a x, \a y coordinate is on the
- * screen window of the \a dmxScreen. */
-int dmxOnScreen(int x, int y, DMXScreenInfo *dmxScreen)
-{
-#if DMX_CURSOR_DEBUG > 1
- dmxLog(dmxDebug,
- "dmxOnScreen %d %d,%d (r=%dx%d%+d%+d@%d,%d s=%dx%d%+d%+d)\n",
- dmxScreen->index, x, y,
- dmxScreen->rootWidth, dmxScreen->rootHeight,
- dmxScreen->rootX, dmxScreen->rootY,
- dmxScreen->rootXOrigin, dmxScreen->rootYOrigin,
- dmxScreen->scrnWidth, dmxScreen->scrnHeight,
- dmxScreen->scrnX, dmxScreen->scrnY);
-#endif
- if (x >= dmxScreen->rootXOrigin
- && x < dmxScreen->rootXOrigin + dmxScreen->rootWidth
- && y >= dmxScreen->rootYOrigin
- && y < dmxScreen->rootYOrigin + dmxScreen->rootHeight) return 1;
- return 0;
-}
-
-/** Returns non-zero if \a a overlaps \a b. */
-static int dmxDoesOverlap(DMXScreenInfo *a, DMXScreenInfo *b)
-{
- if (dmxOnScreen(a->rootXOrigin,
- a->rootYOrigin, b))
- return 1;
-
- if (dmxOnScreen(a->rootXOrigin,
- a->rootYOrigin + a->scrnWidth, b))
- return 1;
-
- if (dmxOnScreen(a->rootXOrigin + a->scrnHeight,
- a->rootYOrigin, b))
- return 1;
-
- if (dmxOnScreen(a->rootXOrigin + a->scrnHeight,
- a->rootYOrigin + a->scrnWidth, b))
- return 1;
-
- if (dmxOnScreen(b->rootXOrigin,
- b->rootYOrigin, a))
- return 1;
-
- if (dmxOnScreen(b->rootXOrigin,
- b->rootYOrigin + b->scrnWidth, a))
- return 1;
-
- if (dmxOnScreen(b->rootXOrigin + b->scrnHeight,
- b->rootYOrigin, a))
- return 1;
-
- if (dmxOnScreen(b->rootXOrigin + b->scrnHeight,
- b->rootYOrigin + b->scrnWidth, a))
- return 1;
-
- return 0;
-}
-
-/** Used with \a dmxInterateOverlap to print out a list of screens which
- * overlap each other. */
-static void *dmxPrintOverlap(DMXScreenInfo *dmxScreen, void *closure)
-{
- DMXScreenInfo *a = closure;
- if (dmxScreen != a) {
- if (dmxScreen->cursorNotShared)
- dmxLogOutputCont(a, " [%d/%s]", dmxScreen->index, dmxScreen->name);
- else
- dmxLogOutputCont(a, " %d/%s", dmxScreen->index, dmxScreen->name);
- }
- return NULL;
-}
-
-/** Iterate over the screens which overlap with the \a start screen,
- * calling \a f with the \a closure for each argument. Often used with
- * #dmxPrintOverlap. */
-static void *dmxIterateOverlap(DMXScreenInfo *start,
- void *(*f)(DMXScreenInfo *dmxScreen, void *),
- void *closure)
-{
- DMXScreenInfo *pt;
-
- if (!start->over) return f(start, closure);
-
- for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
- void *retval;
- if ((retval = f(pt, closure))) return retval;
- if (pt == start) break;
- }
- return NULL;
-}
-
-/** Used with #dmxPropertyIterate to determine if screen \a a is the
- * same as the screen \a closure. */
-static void *dmxTestSameDisplay(DMXScreenInfo *a, void *closure)
-{
- DMXScreenInfo *b = closure;
-
- if (a == b)
- return a;
- return NULL;
-}
-
-/** Detects overlapping dmxScreens and creates circular lists. This
- * uses an O(dmxNumScreens^2) algorithm, but dmxNumScreens is < 100 and
- * the computation only needs to be performed for every server
- * generation or dynamic reconfiguration . */
-void dmxInitOverlap(void)
-{
- int i, j;
- DMXScreenInfo *a, *b, *pt;
-
- for (i = 0; i < dmxNumScreens; i++)
- dmxScreens[i].over = NULL;
-
- for (i = 0; i < dmxNumScreens; i++) {
- a = &dmxScreens[i];
-
- for (j = i+1; j < dmxNumScreens; j++) {
- b = &dmxScreens[j];
- if (b->over)
- continue;
-
- if (dmxDoesOverlap(a, b)) {
- DMXDBG6("%d overlaps %d: a=%p %p b=%p %p\n",
- a->index, b->index, a, a->over, b, b->over);
- b->over = (a->over ? a->over : a);
- a->over = b;
- }
- }
- }
-
- for (i = 0; i < dmxNumScreens; i++) {
- a = &dmxScreens[i];
-
- if (!a->over)
- continue;
-
- /* Flag all pairs that are on same display */
- for (pt = a->over; pt != a; pt = pt->over) {
- if (dmxPropertyIterate(a, dmxTestSameDisplay, pt)) {
- /* The ->over sets contain the transitive set of screens
- * that overlap. For screens that are on the same
- * backend display, we only want to exclude pairs of
- * screens that mutually overlap on the backend display,
- * so we call dmxDoesOverlap, which is stricter than the
- * ->over set. */
- if (!dmxDoesOverlap(a, pt))
- continue;
- a->cursorNotShared = 1;
- pt->cursorNotShared = 1;
- dmxLog(dmxInfo,
- "Screen %d and %d overlap on %s\n",
- a->index, pt->index, a->name);
- }
- }
- }
-
- for (i = 0; i < dmxNumScreens; i++) {
- a = &dmxScreens[i];
-
- if (a->over) {
- dmxLogOutput(a, "Overlaps");
- dmxIterateOverlap(a, dmxPrintOverlap, a);
- dmxLogOutputCont(a, "\n");
- }
- }
-}
-
-/** Create \a pCursor on the back-end associated with \a pScreen. */
-void dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
- CursorBitsPtr pBits = pCursor->bits;
- Pixmap src, msk;
- XColor fg, bg;
- XImage *img;
- XlibGC gc = NULL;
- XGCValues v;
- unsigned long m;
- int i;
-
- if (!pCursorPriv)
- return;
-
- m = GCFunction | GCPlaneMask | GCForeground | GCBackground | GCClipMask;
- v.function = GXcopy;
- v.plane_mask = AllPlanes;
- v.foreground = 1L;
- v.background = 0L;
- v.clip_mask = None;
-
- for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
- if (dmxScreen->bePixmapFormats[i].depth == 1) {
- /* Create GC in the back-end servers */
- gc = XCreateGC(dmxScreen->beDisplay, dmxScreen->scrnDefDrawables[i],
- m, &v);
- break;
- }
- }
- if (!gc)
- dmxLog(dmxFatal, "dmxRealizeCursor: gc not initialized\n");
-
- src = XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin,
- pBits->width, pBits->height, 1);
- msk = XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin,
- pBits->width, pBits->height, 1);
-
- img = XCreateImage(dmxScreen->beDisplay,
- dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
- 1, XYBitmap, 0, (char *)pBits->source,
- pBits->width, pBits->height,
- BitmapPad(dmxScreen->beDisplay), 0);
-
- XPutImage(dmxScreen->beDisplay, src, gc, img, 0, 0, 0, 0,
- pBits->width, pBits->height);
-
- XFree(img);
-
- img = XCreateImage(dmxScreen->beDisplay,
- dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
- 1, XYBitmap, 0, (char *)pBits->mask,
- pBits->width, pBits->height,
- BitmapPad(dmxScreen->beDisplay), 0);
-
- XPutImage(dmxScreen->beDisplay, msk, gc, img, 0, 0, 0, 0,
- pBits->width, pBits->height);
-
- XFree(img);
-
- fg.red = pCursor->foreRed;
- fg.green = pCursor->foreGreen;
- fg.blue = pCursor->foreBlue;
-
- bg.red = pCursor->backRed;
- bg.green = pCursor->backGreen;
- bg.blue = pCursor->backBlue;
-
- pCursorPriv->cursor = XCreatePixmapCursor(dmxScreen->beDisplay,
- src, msk,
- &fg, &bg,
- pBits->xhot, pBits->yhot);
-
- XFreePixmap(dmxScreen->beDisplay, src);
- XFreePixmap(dmxScreen->beDisplay, msk);
- XFreeGC(dmxScreen->beDisplay, gc);
-
- dmxSync(dmxScreen, FALSE);
-}
-
-static Bool _dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxCursorPrivPtr pCursorPriv;
-
- DMXDBG2("_dmxRealizeCursor(%d,%p)\n", pScreen->myNum, pCursor);
-
- DMX_SET_CURSOR_PRIV(pCursor, pScreen, malloc(sizeof(*pCursorPriv)));
- if (!DMX_GET_CURSOR_PRIV(pCursor, pScreen))
- return FALSE;
-
- pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
- pCursorPriv->cursor = (Cursor)0;
-
- if (!dmxScreen->beDisplay)
- return TRUE;
-
- dmxBECreateCursor(pScreen, pCursor);
- return TRUE;
-}
-
-/** Free \a pCursor on the back-end associated with \a pScreen. */
-Bool dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
-
- if (pCursorPriv) {
- XFreeCursor(dmxScreen->beDisplay, pCursorPriv->cursor);
- pCursorPriv->cursor = (Cursor)0;
- return TRUE;
- }
-
- return FALSE;
-}
-
-static Bool _dmxUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
-
- DMXDBG2("_dmxUnrealizeCursor(%d,%p)\n",
- pScreen->myNum, pCursor);
-
- if (dmxScreen->beDisplay) {
- if (dmxBEFreeCursor(pScreen, pCursor))
- free(DMX_GET_CURSOR_PRIV(pCursor, pScreen));
- }
- DMX_SET_CURSOR_PRIV(pCursor, pScreen, NULL);
-
- return TRUE;
-}
-
-static void _dmxMoveCursor(ScreenPtr pScreen, int x, int y)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- int newX = x + dmxScreen->rootX;
- int newY = y + dmxScreen->rootY;
-
- if (newX < 0) newX = 0;
- if (newY < 0) newY = 0;
-
- DMXDBG5("_dmxMoveCursor(%d,%d,%d) -> %d,%d\n",
- pScreen->myNum, x, y, newX, newY);
- if (dmxScreen->beDisplay) {
- XWarpPointer(dmxScreen->beDisplay, None, dmxScreen->scrnWin,
- 0, 0, 0, 0, newX, newY);
- dmxSync(dmxScreen, TRUE);
- }
-}
-
-static void _dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
-
- DMXDBG4("_dmxSetCursor(%d,%p,%d,%d)\n", pScreen->myNum, pCursor, x, y);
-
- if (pCursor) {
- dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
- if (pCursorPriv && dmxScreen->curCursor != pCursorPriv->cursor) {
- if (dmxScreen->beDisplay)
- XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
- pCursorPriv->cursor);
- dmxScreen->cursor = pCursor;
- dmxScreen->curCursor = pCursorPriv->cursor;
- dmxScreen->cursorVisible = 1;
- }
- _dmxMoveCursor(pScreen, x, y);
- } else {
- if (dmxScreen->beDisplay)
- XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
- dmxScreen->noCursor);
- dmxScreen->cursor = NULL;
- dmxScreen->curCursor = (Cursor)0;
- dmxScreen->cursorVisible = 0;
- }
- if (dmxScreen->beDisplay) dmxSync(dmxScreen, TRUE);
-}
-
-static Bool dmxRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
-{
- DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
- DMXScreenInfo *pt;
-
- if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared)
- return _dmxRealizeCursor(pScreen, pCursor);
-
- for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
- if (pt->cursorNotShared)
- continue;
- _dmxRealizeCursor(screenInfo.screens[pt->index], pCursor);
- if (pt == start)
- break;
- }
- return TRUE;
-}
-
-static Bool dmxUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
-{
- DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
- DMXScreenInfo *pt;
-
- if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared)
- return _dmxUnrealizeCursor(pScreen, pCursor);
-
- for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
- if (pt->cursorNotShared)
- continue;
- _dmxUnrealizeCursor(screenInfo.screens[pt->index], pCursor);
- if (pt == start)
- break;
- }
- return TRUE;
-}
-
-static CursorPtr dmxFindCursor(DMXScreenInfo *start)
-{
- DMXScreenInfo *pt;
-
- if (!start || !start->over)
- return GetSpriteCursor(inputInfo.pointer);
- for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
- if (pt->cursor)
- return pt->cursor;
- if (pt == start)
- break;
- }
- return GetSpriteCursor(inputInfo.pointer);
-}
-
-/** Move the cursor to coordinates (\a x, \a y)on \a pScreen. This
- * function is usually called via #dmxPointerSpriteFuncs, except during
- * reconfiguration when the cursor is repositioned to force an update on
- * newley overlapping screens and on screens that no longer overlap.
- *
- * The coords (x,y) are in global coord space. We'll loop over the
- * back-end screens and see if they contain the global coord. If so, call
- * _dmxMoveCursor() (XWarpPointer) to position the pointer on that screen.
- */
-void dmxMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
-{
- DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
- DMXScreenInfo *pt;
-
- DMXDBG3("dmxMoveCursor(%d,%d,%d)\n", pScreen->myNum, x, y);
-
- if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) {
- _dmxMoveCursor(pScreen, x, y);
- return;
- }
-
- for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
- if (pt->cursorNotShared)
- continue;
- if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) {
- if (/* pt != start && */ !pt->cursorVisible) {
- if (!pt->cursor) {
- /* This only happens during
- * reconfiguration when a new overlap
- * occurs. */
- CursorPtr pCursor;
-
- if ((pCursor = dmxFindCursor(start)))
- _dmxRealizeCursor(screenInfo.screens[pt->index],
- pt->cursor = pCursor);
-
- }
- _dmxSetCursor(screenInfo.screens[pt->index],
- pt->cursor,
- x + start->rootXOrigin - pt->rootXOrigin,
- y + start->rootYOrigin - pt->rootYOrigin);
- }
- _dmxMoveCursor(screenInfo.screens[pt->index],
- x + start->rootXOrigin - pt->rootXOrigin,
- y + start->rootYOrigin - pt->rootYOrigin);
- } else if (/* pt != start && */ pt->cursorVisible) {
- _dmxSetCursor(screenInfo.screens[pt->index],
- NULL,
- x + start->rootXOrigin - pt->rootXOrigin,
- y + start->rootYOrigin - pt->rootYOrigin);
- }
- if (pt == start)
- break;
- }
-}
-
-static void dmxSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
-{
- DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
- DMXScreenInfo *pt;
- int GX, GY, gx, gy;
-
- DMXDBG5("dmxSetCursor(%d %p, %p,%d,%d)\n",
- pScreen->myNum, start, pCursor, x, y);
-
- /* We do this check here because of two cases:
- *
- * 1) if a client calls XWarpPointer()
- * and Xinerama is not running, we can
- * have mi's notion of the pointer
- * position out of phase with DMX's
- * notion.
- *
- * 2) if a down button is held while the
- * cursor moves outside the root window,
- * mi's notion of the pointer position
- * is out of phase with DMX's notion and
- * the cursor can remain visible when it
- * shouldn't be. */
-
- dmxGetGlobalPosition(&GX, &GY);
- gx = start->rootXOrigin + x;
- gy = start->rootYOrigin + y;
- if (x && y && (GX != gx || GY != gy))
- dmxCoreMotion(NULL, gx, gy, 0, DMX_NO_BLOCK);
-
- if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) {
- _dmxSetCursor(pScreen, pCursor, x, y);
- return;
- }
-
- for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
- if (pt->cursorNotShared)
- continue;
- if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) {
- _dmxSetCursor(screenInfo.screens[pt->index], pCursor,
- x + start->rootXOrigin - pt->rootXOrigin,
- y + start->rootYOrigin - pt->rootYOrigin);
- } else {
- _dmxSetCursor(screenInfo.screens[pt->index], NULL,
- x + start->rootXOrigin - pt->rootXOrigin,
- y + start->rootYOrigin - pt->rootYOrigin);
- }
- if (pt == start)
- break;
- }
-}
-
-
-/** This routine is used by the backend input routines to hide the
- * cursor on a screen that is being used for relative input. \see
- * dmxbackend.c */
-void dmxHideCursor(DMXScreenInfo *dmxScreen)
-{
- int x, y;
- ScreenPtr pScreen = screenInfo.screens[dmxScreen->index];
-
- dmxGetGlobalPosition(&x, &y);
- _dmxSetCursor(pScreen, NULL, x, y);
-}
-
-/** This routine is called during reconfiguration to make sure the
- * cursor is visible. */
-void dmxCheckCursor(void)
-{
- int i;
- int x, y;
- ScreenPtr pScreen;
- DMXScreenInfo *firstScreen;
-
- dmxGetGlobalPosition(&x, &y);
- firstScreen = dmxFindFirstScreen(x, y);
-
- DMXDBG2("dmxCheckCursor %d %d\n", x, y);
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- pScreen = screenInfo.screens[dmxScreen->index];
-
- if (!dmxOnScreen(x, y, dmxScreen)) {
- if (firstScreen && i == miPointerGetScreen(inputInfo.pointer)->myNum)
- miPointerSetScreen(inputInfo.pointer, firstScreen->index, x, y);
- _dmxSetCursor(pScreen, NULL,
- x - dmxScreen->rootXOrigin,
- y - dmxScreen->rootYOrigin);
- } else {
- if (!dmxScreen->cursor) {
- CursorPtr pCursor;
-
- if ((pCursor = dmxFindCursor(dmxScreen))) {
- _dmxRealizeCursor(pScreen, dmxScreen->cursor = pCursor);
- }
- }
- _dmxSetCursor(pScreen, dmxScreen->cursor,
- x - dmxScreen->rootXOrigin,
- y - dmxScreen->rootYOrigin);
- }
- }
- DMXDBG2(" leave dmxCheckCursor %d %d\n", x, y);
-}
-
-static Bool dmxDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr)
-{
- return TRUE;
-}
-
-static void dmxDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr)
-{
-}
-
-miPointerSpriteFuncRec dmxPointerSpriteFuncs =
-{
- dmxRealizeCursor,
- dmxUnrealizeCursor,
- dmxSetCursor,
- dmxMoveCursor,
- dmxDeviceCursorInitialize,
- dmxDeviceCursorCleanup
-};
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * David H. Dawes <dawes@xfree86.org>
+ * Kevin E. Martin <kem@redhat.com>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * This file contains code than supports cursor movement, including the
+ * code that initializes and reinitializes the screen positions and
+ * computes screen overlap.
+ *
+ * "This code is based very closely on the XFree86 equivalent
+ * (xfree86/common/xf86Cursor.c)." --David Dawes.
+ *
+ * "This code was then extensively re-written, as explained here."
+ * --Rik Faith
+ *
+ * The code in xf86Cursor.c used edge lists to implement the
+ * CursorOffScreen function. The edge list computation was complex
+ * (especially in the face of arbitrarily overlapping screens) compared
+ * with the speed savings in the CursorOffScreen function. The new
+ * implementation has erred on the side of correctness, readability, and
+ * maintainability over efficiency. For the common (non-edge) case, the
+ * dmxCursorOffScreen function does avoid a loop over all the screens.
+ * When the cursor has left the screen, all the screens are searched,
+ * and the first screen (in dmxScreens order) containing the cursor will
+ * be returned. If run-time profiling shows that this routing is a
+ * performance bottle-neck, then an edge list may have to be
+ * reimplemented. An edge list algorithm is O(edges) whereas the new
+ * algorithm is O(dmxNumScreens). Since edges is usually 1-3 and
+ * dmxNumScreens may be 30-60 for large backend walls, this trade off
+ * may be compelling.
+ *
+ * The xf86InitOrigins routine uses bit masks during the computation and
+ * is therefore limited to the length of a word (e.g., 32 or 64 bits)
+ * screens. Because Xdmx is expected to be used with a large number of
+ * backend displays, this limitation was removed. The new
+ * implementation has erred on the side of readability over efficiency,
+ * using the dmxSL* routines to manage a screen list instead of a
+ * bitmap, and a function call to decrease the length of the main
+ * routine. Both algorithms are of the same order, and both are called
+ * only at server generation time, so trading clarity and long-term
+ * maintainability for efficiency does not seem justified in this case.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_CURSOR_DEBUG 0
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxcursor.h"
+#include "dmxlog.h"
+#include "dmxprop.h"
+#include "dmxinput.h"
+
+#include "mipointer.h"
+#include "windowstr.h"
+#include "globals.h"
+#include "cursorstr.h"
+#include "dixevents.h" /* For GetSpriteCursor() */
+#include "inputstr.h" /* for inputInfo.pointer */
+
+#if DMX_CURSOR_DEBUG
+#define DMXDBG0(f) dmxLog(dmxDebug,f)
+#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a)
+#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
+#else
+#define DMXDBG0(f)
+#define DMXDBG1(f,a)
+#define DMXDBG2(f,a,b)
+#define DMXDBG3(f,a,b,c)
+#define DMXDBG4(f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h)
+#endif
+
+static int dmxCursorDoMultiCursors = 1;
+
+/** Turn off support for displaying multiple cursors on overlapped
+ back-end displays. See #dmxCursorDoMultiCursors. */
+void
+dmxCursorNoMulti(void)
+{
+ dmxCursorDoMultiCursors = 0;
+}
+
+static Bool
+dmxCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
+{
+ DMXScreenInfo *dmxScreen;
+ int i;
+ int localX = *x;
+ int localY = *y;
+ int globalX;
+ int globalY;
+
+ if (screenInfo.numScreens == 1)
+ return FALSE;
+
+ /* On current screen? */
+ dmxScreen = &dmxScreens[(*ppScreen)->myNum];
+ if (localX >= 0
+ && localX < dmxScreen->rootWidth
+ && localY >= 0 && localY < dmxScreen->rootHeight)
+ return FALSE;
+
+ /* Convert to global coordinate space */
+ globalX = dmxScreen->rootXOrigin + localX;
+ globalY = dmxScreen->rootYOrigin + localY;
+
+ /* Is cursor on the current screen?
+ * This efficiently exits this routine
+ * for the most common case. */
+ if (ppScreen && *ppScreen) {
+ dmxScreen = &dmxScreens[(*ppScreen)->myNum];
+ if (globalX >= dmxScreen->rootXOrigin
+ && globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth
+ && globalY >= dmxScreen->rootYOrigin
+ && globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight)
+ return FALSE;
+ }
+
+ /* Find first screen cursor is on */
+ for (i = 0; i < dmxNumScreens; i++) {
+ dmxScreen = &dmxScreens[i];
+ if (globalX >= dmxScreen->rootXOrigin
+ && globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth
+ && globalY >= dmxScreen->rootYOrigin
+ && globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight) {
+ if (dmxScreen->index == (*ppScreen)->myNum)
+ return FALSE;
+ *ppScreen = screenInfo.screens[dmxScreen->index];
+ *x = globalX - dmxScreen->rootXOrigin;
+ *y = globalY - dmxScreen->rootYOrigin;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+static void
+dmxCrossScreen(ScreenPtr pScreen, Bool entering)
+{
+}
+
+static void
+dmxWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+{
+ DMXDBG3("dmxWarpCursor(%d,%d,%d)\n", pScreen->myNum, x, y);
+#if 11 /*BP*/
+ /* This call is depracated. Replace with???? */
+ miPointerWarpCursor(pDev, pScreen, x, y);
+#else
+ pScreen->SetCursorPosition(pDev, pScreen, x, y, FALSE);
+#endif
+}
+
+miPointerScreenFuncRec dmxPointerCursorFuncs = {
+ dmxCursorOffScreen,
+ dmxCrossScreen,
+ dmxWarpCursor,
+ NULL,
+ NULL,
+};
+
+/** Create a list of screens that we'll manipulate. */
+static int *
+dmxSLCreate(void)
+{
+ int *list = malloc(dmxNumScreens * sizeof(*list));
+ int i;
+
+ for (i = 0; i < dmxNumScreens; i++)
+ list[i] = 1;
+ return list;
+}
+
+/** Free list. */
+static void
+dmxSLFree(int *list)
+{
+ free(list);
+}
+
+/** Find next uninitialized entry in list. */
+static int
+dmxSLFindNext(int *list)
+{
+ int i;
+
+ for (i = 0; i < dmxNumScreens; i++)
+ if (list[i])
+ return i;
+ return -1;
+}
+
+/** Make one pass over all the screens and return the number updated. */
+static int
+dmxTryComputeScreenOrigins(int *screensLeft)
+{
+ ScreenPtr pScreen, refScreen;
+ DMXScreenInfo *screen;
+ int i, ref;
+ int changed = 0;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ if (!screensLeft[i])
+ continue;
+ screen = &dmxScreens[i];
+ pScreen = screenInfo.screens[i];
+ switch (screen->where) {
+ case PosAbsolute:
+ pScreen->x = screen->whereX;
+ pScreen->y = screen->whereY;
+ ++changed, screensLeft[i] = 0;
+ break;
+ case PosRelative:
+ ref = screen->whereRefScreen;
+ if (screensLeft[ref])
+ break;
+ refScreen = screenInfo.screens[ref];
+ pScreen->x = refScreen->x + screen->whereX;
+ pScreen->y = refScreen->y + screen->whereY;
+ ++changed, screensLeft[i] = 0;
+ break;
+ case PosRightOf:
+ ref = screen->whereRefScreen;
+ if (screensLeft[ref])
+ break;
+ refScreen = screenInfo.screens[ref];
+ pScreen->x = refScreen->x + refScreen->width;
+ pScreen->y = refScreen->y;
+ ++changed, screensLeft[i] = 0;
+ break;
+ case PosLeftOf:
+ ref = screen->whereRefScreen;
+ if (screensLeft[ref])
+ break;
+ refScreen = screenInfo.screens[ref];
+ pScreen->x = refScreen->x - pScreen->width;
+ pScreen->y = refScreen->y;
+ ++changed, screensLeft[i] = 0;
+ break;
+ case PosBelow:
+ ref = screen->whereRefScreen;
+ if (screensLeft[ref])
+ break;
+ refScreen = screenInfo.screens[ref];
+ pScreen->x = refScreen->x;
+ pScreen->y = refScreen->y + refScreen->height;
+ ++changed, screensLeft[i] = 0;
+ break;
+ case PosAbove:
+ ref = screen->whereRefScreen;
+ if (screensLeft[ref])
+ break;
+ refScreen = screenInfo.screens[ref];
+ pScreen->x = refScreen->x;
+ pScreen->y = refScreen->y - pScreen->height;
+ ++changed, screensLeft[i] = 0;
+ break;
+ case PosNone:
+ dmxLog(dmxFatal, "No position information for screen %d\n", i);
+ }
+ }
+ return changed;
+}
+
+static void
+dmxComputeScreenOrigins(void)
+{
+ ScreenPtr pScreen;
+ int *screensLeft;
+ int i, ref;
+ int minX, minY;
+
+ /* Compute origins based on
+ * configuration information. */
+ screensLeft = dmxSLCreate();
+ while ((i = dmxSLFindNext(screensLeft)) >= 0) {
+ while (dmxTryComputeScreenOrigins(screensLeft));
+ if ((i = dmxSLFindNext(screensLeft)) >= 0) {
+ /* All of the remaining screens are referencing each other.
+ * Assign a value to one of them and go through again. This
+ * guarantees that we will eventually terminate.
+ */
+ ref = dmxScreens[i].whereRefScreen;
+ pScreen = screenInfo.screens[ref];
+ pScreen->x = pScreen->y = 0;
+ screensLeft[ref] = 0;
+ }
+ }
+ dmxSLFree(screensLeft);
+
+ /* Justify the topmost and leftmost to
+ * (0,0). */
+ minX = screenInfo.screens[0]->x;
+ minY = screenInfo.screens[0]->y;
+ for (i = 1; i < dmxNumScreens; i++) { /* Compute minX, minY */
+ if (screenInfo.screens[i]->x < minX)
+ minX = screenInfo.screens[i]->x;
+ if (screenInfo.screens[i]->y < minY)
+ minY = screenInfo.screens[i]->y;
+ }
+ if (minX || minY) {
+ for (i = 0; i < dmxNumScreens; i++) {
+ screenInfo.screens[i]->x -= minX;
+ screenInfo.screens[i]->y -= minY;
+ }
+ }
+}
+
+/** Recompute origin information in the #dmxScreens list. This is
+ * called from #dmxInitOrigins. */
+void
+dmxReInitOrigins(void)
+{
+ int i;
+
+ if (dmxNumScreens > MAXSCREENS)
+ dmxLog(dmxFatal, "dmxNumScreens = %d > MAXSCREENS = %d\n",
+ dmxNumScreens, MAXSCREENS);
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ dmxLogOutput(dmxScreen,
+ "s=%dx%d%+d%+d r=%dx%d%+d%+d @%d,%d"
+ " (be=%dx%d depth=%d bpp=%d)\n",
+ dmxScreen->scrnWidth, dmxScreen->scrnHeight,
+ dmxScreen->scrnX, dmxScreen->scrnY,
+ dmxScreen->rootWidth, dmxScreen->rootHeight,
+ dmxScreen->rootX, dmxScreen->rootY,
+ dmxScreen->rootXOrigin, dmxScreen->rootYOrigin,
+ dmxScreen->beWidth, dmxScreen->beHeight,
+ dmxScreen->beDepth, dmxScreen->beBPP);
+ }
+}
+
+/** Initialize screen origins (and relative position). This is called
+ * for each server generation. For dynamic reconfiguration, use
+ * #dmxReInitOrigins() instead. */
+void
+dmxInitOrigins(void)
+{
+ int i;
+
+ if (dmxNumScreens > MAXSCREENS)
+ dmxLog(dmxFatal, "dmxNumScreens = %d > MAXSCREENS = %d\n",
+ dmxNumScreens, MAXSCREENS);
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ dmxLogOutput(dmxScreen,
+ "(request) s=%dx%d%+d%+d r=%dx%d%+d%+d @%d,%d (%d)"
+ " (be=%dx%d depth=%d bpp=%d)\n",
+ dmxScreen->scrnWidth, dmxScreen->scrnHeight,
+ dmxScreen->scrnX, dmxScreen->scrnY,
+ dmxScreen->rootWidth, dmxScreen->rootHeight,
+ dmxScreen->rootX, dmxScreen->rootY,
+ dmxScreen->whereX, dmxScreen->whereY,
+ dmxScreen->where,
+ dmxScreen->beWidth, dmxScreen->beHeight,
+ dmxScreen->beDepth, dmxScreen->beBPP);
+ }
+
+ dmxComputeScreenOrigins();
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ dmxScreen->rootXOrigin = screenInfo.screens[i]->x;
+ dmxScreen->rootYOrigin = screenInfo.screens[i]->y;
+ }
+
+ dmxReInitOrigins();
+}
+
+/** Returns non-zero if the global \a x, \a y coordinate is on the
+ * screen window of the \a dmxScreen. */
+int
+dmxOnScreen(int x, int y, DMXScreenInfo * dmxScreen)
+{
+#if DMX_CURSOR_DEBUG > 1
+ dmxLog(dmxDebug,
+ "dmxOnScreen %d %d,%d (r=%dx%d%+d%+d@%d,%d s=%dx%d%+d%+d)\n",
+ dmxScreen->index, x, y,
+ dmxScreen->rootWidth, dmxScreen->rootHeight,
+ dmxScreen->rootX, dmxScreen->rootY,
+ dmxScreen->rootXOrigin, dmxScreen->rootYOrigin,
+ dmxScreen->scrnWidth, dmxScreen->scrnHeight,
+ dmxScreen->scrnX, dmxScreen->scrnY);
+#endif
+ if (x >= dmxScreen->rootXOrigin
+ && x < dmxScreen->rootXOrigin + dmxScreen->rootWidth
+ && y >= dmxScreen->rootYOrigin
+ && y < dmxScreen->rootYOrigin + dmxScreen->rootHeight)
+ return 1;
+ return 0;
+}
+
+/** Returns non-zero if \a a overlaps \a b. */
+static int
+dmxDoesOverlap(DMXScreenInfo * a, DMXScreenInfo * b)
+{
+ if (dmxOnScreen(a->rootXOrigin, a->rootYOrigin, b))
+ return 1;
+
+ if (dmxOnScreen(a->rootXOrigin, a->rootYOrigin + a->scrnWidth, b))
+ return 1;
+
+ if (dmxOnScreen(a->rootXOrigin + a->scrnHeight, a->rootYOrigin, b))
+ return 1;
+
+ if (dmxOnScreen(a->rootXOrigin + a->scrnHeight,
+ a->rootYOrigin + a->scrnWidth, b))
+ return 1;
+
+ if (dmxOnScreen(b->rootXOrigin, b->rootYOrigin, a))
+ return 1;
+
+ if (dmxOnScreen(b->rootXOrigin, b->rootYOrigin + b->scrnWidth, a))
+ return 1;
+
+ if (dmxOnScreen(b->rootXOrigin + b->scrnHeight, b->rootYOrigin, a))
+ return 1;
+
+ if (dmxOnScreen(b->rootXOrigin + b->scrnHeight,
+ b->rootYOrigin + b->scrnWidth, a))
+ return 1;
+
+ return 0;
+}
+
+/** Used with \a dmxInterateOverlap to print out a list of screens which
+ * overlap each other. */
+static void *
+dmxPrintOverlap(DMXScreenInfo * dmxScreen, void *closure)
+{
+ DMXScreenInfo *a = closure;
+
+ if (dmxScreen != a) {
+ if (dmxScreen->cursorNotShared)
+ dmxLogOutputCont(a, " [%d/%s]", dmxScreen->index, dmxScreen->name);
+ else
+ dmxLogOutputCont(a, " %d/%s", dmxScreen->index, dmxScreen->name);
+ }
+ return NULL;
+}
+
+/** Iterate over the screens which overlap with the \a start screen,
+ * calling \a f with the \a closure for each argument. Often used with
+ * #dmxPrintOverlap. */
+static void *
+dmxIterateOverlap(DMXScreenInfo * start,
+ void *(*f) (DMXScreenInfo * dmxScreen, void *), void *closure)
+{
+ DMXScreenInfo *pt;
+
+ if (!start->over)
+ return f(start, closure);
+
+ for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) {
+ void *retval;
+
+ if ((retval = f(pt, closure)))
+ return retval;
+ if (pt == start)
+ break;
+ }
+ return NULL;
+}
+
+/** Used with #dmxPropertyIterate to determine if screen \a a is the
+ * same as the screen \a closure. */
+static void *
+dmxTestSameDisplay(DMXScreenInfo * a, void *closure)
+{
+ DMXScreenInfo *b = closure;
+
+ if (a == b)
+ return a;
+ return NULL;
+}
+
+/** Detects overlapping dmxScreens and creates circular lists. This
+ * uses an O(dmxNumScreens^2) algorithm, but dmxNumScreens is < 100 and
+ * the computation only needs to be performed for every server
+ * generation or dynamic reconfiguration . */
+void
+dmxInitOverlap(void)
+{
+ int i, j;
+ DMXScreenInfo *a, *b, *pt;
+
+ for (i = 0; i < dmxNumScreens; i++)
+ dmxScreens[i].over = NULL;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ a = &dmxScreens[i];
+
+ for (j = i + 1; j < dmxNumScreens; j++) {
+ b = &dmxScreens[j];
+ if (b->over)
+ continue;
+
+ if (dmxDoesOverlap(a, b)) {
+ DMXDBG6("%d overlaps %d: a=%p %p b=%p %p\n",
+ a->index, b->index, a, a->over, b, b->over);
+ b->over = (a->over ? a->over : a);
+ a->over = b;
+ }
+ }
+ }
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ a = &dmxScreens[i];
+
+ if (!a->over)
+ continue;
+
+ /* Flag all pairs that are on same display */
+ for (pt = a->over; pt != a; pt = pt->over) {
+ if (dmxPropertyIterate(a, dmxTestSameDisplay, pt)) {
+ /* The ->over sets contain the transitive set of screens
+ * that overlap. For screens that are on the same
+ * backend display, we only want to exclude pairs of
+ * screens that mutually overlap on the backend display,
+ * so we call dmxDoesOverlap, which is stricter than the
+ * ->over set. */
+ if (!dmxDoesOverlap(a, pt))
+ continue;
+ a->cursorNotShared = 1;
+ pt->cursorNotShared = 1;
+ dmxLog(dmxInfo,
+ "Screen %d and %d overlap on %s\n",
+ a->index, pt->index, a->name);
+ }
+ }
+ }
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ a = &dmxScreens[i];
+
+ if (a->over) {
+ dmxLogOutput(a, "Overlaps");
+ dmxIterateOverlap(a, dmxPrintOverlap, a);
+ dmxLogOutputCont(a, "\n");
+ }
+ }
+}
+
+/** Create \a pCursor on the back-end associated with \a pScreen. */
+void
+dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
+ CursorBitsPtr pBits = pCursor->bits;
+ Pixmap src, msk;
+ XColor fg, bg;
+ XImage *img;
+ XlibGC gc = NULL;
+ XGCValues v;
+ unsigned long m;
+ int i;
+
+ if (!pCursorPriv)
+ return;
+
+ m = GCFunction | GCPlaneMask | GCForeground | GCBackground | GCClipMask;
+ v.function = GXcopy;
+ v.plane_mask = AllPlanes;
+ v.foreground = 1L;
+ v.background = 0L;
+ v.clip_mask = None;
+
+ for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
+ if (dmxScreen->bePixmapFormats[i].depth == 1) {
+ /* Create GC in the back-end servers */
+ gc = XCreateGC(dmxScreen->beDisplay, dmxScreen->scrnDefDrawables[i],
+ m, &v);
+ break;
+ }
+ }
+ if (!gc)
+ dmxLog(dmxFatal, "dmxRealizeCursor: gc not initialized\n");
+
+ src = XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ pBits->width, pBits->height, 1);
+ msk = XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ pBits->width, pBits->height, 1);
+
+ img = XCreateImage(dmxScreen->beDisplay,
+ dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
+ 1, XYBitmap, 0, (char *) pBits->source,
+ pBits->width, pBits->height,
+ BitmapPad(dmxScreen->beDisplay), 0);
+
+ XPutImage(dmxScreen->beDisplay, src, gc, img, 0, 0, 0, 0,
+ pBits->width, pBits->height);
+
+ XFree(img);
+
+ img = XCreateImage(dmxScreen->beDisplay,
+ dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
+ 1, XYBitmap, 0, (char *) pBits->mask,
+ pBits->width, pBits->height,
+ BitmapPad(dmxScreen->beDisplay), 0);
+
+ XPutImage(dmxScreen->beDisplay, msk, gc, img, 0, 0, 0, 0,
+ pBits->width, pBits->height);
+
+ XFree(img);
+
+ fg.red = pCursor->foreRed;
+ fg.green = pCursor->foreGreen;
+ fg.blue = pCursor->foreBlue;
+
+ bg.red = pCursor->backRed;
+ bg.green = pCursor->backGreen;
+ bg.blue = pCursor->backBlue;
+
+ pCursorPriv->cursor = XCreatePixmapCursor(dmxScreen->beDisplay,
+ src, msk,
+ &fg, &bg,
+ pBits->xhot, pBits->yhot);
+
+ XFreePixmap(dmxScreen->beDisplay, src);
+ XFreePixmap(dmxScreen->beDisplay, msk);
+ XFreeGC(dmxScreen->beDisplay, gc);
+
+ dmxSync(dmxScreen, FALSE);
+}
+
+static Bool
+_dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxCursorPrivPtr pCursorPriv;
+
+ DMXDBG2("_dmxRealizeCursor(%d,%p)\n", pScreen->myNum, pCursor);
+
+ DMX_SET_CURSOR_PRIV(pCursor, pScreen, malloc(sizeof(*pCursorPriv)));
+ if (!DMX_GET_CURSOR_PRIV(pCursor, pScreen))
+ return FALSE;
+
+ pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
+ pCursorPriv->cursor = (Cursor) 0;
+
+ if (!dmxScreen->beDisplay)
+ return TRUE;
+
+ dmxBECreateCursor(pScreen, pCursor);
+ return TRUE;
+}
+
+/** Free \a pCursor on the back-end associated with \a pScreen. */
+Bool
+dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
+
+ if (pCursorPriv) {
+ XFreeCursor(dmxScreen->beDisplay, pCursorPriv->cursor);
+ pCursorPriv->cursor = (Cursor) 0;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static Bool
+_dmxUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+
+ DMXDBG2("_dmxUnrealizeCursor(%d,%p)\n", pScreen->myNum, pCursor);
+
+ if (dmxScreen->beDisplay) {
+ if (dmxBEFreeCursor(pScreen, pCursor))
+ free(DMX_GET_CURSOR_PRIV(pCursor, pScreen));
+ }
+ DMX_SET_CURSOR_PRIV(pCursor, pScreen, NULL);
+
+ return TRUE;
+}
+
+static void
+_dmxMoveCursor(ScreenPtr pScreen, int x, int y)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ int newX = x + dmxScreen->rootX;
+ int newY = y + dmxScreen->rootY;
+
+ if (newX < 0)
+ newX = 0;
+ if (newY < 0)
+ newY = 0;
+
+ DMXDBG5("_dmxMoveCursor(%d,%d,%d) -> %d,%d\n",
+ pScreen->myNum, x, y, newX, newY);
+ if (dmxScreen->beDisplay) {
+ XWarpPointer(dmxScreen->beDisplay, None, dmxScreen->scrnWin,
+ 0, 0, 0, 0, newX, newY);
+ dmxSync(dmxScreen, TRUE);
+ }
+}
+
+static void
+_dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+
+ DMXDBG4("_dmxSetCursor(%d,%p,%d,%d)\n", pScreen->myNum, pCursor, x, y);
+
+ if (pCursor) {
+ dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen);
+
+ if (pCursorPriv && dmxScreen->curCursor != pCursorPriv->cursor) {
+ if (dmxScreen->beDisplay)
+ XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ pCursorPriv->cursor);
+ dmxScreen->cursor = pCursor;
+ dmxScreen->curCursor = pCursorPriv->cursor;
+ dmxScreen->cursorVisible = 1;
+ }
+ _dmxMoveCursor(pScreen, x, y);
+ }
+ else {
+ if (dmxScreen->beDisplay)
+ XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ dmxScreen->noCursor);
+ dmxScreen->cursor = NULL;
+ dmxScreen->curCursor = (Cursor) 0;
+ dmxScreen->cursorVisible = 0;
+ }
+ if (dmxScreen->beDisplay)
+ dmxSync(dmxScreen, TRUE);
+}
+
+static Bool
+dmxRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
+{
+ DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
+ DMXScreenInfo *pt;
+
+ if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared)
+ return _dmxRealizeCursor(pScreen, pCursor);
+
+ for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) {
+ if (pt->cursorNotShared)
+ continue;
+ _dmxRealizeCursor(screenInfo.screens[pt->index], pCursor);
+ if (pt == start)
+ break;
+ }
+ return TRUE;
+}
+
+static Bool
+dmxUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
+{
+ DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
+ DMXScreenInfo *pt;
+
+ if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared)
+ return _dmxUnrealizeCursor(pScreen, pCursor);
+
+ for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) {
+ if (pt->cursorNotShared)
+ continue;
+ _dmxUnrealizeCursor(screenInfo.screens[pt->index], pCursor);
+ if (pt == start)
+ break;
+ }
+ return TRUE;
+}
+
+static CursorPtr
+dmxFindCursor(DMXScreenInfo * start)
+{
+ DMXScreenInfo *pt;
+
+ if (!start || !start->over)
+ return GetSpriteCursor(inputInfo.pointer);
+ for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) {
+ if (pt->cursor)
+ return pt->cursor;
+ if (pt == start)
+ break;
+ }
+ return GetSpriteCursor(inputInfo.pointer);
+}
+
+/** Move the cursor to coordinates (\a x, \a y)on \a pScreen. This
+ * function is usually called via #dmxPointerSpriteFuncs, except during
+ * reconfiguration when the cursor is repositioned to force an update on
+ * newley overlapping screens and on screens that no longer overlap.
+ *
+ * The coords (x,y) are in global coord space. We'll loop over the
+ * back-end screens and see if they contain the global coord. If so, call
+ * _dmxMoveCursor() (XWarpPointer) to position the pointer on that screen.
+ */
+void
+dmxMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+{
+ DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
+ DMXScreenInfo *pt;
+
+ DMXDBG3("dmxMoveCursor(%d,%d,%d)\n", pScreen->myNum, x, y);
+
+ if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) {
+ _dmxMoveCursor(pScreen, x, y);
+ return;
+ }
+
+ for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) {
+ if (pt->cursorNotShared)
+ continue;
+ if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) {
+ if ( /* pt != start && */ !pt->cursorVisible) {
+ if (!pt->cursor) {
+ /* This only happens during
+ * reconfiguration when a new overlap
+ * occurs. */
+ CursorPtr pCursor;
+
+ if ((pCursor = dmxFindCursor(start)))
+ _dmxRealizeCursor(screenInfo.screens[pt->index],
+ pt->cursor = pCursor);
+
+ }
+ _dmxSetCursor(screenInfo.screens[pt->index],
+ pt->cursor,
+ x + start->rootXOrigin - pt->rootXOrigin,
+ y + start->rootYOrigin - pt->rootYOrigin);
+ }
+ _dmxMoveCursor(screenInfo.screens[pt->index],
+ x + start->rootXOrigin - pt->rootXOrigin,
+ y + start->rootYOrigin - pt->rootYOrigin);
+ }
+ else if ( /* pt != start && */ pt->cursorVisible) {
+ _dmxSetCursor(screenInfo.screens[pt->index],
+ NULL,
+ x + start->rootXOrigin - pt->rootXOrigin,
+ y + start->rootYOrigin - pt->rootYOrigin);
+ }
+ if (pt == start)
+ break;
+ }
+}
+
+static void
+dmxSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x,
+ int y)
+{
+ DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
+ DMXScreenInfo *pt;
+ int GX, GY, gx, gy;
+
+ DMXDBG5("dmxSetCursor(%d %p, %p,%d,%d)\n",
+ pScreen->myNum, start, pCursor, x, y);
+
+ /* We do this check here because of two cases:
+ *
+ * 1) if a client calls XWarpPointer()
+ * and Xinerama is not running, we can
+ * have mi's notion of the pointer
+ * position out of phase with DMX's
+ * notion.
+ *
+ * 2) if a down button is held while the
+ * cursor moves outside the root window,
+ * mi's notion of the pointer position
+ * is out of phase with DMX's notion and
+ * the cursor can remain visible when it
+ * shouldn't be. */
+
+ dmxGetGlobalPosition(&GX, &GY);
+ gx = start->rootXOrigin + x;
+ gy = start->rootYOrigin + y;
+ if (x && y && (GX != gx || GY != gy))
+ dmxCoreMotion(NULL, gx, gy, 0, DMX_NO_BLOCK);
+
+ if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) {
+ _dmxSetCursor(pScreen, pCursor, x, y);
+ return;
+ }
+
+ for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) {
+ if (pt->cursorNotShared)
+ continue;
+ if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) {
+ _dmxSetCursor(screenInfo.screens[pt->index], pCursor,
+ x + start->rootXOrigin - pt->rootXOrigin,
+ y + start->rootYOrigin - pt->rootYOrigin);
+ }
+ else {
+ _dmxSetCursor(screenInfo.screens[pt->index], NULL,
+ x + start->rootXOrigin - pt->rootXOrigin,
+ y + start->rootYOrigin - pt->rootYOrigin);
+ }
+ if (pt == start)
+ break;
+ }
+}
+
+/** This routine is used by the backend input routines to hide the
+ * cursor on a screen that is being used for relative input. \see
+ * dmxbackend.c */
+void
+dmxHideCursor(DMXScreenInfo * dmxScreen)
+{
+ int x, y;
+ ScreenPtr pScreen = screenInfo.screens[dmxScreen->index];
+
+ dmxGetGlobalPosition(&x, &y);
+ _dmxSetCursor(pScreen, NULL, x, y);
+}
+
+/** This routine is called during reconfiguration to make sure the
+ * cursor is visible. */
+void
+dmxCheckCursor(void)
+{
+ int i;
+ int x, y;
+ ScreenPtr pScreen;
+ DMXScreenInfo *firstScreen;
+
+ dmxGetGlobalPosition(&x, &y);
+ firstScreen = dmxFindFirstScreen(x, y);
+
+ DMXDBG2("dmxCheckCursor %d %d\n", x, y);
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ pScreen = screenInfo.screens[dmxScreen->index];
+
+ if (!dmxOnScreen(x, y, dmxScreen)) {
+ if (firstScreen &&
+ i == miPointerGetScreen(inputInfo.pointer)->myNum)
+ miPointerSetScreen(inputInfo.pointer, firstScreen->index, x,
+ y);
+ _dmxSetCursor(pScreen, NULL, x - dmxScreen->rootXOrigin,
+ y - dmxScreen->rootYOrigin);
+ }
+ else {
+ if (!dmxScreen->cursor) {
+ CursorPtr pCursor;
+
+ if ((pCursor = dmxFindCursor(dmxScreen))) {
+ _dmxRealizeCursor(pScreen, dmxScreen->cursor = pCursor);
+ }
+ }
+ _dmxSetCursor(pScreen, dmxScreen->cursor,
+ x - dmxScreen->rootXOrigin,
+ y - dmxScreen->rootYOrigin);
+ }
+ }
+ DMXDBG2(" leave dmxCheckCursor %d %d\n", x, y);
+}
+
+static Bool
+dmxDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr)
+{
+ return TRUE;
+}
+
+static void
+dmxDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr)
+{
+}
+
+miPointerSpriteFuncRec dmxPointerSpriteFuncs = {
+ dmxRealizeCursor,
+ dmxUnrealizeCursor,
+ dmxSetCursor,
+ dmxMoveCursor,
+ dmxDeviceCursorInitialize,
+ dmxDeviceCursorCleanup
+};
diff --git a/xorg-server/hw/dmx/dmxdpms.c b/xorg-server/hw/dmx/dmxdpms.c
index 2af160556..d53a3d998 100644
--- a/xorg-server/hw/dmx/dmxdpms.c
+++ b/xorg-server/hw/dmx/dmxdpms.c
@@ -54,36 +54,37 @@
#include <X11/extensions/dpms.h>
static unsigned long dpmsGeneration = 0;
-static Bool dpmsSupported = TRUE;
+static Bool dpmsSupported = TRUE;
-static void _dmxDPMSInit(DMXScreenInfo *dmxScreen)
+static void
+_dmxDPMSInit(DMXScreenInfo * dmxScreen)
{
- int event_base, error_base;
- int major, minor;
- CARD16 level, standby, suspend, off;
- BOOL state;
+ int event_base, error_base;
+ int major, minor;
+ CARD16 level, standby, suspend, off;
+ BOOL state;
const char *monitor;
if (dpmsGeneration != serverGeneration) {
- dpmsSupported = TRUE; /* On unless a backend doesn't support it */
+ dpmsSupported = TRUE; /* On unless a backend doesn't support it */
dpmsGeneration = serverGeneration;
}
#ifdef DPMSExtension
- if (DPMSDisabledSwitch) dpmsSupported = FALSE; /* -dpms turns off */
+ if (DPMSDisabledSwitch)
+ dpmsSupported = FALSE; /* -dpms turns off */
#endif
dmxScreen->dpmsCapable = 0;
-
+
if (!dmxScreen->beDisplay) {
dmxLogOutput(dmxScreen,
- "Cannot determine if DPMS supported (detached screen)\n");
+ "Cannot determine if DPMS supported (detached screen)\n");
dpmsSupported = FALSE;
return;
}
- if (!DPMSQueryExtension(dmxScreen->beDisplay,
- &event_base, &error_base)) {
+ if (!DPMSQueryExtension(dmxScreen->beDisplay, &event_base, &error_base)) {
dmxLogOutput(dmxScreen, "DPMS not supported\n");
dpmsSupported = FALSE;
return;
@@ -106,19 +107,29 @@ static void _dmxDPMSInit(DMXScreenInfo *dmxScreen)
DPMSEnable(dmxScreen->beDisplay);
DPMSForceLevel(dmxScreen->beDisplay, DPMSModeOn);
dmxScreen->dpmsCapable = 1;
- dmxScreen->dpmsEnabled = !!state;
+ dmxScreen->dpmsEnabled = ! !state;
dmxScreen->dpmsStandby = standby;
dmxScreen->dpmsSuspend = suspend;
- dmxScreen->dpmsOff = off;
+ dmxScreen->dpmsOff = off;
switch (level) {
- case DPMSModeOn: monitor = "on"; break;
- case DPMSModeStandby: monitor = "standby"; break;
- case DPMSModeSuspend: monitor = "suspend"; break;
- case DPMSModeOff: monitor = "off"; break;
- default: monitor = "unknown"; break;
+ case DPMSModeOn:
+ monitor = "on";
+ break;
+ case DPMSModeStandby:
+ monitor = "standby";
+ break;
+ case DPMSModeSuspend:
+ monitor = "suspend";
+ break;
+ case DPMSModeOff:
+ monitor = "off";
+ break;
+ default:
+ monitor = "unknown";
+ break;
}
-
+
dmxLogOutput(dmxScreen,
"DPMS %d.%d (%s, %s, %d %d %d)\n",
major, minor, monitor, state ? "enabled" : "disabled",
@@ -127,86 +138,98 @@ static void _dmxDPMSInit(DMXScreenInfo *dmxScreen)
/** Initialize DPMS support. We save the current settings and turn off
* DPMS. The settings are restored in #dmxDPMSTerm. */
-void dmxDPMSInit(DMXScreenInfo *dmxScreen)
+void
+dmxDPMSInit(DMXScreenInfo * dmxScreen)
{
- int interval, preferBlanking, allowExposures;
+ int interval, preferBlanking, allowExposures;
- /* Turn off DPMS */
+ /* Turn off DPMS */
_dmxDPMSInit(dmxScreen);
if (!dmxScreen->beDisplay)
- return;
+ return;
- /* Turn off screen saver */
+ /* Turn off screen saver */
XGetScreenSaver(dmxScreen->beDisplay, &dmxScreen->savedTimeout, &interval,
- &preferBlanking, &allowExposures);
+ &preferBlanking, &allowExposures);
XSetScreenSaver(dmxScreen->beDisplay, 0, interval,
- preferBlanking, allowExposures);
+ preferBlanking, allowExposures);
XResetScreenSaver(dmxScreen->beDisplay);
dmxSync(dmxScreen, FALSE);
}
/** Terminate DPMS support on \a dmxScreen. We restore the settings
* saved in #dmxDPMSInit. */
-void dmxDPMSTerm(DMXScreenInfo *dmxScreen)
+void
+dmxDPMSTerm(DMXScreenInfo * dmxScreen)
{
- int timeout, interval, preferBlanking, allowExposures;
+ int timeout, interval, preferBlanking, allowExposures;
if (!dmxScreen->beDisplay)
- return;
+ return;
XGetScreenSaver(dmxScreen->beDisplay, &timeout, &interval,
- &preferBlanking, &allowExposures);
+ &preferBlanking, &allowExposures);
XSetScreenSaver(dmxScreen->beDisplay, dmxScreen->savedTimeout, interval,
- preferBlanking, allowExposures);
+ preferBlanking, allowExposures);
if (dmxScreen->dpmsCapable) {
- /* Restore saved state */
+ /* Restore saved state */
DPMSForceLevel(dmxScreen->beDisplay, DPMSModeOn);
DPMSSetTimeouts(dmxScreen->beDisplay, dmxScreen->dpmsStandby,
dmxScreen->dpmsSuspend, dmxScreen->dpmsOff);
- if (dmxScreen->dpmsEnabled) DPMSEnable(dmxScreen->beDisplay);
- else DPMSDisable(dmxScreen->beDisplay);
+ if (dmxScreen->dpmsEnabled)
+ DPMSEnable(dmxScreen->beDisplay);
+ else
+ DPMSDisable(dmxScreen->beDisplay);
}
dmxSync(dmxScreen, FALSE);
}
/** Called when activity is detected so that DPMS power-saving mode can
* be deactivated. */
-void dmxDPMSWakeup(void)
+void
+dmxDPMSWakeup(void)
{
if (screenIsSaved == SCREEN_SAVER_ON)
dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
#ifdef DPMSExtension
- if (DPMSPowerLevel) DPMSSet(serverClient, 0);
+ if (DPMSPowerLevel)
+ DPMSSet(serverClient, 0);
#endif
}
#ifdef DPMSExtension
/** This is called on each server generation. It should determine if
* DPMS is supported on all of the backends and, if so, return TRUE. */
-Bool DPMSSupported(void)
+Bool
+DPMSSupported(void)
{
return dpmsSupported;
}
/** This is used by clients (e.g., xset) to set the DPMS level. */
-int DPMSSet(ClientPtr client, int level)
+int
+DPMSSet(ClientPtr client, int level)
{
int i;
- if (!dpmsSupported) return Success;
+ if (!dpmsSupported)
+ return Success;
+
+ if (level < 0)
+ level = DPMSModeOn;
+ if (level > 3)
+ level = DPMSModeOff;
- if (level < 0) level = DPMSModeOn;
- if (level > 3) level = DPMSModeOff;
-
DPMSPowerLevel = level;
for (i = 0; i < dmxNumScreens; i++) {
DMXScreenInfo *dmxScreen = &dmxScreens[i];
- if (dmxScreen->beDisplay) {
- DPMSForceLevel(dmxScreen->beDisplay, level);
- dmxSync(dmxScreen, FALSE);
- }
+
+ if (dmxScreen->beDisplay) {
+ DPMSForceLevel(dmxScreen->beDisplay, level);
+ dmxSync(dmxScreen, FALSE);
+ }
}
return Success;
}
diff --git a/xorg-server/hw/dmx/dmxextension.c b/xorg-server/hw/dmx/dmxextension.c
index 80d11ee89..faa28a590 100644
--- a/xorg-server/hw/dmx/dmxextension.c
+++ b/xorg-server/hw/dmx/dmxextension.c
@@ -60,86 +60,89 @@
#include "input/dmxinputinit.h"
#include "windowstr.h"
-#include "inputstr.h" /* For DeviceIntRec */
-#include <X11/extensions/dmxproto.h> /* For DMX_BAD_* */
+#include "inputstr.h" /* For DeviceIntRec */
+#include <X11/extensions/dmxproto.h> /* For DMX_BAD_* */
#include "cursorstr.h"
/* The default font is declared in dix/globals.c, but is not included in
* _any_ header files. */
-extern FontPtr defaultFont;
-
+extern FontPtr defaultFont;
+
/** This routine provides information to the DMX protocol extension
* about a particular screen. */
-Bool dmxGetScreenAttributes(int physical, DMXScreenAttributesPtr attr)
+Bool
+dmxGetScreenAttributes(int physical, DMXScreenAttributesPtr attr)
{
DMXScreenInfo *dmxScreen;
- if (physical < 0 || physical >= dmxNumScreens) return FALSE;
+ if (physical < 0 || physical >= dmxNumScreens)
+ return FALSE;
dmxScreen = &dmxScreens[physical];
- attr->displayName = dmxScreen->name;
+ attr->displayName = dmxScreen->name;
#ifdef PANORAMIX
- attr->logicalScreen = noPanoramiXExtension ? dmxScreen->index : 0;
+ attr->logicalScreen = noPanoramiXExtension ? dmxScreen->index : 0;
#else
- attr->logicalScreen = dmxScreen->index;
+ attr->logicalScreen = dmxScreen->index;
#endif
- attr->screenWindowWidth = dmxScreen->scrnWidth;
- attr->screenWindowHeight = dmxScreen->scrnHeight;
+ attr->screenWindowWidth = dmxScreen->scrnWidth;
+ attr->screenWindowHeight = dmxScreen->scrnHeight;
attr->screenWindowXoffset = dmxScreen->scrnX;
attr->screenWindowYoffset = dmxScreen->scrnY;
- attr->rootWindowWidth = dmxScreen->rootWidth;
- attr->rootWindowHeight = dmxScreen->rootHeight;
- attr->rootWindowXoffset = dmxScreen->rootX;
- attr->rootWindowYoffset = dmxScreen->rootY;
+ attr->rootWindowWidth = dmxScreen->rootWidth;
+ attr->rootWindowHeight = dmxScreen->rootHeight;
+ attr->rootWindowXoffset = dmxScreen->rootX;
+ attr->rootWindowYoffset = dmxScreen->rootY;
- attr->rootWindowXorigin = dmxScreen->rootXOrigin;
- attr->rootWindowYorigin = dmxScreen->rootYOrigin;
+ attr->rootWindowXorigin = dmxScreen->rootXOrigin;
+ attr->rootWindowYorigin = dmxScreen->rootYOrigin;
return TRUE;
}
/** This routine provides information to the DMX protocol extension
* about a particular window. */
-Bool dmxGetWindowAttributes(WindowPtr pWindow, DMXWindowAttributesPtr attr)
+Bool
+dmxGetWindowAttributes(WindowPtr pWindow, DMXWindowAttributesPtr attr)
{
dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- attr->screen = pWindow->drawable.pScreen->myNum;
- attr->window = pWinPriv->window;
+ attr->screen = pWindow->drawable.pScreen->myNum;
+ attr->window = pWinPriv->window;
- attr->pos.x = pWindow->drawable.x;
- attr->pos.y = pWindow->drawable.y;
- attr->pos.width = pWindow->drawable.width;
- attr->pos.height = pWindow->drawable.height;
+ attr->pos.x = pWindow->drawable.x;
+ attr->pos.y = pWindow->drawable.y;
+ attr->pos.width = pWindow->drawable.width;
+ attr->pos.height = pWindow->drawable.height;
if (!pWinPriv->window || pWinPriv->offscreen) {
- attr->vis.x = 0;
- attr->vis.y = 0;
+ attr->vis.x = 0;
+ attr->vis.y = 0;
attr->vis.height = 0;
- attr->vis.width = 0;
+ attr->vis.width = 0;
return pWinPriv->window ? TRUE : FALSE;
}
- /* Compute display-relative coordinates */
- attr->vis.x = pWindow->drawable.x;
- attr->vis.y = pWindow->drawable.y;
- attr->vis.width = pWindow->drawable.width;
- attr->vis.height = pWindow->drawable.height;
+ /* Compute display-relative coordinates */
+ attr->vis.x = pWindow->drawable.x;
+ attr->vis.y = pWindow->drawable.y;
+ attr->vis.width = pWindow->drawable.width;
+ attr->vis.height = pWindow->drawable.height;
if (attr->pos.x < 0) {
- attr->vis.x -= attr->pos.x;
- attr->vis.width = attr->pos.x + attr->pos.width - attr->vis.x;
+ attr->vis.x -= attr->pos.x;
+ attr->vis.width = attr->pos.x + attr->pos.width - attr->vis.x;
}
if (attr->pos.x + attr->pos.width > pWindow->drawable.pScreen->width) {
if (attr->pos.x < 0)
- attr->vis.width = pWindow->drawable.pScreen->width;
+ attr->vis.width = pWindow->drawable.pScreen->width;
else
- attr->vis.width = pWindow->drawable.pScreen->width - attr->pos.x;
+ attr->vis.width = pWindow->drawable.pScreen->width - attr->pos.x;
}
if (attr->pos.y < 0) {
- attr->vis.y -= attr->pos.y;
+ attr->vis.y -= attr->pos.y;
attr->vis.height = attr->pos.y + attr->pos.height - attr->vis.y;
}
if (attr->pos.y + attr->pos.height > pWindow->drawable.pScreen->height) {
@@ -149,29 +152,32 @@ Bool dmxGetWindowAttributes(WindowPtr pWindow, DMXWindowAttributesPtr attr)
attr->vis.height = pWindow->drawable.pScreen->height - attr->pos.y;
}
- /* Convert to window-relative coordinates */
+ /* Convert to window-relative coordinates */
attr->vis.x -= attr->pos.x;
attr->vis.y -= attr->pos.y;
return TRUE;
}
-void dmxGetDesktopAttributes(DMXDesktopAttributesPtr attr)
+void
+dmxGetDesktopAttributes(DMXDesktopAttributesPtr attr)
{
- attr->width = dmxGlobalWidth;
+ attr->width = dmxGlobalWidth;
attr->height = dmxGlobalHeight;
- attr->shiftX = 0; /* NOTE: The upper left hand corner of */
- attr->shiftY = 0; /* the desktop is always <0,0>. */
+ attr->shiftX = 0; /* NOTE: The upper left hand corner of */
+ attr->shiftY = 0; /* the desktop is always <0,0>. */
}
/** Return the total number of devices, not just #dmxNumInputs. The
* number returned should be the same as that returned by
* XListInputDevices. */
-int dmxGetInputCount(void)
+int
+dmxGetInputCount(void)
{
int i, total;
-
- for (total = i = 0; i < dmxNumInputs; i++) total += dmxInputs[i].numDevs;
+
+ for (total = i = 0; i < dmxNumInputs; i++)
+ total += dmxInputs[i].numDevs;
return total;
}
@@ -179,38 +185,42 @@ int dmxGetInputCount(void)
* information is primarily for the #ProcDMXGetInputAttributes()
* function, which does not have access to the appropriate data
* structure. */
-int dmxGetInputAttributes(int deviceId, DMXInputAttributesPtr attr)
+int
+dmxGetInputAttributes(int deviceId, DMXInputAttributesPtr attr)
{
- int i, j;
+ int i, j;
DMXInputInfo *dmxInput;
- if (deviceId < 0) return -1;
+ if (deviceId < 0)
+ return -1;
for (i = 0; i < dmxNumInputs; i++) {
dmxInput = &dmxInputs[i];
for (j = 0; j < dmxInput->numDevs; j++) {
DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j];
- if (deviceId != dmxLocal->pDevice->id) continue;
- attr->isCore = !!dmxLocal->isCore;
- attr->sendsCore = !!dmxLocal->sendsCore;
- attr->detached = !!dmxInput->detached;
- attr->physicalScreen = -1;
- attr->physicalId = -1;
- attr->name = NULL;
+
+ if (deviceId != dmxLocal->pDevice->id)
+ continue;
+ attr->isCore = ! !dmxLocal->isCore;
+ attr->sendsCore = ! !dmxLocal->sendsCore;
+ attr->detached = ! !dmxInput->detached;
+ attr->physicalScreen = -1;
+ attr->physicalId = -1;
+ attr->name = NULL;
switch (dmxLocal->extType) {
case DMX_LOCAL_TYPE_LOCAL:
- attr->inputType = 0;
+ attr->inputType = 0;
break;
case DMX_LOCAL_TYPE_CONSOLE:
- attr->inputType = 1;
- attr->name = dmxInput->name;
- attr->physicalId = dmxLocal->deviceId;
+ attr->inputType = 1;
+ attr->name = dmxInput->name;
+ attr->physicalId = dmxLocal->deviceId;
break;
case DMX_LOCAL_TYPE_BACKEND:
case DMX_LOCAL_TYPE_COMMON:
- attr->inputType = 2;
+ attr->inputType = 2;
attr->physicalScreen = dmxInput->scrnIdx;
- attr->name = dmxInput->name;
- attr->physicalId = dmxLocal->deviceId;
+ attr->name = dmxInput->name;
+ attr->physicalId = dmxLocal->deviceId;
break;
}
return 0; /* Success */
@@ -220,9 +230,10 @@ int dmxGetInputAttributes(int deviceId, DMXInputAttributesPtr attr)
}
/** Reinitialized the cursor boundaries. */
-static void dmxAdjustCursorBoundaries(void)
+static void
+dmxAdjustCursorBoundaries(void)
{
- int i;
+ int i;
dmxReInitOrigins();
dmxInitOverlap();
@@ -230,28 +241,33 @@ static void dmxAdjustCursorBoundaries(void)
dmxConnectionBlockCallback();
for (i = 0; i < dmxNumInputs; i++) {
DMXInputInfo *dmxInput = &dmxInputs[i];
- if (!dmxInput->detached) dmxInputReInit(dmxInput);
+
+ if (!dmxInput->detached)
+ dmxInputReInit(dmxInput);
}
dmxCheckCursor();
for (i = 0; i < dmxNumInputs; i++) {
DMXInputInfo *dmxInput = &dmxInputs[i];
- if (!dmxInput->detached) dmxInputLateReInit(dmxInput);
+
+ if (!dmxInput->detached)
+ dmxInputLateReInit(dmxInput);
}
}
/** Add an input with the specified attributes. If the input is added,
* the physical id is returned in \a deviceId. */
-int dmxAddInput(DMXInputAttributesPtr attr, int *id)
+int
+dmxAddInput(DMXInputAttributesPtr attr, int *id)
{
int retcode = BadValue;
if (attr->inputType == 1) /* console */
retcode = dmxInputAttachConsole(attr->name, attr->sendsCore, id);
- else if (attr->inputType == 2) /* backend */
+ else if (attr->inputType == 2) /* backend */
retcode = dmxInputAttachBackend(attr->physicalScreen,
- attr->sendsCore,id);
+ attr->sendsCore, id);
if (retcode == Success) {
/* Adjust the cursor boundaries */
@@ -265,7 +281,8 @@ int dmxAddInput(DMXInputAttributesPtr attr, int *id)
}
/** Remove the input with physical id \a id. */
-int dmxRemoveInput(int id)
+int
+dmxRemoveInput(int id)
{
return dmxInputDetachId(id);
}
@@ -273,46 +290,52 @@ int dmxRemoveInput(int id)
/** Return the value of #dmxNumScreens -- the total number of backend
* screens in use (these are logical screens and may be larger than the
* number of backend displays). */
-unsigned long dmxGetNumScreens(void)
+unsigned long
+dmxGetNumScreens(void)
{
return dmxNumScreens;
}
/** Make sure that #dmxCreateAndRealizeWindow has been called for \a
* pWindow. */
-void dmxForceWindowCreation(WindowPtr pWindow)
+void
+dmxForceWindowCreation(WindowPtr pWindow)
{
dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- if (!pWinPriv->window) dmxCreateAndRealizeWindow(pWindow, TRUE);
+
+ if (!pWinPriv->window)
+ dmxCreateAndRealizeWindow(pWindow, TRUE);
}
/** Flush pending syncs for all screens. */
-void dmxFlushPendingSyncs(void)
+void
+dmxFlushPendingSyncs(void)
{
dmxSync(NULL, TRUE);
}
/** Update DMX's screen resources to match those of the newly moved
* and/or resized "root" window. */
-void dmxUpdateScreenResources(ScreenPtr pScreen, int x, int y, int w, int h)
+void
+dmxUpdateScreenResources(ScreenPtr pScreen, int x, int y, int w, int h)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- WindowPtr pRoot = pScreen->root;
- WindowPtr pChild;
- Bool anyMarked = FALSE;
+ WindowPtr pRoot = pScreen->root;
+ WindowPtr pChild;
+ Bool anyMarked = FALSE;
/* Handle special case where width and/or height are zero */
if (w == 0 || h == 0) {
- w = 1;
- h = 1;
+ w = 1;
+ h = 1;
}
/* Change screen size */
- pScreen->width = w;
+ pScreen->width = w;
pScreen->height = h;
/* Reset the root window's drawable's size */
- pRoot->drawable.width = w;
+ pRoot->drawable.width = w;
pRoot->drawable.height = h;
/* Set the root window's new winSize and borderSize */
@@ -328,15 +351,15 @@ void dmxUpdateScreenResources(ScreenPtr pScreen, int x, int y, int w, int h)
/* Recompute this screen's mmWidth & mmHeight */
pScreen->mmWidth =
- (w * 254 + dmxScreen->beXDPI * 5) / (dmxScreen->beXDPI * 10);
+ (w * 254 + dmxScreen->beXDPI * 5) / (dmxScreen->beXDPI * 10);
pScreen->mmHeight =
- (h * 254 + dmxScreen->beYDPI * 5) / (dmxScreen->beYDPI * 10);
+ (h * 254 + dmxScreen->beYDPI * 5) / (dmxScreen->beYDPI * 10);
/* Recompute this screen's window's clip rects as follows: */
/* 1. Mark all of root's children's windows */
for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib)
- anyMarked |= pScreen->MarkOverlappedWindows(pChild, pChild,
- (WindowPtr *)NULL);
+ anyMarked |= pScreen->MarkOverlappedWindows(pChild, pChild,
+ (WindowPtr *) NULL);
/* 2. Set the root window's borderClip */
pRoot->borderClip.extents.x1 = 0;
@@ -346,27 +369,28 @@ void dmxUpdateScreenResources(ScreenPtr pScreen, int x, int y, int w, int h)
/* 3. Set the root window's clipList */
if (anyMarked) {
- /* If any windows have been marked, set the root window's
- * clipList to be broken since it will be recalculated in
- * ValidateTree()
- */
- RegionBreak(&pRoot->clipList);
- } else {
- /* Otherwise, we just set it directly since there are no
- * windows visible on this screen
- */
- pRoot->clipList.extents.x1 = 0;
- pRoot->clipList.extents.y1 = 0;
- pRoot->clipList.extents.x2 = w;
- pRoot->clipList.extents.y2 = h;
+ /* If any windows have been marked, set the root window's
+ * clipList to be broken since it will be recalculated in
+ * ValidateTree()
+ */
+ RegionBreak(&pRoot->clipList);
+ }
+ else {
+ /* Otherwise, we just set it directly since there are no
+ * windows visible on this screen
+ */
+ pRoot->clipList.extents.x1 = 0;
+ pRoot->clipList.extents.y1 = 0;
+ pRoot->clipList.extents.x2 = w;
+ pRoot->clipList.extents.y2 = h;
}
/* 4. Revalidate all clip rects and generate expose events */
if (anyMarked) {
- pScreen->ValidateTree(pRoot, NULL, VTBroken);
- pScreen->HandleExposures(pRoot);
- if (pScreen->PostValidateTree)
- pScreen->PostValidateTree(pRoot, NULL, VTBroken);
+ pScreen->ValidateTree(pRoot, NULL, VTBroken);
+ pScreen->HandleExposures(pRoot);
+ if (pScreen->PostValidateTree)
+ pScreen->PostValidateTree(pRoot, NULL, VTBroken);
}
}
@@ -375,72 +399,71 @@ void dmxUpdateScreenResources(ScreenPtr pScreen, int x, int y, int w, int h)
/** Change the "screen" window attributes by resizing the actual window
* on the back-end display (if necessary). */
-static void dmxConfigureScreenWindow(int idx,
- int x, int y, int w, int h)
+static void
+dmxConfigureScreenWindow(int idx, int x, int y, int w, int h)
{
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
- ScreenPtr pScreen = screenInfo.screens[idx];
+ ScreenPtr pScreen = screenInfo.screens[idx];
/* Resize "screen" window */
- if (dmxScreen->scrnX != x ||
- dmxScreen->scrnY != y ||
- dmxScreen->scrnWidth != w ||
- dmxScreen->scrnHeight != h) {
- dmxResizeScreenWindow(pScreen, x, y, w, h);
+ if (dmxScreen->scrnX != x ||
+ dmxScreen->scrnY != y ||
+ dmxScreen->scrnWidth != w || dmxScreen->scrnHeight != h) {
+ dmxResizeScreenWindow(pScreen, x, y, w, h);
}
/* Change "screen" window values */
- dmxScreen->scrnX = x;
- dmxScreen->scrnY = y;
- dmxScreen->scrnWidth = w;
+ dmxScreen->scrnX = x;
+ dmxScreen->scrnY = y;
+ dmxScreen->scrnWidth = w;
dmxScreen->scrnHeight = h;
}
-
+
/** Change the "root" window position and size by resizing the actual
* window on the back-end display (if necessary) and updating all of
* DMX's resources by calling #dmxUpdateScreenResources. */
-static void dmxConfigureRootWindow(int idx, int x, int y, int w, int h)
+static void
+dmxConfigureRootWindow(int idx, int x, int y, int w, int h)
{
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
- WindowPtr pRoot = screenInfo.screens[idx]->root;
+ WindowPtr pRoot = screenInfo.screens[idx]->root;
/* NOTE: Either this function or the ones that it calls must handle
* the case where w == 0 || h == 0. Currently, the functions that
* this one calls handle that case. */
/* 1. Resize "root" window */
- if (dmxScreen->rootX != x ||
- dmxScreen->rootY != y ||
- dmxScreen->rootWidth != w ||
- dmxScreen->rootHeight != h) {
- dmxResizeRootWindow(pRoot, x, y, w, h);
+ if (dmxScreen->rootX != x ||
+ dmxScreen->rootY != y ||
+ dmxScreen->rootWidth != w || dmxScreen->rootHeight != h) {
+ dmxResizeRootWindow(pRoot, x, y, w, h);
}
/* 2. Update all of the screen's resources associated with this root
* window */
- if (dmxScreen->rootWidth != w ||
- dmxScreen->rootHeight != h) {
- dmxUpdateScreenResources(screenInfo.screens[idx], x, y, w, h);
+ if (dmxScreen->rootWidth != w || dmxScreen->rootHeight != h) {
+ dmxUpdateScreenResources(screenInfo.screens[idx], x, y, w, h);
}
/* Change "root" window values */
- dmxScreen->rootX = x;
- dmxScreen->rootY = y;
- dmxScreen->rootWidth = w;
+ dmxScreen->rootX = x;
+ dmxScreen->rootY = y;
+ dmxScreen->rootWidth = w;
dmxScreen->rootHeight = h;
}
/** Change the "root" window's origin by updating DMX's internal data
* structures (dix and Xinerama) to use the new origin and adjust the
* positions of windows that overlap this "root" window. */
-static void dmxSetRootWindowOrigin(int idx, int x, int y)
+static void
+dmxSetRootWindowOrigin(int idx, int x, int y)
{
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
- ScreenPtr pScreen = screenInfo.screens[idx];
- WindowPtr pRoot = pScreen->root;
- WindowPtr pChild;
- int xoff;
- int yoff;
+ ScreenPtr pScreen = screenInfo.screens[idx];
+ WindowPtr pRoot = pScreen->root;
+ WindowPtr pChild;
+ int xoff;
+ int yoff;
/* Change "root" window's origin */
dmxScreen->rootXOrigin = x;
@@ -458,129 +481,131 @@ static void dmxSetRootWindowOrigin(int idx, int x, int y)
XineramaReinitData();
/* Adjust each of the root window's children */
- if (!idx) ReinitializeRootWindow(screenInfo.screens[0]->root, xoff, yoff);
+ if (!idx)
+ ReinitializeRootWindow(screenInfo.screens[0]->root, xoff, yoff);
pChild = pRoot->firstChild;
while (pChild) {
- /* Adjust child window's position */
- pScreen->MoveWindow(pChild,
- pChild->origin.x - wBorderWidth(pChild) - xoff,
- pChild->origin.y - wBorderWidth(pChild) - yoff,
- pChild->nextSib,
- VTMove);
-
- /* Note that the call to MoveWindow will eventually call
- * dmxPositionWindow which will automatically create a
- * window if it is now exposed on screen (for lazy window
- * creation optimization) and it will properly set the
- * offscreen flag.
- */
-
- pChild = pChild->nextSib;
+ /* Adjust child window's position */
+ pScreen->MoveWindow(pChild,
+ pChild->origin.x - wBorderWidth(pChild) - xoff,
+ pChild->origin.y - wBorderWidth(pChild) - yoff,
+ pChild->nextSib, VTMove);
+
+ /* Note that the call to MoveWindow will eventually call
+ * dmxPositionWindow which will automatically create a
+ * window if it is now exposed on screen (for lazy window
+ * creation optimization) and it will properly set the
+ * offscreen flag.
+ */
+
+ pChild = pChild->nextSib;
}
}
/** Configure the attributes of each "screen" and "root" window. */
-int dmxConfigureScreenWindows(int nscreens,
- CARD32 *screens,
- DMXScreenAttributesPtr attribs,
- int *errorScreen)
+int
+dmxConfigureScreenWindows(int nscreens,
+ CARD32 *screens,
+ DMXScreenAttributesPtr attribs, int *errorScreen)
{
- int i;
+ int i;
for (i = 0; i < nscreens; i++) {
- DMXScreenAttributesPtr attr = &attribs[i];
- int idx = screens[i];
- DMXScreenInfo *dmxScreen = &dmxScreens[idx];
-
- if (errorScreen) *errorScreen = i;
-
- if (!dmxScreen->beDisplay) return DMX_BAD_VALUE;
-
- /* Check for illegal values */
- if (idx < 0 || idx >= dmxNumScreens) return BadValue;
-
- /* The "screen" and "root" windows must have valid sizes */
- if (attr->screenWindowWidth <= 0 || attr->screenWindowHeight <= 0 ||
- attr->rootWindowWidth < 0 || attr->rootWindowHeight < 0)
- return DMX_BAD_VALUE;
-
- /* The "screen" window must fit entirely within the BE display */
- if (attr->screenWindowXoffset < 0 ||
- attr->screenWindowYoffset < 0 ||
- attr->screenWindowXoffset
- + attr->screenWindowWidth > (unsigned)dmxScreen->beWidth ||
- attr->screenWindowYoffset
- + attr->screenWindowHeight > (unsigned)dmxScreen->beHeight)
- return DMX_BAD_VALUE;
-
- /* The "root" window must fit entirely within the "screen" window */
- if (attr->rootWindowXoffset < 0 ||
- attr->rootWindowYoffset < 0 ||
- attr->rootWindowXoffset
- + attr->rootWindowWidth > attr->screenWindowWidth ||
- attr->rootWindowYoffset
- + attr->rootWindowHeight > attr->screenWindowHeight)
- return DMX_BAD_VALUE;
-
- /* The "root" window must not expose unaddressable coordinates */
- if (attr->rootWindowXorigin < 0 ||
- attr->rootWindowYorigin < 0 ||
- attr->rootWindowXorigin + attr->rootWindowWidth > 32767 ||
- attr->rootWindowYorigin + attr->rootWindowHeight > 32767)
- return DMX_BAD_VALUE;
-
- /* The "root" window must fit within the global bounding box */
- if (attr->rootWindowXorigin
- + attr->rootWindowWidth > (unsigned)dmxGlobalWidth ||
- attr->rootWindowYorigin
- + attr->rootWindowHeight > (unsigned)dmxGlobalHeight)
- return DMX_BAD_VALUE;
-
- /* FIXME: Handle the rest of the illegal value checking */
+ DMXScreenAttributesPtr attr = &attribs[i];
+ int idx = screens[i];
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+
+ if (errorScreen)
+ *errorScreen = i;
+
+ if (!dmxScreen->beDisplay)
+ return DMX_BAD_VALUE;
+
+ /* Check for illegal values */
+ if (idx < 0 || idx >= dmxNumScreens)
+ return BadValue;
+
+ /* The "screen" and "root" windows must have valid sizes */
+ if (attr->screenWindowWidth <= 0 || attr->screenWindowHeight <= 0 ||
+ attr->rootWindowWidth < 0 || attr->rootWindowHeight < 0)
+ return DMX_BAD_VALUE;
+
+ /* The "screen" window must fit entirely within the BE display */
+ if (attr->screenWindowXoffset < 0 ||
+ attr->screenWindowYoffset < 0 ||
+ attr->screenWindowXoffset
+ + attr->screenWindowWidth > (unsigned) dmxScreen->beWidth ||
+ attr->screenWindowYoffset
+ + attr->screenWindowHeight > (unsigned) dmxScreen->beHeight)
+ return DMX_BAD_VALUE;
+
+ /* The "root" window must fit entirely within the "screen" window */
+ if (attr->rootWindowXoffset < 0 ||
+ attr->rootWindowYoffset < 0 ||
+ attr->rootWindowXoffset
+ + attr->rootWindowWidth > attr->screenWindowWidth ||
+ attr->rootWindowYoffset
+ + attr->rootWindowHeight > attr->screenWindowHeight)
+ return DMX_BAD_VALUE;
+
+ /* The "root" window must not expose unaddressable coordinates */
+ if (attr->rootWindowXorigin < 0 ||
+ attr->rootWindowYorigin < 0 ||
+ attr->rootWindowXorigin + attr->rootWindowWidth > 32767 ||
+ attr->rootWindowYorigin + attr->rootWindowHeight > 32767)
+ return DMX_BAD_VALUE;
+
+ /* The "root" window must fit within the global bounding box */
+ if (attr->rootWindowXorigin
+ + attr->rootWindowWidth > (unsigned) dmxGlobalWidth ||
+ attr->rootWindowYorigin
+ + attr->rootWindowHeight > (unsigned) dmxGlobalHeight)
+ return DMX_BAD_VALUE;
+
+ /* FIXME: Handle the rest of the illegal value checking */
}
/* No illegal values found */
- if (errorScreen) *errorScreen = 0;
+ if (errorScreen)
+ *errorScreen = 0;
for (i = 0; i < nscreens; i++) {
- DMXScreenAttributesPtr attr = &attribs[i];
- int idx = screens[i];
- DMXScreenInfo *dmxScreen = &dmxScreens[idx];
-
- dmxLog(dmxInfo, "Changing screen #%d attributes "
- "from %dx%d+%d+%d %dx%d+%d+%d +%d+%d "
- "to %dx%d+%d+%d %dx%d+%d+%d +%d+%d\n",
- idx,
- dmxScreen->scrnWidth, dmxScreen->scrnHeight,
- dmxScreen->scrnX, dmxScreen->scrnY,
- dmxScreen->rootWidth, dmxScreen->rootHeight,
- dmxScreen->rootX, dmxScreen->rootY,
- dmxScreen->rootXOrigin, dmxScreen->rootYOrigin,
- attr->screenWindowWidth, attr->screenWindowHeight,
- attr->screenWindowXoffset, attr->screenWindowYoffset,
- attr->rootWindowWidth, attr->rootWindowHeight,
- attr->rootWindowXoffset, attr->rootWindowYoffset,
- attr->rootWindowXorigin, attr->rootWindowYorigin);
-
- /* Configure "screen" window */
- dmxConfigureScreenWindow(idx,
- attr->screenWindowXoffset,
- attr->screenWindowYoffset,
- attr->screenWindowWidth,
- attr->screenWindowHeight);
-
- /* Configure "root" window */
- dmxConfigureRootWindow(idx,
- attr->rootWindowXoffset,
- attr->rootWindowYoffset,
- attr->rootWindowWidth,
- attr->rootWindowHeight);
-
-
- /* Set "root" window's origin */
- dmxSetRootWindowOrigin(idx,
- attr->rootWindowXorigin,
- attr->rootWindowYorigin);
+ DMXScreenAttributesPtr attr = &attribs[i];
+ int idx = screens[i];
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+
+ dmxLog(dmxInfo, "Changing screen #%d attributes "
+ "from %dx%d+%d+%d %dx%d+%d+%d +%d+%d "
+ "to %dx%d+%d+%d %dx%d+%d+%d +%d+%d\n",
+ idx,
+ dmxScreen->scrnWidth, dmxScreen->scrnHeight,
+ dmxScreen->scrnX, dmxScreen->scrnY,
+ dmxScreen->rootWidth, dmxScreen->rootHeight,
+ dmxScreen->rootX, dmxScreen->rootY,
+ dmxScreen->rootXOrigin, dmxScreen->rootYOrigin,
+ attr->screenWindowWidth, attr->screenWindowHeight,
+ attr->screenWindowXoffset, attr->screenWindowYoffset,
+ attr->rootWindowWidth, attr->rootWindowHeight,
+ attr->rootWindowXoffset, attr->rootWindowYoffset,
+ attr->rootWindowXorigin, attr->rootWindowYorigin);
+
+ /* Configure "screen" window */
+ dmxConfigureScreenWindow(idx,
+ attr->screenWindowXoffset,
+ attr->screenWindowYoffset,
+ attr->screenWindowWidth,
+ attr->screenWindowHeight);
+
+ /* Configure "root" window */
+ dmxConfigureRootWindow(idx,
+ attr->rootWindowXoffset,
+ attr->rootWindowYoffset,
+ attr->rootWindowWidth, attr->rootWindowHeight);
+
+ /* Set "root" window's origin */
+ dmxSetRootWindowOrigin(idx,
+ attr->rootWindowXorigin,
+ attr->rootWindowYorigin);
}
/* Adjust the cursor boundaries */
@@ -593,37 +618,46 @@ int dmxConfigureScreenWindows(int nscreens,
}
/** Configure the attributes of the global desktop. */
-int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs)
+int
+dmxConfigureDesktop(DMXDesktopAttributesPtr attribs)
{
- if (attribs->width <= 0 || attribs->width >= 32767 ||
- attribs->height <= 0 || attribs->height >= 32767)
- return DMX_BAD_VALUE;
+ if (attribs->width <= 0 || attribs->width >= 32767 ||
+ attribs->height <= 0 || attribs->height >= 32767)
+ return DMX_BAD_VALUE;
/* If the desktop is shrinking, adjust the "root" windows on each
* "screen" window to only show the visible desktop. Also, handle
* the special case where the desktop shrinks such that the it no
* longer overlaps an portion of a "screen" window. */
if (attribs->width < dmxGlobalWidth || attribs->height < dmxGlobalHeight) {
- int i;
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- if (dmxScreen->rootXOrigin
- + dmxScreen->rootWidth > attribs->width ||
- dmxScreen->rootYOrigin
- + dmxScreen->rootHeight > attribs->height) {
- int w, h;
- if ((w = attribs->width - dmxScreen->rootXOrigin) < 0) w = 0;
- if ((h = attribs->height - dmxScreen->rootYOrigin) < 0) h = 0;
- if (w > dmxScreen->scrnWidth) w = dmxScreen->scrnWidth;
- if (h > dmxScreen->scrnHeight) h = dmxScreen->scrnHeight;
- if (w > dmxScreen->rootWidth) w = dmxScreen->rootWidth;
- if (h > dmxScreen->rootHeight) h = dmxScreen->rootHeight;
- dmxConfigureRootWindow(i,
- dmxScreen->rootX,
- dmxScreen->rootY,
- w, h);
- }
- }
+ int i;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ if (dmxScreen->rootXOrigin
+ + dmxScreen->rootWidth > attribs->width ||
+ dmxScreen->rootYOrigin
+ + dmxScreen->rootHeight > attribs->height) {
+ int w, h;
+
+ if ((w = attribs->width - dmxScreen->rootXOrigin) < 0)
+ w = 0;
+ if ((h = attribs->height - dmxScreen->rootYOrigin) < 0)
+ h = 0;
+ if (w > dmxScreen->scrnWidth)
+ w = dmxScreen->scrnWidth;
+ if (h > dmxScreen->scrnHeight)
+ h = dmxScreen->scrnHeight;
+ if (w > dmxScreen->rootWidth)
+ w = dmxScreen->rootWidth;
+ if (h > dmxScreen->rootHeight)
+ h = dmxScreen->rootHeight;
+ dmxConfigureRootWindow(i,
+ dmxScreen->rootX,
+ dmxScreen->rootY, w, h);
+ }
+ }
}
/* Set the global width/height */
@@ -631,30 +665,30 @@ int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs)
/* Handle shift[XY] changes */
if (attribs->shiftX || attribs->shiftY) {
- int i;
- for (i = 0; i < dmxNumScreens; i++) {
- ScreenPtr pScreen = screenInfo.screens[i];
- WindowPtr pChild = pScreen->root->firstChild;
- while (pChild) {
- /* Adjust child window's position */
- pScreen->MoveWindow(pChild,
- pChild->origin.x - wBorderWidth(pChild)
- - attribs->shiftX,
- pChild->origin.y - wBorderWidth(pChild)
- - attribs->shiftY,
- pChild->nextSib,
- VTMove);
-
- /* Note that the call to MoveWindow will eventually call
- * dmxPositionWindow which will automatically create a
- * window if it is now exposed on screen (for lazy
- * window creation optimization) and it will properly
- * set the offscreen flag.
- */
-
- pChild = pChild->nextSib;
- }
- }
+ int i;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ WindowPtr pChild = pScreen->root->firstChild;
+
+ while (pChild) {
+ /* Adjust child window's position */
+ pScreen->MoveWindow(pChild,
+ pChild->origin.x - wBorderWidth(pChild)
+ - attribs->shiftX,
+ pChild->origin.y - wBorderWidth(pChild)
+ - attribs->shiftY, pChild->nextSib, VTMove);
+
+ /* Note that the call to MoveWindow will eventually call
+ * dmxPositionWindow which will automatically create a
+ * window if it is now exposed on screen (for lazy
+ * window creation optimization) and it will properly
+ * set the offscreen flag.
+ */
+
+ pChild = pChild->nextSib;
+ }
+ }
}
/* Update connection block, Xinerama, etc. -- these appears to
@@ -672,14 +706,15 @@ int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs)
#endif
/** Create the scratch GCs per depth. */
-static void dmxBECreateScratchGCs(int scrnNum)
+static void
+dmxBECreateScratchGCs(int scrnNum)
{
- ScreenPtr pScreen = screenInfo.screens[scrnNum];
- GCPtr *ppGC = pScreen->GCperDepth;
- int i;
+ ScreenPtr pScreen = screenInfo.screens[scrnNum];
+ GCPtr *ppGC = pScreen->GCperDepth;
+ int i;
for (i = 0; i <= pScreen->numDepths; i++)
- dmxBECreateGC(pScreen, ppGC[i]);
+ dmxBECreateGC(pScreen, ppGC[i]);
}
#ifdef PANORAMIX
@@ -689,89 +724,92 @@ static Bool FoundPixImage;
* to have its image restored. When it is found, see if there is
* another screen with the same image. If so, copy the pixmap image
* from the existing screen to the newly created pixmap. */
-static void dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type,
- pointer p)
+static void
+dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type, pointer p)
{
if ((type & TypeMask) == (XRT_PIXMAP & TypeMask)) {
- PixmapPtr pDst = (PixmapPtr)p;
- int idx = pDst->drawable.pScreen->myNum;
- PanoramiXRes *pXinPix = (PanoramiXRes *)value;
- PixmapPtr pPix;
- int i;
-
- dixLookupResourceByType((pointer*) &pPix, pXinPix->info[idx].id,
- RT_PIXMAP, NullClient, DixUnknownAccess);
- if (pPix != pDst) return; /* Not a match.... Next! */
-
- FOR_NSCREENS(i) {
- PixmapPtr pSrc;
- dmxPixPrivPtr pSrcPriv = NULL;
-
- if (i == idx) continue; /* Self replication is bad */
-
- dixLookupResourceByType((pointer*) &pSrc, pXinPix->info[i].id,
- RT_PIXMAP, NullClient, DixUnknownAccess);
- pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
- if (pSrcPriv->pixmap) {
- DMXScreenInfo *dmxSrcScreen = &dmxScreens[i];
- DMXScreenInfo *dmxDstScreen = &dmxScreens[idx];
- dmxPixPrivPtr pDstPriv = DMX_GET_PIXMAP_PRIV(pDst);
- XImage *img;
- int j;
- XlibGC gc = NULL;
-
- /* This should never happen, but just in case.... */
- if (pSrc->drawable.width != pDst->drawable.width ||
- pSrc->drawable.height != pDst->drawable.height)
- return;
-
- /* Copy from src pixmap to dst pixmap */
- img = XGetImage(dmxSrcScreen->beDisplay,
- pSrcPriv->pixmap,
- 0, 0,
- pSrc->drawable.width, pSrc->drawable.height,
- -1,
- ZPixmap);
-
- for (j = 0; j < dmxDstScreen->beNumPixmapFormats; j++) {
- if (dmxDstScreen->bePixmapFormats[j].depth == img->depth) {
- unsigned long m;
- XGCValues v;
-
- m = GCFunction | GCPlaneMask | GCClipMask;
- v.function = GXcopy;
- v.plane_mask = AllPlanes;
- v.clip_mask = None;
-
- gc = XCreateGC(dmxDstScreen->beDisplay,
- dmxDstScreen->scrnDefDrawables[j],
- m, &v);
- break;
- }
- }
-
- if (gc) {
- XPutImage(dmxDstScreen->beDisplay,
- pDstPriv->pixmap,
- gc, img, 0, 0, 0, 0,
- pDst->drawable.width, pDst->drawable.height);
- XFreeGC(dmxDstScreen->beDisplay, gc);
- FoundPixImage = True;
- } else {
- dmxLog(dmxWarning, "Could not create GC\n");
- }
-
- XDestroyImage(img);
- return;
- }
- }
+ PixmapPtr pDst = (PixmapPtr) p;
+ int idx = pDst->drawable.pScreen->myNum;
+ PanoramiXRes *pXinPix = (PanoramiXRes *) value;
+ PixmapPtr pPix;
+ int i;
+
+ dixLookupResourceByType((pointer *) &pPix, pXinPix->info[idx].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
+ if (pPix != pDst)
+ return; /* Not a match.... Next! */
+
+ FOR_NSCREENS(i) {
+ PixmapPtr pSrc;
+ dmxPixPrivPtr pSrcPriv = NULL;
+
+ if (i == idx)
+ continue; /* Self replication is bad */
+
+ dixLookupResourceByType((pointer *) &pSrc, pXinPix->info[i].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
+ pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
+ if (pSrcPriv->pixmap) {
+ DMXScreenInfo *dmxSrcScreen = &dmxScreens[i];
+ DMXScreenInfo *dmxDstScreen = &dmxScreens[idx];
+ dmxPixPrivPtr pDstPriv = DMX_GET_PIXMAP_PRIV(pDst);
+ XImage *img;
+ int j;
+ XlibGC gc = NULL;
+
+ /* This should never happen, but just in case.... */
+ if (pSrc->drawable.width != pDst->drawable.width ||
+ pSrc->drawable.height != pDst->drawable.height)
+ return;
+
+ /* Copy from src pixmap to dst pixmap */
+ img = XGetImage(dmxSrcScreen->beDisplay,
+ pSrcPriv->pixmap,
+ 0, 0,
+ pSrc->drawable.width, pSrc->drawable.height,
+ -1, ZPixmap);
+
+ for (j = 0; j < dmxDstScreen->beNumPixmapFormats; j++) {
+ if (dmxDstScreen->bePixmapFormats[j].depth == img->depth) {
+ unsigned long m;
+ XGCValues v;
+
+ m = GCFunction | GCPlaneMask | GCClipMask;
+ v.function = GXcopy;
+ v.plane_mask = AllPlanes;
+ v.clip_mask = None;
+
+ gc = XCreateGC(dmxDstScreen->beDisplay,
+ dmxDstScreen->scrnDefDrawables[j],
+ m, &v);
+ break;
+ }
+ }
+
+ if (gc) {
+ XPutImage(dmxDstScreen->beDisplay,
+ pDstPriv->pixmap,
+ gc, img, 0, 0, 0, 0,
+ pDst->drawable.width, pDst->drawable.height);
+ XFreeGC(dmxDstScreen->beDisplay, gc);
+ FoundPixImage = True;
+ }
+ else {
+ dmxLog(dmxWarning, "Could not create GC\n");
+ }
+
+ XDestroyImage(img);
+ return;
+ }
+ }
}
}
#endif
/** Restore the pixmap image either from another screen or from an image
* that was saved when the screen was previously detached. */
-static void dmxBERestorePixmap(PixmapPtr pPixmap)
+static void
+dmxBERestorePixmap(PixmapPtr pPixmap)
{
#ifdef PANORAMIX
int i;
@@ -779,62 +817,63 @@ static void dmxBERestorePixmap(PixmapPtr pPixmap)
/* If Xinerama is not active, there's nothing we can do (see comment
* in #else below for more info). */
if (noPanoramiXExtension) {
- dmxLog(dmxWarning, "Cannot restore pixmap image\n");
- return;
+ dmxLog(dmxWarning, "Cannot restore pixmap image\n");
+ return;
}
FoundPixImage = False;
- for (i = currentMaxClients; --i >= 0; )
- if (clients[i])
- FindAllClientResources(clients[i], dmxBERestorePixmapImage,
- (pointer)pPixmap);
+ for (i = currentMaxClients; --i >= 0;)
+ if (clients[i])
+ FindAllClientResources(clients[i], dmxBERestorePixmapImage,
+ (pointer) pPixmap);
/* No corresponding pixmap image was found on other screens, so we
* need to copy it from the saved image when the screen was detached
* (if available). */
if (!FoundPixImage) {
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
-
- if (pPixPriv->detachedImage) {
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- XlibGC gc = NULL;
-
- for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
- if (dmxScreen->bePixmapFormats[i].depth ==
- pPixPriv->detachedImage->depth) {
- unsigned long m;
- XGCValues v;
-
- m = GCFunction | GCPlaneMask | GCClipMask;
- v.function = GXcopy;
- v.plane_mask = AllPlanes;
- v.clip_mask = None;
-
- gc = XCreateGC(dmxScreen->beDisplay,
- dmxScreen->scrnDefDrawables[i],
- m, &v);
- break;
- }
- }
-
- if (gc) {
- XPutImage(dmxScreen->beDisplay,
- pPixPriv->pixmap,
- gc,
- pPixPriv->detachedImage,
- 0, 0, 0, 0,
- pPixmap->drawable.width, pPixmap->drawable.height);
- XFreeGC(dmxScreen->beDisplay, gc);
- } else {
- dmxLog(dmxWarning, "Cannot restore pixmap image\n");
- }
-
- XDestroyImage(pPixPriv->detachedImage);
- pPixPriv->detachedImage = NULL;
- } else {
- dmxLog(dmxWarning, "Cannot restore pixmap image\n");
- }
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+
+ if (pPixPriv->detachedImage) {
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ XlibGC gc = NULL;
+
+ for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
+ if (dmxScreen->bePixmapFormats[i].depth ==
+ pPixPriv->detachedImage->depth) {
+ unsigned long m;
+ XGCValues v;
+
+ m = GCFunction | GCPlaneMask | GCClipMask;
+ v.function = GXcopy;
+ v.plane_mask = AllPlanes;
+ v.clip_mask = None;
+
+ gc = XCreateGC(dmxScreen->beDisplay,
+ dmxScreen->scrnDefDrawables[i], m, &v);
+ break;
+ }
+ }
+
+ if (gc) {
+ XPutImage(dmxScreen->beDisplay,
+ pPixPriv->pixmap,
+ gc,
+ pPixPriv->detachedImage,
+ 0, 0, 0, 0,
+ pPixmap->drawable.width, pPixmap->drawable.height);
+ XFreeGC(dmxScreen->beDisplay, gc);
+ }
+ else {
+ dmxLog(dmxWarning, "Cannot restore pixmap image\n");
+ }
+
+ XDestroyImage(pPixPriv->detachedImage);
+ pPixPriv->detachedImage = NULL;
+ }
+ else {
+ dmxLog(dmxWarning, "Cannot restore pixmap image\n");
+ }
}
#else
/* If Xinerama is not enabled, then there is no other copy of the
@@ -852,57 +891,68 @@ static void dmxBERestorePixmap(PixmapPtr pPixmap)
* function. It walks all resources, compares them to the screen
* number passed in as \a n and calls the appropriate DMX function to
* create the associated resource on the back-end server. */
-static void dmxBECreateResources(pointer value, XID id, RESTYPE type,
- pointer n)
+static void
+dmxBECreateResources(pointer value, XID id, RESTYPE type, pointer n)
{
- int scrnNum = (uintptr_t)n;
- ScreenPtr pScreen = screenInfo.screens[scrnNum];
+ int scrnNum = (uintptr_t) n;
+ ScreenPtr pScreen = screenInfo.screens[scrnNum];
if ((type & TypeMask) == (RT_WINDOW & TypeMask)) {
- /* Window resources are created below in dmxBECreateWindowTree */
- } else if ((type & TypeMask) == (RT_PIXMAP & TypeMask)) {
- PixmapPtr pPix = value;
- if (pPix->drawable.pScreen->myNum == scrnNum) {
- dmxBECreatePixmap(pPix);
- dmxBERestorePixmap(pPix);
- }
- } else if ((type & TypeMask) == (RT_GC & TypeMask)) {
- GCPtr pGC = value;
- if (pGC->pScreen->myNum == scrnNum) {
- /* Create the GC on the back-end server */
- dmxBECreateGC(pScreen, pGC);
- /* Create any pixmaps associated with this GC */
- if (!pGC->tileIsPixel) {
- dmxBECreatePixmap(pGC->tile.pixmap);
- dmxBERestorePixmap(pGC->tile.pixmap);
- }
- if (pGC->stipple != pScreen->PixmapPerDepth[0]) {
- dmxBECreatePixmap(pGC->stipple);
- dmxBERestorePixmap(pGC->stipple);
- }
- if (pGC->font != defaultFont) {
- (void)dmxBELoadFont(pScreen, pGC->font);
- }
- /* Update the GC on the back-end server */
- dmxChangeGC(pGC, -1L);
- }
- } else if ((type & TypeMask) == (RT_FONT & TypeMask)) {
- (void)dmxBELoadFont(pScreen, (FontPtr)value);
- } else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) {
- dmxBECreateCursor(pScreen, (CursorPtr)value);
- } else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) {
- ColormapPtr pCmap = value;
- if (pCmap->pScreen->myNum == scrnNum)
- (void)dmxBECreateColormap((ColormapPtr)value);
+ /* Window resources are created below in dmxBECreateWindowTree */
+ }
+ else if ((type & TypeMask) == (RT_PIXMAP & TypeMask)) {
+ PixmapPtr pPix = value;
+
+ if (pPix->drawable.pScreen->myNum == scrnNum) {
+ dmxBECreatePixmap(pPix);
+ dmxBERestorePixmap(pPix);
+ }
+ }
+ else if ((type & TypeMask) == (RT_GC & TypeMask)) {
+ GCPtr pGC = value;
+
+ if (pGC->pScreen->myNum == scrnNum) {
+ /* Create the GC on the back-end server */
+ dmxBECreateGC(pScreen, pGC);
+ /* Create any pixmaps associated with this GC */
+ if (!pGC->tileIsPixel) {
+ dmxBECreatePixmap(pGC->tile.pixmap);
+ dmxBERestorePixmap(pGC->tile.pixmap);
+ }
+ if (pGC->stipple != pScreen->PixmapPerDepth[0]) {
+ dmxBECreatePixmap(pGC->stipple);
+ dmxBERestorePixmap(pGC->stipple);
+ }
+ if (pGC->font != defaultFont) {
+ (void) dmxBELoadFont(pScreen, pGC->font);
+ }
+ /* Update the GC on the back-end server */
+ dmxChangeGC(pGC, -1L);
+ }
+ }
+ else if ((type & TypeMask) == (RT_FONT & TypeMask)) {
+ (void) dmxBELoadFont(pScreen, (FontPtr) value);
+ }
+ else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) {
+ dmxBECreateCursor(pScreen, (CursorPtr) value);
+ }
+ else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) {
+ ColormapPtr pCmap = value;
+
+ if (pCmap->pScreen->myNum == scrnNum)
+ (void) dmxBECreateColormap((ColormapPtr) value);
#if 0
- /* TODO: Recreate Picture and GlyphSet resources */
- } else if ((type & TypeMask) == (PictureType & TypeMask)) {
- /* Picture resources are created when windows are created */
- } else if ((type & TypeMask) == (GlyphSetType & TypeMask)) {
- dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value);
+ /* TODO: Recreate Picture and GlyphSet resources */
+ }
+ else if ((type & TypeMask) == (PictureType & TypeMask)) {
+ /* Picture resources are created when windows are created */
+ }
+ else if ((type & TypeMask) == (GlyphSetType & TypeMask)) {
+ dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr) value);
#endif
- } else {
- /* Other resource types??? */
+ }
+ else {
+ /* Other resource types??? */
}
}
@@ -912,21 +962,22 @@ static void dmxBECreateResources(pointer value, XID id, RESTYPE type,
* itself to create each window's parents. This is required so that we
* have the opportunity to create each window's border and background
* pixmaps (where appropriate) before the window is created. */
-static void dmxBECreateWindowTree(int idx)
+static void
+dmxBECreateWindowTree(int idx)
{
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
- WindowPtr pRoot = screenInfo.screens[idx]->root;
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pRoot);
- WindowPtr pWin;
+ WindowPtr pRoot = screenInfo.screens[idx]->root;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pRoot);
+ WindowPtr pWin;
/* Create the pixmaps associated with the root window */
if (!pRoot->borderIsPixel) {
- dmxBECreatePixmap(pRoot->border.pixmap);
- dmxBERestorePixmap(pRoot->border.pixmap);
+ dmxBECreatePixmap(pRoot->border.pixmap);
+ dmxBERestorePixmap(pRoot->border.pixmap);
}
if (pRoot->backgroundState == BackgroundPixmap) {
- dmxBECreatePixmap(pRoot->background.pixmap);
- dmxBERestorePixmap(pRoot->background.pixmap);
+ dmxBECreatePixmap(pRoot->background.pixmap);
+ dmxBERestorePixmap(pRoot->background.pixmap);
}
/* Create root window first */
@@ -935,175 +986,188 @@ static void dmxBECreateWindowTree(int idx)
pWin = pRoot->lastChild;
while (pWin) {
- pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
-
- /* Create the pixmaps regardless of whether or not the
- * window is created or not due to lazy window creation.
- */
- if (!pWin->borderIsPixel) {
- dmxBECreatePixmap(pWin->border.pixmap);
- dmxBERestorePixmap(pWin->border.pixmap);
- }
- if (pWin->backgroundState == BackgroundPixmap) {
- dmxBECreatePixmap(pWin->background.pixmap);
- dmxBERestorePixmap(pWin->background.pixmap);
- }
-
- /* Reset the window attributes */
- dmxGetDefaultWindowAttributes(pWin,
- &pWinPriv->cmap,
- &pWinPriv->visual);
-
- /* Create the window */
- if (pWinPriv->mapped && !pWinPriv->offscreen)
- dmxCreateAndRealizeWindow(pWin, TRUE);
-
- /* Next, create the bottom-most child */
- if (pWin->lastChild) {
- pWin = pWin->lastChild;
- continue;
- }
-
- /* If the window has no children, move on to the next higher window */
- while (!pWin->prevSib && (pWin != pRoot))
- pWin = pWin->parent;
-
- if (pWin->prevSib) {
- pWin = pWin->prevSib;
- continue;
- }
-
- /* When we reach the root window, we are finished */
- if (pWin == pRoot)
- break;
+ pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
+
+ /* Create the pixmaps regardless of whether or not the
+ * window is created or not due to lazy window creation.
+ */
+ if (!pWin->borderIsPixel) {
+ dmxBECreatePixmap(pWin->border.pixmap);
+ dmxBERestorePixmap(pWin->border.pixmap);
+ }
+ if (pWin->backgroundState == BackgroundPixmap) {
+ dmxBECreatePixmap(pWin->background.pixmap);
+ dmxBERestorePixmap(pWin->background.pixmap);
+ }
+
+ /* Reset the window attributes */
+ dmxGetDefaultWindowAttributes(pWin, &pWinPriv->cmap, &pWinPriv->visual);
+
+ /* Create the window */
+ if (pWinPriv->mapped && !pWinPriv->offscreen)
+ dmxCreateAndRealizeWindow(pWin, TRUE);
+
+ /* Next, create the bottom-most child */
+ if (pWin->lastChild) {
+ pWin = pWin->lastChild;
+ continue;
+ }
+
+ /* If the window has no children, move on to the next higher window */
+ while (!pWin->prevSib && (pWin != pRoot))
+ pWin = pWin->parent;
+
+ if (pWin->prevSib) {
+ pWin = pWin->prevSib;
+ continue;
+ }
+
+ /* When we reach the root window, we are finished */
+ if (pWin == pRoot)
+ break;
}
}
/* Refresh screen by generating exposure events for all windows */
-static void dmxForceExposures(int idx)
+static void
+dmxForceExposures(int idx)
{
- ScreenPtr pScreen = screenInfo.screens[idx];
- WindowPtr pRoot = pScreen->root;
- Bool anyMarked = FALSE;
- WindowPtr pChild;
+ ScreenPtr pScreen = screenInfo.screens[idx];
+ WindowPtr pRoot = pScreen->root;
+ Bool anyMarked = FALSE;
+ WindowPtr pChild;
for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib)
- anyMarked |= pScreen->MarkOverlappedWindows(pChild, pChild,
- (WindowPtr *)NULL);
+ anyMarked |= pScreen->MarkOverlappedWindows(pChild, pChild,
+ (WindowPtr *) NULL);
if (anyMarked) {
- /* If any windows have been marked, set the root window's
- * clipList to be broken since it will be recalculated in
- * ValidateTree()
- */
- RegionBreak(&pRoot->clipList);
- pScreen->ValidateTree(pRoot, NULL, VTBroken);
- pScreen->HandleExposures(pRoot);
- if (pScreen->PostValidateTree)
- pScreen->PostValidateTree(pRoot, NULL, VTBroken);
+ /* If any windows have been marked, set the root window's
+ * clipList to be broken since it will be recalculated in
+ * ValidateTree()
+ */
+ RegionBreak(&pRoot->clipList);
+ pScreen->ValidateTree(pRoot, NULL, VTBroken);
+ pScreen->HandleExposures(pRoot);
+ if (pScreen->PostValidateTree)
+ pScreen->PostValidateTree(pRoot, NULL, VTBroken);
}
}
/** Compare the new and old screens to see if they are compatible. */
-static Bool dmxCompareScreens(DMXScreenInfo *new, DMXScreenInfo *old)
+static Bool
+dmxCompareScreens(DMXScreenInfo * new, DMXScreenInfo * old)
{
int i;
- if (new->beWidth != old->beWidth) return FALSE;
- if (new->beHeight != old->beHeight) return FALSE;
- if (new->beDepth != old->beDepth) return FALSE;
- if (new->beBPP != old->beBPP) return FALSE;
-
- if (new->beNumDepths != old->beNumDepths) return FALSE;
+ if (new->beWidth != old->beWidth)
+ return FALSE;
+ if (new->beHeight != old->beHeight)
+ return FALSE;
+ if (new->beDepth != old->beDepth)
+ return FALSE;
+ if (new->beBPP != old->beBPP)
+ return FALSE;
+
+ if (new->beNumDepths != old->beNumDepths)
+ return FALSE;
for (i = 0; i < old->beNumDepths; i++)
- if (new->beDepths[i] != old->beDepths[i]) return FALSE;
+ if (new->beDepths[i] != old->beDepths[i])
+ return FALSE;
- if (new->beNumPixmapFormats != old->beNumPixmapFormats) return FALSE;
+ if (new->beNumPixmapFormats != old->beNumPixmapFormats)
+ return FALSE;
for (i = 0; i < old->beNumPixmapFormats; i++) {
- if (new->bePixmapFormats[i].depth !=
- old->bePixmapFormats[i].depth) return FALSE;
- if (new->bePixmapFormats[i].bits_per_pixel !=
- old->bePixmapFormats[i].bits_per_pixel) return FALSE;
- if (new->bePixmapFormats[i].scanline_pad !=
- old->bePixmapFormats[i].scanline_pad) return FALSE;
+ if (new->bePixmapFormats[i].depth != old->bePixmapFormats[i].depth)
+ return FALSE;
+ if (new->bePixmapFormats[i].bits_per_pixel !=
+ old->bePixmapFormats[i].bits_per_pixel)
+ return FALSE;
+ if (new->bePixmapFormats[i].scanline_pad !=
+ old->bePixmapFormats[i].scanline_pad)
+ return FALSE;
}
- if (new->beNumVisuals != old->beNumVisuals) return FALSE;
+ if (new->beNumVisuals != old->beNumVisuals)
+ return FALSE;
for (i = 0; i < old->beNumVisuals; i++) {
- if (new->beVisuals[i].visualid !=
- old->beVisuals[i].visualid) return FALSE;
- if (new->beVisuals[i].screen !=
- old->beVisuals[i].screen) return FALSE;
- if (new->beVisuals[i].depth !=
- old->beVisuals[i].depth) return FALSE;
- if (new->beVisuals[i].class !=
- old->beVisuals[i].class) return FALSE;
- if (new->beVisuals[i].red_mask !=
- old->beVisuals[i].red_mask) return FALSE;
- if (new->beVisuals[i].green_mask !=
- old->beVisuals[i].green_mask) return FALSE;
- if (new->beVisuals[i].blue_mask !=
- old->beVisuals[i].blue_mask) return FALSE;
- if (new->beVisuals[i].colormap_size !=
- old->beVisuals[i].colormap_size) return FALSE;
- if (new->beVisuals[i].bits_per_rgb !=
- old->beVisuals[i].bits_per_rgb) return FALSE;
- }
-
- if (new->beDefVisualIndex != old->beDefVisualIndex) return FALSE;
+ if (new->beVisuals[i].visualid != old->beVisuals[i].visualid)
+ return FALSE;
+ if (new->beVisuals[i].screen != old->beVisuals[i].screen)
+ return FALSE;
+ if (new->beVisuals[i].depth != old->beVisuals[i].depth)
+ return FALSE;
+ if (new->beVisuals[i].class != old->beVisuals[i].class)
+ return FALSE;
+ if (new->beVisuals[i].red_mask != old->beVisuals[i].red_mask)
+ return FALSE;
+ if (new->beVisuals[i].green_mask != old->beVisuals[i].green_mask)
+ return FALSE;
+ if (new->beVisuals[i].blue_mask != old->beVisuals[i].blue_mask)
+ return FALSE;
+ if (new->beVisuals[i].colormap_size != old->beVisuals[i].colormap_size)
+ return FALSE;
+ if (new->beVisuals[i].bits_per_rgb != old->beVisuals[i].bits_per_rgb)
+ return FALSE;
+ }
+
+ if (new->beDefVisualIndex != old->beDefVisualIndex)
+ return FALSE;
return TRUE;
}
/** Restore Render's picture */
-static void dmxBERestoreRenderPict(pointer value, XID id, pointer n)
+static void
+dmxBERestoreRenderPict(pointer value, XID id, pointer n)
{
- PicturePtr pPicture = value; /* The picture */
- DrawablePtr pDraw = pPicture->pDrawable; /* The picture's drawable */
- int scrnNum = (uintptr_t)n;
+ PicturePtr pPicture = value; /* The picture */
+ DrawablePtr pDraw = pPicture->pDrawable; /* The picture's drawable */
+ int scrnNum = (uintptr_t) n;
if (pDraw->pScreen->myNum != scrnNum) {
- /* Picture not on the screen we are restoring*/
- return;
+ /* Picture not on the screen we are restoring */
+ return;
}
if (pDraw->type == DRAWABLE_PIXMAP) {
- PixmapPtr pPixmap = (PixmapPtr)pDraw;
-
- /* Create and restore the pixmap drawable */
- dmxBECreatePixmap(pPixmap);
- dmxBERestorePixmap(pPixmap);
+ PixmapPtr pPixmap = (PixmapPtr) pDraw;
+
+ /* Create and restore the pixmap drawable */
+ dmxBECreatePixmap(pPixmap);
+ dmxBERestorePixmap(pPixmap);
}
dmxBECreatePicture(pPicture);
}
/** Restore Render's glyphs */
-static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
+static void
+dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
{
- GlyphSetPtr glyphSet = value;
- int scrnNum = (uintptr_t)n;
- dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
- DMXScreenInfo *dmxScreen = &dmxScreens[scrnNum];
- GlyphRefPtr table;
- char *images;
- Glyph *gids;
- XGlyphInfo *glyphs;
- char *pos;
- int beret;
- int len_images = 0;
- int i;
- int ctr;
+ GlyphSetPtr glyphSet = value;
+ int scrnNum = (uintptr_t) n;
+ dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ DMXScreenInfo *dmxScreen = &dmxScreens[scrnNum];
+ GlyphRefPtr table;
+ char *images;
+ Glyph *gids;
+ XGlyphInfo *glyphs;
+ char *pos;
+ int beret;
+ int len_images = 0;
+ int i;
+ int ctr;
if (glyphPriv->glyphSets[scrnNum]) {
- /* Only restore glyphs on the screen we are attaching */
- return;
+ /* Only restore glyphs on the screen we are attaching */
+ return;
}
/* First we must create the glyph set on the backend. */
if ((beret = dmxBECreateGlyphSet(scrnNum, glyphSet)) != Success) {
- dmxLog(dmxWarning,
- "\tdmxBERestoreRenderGlyph failed to create glyphset!\n");
- return;
+ dmxLog(dmxWarning,
+ "\tdmxBERestoreRenderGlyph failed to create glyphset!\n");
+ return;
}
/* Now for the complex part, restore the glyph data */
@@ -1111,89 +1175,92 @@ static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n)
/* We need to know how much memory to allocate for this part */
for (i = 0; i < glyphSet->hash.hashSet->size; i++) {
- GlyphRefPtr gr = &table[i];
- GlyphPtr gl = gr->glyph;
+ GlyphRefPtr gr = &table[i];
+ GlyphPtr gl = gr->glyph;
- if (!gl || gl == DeletedGlyph) continue;
- len_images += gl->size - sizeof(gl->info);
+ if (!gl || gl == DeletedGlyph)
+ continue;
+ len_images += gl->size - sizeof(gl->info);
}
/* Now allocate the memory we need */
images = calloc(len_images, sizeof(char));
- gids = malloc(glyphSet->hash.tableEntries*sizeof(Glyph));
- glyphs = malloc(glyphSet->hash.tableEntries*sizeof(XGlyphInfo));
+ gids = malloc(glyphSet->hash.tableEntries * sizeof(Glyph));
+ glyphs = malloc(glyphSet->hash.tableEntries * sizeof(XGlyphInfo));
pos = images;
ctr = 0;
-
+
/* Fill the allocated memory with the proper data */
for (i = 0; i < glyphSet->hash.hashSet->size; i++) {
- GlyphRefPtr gr = &table[i];
- GlyphPtr gl = gr->glyph;
-
- if (!gl || gl == DeletedGlyph) continue;
-
- /* First lets put the data into gids */
- gids[ctr] = gr->signature;
-
- /* Next do the glyphs data structures */
- glyphs[ctr].width = gl->info.width;
- glyphs[ctr].height = gl->info.height;
- glyphs[ctr].x = gl->info.x;
- glyphs[ctr].y = gl->info.y;
- glyphs[ctr].xOff = gl->info.xOff;
- glyphs[ctr].yOff = gl->info.yOff;
-
- /* Copy the images from the DIX's data into the buffer */
- memcpy(pos, gl+1, gl->size - sizeof(gl->info));
- pos += gl->size - sizeof(gl->info);
- ctr++;
+ GlyphRefPtr gr = &table[i];
+ GlyphPtr gl = gr->glyph;
+
+ if (!gl || gl == DeletedGlyph)
+ continue;
+
+ /* First lets put the data into gids */
+ gids[ctr] = gr->signature;
+
+ /* Next do the glyphs data structures */
+ glyphs[ctr].width = gl->info.width;
+ glyphs[ctr].height = gl->info.height;
+ glyphs[ctr].x = gl->info.x;
+ glyphs[ctr].y = gl->info.y;
+ glyphs[ctr].xOff = gl->info.xOff;
+ glyphs[ctr].yOff = gl->info.yOff;
+
+ /* Copy the images from the DIX's data into the buffer */
+ memcpy(pos, gl + 1, gl->size - sizeof(gl->info));
+ pos += gl->size - sizeof(gl->info);
+ ctr++;
}
-
+
/* Now restore the glyph data */
XRenderAddGlyphs(dmxScreen->beDisplay, glyphPriv->glyphSets[scrnNum],
- gids,glyphs, glyphSet->hash.tableEntries, images,
- len_images);
+ gids, glyphs, glyphSet->hash.tableEntries, images,
+ len_images);
/* Clean up */
free(images);
free(gids);
- free(glyphs);
+ free(glyphs);
}
/** Reattach previously detached back-end screen. */
-int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
+int
+dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
{
- ScreenPtr pScreen;
+ ScreenPtr pScreen;
DMXScreenInfo *dmxScreen;
- CARD32 scrnNum = idx;
- DMXScreenInfo oldDMXScreen;
- int i;
+ CARD32 scrnNum = idx;
+ DMXScreenInfo oldDMXScreen;
+ int i;
/* Return failure if dynamic addition/removal of screens is disabled */
if (!dmxAddRemoveScreens) {
- dmxLog(dmxWarning,
- "Attempting to add a screen, but the AddRemoveScreen\n");
- dmxLog(dmxWarning,
- "extension has not been enabled. To enable this extension\n");
- dmxLog(dmxWarning,
- "add the \"-addremovescreens\" option either to the command\n");
- dmxLog(dmxWarning,
- "line or in the configuration file.\n");
- return 1;
+ dmxLog(dmxWarning,
+ "Attempting to add a screen, but the AddRemoveScreen\n");
+ dmxLog(dmxWarning,
+ "extension has not been enabled. To enable this extension\n");
+ dmxLog(dmxWarning,
+ "add the \"-addremovescreens\" option either to the command\n");
+ dmxLog(dmxWarning, "line or in the configuration file.\n");
+ return 1;
}
/* Cannot add a screen that does not exist */
- if (idx < 0 || idx >= dmxNumScreens) return 1;
+ if (idx < 0 || idx >= dmxNumScreens)
+ return 1;
pScreen = screenInfo.screens[idx];
dmxScreen = &dmxScreens[idx];
/* Cannot attach to a screen that is already opened */
if (dmxScreen->beDisplay) {
- dmxLog(dmxWarning,
- "Attempting to add screen #%d but a screen already exists\n",
- idx);
- return 1;
+ dmxLog(dmxWarning,
+ "Attempting to add screen #%d but a screen already exists\n",
+ idx);
+ return 1;
}
dmxLogOutput(dmxScreen, "Attaching screen #%d\n", idx);
@@ -1206,13 +1273,12 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
/* Open display and get all of the screen info */
if (!dmxOpenDisplay(dmxScreen)) {
- dmxLog(dmxWarning,
- "dmxOpenDisplay: Unable to open display %s\n",
- dmxScreen->name);
+ dmxLog(dmxWarning,
+ "dmxOpenDisplay: Unable to open display %s\n", dmxScreen->name);
- /* Restore the old screen */
- *dmxScreen = oldDMXScreen;
- return 1;
+ /* Restore the old screen */
+ *dmxScreen = oldDMXScreen;
+ return 1;
}
dmxSetErrorHandler(dmxScreen);
@@ -1220,13 +1286,13 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
dmxGetScreenAttribs(dmxScreen);
if (!dmxGetVisualInfo(dmxScreen)) {
- dmxLog(dmxWarning, "dmxGetVisualInfo: No matching visuals found\n");
- XFree(dmxScreen->beVisuals);
- XCloseDisplay(dmxScreen->beDisplay);
+ dmxLog(dmxWarning, "dmxGetVisualInfo: No matching visuals found\n");
+ XFree(dmxScreen->beVisuals);
+ XCloseDisplay(dmxScreen->beDisplay);
- /* Restore the old screen */
- *dmxScreen = oldDMXScreen;
- return 1;
+ /* Restore the old screen */
+ *dmxScreen = oldDMXScreen;
+ return 1;
}
dmxGetColormaps(dmxScreen);
@@ -1235,23 +1301,20 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
/* Verify that the screen to be added has the same info as the
* previously added screen. */
if (!dmxCompareScreens(dmxScreen, &oldDMXScreen)) {
- dmxLog(dmxWarning,
- "New screen data (%s) does not match previously\n",
- dmxScreen->name);
- dmxLog(dmxWarning,
- "attached screen data (%s)\n",
- oldDMXScreen.name);
- dmxLog(dmxWarning,
- "All data must match in order to attach to screen #%d\n",
- idx);
- XFree(dmxScreen->beVisuals);
- XFree(dmxScreen->beDepths);
- XFree(dmxScreen->bePixmapFormats);
- XCloseDisplay(dmxScreen->beDisplay);
-
- /* Restore the old screen */
- *dmxScreen = oldDMXScreen;
- return 1;
+ dmxLog(dmxWarning,
+ "New screen data (%s) does not match previously\n",
+ dmxScreen->name);
+ dmxLog(dmxWarning, "attached screen data (%s)\n", oldDMXScreen.name);
+ dmxLog(dmxWarning,
+ "All data must match in order to attach to screen #%d\n", idx);
+ XFree(dmxScreen->beVisuals);
+ XFree(dmxScreen->beDepths);
+ XFree(dmxScreen->bePixmapFormats);
+ XCloseDisplay(dmxScreen->beDisplay);
+
+ /* Restore the old screen */
+ *dmxScreen = oldDMXScreen;
+ return 1;
}
/* Initialize the BE screen resources */
@@ -1268,30 +1331,30 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
dmxBECreateScratchGCs(idx);
/* Create the default font */
- (void)dmxBELoadFont(pScreen, defaultFont);
+ (void) dmxBELoadFont(pScreen, defaultFont);
/* Create all resources that don't depend on windows */
- for (i = currentMaxClients; --i >= 0; )
- if (clients[i])
- FindAllClientResources(clients[i], dmxBECreateResources,
- (pointer)(uintptr_t)idx);
+ for (i = currentMaxClients; --i >= 0;)
+ if (clients[i])
+ FindAllClientResources(clients[i], dmxBECreateResources,
+ (pointer) (uintptr_t) idx);
/* Create window hierarchy (top down) */
dmxBECreateWindowTree(idx);
/* Restore the picture state for RENDER */
- for (i = currentMaxClients; --i >= 0; )
- if (clients[i])
- FindClientResourcesByType(clients[i],PictureType,
- dmxBERestoreRenderPict,
- (pointer)(uintptr_t)idx);
+ for (i = currentMaxClients; --i >= 0;)
+ if (clients[i])
+ FindClientResourcesByType(clients[i], PictureType,
+ dmxBERestoreRenderPict,
+ (pointer) (uintptr_t) idx);
/* Restore the glyph state for RENDER */
- for (i = currentMaxClients; --i >= 0; )
- if (clients[i])
- FindClientResourcesByType(clients[i],GlyphSetType,
- dmxBERestoreRenderGlyph,
- (pointer)(uintptr_t)idx);
+ for (i = currentMaxClients; --i >= 0;)
+ if (clients[i])
+ FindClientResourcesByType(clients[i], GlyphSetType,
+ dmxBERestoreRenderGlyph,
+ (pointer) (uintptr_t) idx);
/* Refresh screen by generating exposure events for all windows */
dmxForceExposures(idx);
@@ -1308,10 +1371,10 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
#ifdef PANORAMIX
if (!noPanoramiXExtension)
- return dmxConfigureScreenWindows(1, &scrnNum, attr, NULL);
+ return dmxConfigureScreenWindows(1, &scrnNum, attr, NULL);
else
#endif
- return 0; /* Success */
+ return 0; /* Success */
}
/*
@@ -1358,34 +1421,36 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr)
#ifdef PANORAMIX
/** Search the Xinerama XRT_PIXMAP resources for the pixmap that needs
* to have its image saved. */
-static void dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type,
- pointer p)
+static void
+dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type, pointer p)
{
if ((type & TypeMask) == (XRT_PIXMAP & TypeMask)) {
- PixmapPtr pDst = (PixmapPtr)p;
- int idx = pDst->drawable.pScreen->myNum;
- PanoramiXRes *pXinPix = (PanoramiXRes *)value;
- PixmapPtr pPix;
- int i;
-
- dixLookupResourceByType((pointer*) &pPix, pXinPix->info[idx].id,
- RT_PIXMAP, NullClient, DixUnknownAccess);
- if (pPix != pDst) return; /* Not a match.... Next! */
-
- FOR_NSCREENS(i) {
- PixmapPtr pSrc;
- dmxPixPrivPtr pSrcPriv = NULL;
-
- if (i == idx) continue; /* Self replication is bad */
-
- dixLookupResourceByType((pointer*) &pSrc, pXinPix->info[i].id,
- RT_PIXMAP, NullClient, DixUnknownAccess);
- pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
- if (pSrcPriv->pixmap) {
- FoundPixImage = True;
- return;
- }
- }
+ PixmapPtr pDst = (PixmapPtr) p;
+ int idx = pDst->drawable.pScreen->myNum;
+ PanoramiXRes *pXinPix = (PanoramiXRes *) value;
+ PixmapPtr pPix;
+ int i;
+
+ dixLookupResourceByType((pointer *) &pPix, pXinPix->info[idx].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
+ if (pPix != pDst)
+ return; /* Not a match.... Next! */
+
+ FOR_NSCREENS(i) {
+ PixmapPtr pSrc;
+ dmxPixPrivPtr pSrcPriv = NULL;
+
+ if (i == idx)
+ continue; /* Self replication is bad */
+
+ dixLookupResourceByType((pointer *) &pSrc, pXinPix->info[i].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
+ pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
+ if (pSrcPriv->pixmap) {
+ FoundPixImage = True;
+ return;
+ }
+ }
}
}
#endif
@@ -1399,40 +1464,41 @@ static void dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type,
* However, if we do not find one, then we need to save the image data.
* The common case for these are for the default stipple and root
* tile. */
-static void dmxBESavePixmap(PixmapPtr pPixmap)
+static void
+dmxBESavePixmap(PixmapPtr pPixmap)
{
#ifdef PANORAMIX
int i;
/* If Xinerama is not active, there's nothing we can do (see comment
* in #else below for more info). */
- if (noPanoramiXExtension) return;
+ if (noPanoramiXExtension)
+ return;
FoundPixImage = False;
- for (i = currentMaxClients; --i >= 0; )
- if (clients[i])
- FindAllClientResources(clients[i], dmxBEFindPixmapImage,
- (pointer)pPixmap);
+ for (i = currentMaxClients; --i >= 0;)
+ if (clients[i])
+ FindAllClientResources(clients[i], dmxBEFindPixmapImage,
+ (pointer) pPixmap);
/* Save the image only if there is no other screens that have a
* pixmap that corresponds to the one we are trying to save. */
if (!FoundPixImage) {
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
-
- if (!pPixPriv->detachedImage) {
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
-
- pPixPriv->detachedImage = XGetImage(dmxScreen->beDisplay,
- pPixPriv->pixmap,
- 0, 0,
- pPixmap->drawable.width,
- pPixmap->drawable.height,
- -1,
- ZPixmap);
- if (!pPixPriv->detachedImage)
- dmxLog(dmxWarning, "Cannot save pixmap image\n");
- }
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+
+ if (!pPixPriv->detachedImage) {
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+
+ pPixPriv->detachedImage = XGetImage(dmxScreen->beDisplay,
+ pPixPriv->pixmap,
+ 0, 0,
+ pPixmap->drawable.width,
+ pPixmap->drawable.height,
+ -1, ZPixmap);
+ if (!pPixPriv->detachedImage)
+ dmxLog(dmxWarning, "Cannot save pixmap image\n");
+ }
}
#else
/* NOTE: The only time there is a pixmap on another screen that
@@ -1452,59 +1518,73 @@ static void dmxBESavePixmap(PixmapPtr pPixmap)
* function. It walks all resources, compares them to the screen
* number passed in as \a n and calls the appropriate DMX function to
* free the associated resource on the back-end server. */
-static void dmxBEDestroyResources(pointer value, XID id, RESTYPE type,
- pointer n)
+static void
+dmxBEDestroyResources(pointer value, XID id, RESTYPE type, pointer n)
{
- int scrnNum = (uintptr_t)n;
- ScreenPtr pScreen = screenInfo.screens[scrnNum];
+ int scrnNum = (uintptr_t) n;
+ ScreenPtr pScreen = screenInfo.screens[scrnNum];
if ((type & TypeMask) == (RT_WINDOW & TypeMask)) {
- /* Window resources are destroyed below in dmxBEDestroyWindowTree */
- } else if ((type & TypeMask) == (RT_PIXMAP & TypeMask)) {
- PixmapPtr pPix = value;
- if (pPix->drawable.pScreen->myNum == scrnNum) {
- dmxBESavePixmap(pPix);
- dmxBEFreePixmap(pPix);
- }
- } else if ((type & TypeMask) == (RT_GC & TypeMask)) {
- GCPtr pGC = value;
- if (pGC->pScreen->myNum == scrnNum)
- dmxBEFreeGC(pGC);
- } else if ((type & TypeMask) == (RT_FONT & TypeMask)) {
- dmxBEFreeFont(pScreen, (FontPtr)value);
- } else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) {
- dmxBEFreeCursor(pScreen, (CursorPtr)value);
- } else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) {
- ColormapPtr pCmap = value;
- if (pCmap->pScreen->myNum == scrnNum)
- dmxBEFreeColormap((ColormapPtr)value);
- } else if ((type & TypeMask) == (PictureType & TypeMask)) {
- PicturePtr pPict = value;
- if (pPict->pDrawable->pScreen->myNum == scrnNum) {
- /* Free the pixmaps on the backend if needed */
- if (pPict->pDrawable->type == DRAWABLE_PIXMAP) {
- PixmapPtr pPixmap = (PixmapPtr)(pPict->pDrawable);
- dmxBESavePixmap(pPixmap);
- dmxBEFreePixmap(pPixmap);
- }
- dmxBEFreePicture((PicturePtr)value);
- }
- } else if ((type & TypeMask) == (GlyphSetType & TypeMask)) {
- dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value);
- } else {
- /* Other resource types??? */
+ /* Window resources are destroyed below in dmxBEDestroyWindowTree */
+ }
+ else if ((type & TypeMask) == (RT_PIXMAP & TypeMask)) {
+ PixmapPtr pPix = value;
+
+ if (pPix->drawable.pScreen->myNum == scrnNum) {
+ dmxBESavePixmap(pPix);
+ dmxBEFreePixmap(pPix);
+ }
+ }
+ else if ((type & TypeMask) == (RT_GC & TypeMask)) {
+ GCPtr pGC = value;
+
+ if (pGC->pScreen->myNum == scrnNum)
+ dmxBEFreeGC(pGC);
+ }
+ else if ((type & TypeMask) == (RT_FONT & TypeMask)) {
+ dmxBEFreeFont(pScreen, (FontPtr) value);
+ }
+ else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) {
+ dmxBEFreeCursor(pScreen, (CursorPtr) value);
+ }
+ else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) {
+ ColormapPtr pCmap = value;
+
+ if (pCmap->pScreen->myNum == scrnNum)
+ dmxBEFreeColormap((ColormapPtr) value);
+ }
+ else if ((type & TypeMask) == (PictureType & TypeMask)) {
+ PicturePtr pPict = value;
+
+ if (pPict->pDrawable->pScreen->myNum == scrnNum) {
+ /* Free the pixmaps on the backend if needed */
+ if (pPict->pDrawable->type == DRAWABLE_PIXMAP) {
+ PixmapPtr pPixmap = (PixmapPtr) (pPict->pDrawable);
+
+ dmxBESavePixmap(pPixmap);
+ dmxBEFreePixmap(pPixmap);
+ }
+ dmxBEFreePicture((PicturePtr) value);
+ }
+ }
+ else if ((type & TypeMask) == (GlyphSetType & TypeMask)) {
+ dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr) value);
+ }
+ else {
+ /* Other resource types??? */
}
}
/** Destroy the scratch GCs that are created per depth. */
-static void dmxBEDestroyScratchGCs(int scrnNum)
+static void
+dmxBEDestroyScratchGCs(int scrnNum)
{
- ScreenPtr pScreen = screenInfo.screens[scrnNum];
- GCPtr *ppGC = pScreen->GCperDepth;
- int i;
+ ScreenPtr pScreen = screenInfo.screens[scrnNum];
+ GCPtr *ppGC = pScreen->GCperDepth;
+ int i;
for (i = 0; i <= pScreen->numDepths; i++)
- dmxBEFreeGC(ppGC[i]);
+ dmxBEFreeGC(ppGC[i]);
}
/** Destroy window hierachy on back-end server. To ensure that all
@@ -1512,79 +1592,81 @@ static void dmxBEDestroyScratchGCs(int scrnNum)
* up order so that windows are not destroyed before their children.
* XDestroyWindow(), which is called from #dmxBEDestroyWindow(), will
* destroy a window as well as all of it's children. */
-static void dmxBEDestroyWindowTree(int idx)
+static void
+dmxBEDestroyWindowTree(int idx)
{
- WindowPtr pWin = screenInfo.screens[idx]->root;
- WindowPtr pChild = pWin;
+ WindowPtr pWin = screenInfo.screens[idx]->root;
+ WindowPtr pChild = pWin;
while (1) {
- if (pChild->firstChild) {
- pChild = pChild->firstChild;
- continue;
- }
-
- /* Destroy the window */
- dmxBEDestroyWindow(pChild);
-
- /* Make sure we destroy the window's border and background
- * pixmaps if they exist */
- if (!pChild->borderIsPixel) {
- dmxBESavePixmap(pChild->border.pixmap);
- dmxBEFreePixmap(pChild->border.pixmap);
- }
- if (pChild->backgroundState == BackgroundPixmap) {
- dmxBESavePixmap(pChild->background.pixmap);
- dmxBEFreePixmap(pChild->background.pixmap);
- }
-
- while (!pChild->nextSib && (pChild != pWin)) {
- pChild = pChild->parent;
- dmxBEDestroyWindow(pChild);
- if (!pChild->borderIsPixel) {
- dmxBESavePixmap(pChild->border.pixmap);
- dmxBEFreePixmap(pChild->border.pixmap);
- }
- if (pChild->backgroundState == BackgroundPixmap) {
- dmxBESavePixmap(pChild->background.pixmap);
- dmxBEFreePixmap(pChild->background.pixmap);
- }
- }
-
- if (pChild == pWin)
- break;
-
- pChild = pChild->nextSib;
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+
+ /* Destroy the window */
+ dmxBEDestroyWindow(pChild);
+
+ /* Make sure we destroy the window's border and background
+ * pixmaps if they exist */
+ if (!pChild->borderIsPixel) {
+ dmxBESavePixmap(pChild->border.pixmap);
+ dmxBEFreePixmap(pChild->border.pixmap);
+ }
+ if (pChild->backgroundState == BackgroundPixmap) {
+ dmxBESavePixmap(pChild->background.pixmap);
+ dmxBEFreePixmap(pChild->background.pixmap);
+ }
+
+ while (!pChild->nextSib && (pChild != pWin)) {
+ pChild = pChild->parent;
+ dmxBEDestroyWindow(pChild);
+ if (!pChild->borderIsPixel) {
+ dmxBESavePixmap(pChild->border.pixmap);
+ dmxBEFreePixmap(pChild->border.pixmap);
+ }
+ if (pChild->backgroundState == BackgroundPixmap) {
+ dmxBESavePixmap(pChild->background.pixmap);
+ dmxBEFreePixmap(pChild->background.pixmap);
+ }
+ }
+
+ if (pChild == pWin)
+ break;
+
+ pChild = pChild->nextSib;
}
}
/** Detach back-end screen. */
-int dmxDetachScreen(int idx)
+int
+dmxDetachScreen(int idx)
{
DMXScreenInfo *dmxScreen = &dmxScreens[idx];
- int i;
+ int i;
/* Return failure if dynamic addition/removal of screens is disabled */
if (!dmxAddRemoveScreens) {
- dmxLog(dmxWarning,
- "Attempting to remove a screen, but the AddRemoveScreen\n");
- dmxLog(dmxWarning,
- "extension has not been enabled. To enable this extension\n");
- dmxLog(dmxWarning,
- "add the \"-addremovescreens\" option either to the command\n");
- dmxLog(dmxWarning,
- "line or in the configuration file.\n");
- return 1;
+ dmxLog(dmxWarning,
+ "Attempting to remove a screen, but the AddRemoveScreen\n");
+ dmxLog(dmxWarning,
+ "extension has not been enabled. To enable this extension\n");
+ dmxLog(dmxWarning,
+ "add the \"-addremovescreens\" option either to the command\n");
+ dmxLog(dmxWarning, "line or in the configuration file.\n");
+ return 1;
}
/* Cannot remove a screen that does not exist */
- if (idx < 0 || idx >= dmxNumScreens) return 1;
+ if (idx < 0 || idx >= dmxNumScreens)
+ return 1;
/* Cannot detach from a screen that is not opened */
if (!dmxScreen->beDisplay) {
- dmxLog(dmxWarning,
- "Attempting to remove screen #%d but it has not been opened\n",
- idx);
- return 1;
+ dmxLog(dmxWarning,
+ "Attempting to remove screen #%d but it has not been opened\n",
+ idx);
+ return 1;
}
dmxLogOutput(dmxScreen, "Detaching screen #%d\n", idx);
@@ -1595,10 +1677,10 @@ int dmxDetachScreen(int idx)
/* Save all relevant state (TODO) */
/* Free all non-window resources related to this screen */
- for (i = currentMaxClients; --i >= 0; )
- if (clients[i])
- FindAllClientResources(clients[i], dmxBEDestroyResources,
- (pointer)(uintptr_t)idx);
+ for (i = currentMaxClients; --i >= 0;)
+ if (clients[i])
+ FindAllClientResources(clients[i], dmxBEDestroyResources,
+ (pointer) (uintptr_t) idx);
/* Free scratch GCs */
dmxBEDestroyScratchGCs(idx);
@@ -1616,5 +1698,5 @@ int dmxDetachScreen(int idx)
/* Adjust the cursor boundaries (paints detached console window) */
dmxAdjustCursorBoundaries();
- return 0; /* Success */
+ return 0; /* Success */
}
diff --git a/xorg-server/hw/dmx/dmxextension.h b/xorg-server/hw/dmx/dmxextension.h
index 5a6fd0e9f..036417b8d 100644
--- a/xorg-server/hw/dmx/dmxextension.h
+++ b/xorg-server/hw/dmx/dmxextension.h
@@ -42,77 +42,74 @@
/** Screen attributes. Used by #ProcDMXGetScreenAttributes and
* \a ProcDMXChangeScreensAttributes. */
typedef struct {
- const char *displayName;
- int logicalScreen;
+ const char *displayName;
+ int logicalScreen;
- unsigned int screenWindowWidth; /* displayName's coordinate system */
- unsigned int screenWindowHeight; /* displayName's coordinate system */
- int screenWindowXoffset; /* displayName's coordinate system */
- int screenWindowYoffset; /* displayName's coordinate system */
+ unsigned int screenWindowWidth; /* displayName's coordinate system */
+ unsigned int screenWindowHeight; /* displayName's coordinate system */
+ int screenWindowXoffset; /* displayName's coordinate system */
+ int screenWindowYoffset; /* displayName's coordinate system */
- unsigned int rootWindowWidth; /* screenWindow's coordinate system */
- unsigned int rootWindowHeight; /* screenWindow's coordinate system */
- int rootWindowXoffset; /* screenWindow's coordinate system */
- int rootWindowYoffset; /* screenWindow's coordinate system */
+ unsigned int rootWindowWidth; /* screenWindow's coordinate system */
+ unsigned int rootWindowHeight; /* screenWindow's coordinate system */
+ int rootWindowXoffset; /* screenWindow's coordinate system */
+ int rootWindowYoffset; /* screenWindow's coordinate system */
- int rootWindowXorigin; /* global coordinate system */
- int rootWindowYorigin; /* global coordinate system */
+ int rootWindowXorigin; /* global coordinate system */
+ int rootWindowYorigin; /* global coordinate system */
} DMXScreenAttributesRec, *DMXScreenAttributesPtr;
/** Window attributes. Used by #ProcDMXGetWindowAttributes. */
typedef struct {
- int screen;
- Window window;
- xRectangle pos;
- xRectangle vis;
+ int screen;
+ Window window;
+ xRectangle pos;
+ xRectangle vis;
} DMXWindowAttributesRec, *DMXWindowAttributesPtr;
/** Desktop attributes. Used by #ProcDMXGetDesktopAttributes and
* #ProcDMXChangeDesktopAttributes. */
typedef struct {
- int width;
- int height;
- int shiftX;
- int shiftY;
+ int width;
+ int height;
+ int shiftX;
+ int shiftY;
} DMXDesktopAttributesRec, *DMXDesktopAttributesPtr;
/** Input attributes. Used by #ProcDMXGetInputAttributes. */
typedef struct {
- const char *name;
- int inputType;
- int physicalScreen;
- int physicalId;
- int isCore;
- int sendsCore;
- int detached;
+ const char *name;
+ int inputType;
+ int physicalScreen;
+ int physicalId;
+ int isCore;
+ int sendsCore;
+ int detached;
} DMXInputAttributesRec, *DMXInputAttributesPtr;
-
extern unsigned long dmxGetNumScreens(void);
-extern void dmxForceWindowCreation(WindowPtr pWindow);
-extern void dmxFlushPendingSyncs(void);
-extern Bool dmxGetScreenAttributes(int physical,
- DMXScreenAttributesPtr attr);
-extern Bool dmxGetWindowAttributes(WindowPtr pWindow,
- DMXWindowAttributesPtr attr);
-extern void dmxGetDesktopAttributes(DMXDesktopAttributesPtr attr);
-extern int dmxGetInputCount(void);
-extern int dmxGetInputAttributes(int deviceId,
- DMXInputAttributesPtr attr);
-extern int dmxAddInput(DMXInputAttributesPtr attr, int *deviceId);
-extern int dmxRemoveInput(int deviceId);
-
-extern int dmxConfigureScreenWindows(int nscreens,
- CARD32 *screens,
- DMXScreenAttributesPtr attribs,
- int *errorScreen);
-
-extern int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs);
+extern void dmxForceWindowCreation(WindowPtr pWindow);
+extern void dmxFlushPendingSyncs(void);
+extern Bool dmxGetScreenAttributes(int physical, DMXScreenAttributesPtr attr);
+extern Bool dmxGetWindowAttributes(WindowPtr pWindow,
+ DMXWindowAttributesPtr attr);
+extern void dmxGetDesktopAttributes(DMXDesktopAttributesPtr attr);
+extern int dmxGetInputCount(void);
+extern int dmxGetInputAttributes(int deviceId, DMXInputAttributesPtr attr);
+extern int dmxAddInput(DMXInputAttributesPtr attr, int *deviceId);
+extern int dmxRemoveInput(int deviceId);
+
+extern int dmxConfigureScreenWindows(int nscreens,
+ CARD32 *screens,
+ DMXScreenAttributesPtr attribs,
+ int *errorScreen);
+
+extern int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs);
/* dmxUpdateScreenResources exposed for dmxCreateWindow in dmxwindow.c */
-extern void dmxUpdateScreenResources(ScreenPtr pScreen,
- int x, int y, int w, int h);
+extern void dmxUpdateScreenResources(ScreenPtr pScreen,
+ int x, int y, int w, int h);
-extern int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr);
-extern int dmxDetachScreen(int idx);
+extern int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr);
+extern int dmxDetachScreen(int idx);
#endif
diff --git a/xorg-server/hw/dmx/dmxfont.c b/xorg-server/hw/dmx/dmxfont.c
index 8b57b6f3b..7ef7ad971 100644
--- a/xorg-server/hw/dmx/dmxfont.c
+++ b/xorg-server/hw/dmx/dmxfont.c
@@ -1,551 +1,572 @@
-/*
- * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <kem@redhat.com>
- *
- */
-
-/** \file
- * This file provides support for fonts. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#define DMX_FONTPATH_DEBUG 0
-
-#include "dmx.h"
-#include "dmxsync.h"
-#include "dmxfont.h"
-#include "dmxlog.h"
-
-#include <X11/fonts/fontstruct.h>
-#include "dixfont.h"
-#include "dixstruct.h"
-
-static int (*dmxSaveProcVector[256])(ClientPtr);
-static int dmxFontLastError;
-
-static int dmxFontErrorHandler(Display *dpy, XErrorEvent *ev)
-{
- dmxFontLastError = ev->error_code;
-
- return 0;
-}
-
-static char **dmxGetFontPath(int *npaths)
-{
- char **fp;
- unsigned char *c, *paths;
- char *newfp;
- int len, l, i;
-
- GetFontPath(serverClient, npaths, &len, &paths);
-
- newfp = malloc(*npaths + len);
- c = (unsigned char *)newfp;
- fp = malloc(*npaths * sizeof(*fp));
-
- memmove(newfp, paths+1, *npaths + len - 1);
- l = *paths;
- for (i = 0; i < *npaths; i++) {
- fp[i] = (char *)c;
- c += l;
- l = *c;
- *c++ = '\0';
- }
-
-#if DMX_FONTPATH_DEBUG
- for (i = 0; i < *npaths; i++)
- dmxLog(dmxDebug, "FontPath[%d] = %s\n", i, fp[i]);
-#endif
-
- return fp;
-}
-
-static void dmxFreeFontPath(char **fp)
-{
- free(fp[0]);
- free(fp);
-}
-
-static Bool dmxCheckFontPathElement(DMXScreenInfo *dmxScreen, char *fp)
-{
- int (*oldErrorHandler)(Display *, XErrorEvent *);
-
- if (!dmxScreen->beDisplay)
- return TRUE;
-
- dmxFontLastError = 0;
- oldErrorHandler = XSetErrorHandler(dmxFontErrorHandler);
- XSetFontPath(dmxScreen->beDisplay, &fp, 1);
- dmxSync(dmxScreen, TRUE); /* Must complete before removing handler */
- XSetErrorHandler(oldErrorHandler);
-
- return dmxFontLastError == 0;
-}
-
-static int dmxSetFontPath(DMXScreenInfo *dmxScreen)
-{
- int (*oldErrorHandler)(Display *, XErrorEvent *);
- char **fp;
- int result = Success;
- int npaths;
-
- if (!dmxScreen->beDisplay)
- return result;
-
- fp = dmxGetFontPath(&npaths);
- if (!fp) return BadAlloc;
-
- dmxFontLastError = 0;
- oldErrorHandler = XSetErrorHandler(dmxFontErrorHandler);
- XSetFontPath(dmxScreen->beDisplay, fp, npaths);
- dmxSync(dmxScreen, TRUE); /* Must complete before removing handler */
- XSetErrorHandler(oldErrorHandler);
-
- if (dmxFontLastError) {
- result = dmxFontLastError;
- /* We could set *error here to the offending path, but it is
- * ignored, so we don't bother figuring out which path is bad.
- * If we do add this support in the future, we'll need to add
- * error to the function's argument list.
- */
- }
-
- dmxFreeFontPath(fp);
-
- return result;
-}
-
-static int dmxCheckFontPath(DMXScreenInfo *dmxScreen, int *error)
-{
- char **oldFontPath;
- int nOldPaths;
- int result = Success;
-
- if (!dmxScreen->beDisplay)
- return result;
-
- /* Save old font path */
- oldFontPath = XGetFontPath(dmxScreen->beDisplay, &nOldPaths);
-
- result = dmxSetFontPath(dmxScreen);
-
- /* Restore old font path */
- XSetFontPath(dmxScreen->beDisplay, oldFontPath, nOldPaths);
- XFreeFontPath(oldFontPath);
- dmxSync(dmxScreen, FALSE);
-
- return result;
-}
-
-static int dmxProcSetFontPath(ClientPtr client)
-{
- unsigned char *ptr;
- unsigned long nbytes, total, n;
- long nfonts;
- int i, result;
- unsigned char *oldFontPath, *tmpFontPath;
- int nOldPaths;
- int lenOldPaths;
- REQUEST(xSetFontPathReq);
-
- REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
-
- nbytes = (client->req_len << 2) - sizeof(xSetFontPathReq);
- total = nbytes;
- ptr = (unsigned char *)&stuff[1];
- nfonts = stuff->nFonts;
-
- while (--nfonts >= 0) {
- if ((total == 0) || (total < (n = (*ptr + 1))))
- return BadLength;
- total -= n;
- ptr += n;
- }
- if (total >= 4)
- return BadLength;
-
- GetFontPath(serverClient, &nOldPaths, &lenOldPaths, &tmpFontPath);
- oldFontPath = malloc(nOldPaths + lenOldPaths);
- memmove(oldFontPath, tmpFontPath, nOldPaths + lenOldPaths);
-
- result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1]);
- if (!result) {
- int error = 0;
- for (i = 0; i < dmxNumScreens; i++)
- if ((result = dmxCheckFontPath(&dmxScreens[i], &error)))
- break;
-
- if (result) {
- /* Restore old fontpath in the DMX server */
- SetFontPath(client, nOldPaths, oldFontPath);
- client->errorValue = error;
- }
- }
-
- free(oldFontPath);
- return result;
-}
-
-/** Initialize font support. In addition to the screen function call
- * pointers, DMX also hooks in at the ProcVector[] level. Here the old
- * ProcVector function pointers are saved and the new ProcVector
- * function pointers are initialized. */
-void dmxInitFonts(void)
-{
- int i;
-
- for (i = 0; i < 256; i++)
- dmxSaveProcVector[i] = ProcVector[i];
-
- ProcVector[X_SetFontPath] = dmxProcSetFontPath;
-}
-
-/** Reset font support by restoring the original ProcVector function
- * pointers. */
-void dmxResetFonts(void)
-{
- int i;
-
- for (i = 0; i < 256; i++)
- ProcVector[i] = dmxSaveProcVector[i];
-}
-
-/** Load the font, \a pFont, on the back-end server associated with \a
- * pScreen. When a font is loaded, the font path on back-end server is
- * first initialized to that specified on the command line with the
- * -fontpath options, and then the font is loaded. */
-Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxFontPrivPtr pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex);
- const char *name;
- char **oldFontPath = NULL;
- int nOldPaths;
- Atom name_atom, value_atom;
- int i;
-
- /* Make sure we have a font private struct to work with */
- if (!pFontPriv)
- return FALSE;
-
- /* Don't load a font over top of itself */
- if (pFontPriv->font[pScreen->myNum]) {
- return TRUE; /* Already loaded font */
- }
-
- /* Save old font path */
- oldFontPath = XGetFontPath(dmxScreen->beDisplay, &nOldPaths);
-
- /* Set the font path for the font about to be loaded on the back-end */
- if (dmxSetFontPath(dmxScreen)) {
- char **fp;
- int npaths;
- Bool *goodfps;
-
- /* This could fail only when first starting the X server and
- * loading the default font. If it fails here, then the default
- * font path is invalid, no default font path will be set, the
- * DMX server will fail to load the default font, and it will
- * exit with an error unless we remove the offending font paths
- * with the -ignorebadfontpaths command line option.
- */
-
- fp = dmxGetFontPath(&npaths);
- if (!fp) {
- dmxLog(dmxError,
- "No default font path set.\n");
- dmxLog(dmxError,
- "Please see the Xdmx man page for information on how to\n");
- dmxLog(dmxError,
- "initialize the DMX server's default font path.\n");
- XFreeFontPath(oldFontPath);
- return FALSE;
- }
-
- if (!dmxFontPath)
- dmxLog(dmxWarning, "No default font path is set.\n");
-
- goodfps = malloc(npaths * sizeof(*goodfps));
-
- dmxLog(dmxError,
- "The DMX server failed to set the following font paths on "
- "screen #%d:\n", pScreen->myNum);
-
- for (i = 0; i < npaths; i++)
- if (!(goodfps[i] = dmxCheckFontPathElement(dmxScreen, fp[i])))
- dmxLog(dmxError, " %s\n", fp[i]);
-
- if (dmxIgnoreBadFontPaths) {
- char *newfp;
- int newnpaths = 0;
- int len = 0;
- int j = 0;
-
- dmxLog(dmxError,
- "These font paths will not be used because the "
- "\"-ignorebadfontpaths\"\n");
- dmxLog(dmxError,
- "option is set.\n");
-
- for (i = 0; i < npaths; i++)
- if (goodfps[i]) {
- len += strlen(fp[i]) + 1;
- newnpaths++;
- }
-
- if (!newnpaths) {
- /* No valid font paths were found */
- dmxLog(dmxError,
- "After removing the font paths above, no valid font "
- "paths were\n");
- dmxLog(dmxError,
- "available. Please check that the font paths set on "
- "the command\n");
- dmxLog(dmxError,
- "line or in the configuration file via the "
- "\"-fontpath\" option\n");
- dmxLog(dmxError,
- "are valid on all back-end servers. See the Xdmx man "
- "page for\n");
- dmxLog(dmxError,
- "more information on font paths.\n");
- dmxFreeFontPath(fp);
- XFreeFontPath(oldFontPath);
- free(goodfps);
- return FALSE;
- }
-
- newfp = malloc(len * sizeof(*newfp));
- for (i = 0; i < npaths; i++) {
- if (goodfps[i]) {
- int n = strlen(fp[i]);
- newfp[j++] = n;
- strncpy(&newfp[j], fp[i], n);
- j += n;
- }
- }
-
- if (SetFontPath(serverClient, newnpaths, (unsigned char *)newfp)) {
- /* Note that this should never happen since all of the
- * FPEs were previously valid. */
- dmxLog(dmxError, "Cannot reset the default font path.\n");
- }
- } else if (dmxFontPath) {
- dmxLog(dmxError,
- "Please remove these font paths from the command line "
- "or\n");
- dmxLog(dmxError,
- "configuration file, or set the \"-ignorebadfontpaths\" "
- "option to\n");
- dmxLog(dmxError,
- "ignore them. For more information on these options, see "
- "the\n");
- dmxLog(dmxError,
- "Xdmx man page.\n");
- } else {
- dmxLog(dmxError,
- "Please specify the font paths that are available on all "
- "back-end\n");
- dmxLog(dmxError,
- "servers with the \"-fontpath\" option, or use the "
- "\"-ignorebadfontpaths\"\n");
- dmxLog(dmxError,
- "to ignore bad defaults. For more information on "
- "these and other\n");
- dmxLog(dmxError,
- "font-path-related options, see the Xdmx man page.\n");
- }
-
- if (!dmxIgnoreBadFontPaths ||
- (dmxIgnoreBadFontPaths && dmxSetFontPath(dmxScreen))) {
- /* We still have errors so return with error */
- dmxFreeFontPath(fp);
- XFreeFontPath(oldFontPath);
- free(goodfps);
- return FALSE;
- }
- }
-
- /* Find requested font on back-end server */
- name_atom = MakeAtom("FONT", 4, TRUE);
- value_atom = 0L;
-
- for (i = 0; i < pFont->info.nprops; i++) {
- if ((Atom)pFont->info.props[i].name == name_atom) {
- value_atom = pFont->info.props[i].value;
- break;
- }
- }
- if (!value_atom) return FALSE;
-
- name = NameForAtom(value_atom);
- if (!name) return FALSE;
-
- pFontPriv->font[pScreen->myNum] =
- XLoadQueryFont(dmxScreen->beDisplay, name);
-
- /* Restore old font path */
- XSetFontPath(dmxScreen->beDisplay, oldFontPath, nOldPaths);
- XFreeFontPath(oldFontPath);
- dmxSync(dmxScreen, FALSE);
-
- if (!pFontPriv->font[pScreen->myNum]) return FALSE;
-
- return TRUE;
-}
-
-/** Realize the font, \a pFont, on the back-end server associated with
- * \a pScreen. */
-Bool dmxRealizeFont(ScreenPtr pScreen, FontPtr pFont)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxFontPrivPtr pFontPriv;
-
- if (!(pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex))) {
- FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
- pFontPriv = malloc(sizeof(dmxFontPrivRec));
- if (!pFontPriv) return FALSE;
- pFontPriv->font = NULL;
- MAXSCREENSALLOC(pFontPriv->font);
- if (!pFontPriv->font) {
- free(pFontPriv);
- return FALSE;
- }
- pFontPriv->refcnt = 0;
- }
-
- FontSetPrivate(pFont, dmxFontPrivateIndex, (pointer)pFontPriv);
-
- if (dmxScreen->beDisplay) {
- if (!dmxBELoadFont(pScreen, pFont))
- return FALSE;
-
- pFontPriv->refcnt++;
- } else {
- pFontPriv->font[pScreen->myNum] = NULL;
- }
-
- return TRUE;
-}
-
-/** Free \a pFont on the back-end associated with \a pScreen. */
-Bool dmxBEFreeFont(ScreenPtr pScreen, FontPtr pFont)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxFontPrivPtr pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex);
-
- if (pFontPriv && pFontPriv->font[pScreen->myNum]) {
- XFreeFont(dmxScreen->beDisplay, pFontPriv->font[pScreen->myNum]);
- pFontPriv->font[pScreen->myNum] = NULL;
- return TRUE;
- }
-
- return FALSE;
-}
-
-/** Unrealize the font, \a pFont, on the back-end server associated with
- * \a pScreen. */
-Bool dmxUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxFontPrivPtr pFontPriv;
-
- if ((pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex))) {
- /* In case the font failed to load properly */
- if (!pFontPriv->refcnt) {
- MAXSCREENSFREE(pFontPriv->font);
- free(pFontPriv);
- FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
- } else if (pFontPriv->font[pScreen->myNum]) {
- if (dmxScreen->beDisplay)
- dmxBEFreeFont(pScreen, pFont);
-
- /* The code below is non-obvious, so here's an explanation...
- *
- * When creating the default GC, the server opens up the
- * default font once for each screen, which in turn calls
- * the RealizeFont function pointer once for each screen.
- * During this process both dix's font refcnt and DMX's font
- * refcnt are incremented once for each screen.
- *
- * Later, when shutting down the X server, dix shuts down
- * each screen in reverse order. During this shutdown
- * procedure, each screen's default GC is freed and then
- * that screen is closed by calling the CloseScreen function
- * pointer. screenInfo.numScreens is then decremented after
- * closing each screen. This procedure means that the dix's
- * font refcnt for the font used by the default GC's is
- * decremented once for each screen # greater than 0.
- * However, since dix's refcnt for the default font is not
- * yet 0 for each screen greater than 0, no call to the
- * UnrealizeFont function pointer is made for those screens.
- * Then, when screen 0 is being closed, dix's font refcnt
- * for the default GC's font is finally 0 and the font is
- * unrealized. However, since screenInfo.numScreens has
- * been decremented already down to 1, only one call to
- * UnrealizeFont is made (for screen 0). Thus, even though
- * RealizeFont was called once for each screen,
- * UnrealizeFont is only called for screen 0.
- *
- * This is a bug in dix.
- *
- * To avoid the memory leak of pFontPriv for each server
- * generation, we can also free pFontPriv if the refcnt is
- * not yet 0 but the # of screens is 1 -- i.e., the case
- * described in the dix bug above. This is only a temporary
- * workaround until the bug in dix is solved.
- *
- * The other problem is that the font structure allocated by
- * XLoadQueryFont() above is not freed for screens > 0.
- * This problem cannot be worked around here since the back-
- * end displays for screens > 0 have already been closed by
- * the time this code is called from dix.
- *
- * When the bug in dix described above is fixed, then we can
- * remove the "|| screenInfo.numScreens == 1" code below and
- * the memory leaks will be eliminated.
- */
- if (--pFontPriv->refcnt == 0
-#if 1
- /* Remove this code when the dix bug is fixed */
- || screenInfo.numScreens == 1
-#endif
- ) {
- MAXSCREENSFREE(pFontPriv->font);
- free(pFontPriv);
- FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
- }
- }
- }
-
- return TRUE;
-}
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * This file provides support for fonts. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_FONTPATH_DEBUG 0
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxfont.h"
+#include "dmxlog.h"
+
+#include <X11/fonts/fontstruct.h>
+#include "dixfont.h"
+#include "dixstruct.h"
+
+static int (*dmxSaveProcVector[256]) (ClientPtr);
+static int dmxFontLastError;
+
+static int
+dmxFontErrorHandler(Display * dpy, XErrorEvent * ev)
+{
+ dmxFontLastError = ev->error_code;
+
+ return 0;
+}
+
+static char **
+dmxGetFontPath(int *npaths)
+{
+ char **fp;
+ unsigned char *c, *paths;
+ char *newfp;
+ int len, l, i;
+
+ GetFontPath(serverClient, npaths, &len, &paths);
+
+ newfp = malloc(*npaths + len);
+ c = (unsigned char *) newfp;
+ fp = malloc(*npaths * sizeof(*fp));
+
+ memmove(newfp, paths + 1, *npaths + len - 1);
+ l = *paths;
+ for (i = 0; i < *npaths; i++) {
+ fp[i] = (char *) c;
+ c += l;
+ l = *c;
+ *c++ = '\0';
+ }
+
+#if DMX_FONTPATH_DEBUG
+ for (i = 0; i < *npaths; i++)
+ dmxLog(dmxDebug, "FontPath[%d] = %s\n", i, fp[i]);
+#endif
+
+ return fp;
+}
+
+static void
+dmxFreeFontPath(char **fp)
+{
+ free(fp[0]);
+ free(fp);
+}
+
+static Bool
+dmxCheckFontPathElement(DMXScreenInfo * dmxScreen, char *fp)
+{
+ int (*oldErrorHandler) (Display *, XErrorEvent *);
+
+ if (!dmxScreen->beDisplay)
+ return TRUE;
+
+ dmxFontLastError = 0;
+ oldErrorHandler = XSetErrorHandler(dmxFontErrorHandler);
+ XSetFontPath(dmxScreen->beDisplay, &fp, 1);
+ dmxSync(dmxScreen, TRUE); /* Must complete before removing handler */
+ XSetErrorHandler(oldErrorHandler);
+
+ return dmxFontLastError == 0;
+}
+
+static int
+dmxSetFontPath(DMXScreenInfo * dmxScreen)
+{
+ int (*oldErrorHandler) (Display *, XErrorEvent *);
+ char **fp;
+ int result = Success;
+ int npaths;
+
+ if (!dmxScreen->beDisplay)
+ return result;
+
+ fp = dmxGetFontPath(&npaths);
+ if (!fp)
+ return BadAlloc;
+
+ dmxFontLastError = 0;
+ oldErrorHandler = XSetErrorHandler(dmxFontErrorHandler);
+ XSetFontPath(dmxScreen->beDisplay, fp, npaths);
+ dmxSync(dmxScreen, TRUE); /* Must complete before removing handler */
+ XSetErrorHandler(oldErrorHandler);
+
+ if (dmxFontLastError) {
+ result = dmxFontLastError;
+ /* We could set *error here to the offending path, but it is
+ * ignored, so we don't bother figuring out which path is bad.
+ * If we do add this support in the future, we'll need to add
+ * error to the function's argument list.
+ */
+ }
+
+ dmxFreeFontPath(fp);
+
+ return result;
+}
+
+static int
+dmxCheckFontPath(DMXScreenInfo * dmxScreen, int *error)
+{
+ char **oldFontPath;
+ int nOldPaths;
+ int result = Success;
+
+ if (!dmxScreen->beDisplay)
+ return result;
+
+ /* Save old font path */
+ oldFontPath = XGetFontPath(dmxScreen->beDisplay, &nOldPaths);
+
+ result = dmxSetFontPath(dmxScreen);
+
+ /* Restore old font path */
+ XSetFontPath(dmxScreen->beDisplay, oldFontPath, nOldPaths);
+ XFreeFontPath(oldFontPath);
+ dmxSync(dmxScreen, FALSE);
+
+ return result;
+}
+
+static int
+dmxProcSetFontPath(ClientPtr client)
+{
+ unsigned char *ptr;
+ unsigned long nbytes, total, n;
+ long nfonts;
+ int i, result;
+ unsigned char *oldFontPath, *tmpFontPath;
+ int nOldPaths;
+ int lenOldPaths;
+
+ REQUEST(xSetFontPathReq);
+
+ REQUEST_AT_LEAST_SIZE(xSetFontPathReq);
+
+ nbytes = (client->req_len << 2) - sizeof(xSetFontPathReq);
+ total = nbytes;
+ ptr = (unsigned char *) &stuff[1];
+ nfonts = stuff->nFonts;
+
+ while (--nfonts >= 0) {
+ if ((total == 0) || (total < (n = (*ptr + 1))))
+ return BadLength;
+ total -= n;
+ ptr += n;
+ }
+ if (total >= 4)
+ return BadLength;
+
+ GetFontPath(serverClient, &nOldPaths, &lenOldPaths, &tmpFontPath);
+ oldFontPath = malloc(nOldPaths + lenOldPaths);
+ memmove(oldFontPath, tmpFontPath, nOldPaths + lenOldPaths);
+
+ result = SetFontPath(client, stuff->nFonts, (unsigned char *) &stuff[1]);
+ if (!result) {
+ int error = 0;
+
+ for (i = 0; i < dmxNumScreens; i++)
+ if ((result = dmxCheckFontPath(&dmxScreens[i], &error)))
+ break;
+
+ if (result) {
+ /* Restore old fontpath in the DMX server */
+ SetFontPath(client, nOldPaths, oldFontPath);
+ client->errorValue = error;
+ }
+ }
+
+ free(oldFontPath);
+ return result;
+}
+
+/** Initialize font support. In addition to the screen function call
+ * pointers, DMX also hooks in at the ProcVector[] level. Here the old
+ * ProcVector function pointers are saved and the new ProcVector
+ * function pointers are initialized. */
+void
+dmxInitFonts(void)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ dmxSaveProcVector[i] = ProcVector[i];
+
+ ProcVector[X_SetFontPath] = dmxProcSetFontPath;
+}
+
+/** Reset font support by restoring the original ProcVector function
+ * pointers. */
+void
+dmxResetFonts(void)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ ProcVector[i] = dmxSaveProcVector[i];
+}
+
+/** Load the font, \a pFont, on the back-end server associated with \a
+ * pScreen. When a font is loaded, the font path on back-end server is
+ * first initialized to that specified on the command line with the
+ * -fontpath options, and then the font is loaded. */
+Bool
+dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxFontPrivPtr pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex);
+ const char *name;
+ char **oldFontPath = NULL;
+ int nOldPaths;
+ Atom name_atom, value_atom;
+ int i;
+
+ /* Make sure we have a font private struct to work with */
+ if (!pFontPriv)
+ return FALSE;
+
+ /* Don't load a font over top of itself */
+ if (pFontPriv->font[pScreen->myNum]) {
+ return TRUE; /* Already loaded font */
+ }
+
+ /* Save old font path */
+ oldFontPath = XGetFontPath(dmxScreen->beDisplay, &nOldPaths);
+
+ /* Set the font path for the font about to be loaded on the back-end */
+ if (dmxSetFontPath(dmxScreen)) {
+ char **fp;
+ int npaths;
+ Bool *goodfps;
+
+ /* This could fail only when first starting the X server and
+ * loading the default font. If it fails here, then the default
+ * font path is invalid, no default font path will be set, the
+ * DMX server will fail to load the default font, and it will
+ * exit with an error unless we remove the offending font paths
+ * with the -ignorebadfontpaths command line option.
+ */
+
+ fp = dmxGetFontPath(&npaths);
+ if (!fp) {
+ dmxLog(dmxError, "No default font path set.\n");
+ dmxLog(dmxError,
+ "Please see the Xdmx man page for information on how to\n");
+ dmxLog(dmxError,
+ "initialize the DMX server's default font path.\n");
+ XFreeFontPath(oldFontPath);
+ return FALSE;
+ }
+
+ if (!dmxFontPath)
+ dmxLog(dmxWarning, "No default font path is set.\n");
+
+ goodfps = malloc(npaths * sizeof(*goodfps));
+
+ dmxLog(dmxError,
+ "The DMX server failed to set the following font paths on "
+ "screen #%d:\n", pScreen->myNum);
+
+ for (i = 0; i < npaths; i++)
+ if (!(goodfps[i] = dmxCheckFontPathElement(dmxScreen, fp[i])))
+ dmxLog(dmxError, " %s\n", fp[i]);
+
+ if (dmxIgnoreBadFontPaths) {
+ char *newfp;
+ int newnpaths = 0;
+ int len = 0;
+ int j = 0;
+
+ dmxLog(dmxError,
+ "These font paths will not be used because the "
+ "\"-ignorebadfontpaths\"\n");
+ dmxLog(dmxError, "option is set.\n");
+
+ for (i = 0; i < npaths; i++)
+ if (goodfps[i]) {
+ len += strlen(fp[i]) + 1;
+ newnpaths++;
+ }
+
+ if (!newnpaths) {
+ /* No valid font paths were found */
+ dmxLog(dmxError,
+ "After removing the font paths above, no valid font "
+ "paths were\n");
+ dmxLog(dmxError,
+ "available. Please check that the font paths set on "
+ "the command\n");
+ dmxLog(dmxError,
+ "line or in the configuration file via the "
+ "\"-fontpath\" option\n");
+ dmxLog(dmxError,
+ "are valid on all back-end servers. See the Xdmx man "
+ "page for\n");
+ dmxLog(dmxError, "more information on font paths.\n");
+ dmxFreeFontPath(fp);
+ XFreeFontPath(oldFontPath);
+ free(goodfps);
+ return FALSE;
+ }
+
+ newfp = malloc(len * sizeof(*newfp));
+ for (i = 0; i < npaths; i++) {
+ if (goodfps[i]) {
+ int n = strlen(fp[i]);
+
+ newfp[j++] = n;
+ strncpy(&newfp[j], fp[i], n);
+ j += n;
+ }
+ }
+
+ if (SetFontPath(serverClient, newnpaths, (unsigned char *) newfp)) {
+ /* Note that this should never happen since all of the
+ * FPEs were previously valid. */
+ dmxLog(dmxError, "Cannot reset the default font path.\n");
+ }
+ }
+ else if (dmxFontPath) {
+ dmxLog(dmxError,
+ "Please remove these font paths from the command line "
+ "or\n");
+ dmxLog(dmxError,
+ "configuration file, or set the \"-ignorebadfontpaths\" "
+ "option to\n");
+ dmxLog(dmxError,
+ "ignore them. For more information on these options, see "
+ "the\n");
+ dmxLog(dmxError, "Xdmx man page.\n");
+ }
+ else {
+ dmxLog(dmxError,
+ "Please specify the font paths that are available on all "
+ "back-end\n");
+ dmxLog(dmxError,
+ "servers with the \"-fontpath\" option, or use the "
+ "\"-ignorebadfontpaths\"\n");
+ dmxLog(dmxError,
+ "to ignore bad defaults. For more information on "
+ "these and other\n");
+ dmxLog(dmxError,
+ "font-path-related options, see the Xdmx man page.\n");
+ }
+
+ if (!dmxIgnoreBadFontPaths ||
+ (dmxIgnoreBadFontPaths && dmxSetFontPath(dmxScreen))) {
+ /* We still have errors so return with error */
+ dmxFreeFontPath(fp);
+ XFreeFontPath(oldFontPath);
+ free(goodfps);
+ return FALSE;
+ }
+ }
+
+ /* Find requested font on back-end server */
+ name_atom = MakeAtom("FONT", 4, TRUE);
+ value_atom = 0L;
+
+ for (i = 0; i < pFont->info.nprops; i++) {
+ if ((Atom) pFont->info.props[i].name == name_atom) {
+ value_atom = pFont->info.props[i].value;
+ break;
+ }
+ }
+ if (!value_atom)
+ return FALSE;
+
+ name = NameForAtom(value_atom);
+ if (!name)
+ return FALSE;
+
+ pFontPriv->font[pScreen->myNum] =
+ XLoadQueryFont(dmxScreen->beDisplay, name);
+
+ /* Restore old font path */
+ XSetFontPath(dmxScreen->beDisplay, oldFontPath, nOldPaths);
+ XFreeFontPath(oldFontPath);
+ dmxSync(dmxScreen, FALSE);
+
+ if (!pFontPriv->font[pScreen->myNum])
+ return FALSE;
+
+ return TRUE;
+}
+
+/** Realize the font, \a pFont, on the back-end server associated with
+ * \a pScreen. */
+Bool
+dmxRealizeFont(ScreenPtr pScreen, FontPtr pFont)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxFontPrivPtr pFontPriv;
+
+ if (!(pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex))) {
+ FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
+ pFontPriv = malloc(sizeof(dmxFontPrivRec));
+ if (!pFontPriv)
+ return FALSE;
+ pFontPriv->font = NULL;
+ MAXSCREENSALLOC(pFontPriv->font);
+ if (!pFontPriv->font) {
+ free(pFontPriv);
+ return FALSE;
+ }
+ pFontPriv->refcnt = 0;
+ }
+
+ FontSetPrivate(pFont, dmxFontPrivateIndex, (pointer) pFontPriv);
+
+ if (dmxScreen->beDisplay) {
+ if (!dmxBELoadFont(pScreen, pFont))
+ return FALSE;
+
+ pFontPriv->refcnt++;
+ }
+ else {
+ pFontPriv->font[pScreen->myNum] = NULL;
+ }
+
+ return TRUE;
+}
+
+/** Free \a pFont on the back-end associated with \a pScreen. */
+Bool
+dmxBEFreeFont(ScreenPtr pScreen, FontPtr pFont)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxFontPrivPtr pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex);
+
+ if (pFontPriv && pFontPriv->font[pScreen->myNum]) {
+ XFreeFont(dmxScreen->beDisplay, pFontPriv->font[pScreen->myNum]);
+ pFontPriv->font[pScreen->myNum] = NULL;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/** Unrealize the font, \a pFont, on the back-end server associated with
+ * \a pScreen. */
+Bool
+dmxUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxFontPrivPtr pFontPriv;
+
+ if ((pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex))) {
+ /* In case the font failed to load properly */
+ if (!pFontPriv->refcnt) {
+ MAXSCREENSFREE(pFontPriv->font);
+ free(pFontPriv);
+ FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
+ }
+ else if (pFontPriv->font[pScreen->myNum]) {
+ if (dmxScreen->beDisplay)
+ dmxBEFreeFont(pScreen, pFont);
+
+ /* The code below is non-obvious, so here's an explanation...
+ *
+ * When creating the default GC, the server opens up the
+ * default font once for each screen, which in turn calls
+ * the RealizeFont function pointer once for each screen.
+ * During this process both dix's font refcnt and DMX's font
+ * refcnt are incremented once for each screen.
+ *
+ * Later, when shutting down the X server, dix shuts down
+ * each screen in reverse order. During this shutdown
+ * procedure, each screen's default GC is freed and then
+ * that screen is closed by calling the CloseScreen function
+ * pointer. screenInfo.numScreens is then decremented after
+ * closing each screen. This procedure means that the dix's
+ * font refcnt for the font used by the default GC's is
+ * decremented once for each screen # greater than 0.
+ * However, since dix's refcnt for the default font is not
+ * yet 0 for each screen greater than 0, no call to the
+ * UnrealizeFont function pointer is made for those screens.
+ * Then, when screen 0 is being closed, dix's font refcnt
+ * for the default GC's font is finally 0 and the font is
+ * unrealized. However, since screenInfo.numScreens has
+ * been decremented already down to 1, only one call to
+ * UnrealizeFont is made (for screen 0). Thus, even though
+ * RealizeFont was called once for each screen,
+ * UnrealizeFont is only called for screen 0.
+ *
+ * This is a bug in dix.
+ *
+ * To avoid the memory leak of pFontPriv for each server
+ * generation, we can also free pFontPriv if the refcnt is
+ * not yet 0 but the # of screens is 1 -- i.e., the case
+ * described in the dix bug above. This is only a temporary
+ * workaround until the bug in dix is solved.
+ *
+ * The other problem is that the font structure allocated by
+ * XLoadQueryFont() above is not freed for screens > 0.
+ * This problem cannot be worked around here since the back-
+ * end displays for screens > 0 have already been closed by
+ * the time this code is called from dix.
+ *
+ * When the bug in dix described above is fixed, then we can
+ * remove the "|| screenInfo.numScreens == 1" code below and
+ * the memory leaks will be eliminated.
+ */
+ if (--pFontPriv->refcnt == 0
+#if 1
+ /* Remove this code when the dix bug is fixed */
+ || screenInfo.numScreens == 1
+#endif
+ ) {
+ MAXSCREENSFREE(pFontPriv->font);
+ free(pFontPriv);
+ FontSetPrivate(pFont, dmxFontPrivateIndex, NULL);
+ }
+ }
+ }
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/dmx/dmxgc.c b/xorg-server/hw/dmx/dmxgc.c
index f10f9a074..703aeb336 100644
--- a/xorg-server/hw/dmx/dmxgc.c
+++ b/xorg-server/hw/dmx/dmxgc.c
@@ -83,65 +83,70 @@ static GCOps dmxGCOps = {
};
/** Initialize the GC on \a pScreen */
-Bool dmxInitGC(ScreenPtr pScreen)
+Bool
+dmxInitGC(ScreenPtr pScreen)
{
- if (!dixRegisterPrivateKey(&dmxGCPrivateKeyRec, PRIVATE_GC, sizeof(dmxGCPrivRec)))
- return FALSE;
+ if (!dixRegisterPrivateKey
+ (&dmxGCPrivateKeyRec, PRIVATE_GC, sizeof(dmxGCPrivRec)))
+ return FALSE;
return TRUE;
}
/** Create the GC on the back-end server. */
-void dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC)
+void
+dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- int i;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ int i;
for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
- if (pGC->depth == dmxScreen->bePixmapFormats[i].depth) {
- unsigned long mask;
- XGCValues gcvals;
-
- mask = GCGraphicsExposures;
- gcvals.graphics_exposures = FALSE;
-
- /* Create GC in the back-end servers */
- pGCPriv->gc = XCreateGC(dmxScreen->beDisplay,
- dmxScreen->scrnDefDrawables[i],
- mask, &gcvals);
- break;
- }
+ if (pGC->depth == dmxScreen->bePixmapFormats[i].depth) {
+ unsigned long mask;
+ XGCValues gcvals;
+
+ mask = GCGraphicsExposures;
+ gcvals.graphics_exposures = FALSE;
+
+ /* Create GC in the back-end servers */
+ pGCPriv->gc = XCreateGC(dmxScreen->beDisplay,
+ dmxScreen->scrnDefDrawables[i],
+ mask, &gcvals);
+ break;
+ }
}
}
/** Create a graphics context on the back-end server associated /a pGC's
* screen. */
-Bool dmxCreateGC(GCPtr pGC)
+Bool
+dmxCreateGC(GCPtr pGC)
{
- ScreenPtr pScreen = pGC->pScreen;
+ ScreenPtr pScreen = pGC->pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Bool ret;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Bool ret;
DMX_UNWRAP(CreateGC, dmxScreen, pScreen);
if ((ret = pScreen->CreateGC(pGC))) {
- /* Save the old funcs */
- pGCPriv->funcs = pGC->funcs;
- pGCPriv->ops = NULL;
-
- pGC->funcs = &dmxGCFuncs;
-
- if (dmxScreen->beDisplay) {
- dmxBECreateGC(pScreen, pGC);
- } else {
- pGCPriv->gc = NULL;
- }
-
- /* Check for "magic special case"
- * 1. see CreateGC in dix/gc.c for more info
- * 2. see dmxChangeGC for more info
- */
- pGCPriv->msc = (!pGC->tileIsPixel && !pGC->tile.pixmap);
+ /* Save the old funcs */
+ pGCPriv->funcs = pGC->funcs;
+ pGCPriv->ops = NULL;
+
+ pGC->funcs = &dmxGCFuncs;
+
+ if (dmxScreen->beDisplay) {
+ dmxBECreateGC(pScreen, pGC);
+ }
+ else {
+ pGCPriv->gc = NULL;
+ }
+
+ /* Check for "magic special case"
+ * 1. see CreateGC in dix/gc.c for more info
+ * 2. see dmxChangeGC for more info
+ */
+ pGCPriv->msc = (!pGC->tileIsPixel && !pGC->tile.pixmap);
}
DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen);
@@ -150,7 +155,8 @@ Bool dmxCreateGC(GCPtr pGC)
/** Validate a graphics context, \a pGC, locally in the DMX server and
* recompute the composite clip, if necessary. */
-void dmxValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
+void
+dmxValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
{
dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
@@ -160,13 +166,14 @@ void dmxValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
#endif
if (pDrawable->type == DRAWABLE_WINDOW ||
- pDrawable->type == DRAWABLE_PIXMAP) {
- /* Save the old ops, since we're about to change the ops in the
- * epilogue.
- */
- pGCPriv->ops = pGC->ops;
- } else {
- pGCPriv->ops = NULL;
+ pDrawable->type == DRAWABLE_PIXMAP) {
+ /* Save the old ops, since we're about to change the ops in the
+ * epilogue.
+ */
+ pGCPriv->ops = pGC->ops;
+ }
+ else {
+ pGCPriv->ops = NULL;
}
/* If the client clip is different or moved OR the subwindowMode has
@@ -174,12 +181,12 @@ void dmxValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
* validation, then we need to recompute the composite clip.
*/
if ((changes & (GCClipXOrigin |
- GCClipYOrigin |
- GCClipMask |
- GCSubwindowMode)) ||
- (pDrawable->serialNumber !=
- (pGC->serialNumber & DRAWABLE_SERIAL_BITS))) {
- miComputeCompositeClip(pGC, pDrawable);
+ GCClipYOrigin |
+ GCClipMask |
+ GCSubwindowMode)) ||
+ (pDrawable->serialNumber !=
+ (pGC->serialNumber & DRAWABLE_SERIAL_BITS))) {
+ miComputeCompositeClip(pGC, pDrawable);
}
DMX_GC_FUNC_EPILOGUE(pGC);
@@ -187,12 +194,13 @@ void dmxValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
/** Set the values in the graphics context on the back-end server
* associated with \a pGC's screen. */
-void dmxChangeGC(GCPtr pGC, unsigned long mask)
+void
+dmxChangeGC(GCPtr pGC, unsigned long mask)
{
- ScreenPtr pScreen = pGC->pScreen;
+ ScreenPtr pScreen = pGC->pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- XGCValues v;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ XGCValues v;
DMX_GC_FUNC_PROLOGUE(pGC);
#if 0
@@ -201,89 +209,113 @@ void dmxChangeGC(GCPtr pGC, unsigned long mask)
/* Handle "magic special case" from CreateGC */
if (pGCPriv->msc) {
- /* The "magic special case" is used to handle the case where a
- * foreground pixel is set when the GC is created so that a
- * "pseudo default-tile" can be created and used in case the
- * fillstyle was set to FillTiled. This specific case is tested
- * in xtest (XCreateGC test #3). What has happened in dix by
- * the time it reaches here is (1) the pGC->tile.pixel has been
- * set to pGC->fgPixel and pGC->tileIsPixel is set, (2) if a
- * tile has also been set, then pGC->tileIsPixel is unset and
- * pGC->tile.pixmap is initialized; else, the default tile is
- * created and pGC->tileIsPixel is unset and pGC->tile.pixmap is
- * initialized to the "pseudo default-tile". In either case,
- * pGC->tile.pixmap is set; however, in the "magic special case"
- * the mask is not updated to allow us to detect that we should
- * initialize the GCTile in the back-end server. Thus, we catch
- * this case in dmxCreateGC and add GCTile to the mask here.
- * Are there any cases that I've missed?
- */
-
- /* Make sure that the tile.pixmap is set, just in case the user
+ /* The "magic special case" is used to handle the case where a
+ * foreground pixel is set when the GC is created so that a
+ * "pseudo default-tile" can be created and used in case the
+ * fillstyle was set to FillTiled. This specific case is tested
+ * in xtest (XCreateGC test #3). What has happened in dix by
+ * the time it reaches here is (1) the pGC->tile.pixel has been
+ * set to pGC->fgPixel and pGC->tileIsPixel is set, (2) if a
+ * tile has also been set, then pGC->tileIsPixel is unset and
+ * pGC->tile.pixmap is initialized; else, the default tile is
+ * created and pGC->tileIsPixel is unset and pGC->tile.pixmap is
+ * initialized to the "pseudo default-tile". In either case,
+ * pGC->tile.pixmap is set; however, in the "magic special case"
+ * the mask is not updated to allow us to detect that we should
+ * initialize the GCTile in the back-end server. Thus, we catch
+ * this case in dmxCreateGC and add GCTile to the mask here.
+ * Are there any cases that I've missed?
+ */
+
+ /* Make sure that the tile.pixmap is set, just in case the user
* set GCTile in the mask but forgot to set vals.pixmap
- */
- if (pGC->tile.pixmap) mask |= GCTile;
+ */
+ if (pGC->tile.pixmap)
+ mask |= GCTile;
- /* This only happens once when the GC is created */
- pGCPriv->msc = FALSE;
+ /* This only happens once when the GC is created */
+ pGCPriv->msc = FALSE;
}
/* Update back-end server's gc */
- if (mask & GCFunction) v.function = pGC->alu;
- if (mask & GCPlaneMask) v.plane_mask = pGC->planemask;
- if (mask & GCForeground) v.foreground = pGC->fgPixel;
- if (mask & GCBackground) v.background = pGC->bgPixel;
- if (mask & GCLineWidth) v.line_width = pGC->lineWidth;
- if (mask & GCLineStyle) v.line_style = pGC->lineStyle;
- if (mask & GCCapStyle) v.cap_style = pGC->capStyle;
- if (mask & GCJoinStyle) v.join_style = pGC->joinStyle;
- if (mask & GCFillStyle) v.fill_style = pGC->fillStyle;
- if (mask & GCFillRule) v.fill_rule = pGC->fillRule;
+ if (mask & GCFunction)
+ v.function = pGC->alu;
+ if (mask & GCPlaneMask)
+ v.plane_mask = pGC->planemask;
+ if (mask & GCForeground)
+ v.foreground = pGC->fgPixel;
+ if (mask & GCBackground)
+ v.background = pGC->bgPixel;
+ if (mask & GCLineWidth)
+ v.line_width = pGC->lineWidth;
+ if (mask & GCLineStyle)
+ v.line_style = pGC->lineStyle;
+ if (mask & GCCapStyle)
+ v.cap_style = pGC->capStyle;
+ if (mask & GCJoinStyle)
+ v.join_style = pGC->joinStyle;
+ if (mask & GCFillStyle)
+ v.fill_style = pGC->fillStyle;
+ if (mask & GCFillRule)
+ v.fill_rule = pGC->fillRule;
if (mask & GCTile) {
- if (pGC->tileIsPixel) {
- mask &= ~GCTile;
- } else {
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->tile.pixmap);
- v.tile = (Drawable)pPixPriv->pixmap;
- }
+ if (pGC->tileIsPixel) {
+ mask &= ~GCTile;
+ }
+ else {
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->tile.pixmap);
+
+ v.tile = (Drawable) pPixPriv->pixmap;
+ }
}
if (mask & GCStipple) {
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->stipple);
- v.stipple = (Drawable)pPixPriv->pixmap;
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->stipple);
+
+ v.stipple = (Drawable) pPixPriv->pixmap;
}
- if (mask & GCTileStipXOrigin) v.ts_x_origin = pGC->patOrg.x;
- if (mask & GCTileStipYOrigin) v.ts_y_origin = pGC->patOrg.y;
+ if (mask & GCTileStipXOrigin)
+ v.ts_x_origin = pGC->patOrg.x;
+ if (mask & GCTileStipYOrigin)
+ v.ts_y_origin = pGC->patOrg.y;
if (mask & GCFont) {
- if (dmxScreen->beDisplay) {
- dmxFontPrivPtr pFontPriv;
- pFontPriv = FontGetPrivate(pGC->font, dmxFontPrivateIndex);
- v.font = pFontPriv->font[pScreen->myNum]->fid;
- } else {
- mask &= ~GCFont;
- }
+ if (dmxScreen->beDisplay) {
+ dmxFontPrivPtr pFontPriv;
+
+ pFontPriv = FontGetPrivate(pGC->font, dmxFontPrivateIndex);
+ v.font = pFontPriv->font[pScreen->myNum]->fid;
+ }
+ else {
+ mask &= ~GCFont;
+ }
}
- if (mask & GCSubwindowMode) v.subwindow_mode = pGC->subWindowMode;
+ if (mask & GCSubwindowMode)
+ v.subwindow_mode = pGC->subWindowMode;
/* Graphics exposures are not needed on the back-ends since they can
be generated on the front-end thereby saving bandwidth. */
- if (mask & GCGraphicsExposures) mask &= ~GCGraphicsExposures;
-
- if (mask & GCClipXOrigin) v.clip_x_origin = pGC->clipOrg.x;
- if (mask & GCClipYOrigin) v.clip_y_origin = pGC->clipOrg.y;
- if (mask & GCClipMask) mask &= ~GCClipMask; /* See ChangeClip */
- if (mask & GCDashOffset) v.dash_offset = pGC->dashOffset;
+ if (mask & GCGraphicsExposures)
+ mask &= ~GCGraphicsExposures;
+
+ if (mask & GCClipXOrigin)
+ v.clip_x_origin = pGC->clipOrg.x;
+ if (mask & GCClipYOrigin)
+ v.clip_y_origin = pGC->clipOrg.y;
+ if (mask & GCClipMask)
+ mask &= ~GCClipMask; /* See ChangeClip */
+ if (mask & GCDashOffset)
+ v.dash_offset = pGC->dashOffset;
if (mask & GCDashList) {
- mask &= ~GCDashList;
- if (dmxScreen->beDisplay)
- XSetDashes(dmxScreen->beDisplay, pGCPriv->gc,
- pGC->dashOffset, (char *)pGC->dash,
- pGC->numInDashList);
+ mask &= ~GCDashList;
+ if (dmxScreen->beDisplay)
+ XSetDashes(dmxScreen->beDisplay, pGCPriv->gc,
+ pGC->dashOffset, (char *) pGC->dash, pGC->numInDashList);
}
- if (mask & GCArcMode) v.arc_mode = pGC->arcMode;
+ if (mask & GCArcMode)
+ v.arc_mode = pGC->arcMode;
if (mask && dmxScreen->beDisplay) {
- XChangeGC(dmxScreen->beDisplay, pGCPriv->gc, mask, &v);
- dmxSync(dmxScreen, FALSE);
+ XChangeGC(dmxScreen->beDisplay, pGCPriv->gc, mask, &v);
+ dmxSync(dmxScreen, FALSE);
}
DMX_GC_FUNC_EPILOGUE(pGC);
@@ -291,34 +323,36 @@ void dmxChangeGC(GCPtr pGC, unsigned long mask)
/** Copy \a pGCSrc to \a pGCDst on the back-end server associated with
* \a pGCSrc's screen. */
-void dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst)
+void
+dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst)
{
- ScreenPtr pScreen = pGCSrc->pScreen;
+ ScreenPtr pScreen = pGCSrc->pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxGCPrivPtr pGCSrcPriv = DMX_GET_GC_PRIV(pGCSrc);
- dmxGCPrivPtr pGCDstPriv = DMX_GET_GC_PRIV(pGCDst);
+ dmxGCPrivPtr pGCSrcPriv = DMX_GET_GC_PRIV(pGCSrc);
+ dmxGCPrivPtr pGCDstPriv = DMX_GET_GC_PRIV(pGCDst);
DMX_GC_FUNC_PROLOGUE(pGCDst);
pGCDst->funcs->CopyGC(pGCSrc, changes, pGCDst);
/* Copy the GC on the back-end server */
if (dmxScreen->beDisplay)
- XCopyGC(dmxScreen->beDisplay, pGCSrcPriv->gc, changes, pGCDstPriv->gc);
+ XCopyGC(dmxScreen->beDisplay, pGCSrcPriv->gc, changes, pGCDstPriv->gc);
DMX_GC_FUNC_EPILOGUE(pGCDst);
}
/** Free the \a pGC on the back-end server. */
-Bool dmxBEFreeGC(GCPtr pGC)
+Bool
+dmxBEFreeGC(GCPtr pGC)
{
- ScreenPtr pScreen = pGC->pScreen;
+ ScreenPtr pScreen = pGC->pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
if (pGCPriv->gc) {
- XFreeGC(dmxScreen->beDisplay, pGCPriv->gc);
- pGCPriv->gc = NULL;
- return TRUE;
+ XFreeGC(dmxScreen->beDisplay, pGCPriv->gc);
+ pGCPriv->gc = NULL;
+ return TRUE;
}
return FALSE;
@@ -326,30 +360,32 @@ Bool dmxBEFreeGC(GCPtr pGC)
/** Destroy the graphics context, \a pGC and free the corresponding GC
* on the back-end server. */
-void dmxDestroyGC(GCPtr pGC)
+void
+dmxDestroyGC(GCPtr pGC)
{
- ScreenPtr pScreen = pGC->pScreen;
+ ScreenPtr pScreen = pGC->pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
DMX_GC_FUNC_PROLOGUE(pGC);
/* Free the GC on the back-end server */
if (dmxScreen->beDisplay)
- dmxBEFreeGC(pGC);
+ dmxBEFreeGC(pGC);
pGC->funcs->DestroyGC(pGC);
DMX_GC_FUNC_EPILOGUE(pGC);
}
/** Change the clip rects for a GC. */
-void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
+void
+dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
{
- ScreenPtr pScreen = pGC->pScreen;
+ ScreenPtr pScreen = pGC->pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- XRectangle *pRects;
- BoxPtr pBox;
- int i, nRects;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ XRectangle *pRects;
+ BoxPtr pBox;
+ int i, nRects;
DMX_GC_FUNC_PROLOGUE(pGC);
pGC->funcs->ChangeClip(pGC, type, pvalue, nrects);
@@ -357,58 +393,60 @@ void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
/* Set the client clip on the back-end server */
switch (pGC->clientClipType) {
case CT_NONE:
- if (dmxScreen->beDisplay)
- XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None);
- break;
+ if (dmxScreen->beDisplay)
+ XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None);
+ break;
case CT_REGION:
- if (dmxScreen->beDisplay) {
- nRects = RegionNumRects((RegionPtr)pGC->clientClip);
- pRects = malloc(nRects * sizeof(*pRects));
- pBox = RegionRects((RegionPtr)pGC->clientClip);
-
- for (i = 0; i < nRects; i++) {
- pRects[i].x = pBox[i].x1;
- pRects[i].y = pBox[i].y1;
- pRects[i].width = pBox[i].x2 - pBox[i].x1;
- pRects[i].height = pBox[i].y2 - pBox[i].y1;
- }
-
- XSetClipRectangles(dmxScreen->beDisplay, pGCPriv->gc,
- pGC->clipOrg.x, pGC->clipOrg.y,
- pRects, nRects, Unsorted);
-
- free(pRects);
- }
- break;
+ if (dmxScreen->beDisplay) {
+ nRects = RegionNumRects((RegionPtr) pGC->clientClip);
+ pRects = malloc(nRects * sizeof(*pRects));
+ pBox = RegionRects((RegionPtr) pGC->clientClip);
+
+ for (i = 0; i < nRects; i++) {
+ pRects[i].x = pBox[i].x1;
+ pRects[i].y = pBox[i].y1;
+ pRects[i].width = pBox[i].x2 - pBox[i].x1;
+ pRects[i].height = pBox[i].y2 - pBox[i].y1;
+ }
+
+ XSetClipRectangles(dmxScreen->beDisplay, pGCPriv->gc,
+ pGC->clipOrg.x, pGC->clipOrg.y,
+ pRects, nRects, Unsorted);
+
+ free(pRects);
+ }
+ break;
case CT_PIXMAP:
- /* Condensed down to REGION in the mi code */
- break;
+ /* Condensed down to REGION in the mi code */
+ break;
}
DMX_GC_FUNC_EPILOGUE(pGC);
}
/** Destroy a GC's clip rects. */
-void dmxDestroyClip(GCPtr pGC)
+void
+dmxDestroyClip(GCPtr pGC)
{
- ScreenPtr pScreen = pGC->pScreen;
+ ScreenPtr pScreen = pGC->pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
DMX_GC_FUNC_PROLOGUE(pGC);
pGC->funcs->DestroyClip(pGC);
/* Set the client clip on the back-end server to None */
if (dmxScreen->beDisplay)
- XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None);
+ XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None);
DMX_GC_FUNC_EPILOGUE(pGC);
}
/** Copy a GC's clip rects. */
-void dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
+void
+dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
{
DMX_GC_FUNC_PROLOGUE(pGCDst);
pGCDst->funcs->CopyClip(pGCDst, pGCSrc);
diff --git a/xorg-server/hw/dmx/dmxgcops.c b/xorg-server/hw/dmx/dmxgcops.c
index 500e2cdf1..19330668a 100644
--- a/xorg-server/hw/dmx/dmxgcops.c
+++ b/xorg-server/hw/dmx/dmxgcops.c
@@ -75,17 +75,17 @@ do { \
!DMX_GET_WINDOW_PRIV((WindowPtr)(_pDraw))->window)))
/** Fill spans -- this function should never be called. */
-void dmxFillSpans(DrawablePtr pDrawable, GCPtr pGC,
- int nInit, DDXPointPtr pptInit, int *pwidthInit,
- int fSorted)
+void
+dmxFillSpans(DrawablePtr pDrawable, GCPtr pGC,
+ int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted)
{
/* Error -- this should never happen! */
}
/** Set spans -- this function should never be called. */
-void dmxSetSpans(DrawablePtr pDrawable, GCPtr pGC,
- char *psrc, DDXPointPtr ppt, int *pwidth, int nspans,
- int fSorted)
+void
+dmxSetSpans(DrawablePtr pDrawable, GCPtr pGC,
+ char *psrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
{
/* Error -- this should never happen! */
}
@@ -94,73 +94,74 @@ void dmxSetSpans(DrawablePtr pDrawable, GCPtr pGC,
* pDrawable's screen. If primitive subdivision optimization is
* enabled, then only transfer the sections of \a pBits that are
* visible (i.e., not-clipped) to the back-end server. */
-void dmxPutImage(DrawablePtr pDrawable, GCPtr pGC,
- int depth, int x, int y, int w, int h,
- int leftPad, int format, char *pBits)
+void
+dmxPutImage(DrawablePtr pDrawable, GCPtr pGC,
+ int depth, int x, int y, int w, int h,
+ int leftPad, int format, char *pBits)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- XImage *img;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ XImage *img;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
img = XCreateImage(dmxScreen->beDisplay,
- dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
- depth, format, leftPad, pBits, w, h,
- BitmapPad(dmxScreen->beDisplay),
- (format == ZPixmap) ?
- PixmapBytePad(w, depth) : BitmapBytePad(w+leftPad));
+ dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
+ depth, format, leftPad, pBits, w, h,
+ BitmapPad(dmxScreen->beDisplay),
+ (format == ZPixmap) ?
+ PixmapBytePad(w, depth) : BitmapBytePad(w + leftPad));
if (img) {
- Drawable draw;
-
- DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
-
- if (dmxSubdividePrimitives && pGC->pCompositeClip) {
- RegionPtr pSubImages;
- RegionPtr pClip;
- BoxRec box;
- BoxPtr pBox;
- int nBox;
-
- box.x1 = x;
- box.y1 = y;
- box.x2 = x + w;
- box.y2 = y + h;
- pSubImages = RegionCreate(&box, 1);
-
- pClip = RegionCreate(NullBox, 1);
- RegionCopy(pClip, pGC->pCompositeClip);
- RegionTranslate(pClip,
- -pDrawable->x, -pDrawable->y);
- RegionIntersect(pSubImages, pSubImages, pClip);
-
- nBox = RegionNumRects(pSubImages);
- pBox = RegionRects(pSubImages);
-
- while (nBox--) {
- XPutImage(dmxScreen->beDisplay, draw, pGCPriv->gc, img,
- pBox->x1 - box.x1,
- pBox->y1 - box.y1,
- pBox->x1,
- pBox->y1,
- pBox->x2 - pBox->x1,
- pBox->y2 - pBox->y1);
- pBox++;
- }
+ Drawable draw;
+
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+
+ if (dmxSubdividePrimitives && pGC->pCompositeClip) {
+ RegionPtr pSubImages;
+ RegionPtr pClip;
+ BoxRec box;
+ BoxPtr pBox;
+ int nBox;
+
+ box.x1 = x;
+ box.y1 = y;
+ box.x2 = x + w;
+ box.y2 = y + h;
+ pSubImages = RegionCreate(&box, 1);
+
+ pClip = RegionCreate(NullBox, 1);
+ RegionCopy(pClip, pGC->pCompositeClip);
+ RegionTranslate(pClip, -pDrawable->x, -pDrawable->y);
+ RegionIntersect(pSubImages, pSubImages, pClip);
+
+ nBox = RegionNumRects(pSubImages);
+ pBox = RegionRects(pSubImages);
+
+ while (nBox--) {
+ XPutImage(dmxScreen->beDisplay, draw, pGCPriv->gc, img,
+ pBox->x1 - box.x1,
+ pBox->y1 - box.y1,
+ pBox->x1,
+ pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1);
+ pBox++;
+ }
RegionDestroy(pClip);
RegionDestroy(pSubImages);
- } else {
- XPutImage(dmxScreen->beDisplay, draw, pGCPriv->gc,
- img, 0, 0, x, y, w, h);
- }
- XFree(img); /* Use XFree instead of XDestroyImage
+ }
+ else {
+ XPutImage(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ img, 0, 0, x, y, w, h);
+ }
+ XFree(img); /* Use XFree instead of XDestroyImage
* because pBits is passed in from the
* caller. */
- dmxSync(dmxScreen, FALSE);
- } else {
- /* Error -- this should not happen! */
+ dmxSync(dmxScreen, FALSE);
+ }
+ else {
+ /* Error -- this should not happen! */
}
}
@@ -168,72 +169,75 @@ void dmxPutImage(DrawablePtr pDrawable, GCPtr pGC,
* server associated with \a pSrc drawable's screen. If the offscreen
* optimization is enabled, only copy when both \a pSrc and \a pDst are
* at least partially visible. */
-RegionPtr dmxCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int w, int h, int dstx, int dsty)
+RegionPtr
+dmxCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int w, int h, int dstx, int dsty)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pSrc->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable srcDraw, dstDraw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable srcDraw, dstDraw;
if (DMX_GCOPS_OFFSCREEN(pSrc) || DMX_GCOPS_OFFSCREEN(pDst))
- return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, w, h,
- dstx, dsty, 0L);
+ return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, w, h,
+ dstx, dsty, 0L);
DMX_GCOPS_SET_DRAWABLE(pSrc, srcDraw);
DMX_GCOPS_SET_DRAWABLE(pDst, dstDraw);
XCopyArea(dmxScreen->beDisplay, srcDraw, dstDraw, pGCPriv->gc,
- srcx, srcy, w, h, dstx, dsty);
+ srcx, srcy, w, h, dstx, dsty);
dmxSync(dmxScreen, FALSE);
- return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, w, h,
- dstx, dsty, 0L);
+ return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, 0L);
}
/** Copy plane number \a bitPlane from \a pSrc drawable to \a pDst
* drawable on the back-end server associated with \a pSrc drawable's
* screen. If the offscreen optimization is enabled, only copy when
* both \a pSrc and \a pDst are at least partially visible. */
-RegionPtr dmxCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int width, int height,
- int dstx, int dsty, unsigned long bitPlane)
+RegionPtr
+dmxCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long bitPlane)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pSrc->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable srcDraw, dstDraw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable srcDraw, dstDraw;
if (DMX_GCOPS_OFFSCREEN(pSrc) || DMX_GCOPS_OFFSCREEN(pDst))
- return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, width, height,
- dstx, dsty, bitPlane);
+ return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, width, height,
+ dstx, dsty, bitPlane);
DMX_GCOPS_SET_DRAWABLE(pSrc, srcDraw);
DMX_GCOPS_SET_DRAWABLE(pDst, dstDraw);
XCopyPlane(dmxScreen->beDisplay, srcDraw, dstDraw, pGCPriv->gc,
- srcx, srcy, width, height, dstx, dsty, bitPlane);
+ srcx, srcy, width, height, dstx, dsty, bitPlane);
dmxSync(dmxScreen, FALSE);
return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, width, height,
- dstx, dsty, bitPlane);
+ dstx, dsty, bitPlane);
}
/** Render list of points, \a pptInit in \a pDrawable on the back-end
* server associated with \a pDrawable's screen. If the offscreen
* optimization is enabled, only draw when \a pDrawable is at least
* partially visible. */
-void dmxPolyPoint(DrawablePtr pDrawable, GCPtr pGC,
- int mode, int npt, DDXPointPtr pptInit)
+void
+dmxPolyPoint(DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pptInit)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
XDrawPoints(dmxScreen->beDisplay, draw, pGCPriv->gc,
- (XPoint *)pptInit, npt, mode);
+ (XPoint *) pptInit, npt, mode);
dmxSync(dmxScreen, FALSE);
}
@@ -241,19 +245,21 @@ void dmxPolyPoint(DrawablePtr pDrawable, GCPtr pGC,
* back-end server associated with \a pDrawable's screen. If the
* offscreen optimization is enabled, only draw when \a pDrawable is at
* least partially visible. */
-void dmxPolylines(DrawablePtr pDrawable, GCPtr pGC,
- int mode, int npt, DDXPointPtr pptInit)
+void
+dmxPolylines(DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pptInit)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
XDrawLines(dmxScreen->beDisplay, draw, pGCPriv->gc,
- (XPoint *)pptInit, npt, mode);
+ (XPoint *) pptInit, npt, mode);
dmxSync(dmxScreen, FALSE);
}
@@ -261,19 +267,20 @@ void dmxPolylines(DrawablePtr pDrawable, GCPtr pGC,
* back-end server associated with \a pDrawable's screen. If the
* offscreen optimization is enabled, only draw when \a pDrawable is at
* least partially visible. */
-void dmxPolySegment(DrawablePtr pDrawable, GCPtr pGC,
- int nseg, xSegment *pSegs)
+void
+dmxPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSegs)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
XDrawSegments(dmxScreen->beDisplay, draw, pGCPriv->gc,
- (XSegment *)pSegs, nseg);
+ (XSegment *) pSegs, nseg);
dmxSync(dmxScreen, FALSE);
}
@@ -281,19 +288,21 @@ void dmxPolySegment(DrawablePtr pDrawable, GCPtr pGC,
* back-end server associated with \a pDrawable's screen. If the
* offscreen optimization is enabled, only draw when \a pDrawable is at
* least partially visible. */
-void dmxPolyRectangle(DrawablePtr pDrawable, GCPtr pGC,
- int nrects, xRectangle *pRects)
+void
+dmxPolyRectangle(DrawablePtr pDrawable, GCPtr pGC,
+ int nrects, xRectangle *pRects)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
XDrawRectangles(dmxScreen->beDisplay, draw, pGCPriv->gc,
- (XRectangle *)pRects, nrects);
+ (XRectangle *) pRects, nrects);
dmxSync(dmxScreen, FALSE);
}
@@ -302,19 +311,19 @@ void dmxPolyRectangle(DrawablePtr pDrawable, GCPtr pGC,
* back-end server associated with \a pDrawable's screen. If the
* offscreen optimization is enabled, only draw when \a pDrawable is at
* least partially visible. */
-void dmxPolyArc(DrawablePtr pDrawable, GCPtr pGC,
- int narcs, xArc *parcs)
+void
+dmxPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
- XDrawArcs(dmxScreen->beDisplay, draw, pGCPriv->gc,
- (XArc *)parcs, narcs);
+ XDrawArcs(dmxScreen->beDisplay, draw, pGCPriv->gc, (XArc *) parcs, narcs);
dmxSync(dmxScreen, FALSE);
}
@@ -322,19 +331,21 @@ void dmxPolyArc(DrawablePtr pDrawable, GCPtr pGC,
* associated with \a pDrawable's screen. If the offscreen
* optimization is enabled, only draw when \a pDrawable is at least
* partially visible. */
-void dmxFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
- int shape, int mode, int count, DDXPointPtr pPts)
+void
+dmxFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count, DDXPointPtr pPts)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
XFillPolygon(dmxScreen->beDisplay, draw, pGCPriv->gc,
- (XPoint *)pPts, count, shape, mode);
+ (XPoint *) pPts, count, shape, mode);
dmxSync(dmxScreen, FALSE);
}
@@ -342,19 +353,21 @@ void dmxFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
* the back-end server associated with \a pDrawable's screen. If the
* offscreen optimization is enabled, only draw when \a pDrawable is at
* least partially visible. */
-void dmxPolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
- int nrectFill, xRectangle *prectInit)
+void
+dmxPolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
+ int nrectFill, xRectangle *prectInit)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
XFillRectangles(dmxScreen->beDisplay, draw, pGCPriv->gc,
- (XRectangle *)prectInit, nrectFill);
+ (XRectangle *) prectInit, nrectFill);
dmxSync(dmxScreen, FALSE);
}
@@ -362,19 +375,19 @@ void dmxPolyFillRect(DrawablePtr pDrawable, GCPtr pGC,
* server associated with \a pDrawable's screen. If the offscreen
* optimization is enabled, only draw when \a pDrawable is at least
* partially visible. */
-void dmxPolyFillArc(DrawablePtr pDrawable, GCPtr pGC,
- int narcs, xArc *parcs)
+void
+dmxPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
- XFillArcs(dmxScreen->beDisplay, draw, pGCPriv->gc,
- (XArc *)parcs, narcs);
+ XFillArcs(dmxScreen->beDisplay, draw, pGCPriv->gc, (XArc *) parcs, narcs);
dmxSync(dmxScreen, FALSE);
}
@@ -382,84 +395,90 @@ void dmxPolyFillArc(DrawablePtr pDrawable, GCPtr pGC,
* the back-end server associated with \a pDrawable's screen. If the
* offscreen optimization is enabled, only draw when \a pDrawable is at
* least partially visible. */
-int dmxPolyText8(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, int count, char *chars)
+int
+dmxPolyText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- unsigned long n, i;
- int w;
- CharInfoPtr charinfo[255];
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ unsigned long n, i;
+ int w;
+ CharInfoPtr charinfo[255];
+ Drawable draw;
- GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars,
- Linear8Bit, &n, charinfo);
+ GetGlyphs(pGC->font, (unsigned long) count, (unsigned char *) chars,
+ Linear8Bit, &n, charinfo);
/* Calculate text width */
w = 0;
- for (i = 0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
+ for (i = 0; i < n; i++)
+ w += charinfo[i]->metrics.characterWidth;
if (n != 0 && !DMX_GCOPS_OFFSCREEN(pDrawable)) {
- DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
- XDrawString(dmxScreen->beDisplay, draw, pGCPriv->gc,
- x, y, chars, count);
- dmxSync(dmxScreen, FALSE);
+ XDrawString(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ x, y, chars, count);
+ dmxSync(dmxScreen, FALSE);
}
- return x+w;
+ return x + w;
}
/** Render string of 16-bit \a chars (foreground only) in \a pDrawable
* on the back-end server associated with \a pDrawable's screen. If
* the offscreen optimization is enabled, only draw when \a pDrawable
* is at least partially visible. */
-int dmxPolyText16(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, int count, unsigned short *chars)
+int
+dmxPolyText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- unsigned long n, i;
- int w;
- CharInfoPtr charinfo[255];
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ unsigned long n, i;
+ int w;
+ CharInfoPtr charinfo[255];
+ Drawable draw;
- GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars,
- (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
- &n, charinfo);
+ GetGlyphs(pGC->font, (unsigned long) count, (unsigned char *) chars,
+ (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, charinfo);
/* Calculate text width */
w = 0;
- for (i = 0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
+ for (i = 0; i < n; i++)
+ w += charinfo[i]->metrics.characterWidth;
if (n != 0 && !DMX_GCOPS_OFFSCREEN(pDrawable)) {
- DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
- XDrawString16(dmxScreen->beDisplay, draw, pGCPriv->gc,
- x, y, (XChar2b *)chars, count);
- dmxSync(dmxScreen, FALSE);
+ XDrawString16(dmxScreen->beDisplay, draw, pGCPriv->gc,
+ x, y, (XChar2b *) chars, count);
+ dmxSync(dmxScreen, FALSE);
}
- return x+w;
+ return x + w;
}
/** Render string of 8-bit \a chars (both foreground and background) in
* \a pDrawable on the back-end server associated with \a pDrawable's
* screen. If the offscreen optimization is enabled, only draw when \a
* pDrawable is at least partially visible. */
-void dmxImageText8(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, int count, char *chars)
+void
+dmxImageText8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
XDrawImageString(dmxScreen->beDisplay, draw, pGCPriv->gc,
- x, y, chars, count);
+ x, y, chars, count);
dmxSync(dmxScreen, FALSE);
}
@@ -467,41 +486,46 @@ void dmxImageText8(DrawablePtr pDrawable, GCPtr pGC,
* \a pDrawable on the back-end server associated with \a pDrawable's
* screen. If the offscreen optimization is enabled, only draw when \a
* pDrawable is at least partially visible. */
-void dmxImageText16(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, int count, unsigned short *chars)
+void
+dmxImageText16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- Drawable draw;
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
+ Drawable draw;
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) return;
+ if (DMX_GCOPS_OFFSCREEN(pDrawable))
+ return;
DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
XDrawImageString16(dmxScreen->beDisplay, draw, pGCPriv->gc,
- x, y, (XChar2b *)chars, count);
+ x, y, (XChar2b *) chars, count);
dmxSync(dmxScreen, FALSE);
}
/** Image Glyph Blt -- this function should never be called. */
-void dmxImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase)
+void
+dmxImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
{
/* Error -- this should never happen! */
}
/** Poly Glyph Blt -- this function should never be called. */
-void dmxPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase)
+void
+dmxPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr * ppci, pointer pglyphBase)
{
/* Error -- this should never happen! */
}
/** Push Pixels -- this function should never be called. */
-void dmxPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
- int w, int h, int x, int y)
+void
+dmxPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
+ int w, int h, int x, int y)
{
/* Error -- this should never happen! */
}
@@ -514,29 +538,32 @@ void dmxPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
* screen 0. When screen 0 is detached, the pixmaps must be obtained
* from any other screen that is not detached. Usually, this is screen
* 1. */
-static DMXScreenInfo *dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw)
+static DMXScreenInfo *
+dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw)
{
#ifdef PANORAMIX
- PanoramiXRes *pXinPix;
- int i;
+ PanoramiXRes *pXinPix;
+ int i;
DMXScreenInfo *dmxScreen;
-
- if (noPanoramiXExtension) return NULL;
- if (pDrawable->type != DRAWABLE_PIXMAP) return NULL;
- if (Success != dixLookupResourceByType((pointer*) &pXinPix,
- pDrawable->id, XRT_PIXMAP,
- NullClient, DixUnknownAccess))
+ if (noPanoramiXExtension)
+ return NULL;
+ if (pDrawable->type != DRAWABLE_PIXMAP)
+ return NULL;
+
+ if (Success != dixLookupResourceByType((pointer *) &pXinPix,
+ pDrawable->id, XRT_PIXMAP,
+ NullClient, DixUnknownAccess))
return NULL;
FOR_NSCREENS_FORWARD_SKIP(i) {
dmxScreen = &dmxScreens[i];
if (dmxScreen->beDisplay) {
- PixmapPtr pSrc;
+ PixmapPtr pSrc;
dmxPixPrivPtr pSrcPriv;
-
- dixLookupResourceByType((pointer*) &pSrc, pXinPix->info[i].id,
- RT_PIXMAP, NullClient, DixUnknownAccess);
+
+ dixLookupResourceByType((pointer *) &pSrc, pXinPix->info[i].id,
+ RT_PIXMAP, NullClient, DixUnknownAccess);
pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
if (pSrcPriv->pixmap) {
*draw = pSrcPriv->pixmap;
@@ -553,53 +580,58 @@ static DMXScreenInfo *dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw)
* image from it. If it is not viewable, then get the image from the
* first ancestor of \a pDrawable that is viewable. If no viewable
* ancestor is found, then simply return without getting an image. */
-void dmxGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
- unsigned int format, unsigned long planeMask, char *pdstLine)
+void
+dmxGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
+ unsigned int format, unsigned long planeMask, char *pdstLine)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum];
- XImage *img;
- Drawable draw;
+ XImage *img;
+ Drawable draw;
/* Cannot get image from unviewable window */
if (pDrawable->type == DRAWABLE_WINDOW) {
- WindowPtr pWindow = (WindowPtr)pDrawable;
- if (!pWindow->viewable) {
- while (!pWindow->viewable && pWindow->parent) {
- sx += pWindow->origin.x - wBorderWidth(pWindow);
- sx += pWindow->origin.y - wBorderWidth(pWindow);
- pWindow = pWindow->parent;
- }
- if (!pWindow->viewable) {
- return;
- }
- }
- DMX_GCOPS_SET_DRAWABLE(&pWindow->drawable, draw);
- if (DMX_GCOPS_OFFSCREEN(&pWindow->drawable))
- return;
- } else {
- DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
- if (DMX_GCOPS_OFFSCREEN(pDrawable)) {
+ WindowPtr pWindow = (WindowPtr) pDrawable;
+
+ if (!pWindow->viewable) {
+ while (!pWindow->viewable && pWindow->parent) {
+ sx += pWindow->origin.x - wBorderWidth(pWindow);
+ sx += pWindow->origin.y - wBorderWidth(pWindow);
+ pWindow = pWindow->parent;
+ }
+ if (!pWindow->viewable) {
+ return;
+ }
+ }
+ DMX_GCOPS_SET_DRAWABLE(&pWindow->drawable, draw);
+ if (DMX_GCOPS_OFFSCREEN(&pWindow->drawable))
+ return;
+ }
+ else {
+ DMX_GCOPS_SET_DRAWABLE(pDrawable, draw);
+ if (DMX_GCOPS_OFFSCREEN(pDrawable)) {
/* Try to find the pixmap on a non-detached Xinerama screen */
dmxScreen = dmxFindAlternatePixmap(pDrawable, &draw);
- if (!dmxScreen) return;
+ if (!dmxScreen)
+ return;
}
}
img = XGetImage(dmxScreen->beDisplay, draw,
- sx, sy, w, h, planeMask, format);
+ sx, sy, w, h, planeMask, format);
if (img) {
- int len = img->bytes_per_line * img->height;
- memmove(pdstLine, img->data, len);
- XDestroyImage(img);
+ int len = img->bytes_per_line * img->height;
+
+ memmove(pdstLine, img->data, len);
+ XDestroyImage(img);
}
dmxSync(dmxScreen, FALSE);
}
/** Get Spans -- this function should never be called. */
-void dmxGetSpans(DrawablePtr pDrawable, int wMax,
- DDXPointPtr ppt, int *pwidth, int nspans,
- char *pdstStart)
+void
+dmxGetSpans(DrawablePtr pDrawable, int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart)
{
/* Error -- this should never happen! */
}
diff --git a/xorg-server/hw/dmx/dmxinit.c b/xorg-server/hw/dmx/dmxinit.c
index 99223caa8..23a1385c6 100644
--- a/xorg-server/hw/dmx/dmxinit.c
+++ b/xorg-server/hw/dmx/dmxinit.c
@@ -55,8 +55,8 @@
#include "dmxstat.h"
#include "dmxpict.h"
-#include <X11/Xos.h> /* For gettimeofday */
-#include <X11/Xmu/SysUtil.h> /* For XmuGetHostname */
+#include <X11/Xos.h> /* For gettimeofday */
+#include <X11/Xmu/SysUtil.h> /* For XmuGetHostname */
#include "dixstruct.h"
#ifdef PANORAMIX
#include "panoramiXsrv.h"
@@ -70,91 +70,94 @@
#include "dmx_glxvisuals.h"
#include <X11/extensions/Xext.h>
#include <X11/extensions/extutil.h>
-#endif /* GLXEXT */
+#endif /* GLXEXT */
/* Global variables available to all Xserver/hw/dmx routines. */
-int dmxNumScreens;
-DMXScreenInfo *dmxScreens;
+int dmxNumScreens;
+DMXScreenInfo *dmxScreens;
-int dmxNumInputs;
-DMXInputInfo *dmxInputs;
+int dmxNumInputs;
+DMXInputInfo *dmxInputs;
-int dmxShadowFB = FALSE;
+int dmxShadowFB = FALSE;
-XErrorEvent dmxLastErrorEvent;
-Bool dmxErrorOccurred = FALSE;
+XErrorEvent dmxLastErrorEvent;
+Bool dmxErrorOccurred = FALSE;
-char *dmxFontPath = NULL;
+char *dmxFontPath = NULL;
-Bool dmxOffScreenOpt = TRUE;
+Bool dmxOffScreenOpt = TRUE;
-Bool dmxSubdividePrimitives = TRUE;
+Bool dmxSubdividePrimitives = TRUE;
-Bool dmxLazyWindowCreation = TRUE;
+Bool dmxLazyWindowCreation = TRUE;
-Bool dmxUseXKB = TRUE;
+Bool dmxUseXKB = TRUE;
-int dmxDepth = 0;
+int dmxDepth = 0;
#ifndef GLXEXT
-static Bool dmxGLXProxy = FALSE;
+static Bool dmxGLXProxy = FALSE;
#else
-Bool dmxGLXProxy = TRUE;
+Bool dmxGLXProxy = TRUE;
-Bool dmxGLXSwapGroupSupport = TRUE;
+Bool dmxGLXSwapGroupSupport = TRUE;
-Bool dmxGLXSyncSwap = FALSE;
+Bool dmxGLXSyncSwap = FALSE;
-Bool dmxGLXFinishSwap = FALSE;
+Bool dmxGLXFinishSwap = FALSE;
#endif
-Bool dmxIgnoreBadFontPaths = FALSE;
+Bool dmxIgnoreBadFontPaths = FALSE;
-Bool dmxAddRemoveScreens = FALSE;
+Bool dmxAddRemoveScreens = FALSE;
/* dmxErrorHandler catches errors that occur when calling one of the
* back-end servers. Some of this code is based on _XPrintDefaultError
* in xc/lib/X11/XlibInt.c */
-static int dmxErrorHandler(Display *dpy, XErrorEvent *ev)
+static int
+dmxErrorHandler(Display * dpy, XErrorEvent * ev)
{
#define DMX_ERROR_BUF_SIZE 256
- /* RATS: these buffers are only used in
- * length-limited calls. */
- char buf[DMX_ERROR_BUF_SIZE];
- char request[DMX_ERROR_BUF_SIZE];
+ /* RATS: these buffers are only used in
+ * length-limited calls. */
+ char buf[DMX_ERROR_BUF_SIZE];
+ char request[DMX_ERROR_BUF_SIZE];
_XExtension *ext = NULL;
- dmxErrorOccurred = TRUE;
+ dmxErrorOccurred = TRUE;
dmxLastErrorEvent = *ev;
XGetErrorText(dpy, ev->error_code, buf, sizeof(buf));
dmxLog(dmxWarning, "dmxErrorHandler: %s\n", buf);
- /* Find major opcode name */
+ /* Find major opcode name */
if (ev->request_code < 128) {
snprintf(request, sizeof(request), "%d", ev->request_code);
XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf));
- } else {
+ }
+ else {
for (ext = dpy->ext_procs;
ext && ext->codes.major_opcode != ev->request_code;
ext = ext->next);
- if (ext) strlcpy(buf, ext->name, sizeof(buf));
- else buf[0] = '\0';
+ if (ext)
+ strlcpy(buf, ext->name, sizeof(buf));
+ else
+ buf[0] = '\0';
}
dmxLog(dmxWarning, " Major opcode: %d (%s)\n",
ev->request_code, buf);
- /* Find minor opcode name */
+ /* Find minor opcode name */
if (ev->request_code >= 128 && ext) {
snprintf(request, sizeof(request), "%d", ev->request_code);
- snprintf(request, sizeof(request), "%s.%d",
- ext->name, ev->minor_code);
+ snprintf(request, sizeof(request), "%s.%d", ext->name, ev->minor_code);
XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf));
dmxLog(dmxWarning, " Minor opcode: %d (%s)\n",
ev->minor_code, buf);
}
- /* Provide value information */
+ /* Provide value information */
switch (ev->error_code) {
case BadValue:
dmxLog(dmxWarning, " Value: 0x%x\n",
@@ -170,7 +173,7 @@ static int dmxErrorHandler(Display *dpy, XErrorEvent *ev)
break;
}
- /* Provide serial number information */
+ /* Provide serial number information */
dmxLog(dmxWarning, " Failed serial number: %d\n",
ev->serial);
dmxLog(dmxWarning, " Current serial number: %d\n",
@@ -179,47 +182,53 @@ static int dmxErrorHandler(Display *dpy, XErrorEvent *ev)
}
#ifdef GLXEXT
-static int dmxNOPErrorHandler(Display *dpy, XErrorEvent *ev)
+static int
+dmxNOPErrorHandler(Display * dpy, XErrorEvent * ev)
{
return 0;
}
#endif
-Bool dmxOpenDisplay(DMXScreenInfo *dmxScreen)
+Bool
+dmxOpenDisplay(DMXScreenInfo * dmxScreen)
{
if (!(dmxScreen->beDisplay = XOpenDisplay(dmxScreen->name)))
- return FALSE;
+ return FALSE;
dmxPropertyDisplay(dmxScreen);
return TRUE;
}
-void dmxSetErrorHandler(DMXScreenInfo *dmxScreen)
+void
+dmxSetErrorHandler(DMXScreenInfo * dmxScreen)
{
XSetErrorHandler(dmxErrorHandler);
}
-static void dmxPrintScreenInfo(DMXScreenInfo *dmxScreen)
+static void
+dmxPrintScreenInfo(DMXScreenInfo * dmxScreen)
{
XWindowAttributes attribs;
- int ndepths = 0, *depths = NULL;
- int i;
- Display *dpy = dmxScreen->beDisplay;
- Screen *s = DefaultScreenOfDisplay(dpy);
- int scr = DefaultScreen(dpy);
+ int ndepths = 0, *depths = NULL;
+ int i;
+ Display *dpy = dmxScreen->beDisplay;
+ Screen *s = DefaultScreenOfDisplay(dpy);
+ int scr = DefaultScreen(dpy);
XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs);
- if (!(depths = XListDepths(dpy, scr, &ndepths))) ndepths = 0;
-
+ if (!(depths = XListDepths(dpy, scr, &ndepths)))
+ ndepths = 0;
+
dmxLogOutput(dmxScreen, "Name of display: %s\n", DisplayString(dpy));
dmxLogOutput(dmxScreen, "Version number: %d.%d\n",
ProtocolVersion(dpy), ProtocolRevision(dpy));
dmxLogOutput(dmxScreen, "Vendor string: %s\n", ServerVendor(dpy));
if (!strstr(ServerVendor(dpy), "XFree86")) {
dmxLogOutput(dmxScreen, "Vendor release: %d\n", VendorRelease(dpy));
- } else {
- /* This code based on xdpyinfo.c */
- int v = VendorRelease(dpy);
+ }
+ else {
+ /* This code based on xdpyinfo.c */
+ int v = VendorRelease(dpy);
int major = -1, minor = -1, patch = -1, subpatch = -1;
if (v < 336)
@@ -229,27 +238,33 @@ static void dmxPrintScreenInfo(DMXScreenInfo *dmxScreen)
minor = (v / 100) % 10;
if (((v / 10) % 10) || (v % 10)) {
patch = (v / 10) % 10;
- if (v % 10) subpatch = v % 10;
+ if (v % 10)
+ subpatch = v % 10;
}
- } else if (v < 40000000) {
+ }
+ else if (v < 40000000) {
major = v / 1000;
minor = (v / 10) % 10;
- if (v % 10) patch = v % 10;
- } else {
+ if (v % 10)
+ patch = v % 10;
+ }
+ else {
major = v / 10000000;
minor = (v / 100000) % 100;
patch = (v / 1000) % 100;
- if (v % 1000) subpatch = v % 1000;
- }
+ if (v % 1000)
+ subpatch = v % 1000;
+ }
dmxLogOutput(dmxScreen, "Vendor release: %d (XFree86 version: %d.%d",
v, major, minor);
- if (patch > 0) dmxLogOutputCont(dmxScreen, ".%d", patch);
- if (subpatch > 0) dmxLogOutputCont(dmxScreen, ".%d", subpatch);
+ if (patch > 0)
+ dmxLogOutputCont(dmxScreen, ".%d", patch);
+ if (subpatch > 0)
+ dmxLogOutputCont(dmxScreen, ".%d", subpatch);
dmxLogOutputCont(dmxScreen, ")\n");
}
-
- dmxLogOutput(dmxScreen, "Dimensions: %dx%d pixels\n",
+ dmxLogOutput(dmxScreen, "Dimensions: %dx%d pixels\n",
attribs.width, attribs.height);
dmxLogOutput(dmxScreen, "%d depths on screen %d: ", ndepths, scr);
for (i = 0; i < ndepths; i++)
@@ -261,59 +276,65 @@ static void dmxPrintScreenInfo(DMXScreenInfo *dmxScreen)
dmxLogOutput(dmxScreen, "Number of colormaps: %d min, %d max\n",
MinCmapsOfScreen(s), MaxCmapsOfScreen(s));
dmxLogOutput(dmxScreen, "Options: backing-store %s, save-unders %s\n",
- (DoesBackingStore (s) == NotUseful) ? "no" :
- ((DoesBackingStore (s) == Always) ? "yes" : "when mapped"),
- DoesSaveUnders (s) ? "yes" : "no");
+ (DoesBackingStore(s) == NotUseful) ? "no" :
+ ((DoesBackingStore(s) == Always) ? "yes" : "when mapped"),
+ DoesSaveUnders(s) ? "yes" : "no");
dmxLogOutput(dmxScreen, "Window Manager running: %s\n",
- (dmxScreen->WMRunningOnBE) ? "yes" : "no");
+ (dmxScreen->WMRunningOnBE) ? "yes" : "no");
if (dmxScreen->WMRunningOnBE) {
- dmxLogOutputWarning(dmxScreen,
- "Window manager running "
- "-- colormaps not supported\n");
+ dmxLogOutputWarning(dmxScreen,
+ "Window manager running "
+ "-- colormaps not supported\n");
}
XFree(depths);
}
-void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen)
+void
+dmxGetScreenAttribs(DMXScreenInfo * dmxScreen)
{
XWindowAttributes attribs;
- Display *dpy = dmxScreen->beDisplay;
+ Display *dpy = dmxScreen->beDisplay;
+
#ifdef GLXEXT
- int dummy;
+ int dummy;
#endif
XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs);
- dmxScreen->beWidth = attribs.width;
+ dmxScreen->beWidth = attribs.width;
dmxScreen->beHeight = attribs.height;
-
- /* Fill in missing geometry information */
+
+ /* Fill in missing geometry information */
if (dmxScreen->scrnXSign < 0) {
if (dmxScreen->scrnWidth) {
- dmxScreen->scrnX = (attribs.width - dmxScreen->scrnWidth
- - dmxScreen->scrnX);
- } else {
- dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
- dmxScreen->scrnX = 0;
+ dmxScreen->scrnX = (attribs.width - dmxScreen->scrnWidth
+ - dmxScreen->scrnX);
+ }
+ else {
+ dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
+ dmxScreen->scrnX = 0;
}
}
if (dmxScreen->scrnYSign < 0) {
if (dmxScreen->scrnHeight) {
- dmxScreen->scrnY = (attribs.height - dmxScreen->scrnHeight
- - dmxScreen->scrnY);
- } else {
+ dmxScreen->scrnY = (attribs.height - dmxScreen->scrnHeight
+ - dmxScreen->scrnY);
+ }
+ else {
dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY;
- dmxScreen->scrnY = 0;
+ dmxScreen->scrnY = 0;
}
}
if (!dmxScreen->scrnWidth)
- dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
+ dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
if (!dmxScreen->scrnHeight)
dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY;
- if (!dmxScreen->rootWidth) dmxScreen->rootWidth = dmxScreen->scrnWidth;
- if (!dmxScreen->rootHeight) dmxScreen->rootHeight = dmxScreen->scrnHeight;
+ if (!dmxScreen->rootWidth)
+ dmxScreen->rootWidth = dmxScreen->scrnWidth;
+ if (!dmxScreen->rootHeight)
+ dmxScreen->rootHeight = dmxScreen->scrnHeight;
if (dmxScreen->rootWidth + dmxScreen->rootX > dmxScreen->scrnWidth)
dmxScreen->rootWidth = dmxScreen->scrnWidth - dmxScreen->rootX;
if (dmxScreen->rootHeight + dmxScreen->rootY > dmxScreen->scrnHeight)
@@ -323,22 +344,25 @@ void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen)
dmxScreen->beXDPI = 75;
dmxScreen->beYDPI = 75;
- dmxScreen->beDepth = attribs.depth; /* FIXME: verify that this
- * works always. In
- * particular, this will work
- * well for depth=16, will fail
- * because of colormap issues
- * at depth 8. More work needs
- * to be done here. */
-
- if (dmxScreen->beDepth <= 8) dmxScreen->beBPP = 8;
- else if (dmxScreen->beDepth <= 16) dmxScreen->beBPP = 16;
- else dmxScreen->beBPP = 32;
+ dmxScreen->beDepth = attribs.depth; /* FIXME: verify that this
+ * works always. In
+ * particular, this will work
+ * well for depth=16, will fail
+ * because of colormap issues
+ * at depth 8. More work needs
+ * to be done here. */
+
+ if (dmxScreen->beDepth <= 8)
+ dmxScreen->beBPP = 8;
+ else if (dmxScreen->beDepth <= 16)
+ dmxScreen->beBPP = 16;
+ else
+ dmxScreen->beBPP = 32;
#ifdef GLXEXT
/* get the majorOpcode for the back-end GLX extension */
XQueryExtension(dpy, "GLX", &dmxScreen->glxMajorOpcode,
- &dummy, &dmxScreen->glxErrorBase);
+ &dummy, &dmxScreen->glxErrorBase);
#endif
dmxPrintScreenInfo(dmxScreen);
@@ -352,47 +376,50 @@ void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen)
"Support for depth == 8 is not complete\n");
}
-Bool dmxGetVisualInfo(DMXScreenInfo *dmxScreen)
+Bool
+dmxGetVisualInfo(DMXScreenInfo * dmxScreen)
{
int i;
XVisualInfo visinfo;
visinfo.screen = DefaultScreen(dmxScreen->beDisplay);
dmxScreen->beVisuals = XGetVisualInfo(dmxScreen->beDisplay,
- VisualScreenMask,
- &visinfo,
- &dmxScreen->beNumVisuals);
+ VisualScreenMask,
+ &visinfo, &dmxScreen->beNumVisuals);
dmxScreen->beDefVisualIndex = -1;
if (defaultColorVisualClass >= 0 || dmxDepth > 0) {
- for (i = 0; i < dmxScreen->beNumVisuals; i++)
- if (defaultColorVisualClass >= 0) {
- if (dmxScreen->beVisuals[i].class == defaultColorVisualClass) {
- if (dmxDepth > 0) {
- if (dmxScreen->beVisuals[i].depth == dmxDepth) {
- dmxScreen->beDefVisualIndex = i;
- break;
- }
- } else {
- dmxScreen->beDefVisualIndex = i;
- break;
- }
- }
- } else if (dmxScreen->beVisuals[i].depth == dmxDepth) {
- dmxScreen->beDefVisualIndex = i;
- break;
- }
- } else {
- visinfo.visualid =
- XVisualIDFromVisual(DefaultVisual(dmxScreen->beDisplay,
- visinfo.screen));
-
- for (i = 0; i < dmxScreen->beNumVisuals; i++)
- if (visinfo.visualid == dmxScreen->beVisuals[i].visualid) {
- dmxScreen->beDefVisualIndex = i;
- break;
- }
+ for (i = 0; i < dmxScreen->beNumVisuals; i++)
+ if (defaultColorVisualClass >= 0) {
+ if (dmxScreen->beVisuals[i].class == defaultColorVisualClass) {
+ if (dmxDepth > 0) {
+ if (dmxScreen->beVisuals[i].depth == dmxDepth) {
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
+ }
+ else {
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
+ }
+ }
+ else if (dmxScreen->beVisuals[i].depth == dmxDepth) {
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
+ }
+ else {
+ visinfo.visualid =
+ XVisualIDFromVisual(DefaultVisual(dmxScreen->beDisplay,
+ visinfo.screen));
+
+ for (i = 0; i < dmxScreen->beNumVisuals; i++)
+ if (visinfo.visualid == dmxScreen->beVisuals[i].visualid) {
+ dmxScreen->beDefVisualIndex = i;
+ break;
+ }
}
for (i = 0; i < dmxScreen->beNumVisuals; i++)
@@ -402,44 +429,45 @@ Bool dmxGetVisualInfo(DMXScreenInfo *dmxScreen)
return dmxScreen->beDefVisualIndex >= 0;
}
-void dmxGetColormaps(DMXScreenInfo *dmxScreen)
+void
+dmxGetColormaps(DMXScreenInfo * dmxScreen)
{
int i;
dmxScreen->beNumDefColormaps = dmxScreen->beNumVisuals;
dmxScreen->beDefColormaps = malloc(dmxScreen->beNumDefColormaps *
- sizeof(*dmxScreen->beDefColormaps));
+ sizeof(*dmxScreen->beDefColormaps));
for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
- dmxScreen->beDefColormaps[i] =
- XCreateColormap(dmxScreen->beDisplay,
- DefaultRootWindow(dmxScreen->beDisplay),
- dmxScreen->beVisuals[i].visual,
- AllocNone);
+ dmxScreen->beDefColormaps[i] =
+ XCreateColormap(dmxScreen->beDisplay,
+ DefaultRootWindow(dmxScreen->beDisplay),
+ dmxScreen->beVisuals[i].visual, AllocNone);
dmxScreen->beBlackPixel = BlackPixel(dmxScreen->beDisplay,
- DefaultScreen(dmxScreen->beDisplay));
+ DefaultScreen(dmxScreen->beDisplay));
dmxScreen->beWhitePixel = WhitePixel(dmxScreen->beDisplay,
- DefaultScreen(dmxScreen->beDisplay));
+ DefaultScreen(dmxScreen->beDisplay));
}
-void dmxGetPixmapFormats(DMXScreenInfo *dmxScreen)
+void
+dmxGetPixmapFormats(DMXScreenInfo * dmxScreen)
{
dmxScreen->beDepths =
- XListDepths(dmxScreen->beDisplay, DefaultScreen(dmxScreen->beDisplay),
- &dmxScreen->beNumDepths);
+ XListDepths(dmxScreen->beDisplay, DefaultScreen(dmxScreen->beDisplay),
+ &dmxScreen->beNumDepths);
dmxScreen->bePixmapFormats =
- XListPixmapFormats(dmxScreen->beDisplay,
- &dmxScreen->beNumPixmapFormats);
+ XListPixmapFormats(dmxScreen->beDisplay,
+ &dmxScreen->beNumPixmapFormats);
}
-static Bool dmxSetPixmapFormats(ScreenInfo *pScreenInfo,
- DMXScreenInfo *dmxScreen)
+static Bool
+dmxSetPixmapFormats(ScreenInfo * pScreenInfo, DMXScreenInfo * dmxScreen)
{
XPixmapFormatValues *bePixmapFormat;
- PixmapFormatRec *format;
- int i, j;
+ PixmapFormatRec *format;
+ int i, j;
pScreenInfo->imageByteOrder = ImageByteOrder(dmxScreen->beDisplay);
pScreenInfo->bitmapScanlineUnit = BitmapUnit(dmxScreen->beDisplay);
@@ -448,53 +476,54 @@ static Bool dmxSetPixmapFormats(ScreenInfo *pScreenInfo,
pScreenInfo->numPixmapFormats = 0;
for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
- bePixmapFormat = &dmxScreen->bePixmapFormats[i];
- for (j = 0; j < dmxScreen->beNumDepths; j++)
- if ((bePixmapFormat->depth == 1) ||
- (bePixmapFormat->depth == dmxScreen->beDepths[j])) {
- format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats];
-
- format->depth = bePixmapFormat->depth;
- format->bitsPerPixel = bePixmapFormat->bits_per_pixel;
- format->scanlinePad = bePixmapFormat->scanline_pad;
-
- pScreenInfo->numPixmapFormats++;
- break;
- }
+ bePixmapFormat = &dmxScreen->bePixmapFormats[i];
+ for (j = 0; j < dmxScreen->beNumDepths; j++)
+ if ((bePixmapFormat->depth == 1) ||
+ (bePixmapFormat->depth == dmxScreen->beDepths[j])) {
+ format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats];
+
+ format->depth = bePixmapFormat->depth;
+ format->bitsPerPixel = bePixmapFormat->bits_per_pixel;
+ format->scanlinePad = bePixmapFormat->scanline_pad;
+
+ pScreenInfo->numPixmapFormats++;
+ break;
+ }
}
return TRUE;
}
-void dmxCheckForWM(DMXScreenInfo *dmxScreen)
+void
+dmxCheckForWM(DMXScreenInfo * dmxScreen)
{
Status status;
XWindowAttributes xwa;
status = XGetWindowAttributes(dmxScreen->beDisplay,
- DefaultRootWindow(dmxScreen->beDisplay),
- &xwa);
+ DefaultRootWindow(dmxScreen->beDisplay),
+ &xwa);
dmxScreen->WMRunningOnBE =
- (status &&
- ((xwa.all_event_masks & SubstructureRedirectMask) ||
- (xwa.all_event_masks & SubstructureNotifyMask)));
+ (status &&
+ ((xwa.all_event_masks & SubstructureRedirectMask) ||
+ (xwa.all_event_masks & SubstructureNotifyMask)));
}
/** Initialize the display and collect relevant information about the
* display properties */
-static void dmxDisplayInit(DMXScreenInfo *dmxScreen)
+static void
+dmxDisplayInit(DMXScreenInfo * dmxScreen)
{
if (!dmxOpenDisplay(dmxScreen))
- dmxLog(dmxFatal,
- "dmxOpenDisplay: Unable to open display %s\n",
- dmxScreen->name);
+ dmxLog(dmxFatal,
+ "dmxOpenDisplay: Unable to open display %s\n", dmxScreen->name);
dmxSetErrorHandler(dmxScreen);
dmxCheckForWM(dmxScreen);
dmxGetScreenAttribs(dmxScreen);
if (!dmxGetVisualInfo(dmxScreen))
- dmxLog(dmxFatal, "dmxGetVisualInfo: No matching visuals found\n");
+ dmxLog(dmxFatal, "dmxGetVisualInfo: No matching visuals found\n");
dmxGetColormaps(dmxScreen);
dmxGetPixmapFormats(dmxScreen);
@@ -503,45 +532,52 @@ static void dmxDisplayInit(DMXScreenInfo *dmxScreen)
/* If this doesn't compile, just add || defined(yoursystem) to the line
* below. This information is to help with bug reports and is not
* critical. */
-#if !defined(_POSIX_SOURCE)
-static const char *dmxExecOS(void) { return ""; }
+#if !defined(_POSIX_SOURCE)
+static const char *
+dmxExecOS(void)
+{
+ return "";
+}
#else
#include <sys/utsname.h>
-static const char *dmxExecOS(void)
+static const char *
+dmxExecOS(void)
{
static char buffer[128];
- static int initialized = 0;
+ static int initialized = 0;
struct utsname u;
if (!initialized++) {
memset(buffer, 0, sizeof(buffer));
uname(&u);
- snprintf(buffer, sizeof(buffer)-1, "%s %s %s",
- u.sysname, u.release, u.version);
+ snprintf(buffer, sizeof(buffer) - 1, "%s %s %s",
+ u.sysname, u.release, u.version);
}
return buffer;
}
#endif
-static const char *dmxBuildCompiler(void)
+static const char *
+dmxBuildCompiler(void)
{
static char buffer[128];
- static int initialized = 0;
+ static int initialized = 0;
if (!initialized++) {
memset(buffer, 0, sizeof(buffer));
#if defined(__GNUC__) && defined(__GNUC_MINOR__) &&defined(__GNUC_PATCHLEVEL__)
- snprintf(buffer, sizeof(buffer)-1, "gcc %d.%d.%d",
- __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
+ snprintf(buffer, sizeof(buffer) - 1, "gcc %d.%d.%d",
+ __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#endif
}
return buffer;
}
-static const char *dmxExecHost(void)
+static const char *
+dmxExecHost(void)
{
static char buffer[128];
- static int initialized = 0;
+ static int initialized = 0;
if (!initialized++) {
memset(buffer, 0, sizeof(buffer));
@@ -551,32 +587,35 @@ static const char *dmxExecHost(void)
}
/** This routine is called in Xserver/dix/main.c from \a main(). */
-void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
+void
+InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
{
- int i;
+ int i;
static unsigned long dmxGeneration = 0;
+
#ifdef GLXEXT
- Bool glxSupported = TRUE;
+ Bool glxSupported = TRUE;
#endif
if (dmxGeneration != serverGeneration) {
- int vendrel = VENDOR_RELEASE;
+ int vendrel = VENDOR_RELEASE;
int major, minor, year, month, day;
-
+
dmxGeneration = serverGeneration;
- major = vendrel / 100000000;
- vendrel -= major * 100000000;
- minor = vendrel / 1000000;
- vendrel -= minor * 1000000;
- year = vendrel / 10000;
- vendrel -= year * 10000;
- month = vendrel / 100;
- vendrel -= month * 100;
- day = vendrel;
+ major = vendrel / 100000000;
+ vendrel -= major * 100000000;
+ minor = vendrel / 1000000;
+ vendrel -= minor * 1000000;
+ year = vendrel / 10000;
+ vendrel -= year * 10000;
+ month = vendrel / 100;
+ vendrel -= month * 100;
+ day = vendrel;
- /* Add other epoch tests here */
- if (major > 0 && minor > 0) year += 2000;
+ /* Add other epoch tests here */
+ if (major > 0 && minor > 0)
+ year += 2000;
dmxLog(dmxInfo, "Generation: %d\n", dmxGeneration);
dmxLog(dmxInfo, "DMX version: %d.%d.%02d%02d%02d (%s)\n",
@@ -600,32 +639,33 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
dmxStatFree(dmxScreens[i].stat);
dmxScreens[i].stat = NULL;
}
- for (i = 0; i < dmxNumInputs; i++) dmxInputFree(&dmxInputs[i]);
+ for (i = 0; i < dmxNumInputs; i++)
+ dmxInputFree(&dmxInputs[i]);
free(dmxScreens);
free(dmxInputs);
- dmxScreens = NULL;
- dmxInputs = NULL;
+ dmxScreens = NULL;
+ dmxInputs = NULL;
dmxNumScreens = 0;
- dmxNumInputs = 0;
+ dmxNumInputs = 0;
}
/* Make sure that the command-line arguments are sane. */
if (dmxAddRemoveScreens && dmxGLXProxy) {
- /* Currently it is not possible to support GLX and Render
- * extensions with dynamic screen addition/removal due to the
- * state that each extension keeps, which cannot be restored. */
+ /* Currently it is not possible to support GLX and Render
+ * extensions with dynamic screen addition/removal due to the
+ * state that each extension keeps, which cannot be restored. */
dmxLog(dmxWarning,
- "GLX Proxy and Render extensions do not yet support dynamic\n");
+ "GLX Proxy and Render extensions do not yet support dynamic\n");
dmxLog(dmxWarning,
- "screen addition and removal. Please specify -noglxproxy\n");
+ "screen addition and removal. Please specify -noglxproxy\n");
dmxLog(dmxWarning,
- "and -norender on the command line or in the configuration\n");
+ "and -norender on the command line or in the configuration\n");
dmxLog(dmxWarning,
- "file to disable these two extensions if you wish to use\n");
+ "file to disable these two extensions if you wish to use\n");
dmxLog(dmxWarning,
- "the dynamic addition and removal of screens support.\n");
+ "the dynamic addition and removal of screens support.\n");
dmxLog(dmxFatal,
- "Dynamic screen addition/removal error (see above).\n");
+ "Dynamic screen addition/removal error (see above).\n");
}
/* ddxProcessArgument has been called at this point, but any data
@@ -636,17 +676,16 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
dmxLog(dmxFatal, "InitOutput: no back-end displays found\n");
if (!dmxNumInputs)
dmxLog(dmxInfo, "InitOutput: no inputs found\n");
-
+
/* Disable lazy window creation optimization if offscreen
* optimization is disabled */
if (!dmxOffScreenOpt && dmxLazyWindowCreation) {
dmxLog(dmxInfo,
- "InitOutput: Disabling lazy window creation optimization\n");
+ "InitOutput: Disabling lazy window creation optimization\n");
dmxLog(dmxInfo,
- " since it requires the offscreen optimization\n");
- dmxLog(dmxInfo,
- " to function properly.\n");
- dmxLazyWindowCreation = FALSE;
+ " since it requires the offscreen optimization\n");
+ dmxLog(dmxInfo, " to function properly.\n");
+ dmxLazyWindowCreation = FALSE;
}
/* Open each display and gather information about it. */
@@ -662,8 +701,9 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
#endif
/* Since we only have a single screen thus far, we only need to set
- the pixmap formats to match that screen. FIXME: this isn't true.*/
- if (!dmxSetPixmapFormats(pScreenInfo, &dmxScreens[0])) return;
+ the pixmap formats to match that screen. FIXME: this isn't true. */
+ if (!dmxSetPixmapFormats(pScreenInfo, &dmxScreens[0]))
+ return;
/* Might want to install a signal handler to allow cleaning up after
* unexpected signals. The DIX/OS layer already handles SIGINT and
@@ -682,93 +722,95 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
#ifdef GLXEXT
/* Check if GLX extension exists on all back-end servers */
for (i = 0; i < dmxNumScreens; i++)
- glxSupported &= (dmxScreens[i].glxMajorOpcode > 0);
+ glxSupported &= (dmxScreens[i].glxMajorOpcode > 0);
#endif
/* Tell dix layer about the backend displays */
for (i = 0; i < dmxNumScreens; i++) {
#ifdef GLXEXT
- if (glxSupported) {
- /*
- * Builds GLX configurations from the list of visuals
- * supported by the back-end server, and give that
- * configuration list to the glx layer - so that he will
- * build the visuals accordingly.
- */
-
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- __GLXvisualConfig *configs = NULL;
- dmxGlxVisualPrivate **configprivs = NULL;
- int nconfigs = 0;
- int (*oldErrorHandler)(Display *, XErrorEvent *);
- int i;
-
- /* Catch errors if when using an older GLX w/o FBconfigs */
- oldErrorHandler = XSetErrorHandler(dmxNOPErrorHandler);
-
- /* Get FBConfigs of the back-end server */
- dmxScreen->fbconfigs = GetGLXFBConfigs(dmxScreen->beDisplay,
- dmxScreen->glxMajorOpcode,
- &dmxScreen->numFBConfigs);
-
- XSetErrorHandler(oldErrorHandler);
-
- dmxScreen->glxVisuals =
- GetGLXVisualConfigs(dmxScreen->beDisplay,
- DefaultScreen(dmxScreen->beDisplay),
- &dmxScreen->numGlxVisuals);
-
- if (dmxScreen->fbconfigs) {
- configs =
- GetGLXVisualConfigsFromFBConfigs(dmxScreen->fbconfigs,
- dmxScreen->numFBConfigs,
- dmxScreen->beVisuals,
- dmxScreen->beNumVisuals,
- dmxScreen->glxVisuals,
- dmxScreen->numGlxVisuals,
- &nconfigs);
- } else {
- configs = dmxScreen->glxVisuals;
- nconfigs = dmxScreen->numGlxVisuals;
- }
-
- configprivs = malloc(nconfigs * sizeof(dmxGlxVisualPrivate*));
-
- if (configs != NULL && configprivs != NULL) {
-
- /* Initialize our private info for each visual
- * (currently only x_visual_depth and x_visual_class)
- */
- for (i = 0; i < nconfigs; i++) {
-
- configprivs[i] = (dmxGlxVisualPrivate *)
- malloc(sizeof(dmxGlxVisualPrivate));
- configprivs[i]->x_visual_depth = 0;
- configprivs[i]->x_visual_class = 0;
-
- /* Find the visual depth */
- if (configs[i].vid > 0) {
- int j;
- for (j = 0; j < dmxScreen->beNumVisuals; j++) {
- if (dmxScreen->beVisuals[j].visualid ==
- configs[i].vid) {
- configprivs[i]->x_visual_depth =
- dmxScreen->beVisuals[j].depth;
- configprivs[i]->x_visual_class =
- dmxScreen->beVisuals[j].class;
- break;
- }
- }
- }
- }
+ if (glxSupported) {
+ /*
+ * Builds GLX configurations from the list of visuals
+ * supported by the back-end server, and give that
+ * configuration list to the glx layer - so that he will
+ * build the visuals accordingly.
+ */
+
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ __GLXvisualConfig *configs = NULL;
+ dmxGlxVisualPrivate **configprivs = NULL;
+ int nconfigs = 0;
+ int (*oldErrorHandler) (Display *, XErrorEvent *);
+ int i;
+
+ /* Catch errors if when using an older GLX w/o FBconfigs */
+ oldErrorHandler = XSetErrorHandler(dmxNOPErrorHandler);
+
+ /* Get FBConfigs of the back-end server */
+ dmxScreen->fbconfigs = GetGLXFBConfigs(dmxScreen->beDisplay,
+ dmxScreen->glxMajorOpcode,
+ &dmxScreen->numFBConfigs);
+
+ XSetErrorHandler(oldErrorHandler);
+
+ dmxScreen->glxVisuals =
+ GetGLXVisualConfigs(dmxScreen->beDisplay,
+ DefaultScreen(dmxScreen->beDisplay),
+ &dmxScreen->numGlxVisuals);
+
+ if (dmxScreen->fbconfigs) {
+ configs =
+ GetGLXVisualConfigsFromFBConfigs(dmxScreen->fbconfigs,
+ dmxScreen->numFBConfigs,
+ dmxScreen->beVisuals,
+ dmxScreen->beNumVisuals,
+ dmxScreen->glxVisuals,
+ dmxScreen->numGlxVisuals,
+ &nconfigs);
+ }
+ else {
+ configs = dmxScreen->glxVisuals;
+ nconfigs = dmxScreen->numGlxVisuals;
+ }
+
+ configprivs = malloc(nconfigs * sizeof(dmxGlxVisualPrivate *));
+
+ if (configs != NULL && configprivs != NULL) {
+
+ /* Initialize our private info for each visual
+ * (currently only x_visual_depth and x_visual_class)
+ */
+ for (i = 0; i < nconfigs; i++) {
+
+ configprivs[i] = (dmxGlxVisualPrivate *)
+ malloc(sizeof(dmxGlxVisualPrivate));
+ configprivs[i]->x_visual_depth = 0;
+ configprivs[i]->x_visual_class = 0;
+
+ /* Find the visual depth */
+ if (configs[i].vid > 0) {
+ int j;
+
+ for (j = 0; j < dmxScreen->beNumVisuals; j++) {
+ if (dmxScreen->beVisuals[j].visualid ==
+ configs[i].vid) {
+ configprivs[i]->x_visual_depth =
+ dmxScreen->beVisuals[j].depth;
+ configprivs[i]->x_visual_class =
+ dmxScreen->beVisuals[j].class;
+ break;
+ }
+ }
+ }
+ }
XFlush(dmxScreen->beDisplay);
- }
- }
-#endif /* GLXEXT */
+ }
+ }
+#endif /* GLXEXT */
- AddScreen(dmxScreenInit, argc, argv);
+ AddScreen(dmxScreenInit, argc, argv);
}
/* Compute origin information. */
@@ -787,30 +829,32 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[])
/* Initialize the render extension */
if (!noRenderExtension)
- dmxInitRender();
+ dmxInitRender();
/* Initialized things that need timer hooks */
dmxStatInit();
dmxSyncInit(); /* Calls RegisterBlockAndWakeupHandlers */
dmxLog(dmxInfo, "Shadow framebuffer support %s\n",
- dmxShadowFB ? "enabled" : "disabled");
+ dmxShadowFB ? "enabled" : "disabled");
}
/* RATS: Assuming the fp string (which comes from the command-line argv
vector) is NULL-terminated, the buffer is large enough for the
- strcpy. */
-static void dmxSetDefaultFontPath(const char *fp)
+ strcpy. */
+static void
+dmxSetDefaultFontPath(const char *fp)
{
if (dmxFontPath) {
- int fplen = strlen(fp) + 1;
- int len = strlen(dmxFontPath);
-
- dmxFontPath = realloc(dmxFontPath, len+fplen+1);
- dmxFontPath[len] = ',';
- strncpy(&dmxFontPath[len+1], fp, fplen);
- } else {
- dmxFontPath = strdup(fp);
+ int fplen = strlen(fp) + 1;
+ int len = strlen(dmxFontPath);
+
+ dmxFontPath = realloc(dmxFontPath, len + fplen + 1);
+ dmxFontPath[len] = ',';
+ strncpy(&dmxFontPath[len + 1], fp, fplen);
+ }
+ else {
+ dmxFontPath = strdup(fp);
}
defaultFontPath = dmxFontPath;
@@ -819,21 +863,24 @@ static void dmxSetDefaultFontPath(const char *fp)
/** This function is called in Xserver/os/utils.c from \a AbortServer().
* We must ensure that backend and console state is restored in the
* event the server shutdown wasn't clean. */
-void AbortDDX(enum ExitCode error)
+void
+AbortDDX(enum ExitCode error)
{
int i;
- for (i=0; i < dmxNumScreens; i++) {
+ for (i = 0; i < dmxNumScreens; i++) {
DMXScreenInfo *dmxScreen = &dmxScreens[i];
-
- if (dmxScreen->beDisplay) XCloseDisplay(dmxScreen->beDisplay);
+
+ if (dmxScreen->beDisplay)
+ XCloseDisplay(dmxScreen->beDisplay);
dmxScreen->beDisplay = NULL;
}
}
#ifdef DDXBEFORERESET
/* This function is called in Xserver/dix/dispatch.c */
-void ddxBeforeReset(void)
+void
+ddxBeforeReset(void)
{
}
#endif
@@ -841,13 +888,15 @@ void ddxBeforeReset(void)
/** This function is called in Xserver/dix/main.c from \a main() when
* dispatchException & DE_TERMINATE (which is the only way to exit the
* main loop without an interruption. */
-void ddxGiveUp(enum ExitCode error)
+void
+ddxGiveUp(enum ExitCode error)
{
AbortDDX(error);
}
/** This function is called in Xserver/os/osinit.c from \a OsInit(). */
-void OsVendorInit(void)
+void
+OsVendorInit(void)
{
}
@@ -856,100 +905,134 @@ void OsVendorInit(void)
* OsVendorVErrorFProc will cause \a VErrorF() (which is called by the
* two routines mentioned here, as well as by others) to use the
* referenced routine instead of \a vfprintf().) */
-void OsVendorFatalError(void)
+void
+OsVendorFatalError(void)
{
}
/** Process our command line arguments. */
-int ddxProcessArgument(int argc, char *argv[], int i)
+int
+ddxProcessArgument(int argc, char *argv[], int i)
{
int retval = 0;
-
+
if (!strcmp(argv[i], "-display")) {
- if (++i < argc) dmxConfigStoreDisplay(argv[i]);
+ if (++i < argc)
+ dmxConfigStoreDisplay(argv[i]);
retval = 2;
- } else if (!strcmp(argv[i], "-inputfrom") || !strcmp(argv[i], "-input")) {
- if (++i < argc) dmxConfigStoreInput(argv[i]);
+ }
+ else if (!strcmp(argv[i], "-inputfrom") || !strcmp(argv[i], "-input")) {
+ if (++i < argc)
+ dmxConfigStoreInput(argv[i]);
retval = 2;
- } else if (!strcmp(argv[i], "-xinputfrom") || !strcmp(argv[i],"-xinput")) {
- if (++i < argc) dmxConfigStoreXInput(argv[i]);
+ }
+ else if (!strcmp(argv[i], "-xinputfrom") || !strcmp(argv[i], "-xinput")) {
+ if (++i < argc)
+ dmxConfigStoreXInput(argv[i]);
retval = 2;
- } else if (!strcmp(argv[i], "-noshadowfb")) {
+ }
+ else if (!strcmp(argv[i], "-noshadowfb")) {
dmxLog(dmxWarning,
"-noshadowfb has been deprecated "
- "since it is now the default\n");
- dmxShadowFB = FALSE;
- retval = 1;
- } else if (!strcmp(argv[i], "-nomulticursor")) {
+ "since it is now the default\n");
+ dmxShadowFB = FALSE;
+ retval = 1;
+ }
+ else if (!strcmp(argv[i], "-nomulticursor")) {
dmxCursorNoMulti();
- retval = 1;
- } else if (!strcmp(argv[i], "-shadowfb")) {
- dmxShadowFB = TRUE;
- retval = 1;
- } else if (!strcmp(argv[i], "-configfile")) {
- if (++i < argc) dmxConfigStoreFile(argv[i]);
+ retval = 1;
+ }
+ else if (!strcmp(argv[i], "-shadowfb")) {
+ dmxShadowFB = TRUE;
+ retval = 1;
+ }
+ else if (!strcmp(argv[i], "-configfile")) {
+ if (++i < argc)
+ dmxConfigStoreFile(argv[i]);
retval = 2;
- } else if (!strcmp(argv[i], "-config")) {
- if (++i < argc) dmxConfigStoreConfig(argv[i]);
+ }
+ else if (!strcmp(argv[i], "-config")) {
+ if (++i < argc)
+ dmxConfigStoreConfig(argv[i]);
retval = 2;
- } else if (!strcmp(argv[i], "-fontpath")) {
- if (++i < argc) dmxSetDefaultFontPath(argv[i]);
+ }
+ else if (!strcmp(argv[i], "-fontpath")) {
+ if (++i < argc)
+ dmxSetDefaultFontPath(argv[i]);
retval = 2;
- } else if (!strcmp(argv[i], "-stat")) {
- if ((i += 2) < argc) dmxStatActivate(argv[i-1], argv[i]);
+ }
+ else if (!strcmp(argv[i], "-stat")) {
+ if ((i += 2) < argc)
+ dmxStatActivate(argv[i - 1], argv[i]);
retval = 3;
- } else if (!strcmp(argv[i], "-syncbatch")) {
- if (++i < argc) dmxSyncActivate(argv[i]);
+ }
+ else if (!strcmp(argv[i], "-syncbatch")) {
+ if (++i < argc)
+ dmxSyncActivate(argv[i]);
retval = 2;
- } else if (!strcmp(argv[i], "-nooffscreenopt")) {
- dmxOffScreenOpt = FALSE;
+ }
+ else if (!strcmp(argv[i], "-nooffscreenopt")) {
+ dmxOffScreenOpt = FALSE;
retval = 1;
- } else if (!strcmp(argv[i], "-nosubdivprims")) {
- dmxSubdividePrimitives = FALSE;
+ }
+ else if (!strcmp(argv[i], "-nosubdivprims")) {
+ dmxSubdividePrimitives = FALSE;
retval = 1;
- } else if (!strcmp(argv[i], "-nowindowopt")) {
- dmxLazyWindowCreation = FALSE;
+ }
+ else if (!strcmp(argv[i], "-nowindowopt")) {
+ dmxLazyWindowCreation = FALSE;
retval = 1;
- } else if (!strcmp(argv[i], "-noxkb")) {
- dmxUseXKB = FALSE;
+ }
+ else if (!strcmp(argv[i], "-noxkb")) {
+ dmxUseXKB = FALSE;
retval = 1;
- } else if (!strcmp(argv[i], "-depth")) {
- if (++i < argc) dmxDepth = atoi(argv[i]);
+ }
+ else if (!strcmp(argv[i], "-depth")) {
+ if (++i < argc)
+ dmxDepth = atoi(argv[i]);
retval = 2;
- } else if (!strcmp(argv[i], "-norender")) {
- noRenderExtension = TRUE;
+ }
+ else if (!strcmp(argv[i], "-norender")) {
+ noRenderExtension = TRUE;
retval = 1;
#ifdef GLXEXT
- } else if (!strcmp(argv[i], "-noglxproxy")) {
- dmxGLXProxy = FALSE;
+ }
+ else if (!strcmp(argv[i], "-noglxproxy")) {
+ dmxGLXProxy = FALSE;
retval = 1;
- } else if (!strcmp(argv[i], "-noglxswapgroup")) {
- dmxGLXSwapGroupSupport = FALSE;
+ }
+ else if (!strcmp(argv[i], "-noglxswapgroup")) {
+ dmxGLXSwapGroupSupport = FALSE;
retval = 1;
- } else if (!strcmp(argv[i], "-glxsyncswap")) {
- dmxGLXSyncSwap = TRUE;
+ }
+ else if (!strcmp(argv[i], "-glxsyncswap")) {
+ dmxGLXSyncSwap = TRUE;
retval = 1;
- } else if (!strcmp(argv[i], "-glxfinishswap")) {
- dmxGLXFinishSwap = TRUE;
+ }
+ else if (!strcmp(argv[i], "-glxfinishswap")) {
+ dmxGLXFinishSwap = TRUE;
retval = 1;
#endif
- } else if (!strcmp(argv[i], "-ignorebadfontpaths")) {
- dmxIgnoreBadFontPaths = TRUE;
+ }
+ else if (!strcmp(argv[i], "-ignorebadfontpaths")) {
+ dmxIgnoreBadFontPaths = TRUE;
retval = 1;
- } else if (!strcmp(argv[i], "-addremovescreens")) {
- dmxAddRemoveScreens = TRUE;
+ }
+ else if (!strcmp(argv[i], "-addremovescreens")) {
+ dmxAddRemoveScreens = TRUE;
retval = 1;
- } else if (!strcmp(argv[i], "-param")) {
+ }
+ else if (!strcmp(argv[i], "-param")) {
if ((i += 2) < argc) {
- if (!strcasecmp(argv[i-1], "xkbrules"))
+ if (!strcasecmp(argv[i - 1], "xkbrules"))
dmxConfigSetXkbRules(argv[i]);
- else if (!strcasecmp(argv[i-1], "xkbmodel"))
+ else if (!strcasecmp(argv[i - 1], "xkbmodel"))
dmxConfigSetXkbModel(argv[i]);
- else if (!strcasecmp(argv[i-1], "xkblayout"))
+ else if (!strcasecmp(argv[i - 1], "xkblayout"))
dmxConfigSetXkbLayout(argv[i]);
- else if (!strcasecmp(argv[i-1], "xkbvariant"))
+ else if (!strcasecmp(argv[i - 1], "xkbvariant"))
dmxConfigSetXkbVariant(argv[i]);
- else if (!strcasecmp(argv[i-1], "xkboptions"))
+ else if (!strcasecmp(argv[i - 1], "xkboptions"))
dmxConfigSetXkbOptions(argv[i]);
else
dmxLog(dmxWarning,
@@ -958,12 +1041,14 @@ int ddxProcessArgument(int argc, char *argv[], int i)
}
retval = 3;
}
- if (!serverGeneration) dmxConfigSetMaxScreens();
+ if (!serverGeneration)
+ dmxConfigSetMaxScreens();
return retval;
}
/** Provide succinct usage information for the DMX server. */
-void ddxUseMsg(void)
+void
+ddxUseMsg(void)
{
ErrorF("\n\nDevice Dependent Usage:\n");
ErrorF("-display string Specify the back-end display(s)\n");
@@ -991,7 +1076,8 @@ void ddxUseMsg(void)
ErrorF("-glxsyncswap Force XSync after swap buffers\n");
ErrorF("-glxfinishswap Force glFinish after swap buffers\n");
#endif
- ErrorF("-ignorebadfontpaths Ignore bad font paths during initialization\n");
+ ErrorF
+ ("-ignorebadfontpaths Ignore bad font paths during initialization\n");
ErrorF("-addremovescreens Enable dynamic screen addition/removal\n");
ErrorF("-param ... Specify configuration parameters (e.g.,\n");
ErrorF(" XkbRules, XkbModel, XkbLayout, etc.)\n");
@@ -1003,13 +1089,13 @@ void ddxUseMsg(void)
" that display in addition to the backend input. This is\n"
" useful if the backend window does not cover the whole\n"
" physical display.\n\n");
-
+
ErrorF(" Otherwise, if the -input or -xinput string specifies another\n"
" X display, then a console window will be created on that\n"
" display. Placing \",windows\" or \",nowindows\" after the\n"
" display name will control the display of window outlines in\n"
" the console.\n\n");
-
+
ErrorF(" -input or -xinput dummy specifies no input.\n");
ErrorF(" -input or -xinput local specifies the use of a raw keyboard,\n"
" mouse, or other (extension) device:\n"
@@ -1018,7 +1104,7 @@ void ddxUseMsg(void)
" -input local,usb-kbd,usb-mou will use USB devices \n"
" -xinput local,usb-oth will use a non-mouse and\n"
" non-keyboard USB device with XInput\n\n");
-
+
ErrorF(" Special Keys:\n");
ErrorF(" Ctrl-Alt-g Server grab/ungrab (console only)\n");
ErrorF(" Ctrl-Alt-f Fine (1-pixel) mouse mode (console only)\n");
diff --git a/xorg-server/hw/dmx/dmxinput.c b/xorg-server/hw/dmx/dmxinput.c
index f006af4d2..4ccb43903 100644
--- a/xorg-server/hw/dmx/dmxinput.c
+++ b/xorg-server/hw/dmx/dmxinput.c
@@ -53,7 +53,8 @@
/** Returns TRUE if the key is a valid modifier. For PC-class
* keyboards, all keys can be used as modifiers, so return TRUE
* always. */
-Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
+Bool
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
return TRUE;
}
@@ -61,21 +62,23 @@ Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
/** Called from dix/main.c on each server generation to initialize
* inputs. All the work is done in dmxInputInit. \see
* dmxInputInit() */
-void InitInput(int argc, char **argv)
+void
+InitInput(int argc, char **argv)
{
- int i;
+ int i;
DMXInputInfo *dmxInput;
if (!dmxNumInputs)
dmxLog(dmxFatal, "InitInput: no inputs specified\n");
-
+
for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
dmxInputInit(dmxInput);
mieqInit();
}
-void CloseInput(void)
+void
+CloseInput(void)
{
mieqFini();
}
@@ -83,9 +86,10 @@ void CloseInput(void)
/** Called from dix/dispatch.c in Dispatch() whenever input events
* require processing. All the work is done in the lower level
* routines. */
-void ProcessInputEvents(void)
+void
+ProcessInputEvents(void)
{
- int i;
+ int i;
DMXInputInfo *dmxInput;
for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
@@ -97,9 +101,10 @@ void ProcessInputEvents(void)
* windows on the display might have changed. This information is used
* by input drivers (currently only the console driver) that provide
* information about window layout to the user. */
-void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow)
+void
+dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow)
{
- int i;
+ int i;
DMXInputInfo *dmxInput;
for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
@@ -108,8 +113,8 @@ void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow)
}
int
-NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
- DeviceIntPtr *pdev)
+NewInputDeviceRequest(InputOption *options, InputAttributes * attrs,
+ DeviceIntPtr *pdev)
{
return BadRequest;
}
diff --git a/xorg-server/hw/dmx/dmxinput.h b/xorg-server/hw/dmx/dmxinput.h
index edfff9fa1..83c9c8b95 100644
--- a/xorg-server/hw/dmx/dmxinput.h
+++ b/xorg-server/hw/dmx/dmxinput.h
@@ -43,7 +43,7 @@
* hw/dmx/input -- the interface defined here should be the only
* interface exported to the hw/dmx layer. \see input/dmxinputinit.c.
*/
-
+
#ifndef DMXINPUT_H
#define DMXINPUT_H
@@ -62,9 +62,9 @@ typedef enum {
DMX_UPDATE_REPARENT /**< Window reparented */
} DMXUpdateType;
-typedef void (*ProcessInputEventsProc)(struct _DMXInputInfo *);
-typedef void (*UpdateWindowInfoProc)(struct _DMXInputInfo *,
- DMXUpdateType, WindowPtr);
+typedef void (*ProcessInputEventsProc) (struct _DMXInputInfo *);
+typedef void (*UpdateWindowInfoProc) (struct _DMXInputInfo *,
+ DMXUpdateType, WindowPtr);
/** An opaque structure that is only exposed in the dmx/input layer. */
typedef struct _DMXLocalInputInfo *DMXLocalInputInfoPtr;
@@ -82,79 +82,79 @@ typedef enum {
* access to the global pointers. However, the elements are only
* available to input-related routines. */
struct _DMXInputInfo {
- const char *name; /**< Name of input display or device
+ const char *name; /**< Name of input display or device
* (from command line or config
* file) */
- Bool freename; /**< If true, free name on destroy */
- Bool detached; /**< If true, input screen is detached */
- int inputIdx; /**< Index into #dmxInputs global */
- int scrnIdx; /**< Index into #dmxScreens global */
- Bool core; /**< If True, initialize these
+ Bool freename; /**< If true, free name on destroy */
+ Bool detached; /**< If true, input screen is detached */
+ int inputIdx; /**< Index into #dmxInputs global */
+ int scrnIdx; /**< Index into #dmxScreens global */
+ Bool core; /**< If True, initialize these
* devices as devices that send core
* events */
- Bool console; /**< True if console and backend
+ Bool console; /**< True if console and backend
* input share the same backend
* display */
- Bool windows; /**< True if window outlines are
+ Bool windows; /**< True if window outlines are
* draw in console */
- ProcessInputEventsProc processInputEvents;
- UpdateWindowInfoProc updateWindowInfo;
+ ProcessInputEventsProc processInputEvents;
+ UpdateWindowInfoProc updateWindowInfo;
- /* Local input information */
- dmxSigioState sigioState; /**< Current stat */
- int sigioFdCount; /**< Number of fds in use */
- int sigioFd[DMX_MAX_SIGIO_FDS]; /**< List of fds */
- Bool sigioAdded[DMX_MAX_SIGIO_FDS]; /**< Active fds */
+ /* Local input information */
+ dmxSigioState sigioState; /**< Current stat */
+ int sigioFdCount; /**< Number of fds in use */
+ int sigioFd[DMX_MAX_SIGIO_FDS]; /**< List of fds */
+ Bool sigioAdded[DMX_MAX_SIGIO_FDS]; /**< Active fds */
-
/** True if a VT switch is pending, but has not yet happened. */
- int vt_switch_pending;
+ int vt_switch_pending;
/** True if a VT switch has happened. */
- int vt_switched;
+ int vt_switched;
/** Number of devices handled in this _DMXInputInfo structure. */
- int numDevs;
+ int numDevs;
/** List of actual input devices. Each _DMXInputInfo structure can
* refer to more than one device. For example, the keyboard and the
* pointer of a backend display; or all of the XInput extension
* devices on a backend display. */
- DMXLocalInputInfoPtr *devs;
+ DMXLocalInputInfoPtr *devs;
- char *keycodes; /**< XKB keycodes from command line */
- char *symbols; /**< XKB symbols from command line */
- char *geometry; /**< XKB geometry from command line */
+ char *keycodes; /**< XKB keycodes from command line */
+ char *symbols; /**< XKB symbols from command line */
+ char *geometry; /**< XKB geometry from command line */
};
-extern int dmxNumInputs; /**< Number of #dmxInputs */
-extern DMXInputInfo *dmxInputs; /**< List of inputs */
+extern int dmxNumInputs; /**< Number of #dmxInputs */
+extern DMXInputInfo *dmxInputs; /**< List of inputs */
-extern void dmxInputInit(DMXInputInfo *dmxInput);
-extern void dmxInputReInit(DMXInputInfo *dmxInput);
-extern void dmxInputLateReInit(DMXInputInfo *dmxInput);
-extern void dmxInputFree(DMXInputInfo *dmxInput);
+extern void dmxInputInit(DMXInputInfo * dmxInput);
+extern void dmxInputReInit(DMXInputInfo * dmxInput);
+extern void dmxInputLateReInit(DMXInputInfo * dmxInput);
+extern void dmxInputFree(DMXInputInfo * dmxInput);
extern void dmxInputLogDevices(void);
extern void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow);
/* These functions are defined in input/dmxeq.c */
-extern void dmxeqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen, Bool fromDIX);
+extern void dmxeqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen,
+ Bool fromDIX);
/* This type is used in input/dmxevents.c. Also, these functions are
* defined in input/dmxevents.c */
typedef enum {
DMX_NO_BLOCK = 0,
- DMX_BLOCK = 1
+ DMX_BLOCK = 1
} DMXBlockType;
-extern void dmxGetGlobalPosition(int *x, int *y);
+extern void dmxGetGlobalPosition(int *x, int *y);
extern DMXScreenInfo *dmxFindFirstScreen(int x, int y);
-extern void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta,
- DMXBlockType block);
+extern void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta,
+ DMXBlockType block);
/* Support for dynamic addition of inputs. This functions is defined in
* config/dmxconfig.c */
extern DMXInputInfo *dmxConfigAddInput(const char *name, int core);
-#endif /* DMXINPUT_H */
+#endif /* DMXINPUT_H */
diff --git a/xorg-server/hw/dmx/dmxlog.c b/xorg-server/hw/dmx/dmxlog.c
index 94b803528..b56bb93ed 100644
--- a/xorg-server/hw/dmx/dmxlog.c
+++ b/xorg-server/hw/dmx/dmxlog.c
@@ -49,16 +49,20 @@ static dmxLogLevel dmxCurrentLogLevel = dmxDebug;
/** Set the default level for logging to #dmxLogLevel. Returns the
* previous log level. */
-dmxLogLevel dmxSetLogLevel(dmxLogLevel newLevel)
+dmxLogLevel
+dmxSetLogLevel(dmxLogLevel newLevel)
{
dmxLogLevel oldLevel = dmxCurrentLogLevel;
- if (newLevel > dmxFatal) newLevel = dmxFatal;
+
+ if (newLevel > dmxFatal)
+ newLevel = dmxFatal;
dmxCurrentLogLevel = newLevel;
return oldLevel;
}
/** Returns the log level set by #dmxLogLevel. */
-dmxLogLevel dmxGetLogLevel(void)
+dmxLogLevel
+dmxGetLogLevel(void)
{
return dmxCurrentLogLevel;
}
@@ -68,37 +72,41 @@ dmxLogLevel dmxGetLogLevel(void)
* program, then the ultimate output routines have to be defined. */
/** Provide an ErrorF function when used stand-alone. */
-void ErrorF(const char *format, ...)
+void
+ErrorF(const char *format, ...)
{
va_list args;
va_start(args, format);
- vfprintf(stderr, format, args); /* RATS: We assume the format string
- * is trusted, since it is always
- * from a log message in our code. */
+ vfprintf(stderr, format, args); /* RATS: We assume the format string
+ * is trusted, since it is always
+ * from a log message in our code. */
va_end(args);
}
/** Provide an VFatalError function when used stand-alone. */
-static void VFatalError(const char *format, va_list args)
+static void
+VFatalError(const char *format, va_list args)
{
- vfprintf(stderr, format, args); /* RATS: We assume the format string
- * is trusted, since it is always
- * from a log message in our code. */
+ vfprintf(stderr, format, args); /* RATS: We assume the format string
+ * is trusted, since it is always
+ * from a log message in our code. */
exit(1);
}
/** Provide an VErrorF function when used stand-alone. */
-void VErrorF(const char *format, va_list args)
+void
+VErrorF(const char *format, va_list args)
{
- vfprintf(stderr, format, args); /* RATS: We assume the format string
- * is trusted, since it is always
- * from a log message in our code. */
+ vfprintf(stderr, format, args); /* RATS: We assume the format string
+ * is trusted, since it is always
+ * from a log message in our code. */
}
#else
/** This function was removed between XFree86 4.3.0 and XFree86 4.4.0. */
extern void AbortServer(void);
-static void VFatalError(const char *format, va_list args)
+static void
+VFatalError(const char *format, va_list args)
{
VErrorF(format, args);
ErrorF("\n");
@@ -106,60 +114,75 @@ static void VFatalError(const char *format, va_list args)
OsVendorFatalError();
#endif
AbortServer();
- /*NOTREACHED*/
-}
+ /*NOTREACHED*/}
#endif
/* Prints a consistent header for each line. */
-static void dmxHeader(dmxLogLevel logLevel, DMXInputInfo *dmxInput,
- DMXScreenInfo *dmxScreen)
+static void
+dmxHeader(dmxLogLevel logLevel, DMXInputInfo * dmxInput,
+ DMXScreenInfo * dmxScreen)
{
const char *type = "??";
switch (logLevel) {
- case dmxDebug: type = ".."; break;
- case dmxInfo: type = "II"; break;
- case dmxWarning: type = "**"; break;
- case dmxError: type = "!!"; break;
- case dmxFatal: type = "Fatal Error"; break;
+ case dmxDebug:
+ type = "..";
+ break;
+ case dmxInfo:
+ type = "II";
+ break;
+ case dmxWarning:
+ type = "**";
+ break;
+ case dmxError:
+ type = "!!";
+ break;
+ case dmxFatal:
+ type = "Fatal Error";
+ break;
}
if (dmxInput && dmxScreen) {
ErrorF("(%s) dmx[i%d/%s;o%d/%s]: ", type,
dmxInput->inputIdx, dmxInput->name,
dmxScreen->index, dmxScreen->name);
- } else if (dmxScreen) {
- ErrorF("(%s) dmx[o%d/%s]: ", type,
- dmxScreen->index, dmxScreen->name);
- } else if (dmxInput) {
+ }
+ else if (dmxScreen) {
+ ErrorF("(%s) dmx[o%d/%s]: ", type, dmxScreen->index, dmxScreen->name);
+ }
+ else if (dmxInput) {
const char *pt = strchr(dmxInput->name, ',');
- int len = (pt
- ? (size_t)(pt-dmxInput->name)
- : strlen(dmxInput->name));
+ int len = (pt ? (size_t) (pt - dmxInput->name)
+ : strlen(dmxInput->name));
ErrorF("(%s) dmx[i%d/%*.*s]: ", type,
dmxInput->inputIdx, len, len, dmxInput->name);
- } else {
+ }
+ else {
ErrorF("(%s) dmx: ", type);
}
}
/* Prints the error message with the appropriate low-level X output
* routine. */
-static void dmxMessage(dmxLogLevel logLevel, const char *format, va_list args)
+static void
+dmxMessage(dmxLogLevel logLevel, const char *format, va_list args)
{
if (logLevel == dmxFatal || logLevel >= dmxCurrentLogLevel) {
- if (logLevel == dmxFatal) VFatalError(format, args);
- else VErrorF(format, args);
+ if (logLevel == dmxFatal)
+ VFatalError(format, args);
+ else
+ VErrorF(format, args);
}
}
/** Log the specified message at the specified \a logLevel. \a format
* can be a printf-like format expression. */
-void dmxLog(dmxLogLevel logLevel, const char *format, ...)
+void
+dmxLog(dmxLogLevel logLevel, const char *format, ...)
{
va_list args;
-
+
dmxHeader(logLevel, NULL, NULL);
va_start(args, format);
dmxMessage(logLevel, format, args);
@@ -167,7 +190,8 @@ void dmxLog(dmxLogLevel logLevel, const char *format, ...)
}
/** Continue a log message without printing the message prefix. */
-void dmxLogCont(dmxLogLevel logLevel, const char *format, ...)
+void
+dmxLogCont(dmxLogLevel logLevel, const char *format, ...)
{
va_list args;
@@ -180,7 +204,8 @@ void dmxLogCont(dmxLogLevel logLevel, const char *format, ...)
/** Log an informational message (at level #dmxInfo) related to ouput.
* The message prefix will contain backend information from \a
* dmxScreen. */
-void dmxLogOutput(DMXScreenInfo *dmxScreen, const char *format, ...)
+void
+dmxLogOutput(DMXScreenInfo * dmxScreen, const char *format, ...)
{
va_list args;
@@ -192,7 +217,8 @@ void dmxLogOutput(DMXScreenInfo *dmxScreen, const char *format, ...)
/** Continue a message related to output without printing the message
* prefix. */
-void dmxLogOutputCont(DMXScreenInfo *dmxScreen, const char *format, ...)
+void
+dmxLogOutputCont(DMXScreenInfo * dmxScreen, const char *format, ...)
{
va_list args;
@@ -204,7 +230,8 @@ void dmxLogOutputCont(DMXScreenInfo *dmxScreen, const char *format, ...)
/** Log a warning message (at level #dmxWarning) related to output.
* The message prefix will contain backend information from \a
* dmxScreen. */
-void dmxLogOutputWarning(DMXScreenInfo *dmxScreen, const char *format, ...)
+void
+dmxLogOutputWarning(DMXScreenInfo * dmxScreen, const char *format, ...)
{
va_list args;
@@ -216,7 +243,8 @@ void dmxLogOutputWarning(DMXScreenInfo *dmxScreen, const char *format, ...)
/** Log an informational message (at level #dmxInfo) related to input.
* The message prefix will contain information from \a dmxInput. */
-void dmxLogInput(DMXInputInfo *dmxInput, const char *format, ...)
+void
+dmxLogInput(DMXInputInfo * dmxInput, const char *format, ...)
{
va_list args;
@@ -228,7 +256,8 @@ void dmxLogInput(DMXInputInfo *dmxInput, const char *format, ...)
/** Continue a message related to input without printing the message
* prefix. */
-void dmxLogInputCont(DMXInputInfo *dmxInput, const char *format, ...)
+void
+dmxLogInputCont(DMXInputInfo * dmxInput, const char *format, ...)
{
va_list args;
@@ -239,25 +268,40 @@ void dmxLogInputCont(DMXInputInfo *dmxInput, const char *format, ...)
/** Print \a argc messages, each describing an element in \a argv. This
* is maingly for debugging purposes. */
-void dmxLogArgs(dmxLogLevel logLevel, int argc, char **argv)
+void
+dmxLogArgs(dmxLogLevel logLevel, int argc, char **argv)
{
int i;
+
for (i = 0; i < argc; i++)
dmxLog(logLevel, " Arg[%d] = \"%s\"\n", i, argv[i]);
}
/** Print messages at level #dmxInfo describing the visuals in \a vi. */
-void dmxLogVisual(DMXScreenInfo *dmxScreen, XVisualInfo *vi, int defaultVisual)
+void
+dmxLogVisual(DMXScreenInfo * dmxScreen, XVisualInfo * vi, int defaultVisual)
{
- const char *class = "Unknown";
+ const char *class = "Unknown";
switch (vi->class) {
- case StaticGray: class = "StaticGray "; break;
- case GrayScale: class = "GrayScale "; break;
- case StaticColor: class = "StaticColor"; break;
- case PseudoColor: class = "PseudoColor"; break;
- case TrueColor: class = "TrueColor "; break;
- case DirectColor: class = "DirectColor"; break;
+ case StaticGray:
+ class = "StaticGray ";
+ break;
+ case GrayScale:
+ class = "GrayScale ";
+ break;
+ case StaticColor:
+ class = "StaticColor";
+ break;
+ case PseudoColor:
+ class = "PseudoColor";
+ break;
+ case TrueColor:
+ class = "TrueColor ";
+ break;
+ case DirectColor:
+ class = "DirectColor";
+ break;
}
if (dmxScreen) {
@@ -267,7 +311,8 @@ void dmxLogVisual(DMXScreenInfo *dmxScreen, XVisualInfo *vi, int defaultVisual)
vi->colormap_size,
vi->red_mask, vi->green_mask, vi->blue_mask,
defaultVisual ? " *" : "");
- } else {
+ }
+ else {
dmxLog(dmxInfo,
" 0x%02x %s %2db %db/rgb %3d 0x%04x 0x%04x 0x%04x%s\n",
vi->visualid, class, vi->depth, vi->bits_per_rgb,
@@ -279,68 +324,119 @@ void dmxLogVisual(DMXScreenInfo *dmxScreen, XVisualInfo *vi, int defaultVisual)
/** Translate a (normalized) XInput event \a type into a human-readable
* string. */
-const char *dmxXInputEventName(int type)
+const char *
+dmxXInputEventName(int type)
{
switch (type) {
- case XI_DeviceValuator: return "XI_DeviceValuator";
- case XI_DeviceKeyPress: return "XI_DeviceKeyPress";
- case XI_DeviceKeyRelease: return "XI_DeviceKeyRelease";
- case XI_DeviceButtonPress: return "XI_DeviceButtonPress";
- case XI_DeviceButtonRelease: return "XI_DeviceButtonRelease";
- case XI_DeviceMotionNotify: return "XI_DeviceMotionNotify";
- case XI_DeviceFocusIn: return "XI_DeviceFocusIn";
- case XI_DeviceFocusOut: return "XI_DeviceFocusOut";
- case XI_ProximityIn: return "XI_ProximityIn";
- case XI_ProximityOut: return "XI_ProximityOut";
- case XI_DeviceStateNotify: return "XI_DeviceStateNotify";
- case XI_DeviceMappingNotify: return "XI_DeviceMappingNotify";
- case XI_ChangeDeviceNotify: return "XI_ChangeDeviceNotify";
- case XI_DeviceKeystateNotify: return "XI_DeviceKeystateNotify";
- case XI_DeviceButtonstateNotify: return "XI_DeviceButtonstateNotify";
- default: return "unknown";
+ case XI_DeviceValuator:
+ return "XI_DeviceValuator";
+ case XI_DeviceKeyPress:
+ return "XI_DeviceKeyPress";
+ case XI_DeviceKeyRelease:
+ return "XI_DeviceKeyRelease";
+ case XI_DeviceButtonPress:
+ return "XI_DeviceButtonPress";
+ case XI_DeviceButtonRelease:
+ return "XI_DeviceButtonRelease";
+ case XI_DeviceMotionNotify:
+ return "XI_DeviceMotionNotify";
+ case XI_DeviceFocusIn:
+ return "XI_DeviceFocusIn";
+ case XI_DeviceFocusOut:
+ return "XI_DeviceFocusOut";
+ case XI_ProximityIn:
+ return "XI_ProximityIn";
+ case XI_ProximityOut:
+ return "XI_ProximityOut";
+ case XI_DeviceStateNotify:
+ return "XI_DeviceStateNotify";
+ case XI_DeviceMappingNotify:
+ return "XI_DeviceMappingNotify";
+ case XI_ChangeDeviceNotify:
+ return "XI_ChangeDeviceNotify";
+ case XI_DeviceKeystateNotify:
+ return "XI_DeviceKeystateNotify";
+ case XI_DeviceButtonstateNotify:
+ return "XI_DeviceButtonstateNotify";
+ default:
+ return "unknown";
}
}
#endif
/** Translate an event \a type into a human-readable string. */
-const char *dmxEventName(int type)
+const char *
+dmxEventName(int type)
{
switch (type) {
- case KeyPress: return "KeyPress";
- case KeyRelease: return "KeyRelease";
- case ButtonPress: return "ButtonPress";
- case ButtonRelease: return "ButtonRelease";
- case MotionNotify: return "MotionNotify";
- case EnterNotify: return "EnterNotify";
- case LeaveNotify: return "LeaveNotify";
- case FocusIn: return "FocusIn";
- case FocusOut: return "FocusOut";
- case KeymapNotify: return "KeymapNotify";
- case Expose: return "Expose";
- case GraphicsExpose: return "GraphicsExpose";
- case NoExpose: return "NoExpose";
- case VisibilityNotify: return "VisibilityNotify";
- case CreateNotify: return "CreateNotify";
- case DestroyNotify: return "DestroyNotify";
- case UnmapNotify: return "UnmapNotify";
- case MapNotify: return "MapNotify";
- case MapRequest: return "MapRequest";
- case ReparentNotify: return "ReparentNotify";
- case ConfigureNotify: return "ConfigureNotify";
- case ConfigureRequest: return "ConfigureRequest";
- case GravityNotify: return "GravityNotify";
- case ResizeRequest: return "ResizeRequest";
- case CirculateNotify: return "CirculateNotify";
- case CirculateRequest: return "CirculateRequest";
- case PropertyNotify: return "PropertyNotify";
- case SelectionClear: return "SelectionClear";
- case SelectionRequest: return "SelectionRequest";
- case SelectionNotify: return "SelectionNotify";
- case ColormapNotify: return "ColormapNotify";
- case ClientMessage: return "ClientMessage";
- case MappingNotify: return "MappingNotify";
- default: return "<unknown>";
+ case KeyPress:
+ return "KeyPress";
+ case KeyRelease:
+ return "KeyRelease";
+ case ButtonPress:
+ return "ButtonPress";
+ case ButtonRelease:
+ return "ButtonRelease";
+ case MotionNotify:
+ return "MotionNotify";
+ case EnterNotify:
+ return "EnterNotify";
+ case LeaveNotify:
+ return "LeaveNotify";
+ case FocusIn:
+ return "FocusIn";
+ case FocusOut:
+ return "FocusOut";
+ case KeymapNotify:
+ return "KeymapNotify";
+ case Expose:
+ return "Expose";
+ case GraphicsExpose:
+ return "GraphicsExpose";
+ case NoExpose:
+ return "NoExpose";
+ case VisibilityNotify:
+ return "VisibilityNotify";
+ case CreateNotify:
+ return "CreateNotify";
+ case DestroyNotify:
+ return "DestroyNotify";
+ case UnmapNotify:
+ return "UnmapNotify";
+ case MapNotify:
+ return "MapNotify";
+ case MapRequest:
+ return "MapRequest";
+ case ReparentNotify:
+ return "ReparentNotify";
+ case ConfigureNotify:
+ return "ConfigureNotify";
+ case ConfigureRequest:
+ return "ConfigureRequest";
+ case GravityNotify:
+ return "GravityNotify";
+ case ResizeRequest:
+ return "ResizeRequest";
+ case CirculateNotify:
+ return "CirculateNotify";
+ case CirculateRequest:
+ return "CirculateRequest";
+ case PropertyNotify:
+ return "PropertyNotify";
+ case SelectionClear:
+ return "SelectionClear";
+ case SelectionRequest:
+ return "SelectionRequest";
+ case SelectionNotify:
+ return "SelectionNotify";
+ case ColormapNotify:
+ return "ColormapNotify";
+ case ClientMessage:
+ return "ClientMessage";
+ case MappingNotify:
+ return "MappingNotify";
+ default:
+ return "<unknown>";
}
}
-
diff --git a/xorg-server/hw/dmx/dmxpict.c b/xorg-server/hw/dmx/dmxpict.c
index 1ea6543e0..b1177cf41 100644
--- a/xorg-server/hw/dmx/dmxpict.c
+++ b/xorg-server/hw/dmx/dmxpict.c
@@ -1,1237 +1,1280 @@
-/*
- * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <kem@redhat.com>
- *
- */
-
-/** \file
- * Provide support for the RENDER extension (version 0.8).
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxsync.h"
-#include "dmxpict.h"
-#include "dmxwindow.h"
-#include "dmxpixmap.h"
-
-#include "fb.h"
-#include "pixmapstr.h"
-#include "dixstruct.h"
-
-#include <X11/extensions/render.h>
-#include <X11/extensions/renderproto.h>
-#include <X11/extensions/Xfixes.h>
-#include "picture.h"
-#include "picturestr.h"
-#include "mipict.h"
-#include "fbpict.h"
-
-
-extern int RenderErrBase;
-extern int (*ProcRenderVector[RenderNumberRequests])(ClientPtr);
-
-static int (*dmxSaveRenderVector[RenderNumberRequests])(ClientPtr);
-
-
-static int dmxProcRenderCreateGlyphSet(ClientPtr client);
-static int dmxProcRenderFreeGlyphSet(ClientPtr client);
-static int dmxProcRenderAddGlyphs(ClientPtr client);
-static int dmxProcRenderFreeGlyphs(ClientPtr client);
-static int dmxProcRenderCompositeGlyphs(ClientPtr client);
-static int dmxProcRenderSetPictureTransform(ClientPtr client);
-static int dmxProcRenderSetPictureFilter(ClientPtr client);
-#if 0
-/* FIXME: Not (yet) supported */
-static int dmxProcRenderCreateCursor(ClientPtr client);
-static int dmxProcRenderCreateAnimCursor(ClientPtr client);
-#endif
-
-/** Catch errors that might occur when allocating Glyph Sets. Errors
- * are saved in dmxGlyphLastError for later handling. */
-static int dmxGlyphLastError;
-static int dmxGlyphErrorHandler(Display *dpy, XErrorEvent *ev)
-{
- dmxGlyphLastError = ev->error_code;
- return 0;
-}
-
-
-/** Initialize the Proc Vector for the RENDER extension. The functions
- * here cannot be handled by the mi layer RENDER hooks either because
- * the required information is no longer available when it reaches the
- * mi layer or no mi layer hooks exist. This function is called from
- * InitOutput() since it should be initialized only once per server
- * generation. */
-void dmxInitRender(void)
-{
- int i;
-
- for (i = 0; i < RenderNumberRequests; i++)
- dmxSaveRenderVector[i] = ProcRenderVector[i];
-
- ProcRenderVector[X_RenderCreateGlyphSet]
- = dmxProcRenderCreateGlyphSet;
- ProcRenderVector[X_RenderFreeGlyphSet]
- = dmxProcRenderFreeGlyphSet;
- ProcRenderVector[X_RenderAddGlyphs]
- = dmxProcRenderAddGlyphs;
- ProcRenderVector[X_RenderFreeGlyphs]
- = dmxProcRenderFreeGlyphs;
- ProcRenderVector[X_RenderCompositeGlyphs8]
- = dmxProcRenderCompositeGlyphs;
- ProcRenderVector[X_RenderCompositeGlyphs16]
- = dmxProcRenderCompositeGlyphs;
- ProcRenderVector[X_RenderCompositeGlyphs32]
- = dmxProcRenderCompositeGlyphs;
- ProcRenderVector[X_RenderSetPictureTransform]
- = dmxProcRenderSetPictureTransform;
- ProcRenderVector[X_RenderSetPictureFilter]
- = dmxProcRenderSetPictureFilter;
-}
-
-/** Reset the Proc Vector for the RENDER extension back to the original
- * functions. This function is called from dmxCloseScreen() during the
- * server reset (only for screen #0). */
-void dmxResetRender(void)
-{
- int i;
-
- for (i = 0; i < RenderNumberRequests; i++)
- ProcRenderVector[i] = dmxSaveRenderVector[i];
-}
-
-/** Initialize the RENDER extension, allocate the picture privates and
- * wrap mi function hooks. If the shadow frame buffer is used, then
- * call the appropriate fb initialization function. */
-Bool dmxPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps;
-
- /* The shadow framebuffer only relies on FB to be initialized */
- if (dmxShadowFB) return fbPictureInit(pScreen, formats, nformats);
-
- if (!miPictureInit(pScreen, formats, nformats))
- return FALSE;
-
- if (!dixRegisterPrivateKey(&dmxPictPrivateKeyRec, PRIVATE_PICTURE, sizeof(dmxPictPrivRec)))
- return FALSE;
-
- ps = GetPictureScreen(pScreen);
-
- DMX_WRAP(CreatePicture, dmxCreatePicture, dmxScreen, ps);
- DMX_WRAP(DestroyPicture, dmxDestroyPicture, dmxScreen, ps);
-
- DMX_WRAP(ChangePictureClip, dmxChangePictureClip, dmxScreen, ps);
- DMX_WRAP(DestroyPictureClip, dmxDestroyPictureClip, dmxScreen, ps);
-
- DMX_WRAP(ChangePicture, dmxChangePicture, dmxScreen, ps);
- DMX_WRAP(ValidatePicture, dmxValidatePicture, dmxScreen, ps);
-
- DMX_WRAP(Composite, dmxComposite, dmxScreen, ps);
- DMX_WRAP(Glyphs, dmxGlyphs, dmxScreen, ps);
- DMX_WRAP(CompositeRects, dmxCompositeRects, dmxScreen, ps);
-
- DMX_WRAP(Trapezoids, dmxTrapezoids, dmxScreen, ps);
- DMX_WRAP(Triangles, dmxTriangles, dmxScreen, ps);
-
- return TRUE;
-}
-
-
-/** Find the appropriate format on the requested screen given the
- * internal format requested. The list of formats is searched
- * sequentially as the XRenderFindFormat() function does not always
- * find the appropriate format when a specific format is requested. */
-static XRenderPictFormat *dmxFindFormat(DMXScreenInfo *dmxScreen,
- PictFormatPtr pFmt)
-{
- XRenderPictFormat *pFormat = NULL;
- int i = 0;
-
- if (!pFmt || !dmxScreen->beDisplay) return pFormat;
-
- while (1) {
- pFormat = XRenderFindFormat(dmxScreen->beDisplay, 0, 0, i++);
- if (!pFormat) break;
-
- if (pFormat->type != pFmt->type) continue;
- if (pFormat->depth != pFmt->depth) continue;
- if (pFormat->direct.red != pFmt->direct.red) continue;
- if (pFormat->direct.redMask != pFmt->direct.redMask) continue;
- if (pFormat->direct.green != pFmt->direct.green) continue;
- if (pFormat->direct.greenMask != pFmt->direct.greenMask) continue;
- if (pFormat->direct.blue != pFmt->direct.blue) continue;
- if (pFormat->direct.blueMask != pFmt->direct.blueMask) continue;
- if (pFormat->direct.alpha != pFmt->direct.alpha) continue;
- if (pFormat->direct.alphaMask != pFmt->direct.alphaMask) continue;
-
- /* We have a match! */
- break;
- }
-
- return pFormat;
-}
-
-/** Free \a glyphSet on back-end screen number \a idx. */
-Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet)
-{
- dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
- int idx = pScreen->myNum;
- DMXScreenInfo *dmxScreen = &dmxScreens[idx];
-
- if (glyphPriv->glyphSets[idx]) {
- XRenderFreeGlyphSet(dmxScreen->beDisplay, glyphPriv->glyphSets[idx]);
- glyphPriv->glyphSets[idx] = (GlyphSet)0;
- return TRUE;
- }
-
- return FALSE;
-}
-
-/** Create \a glyphSet on the backend screen number \a idx. */
-int dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet)
-{
- XRenderPictFormat *pFormat;
- DMXScreenInfo *dmxScreen = &dmxScreens[idx];
- dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
- PictFormatPtr pFmt = glyphSet->format;
- int (*oldErrorHandler)(Display *, XErrorEvent *);
-
- pFormat = dmxFindFormat(dmxScreen, pFmt);
- if (!pFormat) {
- return BadMatch;
- }
-
- dmxGlyphLastError = 0;
- oldErrorHandler = XSetErrorHandler(dmxGlyphErrorHandler);
-
- /* Catch when this fails */
- glyphPriv->glyphSets[idx]
- = XRenderCreateGlyphSet(dmxScreen->beDisplay, pFormat);
-
- XSetErrorHandler(oldErrorHandler);
-
- if (dmxGlyphLastError) {
- return dmxGlyphLastError;
- }
-
- return Success;
-}
-
-/** Create a Glyph Set on each screen. Save the glyphset ID from each
- * screen in the Glyph Set's private structure. Fail if the format
- * requested is not available or if the Glyph Set cannot be created on
- * the screen. */
-static int dmxProcRenderCreateGlyphSet(ClientPtr client)
-{
- int ret;
- REQUEST(xRenderCreateGlyphSetReq);
-
- ret = dmxSaveRenderVector[stuff->renderReqType](client);
-
- if (ret == Success) {
- GlyphSetPtr glyphSet;
- dmxGlyphPrivPtr glyphPriv;
- int i;
-
- /* Look up glyphSet that was just created ???? */
- /* Store glyphsets from backends in glyphSet->devPrivate ????? */
- /* Make sure we handle all errors here!! */
-
- dixLookupResourceByType((pointer*) &glyphSet,
- stuff->gsid, GlyphSetType,
- client, DixDestroyAccess);
-
- glyphPriv = malloc(sizeof(dmxGlyphPrivRec));
- if (!glyphPriv) return BadAlloc;
- glyphPriv->glyphSets = NULL;
- MAXSCREENSALLOC_RETURN(glyphPriv->glyphSets, BadAlloc);
- DMX_SET_GLYPH_PRIV(glyphSet, glyphPriv);
-
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- int beret;
-
- if (!dmxScreen->beDisplay) {
- glyphPriv->glyphSets[i] = 0;
- continue;
- }
-
- if ((beret = dmxBECreateGlyphSet(i, glyphSet)) != Success) {
- int j;
-
- /* Free the glyph sets we've allocated thus far */
- for (j = 0; j < i; j++)
- dmxBEFreeGlyphSet(screenInfo.screens[j], glyphSet);
-
- /* Free the resource created by render */
- FreeResource(stuff->gsid, RT_NONE);
-
- return beret;
- }
- }
- }
-
- return ret;
-}
-
-/** Free the previously allocated Glyph Sets for each screen. */
-static int dmxProcRenderFreeGlyphSet(ClientPtr client)
-{
- GlyphSetPtr glyphSet;
- REQUEST(xRenderFreeGlyphSetReq);
-
- REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
- dixLookupResourceByType((pointer*) &glyphSet,
- stuff->glyphset, GlyphSetType,
- client, DixDestroyAccess);
-
- if (glyphSet && glyphSet->refcnt == 1) {
- dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
- int i;
-
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
-
- if (dmxScreen->beDisplay) {
- if (dmxBEFreeGlyphSet(screenInfo.screens[i], glyphSet))
- dmxSync(dmxScreen, FALSE);
- }
- }
-
- MAXSCREENSFREE(glyphPriv->glyphSets);
- free(glyphPriv);
- DMX_SET_GLYPH_PRIV(glyphSet, NULL);
- }
-
- return dmxSaveRenderVector[stuff->renderReqType](client);
-}
-
-/** Add glyphs to the Glyph Set on each screen. */
-static int dmxProcRenderAddGlyphs(ClientPtr client)
-{
- int ret;
- REQUEST(xRenderAddGlyphsReq);
-
- ret = dmxSaveRenderVector[stuff->renderReqType](client);
-
- if (ret == Success) {
- GlyphSetPtr glyphSet;
- dmxGlyphPrivPtr glyphPriv;
- int i;
- int nglyphs;
- CARD32 *gids;
- Glyph *gidsCopy;
- xGlyphInfo *gi;
- CARD8 *bits;
- int nbytes;
-
- dixLookupResourceByType((pointer*) &glyphSet,
- stuff->glyphset, GlyphSetType,
- client, DixReadAccess);
- glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
-
- nglyphs = stuff->nglyphs;
- gids = (CARD32 *)(stuff + 1);
- gi = (xGlyphInfo *)(gids + nglyphs);
- bits = (CARD8 *)(gi + nglyphs);
- nbytes = ((stuff->length << 2) -
- sizeof(xRenderAddGlyphsReq) -
- (sizeof(CARD32) + sizeof(xGlyphInfo)) * nglyphs);
-
- gidsCopy = malloc(sizeof(*gidsCopy) * nglyphs);
- for (i = 0; i < nglyphs; i++) gidsCopy[i] = gids[i];
-
- /* FIXME: Will this ever fail? */
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
-
- if (dmxScreen->beDisplay) {
- XRenderAddGlyphs(dmxScreen->beDisplay,
- glyphPriv->glyphSets[i],
- gidsCopy,
- (XGlyphInfo *)gi,
- nglyphs,
- (char *)bits,
- nbytes);
- dmxSync(dmxScreen, FALSE);
- }
- }
- free(gidsCopy);
- }
-
- return ret;
-}
-
-/** Free glyphs from the Glyph Set for each screen. */
-static int dmxProcRenderFreeGlyphs(ClientPtr client)
-{
- GlyphSetPtr glyphSet;
- REQUEST(xRenderFreeGlyphsReq);
-
- REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq);
- dixLookupResourceByType((pointer*) &glyphSet,
- stuff->glyphset, GlyphSetType,
- client, DixWriteAccess);
-
- if (glyphSet) {
- dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
- int i;
- int nglyphs;
- Glyph *gids;
-
- nglyphs = ((client->req_len << 2) - sizeof(xRenderFreeGlyphsReq)) >> 2;
- if (nglyphs) {
- gids = malloc(sizeof(*gids) * nglyphs);
- for (i = 0; i < nglyphs; i++)
- gids[i] = ((CARD32 *)(stuff + 1))[i];
-
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
-
- if (dmxScreen->beDisplay) {
- XRenderFreeGlyphs(dmxScreen->beDisplay,
- glyphPriv->glyphSets[i], gids, nglyphs);
- dmxSync(dmxScreen, FALSE);
- }
- }
- free(gids);
- }
- }
-
- return dmxSaveRenderVector[stuff->renderReqType](client);
-}
-
-/** Composite glyphs on each screen into the requested picture. If
- * either the src or dest picture has not been allocated due to lazy
- * window creation, this request will gracefully return. */
-static int dmxProcRenderCompositeGlyphs(ClientPtr client)
-{
- int ret;
- REQUEST(xRenderCompositeGlyphsReq);
-
- ret = dmxSaveRenderVector[stuff->renderReqType](client);
-
- /* For the following to work with PanoramiX, it assumes that Render
- * wraps the ProcRenderVector after dmxRenderInit has been called.
- */
- if (ret == Success) {
- PicturePtr pSrc;
- dmxPictPrivPtr pSrcPriv;
- PicturePtr pDst;
- dmxPictPrivPtr pDstPriv;
- PictFormatPtr pFmt;
- XRenderPictFormat *pFormat;
- int size;
-
- int scrnNum;
- DMXScreenInfo *dmxScreen;
-
- CARD8 *buffer;
- CARD8 *end;
- int space;
-
- int nglyph;
- char *glyphs;
- char *curGlyph;
-
- xGlyphElt *elt;
- int nelt;
- XGlyphElt8 *elts;
- XGlyphElt8 *curElt;
-
- GlyphSetPtr glyphSet;
- dmxGlyphPrivPtr glyphPriv;
-
- dixLookupResourceByType((pointer*) &pSrc,
- stuff->src, PictureType,
- client, DixReadAccess);
-
- pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
- if (!pSrcPriv->pict)
- return ret;
-
- dixLookupResourceByType((pointer*) &pDst,
- stuff->dst, PictureType,
- client, DixWriteAccess);
-
- pDstPriv = DMX_GET_PICT_PRIV(pDst);
- if (!pDstPriv->pict)
- return ret;
-
- scrnNum = pDst->pDrawable->pScreen->myNum;
- dmxScreen = &dmxScreens[scrnNum];
-
- /* Note: If the back-end display has been detached, then it
- * should not be possible to reach here since the pSrcPriv->pict
- * and pDstPriv->pict will have already been set to 0.
- */
- if (!dmxScreen->beDisplay)
- return ret;
-
- if (stuff->maskFormat)
- dixLookupResourceByType((pointer*) &pFmt,
- stuff->maskFormat, PictFormatType,
- client, DixReadAccess);
- else
- pFmt = NULL;
-
- pFormat = dmxFindFormat(dmxScreen, pFmt);
-
- switch (stuff->renderReqType) {
- case X_RenderCompositeGlyphs8: size = sizeof(CARD8); break;
- case X_RenderCompositeGlyphs16: size = sizeof(CARD16); break;
- case X_RenderCompositeGlyphs32: size = sizeof(CARD32); break;
- default: return BadPictOp; /* Can't happen */
- }
-
- buffer = (CARD8 *)(stuff + 1);
- end = (CARD8 *)stuff + (stuff->length << 2);
- nelt = 0;
- nglyph = 0;
- while (buffer + sizeof(xGlyphElt) < end) {
- elt = (xGlyphElt *)buffer;
- buffer += sizeof(xGlyphElt);
-
- if (elt->len == 0xff) {
- buffer += 4;
- } else {
- nelt++;
- nglyph += elt->len;
- space = size * elt->len;
- if (space & 3) space += 4 - (space & 3);
- buffer += space;
- }
- }
-
- /* The following only works for Render version > 0.2 */
-
- /* All of the XGlyphElt* structure sizes are identical */
- elts = malloc(nelt * sizeof(XGlyphElt8));
- if (!elts)
- return BadAlloc;
-
- glyphs = malloc(nglyph * size);
- if (!glyphs) {
- free(elts);
- return BadAlloc;
- }
-
- buffer = (CARD8 *)(stuff + 1);
- end = (CARD8 *)stuff + (stuff->length << 2);
- curGlyph = glyphs;
- curElt = elts;
-
- dixLookupResourceByType((pointer*) &glyphSet,
- stuff->glyphset, GlyphSetType,
- client, DixReadAccess);
- glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
-
- while (buffer + sizeof(xGlyphElt) < end) {
- elt = (xGlyphElt *)buffer;
- buffer += sizeof(xGlyphElt);
-
- if (elt->len == 0xff) {
- dixLookupResourceByType((pointer*) &glyphSet,
- *((CARD32 *)buffer),
- GlyphSetType,
- client,
- DixReadAccess);
- glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
- buffer += 4;
- } else {
- curElt->glyphset = glyphPriv->glyphSets[scrnNum];
- curElt->xOff = elt->deltax;
- curElt->yOff = elt->deltay;
- curElt->nchars = elt->len;
- curElt->chars = curGlyph;
-
- memcpy(curGlyph, buffer, size*elt->len);
- curGlyph += size * elt->len;
-
- curElt++;
-
- space = size * elt->len;
- if (space & 3) space += 4 - (space & 3);
- buffer += space;
- }
- }
-
- switch (stuff->renderReqType) {
- case X_RenderCompositeGlyphs8:
- XRenderCompositeText8(dmxScreen->beDisplay, stuff->op,
- pSrcPriv->pict, pDstPriv->pict,
- pFormat,
- stuff->xSrc, stuff->ySrc,
- 0, 0, elts, nelt);
- break;
- case X_RenderCompositeGlyphs16:
- XRenderCompositeText16(dmxScreen->beDisplay, stuff->op,
- pSrcPriv->pict, pDstPriv->pict,
- pFormat,
- stuff->xSrc, stuff->ySrc,
- 0, 0, (XGlyphElt16 *)elts, nelt);
- break;
- case X_RenderCompositeGlyphs32:
- XRenderCompositeText32(dmxScreen->beDisplay, stuff->op,
- pSrcPriv->pict, pDstPriv->pict,
- pFormat,
- stuff->xSrc, stuff->ySrc,
- 0, 0, (XGlyphElt32 *)elts, nelt);
- break;
- }
-
- dmxSync(dmxScreen, FALSE);
-
- free(elts);
- free(glyphs);
- }
-
- return ret;
-}
-
-/** Set the picture transform on each screen. */
-static int dmxProcRenderSetPictureTransform(ClientPtr client)
-{
- DMXScreenInfo *dmxScreen;
- PicturePtr pPicture;
- dmxPictPrivPtr pPictPriv;
- XTransform xform;
- REQUEST(xRenderSetPictureTransformReq);
-
- REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
- VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess);
-
- /* For the following to work with PanoramiX, it assumes that Render
- * wraps the ProcRenderVector after dmxRenderInit has been called.
- */
- dmxScreen = &dmxScreens[pPicture->pDrawable->pScreen->myNum];
- pPictPriv = DMX_GET_PICT_PRIV(pPicture);
-
- if (pPictPriv->pict) {
- xform.matrix[0][0] = stuff->transform.matrix11;
- xform.matrix[0][1] = stuff->transform.matrix12;
- xform.matrix[0][2] = stuff->transform.matrix13;
- xform.matrix[1][0] = stuff->transform.matrix21;
- xform.matrix[1][1] = stuff->transform.matrix22;
- xform.matrix[1][2] = stuff->transform.matrix23;
- xform.matrix[2][0] = stuff->transform.matrix31;
- xform.matrix[2][1] = stuff->transform.matrix32;
- xform.matrix[2][2] = stuff->transform.matrix33;
-
- XRenderSetPictureTransform(dmxScreen->beDisplay,
- pPictPriv->pict,
- &xform);
- dmxSync(dmxScreen, FALSE);
- }
-
- return dmxSaveRenderVector[stuff->renderReqType](client);
-}
-
-/** Set the picture filter on each screen. */
-static int dmxProcRenderSetPictureFilter(ClientPtr client)
-{
- DMXScreenInfo *dmxScreen;
- PicturePtr pPicture;
- dmxPictPrivPtr pPictPriv;
- char *filter;
- XFixed *params;
- int nparams;
- REQUEST(xRenderSetPictureFilterReq);
-
- REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
- VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess);
-
- /* For the following to work with PanoramiX, it assumes that Render
- * wraps the ProcRenderVector after dmxRenderInit has been called.
- */
- dmxScreen = &dmxScreens[pPicture->pDrawable->pScreen->myNum];
- pPictPriv = DMX_GET_PICT_PRIV(pPicture);
-
- if (pPictPriv->pict) {
- filter = (char *)(stuff + 1);
- params = (XFixed *)(filter + ((stuff->nbytes + 3) & ~3));
- nparams = ((XFixed *)stuff + client->req_len) - params;
-
- XRenderSetPictureFilter(dmxScreen->beDisplay,
- pPictPriv->pict,
- filter,
- params,
- nparams);
- dmxSync(dmxScreen, FALSE);
- }
-
- return dmxSaveRenderVector[stuff->renderReqType](client);
-}
-
-
-/** Create a picture on the appropriate screen. This is the actual
- * function that creates the picture. However, if the associated
- * window has not yet been created due to lazy window creation, then
- * delay the picture creation until the window is mapped. */
-static Picture dmxDoCreatePicture(PicturePtr pPicture)
-{
- DrawablePtr pDraw = pPicture->pDrawable;
- ScreenPtr pScreen = pDraw->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- XRenderPictFormat *pFormat;
- Drawable draw;
-
- if (pPicture->pDrawable->type == DRAWABLE_WINDOW) {
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV((WindowPtr)(pDraw));
-
- if (!(draw = pWinPriv->window)) {
- /* Window has not been created yet due to the window
- * optimization. Delay picture creation until window is
- * mapped.
- */
- pWinPriv->hasPict = TRUE;
- return 0;
- }
- } else {
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV((PixmapPtr)(pDraw));
-
- if (!(draw = pPixPriv->pixmap)) {
- /* FIXME: Zero width/height pixmap?? */
- return 0;
- }
- }
-
- /* This should not be reached if the back-end display has been
- * detached because the pWinPriv->window or the pPixPriv->pixmap
- * will be NULL; however, we add it here for completeness
- */
- if (!dmxScreen->beDisplay)
- return 0;
-
- pFormat = dmxFindFormat(dmxScreen, pPicture->pFormat);
-
- return XRenderCreatePicture(dmxScreen->beDisplay, draw, pFormat, 0, 0);
-}
-
-/** Create a list of pictures. This function is called by
- * dmxCreateAndRealizeWindow() during the lazy window creation
- * realization process. It creates the entire list of pictures that
- * are associated with the given window. */
-void dmxCreatePictureList(WindowPtr pWindow)
-{
- PicturePtr pPicture = GetPictureWindow(pWindow);
-
- while (pPicture) {
- dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
-
- /* Create the picture for this window */
- pPictPriv->pict = dmxDoCreatePicture(pPicture);
-
- /* ValidatePicture takes care of the state changes */
-
- pPicture = pPicture->pNext;
- }
-}
-
-/** Create \a pPicture on the backend. */
-int dmxBECreatePicture(PicturePtr pPicture)
-{
- dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
-
- /* Create picutre on BE */
- pPictPriv->pict = dmxDoCreatePicture(pPicture);
-
- /* Flush changes to the backend server */
- dmxValidatePicture(pPicture, (1 << (CPLastBit+1)) - 1);
-
- return Success;
-}
-
-/** Create a picture. This function handles the CreatePicture
- * unwrapping/wrapping and calls dmxDoCreatePicture to actually create
- * the picture on the appropriate screen. */
-int dmxCreatePicture(PicturePtr pPicture)
-{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
- int ret = Success;
-
- DMX_UNWRAP(CreatePicture, dmxScreen, ps);
-#if 1
- if (ps->CreatePicture)
- ret = ps->CreatePicture(pPicture);
-#endif
-
- /* Create picture on back-end server */
- pPictPriv->pict = dmxDoCreatePicture(pPicture);
- pPictPriv->savedMask = 0;
-
- DMX_WRAP(CreatePicture, dmxCreatePicture, dmxScreen, ps);
-
- return ret;
-}
-
-/** Destroy \a pPicture on the back-end server. */
-Bool dmxBEFreePicture(PicturePtr pPicture)
-{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
-
- if (pPictPriv->pict) {
- XRenderFreePicture(dmxScreen->beDisplay, pPictPriv->pict);
- pPictPriv->pict = (Picture)0;
- return TRUE;
- }
-
- return FALSE;
-}
-
-/** Destroy a list of pictures that are associated with the window that
- * is being destroyed. This function is called by #dmxDestroyWindow().
- * */
-Bool dmxDestroyPictureList(WindowPtr pWindow)
-{
- PicturePtr pPicture = GetPictureWindow(pWindow);
- Bool ret = FALSE;
-
- while (pPicture) {
- ret |= dmxBEFreePicture(pPicture);
- pPicture = pPicture->pNext;
- }
-
- return ret;
-}
-
-/** Destroy a picture. This function calls the wrapped function that
- * frees the resources in the DMX server associated with this
- * picture. */
-void dmxDestroyPicture(PicturePtr pPicture)
-{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
-
- DMX_UNWRAP(DestroyPicture, dmxScreen, ps);
-
- /* Destroy picture on back-end server */
- if (dmxBEFreePicture(pPicture))
- dmxSync(dmxScreen, FALSE);
-
-#if 1
- if (ps->DestroyPicture)
- ps->DestroyPicture(pPicture);
-#endif
- DMX_WRAP(DestroyPicture, dmxDestroyPicture, dmxScreen, ps);
-}
-
-/** Change the picture's list of clip rectangles. */
-int dmxChangePictureClip(PicturePtr pPicture, int clipType,
- pointer value, int n)
-{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
-
- DMX_UNWRAP(ChangePictureClip, dmxScreen, ps);
-#if 1
- if (ps->ChangePictureClip)
- ps->ChangePictureClip(pPicture, clipType, value, n);
-#endif
-
- /* Change picture clip rects on back-end server */
- if (pPictPriv->pict) {
- /* The clip has already been changed into a region by the mi
- * routine called above.
- */
- if (clipType == CT_NONE) {
- /* Disable clipping, show all */
- XFixesSetPictureClipRegion(dmxScreen->beDisplay,
- pPictPriv->pict, 0, 0, None);
- } else if (pPicture->clientClip) {
- RegionPtr pClip = pPicture->clientClip;
- BoxPtr pBox = RegionRects(pClip);
- int nBox = RegionNumRects(pClip);
- XRectangle *pRects;
- XRectangle *pRect;
- int nRects;
-
- nRects = nBox;
- pRects = pRect = malloc(nRects * sizeof(*pRect));
-
- while (nBox--) {
- pRect->x = pBox->x1;
- pRect->y = pBox->y1;
- pRect->width = pBox->x2 - pBox->x1;
- pRect->height = pBox->y2 - pBox->y1;
- pBox++;
- pRect++;
- }
-
- XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
- pPictPriv->pict,
- 0, 0,
- pRects,
- nRects);
- free(pRects);
- } else {
- XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
- pPictPriv->pict,
- 0, 0, NULL, 0);
- }
- dmxSync(dmxScreen, FALSE);
- } else {
- /* FIXME: Handle saving clip region when offscreen */
- }
-
- DMX_WRAP(ChangePictureClip, dmxChangePictureClip, dmxScreen, ps);
-
- return Success;
-}
-
-/** Destroy the picture's list of clip rectangles. */
-void dmxDestroyPictureClip(PicturePtr pPicture)
-{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
-
- DMX_UNWRAP(DestroyPictureClip, dmxScreen, ps);
-#if 1
- if (ps->DestroyPictureClip)
- ps->DestroyPictureClip(pPicture);
-#endif
-
- /* Destroy picture clip rects on back-end server */
- if (pPictPriv->pict) {
- XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
- pPictPriv->pict,
- 0, 0, NULL, 0);
- dmxSync(dmxScreen, FALSE);
- } else {
- /* FIXME: Handle destroying clip region when offscreen */
- }
-
- DMX_WRAP(DestroyPictureClip, dmxDestroyPictureClip, dmxScreen, ps);
-}
-
-/** Change the attributes of the pictures. If the picture has not yet
- * been created due to lazy window creation, save the mask so that it
- * can be used to appropriately initialize the picture's attributes
- * when it is created later. */
-void dmxChangePicture(PicturePtr pPicture, Mask mask)
-{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
-
- DMX_UNWRAP(ChangePicture, dmxScreen, ps);
-#if 1
- if (ps->ChangePicture)
- ps->ChangePicture(pPicture, mask);
-#endif
-
- /* Picture attribute changes are handled in ValidatePicture */
- pPictPriv->savedMask |= mask;
-
- DMX_WRAP(ChangePicture, dmxChangePicture, dmxScreen, ps);
-}
-
-/** Validate the picture's attributes before rendering to it. Update
- * any picture attributes that have been changed by one of the higher
- * layers. */
-void dmxValidatePicture(PicturePtr pPicture, Mask mask)
-{
- ScreenPtr pScreen = pPicture->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
-
- DMX_UNWRAP(ValidatePicture, dmxScreen, ps);
-
- /* Change picture attributes on back-end server */
- if (pPictPriv->pict) {
- XRenderPictureAttributes attribs;
-
- if (mask & CPRepeat) {
- attribs.repeat = pPicture->repeatType;
- }
- if (mask & CPAlphaMap) {
- if (pPicture->alphaMap) {
- dmxPictPrivPtr pAlphaPriv;
- pAlphaPriv = DMX_GET_PICT_PRIV(pPicture->alphaMap);
- if (pAlphaPriv->pict) {
- attribs.alpha_map = pAlphaPriv->pict;
- } else {
- /* FIXME: alpha picture drawable has not been created?? */
- return; /* or should this be: attribs.alpha_map = None; */
- }
- } else {
- attribs.alpha_map = None;
- }
- }
- if (mask & CPAlphaXOrigin)
- attribs.alpha_x_origin = pPicture->alphaOrigin.x;
- if (mask & CPAlphaYOrigin)
- attribs.alpha_y_origin = pPicture->alphaOrigin.y;
- if (mask & CPClipXOrigin)
- attribs.clip_x_origin = pPicture->clipOrigin.x;
- if (mask & CPClipYOrigin)
- attribs.clip_y_origin = pPicture->clipOrigin.y;
- if (mask & CPClipMask)
- mask &= ~CPClipMask; /* Handled in ChangePictureClip */
- if (mask & CPGraphicsExposure)
- attribs.graphics_exposures = pPicture->graphicsExposures;
- if (mask & CPSubwindowMode)
- attribs.subwindow_mode = pPicture->subWindowMode;
- if (mask & CPPolyEdge)
- attribs.poly_edge = pPicture->polyEdge;
- if (mask & CPPolyMode)
- attribs.poly_mode = pPicture->polyMode;
- if (mask & CPComponentAlpha)
- attribs.component_alpha = pPicture->componentAlpha;
-
- XRenderChangePicture(dmxScreen->beDisplay, pPictPriv->pict,
- mask, &attribs);
- dmxSync(dmxScreen, FALSE);
- } else {
- pPictPriv->savedMask |= mask;
- }
-
-#if 1
- if (ps->ValidatePicture)
- ps->ValidatePicture(pPicture, mask);
-#endif
-
- DMX_WRAP(ValidatePicture, dmxValidatePicture, dmxScreen, ps);
-}
-
-/** Composite a picture on the appropriate screen by combining the
- * specified rectangle of the transformed src and mask operands with
- * the specified rectangle of the dst using op as the compositing
- * operator. For a complete description see the protocol document of
- * the RENDER library. */
-void dmxComposite(CARD8 op,
- PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
- INT16 xSrc, INT16 ySrc,
- INT16 xMask, INT16 yMask,
- INT16 xDst, INT16 yDst,
- CARD16 width, CARD16 height)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
- dmxPictPrivPtr pMaskPriv = NULL;
- dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
-
- if (pMask) pMaskPriv = DMX_GET_PICT_PRIV(pMask);
-
- DMX_UNWRAP(Composite, dmxScreen, ps);
-#if 0
- if (ps->Composite)
- ps->Composite(op, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height);
-#endif
-
- /* Composite on back-end server */
- if (pSrcPriv->pict && pDstPriv->pict &&
- ((pMaskPriv && pMaskPriv->pict) || !pMaskPriv)) {
- XRenderComposite(dmxScreen->beDisplay,
- op,
- pSrcPriv->pict,
- pMaskPriv ? pMaskPriv->pict : None,
- pDstPriv->pict,
- xSrc, ySrc,
- xMask, yMask,
- xDst, yDst,
- width, height);
- dmxSync(dmxScreen, FALSE);
- }
-
-
- DMX_WRAP(Composite, dmxComposite, dmxScreen, ps);
-}
-
-/** Null function to catch when/if RENDER calls lower level mi hooks.
- * Compositing glyphs is handled by dmxProcRenderCompositeGlyphs().
- * This function should never be called. */
-void dmxGlyphs(CARD8 op,
- PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc, INT16 ySrc,
- int nlists, GlyphListPtr lists, GlyphPtr *glyphs)
-{
- /* This won't work, so we need to wrap ProcRenderCompositeGlyphs */
-}
-
-/** Fill a rectangle on the appropriate screen by combining the color
- * with the dest picture in the area specified by the list of
- * rectangles. For a complete description see the protocol document of
- * the RENDER library. */
-void dmxCompositeRects(CARD8 op,
- PicturePtr pDst,
- xRenderColor *color,
- int nRect, xRectangle *rects)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pDst);
-
- DMX_UNWRAP(CompositeRects, dmxScreen, ps);
-#if 0
- if (ps->CompositeRects)
- ps->CompositeRects(op, pDst, color, nRect, rects);
-#endif
-
- /* CompositeRects on back-end server */
- if (pPictPriv->pict) {
- XRenderFillRectangles(dmxScreen->beDisplay,
- op,
- pPictPriv->pict,
- (XRenderColor *)color,
- (XRectangle *)rects,
- nRect);
- dmxSync(dmxScreen, FALSE);
- }
-
- DMX_WRAP(CompositeRects, dmxCompositeRects, dmxScreen, ps);
-}
-
-/** Indexed color visuals are not yet supported. */
-Bool dmxInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat)
-{
- return TRUE;
-}
-
-/** Indexed color visuals are not yet supported. */
-void dmxCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat)
-{
-}
-
-/** Indexed color visuals are not yet supported. */
-void dmxUpdateIndexed(ScreenPtr pScreen, PictFormatPtr pFormat,
- int ndef, xColorItem *pdef)
-{
-}
-
-/** Composite a list of trapezoids on the appropriate screen. For a
- * complete description see the protocol document of the RENDER
- * library. */
-void dmxTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc, INT16 ySrc,
- int ntrap, xTrapezoid *traps)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
- dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
-
- DMX_UNWRAP(Trapezoids, dmxScreen, ps);
-#if 0
- if (ps->Trapezoids)
- ps->Trapezoids(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntrap, *traps);
-#endif
-
- /* Draw trapezoids on back-end server */
- if (pDstPriv->pict) {
- XRenderPictFormat *pFormat;
-
- pFormat = dmxFindFormat(dmxScreen, maskFormat);
- if (!pFormat) {
- /* FIXME: Error! */
- }
-
- XRenderCompositeTrapezoids(dmxScreen->beDisplay,
- op,
- pSrcPriv->pict,
- pDstPriv->pict,
- pFormat,
- xSrc, ySrc,
- (XTrapezoid *)traps,
- ntrap);
- dmxSync(dmxScreen, FALSE);
- }
-
- DMX_WRAP(Trapezoids, dmxTrapezoids, dmxScreen, ps);
-}
-
-/** Composite a list of triangles on the appropriate screen. For a
- * complete description see the protocol document of the RENDER
- * library. */
-void dmxTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc, INT16 ySrc,
- int ntri, xTriangle *tris)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
- dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
-
- DMX_UNWRAP(Triangles, dmxScreen, ps);
-#if 0
- if (ps->Triangles)
- ps->Triangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, *tris);
-#endif
-
- /* Draw trapezoids on back-end server */
- if (pDstPriv->pict) {
- XRenderPictFormat *pFormat;
-
- pFormat = dmxFindFormat(dmxScreen, maskFormat);
- if (!pFormat) {
- /* FIXME: Error! */
- }
-
- XRenderCompositeTriangles(dmxScreen->beDisplay,
- op,
- pSrcPriv->pict,
- pDstPriv->pict,
- pFormat,
- xSrc, ySrc,
- (XTriangle *)tris,
- ntri);
- dmxSync(dmxScreen, FALSE);
- }
-
- DMX_WRAP(Triangles, dmxTriangles, dmxScreen, ps);
-}
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Provide support for the RENDER extension (version 0.8).
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxpict.h"
+#include "dmxwindow.h"
+#include "dmxpixmap.h"
+
+#include "fb.h"
+#include "pixmapstr.h"
+#include "dixstruct.h"
+
+#include <X11/extensions/render.h>
+#include <X11/extensions/renderproto.h>
+#include <X11/extensions/Xfixes.h>
+#include "picture.h"
+#include "picturestr.h"
+#include "mipict.h"
+#include "fbpict.h"
+
+extern int RenderErrBase;
+extern int (*ProcRenderVector[RenderNumberRequests]) (ClientPtr);
+
+static int (*dmxSaveRenderVector[RenderNumberRequests]) (ClientPtr);
+
+static int dmxProcRenderCreateGlyphSet(ClientPtr client);
+static int dmxProcRenderFreeGlyphSet(ClientPtr client);
+static int dmxProcRenderAddGlyphs(ClientPtr client);
+static int dmxProcRenderFreeGlyphs(ClientPtr client);
+static int dmxProcRenderCompositeGlyphs(ClientPtr client);
+static int dmxProcRenderSetPictureTransform(ClientPtr client);
+static int dmxProcRenderSetPictureFilter(ClientPtr client);
+
+#if 0
+/* FIXME: Not (yet) supported */
+static int dmxProcRenderCreateCursor(ClientPtr client);
+static int dmxProcRenderCreateAnimCursor(ClientPtr client);
+#endif
+
+/** Catch errors that might occur when allocating Glyph Sets. Errors
+ * are saved in dmxGlyphLastError for later handling. */
+static int dmxGlyphLastError;
+static int
+dmxGlyphErrorHandler(Display * dpy, XErrorEvent * ev)
+{
+ dmxGlyphLastError = ev->error_code;
+ return 0;
+}
+
+/** Initialize the Proc Vector for the RENDER extension. The functions
+ * here cannot be handled by the mi layer RENDER hooks either because
+ * the required information is no longer available when it reaches the
+ * mi layer or no mi layer hooks exist. This function is called from
+ * InitOutput() since it should be initialized only once per server
+ * generation. */
+void
+dmxInitRender(void)
+{
+ int i;
+
+ for (i = 0; i < RenderNumberRequests; i++)
+ dmxSaveRenderVector[i] = ProcRenderVector[i];
+
+ ProcRenderVector[X_RenderCreateGlyphSet]
+ = dmxProcRenderCreateGlyphSet;
+ ProcRenderVector[X_RenderFreeGlyphSet]
+ = dmxProcRenderFreeGlyphSet;
+ ProcRenderVector[X_RenderAddGlyphs]
+ = dmxProcRenderAddGlyphs;
+ ProcRenderVector[X_RenderFreeGlyphs]
+ = dmxProcRenderFreeGlyphs;
+ ProcRenderVector[X_RenderCompositeGlyphs8]
+ = dmxProcRenderCompositeGlyphs;
+ ProcRenderVector[X_RenderCompositeGlyphs16]
+ = dmxProcRenderCompositeGlyphs;
+ ProcRenderVector[X_RenderCompositeGlyphs32]
+ = dmxProcRenderCompositeGlyphs;
+ ProcRenderVector[X_RenderSetPictureTransform]
+ = dmxProcRenderSetPictureTransform;
+ ProcRenderVector[X_RenderSetPictureFilter]
+ = dmxProcRenderSetPictureFilter;
+}
+
+/** Reset the Proc Vector for the RENDER extension back to the original
+ * functions. This function is called from dmxCloseScreen() during the
+ * server reset (only for screen #0). */
+void
+dmxResetRender(void)
+{
+ int i;
+
+ for (i = 0; i < RenderNumberRequests; i++)
+ ProcRenderVector[i] = dmxSaveRenderVector[i];
+}
+
+/** Initialize the RENDER extension, allocate the picture privates and
+ * wrap mi function hooks. If the shadow frame buffer is used, then
+ * call the appropriate fb initialization function. */
+Bool
+dmxPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps;
+
+ /* The shadow framebuffer only relies on FB to be initialized */
+ if (dmxShadowFB)
+ return fbPictureInit(pScreen, formats, nformats);
+
+ if (!miPictureInit(pScreen, formats, nformats))
+ return FALSE;
+
+ if (!dixRegisterPrivateKey
+ (&dmxPictPrivateKeyRec, PRIVATE_PICTURE, sizeof(dmxPictPrivRec)))
+ return FALSE;
+
+ ps = GetPictureScreen(pScreen);
+
+ DMX_WRAP(CreatePicture, dmxCreatePicture, dmxScreen, ps);
+ DMX_WRAP(DestroyPicture, dmxDestroyPicture, dmxScreen, ps);
+
+ DMX_WRAP(ChangePictureClip, dmxChangePictureClip, dmxScreen, ps);
+ DMX_WRAP(DestroyPictureClip, dmxDestroyPictureClip, dmxScreen, ps);
+
+ DMX_WRAP(ChangePicture, dmxChangePicture, dmxScreen, ps);
+ DMX_WRAP(ValidatePicture, dmxValidatePicture, dmxScreen, ps);
+
+ DMX_WRAP(Composite, dmxComposite, dmxScreen, ps);
+ DMX_WRAP(Glyphs, dmxGlyphs, dmxScreen, ps);
+ DMX_WRAP(CompositeRects, dmxCompositeRects, dmxScreen, ps);
+
+ DMX_WRAP(Trapezoids, dmxTrapezoids, dmxScreen, ps);
+ DMX_WRAP(Triangles, dmxTriangles, dmxScreen, ps);
+
+ return TRUE;
+}
+
+/** Find the appropriate format on the requested screen given the
+ * internal format requested. The list of formats is searched
+ * sequentially as the XRenderFindFormat() function does not always
+ * find the appropriate format when a specific format is requested. */
+static XRenderPictFormat *
+dmxFindFormat(DMXScreenInfo * dmxScreen, PictFormatPtr pFmt)
+{
+ XRenderPictFormat *pFormat = NULL;
+ int i = 0;
+
+ if (!pFmt || !dmxScreen->beDisplay)
+ return pFormat;
+
+ while (1) {
+ pFormat = XRenderFindFormat(dmxScreen->beDisplay, 0, 0, i++);
+ if (!pFormat)
+ break;
+
+ if (pFormat->type != pFmt->type)
+ continue;
+ if (pFormat->depth != pFmt->depth)
+ continue;
+ if (pFormat->direct.red != pFmt->direct.red)
+ continue;
+ if (pFormat->direct.redMask != pFmt->direct.redMask)
+ continue;
+ if (pFormat->direct.green != pFmt->direct.green)
+ continue;
+ if (pFormat->direct.greenMask != pFmt->direct.greenMask)
+ continue;
+ if (pFormat->direct.blue != pFmt->direct.blue)
+ continue;
+ if (pFormat->direct.blueMask != pFmt->direct.blueMask)
+ continue;
+ if (pFormat->direct.alpha != pFmt->direct.alpha)
+ continue;
+ if (pFormat->direct.alphaMask != pFmt->direct.alphaMask)
+ continue;
+
+ /* We have a match! */
+ break;
+ }
+
+ return pFormat;
+}
+
+/** Free \a glyphSet on back-end screen number \a idx. */
+Bool
+dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet)
+{
+ dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ int idx = pScreen->myNum;
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+
+ if (glyphPriv->glyphSets[idx]) {
+ XRenderFreeGlyphSet(dmxScreen->beDisplay, glyphPriv->glyphSets[idx]);
+ glyphPriv->glyphSets[idx] = (GlyphSet) 0;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/** Create \a glyphSet on the backend screen number \a idx. */
+int
+dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet)
+{
+ XRenderPictFormat *pFormat;
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+ dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ PictFormatPtr pFmt = glyphSet->format;
+ int (*oldErrorHandler) (Display *, XErrorEvent *);
+
+ pFormat = dmxFindFormat(dmxScreen, pFmt);
+ if (!pFormat) {
+ return BadMatch;
+ }
+
+ dmxGlyphLastError = 0;
+ oldErrorHandler = XSetErrorHandler(dmxGlyphErrorHandler);
+
+ /* Catch when this fails */
+ glyphPriv->glyphSets[idx]
+ = XRenderCreateGlyphSet(dmxScreen->beDisplay, pFormat);
+
+ XSetErrorHandler(oldErrorHandler);
+
+ if (dmxGlyphLastError) {
+ return dmxGlyphLastError;
+ }
+
+ return Success;
+}
+
+/** Create a Glyph Set on each screen. Save the glyphset ID from each
+ * screen in the Glyph Set's private structure. Fail if the format
+ * requested is not available or if the Glyph Set cannot be created on
+ * the screen. */
+static int
+dmxProcRenderCreateGlyphSet(ClientPtr client)
+{
+ int ret;
+
+ REQUEST(xRenderCreateGlyphSetReq);
+
+ ret = dmxSaveRenderVector[stuff->renderReqType] (client);
+
+ if (ret == Success) {
+ GlyphSetPtr glyphSet;
+ dmxGlyphPrivPtr glyphPriv;
+ int i;
+
+ /* Look up glyphSet that was just created ???? */
+ /* Store glyphsets from backends in glyphSet->devPrivate ????? */
+ /* Make sure we handle all errors here!! */
+
+ dixLookupResourceByType((pointer *) &glyphSet,
+ stuff->gsid, GlyphSetType,
+ client, DixDestroyAccess);
+
+ glyphPriv = malloc(sizeof(dmxGlyphPrivRec));
+ if (!glyphPriv)
+ return BadAlloc;
+ glyphPriv->glyphSets = NULL;
+ MAXSCREENSALLOC_RETURN(glyphPriv->glyphSets, BadAlloc);
+ DMX_SET_GLYPH_PRIV(glyphSet, glyphPriv);
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ int beret;
+
+ if (!dmxScreen->beDisplay) {
+ glyphPriv->glyphSets[i] = 0;
+ continue;
+ }
+
+ if ((beret = dmxBECreateGlyphSet(i, glyphSet)) != Success) {
+ int j;
+
+ /* Free the glyph sets we've allocated thus far */
+ for (j = 0; j < i; j++)
+ dmxBEFreeGlyphSet(screenInfo.screens[j], glyphSet);
+
+ /* Free the resource created by render */
+ FreeResource(stuff->gsid, RT_NONE);
+
+ return beret;
+ }
+ }
+ }
+
+ return ret;
+}
+
+/** Free the previously allocated Glyph Sets for each screen. */
+static int
+dmxProcRenderFreeGlyphSet(ClientPtr client)
+{
+ GlyphSetPtr glyphSet;
+
+ REQUEST(xRenderFreeGlyphSetReq);
+
+ REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
+ dixLookupResourceByType((pointer *) &glyphSet,
+ stuff->glyphset, GlyphSetType,
+ client, DixDestroyAccess);
+
+ if (glyphSet && glyphSet->refcnt == 1) {
+ dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ int i;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ if (dmxScreen->beDisplay) {
+ if (dmxBEFreeGlyphSet(screenInfo.screens[i], glyphSet))
+ dmxSync(dmxScreen, FALSE);
+ }
+ }
+
+ MAXSCREENSFREE(glyphPriv->glyphSets);
+ free(glyphPriv);
+ DMX_SET_GLYPH_PRIV(glyphSet, NULL);
+ }
+
+ return dmxSaveRenderVector[stuff->renderReqType] (client);
+}
+
+/** Add glyphs to the Glyph Set on each screen. */
+static int
+dmxProcRenderAddGlyphs(ClientPtr client)
+{
+ int ret;
+
+ REQUEST(xRenderAddGlyphsReq);
+
+ ret = dmxSaveRenderVector[stuff->renderReqType] (client);
+
+ if (ret == Success) {
+ GlyphSetPtr glyphSet;
+ dmxGlyphPrivPtr glyphPriv;
+ int i;
+ int nglyphs;
+ CARD32 *gids;
+ Glyph *gidsCopy;
+ xGlyphInfo *gi;
+ CARD8 *bits;
+ int nbytes;
+
+ dixLookupResourceByType((pointer *) &glyphSet,
+ stuff->glyphset, GlyphSetType,
+ client, DixReadAccess);
+ glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+
+ nglyphs = stuff->nglyphs;
+ gids = (CARD32 *) (stuff + 1);
+ gi = (xGlyphInfo *) (gids + nglyphs);
+ bits = (CARD8 *) (gi + nglyphs);
+ nbytes = ((stuff->length << 2) -
+ sizeof(xRenderAddGlyphsReq) -
+ (sizeof(CARD32) + sizeof(xGlyphInfo)) * nglyphs);
+
+ gidsCopy = malloc(sizeof(*gidsCopy) * nglyphs);
+ for (i = 0; i < nglyphs; i++)
+ gidsCopy[i] = gids[i];
+
+ /* FIXME: Will this ever fail? */
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ if (dmxScreen->beDisplay) {
+ XRenderAddGlyphs(dmxScreen->beDisplay,
+ glyphPriv->glyphSets[i],
+ gidsCopy,
+ (XGlyphInfo *) gi,
+ nglyphs, (char *) bits, nbytes);
+ dmxSync(dmxScreen, FALSE);
+ }
+ }
+ free(gidsCopy);
+ }
+
+ return ret;
+}
+
+/** Free glyphs from the Glyph Set for each screen. */
+static int
+dmxProcRenderFreeGlyphs(ClientPtr client)
+{
+ GlyphSetPtr glyphSet;
+
+ REQUEST(xRenderFreeGlyphsReq);
+
+ REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq);
+ dixLookupResourceByType((pointer *) &glyphSet,
+ stuff->glyphset, GlyphSetType,
+ client, DixWriteAccess);
+
+ if (glyphSet) {
+ dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ int i;
+ int nglyphs;
+ Glyph *gids;
+
+ nglyphs = ((client->req_len << 2) - sizeof(xRenderFreeGlyphsReq)) >> 2;
+ if (nglyphs) {
+ gids = malloc(sizeof(*gids) * nglyphs);
+ for (i = 0; i < nglyphs; i++)
+ gids[i] = ((CARD32 *) (stuff + 1))[i];
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ if (dmxScreen->beDisplay) {
+ XRenderFreeGlyphs(dmxScreen->beDisplay,
+ glyphPriv->glyphSets[i], gids, nglyphs);
+ dmxSync(dmxScreen, FALSE);
+ }
+ }
+ free(gids);
+ }
+ }
+
+ return dmxSaveRenderVector[stuff->renderReqType] (client);
+}
+
+/** Composite glyphs on each screen into the requested picture. If
+ * either the src or dest picture has not been allocated due to lazy
+ * window creation, this request will gracefully return. */
+static int
+dmxProcRenderCompositeGlyphs(ClientPtr client)
+{
+ int ret;
+
+ REQUEST(xRenderCompositeGlyphsReq);
+
+ ret = dmxSaveRenderVector[stuff->renderReqType] (client);
+
+ /* For the following to work with PanoramiX, it assumes that Render
+ * wraps the ProcRenderVector after dmxRenderInit has been called.
+ */
+ if (ret == Success) {
+ PicturePtr pSrc;
+ dmxPictPrivPtr pSrcPriv;
+ PicturePtr pDst;
+ dmxPictPrivPtr pDstPriv;
+ PictFormatPtr pFmt;
+ XRenderPictFormat *pFormat;
+ int size;
+
+ int scrnNum;
+ DMXScreenInfo *dmxScreen;
+
+ CARD8 *buffer;
+ CARD8 *end;
+ int space;
+
+ int nglyph;
+ char *glyphs;
+ char *curGlyph;
+
+ xGlyphElt *elt;
+ int nelt;
+ XGlyphElt8 *elts;
+ XGlyphElt8 *curElt;
+
+ GlyphSetPtr glyphSet;
+ dmxGlyphPrivPtr glyphPriv;
+
+ dixLookupResourceByType((pointer *) &pSrc,
+ stuff->src, PictureType, client, DixReadAccess);
+
+ pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
+ if (!pSrcPriv->pict)
+ return ret;
+
+ dixLookupResourceByType((pointer *) &pDst,
+ stuff->dst, PictureType,
+ client, DixWriteAccess);
+
+ pDstPriv = DMX_GET_PICT_PRIV(pDst);
+ if (!pDstPriv->pict)
+ return ret;
+
+ scrnNum = pDst->pDrawable->pScreen->myNum;
+ dmxScreen = &dmxScreens[scrnNum];
+
+ /* Note: If the back-end display has been detached, then it
+ * should not be possible to reach here since the pSrcPriv->pict
+ * and pDstPriv->pict will have already been set to 0.
+ */
+ if (!dmxScreen->beDisplay)
+ return ret;
+
+ if (stuff->maskFormat)
+ dixLookupResourceByType((pointer *) &pFmt,
+ stuff->maskFormat, PictFormatType,
+ client, DixReadAccess);
+ else
+ pFmt = NULL;
+
+ pFormat = dmxFindFormat(dmxScreen, pFmt);
+
+ switch (stuff->renderReqType) {
+ case X_RenderCompositeGlyphs8:
+ size = sizeof(CARD8);
+ break;
+ case X_RenderCompositeGlyphs16:
+ size = sizeof(CARD16);
+ break;
+ case X_RenderCompositeGlyphs32:
+ size = sizeof(CARD32);
+ break;
+ default:
+ return BadPictOp; /* Can't happen */
+ }
+
+ buffer = (CARD8 *) (stuff + 1);
+ end = (CARD8 *) stuff + (stuff->length << 2);
+ nelt = 0;
+ nglyph = 0;
+ while (buffer + sizeof(xGlyphElt) < end) {
+ elt = (xGlyphElt *) buffer;
+ buffer += sizeof(xGlyphElt);
+
+ if (elt->len == 0xff) {
+ buffer += 4;
+ }
+ else {
+ nelt++;
+ nglyph += elt->len;
+ space = size * elt->len;
+ if (space & 3)
+ space += 4 - (space & 3);
+ buffer += space;
+ }
+ }
+
+ /* The following only works for Render version > 0.2 */
+
+ /* All of the XGlyphElt* structure sizes are identical */
+ elts = malloc(nelt * sizeof(XGlyphElt8));
+ if (!elts)
+ return BadAlloc;
+
+ glyphs = malloc(nglyph * size);
+ if (!glyphs) {
+ free(elts);
+ return BadAlloc;
+ }
+
+ buffer = (CARD8 *) (stuff + 1);
+ end = (CARD8 *) stuff + (stuff->length << 2);
+ curGlyph = glyphs;
+ curElt = elts;
+
+ dixLookupResourceByType((pointer *) &glyphSet,
+ stuff->glyphset, GlyphSetType,
+ client, DixReadAccess);
+ glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+
+ while (buffer + sizeof(xGlyphElt) < end) {
+ elt = (xGlyphElt *) buffer;
+ buffer += sizeof(xGlyphElt);
+
+ if (elt->len == 0xff) {
+ dixLookupResourceByType((pointer *) &glyphSet,
+ *((CARD32 *) buffer),
+ GlyphSetType, client, DixReadAccess);
+ glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
+ buffer += 4;
+ }
+ else {
+ curElt->glyphset = glyphPriv->glyphSets[scrnNum];
+ curElt->xOff = elt->deltax;
+ curElt->yOff = elt->deltay;
+ curElt->nchars = elt->len;
+ curElt->chars = curGlyph;
+
+ memcpy(curGlyph, buffer, size * elt->len);
+ curGlyph += size * elt->len;
+
+ curElt++;
+
+ space = size * elt->len;
+ if (space & 3)
+ space += 4 - (space & 3);
+ buffer += space;
+ }
+ }
+
+ switch (stuff->renderReqType) {
+ case X_RenderCompositeGlyphs8:
+ XRenderCompositeText8(dmxScreen->beDisplay, stuff->op,
+ pSrcPriv->pict, pDstPriv->pict,
+ pFormat,
+ stuff->xSrc, stuff->ySrc, 0, 0, elts, nelt);
+ break;
+ case X_RenderCompositeGlyphs16:
+ XRenderCompositeText16(dmxScreen->beDisplay, stuff->op,
+ pSrcPriv->pict, pDstPriv->pict,
+ pFormat,
+ stuff->xSrc, stuff->ySrc,
+ 0, 0, (XGlyphElt16 *) elts, nelt);
+ break;
+ case X_RenderCompositeGlyphs32:
+ XRenderCompositeText32(dmxScreen->beDisplay, stuff->op,
+ pSrcPriv->pict, pDstPriv->pict,
+ pFormat,
+ stuff->xSrc, stuff->ySrc,
+ 0, 0, (XGlyphElt32 *) elts, nelt);
+ break;
+ }
+
+ dmxSync(dmxScreen, FALSE);
+
+ free(elts);
+ free(glyphs);
+ }
+
+ return ret;
+}
+
+/** Set the picture transform on each screen. */
+static int
+dmxProcRenderSetPictureTransform(ClientPtr client)
+{
+ DMXScreenInfo *dmxScreen;
+ PicturePtr pPicture;
+ dmxPictPrivPtr pPictPriv;
+ XTransform xform;
+
+ REQUEST(xRenderSetPictureTransformReq);
+
+ REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq);
+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess);
+
+ /* For the following to work with PanoramiX, it assumes that Render
+ * wraps the ProcRenderVector after dmxRenderInit has been called.
+ */
+ dmxScreen = &dmxScreens[pPicture->pDrawable->pScreen->myNum];
+ pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ if (pPictPriv->pict) {
+ xform.matrix[0][0] = stuff->transform.matrix11;
+ xform.matrix[0][1] = stuff->transform.matrix12;
+ xform.matrix[0][2] = stuff->transform.matrix13;
+ xform.matrix[1][0] = stuff->transform.matrix21;
+ xform.matrix[1][1] = stuff->transform.matrix22;
+ xform.matrix[1][2] = stuff->transform.matrix23;
+ xform.matrix[2][0] = stuff->transform.matrix31;
+ xform.matrix[2][1] = stuff->transform.matrix32;
+ xform.matrix[2][2] = stuff->transform.matrix33;
+
+ XRenderSetPictureTransform(dmxScreen->beDisplay,
+ pPictPriv->pict, &xform);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ return dmxSaveRenderVector[stuff->renderReqType] (client);
+}
+
+/** Set the picture filter on each screen. */
+static int
+dmxProcRenderSetPictureFilter(ClientPtr client)
+{
+ DMXScreenInfo *dmxScreen;
+ PicturePtr pPicture;
+ dmxPictPrivPtr pPictPriv;
+ char *filter;
+ XFixed *params;
+ int nparams;
+
+ REQUEST(xRenderSetPictureFilterReq);
+
+ REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq);
+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess);
+
+ /* For the following to work with PanoramiX, it assumes that Render
+ * wraps the ProcRenderVector after dmxRenderInit has been called.
+ */
+ dmxScreen = &dmxScreens[pPicture->pDrawable->pScreen->myNum];
+ pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ if (pPictPriv->pict) {
+ filter = (char *) (stuff + 1);
+ params = (XFixed *) (filter + ((stuff->nbytes + 3) & ~3));
+ nparams = ((XFixed *) stuff + client->req_len) - params;
+
+ XRenderSetPictureFilter(dmxScreen->beDisplay,
+ pPictPriv->pict, filter, params, nparams);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ return dmxSaveRenderVector[stuff->renderReqType] (client);
+}
+
+/** Create a picture on the appropriate screen. This is the actual
+ * function that creates the picture. However, if the associated
+ * window has not yet been created due to lazy window creation, then
+ * delay the picture creation until the window is mapped. */
+static Picture
+dmxDoCreatePicture(PicturePtr pPicture)
+{
+ DrawablePtr pDraw = pPicture->pDrawable;
+ ScreenPtr pScreen = pDraw->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ XRenderPictFormat *pFormat;
+ Drawable draw;
+
+ if (pPicture->pDrawable->type == DRAWABLE_WINDOW) {
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV((WindowPtr) (pDraw));
+
+ if (!(draw = pWinPriv->window)) {
+ /* Window has not been created yet due to the window
+ * optimization. Delay picture creation until window is
+ * mapped.
+ */
+ pWinPriv->hasPict = TRUE;
+ return 0;
+ }
+ }
+ else {
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV((PixmapPtr) (pDraw));
+
+ if (!(draw = pPixPriv->pixmap)) {
+ /* FIXME: Zero width/height pixmap?? */
+ return 0;
+ }
+ }
+
+ /* This should not be reached if the back-end display has been
+ * detached because the pWinPriv->window or the pPixPriv->pixmap
+ * will be NULL; however, we add it here for completeness
+ */
+ if (!dmxScreen->beDisplay)
+ return 0;
+
+ pFormat = dmxFindFormat(dmxScreen, pPicture->pFormat);
+
+ return XRenderCreatePicture(dmxScreen->beDisplay, draw, pFormat, 0, 0);
+}
+
+/** Create a list of pictures. This function is called by
+ * dmxCreateAndRealizeWindow() during the lazy window creation
+ * realization process. It creates the entire list of pictures that
+ * are associated with the given window. */
+void
+dmxCreatePictureList(WindowPtr pWindow)
+{
+ PicturePtr pPicture = GetPictureWindow(pWindow);
+
+ while (pPicture) {
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ /* Create the picture for this window */
+ pPictPriv->pict = dmxDoCreatePicture(pPicture);
+
+ /* ValidatePicture takes care of the state changes */
+
+ pPicture = pPicture->pNext;
+ }
+}
+
+/** Create \a pPicture on the backend. */
+int
+dmxBECreatePicture(PicturePtr pPicture)
+{
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ /* Create picutre on BE */
+ pPictPriv->pict = dmxDoCreatePicture(pPicture);
+
+ /* Flush changes to the backend server */
+ dmxValidatePicture(pPicture, (1 << (CPLastBit + 1)) - 1);
+
+ return Success;
+}
+
+/** Create a picture. This function handles the CreatePicture
+ * unwrapping/wrapping and calls dmxDoCreatePicture to actually create
+ * the picture on the appropriate screen. */
+int
+dmxCreatePicture(PicturePtr pPicture)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+ int ret = Success;
+
+ DMX_UNWRAP(CreatePicture, dmxScreen, ps);
+#if 1
+ if (ps->CreatePicture)
+ ret = ps->CreatePicture(pPicture);
+#endif
+
+ /* Create picture on back-end server */
+ pPictPriv->pict = dmxDoCreatePicture(pPicture);
+ pPictPriv->savedMask = 0;
+
+ DMX_WRAP(CreatePicture, dmxCreatePicture, dmxScreen, ps);
+
+ return ret;
+}
+
+/** Destroy \a pPicture on the back-end server. */
+Bool
+dmxBEFreePicture(PicturePtr pPicture)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ if (pPictPriv->pict) {
+ XRenderFreePicture(dmxScreen->beDisplay, pPictPriv->pict);
+ pPictPriv->pict = (Picture) 0;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/** Destroy a list of pictures that are associated with the window that
+ * is being destroyed. This function is called by #dmxDestroyWindow().
+ * */
+Bool
+dmxDestroyPictureList(WindowPtr pWindow)
+{
+ PicturePtr pPicture = GetPictureWindow(pWindow);
+ Bool ret = FALSE;
+
+ while (pPicture) {
+ ret |= dmxBEFreePicture(pPicture);
+ pPicture = pPicture->pNext;
+ }
+
+ return ret;
+}
+
+/** Destroy a picture. This function calls the wrapped function that
+ * frees the resources in the DMX server associated with this
+ * picture. */
+void
+dmxDestroyPicture(PicturePtr pPicture)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+
+ DMX_UNWRAP(DestroyPicture, dmxScreen, ps);
+
+ /* Destroy picture on back-end server */
+ if (dmxBEFreePicture(pPicture))
+ dmxSync(dmxScreen, FALSE);
+
+#if 1
+ if (ps->DestroyPicture)
+ ps->DestroyPicture(pPicture);
+#endif
+ DMX_WRAP(DestroyPicture, dmxDestroyPicture, dmxScreen, ps);
+}
+
+/** Change the picture's list of clip rectangles. */
+int
+dmxChangePictureClip(PicturePtr pPicture, int clipType, pointer value, int n)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ DMX_UNWRAP(ChangePictureClip, dmxScreen, ps);
+#if 1
+ if (ps->ChangePictureClip)
+ ps->ChangePictureClip(pPicture, clipType, value, n);
+#endif
+
+ /* Change picture clip rects on back-end server */
+ if (pPictPriv->pict) {
+ /* The clip has already been changed into a region by the mi
+ * routine called above.
+ */
+ if (clipType == CT_NONE) {
+ /* Disable clipping, show all */
+ XFixesSetPictureClipRegion(dmxScreen->beDisplay,
+ pPictPriv->pict, 0, 0, None);
+ }
+ else if (pPicture->clientClip) {
+ RegionPtr pClip = pPicture->clientClip;
+ BoxPtr pBox = RegionRects(pClip);
+ int nBox = RegionNumRects(pClip);
+ XRectangle *pRects;
+ XRectangle *pRect;
+ int nRects;
+
+ nRects = nBox;
+ pRects = pRect = malloc(nRects * sizeof(*pRect));
+
+ while (nBox--) {
+ pRect->x = pBox->x1;
+ pRect->y = pBox->y1;
+ pRect->width = pBox->x2 - pBox->x1;
+ pRect->height = pBox->y2 - pBox->y1;
+ pBox++;
+ pRect++;
+ }
+
+ XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
+ pPictPriv->pict,
+ 0, 0, pRects, nRects);
+ free(pRects);
+ }
+ else {
+ XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
+ pPictPriv->pict, 0, 0, NULL, 0);
+ }
+ dmxSync(dmxScreen, FALSE);
+ }
+ else {
+ /* FIXME: Handle saving clip region when offscreen */
+ }
+
+ DMX_WRAP(ChangePictureClip, dmxChangePictureClip, dmxScreen, ps);
+
+ return Success;
+}
+
+/** Destroy the picture's list of clip rectangles. */
+void
+dmxDestroyPictureClip(PicturePtr pPicture)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ DMX_UNWRAP(DestroyPictureClip, dmxScreen, ps);
+#if 1
+ if (ps->DestroyPictureClip)
+ ps->DestroyPictureClip(pPicture);
+#endif
+
+ /* Destroy picture clip rects on back-end server */
+ if (pPictPriv->pict) {
+ XRenderSetPictureClipRectangles(dmxScreen->beDisplay,
+ pPictPriv->pict, 0, 0, NULL, 0);
+ dmxSync(dmxScreen, FALSE);
+ }
+ else {
+ /* FIXME: Handle destroying clip region when offscreen */
+ }
+
+ DMX_WRAP(DestroyPictureClip, dmxDestroyPictureClip, dmxScreen, ps);
+}
+
+/** Change the attributes of the pictures. If the picture has not yet
+ * been created due to lazy window creation, save the mask so that it
+ * can be used to appropriately initialize the picture's attributes
+ * when it is created later. */
+void
+dmxChangePicture(PicturePtr pPicture, Mask mask)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ DMX_UNWRAP(ChangePicture, dmxScreen, ps);
+#if 1
+ if (ps->ChangePicture)
+ ps->ChangePicture(pPicture, mask);
+#endif
+
+ /* Picture attribute changes are handled in ValidatePicture */
+ pPictPriv->savedMask |= mask;
+
+ DMX_WRAP(ChangePicture, dmxChangePicture, dmxScreen, ps);
+}
+
+/** Validate the picture's attributes before rendering to it. Update
+ * any picture attributes that have been changed by one of the higher
+ * layers. */
+void
+dmxValidatePicture(PicturePtr pPicture, Mask mask)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+
+ DMX_UNWRAP(ValidatePicture, dmxScreen, ps);
+
+ /* Change picture attributes on back-end server */
+ if (pPictPriv->pict) {
+ XRenderPictureAttributes attribs;
+
+ if (mask & CPRepeat) {
+ attribs.repeat = pPicture->repeatType;
+ }
+ if (mask & CPAlphaMap) {
+ if (pPicture->alphaMap) {
+ dmxPictPrivPtr pAlphaPriv;
+
+ pAlphaPriv = DMX_GET_PICT_PRIV(pPicture->alphaMap);
+ if (pAlphaPriv->pict) {
+ attribs.alpha_map = pAlphaPriv->pict;
+ }
+ else {
+ /* FIXME: alpha picture drawable has not been created?? */
+ return; /* or should this be: attribs.alpha_map = None; */
+ }
+ }
+ else {
+ attribs.alpha_map = None;
+ }
+ }
+ if (mask & CPAlphaXOrigin)
+ attribs.alpha_x_origin = pPicture->alphaOrigin.x;
+ if (mask & CPAlphaYOrigin)
+ attribs.alpha_y_origin = pPicture->alphaOrigin.y;
+ if (mask & CPClipXOrigin)
+ attribs.clip_x_origin = pPicture->clipOrigin.x;
+ if (mask & CPClipYOrigin)
+ attribs.clip_y_origin = pPicture->clipOrigin.y;
+ if (mask & CPClipMask)
+ mask &= ~CPClipMask; /* Handled in ChangePictureClip */
+ if (mask & CPGraphicsExposure)
+ attribs.graphics_exposures = pPicture->graphicsExposures;
+ if (mask & CPSubwindowMode)
+ attribs.subwindow_mode = pPicture->subWindowMode;
+ if (mask & CPPolyEdge)
+ attribs.poly_edge = pPicture->polyEdge;
+ if (mask & CPPolyMode)
+ attribs.poly_mode = pPicture->polyMode;
+ if (mask & CPComponentAlpha)
+ attribs.component_alpha = pPicture->componentAlpha;
+
+ XRenderChangePicture(dmxScreen->beDisplay, pPictPriv->pict,
+ mask, &attribs);
+ dmxSync(dmxScreen, FALSE);
+ }
+ else {
+ pPictPriv->savedMask |= mask;
+ }
+
+#if 1
+ if (ps->ValidatePicture)
+ ps->ValidatePicture(pPicture, mask);
+#endif
+
+ DMX_WRAP(ValidatePicture, dmxValidatePicture, dmxScreen, ps);
+}
+
+/** Composite a picture on the appropriate screen by combining the
+ * specified rectangle of the transformed src and mask operands with
+ * the specified rectangle of the dst using op as the compositing
+ * operator. For a complete description see the protocol document of
+ * the RENDER library. */
+void
+dmxComposite(CARD8 op,
+ PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+ INT16 xSrc, INT16 ySrc,
+ INT16 xMask, INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
+ dmxPictPrivPtr pMaskPriv = NULL;
+ dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
+
+ if (pMask)
+ pMaskPriv = DMX_GET_PICT_PRIV(pMask);
+
+ DMX_UNWRAP(Composite, dmxScreen, ps);
+#if 0
+ if (ps->Composite)
+ ps->Composite(op, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst, width, height);
+#endif
+
+ /* Composite on back-end server */
+ if (pSrcPriv->pict && pDstPriv->pict &&
+ ((pMaskPriv && pMaskPriv->pict) || !pMaskPriv)) {
+ XRenderComposite(dmxScreen->beDisplay,
+ op,
+ pSrcPriv->pict,
+ pMaskPriv ? pMaskPriv->pict : None,
+ pDstPriv->pict,
+ xSrc, ySrc, xMask, yMask, xDst, yDst, width, height);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ DMX_WRAP(Composite, dmxComposite, dmxScreen, ps);
+}
+
+/** Null function to catch when/if RENDER calls lower level mi hooks.
+ * Compositing glyphs is handled by dmxProcRenderCompositeGlyphs().
+ * This function should never be called. */
+void
+dmxGlyphs(CARD8 op,
+ PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc,
+ int nlists, GlyphListPtr lists, GlyphPtr * glyphs)
+{
+ /* This won't work, so we need to wrap ProcRenderCompositeGlyphs */
+}
+
+/** Fill a rectangle on the appropriate screen by combining the color
+ * with the dest picture in the area specified by the list of
+ * rectangles. For a complete description see the protocol document of
+ * the RENDER library. */
+void
+dmxCompositeRects(CARD8 op,
+ PicturePtr pDst,
+ xRenderColor * color, int nRect, xRectangle *rects)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pDst);
+
+ DMX_UNWRAP(CompositeRects, dmxScreen, ps);
+#if 0
+ if (ps->CompositeRects)
+ ps->CompositeRects(op, pDst, color, nRect, rects);
+#endif
+
+ /* CompositeRects on back-end server */
+ if (pPictPriv->pict) {
+ XRenderFillRectangles(dmxScreen->beDisplay,
+ op,
+ pPictPriv->pict,
+ (XRenderColor *) color,
+ (XRectangle *) rects, nRect);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ DMX_WRAP(CompositeRects, dmxCompositeRects, dmxScreen, ps);
+}
+
+/** Indexed color visuals are not yet supported. */
+Bool
+dmxInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat)
+{
+ return TRUE;
+}
+
+/** Indexed color visuals are not yet supported. */
+void
+dmxCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat)
+{
+}
+
+/** Indexed color visuals are not yet supported. */
+void
+dmxUpdateIndexed(ScreenPtr pScreen, PictFormatPtr pFormat,
+ int ndef, xColorItem * pdef)
+{
+}
+
+/** Composite a list of trapezoids on the appropriate screen. For a
+ * complete description see the protocol document of the RENDER
+ * library. */
+void
+dmxTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
+ dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
+
+ DMX_UNWRAP(Trapezoids, dmxScreen, ps);
+#if 0
+ if (ps->Trapezoids)
+ ps->Trapezoids(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntrap, *traps);
+#endif
+
+ /* Draw trapezoids on back-end server */
+ if (pDstPriv->pict) {
+ XRenderPictFormat *pFormat;
+
+ pFormat = dmxFindFormat(dmxScreen, maskFormat);
+ if (!pFormat) {
+ /* FIXME: Error! */
+ }
+
+ XRenderCompositeTrapezoids(dmxScreen->beDisplay,
+ op,
+ pSrcPriv->pict,
+ pDstPriv->pict,
+ pFormat,
+ xSrc, ySrc, (XTrapezoid *) traps, ntrap);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ DMX_WRAP(Trapezoids, dmxTrapezoids, dmxScreen, ps);
+}
+
+/** Composite a list of triangles on the appropriate screen. For a
+ * complete description see the protocol document of the RENDER
+ * library. */
+void
+dmxTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntri, xTriangle * tris)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc);
+ dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst);
+
+ DMX_UNWRAP(Triangles, dmxScreen, ps);
+#if 0
+ if (ps->Triangles)
+ ps->Triangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, *tris);
+#endif
+
+ /* Draw trapezoids on back-end server */
+ if (pDstPriv->pict) {
+ XRenderPictFormat *pFormat;
+
+ pFormat = dmxFindFormat(dmxScreen, maskFormat);
+ if (!pFormat) {
+ /* FIXME: Error! */
+ }
+
+ XRenderCompositeTriangles(dmxScreen->beDisplay,
+ op,
+ pSrcPriv->pict,
+ pDstPriv->pict,
+ pFormat,
+ xSrc, ySrc, (XTriangle *) tris, ntri);
+ dmxSync(dmxScreen, FALSE);
+ }
+
+ DMX_WRAP(Triangles, dmxTriangles, dmxScreen, ps);
+}
diff --git a/xorg-server/hw/dmx/dmxpict.h b/xorg-server/hw/dmx/dmxpict.h
index f1d8c1f52..6c37be924 100644
--- a/xorg-server/hw/dmx/dmxpict.h
+++ b/xorg-server/hw/dmx/dmxpict.h
@@ -1,120 +1,116 @@
-/*
- * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <kem@redhat.com>
- *
- */
-
-/** \file
- * This file provides access to the externally visible RENDER support
- * functions, global variables and macros for DMX.
- *
- * FIXME: Move function definitions for non-externally visible function
- * to .c file. */
-
-#ifndef DMXPICT_H
-#define DMXPICT_H
-
-/** Picture private structure */
-typedef struct _dmxPictPriv {
- Picture pict; /**< Picture ID from back-end server */
- Mask savedMask; /**< Mask of picture attributes saved for
- * lazy window creation. */
-} dmxPictPrivRec, *dmxPictPrivPtr;
-
-
-/** Glyph Set private structure */
-typedef struct _dmxGlyphPriv {
- GlyphSet *glyphSets; /**< Glyph Set IDs from back-end server */
-} dmxGlyphPrivRec, *dmxGlyphPrivPtr;
-
-
-extern void dmxInitRender(void);
-extern void dmxResetRender(void);
-
-extern Bool dmxPictureInit(ScreenPtr pScreen,
- PictFormatPtr formats, int nformats);
-
-extern void dmxCreatePictureList(WindowPtr pWindow);
-extern Bool dmxDestroyPictureList(WindowPtr pWindow);
-
-extern int dmxCreatePicture(PicturePtr pPicture);
-extern void dmxDestroyPicture(PicturePtr pPicture);
-extern int dmxChangePictureClip(PicturePtr pPicture, int clipType,
- pointer value, int n);
-extern void dmxDestroyPictureClip(PicturePtr pPicture);
-extern void dmxChangePicture(PicturePtr pPicture, Mask mask);
-extern void dmxValidatePicture(PicturePtr pPicture, Mask mask);
-extern void dmxComposite(CARD8 op,
- PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
- INT16 xSrc, INT16 ySrc,
- INT16 xMask, INT16 yMask,
- INT16 xDst, INT16 yDst,
- CARD16 width, CARD16 height);
-extern void dmxGlyphs(CARD8 op,
- PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc, INT16 ySrc,
- int nlists, GlyphListPtr lists, GlyphPtr *glyphs);
-extern void dmxCompositeRects(CARD8 op,
- PicturePtr pDst,
- xRenderColor *color,
- int nRect, xRectangle *rects);
-extern Bool dmxInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat);
-extern void dmxCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat);
-extern void dmxUpdateIndexed(ScreenPtr pScreen, PictFormatPtr pFormat,
- int ndef, xColorItem *pdef);
-extern void dmxTrapezoids(CARD8 op,
- PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc, INT16 ySrc,
- int ntrap, xTrapezoid *traps);
-extern void dmxTriangles(CARD8 op,
- PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc, INT16 ySrc,
- int ntri, xTriangle *tris);
-
-extern int dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet);
-extern Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet);
-extern int dmxBECreatePicture(PicturePtr pPicture);
-extern Bool dmxBEFreePicture(PicturePtr pPicture);
-
-/** Get the picture private data given a picture pointer */
-#define DMX_GET_PICT_PRIV(_pPict) \
- (dmxPictPrivPtr)dixLookupPrivate(&(_pPict)->devPrivates, dmxPictPrivateKey)
-
-/** Set the glyphset private data given a glyphset pointer */
-#define DMX_SET_GLYPH_PRIV(_pGlyph, _pPriv) \
- GlyphSetSetPrivate((_pGlyph), dmxGlyphSetPrivateKey, (_pPriv))
-/** Get the glyphset private data given a glyphset pointer */
-#define DMX_GET_GLYPH_PRIV(_pGlyph) \
- (dmxGlyphPrivPtr)GlyphSetGetPrivate((_pGlyph), dmxGlyphSetPrivateKey)
-
-#endif /* DMXPICT_H */
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * This file provides access to the externally visible RENDER support
+ * functions, global variables and macros for DMX.
+ *
+ * FIXME: Move function definitions for non-externally visible function
+ * to .c file. */
+
+#ifndef DMXPICT_H
+#define DMXPICT_H
+
+/** Picture private structure */
+typedef struct _dmxPictPriv {
+ Picture pict; /**< Picture ID from back-end server */
+ Mask savedMask; /**< Mask of picture attributes saved for
+ * lazy window creation. */
+} dmxPictPrivRec, *dmxPictPrivPtr;
+
+/** Glyph Set private structure */
+typedef struct _dmxGlyphPriv {
+ GlyphSet *glyphSets; /**< Glyph Set IDs from back-end server */
+} dmxGlyphPrivRec, *dmxGlyphPrivPtr;
+
+extern void dmxInitRender(void);
+extern void dmxResetRender(void);
+
+extern Bool dmxPictureInit(ScreenPtr pScreen,
+ PictFormatPtr formats, int nformats);
+
+extern void dmxCreatePictureList(WindowPtr pWindow);
+extern Bool dmxDestroyPictureList(WindowPtr pWindow);
+
+extern int dmxCreatePicture(PicturePtr pPicture);
+extern void dmxDestroyPicture(PicturePtr pPicture);
+extern int dmxChangePictureClip(PicturePtr pPicture, int clipType,
+ pointer value, int n);
+extern void dmxDestroyPictureClip(PicturePtr pPicture);
+extern void dmxChangePicture(PicturePtr pPicture, Mask mask);
+extern void dmxValidatePicture(PicturePtr pPicture, Mask mask);
+extern void dmxComposite(CARD8 op,
+ PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+ INT16 xSrc, INT16 ySrc,
+ INT16 xMask, INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
+extern void dmxGlyphs(CARD8 op,
+ PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc,
+ int nlists, GlyphListPtr lists, GlyphPtr * glyphs);
+extern void dmxCompositeRects(CARD8 op,
+ PicturePtr pDst,
+ xRenderColor * color,
+ int nRect, xRectangle *rects);
+extern Bool dmxInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat);
+extern void dmxCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat);
+extern void dmxUpdateIndexed(ScreenPtr pScreen, PictFormatPtr pFormat,
+ int ndef, xColorItem * pdef);
+extern void dmxTrapezoids(CARD8 op,
+ PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc,
+ int ntrap, xTrapezoid * traps);
+extern void dmxTriangles(CARD8 op,
+ PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc, INT16 ySrc, int ntri, xTriangle * tris);
+
+extern int dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet);
+extern Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet);
+extern int dmxBECreatePicture(PicturePtr pPicture);
+extern Bool dmxBEFreePicture(PicturePtr pPicture);
+
+/** Get the picture private data given a picture pointer */
+#define DMX_GET_PICT_PRIV(_pPict) \
+ (dmxPictPrivPtr)dixLookupPrivate(&(_pPict)->devPrivates, dmxPictPrivateKey)
+
+/** Set the glyphset private data given a glyphset pointer */
+#define DMX_SET_GLYPH_PRIV(_pGlyph, _pPriv) \
+ GlyphSetSetPrivate((_pGlyph), dmxGlyphSetPrivateKey, (_pPriv))
+/** Get the glyphset private data given a glyphset pointer */
+#define DMX_GET_GLYPH_PRIV(_pGlyph) \
+ (dmxGlyphPrivPtr)GlyphSetGetPrivate((_pGlyph), dmxGlyphSetPrivateKey)
+
+#endif /* DMXPICT_H */
diff --git a/xorg-server/hw/dmx/dmxpixmap.c b/xorg-server/hw/dmx/dmxpixmap.c
index 119dd1134..17aca9224 100644
--- a/xorg-server/hw/dmx/dmxpixmap.c
+++ b/xorg-server/hw/dmx/dmxpixmap.c
@@ -1,251 +1,262 @@
-/*
- * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <kem@redhat.com>
- *
- */
-
-/** \file
- * Provides pixmap support. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxsync.h"
-#include "dmxpixmap.h"
-
-#include "pixmapstr.h"
-#include "servermd.h"
-#include "privates.h"
-
-/** Initialize a private area in \a pScreen for pixmap information. */
-Bool dmxInitPixmap(ScreenPtr pScreen)
-{
- if (!dixRegisterPrivateKey(&dmxPixPrivateKeyRec, PRIVATE_PIXMAP, sizeof(dmxPixPrivRec)))
- return FALSE;
-
- return TRUE;
-}
-
-/** Create a pixmap on the back-end server. */
-void dmxBECreatePixmap(PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
-
- /* Make sure we haven't already created this pixmap. This can
- * happen when the pixmap is used elsewhere (e.g., as a background
- * or border for a window) and the refcnt > 1.
- */
- if (pPixPriv->pixmap)
- return;
-
- if (pPixmap->drawable.width && pPixmap->drawable.height) {
- pPixPriv->pixmap = XCreatePixmap(dmxScreen->beDisplay,
- dmxScreen->scrnWin,
- pPixmap->drawable.width,
- pPixmap->drawable.height,
- pPixmap->drawable.depth);
- dmxSync(dmxScreen, FALSE);
- }
-}
-
-/** Create a pixmap for \a pScreen with the specified \a width, \a
- * height, and \a depth. */
-PixmapPtr dmxCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
- unsigned usage_hint)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- PixmapPtr pPixmap;
- int bpp;
- dmxPixPrivPtr pPixPriv;
-
-#if 0
- DMX_UNWRAP(CreatePixmap, dmxScreen, pScreen);
- if (pScreen->CreatePixmap)
- ret = pScreen->CreatePixmap(pPixmap);
-#endif
-
- /* Create pixmap on back-end server */
- if (depth == 24) bpp = 32;
- else bpp = depth;
-
- pPixmap = AllocatePixmap(pScreen, 0);
- if (!pPixmap)
- return NullPixmap;
-
- pPixmap->drawable.type = DRAWABLE_PIXMAP;
- pPixmap->drawable.class = 0;
- pPixmap->drawable.pScreen = pScreen;
- pPixmap->drawable.depth = depth;
- pPixmap->drawable.bitsPerPixel = bpp;
- pPixmap->drawable.id = 0;
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- pPixmap->drawable.x = 0;
- pPixmap->drawable.y = 0;
- pPixmap->drawable.width = width;
- pPixmap->drawable.height = height;
- pPixmap->devKind = PixmapBytePad(width, bpp);
- pPixmap->refcnt = 1;
- pPixmap->usage_hint = usage_hint;
-
- pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
- pPixPriv->pixmap = (Pixmap)0;
- pPixPriv->detachedImage = NULL;
-
- /* Create the pixmap on the back-end server */
- if (dmxScreen->beDisplay) {
- dmxBECreatePixmap(pPixmap);
- }
-
-#if 0
- DMX_WRAP(CreatePixmap, dmxCreatePixmap, dmxScreen, pScreen);
-#endif
-
- return pPixmap;
-}
-
-/** Destroy the pixmap on the back-end server. */
-Bool dmxBEFreePixmap(PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
-
- if (pPixPriv->pixmap) {
- XFreePixmap(dmxScreen->beDisplay, pPixPriv->pixmap);
- pPixPriv->pixmap = (Pixmap)0;
- return TRUE;
- }
-
- return FALSE;
-}
-
-/** Destroy the pixmap pointed to by \a pPixmap. */
-Bool dmxDestroyPixmap(PixmapPtr pPixmap)
-{
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- Bool ret = TRUE;
-
-#if 0
- DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen);
-#endif
-
- if (--pPixmap->refcnt)
- return TRUE;
-
- /* Destroy pixmap on back-end server */
- if (dmxScreen->beDisplay) {
- if (dmxBEFreePixmap(pPixmap)) {
- /* Also make sure that we destroy any detached image */
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
- if (pPixPriv->detachedImage)
- XDestroyImage(pPixPriv->detachedImage);
- dmxSync(dmxScreen, FALSE);
- }
- }
- FreePixmap(pPixmap);
-
-#if 0
- if (pScreen->DestroyPixmap)
- ret = pScreen->DestroyPixmap(pPixmap);
- DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen);
-#endif
-
- return ret;
-}
-
-/** Create and return a region based on the pixmap pointed to by \a
- * pPixmap. */
-RegionPtr dmxBitmapToRegion(PixmapPtr pPixmap)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pPixmap->drawable.pScreen->myNum];
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
- XImage *ximage;
- RegionPtr pReg, pTmpReg;
- int x, y;
- unsigned long previousPixel, currentPixel;
- BoxRec Box;
- Bool overlap;
-
- if (!dmxScreen->beDisplay) {
- pReg = RegionCreate(NullBox, 1);
- return pReg;
- }
-
- ximage = XGetImage(dmxScreen->beDisplay, pPixPriv->pixmap, 0, 0,
- pPixmap->drawable.width, pPixmap->drawable.height,
- 1, XYPixmap);
-
- pReg = RegionCreate(NullBox, 1);
- pTmpReg = RegionCreate(NullBox, 1);
- if(!pReg || !pTmpReg) {
- XDestroyImage(ximage);
- return NullRegion;
- }
-
- for (y = 0; y < pPixmap->drawable.height; y++) {
- Box.y1 = y;
- Box.y2 = y + 1;
- previousPixel = 0L;
- for (x = 0; x < pPixmap->drawable.width; x++) {
- currentPixel = XGetPixel(ximage, x, y);
- if (previousPixel != currentPixel) {
- if (previousPixel == 0L) {
- /* left edge */
- Box.x1 = x;
- } else if (currentPixel == 0L) {
- /* right edge */
- Box.x2 = x;
- RegionReset(pTmpReg, &Box);
- RegionAppend(pReg, pTmpReg);
- }
- previousPixel = currentPixel;
- }
- }
- if (previousPixel != 0L) {
- /* right edge because of the end of pixmap */
- Box.x2 = pPixmap->drawable.width;
- RegionReset(pTmpReg, &Box);
- RegionAppend(pReg, pTmpReg);
- }
- }
-
- RegionDestroy(pTmpReg);
- XDestroyImage(ximage);
-
- RegionValidate(pReg, &overlap);
-
- dmxSync(dmxScreen, FALSE);
- return pReg;
-}
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Provides pixmap support. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxpixmap.h"
+
+#include "pixmapstr.h"
+#include "servermd.h"
+#include "privates.h"
+
+/** Initialize a private area in \a pScreen for pixmap information. */
+Bool
+dmxInitPixmap(ScreenPtr pScreen)
+{
+ if (!dixRegisterPrivateKey
+ (&dmxPixPrivateKeyRec, PRIVATE_PIXMAP, sizeof(dmxPixPrivRec)))
+ return FALSE;
+
+ return TRUE;
+}
+
+/** Create a pixmap on the back-end server. */
+void
+dmxBECreatePixmap(PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+
+ /* Make sure we haven't already created this pixmap. This can
+ * happen when the pixmap is used elsewhere (e.g., as a background
+ * or border for a window) and the refcnt > 1.
+ */
+ if (pPixPriv->pixmap)
+ return;
+
+ if (pPixmap->drawable.width && pPixmap->drawable.height) {
+ pPixPriv->pixmap = XCreatePixmap(dmxScreen->beDisplay,
+ dmxScreen->scrnWin,
+ pPixmap->drawable.width,
+ pPixmap->drawable.height,
+ pPixmap->drawable.depth);
+ dmxSync(dmxScreen, FALSE);
+ }
+}
+
+/** Create a pixmap for \a pScreen with the specified \a width, \a
+ * height, and \a depth. */
+PixmapPtr
+dmxCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
+ unsigned usage_hint)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PixmapPtr pPixmap;
+ int bpp;
+ dmxPixPrivPtr pPixPriv;
+
+#if 0
+ DMX_UNWRAP(CreatePixmap, dmxScreen, pScreen);
+ if (pScreen->CreatePixmap)
+ ret = pScreen->CreatePixmap(pPixmap);
+#endif
+
+ /* Create pixmap on back-end server */
+ if (depth == 24)
+ bpp = 32;
+ else
+ bpp = depth;
+
+ pPixmap = AllocatePixmap(pScreen, 0);
+ if (!pPixmap)
+ return NullPixmap;
+
+ pPixmap->drawable.type = DRAWABLE_PIXMAP;
+ pPixmap->drawable.class = 0;
+ pPixmap->drawable.pScreen = pScreen;
+ pPixmap->drawable.depth = depth;
+ pPixmap->drawable.bitsPerPixel = bpp;
+ pPixmap->drawable.id = 0;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ pPixmap->drawable.x = 0;
+ pPixmap->drawable.y = 0;
+ pPixmap->drawable.width = width;
+ pPixmap->drawable.height = height;
+ pPixmap->devKind = PixmapBytePad(width, bpp);
+ pPixmap->refcnt = 1;
+ pPixmap->usage_hint = usage_hint;
+
+ pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+ pPixPriv->pixmap = (Pixmap) 0;
+ pPixPriv->detachedImage = NULL;
+
+ /* Create the pixmap on the back-end server */
+ if (dmxScreen->beDisplay) {
+ dmxBECreatePixmap(pPixmap);
+ }
+
+#if 0
+ DMX_WRAP(CreatePixmap, dmxCreatePixmap, dmxScreen, pScreen);
+#endif
+
+ return pPixmap;
+}
+
+/** Destroy the pixmap on the back-end server. */
+Bool
+dmxBEFreePixmap(PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+
+ if (pPixPriv->pixmap) {
+ XFreePixmap(dmxScreen->beDisplay, pPixPriv->pixmap);
+ pPixPriv->pixmap = (Pixmap) 0;
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/** Destroy the pixmap pointed to by \a pPixmap. */
+Bool
+dmxDestroyPixmap(PixmapPtr pPixmap)
+{
+ ScreenPtr pScreen = pPixmap->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ Bool ret = TRUE;
+
+#if 0
+ DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen);
+#endif
+
+ if (--pPixmap->refcnt)
+ return TRUE;
+
+ /* Destroy pixmap on back-end server */
+ if (dmxScreen->beDisplay) {
+ if (dmxBEFreePixmap(pPixmap)) {
+ /* Also make sure that we destroy any detached image */
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+
+ if (pPixPriv->detachedImage)
+ XDestroyImage(pPixPriv->detachedImage);
+ dmxSync(dmxScreen, FALSE);
+ }
+ }
+ FreePixmap(pPixmap);
+
+#if 0
+ if (pScreen->DestroyPixmap)
+ ret = pScreen->DestroyPixmap(pPixmap);
+ DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen);
+#endif
+
+ return ret;
+}
+
+/** Create and return a region based on the pixmap pointed to by \a
+ * pPixmap. */
+RegionPtr
+dmxBitmapToRegion(PixmapPtr pPixmap)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pPixmap->drawable.pScreen->myNum];
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap);
+ XImage *ximage;
+ RegionPtr pReg, pTmpReg;
+ int x, y;
+ unsigned long previousPixel, currentPixel;
+ BoxRec Box;
+ Bool overlap;
+
+ if (!dmxScreen->beDisplay) {
+ pReg = RegionCreate(NullBox, 1);
+ return pReg;
+ }
+
+ ximage = XGetImage(dmxScreen->beDisplay, pPixPriv->pixmap, 0, 0,
+ pPixmap->drawable.width, pPixmap->drawable.height,
+ 1, XYPixmap);
+
+ pReg = RegionCreate(NullBox, 1);
+ pTmpReg = RegionCreate(NullBox, 1);
+ if (!pReg || !pTmpReg) {
+ XDestroyImage(ximage);
+ return NullRegion;
+ }
+
+ for (y = 0; y < pPixmap->drawable.height; y++) {
+ Box.y1 = y;
+ Box.y2 = y + 1;
+ previousPixel = 0L;
+ for (x = 0; x < pPixmap->drawable.width; x++) {
+ currentPixel = XGetPixel(ximage, x, y);
+ if (previousPixel != currentPixel) {
+ if (previousPixel == 0L) {
+ /* left edge */
+ Box.x1 = x;
+ }
+ else if (currentPixel == 0L) {
+ /* right edge */
+ Box.x2 = x;
+ RegionReset(pTmpReg, &Box);
+ RegionAppend(pReg, pTmpReg);
+ }
+ previousPixel = currentPixel;
+ }
+ }
+ if (previousPixel != 0L) {
+ /* right edge because of the end of pixmap */
+ Box.x2 = pPixmap->drawable.width;
+ RegionReset(pTmpReg, &Box);
+ RegionAppend(pReg, pTmpReg);
+ }
+ }
+
+ RegionDestroy(pTmpReg);
+ XDestroyImage(ximage);
+
+ RegionValidate(pReg, &overlap);
+
+ dmxSync(dmxScreen, FALSE);
+ return pReg;
+}
diff --git a/xorg-server/hw/dmx/dmxprop.c b/xorg-server/hw/dmx/dmxprop.c
index b4695dd5d..4be2dbd4c 100644
--- a/xorg-server/hw/dmx/dmxprop.c
+++ b/xorg-server/hw/dmx/dmxprop.c
@@ -62,7 +62,7 @@
#include "dmx.h"
#include "dmxprop.h"
#include "dmxlog.h"
-#include <X11/Xmu/SysUtil.h> /* For XmuGetHostname */
+#include <X11/Xmu/SysUtil.h> /* For XmuGetHostname */
/** Holds the window id of all DMX windows on the backend X server. */
#define DMX_ATOMNAME "DMX_NAME"
@@ -72,95 +72,108 @@
extern char *display;
-static int dmxPropertyErrorHandler(Display *dpy, XErrorEvent *ev)
+static int
+dmxPropertyErrorHandler(Display * dpy, XErrorEvent * ev)
{
return 0;
}
-static const unsigned char *dmxPropertyIdentifier(void)
+static const unsigned char *
+dmxPropertyIdentifier(void)
{
- /* RATS: These buffers are only used in
- * length-limited calls. */
- char hostname[256];
- static char buf[128];
- static int initialized = 0;
-
- if (initialized++) return (unsigned char *)buf;
-
+ /* RATS: These buffers are only used in
+ * length-limited calls. */
+ char hostname[256];
+ static char buf[128];
+ static int initialized = 0;
+
+ if (initialized++)
+ return (unsigned char *) buf;
+
XmuGetHostname(hostname, sizeof(hostname));
snprintf(buf, sizeof(buf), "%s:%s:%s", DMX_IDENT, hostname, display);
- return (unsigned char *)buf;
+ return (unsigned char *) buf;
}
/** Starting with the \a start screen, iterate over all of the screens
* on the same physical X server as \a start, calling \a f with the
* screen and the \a closure. (The common case is that \a start is the
* only DMX window on the backend X server.) */
-void *dmxPropertyIterate(DMXScreenInfo *start,
- void *(*f)(DMXScreenInfo *dmxScreen, void *),
- void *closure)
+void *
+dmxPropertyIterate(DMXScreenInfo * start,
+ void *(*f) (DMXScreenInfo * dmxScreen, void *),
+ void *closure)
{
DMXScreenInfo *pt;
if (!start->next) {
- if (!start->beDisplay) return NULL;
+ if (!start->beDisplay)
+ return NULL;
return f(start, closure);
}
- for (pt = start->next; /* condition at end of loop */; pt = pt->next) {
+ for (pt = start->next; /* condition at end of loop */ ; pt = pt->next) {
void *retval;
+
/* beDisplay ban be NULL if a screen was detached */
dmxLog(dmxDebug, "pt = %p\n", pt);
dmxLog(dmxDebug, "pt->beDisplay = %p\n", pt->beDisplay);
- if (pt->beDisplay && (retval = f(pt, closure))) return retval;
- if (pt == start) break;
+ if (pt->beDisplay && (retval = f(pt, closure)))
+ return retval;
+ if (pt == start)
+ break;
}
return NULL;
}
/** Returns 0 if this is the only Xdmx session on the display; 1
* otherwise. */
-static int dmxPropertyCheckOtherServers(DMXScreenInfo *dmxScreen, Atom atom)
+static int
+dmxPropertyCheckOtherServers(DMXScreenInfo * dmxScreen, Atom atom)
{
- Display *dpy = dmxScreen->beDisplay;
+ Display *dpy = dmxScreen->beDisplay;
XTextProperty tp;
XTextProperty tproot;
- const char *pt;
- int retcode = 0;
- char **list = NULL;
- int count = 0;
- int i;
- int (*dmxOldHandler)(Display *, XErrorEvent *);
+ const char *pt;
+ int retcode = 0;
+ char **list = NULL;
+ int count = 0;
+ int i;
+ int (*dmxOldHandler) (Display *, XErrorEvent *);
if (!dpy)
- return 0;
-
- if (!XGetTextProperty(dpy, RootWindow(dpy,0), &tproot, atom)
- || !tproot.nitems) return 0;
-
- /* Ignore BadWindow errors for this
- * routine because the window id stored
- * in the property might be old */
+ return 0;
+
+ if (!XGetTextProperty(dpy, RootWindow(dpy, 0), &tproot, atom)
+ || !tproot.nitems)
+ return 0;
+
+ /* Ignore BadWindow errors for this
+ * routine because the window id stored
+ * in the property might be old */
dmxOldHandler = XSetErrorHandler(dmxPropertyErrorHandler);
- for (pt = (const char *)tproot.value; pt && *pt; pt = pt ? pt + 1 : NULL) {
+ for (pt = (const char *) tproot.value; pt && *pt; pt = pt ? pt + 1 : NULL) {
if ((pt = strchr(pt, ','))) {
- Window win = strtol(pt+1, NULL, 10);
+ Window win = strtol(pt + 1, NULL, 10);
+
if (XGetTextProperty(dpy, win, &tp, atom) && tp.nitems) {
- if (!strncmp((char *)tp.value, DMX_IDENT, strlen(DMX_IDENT))) {
+ if (!strncmp((char *) tp.value, DMX_IDENT, strlen(DMX_IDENT))) {
int flag = 0;
+
for (i = 0; i < count; i++)
- if (!strcmp(list[i], (char *)tp.value)) {
+ if (!strcmp(list[i], (char *) tp.value)) {
++flag;
break;
}
- if (flag) continue;
+ if (flag)
+ continue;
++retcode;
dmxLogOutputWarning(dmxScreen,
"%s also running on %s\n",
tp.value, dmxScreen->name);
list = realloc(list, ++count * sizeof(*list));
- list[count-1] = malloc(tp.nitems + 2);
- strncpy(list[count-1], (char *)tp.value, tp.nitems + 1);
+ list[count - 1] = malloc(tp.nitems + 2);
+ strncpy(list[count - 1], (char *) tp.value, tp.nitems + 1);
}
XFree(tp.value);
}
@@ -168,7 +181,8 @@ static int dmxPropertyCheckOtherServers(DMXScreenInfo *dmxScreen, Atom atom)
}
XSetErrorHandler(dmxOldHandler);
- for (i = 0; i < count; i++) free(list[i]);
+ for (i = 0; i < count; i++)
+ free(list[i]);
free(list);
XFree(tproot.value);
if (!retcode)
@@ -179,40 +193,45 @@ static int dmxPropertyCheckOtherServers(DMXScreenInfo *dmxScreen, Atom atom)
/** Returns NULL if this is the only Xdmx window on the display.
* Otherwise, returns a pointer to the dmxScreen of the other windows on
* the display. */
-static DMXScreenInfo *dmxPropertyCheckOtherWindows(DMXScreenInfo *dmxScreen,
- Atom atom)
+static DMXScreenInfo *
+dmxPropertyCheckOtherWindows(DMXScreenInfo * dmxScreen, Atom atom)
{
- Display *dpy = dmxScreen->beDisplay;
- const unsigned char *id = dmxPropertyIdentifier();
- XTextProperty tproot;
- XTextProperty tp;
- const char *pt;
- int (*dmxOldHandler)(Display *, XErrorEvent *);
+ Display *dpy = dmxScreen->beDisplay;
+ const unsigned char *id = dmxPropertyIdentifier();
+ XTextProperty tproot;
+ XTextProperty tp;
+ const char *pt;
+ int (*dmxOldHandler) (Display *, XErrorEvent *);
if (!dpy)
- return NULL;
+ return NULL;
- if (!XGetTextProperty(dpy, RootWindow(dpy,0), &tproot, atom)
- || !tproot.nitems) return 0;
+ if (!XGetTextProperty(dpy, RootWindow(dpy, 0), &tproot, atom)
+ || !tproot.nitems)
+ return 0;
- /* Ignore BadWindow errors for this
- * routine because the window id stored
- * in the property might be old */
+ /* Ignore BadWindow errors for this
+ * routine because the window id stored
+ * in the property might be old */
dmxOldHandler = XSetErrorHandler(dmxPropertyErrorHandler);
- for (pt = (const char *)tproot.value; pt && *pt; pt = pt ? pt + 1 : NULL) {
+ for (pt = (const char *) tproot.value; pt && *pt; pt = pt ? pt + 1 : NULL) {
if ((pt = strchr(pt, ','))) {
- Window win = strtol(pt+1, NULL, 10);
+ Window win = strtol(pt + 1, NULL, 10);
+
if (XGetTextProperty(dpy, win, &tp, atom) && tp.nitems) {
- dmxLog(dmxDebug,"On %s/%lu: %s\n",
+ dmxLog(dmxDebug, "On %s/%lu: %s\n",
dmxScreen->name, win, tp.value);
- if (!strncmp((char *)tp.value, (char *)id,
- strlen((char *)id))) {
+ if (!strncmp((char *) tp.value, (char *) id,
+ strlen((char *) id))) {
int idx;
-
- if (!(pt = strchr((char *)tp.value, ','))) continue;
- idx = strtol(pt+1, NULL, 10);
- if (idx < 0 || idx >= dmxNumScreens) continue;
- if (dmxScreens[idx].scrnWin != win) continue;
+
+ if (!(pt = strchr((char *) tp.value, ',')))
+ continue;
+ idx = strtol(pt + 1, NULL, 10);
+ if (idx < 0 || idx >= dmxNumScreens)
+ continue;
+ if (dmxScreens[idx].scrnWin != win)
+ continue;
XSetErrorHandler(dmxOldHandler);
return &dmxScreens[idx];
}
@@ -227,22 +246,23 @@ static DMXScreenInfo *dmxPropertyCheckOtherWindows(DMXScreenInfo *dmxScreen,
/** Returns 0 if this is the only Xdmx session on the display; 1
* otherwise. */
-int dmxPropertyDisplay(DMXScreenInfo *dmxScreen)
+int
+dmxPropertyDisplay(DMXScreenInfo * dmxScreen)
{
- Atom atom;
- const unsigned char *id = dmxPropertyIdentifier();
- Display *dpy = dmxScreen->beDisplay;
+ Atom atom;
+ const unsigned char *id = dmxPropertyIdentifier();
+ Display *dpy = dmxScreen->beDisplay;
if (!dpy)
- return 0;
+ return 0;
atom = XInternAtom(dpy, DMX_ATOMNAME, False);
if (dmxPropertyCheckOtherServers(dmxScreen, atom)) {
dmxScreen->shared = 1;
return 1;
}
- XChangeProperty(dpy, RootWindow(dpy,0), atom, XA_STRING, 8,
- PropModeReplace, id, strlen((char *)id));
+ XChangeProperty(dpy, RootWindow(dpy, 0), atom, XA_STRING, 8,
+ PropModeReplace, id, strlen((char *) id));
return 0;
}
@@ -251,18 +271,19 @@ int dmxPropertyDisplay(DMXScreenInfo *dmxScreen)
* names because there can be multiple synonyms for the same display,
* some of which cannot be determined without accessing the display
* itself (e.g., domain aliases or machines with multiple NICs). */
-int dmxPropertySameDisplay(DMXScreenInfo *dmxScreen, const char *name)
+int
+dmxPropertySameDisplay(DMXScreenInfo * dmxScreen, const char *name)
{
- Display *dpy0 = dmxScreen->beDisplay;
- Atom atom0;
- XTextProperty tp0;
- Display *dpy1 = NULL;
- Atom atom1;
- XTextProperty tp1;
- int retval = 0;
+ Display *dpy0 = dmxScreen->beDisplay;
+ Atom atom0;
+ XTextProperty tp0;
+ Display *dpy1 = NULL;
+ Atom atom1;
+ XTextProperty tp1;
+ int retval = 0;
if (!dpy0)
- return 0;
+ return 0;
tp0.nitems = 0;
tp1.nitems = 0;
@@ -271,7 +292,7 @@ int dmxPropertySameDisplay(DMXScreenInfo *dmxScreen, const char *name)
dmxLog(dmxWarning, "No atom on %s\n", dmxScreen->name);
return 0;
}
- if (!XGetTextProperty(dpy0, RootWindow(dpy0,0), &tp0, atom0)
+ if (!XGetTextProperty(dpy0, RootWindow(dpy0, 0), &tp0, atom0)
|| !tp0.nitems) {
dmxLog(dmxWarning, "No text property on %s\n", dmxScreen->name);
return 0;
@@ -286,17 +307,21 @@ int dmxPropertySameDisplay(DMXScreenInfo *dmxScreen, const char *name)
dmxLog(dmxDebug, "No atom on %s\n", name);
goto cleanup;
}
- if (!XGetTextProperty(dpy1, RootWindow(dpy1,0), &tp1, atom1)
+ if (!XGetTextProperty(dpy1, RootWindow(dpy1, 0), &tp1, atom1)
|| !tp1.nitems) {
dmxLog(dmxDebug, "No text property on %s\n", name);
goto cleanup;
}
- if (!strcmp((char *)tp0.value, (char *)tp1.value)) retval = 1;
-
- cleanup:
- if (tp0.nitems) XFree(tp0.value);
- if (tp1.nitems) XFree(tp1.value);
- if (dpy1) XCloseDisplay(dpy1);
+ if (!strcmp((char *) tp0.value, (char *) tp1.value))
+ retval = 1;
+
+ cleanup:
+ if (tp0.nitems)
+ XFree(tp0.value);
+ if (tp1.nitems)
+ XFree(tp1.value);
+ if (dpy1)
+ XCloseDisplay(dpy1);
return retval;
}
@@ -313,36 +338,38 @@ int dmxPropertySameDisplay(DMXScreenInfo *dmxScreen, const char *name)
*
* "#DMX_IDENT:<hostname running DMX>:<display name of DMX>,<screen number>"
*/
-void dmxPropertyWindow(DMXScreenInfo *dmxScreen)
+void
+dmxPropertyWindow(DMXScreenInfo * dmxScreen)
{
- Atom atom;
- const unsigned char *id = dmxPropertyIdentifier();
- Display *dpy = dmxScreen->beDisplay;
- Window win = dmxScreen->scrnWin;
- DMXScreenInfo *other;
- char buf[128]; /* RATS: only used with snprintf */
+ Atom atom;
+ const unsigned char *id = dmxPropertyIdentifier();
+ Display *dpy = dmxScreen->beDisplay;
+ Window win = dmxScreen->scrnWin;
+ DMXScreenInfo *other;
+ char buf[128]; /* RATS: only used with snprintf */
if (!dpy)
- return; /* FIXME: What should be done here if Xdmx is started
- * with this screen initially detached?
- */
+ return; /* FIXME: What should be done here if Xdmx is started
+ * with this screen initially detached?
+ */
atom = XInternAtom(dpy, DMX_ATOMNAME, False);
if ((other = dmxPropertyCheckOtherWindows(dmxScreen, atom))) {
DMXScreenInfo *tmp = dmxScreen->next;
- dmxScreen->next = (other->next ? other->next : other);
- other->next = (tmp ? tmp : dmxScreen);
+
+ dmxScreen->next = (other->next ? other->next : other);
+ other->next = (tmp ? tmp : dmxScreen);
dmxLog(dmxDebug, "%d/%s/%lu and %d/%s/%lu are on the same backend\n",
dmxScreen->index, dmxScreen->name, dmxScreen->scrnWin,
other->index, other->name, other->scrnWin);
}
snprintf(buf, sizeof(buf), ".%d,%lu", dmxScreen->index,
- (long unsigned)win);
- XChangeProperty(dpy, RootWindow(dpy,0), atom, XA_STRING, 8,
- PropModeAppend, (unsigned char *)buf, strlen(buf));
+ (long unsigned) win);
+ XChangeProperty(dpy, RootWindow(dpy, 0), atom, XA_STRING, 8,
+ PropModeAppend, (unsigned char *) buf, strlen(buf));
snprintf(buf, sizeof(buf), "%s,%d", id, dmxScreen->index);
XChangeProperty(dpy, win, atom, XA_STRING, 8,
- PropModeAppend, (unsigned char *)buf, strlen(buf));
+ PropModeAppend, (unsigned char *) buf, strlen(buf));
}
diff --git a/xorg-server/hw/dmx/dmxprop.h b/xorg-server/hw/dmx/dmxprop.h
index 50135cd64..a1170520f 100644
--- a/xorg-server/hw/dmx/dmxprop.h
+++ b/xorg-server/hw/dmx/dmxprop.h
@@ -36,11 +36,10 @@
#ifndef _DMXPROP_H_
#define _DMXPROP_H_
-extern int dmxPropertyDisplay(DMXScreenInfo *dmxScreen);
-extern void dmxPropertyWindow(DMXScreenInfo *dmxScreen);
-extern void *dmxPropertyIterate(DMXScreenInfo *start,
- void *(*f)(DMXScreenInfo *dmxScreen,
- void *closure),
- void *closure);
-extern int dmxPropertySameDisplay(DMXScreenInfo *dmxScreen, const char *name);
+extern int dmxPropertyDisplay(DMXScreenInfo * dmxScreen);
+extern void dmxPropertyWindow(DMXScreenInfo * dmxScreen);
+extern void *dmxPropertyIterate(DMXScreenInfo * start,
+ void *(*f) (DMXScreenInfo * dmxScreen,
+ void *closure), void *closure);
+extern int dmxPropertySameDisplay(DMXScreenInfo * dmxScreen, const char *name);
#endif
diff --git a/xorg-server/hw/dmx/dmxscrinit.c b/xorg-server/hw/dmx/dmxscrinit.c
index 8582d2ceb..37b3f3b5a 100644
--- a/xorg-server/hw/dmx/dmxscrinit.c
+++ b/xorg-server/hw/dmx/dmxscrinit.c
@@ -1,522 +1,525 @@
-/*
- * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <kem@redhat.com>
- * David H. Dawes <dawes@xfree86.org>
- *
- */
-
-/** \file
- * This file provides support for screen initialization. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxsync.h"
-#include "dmxshadow.h"
-#include "dmxscrinit.h"
-#include "dmxcursor.h"
-#include "dmxgc.h"
-#include "dmxgcops.h"
-#include "dmxwindow.h"
-#include "dmxpixmap.h"
-#include "dmxfont.h"
-#include "dmxcmap.h"
-#include "dmxprop.h"
-#include "dmxdpms.h"
-
-#include "dmxpict.h"
-
-#include "fb.h"
-#include "mipointer.h"
-#include "micmap.h"
-
-extern Bool dmxCloseScreen(int idx, ScreenPtr pScreen);
-static Bool dmxSaveScreen(ScreenPtr pScreen, int what);
-
-static unsigned long dmxGeneration;
-static unsigned long *dmxCursorGeneration;
-
-DevPrivateKeyRec dmxGCPrivateKeyRec;
-DevPrivateKeyRec dmxWinPrivateKeyRec;
-DevPrivateKeyRec dmxPixPrivateKeyRec;
-int dmxFontPrivateIndex; /**< Private index for Fonts */
-DevPrivateKeyRec dmxScreenPrivateKeyRec;
-DevPrivateKeyRec dmxColormapPrivateKeyRec;
-DevPrivateKeyRec dmxPictPrivateKeyRec;
-DevPrivateKeyRec dmxGlyphSetPrivateKeyRec;
-
-/** Initialize the parts of screen \a idx that require access to the
- * back-end server. */
-void dmxBEScreenInit(int idx, ScreenPtr pScreen)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[idx];
- XSetWindowAttributes attribs;
- XGCValues gcvals;
- unsigned long mask;
- int i, j;
-
- /* FIXME: The dmxScreenInit() code currently assumes that it will
- * not be called if the Xdmx server is started with this screen
- * detached -- i.e., it assumes that dmxScreen->beDisplay is always
- * valid. This is not necessarily a valid assumption when full
- * addition/removal of screens is implemented, but when this code is
- * broken out for screen reattachment, then we will reevaluate this
- * assumption.
- */
-
- pScreen->mmWidth = DisplayWidthMM(dmxScreen->beDisplay,
- DefaultScreen(dmxScreen->beDisplay));
- pScreen->mmHeight = DisplayHeightMM(dmxScreen->beDisplay,
- DefaultScreen(dmxScreen->beDisplay));
-
- pScreen->whitePixel = dmxScreen->beWhitePixel;
- pScreen->blackPixel = dmxScreen->beBlackPixel;
-
- /* Handle screen savers and DPMS on the backend */
- dmxDPMSInit(dmxScreen);
-
- /* Create root window for screen */
- mask = CWBackPixel | CWEventMask | CWColormap | CWOverrideRedirect;
- attribs.background_pixel = dmxScreen->beBlackPixel;
- attribs.event_mask = (KeyPressMask
- | KeyReleaseMask
- | ButtonPressMask
- | ButtonReleaseMask
- | EnterWindowMask
- | LeaveWindowMask
- | PointerMotionMask
- | KeymapStateMask
- | FocusChangeMask);
- attribs.colormap = dmxScreen->beDefColormaps[dmxScreen->beDefVisualIndex];
- attribs.override_redirect = True;
-
- dmxScreen->scrnWin =
- XCreateWindow(dmxScreen->beDisplay,
- DefaultRootWindow(dmxScreen->beDisplay),
- dmxScreen->scrnX,
- dmxScreen->scrnY,
- dmxScreen->scrnWidth,
- dmxScreen->scrnHeight,
- 0,
- pScreen->rootDepth,
- InputOutput,
- dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
- mask,
- &attribs);
- dmxPropertyWindow(dmxScreen);
-
- /*
- * This turns off the cursor by defining a cursor with no visible
- * components.
- */
- {
- char noCursorData[] = {0, 0, 0, 0,
- 0, 0, 0, 0};
- Pixmap pixmap;
- XColor color, tmp;
-
- pixmap = XCreateBitmapFromData(dmxScreen->beDisplay, dmxScreen->scrnWin,
- noCursorData, 8, 8);
- XAllocNamedColor(dmxScreen->beDisplay, dmxScreen->beDefColormaps[0],
- "black", &color, &tmp);
- dmxScreen->noCursor = XCreatePixmapCursor(dmxScreen->beDisplay,
- pixmap, pixmap,
- &color, &color, 0, 0);
- XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
- dmxScreen->noCursor);
-
- XFreePixmap(dmxScreen->beDisplay, pixmap);
- }
-
- XMapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
-
- if (dmxShadowFB) {
- mask = (GCFunction
- | GCPlaneMask
- | GCClipMask);
- gcvals.function = GXcopy;
- gcvals.plane_mask = AllPlanes;
- gcvals.clip_mask = None;
-
- dmxScreen->shadowGC = XCreateGC(dmxScreen->beDisplay,
- dmxScreen->scrnWin,
- mask, &gcvals);
-
- dmxScreen->shadowFBImage =
- XCreateImage(dmxScreen->beDisplay,
- dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
- dmxScreen->beDepth,
- ZPixmap,
- 0,
- (char *)dmxScreen->shadow,
- dmxScreen->scrnWidth, dmxScreen->scrnHeight,
- dmxScreen->beBPP,
- PixmapBytePad(dmxScreen->scrnWidth,
- dmxScreen->beBPP));
- } else {
- /* Create default drawables (used during GC creation) */
- for (i = 0; i < dmxScreen->beNumPixmapFormats; i++)
- for (j = 0; j < dmxScreen->beNumDepths; j++)
- if ((dmxScreen->bePixmapFormats[i].depth == 1) ||
- (dmxScreen->bePixmapFormats[i].depth ==
- dmxScreen->beDepths[j])) {
- dmxScreen->scrnDefDrawables[i] = (Drawable)
- XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin,
- 1, 1, dmxScreen->bePixmapFormats[i].depth);
- break;
- }
- }
-}
-
-/** Initialize screen number \a idx. */
-Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[idx];
- int i, j;
-
- if (!dixRegisterPrivateKey(&dmxScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
- return FALSE;
- if (!dixRegisterPrivateKey(&dmxColormapPrivateKeyRec, PRIVATE_COLORMAP, 0))
- return FALSE;
- if (!dixRegisterPrivateKey(&dmxGlyphSetPrivateKeyRec, PRIVATE_GLYPHSET, 0))
- return FALSE;
-
- if (dmxGeneration != serverGeneration) {
- /* Allocate font private index */
- dmxFontPrivateIndex = AllocateFontPrivateIndex();
- if (dmxFontPrivateIndex == -1)
- return FALSE;
-
- dmxGeneration = serverGeneration;
- }
-
- if (dmxShadowFB) {
- dmxScreen->shadow = shadowAlloc(dmxScreen->scrnWidth,
- dmxScreen->scrnHeight,
- dmxScreen->beBPP);
- } else {
- if (!dmxInitGC(pScreen)) return FALSE;
- if (!dmxInitWindow(pScreen)) return FALSE;
- if (!dmxInitPixmap(pScreen)) return FALSE;
- }
-
- /*
- * Initalise the visual types. miSetVisualTypesAndMasks() requires
- * that all of the types for each depth be collected together. It's
- * intended for slightly different usage to what we would like here.
- * Maybe a miAddVisualTypeAndMask() function will be added to make
- * things easier here.
- */
- for (i = 0; i < dmxScreen->beNumDepths; i++) {
- int depth;
- int visuals = 0;
- int bitsPerRgb = 0;
- int preferredClass = -1;
- Pixel redMask = 0;
- Pixel greenMask = 0;
- Pixel blueMask = 0;
-
- depth = dmxScreen->beDepths[i];
- for (j = 0; j < dmxScreen->beNumVisuals; j++) {
- XVisualInfo *vi;
-
- vi = &dmxScreen->beVisuals[j];
- if (vi->depth == depth) {
- /* Assume the masks are all the same. */
- visuals |= (1 << vi->class);
- bitsPerRgb = vi->bits_per_rgb;
- redMask = vi->red_mask;
- greenMask = vi->green_mask;
- blueMask = vi->blue_mask;
- if (j == dmxScreen->beDefVisualIndex) {
- preferredClass = vi->class;
- }
- }
- }
- miSetVisualTypesAndMasks(depth, visuals, bitsPerRgb, preferredClass,
- redMask, greenMask, blueMask);
- }
-
- fbScreenInit(pScreen,
- dmxShadowFB ? dmxScreen->shadow : NULL,
- dmxScreen->scrnWidth,
- dmxScreen->scrnHeight,
- dmxScreen->beXDPI,
- dmxScreen->beXDPI,
- dmxScreen->scrnWidth,
- dmxScreen->beBPP);
- (void)dmxPictureInit(pScreen, 0, 0);
-
- /* Not yet... */
- pScreen->GetWindowPixmap = NULL;
- pScreen->SetWindowPixmap = NULL;
-
- if (dmxShadowFB && !shadowInit(pScreen, dmxShadowUpdateProc, NULL))
- return FALSE;
-
- if (dmxShadowFB) {
- miDCInitialize(pScreen, &dmxPointerCursorFuncs);
- } else {
- MAXSCREENSALLOC(dmxCursorGeneration);
- if (dmxCursorGeneration[idx] != serverGeneration) {
- if (!(miPointerInitialize(pScreen,
- &dmxPointerSpriteFuncs,
- &dmxPointerCursorFuncs,
- FALSE)))
- return FALSE;
-
- dmxCursorGeneration[idx] = serverGeneration;
- }
- }
-
- DMX_WRAP(CloseScreen, dmxCloseScreen, dmxScreen, pScreen);
- DMX_WRAP(SaveScreen, dmxSaveScreen, dmxScreen, pScreen);
-
- dmxBEScreenInit(idx, pScreen);
-
- if (!dmxShadowFB) {
- /* Wrap GC functions */
- DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen);
-
- /* Wrap Window functions */
- DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen);
- DMX_WRAP(DestroyWindow, dmxDestroyWindow, dmxScreen, pScreen);
- DMX_WRAP(PositionWindow, dmxPositionWindow, dmxScreen, pScreen);
- DMX_WRAP(ChangeWindowAttributes, dmxChangeWindowAttributes, dmxScreen,
- pScreen);
- DMX_WRAP(RealizeWindow, dmxRealizeWindow, dmxScreen, pScreen);
- DMX_WRAP(UnrealizeWindow, dmxUnrealizeWindow, dmxScreen, pScreen);
- DMX_WRAP(RestackWindow, dmxRestackWindow, dmxScreen, pScreen);
- DMX_WRAP(WindowExposures, dmxWindowExposures, dmxScreen, pScreen);
- DMX_WRAP(CopyWindow, dmxCopyWindow, dmxScreen, pScreen);
-
- DMX_WRAP(ResizeWindow, dmxResizeWindow, dmxScreen, pScreen);
- DMX_WRAP(ReparentWindow, dmxReparentWindow, dmxScreen, pScreen);
-
- DMX_WRAP(ChangeBorderWidth, dmxChangeBorderWidth, dmxScreen, pScreen);
-
- /* Wrap Image functions */
- DMX_WRAP(GetImage, dmxGetImage, dmxScreen, pScreen);
- DMX_WRAP(GetSpans, dmxGetSpans, dmxScreen, pScreen);
-
- /* Wrap Pixmap functions */
- DMX_WRAP(CreatePixmap, dmxCreatePixmap, dmxScreen, pScreen);
- DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen);
- DMX_WRAP(BitmapToRegion, dmxBitmapToRegion, dmxScreen, pScreen);
-
- /* Wrap Font functions */
- DMX_WRAP(RealizeFont, dmxRealizeFont, dmxScreen, pScreen);
- DMX_WRAP(UnrealizeFont, dmxUnrealizeFont, dmxScreen, pScreen);
-
- /* Wrap Colormap functions */
- DMX_WRAP(CreateColormap, dmxCreateColormap, dmxScreen, pScreen);
- DMX_WRAP(DestroyColormap, dmxDestroyColormap, dmxScreen, pScreen);
- DMX_WRAP(InstallColormap, dmxInstallColormap, dmxScreen, pScreen);
- DMX_WRAP(StoreColors, dmxStoreColors, dmxScreen, pScreen);
-
- /* Wrap Shape functions */
- DMX_WRAP(SetShape, dmxSetShape, dmxScreen, pScreen);
- }
-
- if (!dmxCreateDefColormap(pScreen))
- return FALSE;
-
- return TRUE;
-}
-
-/** Close the \a pScreen resources on the back-end server. */
-void dmxBECloseScreen(ScreenPtr pScreen)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- int i;
-
- /* Restore the back-end screen-saver and DPMS state. */
- dmxDPMSTerm(dmxScreen);
-
- /* Free the screen resources */
-
- XFreeCursor(dmxScreen->beDisplay, dmxScreen->noCursor);
- dmxScreen->noCursor = (Cursor)0;
-
- XUnmapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
- XDestroyWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
- dmxScreen->scrnWin = (Window)0;
-
- if (dmxShadowFB) {
- /* Free the shadow GC and image assocated with the back-end server */
- XFreeGC(dmxScreen->beDisplay, dmxScreen->shadowGC);
- dmxScreen->shadowGC = NULL;
- XFree(dmxScreen->shadowFBImage);
- dmxScreen->shadowFBImage = NULL;
- } else {
- /* Free the default drawables */
- for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
- if (dmxScreen->scrnDefDrawables[i]) {
- XFreePixmap(dmxScreen->beDisplay,
- dmxScreen->scrnDefDrawables[i]);
- dmxScreen->scrnDefDrawables[i] = (Drawable)0;
- }
- }
- }
-
- /* Free resources allocated during initialization (in dmxinit.c) */
- for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
- XFreeColormap(dmxScreen->beDisplay, dmxScreen->beDefColormaps[i]);
- free(dmxScreen->beDefColormaps);
- dmxScreen->beDefColormaps = NULL;
-
-#if 0
- /* Do not free visuals, depths and pixmap formats here. Free them
- * in dmxCloseScreen() instead -- see comment below. */
- XFree(dmxScreen->beVisuals);
- dmxScreen->beVisuals = NULL;
-
- XFree(dmxScreen->beDepths);
- dmxScreen->beDepths = NULL;
-
- XFree(dmxScreen->bePixmapFormats);
- dmxScreen->bePixmapFormats = NULL;
-#endif
-
-#ifdef GLXEXT
- if (dmxScreen->glxVisuals) {
- XFree(dmxScreen->glxVisuals);
- dmxScreen->glxVisuals = NULL;
- dmxScreen->numGlxVisuals = 0;
- }
-#endif
-
- /* Close display */
- XCloseDisplay(dmxScreen->beDisplay);
- dmxScreen->beDisplay = NULL;
-}
-
-/** Close screen number \a idx. */
-Bool dmxCloseScreen(int idx, ScreenPtr pScreen)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[idx];
-
- /* Reset the proc vectors */
- if (idx == 0) {
- dmxResetRender();
- dmxResetFonts();
- }
-
- if (dmxShadowFB) {
- /* Free the shadow framebuffer */
- free(dmxScreen->shadow);
- } else {
-
- /* Unwrap Shape functions */
- DMX_UNWRAP(SetShape, dmxScreen, pScreen);
-
- /* Unwrap the pScreen functions */
- DMX_UNWRAP(CreateGC, dmxScreen, pScreen);
-
- DMX_UNWRAP(CreateWindow, dmxScreen, pScreen);
- DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen);
- DMX_UNWRAP(PositionWindow, dmxScreen, pScreen);
- DMX_UNWRAP(ChangeWindowAttributes, dmxScreen, pScreen);
- DMX_UNWRAP(RealizeWindow, dmxScreen, pScreen);
- DMX_UNWRAP(UnrealizeWindow, dmxScreen, pScreen);
- DMX_UNWRAP(RestackWindow, dmxScreen, pScreen);
- DMX_UNWRAP(WindowExposures, dmxScreen, pScreen);
- DMX_UNWRAP(CopyWindow, dmxScreen, pScreen);
-
- DMX_UNWRAP(ResizeWindow, dmxScreen, pScreen);
- DMX_UNWRAP(ReparentWindow, dmxScreen, pScreen);
-
- DMX_UNWRAP(ChangeBorderWidth, dmxScreen, pScreen);
-
- DMX_UNWRAP(GetImage, dmxScreen, pScreen);
- DMX_UNWRAP(GetSpans, dmxScreen, pScreen);
-
- DMX_UNWRAP(CreatePixmap, dmxScreen, pScreen);
- DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen);
- DMX_UNWRAP(BitmapToRegion, dmxScreen, pScreen);
-
- DMX_UNWRAP(RealizeFont, dmxScreen, pScreen);
- DMX_UNWRAP(UnrealizeFont, dmxScreen, pScreen);
-
- DMX_UNWRAP(CreateColormap, dmxScreen, pScreen);
- DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen);
- DMX_UNWRAP(InstallColormap, dmxScreen, pScreen);
- DMX_UNWRAP(StoreColors, dmxScreen, pScreen);
- }
-
- DMX_UNWRAP(SaveScreen, dmxScreen, pScreen);
-
- if (dmxScreen->beDisplay) {
- dmxBECloseScreen(pScreen);
-
-#if 1
- /* Free visuals, depths and pixmap formats here so that they
- * won't be freed when a screen is detached, thereby allowing
- * the screen to be reattached to be compared to the one
- * previously removed.
- */
- XFree(dmxScreen->beVisuals);
- dmxScreen->beVisuals = NULL;
-
- XFree(dmxScreen->beDepths);
- dmxScreen->beDepths = NULL;
-
- XFree(dmxScreen->bePixmapFormats);
- dmxScreen->bePixmapFormats = NULL;
-#endif
- }
-
- DMX_UNWRAP(CloseScreen, dmxScreen, pScreen);
- return pScreen->CloseScreen(idx, pScreen);
-}
-
-static Bool dmxSaveScreen(ScreenPtr pScreen, int what)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
-
- if (dmxScreen->beDisplay) {
- switch (what) {
- case SCREEN_SAVER_OFF:
- case SCREEN_SAVER_FORCER:
- XResetScreenSaver(dmxScreen->beDisplay);
- dmxSync(dmxScreen, FALSE);
- break;
- case SCREEN_SAVER_ON:
- case SCREEN_SAVER_CYCLE:
- XActivateScreenSaver(dmxScreen->beDisplay);
- dmxSync(dmxScreen, FALSE);
- break;
- }
- }
-
- return TRUE;
-}
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ * David H. Dawes <dawes@xfree86.org>
+ *
+ */
+
+/** \file
+ * This file provides support for screen initialization. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxshadow.h"
+#include "dmxscrinit.h"
+#include "dmxcursor.h"
+#include "dmxgc.h"
+#include "dmxgcops.h"
+#include "dmxwindow.h"
+#include "dmxpixmap.h"
+#include "dmxfont.h"
+#include "dmxcmap.h"
+#include "dmxprop.h"
+#include "dmxdpms.h"
+
+#include "dmxpict.h"
+
+#include "fb.h"
+#include "mipointer.h"
+#include "micmap.h"
+
+extern Bool dmxCloseScreen(int idx, ScreenPtr pScreen);
+static Bool dmxSaveScreen(ScreenPtr pScreen, int what);
+
+static unsigned long dmxGeneration;
+static unsigned long *dmxCursorGeneration;
+
+DevPrivateKeyRec dmxGCPrivateKeyRec;
+DevPrivateKeyRec dmxWinPrivateKeyRec;
+DevPrivateKeyRec dmxPixPrivateKeyRec;
+int dmxFontPrivateIndex; /**< Private index for Fonts */
+DevPrivateKeyRec dmxScreenPrivateKeyRec;
+DevPrivateKeyRec dmxColormapPrivateKeyRec;
+DevPrivateKeyRec dmxPictPrivateKeyRec;
+DevPrivateKeyRec dmxGlyphSetPrivateKeyRec;
+
+/** Initialize the parts of screen \a idx that require access to the
+ * back-end server. */
+void
+dmxBEScreenInit(int idx, ScreenPtr pScreen)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+ XSetWindowAttributes attribs;
+ XGCValues gcvals;
+ unsigned long mask;
+ int i, j;
+
+ /* FIXME: The dmxScreenInit() code currently assumes that it will
+ * not be called if the Xdmx server is started with this screen
+ * detached -- i.e., it assumes that dmxScreen->beDisplay is always
+ * valid. This is not necessarily a valid assumption when full
+ * addition/removal of screens is implemented, but when this code is
+ * broken out for screen reattachment, then we will reevaluate this
+ * assumption.
+ */
+
+ pScreen->mmWidth = DisplayWidthMM(dmxScreen->beDisplay,
+ DefaultScreen(dmxScreen->beDisplay));
+ pScreen->mmHeight = DisplayHeightMM(dmxScreen->beDisplay,
+ DefaultScreen(dmxScreen->beDisplay));
+
+ pScreen->whitePixel = dmxScreen->beWhitePixel;
+ pScreen->blackPixel = dmxScreen->beBlackPixel;
+
+ /* Handle screen savers and DPMS on the backend */
+ dmxDPMSInit(dmxScreen);
+
+ /* Create root window for screen */
+ mask = CWBackPixel | CWEventMask | CWColormap | CWOverrideRedirect;
+ attribs.background_pixel = dmxScreen->beBlackPixel;
+ attribs.event_mask = (KeyPressMask
+ | KeyReleaseMask
+ | ButtonPressMask
+ | ButtonReleaseMask
+ | EnterWindowMask
+ | LeaveWindowMask
+ | PointerMotionMask
+ | KeymapStateMask | FocusChangeMask);
+ attribs.colormap = dmxScreen->beDefColormaps[dmxScreen->beDefVisualIndex];
+ attribs.override_redirect = True;
+
+ dmxScreen->scrnWin =
+ XCreateWindow(dmxScreen->beDisplay,
+ DefaultRootWindow(dmxScreen->beDisplay),
+ dmxScreen->scrnX,
+ dmxScreen->scrnY,
+ dmxScreen->scrnWidth,
+ dmxScreen->scrnHeight,
+ 0,
+ pScreen->rootDepth,
+ InputOutput,
+ dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual,
+ mask, &attribs);
+ dmxPropertyWindow(dmxScreen);
+
+ /*
+ * This turns off the cursor by defining a cursor with no visible
+ * components.
+ */
+ {
+ char noCursorData[] = { 0, 0, 0, 0,
+ 0, 0, 0, 0
+ };
+ Pixmap pixmap;
+ XColor color, tmp;
+
+ pixmap = XCreateBitmapFromData(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ noCursorData, 8, 8);
+ XAllocNamedColor(dmxScreen->beDisplay, dmxScreen->beDefColormaps[0],
+ "black", &color, &tmp);
+ dmxScreen->noCursor = XCreatePixmapCursor(dmxScreen->beDisplay,
+ pixmap, pixmap,
+ &color, &color, 0, 0);
+ XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ dmxScreen->noCursor);
+
+ XFreePixmap(dmxScreen->beDisplay, pixmap);
+ }
+
+ XMapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
+
+ if (dmxShadowFB) {
+ mask = (GCFunction | GCPlaneMask | GCClipMask);
+ gcvals.function = GXcopy;
+ gcvals.plane_mask = AllPlanes;
+ gcvals.clip_mask = None;
+
+ dmxScreen->shadowGC = XCreateGC(dmxScreen->beDisplay,
+ dmxScreen->scrnWin, mask, &gcvals);
+
+ dmxScreen->shadowFBImage =
+ XCreateImage(dmxScreen->beDisplay,
+ dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].
+ visual, dmxScreen->beDepth, ZPixmap, 0,
+ (char *) dmxScreen->shadow, dmxScreen->scrnWidth,
+ dmxScreen->scrnHeight, dmxScreen->beBPP,
+ PixmapBytePad(dmxScreen->scrnWidth, dmxScreen->beBPP));
+ }
+ else {
+ /* Create default drawables (used during GC creation) */
+ for (i = 0; i < dmxScreen->beNumPixmapFormats; i++)
+ for (j = 0; j < dmxScreen->beNumDepths; j++)
+ if ((dmxScreen->bePixmapFormats[i].depth == 1) ||
+ (dmxScreen->bePixmapFormats[i].depth ==
+ dmxScreen->beDepths[j])) {
+ dmxScreen->scrnDefDrawables[i] = (Drawable)
+ XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin,
+ 1, 1,
+ dmxScreen->bePixmapFormats[i].depth);
+ break;
+ }
+ }
+}
+
+/** Initialize screen number \a idx. */
+Bool
+dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+ int i, j;
+
+ if (!dixRegisterPrivateKey(&dmxScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
+ return FALSE;
+ if (!dixRegisterPrivateKey(&dmxColormapPrivateKeyRec, PRIVATE_COLORMAP, 0))
+ return FALSE;
+ if (!dixRegisterPrivateKey(&dmxGlyphSetPrivateKeyRec, PRIVATE_GLYPHSET, 0))
+ return FALSE;
+
+ if (dmxGeneration != serverGeneration) {
+ /* Allocate font private index */
+ dmxFontPrivateIndex = AllocateFontPrivateIndex();
+ if (dmxFontPrivateIndex == -1)
+ return FALSE;
+
+ dmxGeneration = serverGeneration;
+ }
+
+ if (dmxShadowFB) {
+ dmxScreen->shadow = shadowAlloc(dmxScreen->scrnWidth,
+ dmxScreen->scrnHeight,
+ dmxScreen->beBPP);
+ }
+ else {
+ if (!dmxInitGC(pScreen))
+ return FALSE;
+ if (!dmxInitWindow(pScreen))
+ return FALSE;
+ if (!dmxInitPixmap(pScreen))
+ return FALSE;
+ }
+
+ /*
+ * Initalise the visual types. miSetVisualTypesAndMasks() requires
+ * that all of the types for each depth be collected together. It's
+ * intended for slightly different usage to what we would like here.
+ * Maybe a miAddVisualTypeAndMask() function will be added to make
+ * things easier here.
+ */
+ for (i = 0; i < dmxScreen->beNumDepths; i++) {
+ int depth;
+ int visuals = 0;
+ int bitsPerRgb = 0;
+ int preferredClass = -1;
+ Pixel redMask = 0;
+ Pixel greenMask = 0;
+ Pixel blueMask = 0;
+
+ depth = dmxScreen->beDepths[i];
+ for (j = 0; j < dmxScreen->beNumVisuals; j++) {
+ XVisualInfo *vi;
+
+ vi = &dmxScreen->beVisuals[j];
+ if (vi->depth == depth) {
+ /* Assume the masks are all the same. */
+ visuals |= (1 << vi->class);
+ bitsPerRgb = vi->bits_per_rgb;
+ redMask = vi->red_mask;
+ greenMask = vi->green_mask;
+ blueMask = vi->blue_mask;
+ if (j == dmxScreen->beDefVisualIndex) {
+ preferredClass = vi->class;
+ }
+ }
+ }
+ miSetVisualTypesAndMasks(depth, visuals, bitsPerRgb, preferredClass,
+ redMask, greenMask, blueMask);
+ }
+
+ fbScreenInit(pScreen,
+ dmxShadowFB ? dmxScreen->shadow : NULL,
+ dmxScreen->scrnWidth,
+ dmxScreen->scrnHeight,
+ dmxScreen->beXDPI,
+ dmxScreen->beXDPI, dmxScreen->scrnWidth, dmxScreen->beBPP);
+ (void) dmxPictureInit(pScreen, 0, 0);
+
+ /* Not yet... */
+ pScreen->GetWindowPixmap = NULL;
+ pScreen->SetWindowPixmap = NULL;
+
+ if (dmxShadowFB && !shadowInit(pScreen, dmxShadowUpdateProc, NULL))
+ return FALSE;
+
+ if (dmxShadowFB) {
+ miDCInitialize(pScreen, &dmxPointerCursorFuncs);
+ }
+ else {
+ MAXSCREENSALLOC(dmxCursorGeneration);
+ if (dmxCursorGeneration[idx] != serverGeneration) {
+ if (!(miPointerInitialize(pScreen,
+ &dmxPointerSpriteFuncs,
+ &dmxPointerCursorFuncs, FALSE)))
+ return FALSE;
+
+ dmxCursorGeneration[idx] = serverGeneration;
+ }
+ }
+
+ DMX_WRAP(CloseScreen, dmxCloseScreen, dmxScreen, pScreen);
+ DMX_WRAP(SaveScreen, dmxSaveScreen, dmxScreen, pScreen);
+
+ dmxBEScreenInit(idx, pScreen);
+
+ if (!dmxShadowFB) {
+ /* Wrap GC functions */
+ DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen);
+
+ /* Wrap Window functions */
+ DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen);
+ DMX_WRAP(DestroyWindow, dmxDestroyWindow, dmxScreen, pScreen);
+ DMX_WRAP(PositionWindow, dmxPositionWindow, dmxScreen, pScreen);
+ DMX_WRAP(ChangeWindowAttributes, dmxChangeWindowAttributes, dmxScreen,
+ pScreen);
+ DMX_WRAP(RealizeWindow, dmxRealizeWindow, dmxScreen, pScreen);
+ DMX_WRAP(UnrealizeWindow, dmxUnrealizeWindow, dmxScreen, pScreen);
+ DMX_WRAP(RestackWindow, dmxRestackWindow, dmxScreen, pScreen);
+ DMX_WRAP(WindowExposures, dmxWindowExposures, dmxScreen, pScreen);
+ DMX_WRAP(CopyWindow, dmxCopyWindow, dmxScreen, pScreen);
+
+ DMX_WRAP(ResizeWindow, dmxResizeWindow, dmxScreen, pScreen);
+ DMX_WRAP(ReparentWindow, dmxReparentWindow, dmxScreen, pScreen);
+
+ DMX_WRAP(ChangeBorderWidth, dmxChangeBorderWidth, dmxScreen, pScreen);
+
+ /* Wrap Image functions */
+ DMX_WRAP(GetImage, dmxGetImage, dmxScreen, pScreen);
+ DMX_WRAP(GetSpans, dmxGetSpans, dmxScreen, pScreen);
+
+ /* Wrap Pixmap functions */
+ DMX_WRAP(CreatePixmap, dmxCreatePixmap, dmxScreen, pScreen);
+ DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen);
+ DMX_WRAP(BitmapToRegion, dmxBitmapToRegion, dmxScreen, pScreen);
+
+ /* Wrap Font functions */
+ DMX_WRAP(RealizeFont, dmxRealizeFont, dmxScreen, pScreen);
+ DMX_WRAP(UnrealizeFont, dmxUnrealizeFont, dmxScreen, pScreen);
+
+ /* Wrap Colormap functions */
+ DMX_WRAP(CreateColormap, dmxCreateColormap, dmxScreen, pScreen);
+ DMX_WRAP(DestroyColormap, dmxDestroyColormap, dmxScreen, pScreen);
+ DMX_WRAP(InstallColormap, dmxInstallColormap, dmxScreen, pScreen);
+ DMX_WRAP(StoreColors, dmxStoreColors, dmxScreen, pScreen);
+
+ /* Wrap Shape functions */
+ DMX_WRAP(SetShape, dmxSetShape, dmxScreen, pScreen);
+ }
+
+ if (!dmxCreateDefColormap(pScreen))
+ return FALSE;
+
+ return TRUE;
+}
+
+/** Close the \a pScreen resources on the back-end server. */
+void
+dmxBECloseScreen(ScreenPtr pScreen)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ int i;
+
+ /* Restore the back-end screen-saver and DPMS state. */
+ dmxDPMSTerm(dmxScreen);
+
+ /* Free the screen resources */
+
+ XFreeCursor(dmxScreen->beDisplay, dmxScreen->noCursor);
+ dmxScreen->noCursor = (Cursor) 0;
+
+ XUnmapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
+ XDestroyWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
+ dmxScreen->scrnWin = (Window) 0;
+
+ if (dmxShadowFB) {
+ /* Free the shadow GC and image assocated with the back-end server */
+ XFreeGC(dmxScreen->beDisplay, dmxScreen->shadowGC);
+ dmxScreen->shadowGC = NULL;
+ XFree(dmxScreen->shadowFBImage);
+ dmxScreen->shadowFBImage = NULL;
+ }
+ else {
+ /* Free the default drawables */
+ for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
+ if (dmxScreen->scrnDefDrawables[i]) {
+ XFreePixmap(dmxScreen->beDisplay,
+ dmxScreen->scrnDefDrawables[i]);
+ dmxScreen->scrnDefDrawables[i] = (Drawable) 0;
+ }
+ }
+ }
+
+ /* Free resources allocated during initialization (in dmxinit.c) */
+ for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
+ XFreeColormap(dmxScreen->beDisplay, dmxScreen->beDefColormaps[i]);
+ free(dmxScreen->beDefColormaps);
+ dmxScreen->beDefColormaps = NULL;
+
+#if 0
+ /* Do not free visuals, depths and pixmap formats here. Free them
+ * in dmxCloseScreen() instead -- see comment below. */
+ XFree(dmxScreen->beVisuals);
+ dmxScreen->beVisuals = NULL;
+
+ XFree(dmxScreen->beDepths);
+ dmxScreen->beDepths = NULL;
+
+ XFree(dmxScreen->bePixmapFormats);
+ dmxScreen->bePixmapFormats = NULL;
+#endif
+
+#ifdef GLXEXT
+ if (dmxScreen->glxVisuals) {
+ XFree(dmxScreen->glxVisuals);
+ dmxScreen->glxVisuals = NULL;
+ dmxScreen->numGlxVisuals = 0;
+ }
+#endif
+
+ /* Close display */
+ XCloseDisplay(dmxScreen->beDisplay);
+ dmxScreen->beDisplay = NULL;
+}
+
+/** Close screen number \a idx. */
+Bool
+dmxCloseScreen(int idx, ScreenPtr pScreen)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[idx];
+
+ /* Reset the proc vectors */
+ if (idx == 0) {
+ dmxResetRender();
+ dmxResetFonts();
+ }
+
+ if (dmxShadowFB) {
+ /* Free the shadow framebuffer */
+ free(dmxScreen->shadow);
+ }
+ else {
+
+ /* Unwrap Shape functions */
+ DMX_UNWRAP(SetShape, dmxScreen, pScreen);
+
+ /* Unwrap the pScreen functions */
+ DMX_UNWRAP(CreateGC, dmxScreen, pScreen);
+
+ DMX_UNWRAP(CreateWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(PositionWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(ChangeWindowAttributes, dmxScreen, pScreen);
+ DMX_UNWRAP(RealizeWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(UnrealizeWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(RestackWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(WindowExposures, dmxScreen, pScreen);
+ DMX_UNWRAP(CopyWindow, dmxScreen, pScreen);
+
+ DMX_UNWRAP(ResizeWindow, dmxScreen, pScreen);
+ DMX_UNWRAP(ReparentWindow, dmxScreen, pScreen);
+
+ DMX_UNWRAP(ChangeBorderWidth, dmxScreen, pScreen);
+
+ DMX_UNWRAP(GetImage, dmxScreen, pScreen);
+ DMX_UNWRAP(GetSpans, dmxScreen, pScreen);
+
+ DMX_UNWRAP(CreatePixmap, dmxScreen, pScreen);
+ DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen);
+ DMX_UNWRAP(BitmapToRegion, dmxScreen, pScreen);
+
+ DMX_UNWRAP(RealizeFont, dmxScreen, pScreen);
+ DMX_UNWRAP(UnrealizeFont, dmxScreen, pScreen);
+
+ DMX_UNWRAP(CreateColormap, dmxScreen, pScreen);
+ DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen);
+ DMX_UNWRAP(InstallColormap, dmxScreen, pScreen);
+ DMX_UNWRAP(StoreColors, dmxScreen, pScreen);
+ }
+
+ DMX_UNWRAP(SaveScreen, dmxScreen, pScreen);
+
+ if (dmxScreen->beDisplay) {
+ dmxBECloseScreen(pScreen);
+
+#if 1
+ /* Free visuals, depths and pixmap formats here so that they
+ * won't be freed when a screen is detached, thereby allowing
+ * the screen to be reattached to be compared to the one
+ * previously removed.
+ */
+ XFree(dmxScreen->beVisuals);
+ dmxScreen->beVisuals = NULL;
+
+ XFree(dmxScreen->beDepths);
+ dmxScreen->beDepths = NULL;
+
+ XFree(dmxScreen->bePixmapFormats);
+ dmxScreen->bePixmapFormats = NULL;
+#endif
+ }
+
+ DMX_UNWRAP(CloseScreen, dmxScreen, pScreen);
+ return pScreen->CloseScreen(idx, pScreen);
+}
+
+static Bool
+dmxSaveScreen(ScreenPtr pScreen, int what)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+
+ if (dmxScreen->beDisplay) {
+ switch (what) {
+ case SCREEN_SAVER_OFF:
+ case SCREEN_SAVER_FORCER:
+ XResetScreenSaver(dmxScreen->beDisplay);
+ dmxSync(dmxScreen, FALSE);
+ break;
+ case SCREEN_SAVER_ON:
+ case SCREEN_SAVER_CYCLE:
+ XActivateScreenSaver(dmxScreen->beDisplay);
+ dmxSync(dmxScreen, FALSE);
+ break;
+ }
+ }
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/dmx/dmxshadow.c b/xorg-server/hw/dmx/dmxshadow.c
index e075dec2a..9b4bafc34 100644
--- a/xorg-server/hw/dmx/dmxshadow.c
+++ b/xorg-server/hw/dmx/dmxshadow.c
@@ -1,71 +1,70 @@
-/*
- * Copyright 2001 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <kem@redhat.com>
- * David H. Dawes <dawes@xfree86.org>
- *
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxsync.h"
-#include "dmxshadow.h"
-
-/** \file
- * This file provides support for the shadow frame buffer. */
-
-/** Update the screen from the shadow frame buffer. */
-void dmxShadowUpdateProc(ScreenPtr pScreen, shadowBufPtr pBuf)
-{
- RegionPtr damage = &pBuf->damage;
- int nbox = RegionNumRects(damage);
- BoxPtr pbox = RegionRects(damage);
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
-
- if (!dmxScreen->beDisplay)
- return;
-
- while (nbox--) {
- XPutImage(dmxScreen->beDisplay,
- dmxScreen->scrnWin,
- dmxScreen->shadowGC,
- dmxScreen->shadowFBImage,
- pbox->x1, pbox->y1,
- pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1,
- pbox->y2 - pbox->y1);
-
- pbox++;
- }
-
- dmxSync(dmxScreen, FALSE);
-}
+/*
+ * Copyright 2001 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ * David H. Dawes <dawes@xfree86.org>
+ *
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxshadow.h"
+
+/** \file
+ * This file provides support for the shadow frame buffer. */
+
+/** Update the screen from the shadow frame buffer. */
+void
+dmxShadowUpdateProc(ScreenPtr pScreen, shadowBufPtr pBuf)
+{
+ RegionPtr damage = &pBuf->damage;
+ int nbox = RegionNumRects(damage);
+ BoxPtr pbox = RegionRects(damage);
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+
+ if (!dmxScreen->beDisplay)
+ return;
+
+ while (nbox--) {
+ XPutImage(dmxScreen->beDisplay,
+ dmxScreen->scrnWin,
+ dmxScreen->shadowGC,
+ dmxScreen->shadowFBImage,
+ pbox->x1, pbox->y1,
+ pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+
+ pbox++;
+ }
+
+ dmxSync(dmxScreen, FALSE);
+}
diff --git a/xorg-server/hw/dmx/dmxstat.c b/xorg-server/hw/dmx/dmxstat.c
index c08c6f4cd..0d8c22a9e 100644
--- a/xorg-server/hw/dmx/dmxstat.c
+++ b/xorg-server/hw/dmx/dmxstat.c
@@ -1,221 +1,238 @@
-/*
- * Copyright 2002, 2003 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- *
- * The DMX server code is written to call #dmxSync() whenever an XSync()
- * might be necessary. However, since XSync() requires a two way
- * communication with the other X server, eliminating unnecessary
- * XSync() calls is a key performance optimization. Support for this
- * optimization is provided in \a dmxsync.c. This file provides routines
- * that evaluate this optimization by counting the number of XSync()
- * calls and monitoring their latency. This functionality can be turned
- * on using the -stat command-line parameter. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxstat.h"
-#include "dmxlog.h"
-#include <X11/Xos.h> /* For sys/time.h */
-
-/** Used to compute a running average of value. */
-typedef struct _DMXStatAvg {
- int pos;
- int count;
- unsigned long value[DMX_STAT_LENGTH];
-} DMXStatAvg;
-
-/** Statistical information about XSync calls. */
-struct _DMXStatInfo {
- unsigned long syncCount;
- unsigned long oldSyncCount;
-
- DMXStatAvg usec;
- DMXStatAvg pending;
-
- unsigned long bins[DMX_STAT_BINS];
-};
-
-/* Interval in mS between statistic message log entries. */
- int dmxStatInterval;
-static int dmxStatDisplays;
-static OsTimerPtr dmxStatTimer;
-
-/** Return the number of microseconds as an unsigned long.
- * Unfortunately, this is only useful for intervals < about 4 sec. */
-static unsigned long usec(struct timeval *stop, struct timeval *start)
-{
- return (stop->tv_sec - start->tv_sec) * 1000000
- + stop->tv_usec - start->tv_usec;
-}
-
-static unsigned long avg(DMXStatAvg *data, unsigned long *max)
-{
- unsigned long sum;
- int i;
-
- *max = 0;
- if (!data->count) return 0;
-
- for (i = 0, sum = 0; i < data->count; i++) {
- if (data->value[i] > *max) *max = data->value[i];
- sum += data->value[i];
- }
- return sum / data->count;
-}
-
-/** Turn on XSync statistic gathering and printing. Print every \a
- * interval seconds, with lines for the first \a displays. If \a
- * interval is NULL, 1 will be used. If \a displays is NULL, 0 will be
- * used (meaning a line for every display will be printed). Note that
- * this function takes string arguments because it will usually be
- * called from #ddxProcessArgument in \a dmxinit.c. */
-void dmxStatActivate(const char *interval, const char *displays)
-{
- dmxStatInterval = (interval ? atoi(interval) : 1) * 1000;
- dmxStatDisplays = (displays ? atoi(displays) : 0);
-
- if (dmxStatInterval < 1000) dmxStatInterval = 1000;
- if (dmxStatDisplays < 0) dmxStatDisplays = 0;
-}
-
-/** Allocate a \a DMXStatInfo structure. */
-DMXStatInfo *dmxStatAlloc(void)
-{
- DMXStatInfo *pt = calloc(1, sizeof(*pt));
- return pt;
-}
-
-/** Free the memory used by a \a DMXStatInfo structure. */
-void dmxStatFree(DMXStatInfo *pt)
-{
- free(pt);
-}
-
-static void dmxStatValue(DMXStatAvg *data, unsigned long value)
-{
- if (data->count != DMX_STAT_LENGTH) ++data->count;
- if (data->pos >= DMX_STAT_LENGTH-1) data->pos = 0;
- data->value[data->pos++] = value;
-}
-
-/** Note that a XSync() was just done on \a dmxScreen with the \a start
- * and \a stop times (from gettimeofday()) and the number of
- * pending-but-not-yet-processed XSync requests. This routine is called
- * from #dmxDoSync in \a dmxsync.c */
-void dmxStatSync(DMXScreenInfo *dmxScreen,
- struct timeval *stop, struct timeval *start,
- unsigned long pending)
-{
- DMXStatInfo *s = dmxScreen->stat;
- unsigned long elapsed = usec(stop, start);
- unsigned long thresh;
- int i;
-
- ++s->syncCount;
- dmxStatValue(&s->usec, elapsed);
- dmxStatValue(&s->pending, pending);
-
- for (i = 0, thresh = DMX_STAT_BIN0; i < DMX_STAT_BINS-1; i++) {
- if (elapsed < thresh) {
- ++s->bins[i];
- break;
- }
- thresh *= DMX_STAT_BINMULT;
- }
- if (i == DMX_STAT_BINS-1) ++s->bins[i];
-}
-
-/* Actually do the work of printing out the human-readable message. */
-static CARD32 dmxStatCallback(OsTimerPtr timer, CARD32 t, pointer arg)
-{
- int i, j;
- static int header = 0;
- int limit = dmxNumScreens;
-
- if (!dmxNumScreens) {
- header = 0;
- return DMX_STAT_INTERVAL;
- }
-
- if (!header++ || !(header % 10)) {
- dmxLog(dmxDebug,
- " S SyncCount Sync/s avSync mxSync avPend mxPend | "
- "<10ms <1s >1s\n");
- }
-
- if (dmxStatDisplays && dmxStatDisplays < limit) limit = dmxStatDisplays;
- for (i = 0; i < limit; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- DMXStatInfo *s = dmxScreen->stat;
- unsigned long aSync, mSync;
- unsigned long aPend, mPend;
-
- if (!s) continue;
-
- aSync = avg(&s->usec, &mSync);
- aPend = avg(&s->pending, &mPend);
- dmxLog(dmxDebug, "%2d %9lu %7lu %6lu %6lu %6lu %6lu |",
- i, /* S */
- s->syncCount, /* SyncCount */
- (s->syncCount
- - s->oldSyncCount) * 1000 / dmxStatInterval, /* Sync/s */
- aSync, /* us/Sync */
- mSync, /* max/Sync */
- aPend, /* avgPend */
- mPend); /* maxPend */
- for (j = 0; j < DMX_STAT_BINS; j++)
- dmxLogCont(dmxDebug, " %5lu", s->bins[j]);
- dmxLogCont(dmxDebug, "\n");
-
- /* Reset/clear */
- s->oldSyncCount = s->syncCount;
- for (j = 0; j < DMX_STAT_BINS; j++) s->bins[j] = 0;
- }
- return DMX_STAT_INTERVAL; /* Place on queue again */
-}
-
-/** Try to initialize the statistic gathering and printing routines.
- * Initialization only takes place if #dmxStatActivate has already been
- * called. We don't need the same generation protection that we used in
- * dmxSyncInit because our timer is always on a queue -- hence, server
- * generation will always free it. */
-void dmxStatInit(void)
-{
- if (dmxStatInterval)
- dmxStatTimer = TimerSet(NULL, 0,
- dmxStatInterval, dmxStatCallback, NULL);
-}
+/*
+ * Copyright 2002, 2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * The DMX server code is written to call #dmxSync() whenever an XSync()
+ * might be necessary. However, since XSync() requires a two way
+ * communication with the other X server, eliminating unnecessary
+ * XSync() calls is a key performance optimization. Support for this
+ * optimization is provided in \a dmxsync.c. This file provides routines
+ * that evaluate this optimization by counting the number of XSync()
+ * calls and monitoring their latency. This functionality can be turned
+ * on using the -stat command-line parameter. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxstat.h"
+#include "dmxlog.h"
+#include <X11/Xos.h> /* For sys/time.h */
+
+/** Used to compute a running average of value. */
+typedef struct _DMXStatAvg {
+ int pos;
+ int count;
+ unsigned long value[DMX_STAT_LENGTH];
+} DMXStatAvg;
+
+/** Statistical information about XSync calls. */
+struct _DMXStatInfo {
+ unsigned long syncCount;
+ unsigned long oldSyncCount;
+
+ DMXStatAvg usec;
+ DMXStatAvg pending;
+
+ unsigned long bins[DMX_STAT_BINS];
+};
+
+/* Interval in mS between statistic message log entries. */
+int dmxStatInterval;
+static int dmxStatDisplays;
+static OsTimerPtr dmxStatTimer;
+
+/** Return the number of microseconds as an unsigned long.
+ * Unfortunately, this is only useful for intervals < about 4 sec. */
+static unsigned long
+usec(struct timeval *stop, struct timeval *start)
+{
+ return (stop->tv_sec - start->tv_sec) * 1000000
+ + stop->tv_usec - start->tv_usec;
+}
+
+static unsigned long
+avg(DMXStatAvg * data, unsigned long *max)
+{
+ unsigned long sum;
+ int i;
+
+ *max = 0;
+ if (!data->count)
+ return 0;
+
+ for (i = 0, sum = 0; i < data->count; i++) {
+ if (data->value[i] > *max)
+ *max = data->value[i];
+ sum += data->value[i];
+ }
+ return sum / data->count;
+}
+
+/** Turn on XSync statistic gathering and printing. Print every \a
+ * interval seconds, with lines for the first \a displays. If \a
+ * interval is NULL, 1 will be used. If \a displays is NULL, 0 will be
+ * used (meaning a line for every display will be printed). Note that
+ * this function takes string arguments because it will usually be
+ * called from #ddxProcessArgument in \a dmxinit.c. */
+void
+dmxStatActivate(const char *interval, const char *displays)
+{
+ dmxStatInterval = (interval ? atoi(interval) : 1) * 1000;
+ dmxStatDisplays = (displays ? atoi(displays) : 0);
+
+ if (dmxStatInterval < 1000)
+ dmxStatInterval = 1000;
+ if (dmxStatDisplays < 0)
+ dmxStatDisplays = 0;
+}
+
+/** Allocate a \a DMXStatInfo structure. */
+DMXStatInfo *
+dmxStatAlloc(void)
+{
+ DMXStatInfo *pt = calloc(1, sizeof(*pt));
+
+ return pt;
+}
+
+/** Free the memory used by a \a DMXStatInfo structure. */
+void
+dmxStatFree(DMXStatInfo * pt)
+{
+ free(pt);
+}
+
+static void
+dmxStatValue(DMXStatAvg * data, unsigned long value)
+{
+ if (data->count != DMX_STAT_LENGTH)
+ ++data->count;
+ if (data->pos >= DMX_STAT_LENGTH - 1)
+ data->pos = 0;
+ data->value[data->pos++] = value;
+}
+
+/** Note that a XSync() was just done on \a dmxScreen with the \a start
+ * and \a stop times (from gettimeofday()) and the number of
+ * pending-but-not-yet-processed XSync requests. This routine is called
+ * from #dmxDoSync in \a dmxsync.c */
+void
+dmxStatSync(DMXScreenInfo * dmxScreen,
+ struct timeval *stop, struct timeval *start, unsigned long pending)
+{
+ DMXStatInfo *s = dmxScreen->stat;
+ unsigned long elapsed = usec(stop, start);
+ unsigned long thresh;
+ int i;
+
+ ++s->syncCount;
+ dmxStatValue(&s->usec, elapsed);
+ dmxStatValue(&s->pending, pending);
+
+ for (i = 0, thresh = DMX_STAT_BIN0; i < DMX_STAT_BINS - 1; i++) {
+ if (elapsed < thresh) {
+ ++s->bins[i];
+ break;
+ }
+ thresh *= DMX_STAT_BINMULT;
+ }
+ if (i == DMX_STAT_BINS - 1)
+ ++s->bins[i];
+}
+
+/* Actually do the work of printing out the human-readable message. */
+static CARD32
+dmxStatCallback(OsTimerPtr timer, CARD32 t, pointer arg)
+{
+ int i, j;
+ static int header = 0;
+ int limit = dmxNumScreens;
+
+ if (!dmxNumScreens) {
+ header = 0;
+ return DMX_STAT_INTERVAL;
+ }
+
+ if (!header++ || !(header % 10)) {
+ dmxLog(dmxDebug,
+ " S SyncCount Sync/s avSync mxSync avPend mxPend | "
+ "<10ms <1s >1s\n");
+ }
+
+ if (dmxStatDisplays && dmxStatDisplays < limit)
+ limit = dmxStatDisplays;
+ for (i = 0; i < limit; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+ DMXStatInfo *s = dmxScreen->stat;
+ unsigned long aSync, mSync;
+ unsigned long aPend, mPend;
+
+ if (!s)
+ continue;
+
+ aSync = avg(&s->usec, &mSync);
+ aPend = avg(&s->pending, &mPend);
+ dmxLog(dmxDebug, "%2d %9lu %7lu %6lu %6lu %6lu %6lu |", i, /* S */
+ s->syncCount, /* SyncCount */
+ (s->syncCount - s->oldSyncCount) * 1000 / dmxStatInterval, /* Sync/s */
+ aSync, /* us/Sync */
+ mSync, /* max/Sync */
+ aPend, /* avgPend */
+ mPend); /* maxPend */
+ for (j = 0; j < DMX_STAT_BINS; j++)
+ dmxLogCont(dmxDebug, " %5lu", s->bins[j]);
+ dmxLogCont(dmxDebug, "\n");
+
+ /* Reset/clear */
+ s->oldSyncCount = s->syncCount;
+ for (j = 0; j < DMX_STAT_BINS; j++)
+ s->bins[j] = 0;
+ }
+ return DMX_STAT_INTERVAL; /* Place on queue again */
+}
+
+/** Try to initialize the statistic gathering and printing routines.
+ * Initialization only takes place if #dmxStatActivate has already been
+ * called. We don't need the same generation protection that we used in
+ * dmxSyncInit because our timer is always on a queue -- hence, server
+ * generation will always free it. */
+void
+dmxStatInit(void)
+{
+ if (dmxStatInterval)
+ dmxStatTimer = TimerSet(NULL, 0,
+ dmxStatInterval, dmxStatCallback, NULL);
+}
diff --git a/xorg-server/hw/dmx/dmxsync.c b/xorg-server/hw/dmx/dmxsync.c
index 8ace59470..bf28584b4 100644
--- a/xorg-server/hw/dmx/dmxsync.c
+++ b/xorg-server/hw/dmx/dmxsync.c
@@ -1,193 +1,207 @@
-/*
- * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- *
- * The DMX server code is written to call #dmxSync() whenever an XSync()
- * might be necessary. However, since XSync() requires a two way
- * communication with the other X server, eliminating unnecessary
- * XSync() calls is a key performance optimization. Support for this
- * optimization is provided here. Statistics about XSync() calls and
- * latency are gathered in \a dmxstat.c.
- *
- * During the initial conversion from calling XSync() immediately to the
- * XSync() batching method implemented in this file, it was noted that,
- * out of more than 300 \a x11perf tests, 8 tests became more than 100
- * times faster, with 68 more than 50X faster, 114 more than 10X faster,
- * and 181 more than 2X faster. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxsync.h"
-#include "dmxstat.h"
-#include "dmxlog.h"
-#include <sys/time.h>
-
-static int dmxSyncInterval = 100; /* Default interval in milliseconds */
-static OsTimerPtr dmxSyncTimer;
-static int dmxSyncPending;
-
-static void dmxDoSync(DMXScreenInfo *dmxScreen)
-{
- dmxScreen->needsSync = FALSE;
-
- if (!dmxScreen->beDisplay)
- return; /* FIXME: Is this correct behavior for sync stats? */
-
- if (!dmxStatInterval) {
- XSync(dmxScreen->beDisplay, False);
- } else {
- struct timeval start, stop;
-
- gettimeofday(&start, 0);
- XSync(dmxScreen->beDisplay, False);
- gettimeofday(&stop, 0);
- dmxStatSync(dmxScreen, &stop, &start, dmxSyncPending);
- }
-}
-
-static CARD32 dmxSyncCallback(OsTimerPtr timer, CARD32 time, pointer arg)
-{
- int i;
-
- if (dmxSyncPending) {
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- if (dmxScreen->needsSync) dmxDoSync(dmxScreen);
- }
- }
- dmxSyncPending = 0;
- return 0; /* Do not place on queue again */
-}
-
-static void dmxSyncBlockHandler(pointer blockData, OSTimePtr pTimeout,
- pointer pReadMask)
-{
- TimerForce(dmxSyncTimer);
-}
-
-static void dmxSyncWakeupHandler(pointer blockData, int result,
- pointer pReadMask)
-{
-}
-
-/** Request the XSync() batching optimization with the specified \a
- * interval (in mS). If the \a interval is 0, 100mS is used. If the \a
- * interval is less than 0, then the XSync() batching optimization is
- * not requested (e.g., so the -syncbatch -1 command line option can
- * turn off the default 100mS XSync() batching).
- *
- * Note that the parameter to this routine is a string, since it will
- * usually be called from #ddxProcessArgument in \a dmxinit.c */
-void dmxSyncActivate(const char *interval)
-{
- dmxSyncInterval = (interval ? atoi(interval) : 100);
-
- if (dmxSyncInterval < 0) dmxSyncInterval = 0;
-}
-
-/** Initialize the XSync() batching optimization, but only if
- * #dmxSyncActivate was last called with a non-negative value. */
-void dmxSyncInit(void)
-{
- if (dmxSyncInterval) {
- RegisterBlockAndWakeupHandlers(dmxSyncBlockHandler,
- dmxSyncWakeupHandler,
- NULL);
- dmxLog(dmxInfo, "XSync batching with %d ms interval\n",
- dmxSyncInterval);
- } else {
- dmxLog(dmxInfo, "XSync batching disabled\n");
- }
-}
-
-/** Request an XSync() to the display used by \a dmxScreen. If \a now
- * is TRUE, call XSync() immediately instead of waiting for the next
- * XSync() batching point. Note that if XSync() batching was deselected
- * with #dmxSyncActivate() before #dmxSyncInit() was called, then no
- * XSync() batching is performed and this function always calles XSync()
- * immediately.
- *
- * (Note that this function uses TimerSet but works correctly in the
- * face of a server generation. See the source for details.)
- *
- * If \a dmxScreen is \a NULL, then all pending syncs will be flushed
- * immediately.
- */
-void dmxSync(DMXScreenInfo *dmxScreen, Bool now)
-{
- static unsigned long dmxGeneration = 0;
-
- if (dmxSyncInterval) {
- if (dmxGeneration != serverGeneration) {
- /* Server generation does a TimerInit, which frees all
- * timers. So, at this point dmxSyncTimer is either:
- * 1) NULL, iff dmxGeneration == 0,
- * 2) freed, if it was on a queue (dmxSyncPending != 0), or
- * 3) allocated, if it wasn't on a queue (dmxSyncPending == 0)
- */
- if (dmxSyncTimer && !dmxSyncPending) free(dmxSyncTimer);
- dmxSyncTimer = NULL;
- now = TRUE;
- dmxGeneration = serverGeneration;
- }
- /* Queue sync */
- if (dmxScreen) {
- dmxScreen->needsSync = TRUE;
- ++dmxSyncPending;
- }
-
- /* Do sync or set time for later */
- if (now || !dmxScreen) {
- if (!TimerForce(dmxSyncTimer)) dmxSyncCallback(NULL, 0, NULL);
- /* At this point, dmxSyncPending == 0 because
- * dmxSyncCallback must have been called. */
- if (dmxSyncPending)
- dmxLog(dmxFatal, "dmxSync(%s,%d): dmxSyncPending = %d\n",
- dmxScreen ? dmxScreen->name : "", now, dmxSyncPending);
- } else {
- dmxScreen->needsSync = TRUE;
- if (dmxSyncPending == 1)
- dmxSyncTimer = TimerSet(dmxSyncTimer, 0, dmxSyncInterval,
- dmxSyncCallback, NULL);
- }
- } else {
- /* If dmxSyncInterval is not being used,
- * then all the backends are already
- * up-to-date. */
- if (dmxScreen) dmxDoSync(dmxScreen);
- }
-}
+/*
+ * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * The DMX server code is written to call #dmxSync() whenever an XSync()
+ * might be necessary. However, since XSync() requires a two way
+ * communication with the other X server, eliminating unnecessary
+ * XSync() calls is a key performance optimization. Support for this
+ * optimization is provided here. Statistics about XSync() calls and
+ * latency are gathered in \a dmxstat.c.
+ *
+ * During the initial conversion from calling XSync() immediately to the
+ * XSync() batching method implemented in this file, it was noted that,
+ * out of more than 300 \a x11perf tests, 8 tests became more than 100
+ * times faster, with 68 more than 50X faster, 114 more than 10X faster,
+ * and 181 more than 2X faster. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxsync.h"
+#include "dmxstat.h"
+#include "dmxlog.h"
+#include <sys/time.h>
+
+static int dmxSyncInterval = 100; /* Default interval in milliseconds */
+static OsTimerPtr dmxSyncTimer;
+static int dmxSyncPending;
+
+static void
+dmxDoSync(DMXScreenInfo * dmxScreen)
+{
+ dmxScreen->needsSync = FALSE;
+
+ if (!dmxScreen->beDisplay)
+ return; /* FIXME: Is this correct behavior for sync stats? */
+
+ if (!dmxStatInterval) {
+ XSync(dmxScreen->beDisplay, False);
+ }
+ else {
+ struct timeval start, stop;
+
+ gettimeofday(&start, 0);
+ XSync(dmxScreen->beDisplay, False);
+ gettimeofday(&stop, 0);
+ dmxStatSync(dmxScreen, &stop, &start, dmxSyncPending);
+ }
+}
+
+static CARD32
+dmxSyncCallback(OsTimerPtr timer, CARD32 time, pointer arg)
+{
+ int i;
+
+ if (dmxSyncPending) {
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ if (dmxScreen->needsSync)
+ dmxDoSync(dmxScreen);
+ }
+ }
+ dmxSyncPending = 0;
+ return 0; /* Do not place on queue again */
+}
+
+static void
+dmxSyncBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask)
+{
+ TimerForce(dmxSyncTimer);
+}
+
+static void
+dmxSyncWakeupHandler(pointer blockData, int result, pointer pReadMask)
+{
+}
+
+/** Request the XSync() batching optimization with the specified \a
+ * interval (in mS). If the \a interval is 0, 100mS is used. If the \a
+ * interval is less than 0, then the XSync() batching optimization is
+ * not requested (e.g., so the -syncbatch -1 command line option can
+ * turn off the default 100mS XSync() batching).
+ *
+ * Note that the parameter to this routine is a string, since it will
+ * usually be called from #ddxProcessArgument in \a dmxinit.c */
+void
+dmxSyncActivate(const char *interval)
+{
+ dmxSyncInterval = (interval ? atoi(interval) : 100);
+
+ if (dmxSyncInterval < 0)
+ dmxSyncInterval = 0;
+}
+
+/** Initialize the XSync() batching optimization, but only if
+ * #dmxSyncActivate was last called with a non-negative value. */
+void
+dmxSyncInit(void)
+{
+ if (dmxSyncInterval) {
+ RegisterBlockAndWakeupHandlers(dmxSyncBlockHandler,
+ dmxSyncWakeupHandler, NULL);
+ dmxLog(dmxInfo, "XSync batching with %d ms interval\n",
+ dmxSyncInterval);
+ }
+ else {
+ dmxLog(dmxInfo, "XSync batching disabled\n");
+ }
+}
+
+/** Request an XSync() to the display used by \a dmxScreen. If \a now
+ * is TRUE, call XSync() immediately instead of waiting for the next
+ * XSync() batching point. Note that if XSync() batching was deselected
+ * with #dmxSyncActivate() before #dmxSyncInit() was called, then no
+ * XSync() batching is performed and this function always calles XSync()
+ * immediately.
+ *
+ * (Note that this function uses TimerSet but works correctly in the
+ * face of a server generation. See the source for details.)
+ *
+ * If \a dmxScreen is \a NULL, then all pending syncs will be flushed
+ * immediately.
+ */
+void
+dmxSync(DMXScreenInfo * dmxScreen, Bool now)
+{
+ static unsigned long dmxGeneration = 0;
+
+ if (dmxSyncInterval) {
+ if (dmxGeneration != serverGeneration) {
+ /* Server generation does a TimerInit, which frees all
+ * timers. So, at this point dmxSyncTimer is either:
+ * 1) NULL, iff dmxGeneration == 0,
+ * 2) freed, if it was on a queue (dmxSyncPending != 0), or
+ * 3) allocated, if it wasn't on a queue (dmxSyncPending == 0)
+ */
+ if (dmxSyncTimer && !dmxSyncPending)
+ free(dmxSyncTimer);
+ dmxSyncTimer = NULL;
+ now = TRUE;
+ dmxGeneration = serverGeneration;
+ }
+ /* Queue sync */
+ if (dmxScreen) {
+ dmxScreen->needsSync = TRUE;
+ ++dmxSyncPending;
+ }
+
+ /* Do sync or set time for later */
+ if (now || !dmxScreen) {
+ if (!TimerForce(dmxSyncTimer))
+ dmxSyncCallback(NULL, 0, NULL);
+ /* At this point, dmxSyncPending == 0 because
+ * dmxSyncCallback must have been called. */
+ if (dmxSyncPending)
+ dmxLog(dmxFatal, "dmxSync(%s,%d): dmxSyncPending = %d\n",
+ dmxScreen ? dmxScreen->name : "", now, dmxSyncPending);
+ }
+ else {
+ dmxScreen->needsSync = TRUE;
+ if (dmxSyncPending == 1)
+ dmxSyncTimer = TimerSet(dmxSyncTimer, 0, dmxSyncInterval,
+ dmxSyncCallback, NULL);
+ }
+ }
+ else {
+ /* If dmxSyncInterval is not being used,
+ * then all the backends are already
+ * up-to-date. */
+ if (dmxScreen)
+ dmxDoSync(dmxScreen);
+ }
+}
diff --git a/xorg-server/hw/dmx/dmxvisual.c b/xorg-server/hw/dmx/dmxvisual.c
index 7b8771f9e..23b9bddea 100644
--- a/xorg-server/hw/dmx/dmxvisual.c
+++ b/xorg-server/hw/dmx/dmxvisual.c
@@ -48,24 +48,25 @@
#include <GL/glxint.h>
extern VisualID glxMatchVisualInConfigList(ScreenPtr pScreen,
- VisualPtr pVisual,
- __GLXvisualConfig *configs,
- int nconfigs);
+ VisualPtr pVisual,
+ __GLXvisualConfig * configs,
+ int nconfigs);
-static Visual *dmxLookupGLXVisual(ScreenPtr pScreen, VisualPtr pVisual)
+static Visual *
+dmxLookupGLXVisual(ScreenPtr pScreen, VisualPtr pVisual)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- int j;
- VisualID vid;
+ int j;
+ VisualID vid;
vid = glxMatchVisualInConfigList(pScreen, pVisual,
- dmxScreen->glxVisuals,
- dmxScreen->numGlxVisuals);
+ dmxScreen->glxVisuals,
+ dmxScreen->numGlxVisuals);
if (vid) {
- /* Find the X visual of the matching GLX visual */
- for (j = 0; j < dmxScreen->beNumVisuals; j++)
- if (vid == dmxScreen->beVisuals[j].visualid)
- return dmxScreen->beVisuals[j].visual;
+ /* Find the X visual of the matching GLX visual */
+ for (j = 0; j < dmxScreen->beNumVisuals; j++)
+ if (vid == dmxScreen->beVisuals[j].visualid)
+ return dmxScreen->beVisuals[j].visual;
}
/* No matching visual found */
@@ -74,66 +75,71 @@ static Visual *dmxLookupGLXVisual(ScreenPtr pScreen, VisualPtr pVisual)
#endif
/** Return the visual that matched \a pVisual. */
-Visual *dmxLookupVisual(ScreenPtr pScreen, VisualPtr pVisual)
+Visual *
+dmxLookupVisual(ScreenPtr pScreen, VisualPtr pVisual)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- int i;
+ int i;
+
#ifdef GLXEXT
- Visual *retval;
+ Visual *retval;
#endif
if (!dmxScreen->beDisplay)
- return NULL;
+ return NULL;
#ifdef GLXEXT
if ((retval = dmxLookupGLXVisual(pScreen, pVisual)))
- return retval;
+ return retval;
#endif
for (i = 0; i < dmxScreen->beNumVisuals; i++) {
- if (pVisual->class == dmxScreen->beVisuals[i].class &&
- pVisual->bitsPerRGBValue == dmxScreen->beVisuals[i].bits_per_rgb &&
- pVisual->ColormapEntries == dmxScreen->beVisuals[i].colormap_size &&
- pVisual->nplanes == dmxScreen->beVisuals[i].depth &&
- pVisual->redMask == dmxScreen->beVisuals[i].red_mask &&
- pVisual->greenMask == dmxScreen->beVisuals[i].green_mask &&
- pVisual->blueMask == dmxScreen->beVisuals[i].blue_mask) {
- return dmxScreen->beVisuals[i].visual;
- }
+ if (pVisual->class == dmxScreen->beVisuals[i].class &&
+ pVisual->bitsPerRGBValue == dmxScreen->beVisuals[i].bits_per_rgb &&
+ pVisual->ColormapEntries == dmxScreen->beVisuals[i].colormap_size &&
+ pVisual->nplanes == dmxScreen->beVisuals[i].depth &&
+ pVisual->redMask == dmxScreen->beVisuals[i].red_mask &&
+ pVisual->greenMask == dmxScreen->beVisuals[i].green_mask &&
+ pVisual->blueMask == dmxScreen->beVisuals[i].blue_mask) {
+ return dmxScreen->beVisuals[i].visual;
+ }
}
return NULL;
}
/** Return the visual that matched the \a vid. */
-Visual *dmxLookupVisualFromID(ScreenPtr pScreen, VisualID vid)
+Visual *
+dmxLookupVisualFromID(ScreenPtr pScreen, VisualID vid)
{
Visual *visual;
- int i;
+ int i;
if (!dmxScreens[pScreen->myNum].beDisplay)
- return NULL;
+ return NULL;
for (i = 0; i < pScreen->numVisuals; i++) {
- if (pScreen->visuals[i].vid == vid) {
- visual = dmxLookupVisual(pScreen, &pScreen->visuals[i]);
- if (visual) return visual;
- }
+ if (pScreen->visuals[i].vid == vid) {
+ visual = dmxLookupVisual(pScreen, &pScreen->visuals[i]);
+ if (visual)
+ return visual;
+ }
}
return NULL;
}
/** Return the colormap for the \a visual. */
-Colormap dmxColormapFromDefaultVisual(ScreenPtr pScreen, Visual *visual)
+Colormap
+dmxColormapFromDefaultVisual(ScreenPtr pScreen, Visual * visual)
{
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- int i;
+ int i;
if (dmxScreen->beDisplay) {
- for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
- if (visual == dmxScreen->beVisuals[i].visual)
- return dmxScreen->beDefColormaps[i];
+ for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
+ if (visual == dmxScreen->beVisuals[i].visual)
+ return dmxScreen->beDefColormaps[i];
}
return None;
diff --git a/xorg-server/hw/dmx/dmxwindow.c b/xorg-server/hw/dmx/dmxwindow.c
index 704fcff54..855e56b9d 100644
--- a/xorg-server/hw/dmx/dmxwindow.c
+++ b/xorg-server/hw/dmx/dmxwindow.c
@@ -52,79 +52,78 @@
static void dmxDoRestackWindow(WindowPtr pWindow);
static void dmxDoChangeWindowAttributes(WindowPtr pWindow,
- unsigned long *mask,
- XSetWindowAttributes *attribs);
+ unsigned long *mask,
+ XSetWindowAttributes * attribs);
static void dmxDoSetShape(WindowPtr pWindow);
/** Initialize the private area for the window functions. */
-Bool dmxInitWindow(ScreenPtr pScreen)
+Bool
+dmxInitWindow(ScreenPtr pScreen)
{
- if (!dixRegisterPrivateKey(&dmxWinPrivateKeyRec, PRIVATE_WINDOW, sizeof(dmxWinPrivRec)))
- return FALSE;
+ if (!dixRegisterPrivateKey
+ (&dmxWinPrivateKeyRec, PRIVATE_WINDOW, sizeof(dmxWinPrivRec)))
+ return FALSE;
return TRUE;
}
-
-Window dmxCreateRootWindow(WindowPtr pWindow)
+Window
+dmxCreateRootWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- Window parent;
- Visual *visual;
- unsigned long mask;
- XSetWindowAttributes attribs;
- ColormapPtr pCmap;
- dmxColormapPrivPtr pCmapPriv;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ Window parent;
+ Visual *visual;
+ unsigned long mask;
+ XSetWindowAttributes attribs;
+ ColormapPtr pCmap;
+ dmxColormapPrivPtr pCmapPriv;
/* Create root window */
- parent = dmxScreen->scrnWin; /* This is our "Screen" window */
+ parent = dmxScreen->scrnWin; /* This is our "Screen" window */
visual = dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual;
- dixLookupResourceByType((pointer*) &pCmap, wColormap(pWindow),
- RT_COLORMAP, NullClient, DixUnknownAccess);
+ dixLookupResourceByType((pointer *) &pCmap, wColormap(pWindow),
+ RT_COLORMAP, NullClient, DixUnknownAccess);
pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
mask = CWEventMask | CWBackingStore | CWColormap | CWBorderPixel;
- attribs.event_mask = ExposureMask;
+ attribs.event_mask = ExposureMask;
attribs.backing_store = NotUseful;
- attribs.colormap = pCmapPriv->cmap;
- attribs.border_pixel = 0;
+ attribs.colormap = pCmapPriv->cmap;
+ attribs.border_pixel = 0;
/* Incorporate new attributes, if needed */
if (pWinPriv->attribMask) {
- dmxDoChangeWindowAttributes(pWindow, &pWinPriv->attribMask, &attribs);
- mask |= pWinPriv->attribMask;
+ dmxDoChangeWindowAttributes(pWindow, &pWinPriv->attribMask, &attribs);
+ mask |= pWinPriv->attribMask;
}
return XCreateWindow(dmxScreen->beDisplay,
- parent,
- pWindow->origin.x - wBorderWidth(pWindow),
- pWindow->origin.y - wBorderWidth(pWindow),
- pWindow->drawable.width,
- pWindow->drawable.height,
- pWindow->borderWidth,
- pWindow->drawable.depth,
- pWindow->drawable.class,
- visual,
- mask,
- &attribs);
+ parent,
+ pWindow->origin.x - wBorderWidth(pWindow),
+ pWindow->origin.y - wBorderWidth(pWindow),
+ pWindow->drawable.width,
+ pWindow->drawable.height,
+ pWindow->borderWidth,
+ pWindow->drawable.depth,
+ pWindow->drawable.class, visual, mask, &attribs);
}
/** Change the location and size of the "screen" window. Called from
* dmxextension.c dmxConfigureScreenWindow(). */
-void dmxResizeScreenWindow(ScreenPtr pScreen,
- int x, int y, int w, int h)
+void
+dmxResizeScreenWindow(ScreenPtr pScreen, int x, int y, int w, int h)
{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- unsigned int m;
- XWindowChanges c;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ unsigned int m;
+ XWindowChanges c;
if (!dmxScreen->beDisplay)
- return;
+ return;
/* Handle resizing on back-end server */
m = CWX | CWY | CWWidth | CWHeight;
@@ -139,81 +138,85 @@ void dmxResizeScreenWindow(ScreenPtr pScreen,
/** Change the location and size of the "root" window. Called from
* #dmxCreateWindow. */
-void dmxResizeRootWindow(WindowPtr pRoot,
- int x, int y, int w, int h)
+void
+dmxResizeRootWindow(WindowPtr pRoot, int x, int y, int w, int h)
{
- DMXScreenInfo *dmxScreen = &dmxScreens[pRoot->drawable.pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pRoot);
- unsigned int m;
- XWindowChanges c;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pRoot->drawable.pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pRoot);
+ unsigned int m;
+ XWindowChanges c;
/* Handle resizing on back-end server */
if (dmxScreen->beDisplay) {
- m = CWX | CWY | CWWidth | CWHeight;
- c.x = x;
- c.y = y;
- c.width = (w > 0) ? w : 1;
- c.height = (h > 0) ? h : 1;
+ m = CWX | CWY | CWWidth | CWHeight;
+ c.x = x;
+ c.y = y;
+ c.width = (w > 0) ? w : 1;
+ c.height = (h > 0) ? h : 1;
- XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
}
if (w == 0 || h == 0) {
- if (pWinPriv->mapped) {
- if (dmxScreen->beDisplay)
- XUnmapWindow(dmxScreen->beDisplay, pWinPriv->window);
- pWinPriv->mapped = FALSE;
- }
- } else if (!pWinPriv->mapped) {
- if (dmxScreen->beDisplay)
- XMapWindow(dmxScreen->beDisplay, pWinPriv->window);
- pWinPriv->mapped = TRUE;
+ if (pWinPriv->mapped) {
+ if (dmxScreen->beDisplay)
+ XUnmapWindow(dmxScreen->beDisplay, pWinPriv->window);
+ pWinPriv->mapped = FALSE;
+ }
+ }
+ else if (!pWinPriv->mapped) {
+ if (dmxScreen->beDisplay)
+ XMapWindow(dmxScreen->beDisplay, pWinPriv->window);
+ pWinPriv->mapped = TRUE;
}
if (dmxScreen->beDisplay)
- dmxSync(dmxScreen, False);
+ dmxSync(dmxScreen, False);
}
-void dmxGetDefaultWindowAttributes(WindowPtr pWindow,
- Colormap *cmap,
- Visual **visual)
+void
+dmxGetDefaultWindowAttributes(WindowPtr pWindow,
+ Colormap * cmap, Visual ** visual)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
if (pWindow->drawable.class != InputOnly &&
- pWindow->optional &&
- pWindow->optional->visual != wVisual(pWindow->parent)) {
-
- /* Find the matching visual */
- *visual = dmxLookupVisualFromID(pScreen, wVisual(pWindow));
-
- /* Handle optional colormaps */
- if (pWindow->optional->colormap) {
- ColormapPtr pCmap;
- dmxColormapPrivPtr pCmapPriv;
-
- dixLookupResourceByType((pointer*) &pCmap, wColormap(pWindow),
- RT_COLORMAP, NullClient, DixUnknownAccess);
- pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
- *cmap = pCmapPriv->cmap;
- } else {
- *cmap = dmxColormapFromDefaultVisual(pScreen, *visual);
- }
- } else {
- *visual = CopyFromParent;
- *cmap = (Colormap)0;
+ pWindow->optional &&
+ pWindow->optional->visual != wVisual(pWindow->parent)) {
+
+ /* Find the matching visual */
+ *visual = dmxLookupVisualFromID(pScreen, wVisual(pWindow));
+
+ /* Handle optional colormaps */
+ if (pWindow->optional->colormap) {
+ ColormapPtr pCmap;
+ dmxColormapPrivPtr pCmapPriv;
+
+ dixLookupResourceByType((pointer *) &pCmap, wColormap(pWindow),
+ RT_COLORMAP, NullClient, DixUnknownAccess);
+ pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
+ *cmap = pCmapPriv->cmap;
+ }
+ else {
+ *cmap = dmxColormapFromDefaultVisual(pScreen, *visual);
+ }
+ }
+ else {
+ *visual = CopyFromParent;
+ *cmap = (Colormap) 0;
}
}
-static Window dmxCreateNonRootWindow(WindowPtr pWindow)
+static Window
+dmxCreateNonRootWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- Window parent;
- unsigned long mask = 0L;
- XSetWindowAttributes attribs;
- dmxWinPrivPtr pParentPriv = DMX_GET_WINDOW_PRIV(pWindow->parent);
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ Window parent;
+ unsigned long mask = 0L;
+ XSetWindowAttributes attribs;
+ dmxWinPrivPtr pParentPriv = DMX_GET_WINDOW_PRIV(pWindow->parent);
/* Create window on back-end server */
@@ -223,29 +226,29 @@ static Window dmxCreateNonRootWindow(WindowPtr pWindow)
from ReparentWindow and the grandparent window has not yet been
created */
if (!parent) {
- dmxCreateAndRealizeWindow(pWindow->parent, FALSE);
- parent = pParentPriv->window;
+ dmxCreateAndRealizeWindow(pWindow->parent, FALSE);
+ parent = pParentPriv->window;
}
/* Incorporate new attributes, if needed */
if (pWinPriv->attribMask) {
- dmxDoChangeWindowAttributes(pWindow, &pWinPriv->attribMask, &attribs);
- mask |= pWinPriv->attribMask;
+ dmxDoChangeWindowAttributes(pWindow, &pWinPriv->attribMask, &attribs);
+ mask |= pWinPriv->attribMask;
}
/* Add in default attributes */
if (pWindow->drawable.class != InputOnly) {
- mask |= CWBackingStore;
- attribs.backing_store = NotUseful;
-
- if (!(mask & CWColormap) && pWinPriv->cmap) {
- mask |= CWColormap;
- attribs.colormap = pWinPriv->cmap;
- if (!(mask & CWBorderPixel)) {
- mask |= CWBorderPixel;
- attribs.border_pixel = 0;
- }
- }
+ mask |= CWBackingStore;
+ attribs.backing_store = NotUseful;
+
+ if (!(mask & CWColormap) && pWinPriv->cmap) {
+ mask |= CWColormap;
+ attribs.colormap = pWinPriv->cmap;
+ if (!(mask & CWBorderPixel)) {
+ mask |= CWBorderPixel;
+ attribs.border_pixel = 0;
+ }
+ }
}
/* Handle case where subwindows are being mapped, but created out of
@@ -254,17 +257,15 @@ static Window dmxCreateNonRootWindow(WindowPtr pWindow)
pWinPriv->restacked = (pWindow->prevSib != NullWindow);
return XCreateWindow(dmxScreen->beDisplay,
- parent,
- pWindow->origin.x - wBorderWidth(pWindow),
- pWindow->origin.y - wBorderWidth(pWindow),
- pWindow->drawable.width,
- pWindow->drawable.height,
- pWindow->borderWidth,
- pWindow->drawable.depth,
- pWindow->drawable.class,
- pWinPriv->visual,
- mask,
- &attribs);
+ parent,
+ pWindow->origin.x - wBorderWidth(pWindow),
+ pWindow->origin.y - wBorderWidth(pWindow),
+ pWindow->drawable.width,
+ pWindow->drawable.height,
+ pWindow->borderWidth,
+ pWindow->drawable.depth,
+ pWindow->drawable.class,
+ pWinPriv->visual, mask, &attribs);
}
/** This function handles lazy window creation and realization. Window
@@ -276,93 +277,101 @@ static Window dmxCreateNonRootWindow(WindowPtr pWindow)
* associated with it, those pictures are created on the back-end
* server by calling #dmxCreatePictureList(). If \a doSync is TRUE,
* then #dmxSync() is called. */
-void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync)
+void
+dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- if (!dmxScreen->beDisplay) return;
+ if (!dmxScreen->beDisplay)
+ return;
pWinPriv->window = dmxCreateNonRootWindow(pWindow);
- if (pWinPriv->restacked) dmxDoRestackWindow(pWindow);
- if (pWinPriv->isShaped) dmxDoSetShape(pWindow);
- if (pWinPriv->hasPict) dmxCreatePictureList(pWindow);
- if (pWinPriv->mapped) XMapWindow(dmxScreen->beDisplay,
- pWinPriv->window);
- if (doSync) dmxSync(dmxScreen, False);
+ if (pWinPriv->restacked)
+ dmxDoRestackWindow(pWindow);
+ if (pWinPriv->isShaped)
+ dmxDoSetShape(pWindow);
+ if (pWinPriv->hasPict)
+ dmxCreatePictureList(pWindow);
+ if (pWinPriv->mapped)
+ XMapWindow(dmxScreen->beDisplay, pWinPriv->window);
+ if (doSync)
+ dmxSync(dmxScreen, False);
}
/** Create \a pWindow on the back-end server. If the lazy window
* creation optimization is enabled, then the actual creation and
* realization of the window is handled by
* #dmxCreateAndRealizeWindow(). */
-Bool dmxCreateWindow(WindowPtr pWindow)
+Bool
+dmxCreateWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- Bool ret = TRUE;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ Bool ret = TRUE;
DMX_UNWRAP(CreateWindow, dmxScreen, pScreen);
#if 0
if (pScreen->CreateWindow)
- ret = pScreen->CreateWindow(pWindow);
+ ret = pScreen->CreateWindow(pWindow);
#endif
/* Set up the defaults */
- pWinPriv->window = (Window)0;
- pWinPriv->offscreen = TRUE;
- pWinPriv->mapped = FALSE;
- pWinPriv->restacked = FALSE;
+ pWinPriv->window = (Window) 0;
+ pWinPriv->offscreen = TRUE;
+ pWinPriv->mapped = FALSE;
+ pWinPriv->restacked = FALSE;
pWinPriv->attribMask = 0;
- pWinPriv->isShaped = FALSE;
- pWinPriv->hasPict = FALSE;
+ pWinPriv->isShaped = FALSE;
+ pWinPriv->hasPict = FALSE;
#ifdef GLXEXT
- pWinPriv->swapGroup = NULL;
- pWinPriv->barrier = 0;
+ pWinPriv->swapGroup = NULL;
+ pWinPriv->barrier = 0;
#endif
if (dmxScreen->beDisplay) {
- /* Only create the root window at this stage -- non-root windows are
- created when they are mapped and are on-screen */
- if (!pWindow->parent) {
- dmxScreen->rootWin = pWinPriv->window
- = dmxCreateRootWindow(pWindow);
- if (dmxScreen->scrnX != dmxScreen->rootX
- || dmxScreen->scrnY != dmxScreen->rootY
- || dmxScreen->scrnWidth != dmxScreen->rootWidth
- || dmxScreen->scrnHeight != dmxScreen->rootHeight) {
- dmxResizeRootWindow(pWindow,
- dmxScreen->rootX,
- dmxScreen->rootY,
- dmxScreen->rootWidth,
- dmxScreen->rootHeight);
- dmxUpdateScreenResources(screenInfo.screens[dmxScreen->index],
- dmxScreen->rootX,
- dmxScreen->rootY,
- dmxScreen->rootWidth,
- dmxScreen->rootHeight);
- pWindow->origin.x = dmxScreen->rootX;
- pWindow->origin.y = dmxScreen->rootY;
- }
- } else {
- dmxGetDefaultWindowAttributes(pWindow,
- &pWinPriv->cmap,
- &pWinPriv->visual);
-
- if (dmxLazyWindowCreation) {
- /* Save parent's visual for use later */
- if (pWinPriv->visual == CopyFromParent)
- pWinPriv->visual =
- dmxLookupVisualFromID(pScreen,
- wVisual(pWindow->parent));
- } else {
- pWinPriv->window = dmxCreateNonRootWindow(pWindow);
- }
- }
-
- dmxSync(dmxScreen, False);
+ /* Only create the root window at this stage -- non-root windows are
+ created when they are mapped and are on-screen */
+ if (!pWindow->parent) {
+ dmxScreen->rootWin = pWinPriv->window
+ = dmxCreateRootWindow(pWindow);
+ if (dmxScreen->scrnX != dmxScreen->rootX
+ || dmxScreen->scrnY != dmxScreen->rootY
+ || dmxScreen->scrnWidth != dmxScreen->rootWidth
+ || dmxScreen->scrnHeight != dmxScreen->rootHeight) {
+ dmxResizeRootWindow(pWindow,
+ dmxScreen->rootX,
+ dmxScreen->rootY,
+ dmxScreen->rootWidth,
+ dmxScreen->rootHeight);
+ dmxUpdateScreenResources(screenInfo.screens[dmxScreen->index],
+ dmxScreen->rootX,
+ dmxScreen->rootY,
+ dmxScreen->rootWidth,
+ dmxScreen->rootHeight);
+ pWindow->origin.x = dmxScreen->rootX;
+ pWindow->origin.y = dmxScreen->rootY;
+ }
+ }
+ else {
+ dmxGetDefaultWindowAttributes(pWindow,
+ &pWinPriv->cmap, &pWinPriv->visual);
+
+ if (dmxLazyWindowCreation) {
+ /* Save parent's visual for use later */
+ if (pWinPriv->visual == CopyFromParent)
+ pWinPriv->visual =
+ dmxLookupVisualFromID(pScreen,
+ wVisual(pWindow->parent));
+ }
+ else {
+ pWinPriv->window = dmxCreateNonRootWindow(pWindow);
+ }
+ }
+
+ dmxSync(dmxScreen, False);
}
DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen);
@@ -371,16 +380,17 @@ Bool dmxCreateWindow(WindowPtr pWindow)
}
/** Destroy \a pWindow on the back-end server. */
-Bool dmxBEDestroyWindow(WindowPtr pWindow)
+Bool
+dmxBEDestroyWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
if (pWinPriv->window) {
- XDestroyWindow(dmxScreen->beDisplay, pWinPriv->window);
- pWinPriv->window = (Window)0;
- return TRUE;
+ XDestroyWindow(dmxScreen->beDisplay, pWinPriv->window);
+ pWinPriv->window = (Window) 0;
+ return TRUE;
}
return FALSE;
@@ -388,14 +398,16 @@ Bool dmxBEDestroyWindow(WindowPtr pWindow)
/** Destroy \a pWindow on the back-end server. If any RENDER pictures
were created, destroy them as well. */
-Bool dmxDestroyWindow(WindowPtr pWindow)
+Bool
+dmxDestroyWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- Bool ret = TRUE;
- Bool needSync = FALSE;
+ Bool ret = TRUE;
+ Bool needSync = FALSE;
+
#ifdef GLXEXT
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
#endif
DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen);
@@ -405,15 +417,16 @@ Bool dmxDestroyWindow(WindowPtr pWindow)
/* Destroy window on back-end server */
needSync |= dmxBEDestroyWindow(pWindow);
- if (needSync) dmxSync(dmxScreen, FALSE);
+ if (needSync)
+ dmxSync(dmxScreen, FALSE);
#ifdef GLXEXT
if (pWinPriv->swapGroup && pWinPriv->windowDestroyed)
- pWinPriv->windowDestroyed(pWindow);
+ pWinPriv->windowDestroyed(pWindow);
#endif
if (pScreen->DestroyWindow)
- ret = pScreen->DestroyWindow(pWindow);
+ ret = pScreen->DestroyWindow(pWindow);
DMX_WRAP(DestroyWindow, dmxDestroyWindow, dmxScreen, pScreen);
@@ -421,19 +434,20 @@ Bool dmxDestroyWindow(WindowPtr pWindow)
}
/** Change the position of \a pWindow to be \a x, \a y. */
-Bool dmxPositionWindow(WindowPtr pWindow, int x, int y)
+Bool
+dmxPositionWindow(WindowPtr pWindow, int x, int y)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- Bool ret = TRUE;
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- unsigned int m;
- XWindowChanges c;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ Bool ret = TRUE;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ unsigned int m;
+ XWindowChanges c;
DMX_UNWRAP(PositionWindow, dmxScreen, pScreen);
#if 0
if (pScreen->PositionWindow)
- ret = pScreen->PositionWindow(pWindow, x, y);
+ ret = pScreen->PositionWindow(pWindow, x, y);
#endif
/* Determine if the window is completely off the visible portion of
@@ -443,21 +457,22 @@ Bool dmxPositionWindow(WindowPtr pWindow, int x, int y)
/* If the window is now on-screen and it is mapped and it has not
been created yet, create it and map it */
if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) {
- dmxCreateAndRealizeWindow(pWindow, TRUE);
- } else if (pWinPriv->window) {
- /* Position window on back-end server */
- m = CWX | CWY | CWWidth | CWHeight;
- c.x = pWindow->origin.x - wBorderWidth(pWindow);
- c.y = pWindow->origin.y - wBorderWidth(pWindow);
- c.width = pWindow->drawable.width;
- c.height = pWindow->drawable.height;
- if (pWindow->drawable.class != InputOnly) {
- m |= CWBorderWidth;
- c.border_width = pWindow->borderWidth;
- }
-
- XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
- dmxSync(dmxScreen, False);
+ dmxCreateAndRealizeWindow(pWindow, TRUE);
+ }
+ else if (pWinPriv->window) {
+ /* Position window on back-end server */
+ m = CWX | CWY | CWWidth | CWHeight;
+ c.x = pWindow->origin.x - wBorderWidth(pWindow);
+ c.y = pWindow->origin.y - wBorderWidth(pWindow);
+ c.width = pWindow->drawable.width;
+ c.height = pWindow->drawable.height;
+ if (pWindow->drawable.class != InputOnly) {
+ m |= CWBorderWidth;
+ c.border_width = pWindow->borderWidth;
+ }
+
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ dmxSync(dmxScreen, False);
}
DMX_WRAP(PositionWindow, dmxPositionWindow, dmxScreen, pScreen);
@@ -465,110 +480,111 @@ Bool dmxPositionWindow(WindowPtr pWindow, int x, int y)
return ret;
}
-static void dmxDoChangeWindowAttributes(WindowPtr pWindow,
- unsigned long *mask,
- XSetWindowAttributes *attribs)
+static void
+dmxDoChangeWindowAttributes(WindowPtr pWindow,
+ unsigned long *mask, XSetWindowAttributes * attribs)
{
- dmxPixPrivPtr pPixPriv;
+ dmxPixPrivPtr pPixPriv;
if (*mask & CWBackPixmap) {
- switch (pWindow->backgroundState) {
- case None:
- attribs->background_pixmap = None;
- break;
-
- case ParentRelative:
- attribs->background_pixmap = ParentRelative;
- break;
-
- case BackgroundPixmap:
- pPixPriv = DMX_GET_PIXMAP_PRIV(pWindow->background.pixmap);
- attribs->background_pixmap = pPixPriv->pixmap;
- break;
-
- case BackgroundPixel:
- *mask &= ~CWBackPixmap;
- break;
- }
+ switch (pWindow->backgroundState) {
+ case None:
+ attribs->background_pixmap = None;
+ break;
+
+ case ParentRelative:
+ attribs->background_pixmap = ParentRelative;
+ break;
+
+ case BackgroundPixmap:
+ pPixPriv = DMX_GET_PIXMAP_PRIV(pWindow->background.pixmap);
+ attribs->background_pixmap = pPixPriv->pixmap;
+ break;
+
+ case BackgroundPixel:
+ *mask &= ~CWBackPixmap;
+ break;
+ }
}
if (*mask & CWBackPixel) {
- if (pWindow->backgroundState == BackgroundPixel)
- attribs->background_pixel = pWindow->background.pixel;
- else
- *mask &= ~CWBackPixel;
+ if (pWindow->backgroundState == BackgroundPixel)
+ attribs->background_pixel = pWindow->background.pixel;
+ else
+ *mask &= ~CWBackPixel;
}
if (*mask & CWBorderPixmap) {
- if (pWindow->borderIsPixel)
- *mask &= ~CWBorderPixmap;
- else {
- pPixPriv = DMX_GET_PIXMAP_PRIV(pWindow->border.pixmap);
- attribs->border_pixmap = pPixPriv->pixmap;
- }
+ if (pWindow->borderIsPixel)
+ *mask &= ~CWBorderPixmap;
+ else {
+ pPixPriv = DMX_GET_PIXMAP_PRIV(pWindow->border.pixmap);
+ attribs->border_pixmap = pPixPriv->pixmap;
+ }
}
if (*mask & CWBorderPixel) {
- if (pWindow->borderIsPixel)
- attribs->border_pixel = pWindow->border.pixel;
- else
- *mask &= ~CWBorderPixel;
+ if (pWindow->borderIsPixel)
+ attribs->border_pixel = pWindow->border.pixel;
+ else
+ *mask &= ~CWBorderPixel;
}
if (*mask & CWBitGravity)
- attribs->bit_gravity = pWindow->bitGravity;
+ attribs->bit_gravity = pWindow->bitGravity;
if (*mask & CWWinGravity)
- *mask &= ~CWWinGravity; /* Handled by dix */
+ *mask &= ~CWWinGravity; /* Handled by dix */
if (*mask & CWBackingStore)
- *mask &= ~CWBackingStore; /* Backing store not supported */
+ *mask &= ~CWBackingStore; /* Backing store not supported */
if (*mask & CWBackingPlanes)
- *mask &= ~CWBackingPlanes; /* Backing store not supported */
+ *mask &= ~CWBackingPlanes; /* Backing store not supported */
if (*mask & CWBackingPixel)
- *mask &= ~CWBackingPixel; /* Backing store not supported */
+ *mask &= ~CWBackingPixel; /* Backing store not supported */
if (*mask & CWOverrideRedirect)
- attribs->override_redirect = pWindow->overrideRedirect;
+ attribs->override_redirect = pWindow->overrideRedirect;
if (*mask & CWSaveUnder)
- *mask &= ~CWSaveUnder; /* Save unders not supported */
+ *mask &= ~CWSaveUnder; /* Save unders not supported */
if (*mask & CWEventMask)
- *mask &= ~CWEventMask; /* Events are handled by dix */
+ *mask &= ~CWEventMask; /* Events are handled by dix */
if (*mask & CWDontPropagate)
- *mask &= ~CWDontPropagate; /* Events are handled by dix */
+ *mask &= ~CWDontPropagate; /* Events are handled by dix */
if (*mask & CWColormap) {
- ColormapPtr pCmap;
- dmxColormapPrivPtr pCmapPriv;
+ ColormapPtr pCmap;
+ dmxColormapPrivPtr pCmapPriv;
- dixLookupResourceByType((pointer*) &pCmap, wColormap(pWindow),
- RT_COLORMAP, NullClient, DixUnknownAccess);
- pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
- attribs->colormap = pCmapPriv->cmap;
+ dixLookupResourceByType((pointer *) &pCmap, wColormap(pWindow),
+ RT_COLORMAP, NullClient, DixUnknownAccess);
+ pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap);
+ attribs->colormap = pCmapPriv->cmap;
}
if (*mask & CWCursor)
- *mask &= ~CWCursor; /* Handled by the cursor code */
+ *mask &= ~CWCursor; /* Handled by the cursor code */
}
/** Change the window attributes of \a pWindow. */
-Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask)
+Bool
+dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- Bool ret = TRUE;
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- XSetWindowAttributes attribs;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ Bool ret = TRUE;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ XSetWindowAttributes attribs;
DMX_UNWRAP(ChangeWindowAttributes, dmxScreen, pScreen);
#if 0
if (pScreen->ChangeWindowAttributes)
- ret = pScreen->ChangeWindowAttributes(pWindow, mask);
+ ret = pScreen->ChangeWindowAttributes(pWindow, mask);
#endif
/* Change window attribs on back-end server */
@@ -578,13 +594,13 @@ Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask)
pWinPriv->attribMask |= mask;
if (mask && pWinPriv->window) {
- XChangeWindowAttributes(dmxScreen->beDisplay, pWinPriv->window,
- mask, &attribs);
- dmxSync(dmxScreen, False);
+ XChangeWindowAttributes(dmxScreen->beDisplay, pWinPriv->window,
+ mask, &attribs);
+ dmxSync(dmxScreen, False);
}
DMX_WRAP(ChangeWindowAttributes, dmxChangeWindowAttributes, dmxScreen,
- pScreen);
+ pScreen);
return ret;
}
@@ -592,17 +608,18 @@ Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask)
/** Realize \a pWindow on the back-end server. If the lazy window
* creation optimization is enabled, the window is only realized when
* it at least partially overlaps the screen. */
-Bool dmxRealizeWindow(WindowPtr pWindow)
+Bool
+dmxRealizeWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- Bool ret = TRUE;
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ Bool ret = TRUE;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
DMX_UNWRAP(RealizeWindow, dmxScreen, pScreen);
#if 0
if (pScreen->RealizeWindow)
- ret = pScreen->RealizeWindow(pWindow);
+ ret = pScreen->RealizeWindow(pWindow);
#endif
/* Determine if the window is completely off the visible portion of
@@ -612,13 +629,13 @@ Bool dmxRealizeWindow(WindowPtr pWindow)
/* If the window hasn't been created and it's not offscreen, then
create it */
if (!pWinPriv->window && !pWinPriv->offscreen) {
- dmxCreateAndRealizeWindow(pWindow, FALSE);
+ dmxCreateAndRealizeWindow(pWindow, FALSE);
}
if (pWinPriv->window) {
- /* Realize window on back-end server */
- XMapWindow(dmxScreen->beDisplay, pWinPriv->window);
- dmxSync(dmxScreen, False);
+ /* Realize window on back-end server */
+ XMapWindow(dmxScreen->beDisplay, pWinPriv->window);
+ dmxSync(dmxScreen, False);
}
/* Let the other functions know that the window is now mapped */
@@ -631,23 +648,24 @@ Bool dmxRealizeWindow(WindowPtr pWindow)
}
/** Unrealize \a pWindow on the back-end server. */
-Bool dmxUnrealizeWindow(WindowPtr pWindow)
+Bool
+dmxUnrealizeWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- Bool ret = TRUE;
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ Bool ret = TRUE;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
DMX_UNWRAP(UnrealizeWindow, dmxScreen, pScreen);
#if 0
if (pScreen->UnrealizeWindow)
- ret = pScreen->UnrealizeWindow(pWindow);
+ ret = pScreen->UnrealizeWindow(pWindow);
#endif
if (pWinPriv->window) {
- /* Unrealize window on back-end server */
- XUnmapWindow(dmxScreen->beDisplay, pWinPriv->window);
- dmxSync(dmxScreen, False);
+ /* Unrealize window on back-end server */
+ XUnmapWindow(dmxScreen->beDisplay, pWinPriv->window);
+ dmxSync(dmxScreen, False);
}
/* When unrealized (i.e., unmapped), the window is always considered
@@ -657,7 +675,7 @@ Bool dmxUnrealizeWindow(WindowPtr pWindow)
#ifdef GLXEXT
if (pWinPriv->swapGroup && pWinPriv->windowUnmapped)
- pWinPriv->windowUnmapped(pWindow);
+ pWinPriv->windowUnmapped(pWindow);
#endif
DMX_WRAP(UnrealizeWindow, dmxUnrealizeWindow, dmxScreen, pScreen);
@@ -666,118 +684,122 @@ Bool dmxUnrealizeWindow(WindowPtr pWindow)
return ret;
}
-static void dmxDoRestackWindow(WindowPtr pWindow)
+static void
+dmxDoRestackWindow(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- WindowPtr pNextSib = pWindow->nextSib;
- unsigned int m;
- XWindowChanges c;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ WindowPtr pNextSib = pWindow->nextSib;
+ unsigned int m;
+ XWindowChanges c;
if (pNextSib == NullWindow) {
- /* Window is at the bottom of the stack */
- m = CWStackMode;
- c.sibling = (Window)0;
- c.stack_mode = Below;
- XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
- } else {
- /* Window is not at the bottom of the stack */
- dmxWinPrivPtr pNextSibPriv = DMX_GET_WINDOW_PRIV(pNextSib);
-
- /* Handle case where siblings have not yet been created due to
+ /* Window is at the bottom of the stack */
+ m = CWStackMode;
+ c.sibling = (Window) 0;
+ c.stack_mode = Below;
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ }
+ else {
+ /* Window is not at the bottom of the stack */
+ dmxWinPrivPtr pNextSibPriv = DMX_GET_WINDOW_PRIV(pNextSib);
+
+ /* Handle case where siblings have not yet been created due to
lazy window creation optimization by first finding the next
sibling in the sibling list that has been created (if any)
and then putting the current window just above that sibling,
and if no next siblings have been created yet, then put it at
the bottom of the stack (since it might have a previous
sibling that should be above it). */
- while (!pNextSibPriv->window) {
- pNextSib = pNextSib->nextSib;
- if (pNextSib == NullWindow) {
- /* Window is at the bottom of the stack */
- m = CWStackMode;
- c.sibling = (Window)0;
- c.stack_mode = Below;
- XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
- return;
- }
- pNextSibPriv = DMX_GET_WINDOW_PRIV(pNextSib);
- }
-
- m = CWStackMode | CWSibling;
- c.sibling = pNextSibPriv->window;
- c.stack_mode = Above;
- XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ while (!pNextSibPriv->window) {
+ pNextSib = pNextSib->nextSib;
+ if (pNextSib == NullWindow) {
+ /* Window is at the bottom of the stack */
+ m = CWStackMode;
+ c.sibling = (Window) 0;
+ c.stack_mode = Below;
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ return;
+ }
+ pNextSibPriv = DMX_GET_WINDOW_PRIV(pNextSib);
+ }
+
+ m = CWStackMode | CWSibling;
+ c.sibling = pNextSibPriv->window;
+ c.stack_mode = Above;
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
}
}
/** Handle window restacking. The actual restacking occurs in
* #dmxDoRestackWindow(). */
-void dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib)
+void
+dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
DMX_UNWRAP(RestackWindow, dmxScreen, pScreen);
#if 0
if (pScreen->RestackWindow)
- pScreen->RestackWindow(pWindow, pOldNextSib);
+ pScreen->RestackWindow(pWindow, pOldNextSib);
#endif
if (pOldNextSib != pWindow->nextSib) {
- /* Track restacking for lazy window creation optimization */
- pWinPriv->restacked = TRUE;
-
- /* Restack window on back-end server */
- if (pWinPriv->window) {
- dmxDoRestackWindow(pWindow);
- dmxSync(dmxScreen, False);
- }
+ /* Track restacking for lazy window creation optimization */
+ pWinPriv->restacked = TRUE;
+
+ /* Restack window on back-end server */
+ if (pWinPriv->window) {
+ dmxDoRestackWindow(pWindow);
+ dmxSync(dmxScreen, False);
+ }
}
DMX_WRAP(RestackWindow, dmxRestackWindow, dmxScreen, pScreen);
dmxUpdateWindowInfo(DMX_UPDATE_RESTACK, pWindow);
}
-static Bool dmxWindowExposurePredicate(Display *dpy, XEvent *ev, XPointer ptr)
+static Bool
+dmxWindowExposurePredicate(Display * dpy, XEvent * ev, XPointer ptr)
{
- return (ev->type == Expose && ev->xexpose.window == *(Window *)ptr);
+ return (ev->type == Expose && ev->xexpose.window == *(Window *) ptr);
}
/** Handle exposures on \a pWindow. Since window exposures are handled
* in DMX, the events that are generated by the back-end server are
* redundant, so we eat them here. */
-void dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn,
- RegionPtr other_exposed)
+void
+dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn, RegionPtr other_exposed)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- XEvent ev;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ XEvent ev;
DMX_UNWRAP(WindowExposures, dmxScreen, pScreen);
dmxSync(dmxScreen, False);
if (pWinPriv->window) {
- while (XCheckIfEvent(dmxScreen->beDisplay, &ev,
- dmxWindowExposurePredicate,
- (XPointer)&pWinPriv->window)) {
- /* Handle expose events -- this should not be necessary
- since the base window in which the root window was
- created is guaranteed to be on top (override_redirect),
- so we should just swallow these events. If for some
- reason the window is not on top, then we'd need to
- collect these events and send them to the client later
- (e.g., during the block handler as Xnest does). */
- }
+ while (XCheckIfEvent(dmxScreen->beDisplay, &ev,
+ dmxWindowExposurePredicate,
+ (XPointer) & pWinPriv->window)) {
+ /* Handle expose events -- this should not be necessary
+ since the base window in which the root window was
+ created is guaranteed to be on top (override_redirect),
+ so we should just swallow these events. If for some
+ reason the window is not on top, then we'd need to
+ collect these events and send them to the client later
+ (e.g., during the block handler as Xnest does). */
+ }
}
#if 1
if (pScreen->WindowExposures)
- pScreen->WindowExposures(pWindow, prgn, other_exposed);
+ pScreen->WindowExposures(pWindow, prgn, other_exposed);
#endif
DMX_WRAP(WindowExposures, dmxWindowExposures, dmxScreen, pScreen);
}
@@ -785,18 +807,19 @@ void dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn,
/** Move \a pWindow on the back-end server. Determine whether or not it
* is on or offscreen, and realize it if it is newly on screen and the
* lazy window creation optimization is enabled. */
-void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+void
+dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- unsigned int m;
- XWindowChanges c;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ unsigned int m;
+ XWindowChanges c;
DMX_UNWRAP(CopyWindow, dmxScreen, pScreen);
#if 0
if (pScreen->CopyWindow)
- pScreen->CopyWindow(pWindow, ptOldOrg, prgnSrc);
+ pScreen->CopyWindow(pWindow, ptOldOrg, prgnSrc);
#endif
/* Determine if the window is completely off the visible portion of
@@ -806,17 +829,18 @@ void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
/* If the window is now on-screen and it is mapped and it has not
been created yet, create it and map it */
if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) {
- dmxCreateAndRealizeWindow(pWindow, TRUE);
- } else if (pWinPriv->window) {
- /* Move window on back-end server */
- m = CWX | CWY | CWWidth | CWHeight;
- c.x = pWindow->origin.x - wBorderWidth(pWindow);
- c.y = pWindow->origin.y - wBorderWidth(pWindow);
- c.width = pWindow->drawable.width;
- c.height = pWindow->drawable.height;
-
- XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
- dmxSync(dmxScreen, False);
+ dmxCreateAndRealizeWindow(pWindow, TRUE);
+ }
+ else if (pWinPriv->window) {
+ /* Move window on back-end server */
+ m = CWX | CWY | CWWidth | CWHeight;
+ c.x = pWindow->origin.x - wBorderWidth(pWindow);
+ c.y = pWindow->origin.y - wBorderWidth(pWindow);
+ c.width = pWindow->drawable.width;
+ c.height = pWindow->drawable.height;
+
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ dmxSync(dmxScreen, False);
}
DMX_WRAP(CopyWindow, dmxCopyWindow, dmxScreen, pScreen);
@@ -826,23 +850,24 @@ void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
/** Resize \a pWindow on the back-end server. Determine whether or not
* it is on or offscreen, and realize it if it is newly on screen and
* the lazy window creation optimization is enabled. */
-void dmxResizeWindow(WindowPtr pWindow, int x, int y,
- unsigned int w, unsigned int h, WindowPtr pSib)
+void
+dmxResizeWindow(WindowPtr pWindow, int x, int y,
+ unsigned int w, unsigned int h, WindowPtr pSib)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- dmxWinPrivPtr pSibPriv;
- unsigned int m;
- XWindowChanges c;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ dmxWinPrivPtr pSibPriv;
+ unsigned int m;
+ XWindowChanges c;
if (pSib)
- pSibPriv = DMX_GET_WINDOW_PRIV(pSib);
+ pSibPriv = DMX_GET_WINDOW_PRIV(pSib);
DMX_UNWRAP(ResizeWindow, dmxScreen, pScreen);
#if 1
if (pScreen->ResizeWindow)
- pScreen->ResizeWindow(pWindow, x, y, w, h, pSib);
+ pScreen->ResizeWindow(pWindow, x, y, w, h, pSib);
#endif
/* Determine if the window is completely off the visible portion of
@@ -852,17 +877,18 @@ void dmxResizeWindow(WindowPtr pWindow, int x, int y,
/* If the window is now on-screen and it is mapped and it has not
been created yet, create it and map it */
if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) {
- dmxCreateAndRealizeWindow(pWindow, TRUE);
- } else if (pWinPriv->window) {
- /* Handle resizing on back-end server */
- m = CWX | CWY | CWWidth | CWHeight;
- c.x = pWindow->origin.x - wBorderWidth(pWindow);
- c.y = pWindow->origin.y - wBorderWidth(pWindow);
- c.width = pWindow->drawable.width;
- c.height = pWindow->drawable.height;
-
- XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
- dmxSync(dmxScreen, False);
+ dmxCreateAndRealizeWindow(pWindow, TRUE);
+ }
+ else if (pWinPriv->window) {
+ /* Handle resizing on back-end server */
+ m = CWX | CWY | CWWidth | CWHeight;
+ c.x = pWindow->origin.x - wBorderWidth(pWindow);
+ c.y = pWindow->origin.y - wBorderWidth(pWindow);
+ c.width = pWindow->drawable.width;
+ c.height = pWindow->drawable.height;
+
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ dmxSync(dmxScreen, False);
}
DMX_WRAP(ResizeWindow, dmxResizeWindow, dmxScreen, pScreen);
@@ -870,30 +896,31 @@ void dmxResizeWindow(WindowPtr pWindow, int x, int y,
}
/** Reparent \a pWindow on the back-end server. */
-void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent)
+void
+dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- dmxWinPrivPtr pParentPriv = DMX_GET_WINDOW_PRIV(pWindow->parent);
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ dmxWinPrivPtr pParentPriv = DMX_GET_WINDOW_PRIV(pWindow->parent);
DMX_UNWRAP(ReparentWindow, dmxScreen, pScreen);
#if 0
if (pScreen->ReparentWindow)
- pScreen->ReparentWindow(pWindow, pPriorParent);
+ pScreen->ReparentWindow(pWindow, pPriorParent);
#endif
if (pWinPriv->window) {
- if (!pParentPriv->window) {
- dmxCreateAndRealizeWindow(pWindow->parent, FALSE);
- }
-
- /* Handle reparenting on back-end server */
- XReparentWindow(dmxScreen->beDisplay, pWinPriv->window,
- pParentPriv->window,
- pWindow->origin.x - wBorderWidth(pWindow),
- pWindow->origin.x - wBorderWidth(pWindow));
- dmxSync(dmxScreen, False);
+ if (!pParentPriv->window) {
+ dmxCreateAndRealizeWindow(pWindow->parent, FALSE);
+ }
+
+ /* Handle reparenting on back-end server */
+ XReparentWindow(dmxScreen->beDisplay, pWinPriv->window,
+ pParentPriv->window,
+ pWindow->origin.x - wBorderWidth(pWindow),
+ pWindow->origin.x - wBorderWidth(pWindow));
+ dmxSync(dmxScreen, False);
}
DMX_WRAP(ReparentWindow, dmxReparentWindow, dmxScreen, pScreen);
@@ -901,116 +928,120 @@ void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent)
}
/** Change border width for \a pWindow to \a width pixels. */
-void dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width)
+void
+dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- unsigned int m;
- XWindowChanges c;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ unsigned int m;
+ XWindowChanges c;
DMX_UNWRAP(ChangeBorderWidth, dmxScreen, pScreen);
#if 1
if (pScreen->ChangeBorderWidth)
- pScreen->ChangeBorderWidth(pWindow, width);
+ pScreen->ChangeBorderWidth(pWindow, width);
#endif
/* NOTE: Do we need to check for on/off screen here? */
if (pWinPriv->window) {
- /* Handle border width change on back-end server */
- m = CWBorderWidth;
- c.border_width = width;
+ /* Handle border width change on back-end server */
+ m = CWBorderWidth;
+ c.border_width = width;
- XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
- dmxSync(dmxScreen, False);
+ XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c);
+ dmxSync(dmxScreen, False);
}
DMX_WRAP(ChangeBorderWidth, dmxChangeBorderWidth, dmxScreen, pScreen);
}
-static void dmxDoSetShape(WindowPtr pWindow)
+static void
+dmxDoSetShape(WindowPtr pWindow)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
- int nBox;
- BoxPtr pBox;
- int nRect;
- XRectangle *pRect;
- XRectangle *pRectFirst;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ int nBox;
+ BoxPtr pBox;
+ int nRect;
+ XRectangle *pRect;
+ XRectangle *pRectFirst;
/* First, set the bounding shape */
if (wBoundingShape(pWindow)) {
- pBox = RegionRects(wBoundingShape(pWindow));
- nRect = nBox = RegionNumRects(wBoundingShape(pWindow));
- pRectFirst = pRect = malloc(nRect * sizeof(*pRect));
- while (nBox--) {
- pRect->x = pBox->x1;
- pRect->y = pBox->y1;
- pRect->width = pBox->x2 - pBox->x1;
- pRect->height = pBox->y2 - pBox->y1;
- pBox++;
- pRect++;
- }
- XShapeCombineRectangles(dmxScreen->beDisplay, pWinPriv->window,
- ShapeBounding, 0, 0,
- pRectFirst, nRect,
- ShapeSet, YXBanded);
- free(pRectFirst);
- } else {
- XShapeCombineMask(dmxScreen->beDisplay, pWinPriv->window,
- ShapeBounding, 0, 0, None, ShapeSet);
+ pBox = RegionRects(wBoundingShape(pWindow));
+ nRect = nBox = RegionNumRects(wBoundingShape(pWindow));
+ pRectFirst = pRect = malloc(nRect * sizeof(*pRect));
+ while (nBox--) {
+ pRect->x = pBox->x1;
+ pRect->y = pBox->y1;
+ pRect->width = pBox->x2 - pBox->x1;
+ pRect->height = pBox->y2 - pBox->y1;
+ pBox++;
+ pRect++;
+ }
+ XShapeCombineRectangles(dmxScreen->beDisplay, pWinPriv->window,
+ ShapeBounding, 0, 0,
+ pRectFirst, nRect, ShapeSet, YXBanded);
+ free(pRectFirst);
+ }
+ else {
+ XShapeCombineMask(dmxScreen->beDisplay, pWinPriv->window,
+ ShapeBounding, 0, 0, None, ShapeSet);
}
/* Next, set the clip shape */
if (wClipShape(pWindow)) {
- pBox = RegionRects(wClipShape(pWindow));
- nRect = nBox = RegionNumRects(wClipShape(pWindow));
- pRectFirst = pRect = malloc(nRect * sizeof(*pRect));
- while (nBox--) {
- pRect->x = pBox->x1;
- pRect->y = pBox->y1;
- pRect->width = pBox->x2 - pBox->x1;
- pRect->height = pBox->y2 - pBox->y1;
- pBox++;
- pRect++;
- }
- XShapeCombineRectangles(dmxScreen->beDisplay, pWinPriv->window,
- ShapeClip, 0, 0,
- pRectFirst, nRect,
- ShapeSet, YXBanded);
- free(pRectFirst);
- } else {
- XShapeCombineMask(dmxScreen->beDisplay, pWinPriv->window,
- ShapeClip, 0, 0, None, ShapeSet);
+ pBox = RegionRects(wClipShape(pWindow));
+ nRect = nBox = RegionNumRects(wClipShape(pWindow));
+ pRectFirst = pRect = malloc(nRect * sizeof(*pRect));
+ while (nBox--) {
+ pRect->x = pBox->x1;
+ pRect->y = pBox->y1;
+ pRect->width = pBox->x2 - pBox->x1;
+ pRect->height = pBox->y2 - pBox->y1;
+ pBox++;
+ pRect++;
+ }
+ XShapeCombineRectangles(dmxScreen->beDisplay, pWinPriv->window,
+ ShapeClip, 0, 0,
+ pRectFirst, nRect, ShapeSet, YXBanded);
+ free(pRectFirst);
+ }
+ else {
+ XShapeCombineMask(dmxScreen->beDisplay, pWinPriv->window,
+ ShapeClip, 0, 0, None, ShapeSet);
}
if (XShapeInputSelected(dmxScreen->beDisplay, pWinPriv->window)) {
- ErrorF("Input selected for window %x on Screen %d\n",
- (unsigned int)pWinPriv->window, pScreen->myNum);
+ ErrorF("Input selected for window %x on Screen %d\n",
+ (unsigned int) pWinPriv->window, pScreen->myNum);
}
}
/** Set shape of \a pWindow on the back-end server. */
-void dmxSetShape(WindowPtr pWindow, int kind)
+void
+dmxSetShape(WindowPtr pWindow, int kind)
{
- ScreenPtr pScreen = pWindow->drawable.pScreen;
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
DMX_UNWRAP(SetShape, dmxScreen, pScreen);
#if 1
if (pScreen->SetShape)
- pScreen->SetShape(pWindow, kind);
+ pScreen->SetShape(pWindow, kind);
#endif
if (pWinPriv->window) {
- /* Handle setting the current shape on the back-end server */
- dmxDoSetShape(pWindow);
- dmxSync(dmxScreen, False);
- } else {
- pWinPriv->isShaped = TRUE;
+ /* Handle setting the current shape on the back-end server */
+ dmxDoSetShape(pWindow);
+ dmxSync(dmxScreen, False);
+ }
+ else {
+ pWinPriv->isShaped = TRUE;
}
DMX_WRAP(SetShape, dmxSetShape, dmxScreen, pScreen);
diff --git a/xorg-server/hw/dmx/dmxwindow.h b/xorg-server/hw/dmx/dmxwindow.h
index 43316d35b..c6b2efee6 100644
--- a/xorg-server/hw/dmx/dmxwindow.h
+++ b/xorg-server/hw/dmx/dmxwindow.h
@@ -1,135 +1,132 @@
-/*
- * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <kem@redhat.com>
- *
- */
-
-/** \file
- * Interface for window support. \see dmxwindow.c */
-
-#ifndef DMXWINDOW_H
-#define DMXWINDOW_H
-
-#include "windowstr.h"
-
-/** Window private area. */
-typedef struct _dmxWinPriv {
- Window window;
- Bool offscreen;
- Bool mapped;
- Bool restacked;
- unsigned long attribMask;
- Colormap cmap;
- Visual *visual;
- Bool isShaped;
- Bool hasPict;
-#ifdef GLXEXT
- void *swapGroup;
- int barrier;
- void (*windowDestroyed)(WindowPtr);
- void (*windowUnmapped)(WindowPtr);
-#endif
-} dmxWinPrivRec, *dmxWinPrivPtr;
-
-
-extern Bool dmxInitWindow(ScreenPtr pScreen);
-
-extern Window dmxCreateRootWindow(WindowPtr pWindow);
-
-extern void dmxGetDefaultWindowAttributes(WindowPtr pWindow,
- Colormap *cmap,
- Visual **visual);
-extern void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync);
-
-extern Bool dmxCreateWindow(WindowPtr pWindow);
-extern Bool dmxDestroyWindow(WindowPtr pWindow);
-extern Bool dmxPositionWindow(WindowPtr pWindow, int x, int y);
-extern Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask);
-extern Bool dmxRealizeWindow(WindowPtr pWindow);
-extern Bool dmxUnrealizeWindow(WindowPtr pWindow);
-extern void dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib);
-extern void dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn,
- RegionPtr other_exposed);
-extern void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
- RegionPtr prgnSrc);
-
-extern void dmxResizeWindow(WindowPtr pWindow, int x, int y,
- unsigned int w, unsigned int h, WindowPtr pSib);
-extern void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent);
-
-extern void dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width);
-
-extern void dmxResizeScreenWindow(ScreenPtr pScreen,
- int x, int y, int w, int h);
-extern void dmxResizeRootWindow(WindowPtr pRoot,
- int x, int y, int w, int h);
-
-extern Bool dmxBEDestroyWindow(WindowPtr pWindow);
-
-/* Support for shape extension */
-extern void dmxSetShape(WindowPtr pWindow, int kind);
-
-/** Get window private pointer. */
-#define DMX_GET_WINDOW_PRIV(_pWin) ((dmxWinPrivPtr) \
- dixLookupPrivate(&(_pWin)->devPrivates, dmxWinPrivateKey))
-
-/* All of these macros are only used in dmxwindow.c */
-#define DMX_WINDOW_FUNC_PROLOGUE(_pGC) \
-do { \
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \
- DMX_UNWRAP(funcs, pGCPriv, (_pGC)); \
- if (pGCPriv->ops) \
- DMX_UNWRAP(ops, pGCPriv, (_pGC)); \
-} while (0)
-
-#define DMX_WINDOW_FUNC_EPILOGUE(_pGC) \
-do { \
- dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \
- DMX_WRAP(funcs, &dmxGCFuncs, pGCPriv, (_pGC)); \
- if (pGCPriv->ops) \
- DMX_WRAP(ops, &dmxGCOps, pGCPriv, (_pGC)); \
-} while (0)
-
-#define DMX_WINDOW_X1(_pWin) \
- ((_pWin)->drawable.x - wBorderWidth(_pWin))
-#define DMX_WINDOW_Y1(_pWin) \
- ((_pWin)->drawable.y - wBorderWidth(_pWin))
-#define DMX_WINDOW_X2(_pWin) \
- ((_pWin)->drawable.x + wBorderWidth(_pWin) + (_pWin)->drawable.width)
-#define DMX_WINDOW_Y2(_pWin) \
- ((_pWin)->drawable.y + wBorderWidth(_pWin) + (_pWin)->drawable.height)
-
-#define DMX_WINDOW_OFFSCREEN(_pWin) \
- (DMX_WINDOW_X1(_pWin) >= (_pWin)->drawable.pScreen->width || \
- DMX_WINDOW_Y1(_pWin) >= (_pWin)->drawable.pScreen->height || \
- DMX_WINDOW_X2(_pWin) <= 0 || \
- DMX_WINDOW_Y2(_pWin) <= 0)
-
-#endif /* DMXWINDOW_H */
+/*
+ * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for window support. \see dmxwindow.c */
+
+#ifndef DMXWINDOW_H
+#define DMXWINDOW_H
+
+#include "windowstr.h"
+
+/** Window private area. */
+typedef struct _dmxWinPriv {
+ Window window;
+ Bool offscreen;
+ Bool mapped;
+ Bool restacked;
+ unsigned long attribMask;
+ Colormap cmap;
+ Visual *visual;
+ Bool isShaped;
+ Bool hasPict;
+#ifdef GLXEXT
+ void *swapGroup;
+ int barrier;
+ void (*windowDestroyed) (WindowPtr);
+ void (*windowUnmapped) (WindowPtr);
+#endif
+} dmxWinPrivRec, *dmxWinPrivPtr;
+
+extern Bool dmxInitWindow(ScreenPtr pScreen);
+
+extern Window dmxCreateRootWindow(WindowPtr pWindow);
+
+extern void dmxGetDefaultWindowAttributes(WindowPtr pWindow,
+ Colormap * cmap, Visual ** visual);
+extern void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync);
+
+extern Bool dmxCreateWindow(WindowPtr pWindow);
+extern Bool dmxDestroyWindow(WindowPtr pWindow);
+extern Bool dmxPositionWindow(WindowPtr pWindow, int x, int y);
+extern Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask);
+extern Bool dmxRealizeWindow(WindowPtr pWindow);
+extern Bool dmxUnrealizeWindow(WindowPtr pWindow);
+extern void dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib);
+extern void dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn,
+ RegionPtr other_exposed);
+extern void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+
+extern void dmxResizeWindow(WindowPtr pWindow, int x, int y,
+ unsigned int w, unsigned int h, WindowPtr pSib);
+extern void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent);
+
+extern void dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width);
+
+extern void dmxResizeScreenWindow(ScreenPtr pScreen,
+ int x, int y, int w, int h);
+extern void dmxResizeRootWindow(WindowPtr pRoot, int x, int y, int w, int h);
+
+extern Bool dmxBEDestroyWindow(WindowPtr pWindow);
+
+/* Support for shape extension */
+extern void dmxSetShape(WindowPtr pWindow, int kind);
+
+/** Get window private pointer. */
+#define DMX_GET_WINDOW_PRIV(_pWin) ((dmxWinPrivPtr) \
+ dixLookupPrivate(&(_pWin)->devPrivates, dmxWinPrivateKey))
+
+/* All of these macros are only used in dmxwindow.c */
+#define DMX_WINDOW_FUNC_PROLOGUE(_pGC) \
+do { \
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \
+ DMX_UNWRAP(funcs, pGCPriv, (_pGC)); \
+ if (pGCPriv->ops) \
+ DMX_UNWRAP(ops, pGCPriv, (_pGC)); \
+} while (0)
+
+#define DMX_WINDOW_FUNC_EPILOGUE(_pGC) \
+do { \
+ dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \
+ DMX_WRAP(funcs, &dmxGCFuncs, pGCPriv, (_pGC)); \
+ if (pGCPriv->ops) \
+ DMX_WRAP(ops, &dmxGCOps, pGCPriv, (_pGC)); \
+} while (0)
+
+#define DMX_WINDOW_X1(_pWin) \
+ ((_pWin)->drawable.x - wBorderWidth(_pWin))
+#define DMX_WINDOW_Y1(_pWin) \
+ ((_pWin)->drawable.y - wBorderWidth(_pWin))
+#define DMX_WINDOW_X2(_pWin) \
+ ((_pWin)->drawable.x + wBorderWidth(_pWin) + (_pWin)->drawable.width)
+#define DMX_WINDOW_Y2(_pWin) \
+ ((_pWin)->drawable.y + wBorderWidth(_pWin) + (_pWin)->drawable.height)
+
+#define DMX_WINDOW_OFFSCREEN(_pWin) \
+ (DMX_WINDOW_X1(_pWin) >= (_pWin)->drawable.pScreen->width || \
+ DMX_WINDOW_Y1(_pWin) >= (_pWin)->drawable.pScreen->height || \
+ DMX_WINDOW_X2(_pWin) <= 0 || \
+ DMX_WINDOW_Y2(_pWin) <= 0)
+
+#endif /* DMXWINDOW_H */
diff --git a/xorg-server/hw/dmx/examples/dmxaddinput.c b/xorg-server/hw/dmx/examples/dmxaddinput.c
index dcfd4f5cc..fdd09b99b 100644
--- a/xorg-server/hw/dmx/examples/dmxaddinput.c
+++ b/xorg-server/hw/dmx/examples/dmxaddinput.c
@@ -36,14 +36,15 @@
#include <X11/Xlib.h>
#include <X11/extensions/dmxext.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int event_base;
- int error_base;
- int major_version, minor_version, patch_version;
- int id = -1;
- int status;
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ int id = -1;
+ int status;
if (argc != 5) {
printf("Usage: %s display c|b name|screen isCore\n", argv[0]);
@@ -72,8 +73,9 @@ int main(int argc, char **argv)
if (argv[2][0] == 'c') {
status = DMXAddConsoleInput(display, argv[3], atoi(argv[4]), &id);
- } else {
- status = DMXAddBackendInput(display, atoi(argv[3]), atoi(argv[4]),&id);
+ }
+ else {
+ status = DMXAddBackendInput(display, atoi(argv[3]), atoi(argv[4]), &id);
}
printf("status = %d, id = %d\n", status, id);
diff --git a/xorg-server/hw/dmx/examples/dmxaddscreen.c b/xorg-server/hw/dmx/examples/dmxaddscreen.c
index 8e60872df..58129faa5 100644
--- a/xorg-server/hw/dmx/examples/dmxaddscreen.c
+++ b/xorg-server/hw/dmx/examples/dmxaddscreen.c
@@ -37,18 +37,21 @@
#include <X11/Xlib.h>
#include <X11/extensions/dmxext.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int event_base;
- int error_base;
- int major_version, minor_version, patch_version;
- int screenNum;
- DMXScreenAttributes attr;
- unsigned int mask = 0;
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ int screenNum;
+ DMXScreenAttributes attr;
+ unsigned int mask = 0;
if (argc != 4 && argc != 14) {
- printf("Usage: %s display screenNum displayName [scrnx scrny scrnw scrnh rootx rooty rootw rooth originx originy]\n", argv[0]);
+ printf
+ ("Usage: %s display screenNum displayName [scrnx scrny scrnw scrnh rootx rooty rootw rooth originx originy]\n",
+ argv[0]);
return -1;
}
@@ -59,27 +62,25 @@ int main(int argc, char **argv)
screenNum = strtol(argv[2], NULL, 0);
if (argc == 14) {
- mask |= (DMXScreenWindowXoffset |
- DMXScreenWindowYoffset |
- DMXScreenWindowWidth |
- DMXScreenWindowHeight);
- attr.screenWindowXoffset = strtol(argv[4], NULL, 0);
- attr.screenWindowYoffset = strtol(argv[5], NULL, 0);
- attr.screenWindowWidth = strtol(argv[6], NULL, 0);
- attr.screenWindowHeight = strtol(argv[7], NULL, 0);
+ mask |= (DMXScreenWindowXoffset |
+ DMXScreenWindowYoffset |
+ DMXScreenWindowWidth | DMXScreenWindowHeight);
+ attr.screenWindowXoffset = strtol(argv[4], NULL, 0);
+ attr.screenWindowYoffset = strtol(argv[5], NULL, 0);
+ attr.screenWindowWidth = strtol(argv[6], NULL, 0);
+ attr.screenWindowHeight = strtol(argv[7], NULL, 0);
- mask |= (DMXRootWindowXoffset |
- DMXRootWindowYoffset |
- DMXRootWindowWidth |
- DMXRootWindowHeight);
- attr.rootWindowXoffset = strtol(argv[8], NULL, 0);
- attr.rootWindowYoffset = strtol(argv[9], NULL, 0);
- attr.rootWindowWidth = strtol(argv[10], NULL, 0);
- attr.rootWindowHeight = strtol(argv[11], NULL, 0);
+ mask |= (DMXRootWindowXoffset |
+ DMXRootWindowYoffset |
+ DMXRootWindowWidth | DMXRootWindowHeight);
+ attr.rootWindowXoffset = strtol(argv[8], NULL, 0);
+ attr.rootWindowYoffset = strtol(argv[9], NULL, 0);
+ attr.rootWindowWidth = strtol(argv[10], NULL, 0);
+ attr.rootWindowHeight = strtol(argv[11], NULL, 0);
- mask |= DMXRootWindowXorigin | DMXRootWindowYorigin;
- attr.rootWindowXorigin = strtol(argv[12], NULL, 0);
- attr.rootWindowYorigin = strtol(argv[13], NULL, 0);
+ mask |= DMXRootWindowXorigin | DMXRootWindowYorigin;
+ attr.rootWindowXorigin = strtol(argv[12], NULL, 0);
+ attr.rootWindowYorigin = strtol(argv[13], NULL, 0);
}
if (!DMXQueryExtension(display, &event_base, &error_base)) {
@@ -98,8 +99,8 @@ int main(int argc, char **argv)
major_version, minor_version, patch_version);
if (!DMXAddScreen(display, argv[3], mask, &attr, &screenNum))
- printf("Failed to add %s as screen #%d\n", argv[2], screenNum);
-
+ printf("Failed to add %s as screen #%d\n", argv[2], screenNum);
+
XCloseDisplay(display);
return 0;
}
diff --git a/xorg-server/hw/dmx/examples/dmxinfo.c b/xorg-server/hw/dmx/examples/dmxinfo.c
index dedce6e8d..fea94e203 100644
--- a/xorg-server/hw/dmx/examples/dmxinfo.c
+++ b/xorg-server/hw/dmx/examples/dmxinfo.c
@@ -36,45 +36,52 @@
#include <X11/Xlib.h>
#include <X11/extensions/dmxext.h>
-static void indent(int level)
+static void
+indent(int level)
{
int i;
- for (i = 0; i < level; i++) printf(" ");
+
+ for (i = 0; i < level; i++)
+ printf(" ");
}
-static void print_window_id(const char *displayName, Display *display,
- Window window, int level, int child)
+static void
+print_window_id(const char *displayName, Display * display,
+ Window window, int level, int child)
{
- char *name;
-
- if (!XFetchName(display, window, &name)) name = NULL;
+ char *name;
+
+ if (!XFetchName(display, window, &name))
+ name = NULL;
indent(level);
- if (child) printf("(%d) ", child);
+ if (child)
+ printf("(%d) ", child);
printf("%s window 0x%08lx: %s%s\n",
displayName,
- (long unsigned)window,
- name ? name : "",
- (window == DefaultRootWindow(display))
+ (long unsigned) window,
+ name ? name : "", (window == DefaultRootWindow(display))
? " (DMX root window)" : "");
- if (name) XFree(name);
+ if (name)
+ XFree(name);
}
-static void print_info(Display *display, Window window, int level, int child)
+static void
+print_info(Display * display, Window window, int level, int child)
{
DMXWindowAttributes winfo[128];
- int count;
- int i;
-
+ int count;
+ int i;
+
if (!DMXGetWindowAttributes(display, window, &count, 128, winfo)) {
printf("Could not get window information for 0x%08lx\n",
- (long unsigned)window);
+ (long unsigned) window);
exit(-2);
}
printf("\n");
print_window_id("DMX", display, window, level, child);
for (i = 0; i < count; i++) {
- DMXScreenAttributes sinfo;
- Display *backend;
+ DMXScreenAttributes sinfo;
+ Display *backend;
/* This could also be cached -- the information doesn't change. */
if (!DMXGetScreenAttributes(display, winfo[i].screen, &sinfo)) {
@@ -86,78 +93,86 @@ static void print_info(Display *display, Window window, int level, int child)
exit(-2);
}
XCloseDisplay(backend);
-
- indent(level+1);
+
+ indent(level + 1);
printf("%s window 0x%08lx: %dx%d%+d%+d",
sinfo.displayName,
- (long unsigned)winfo[i].window,
+ (long unsigned) winfo[i].window,
winfo[i].pos.width, winfo[i].pos.height,
winfo[i].pos.x, winfo[i].pos.y);
if (!winfo[i].vis.width
- && !winfo[i].vis.height
- && !winfo[i].vis.x
- && !winfo[i].vis.y) printf(" not visible\n");
+ && !winfo[i].vis.height && !winfo[i].vis.x && !winfo[i].vis.y)
+ printf(" not visible\n");
else if (winfo[i].vis.width == winfo[i].pos.width
&& winfo[i].vis.height == winfo[i].pos.height) {
- printf( " %+d%+d\n", winfo[i].vis.x, winfo[i].vis.y);
- } else {
- printf( " %dx%d%+d%+d\n",
- winfo[i].vis.width, winfo[i].vis.height,
- winfo[i].vis.x, winfo[i].vis.y);
+ printf(" %+d%+d\n", winfo[i].vis.x, winfo[i].vis.y);
+ }
+ else {
+ printf(" %dx%d%+d%+d\n",
+ winfo[i].vis.width, winfo[i].vis.height,
+ winfo[i].vis.x, winfo[i].vis.y);
}
}
}
-static void print_tree(Display *display, Window window, int level, int child)
+static void
+print_tree(Display * display, Window window, int level, int child)
{
- Window root, parent;
- Window *list;
+ Window root, parent;
+ Window *list;
unsigned int count;
unsigned int i;
print_info(display, window, level, child);
-
+
if (!XQueryTree(display, window, &root, &parent, &list, &count)) {
printf("Cannot query window tree for 0x%08lx\n",
- (long unsigned)window);
+ (long unsigned) window);
exit(-3);
}
if (count) {
- indent(level+1);
+ indent(level + 1);
printf("%d child%s:\n", count, count > 1 ? "ren" : "");
for (i = 0; i < count; i++) {
- print_tree(display, list[i], level+1, i+1);
+ print_tree(display, list[i], level + 1, i + 1);
}
}
}
-static const char *core(DMXInputAttributes *iinfo)
+static const char *
+core(DMXInputAttributes * iinfo)
{
- if (iinfo->isCore) return "core";
- else if (iinfo->sendsCore) return "extension (sends core)";
- else return "extension";
+ if (iinfo->isCore)
+ return "core";
+ else if (iinfo->sendsCore)
+ return "extension (sends core)";
+ else
+ return "extension";
}
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- Window window = 0;
- int event_base;
- int error_base;
- int major_version, minor_version, patch_version;
- DMXScreenAttributes sinfo;
- DMXInputAttributes iinfo;
- int count;
- int i;
+ Display *display = NULL;
+ Window window = 0;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ DMXScreenAttributes sinfo;
+ DMXInputAttributes iinfo;
+ int count;
+ int i;
if (argc == 2 || argc == 3) {
if (!(display = XOpenDisplay(argv[1]))) {
printf("Cannot open display %s\n", argv[1]);
return -1;
}
- if (argc == 3) window = strtol(argv[2], NULL, 0);
- } else {
+ if (argc == 3)
+ window = strtol(argv[2], NULL, 0);
+ }
+ else {
printf("Usage: %s display [windowid]\n", argv[0]);
return -1;
}
@@ -231,9 +246,11 @@ int main(int argc, char **argv)
}
}
- if (window) print_info(display, window, 0, 0);
- else print_tree(display, DefaultRootWindow(display), 0, 0);
-
+ if (window)
+ print_info(display, window, 0, 0);
+ else
+ print_tree(display, DefaultRootWindow(display), 0, 0);
+
XCloseDisplay(display);
return 0;
}
diff --git a/xorg-server/hw/dmx/examples/dmxreconfig.c b/xorg-server/hw/dmx/examples/dmxreconfig.c
index 042f8a112..9587682db 100644
--- a/xorg-server/hw/dmx/examples/dmxreconfig.c
+++ b/xorg-server/hw/dmx/examples/dmxreconfig.c
@@ -36,47 +36,47 @@
#include <X11/Xlib.h>
#include <X11/extensions/dmxext.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int event_base;
- int error_base;
- int major_version, minor_version, patch_version;
- int screen;
- DMXScreenAttributes attr;
- unsigned int mask = 0;
- int status;
- int errorScreen;
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ int screen;
+ DMXScreenAttributes attr;
+ unsigned int mask = 0;
+ int status;
+ int errorScreen;
if (argc != 13) {
- fprintf(stderr, "Usage: %s display screen scrnx scrny scrnw scrnh rootx rooty rootw rooth originx originy\n", argv[0]);
- return -1;
+ fprintf(stderr,
+ "Usage: %s display screen scrnx scrny scrnw scrnh rootx rooty rootw rooth originx originy\n",
+ argv[0]);
+ return -1;
}
if (!(display = XOpenDisplay(argv[1]))) {
- fprintf(stderr, "Cannot open display %s\n", argv[1]);
- return -1;
+ fprintf(stderr, "Cannot open display %s\n", argv[1]);
+ return -1;
}
- screen = strtol(argv[2], NULL, 0);
+ screen = strtol(argv[2], NULL, 0);
mask |= (DMXScreenWindowXoffset |
- DMXScreenWindowYoffset |
- DMXScreenWindowWidth |
- DMXScreenWindowHeight);
- attr.screenWindowXoffset = strtol(argv[3], NULL, 0);
- attr.screenWindowYoffset = strtol(argv[4], NULL, 0);
- attr.screenWindowWidth = strtol(argv[5], NULL, 0);
- attr.screenWindowHeight = strtol(argv[6], NULL, 0);
+ DMXScreenWindowYoffset |
+ DMXScreenWindowWidth | DMXScreenWindowHeight);
+ attr.screenWindowXoffset = strtol(argv[3], NULL, 0);
+ attr.screenWindowYoffset = strtol(argv[4], NULL, 0);
+ attr.screenWindowWidth = strtol(argv[5], NULL, 0);
+ attr.screenWindowHeight = strtol(argv[6], NULL, 0);
mask |= (DMXRootWindowXoffset |
- DMXRootWindowYoffset |
- DMXRootWindowWidth |
- DMXRootWindowHeight);
- attr.rootWindowXoffset = strtol(argv[7], NULL, 0);
- attr.rootWindowYoffset = strtol(argv[8], NULL, 0);
- attr.rootWindowWidth = strtol(argv[9], NULL, 0);
- attr.rootWindowHeight = strtol(argv[10], NULL, 0);
+ DMXRootWindowYoffset | DMXRootWindowWidth | DMXRootWindowHeight);
+ attr.rootWindowXoffset = strtol(argv[7], NULL, 0);
+ attr.rootWindowYoffset = strtol(argv[8], NULL, 0);
+ attr.rootWindowWidth = strtol(argv[9], NULL, 0);
+ attr.rootWindowHeight = strtol(argv[10], NULL, 0);
mask |= DMXRootWindowXorigin | DMXRootWindowYorigin;
attr.rootWindowXorigin = strtol(argv[11], NULL, 0);
@@ -99,62 +99,61 @@ int main(int argc, char **argv)
if (major_version == 1 && minor_version < 3) {
fprintf(stderr,
- "ReconfigureScreen not supported in this extension version\n");
+ "ReconfigureScreen not supported in this extension version\n");
return -1;
}
if (major_version < 2) {
fprintf(stderr,
- "ChangeScreensAttributes not supported in this extension "
- "version\n");
+ "ChangeScreensAttributes not supported in this extension "
+ "version\n");
return -1;
}
if (!(status = DMXChangeScreensAttributes(display, 1, &screen, 1, &mask,
&attr, &errorScreen))) {
printf("Reconfigured screen #%d to "
- "%dx%d%s%d%s%d %dx%d%s%d%s%d %s%d%s%d\n",
- screen,
- attr.screenWindowWidth,
- attr.screenWindowHeight,
- (attr.screenWindowXoffset < 0 ? "" : "+"),
- attr.screenWindowXoffset,
- (attr.screenWindowYoffset < 0 ? "" : "+"),
- attr.screenWindowYoffset,
- attr.rootWindowWidth,
- attr.rootWindowHeight,
- (attr.rootWindowXoffset < 0 ? "" : "+"),
- attr.rootWindowXoffset,
- (attr.rootWindowYoffset < 0 ? "" : "+"),
- attr.rootWindowYoffset,
- (attr.rootWindowXorigin < 0 ? "" : "+"),
- attr.rootWindowXorigin,
- (attr.rootWindowYorigin < 0 ? "" : "+"),
- attr.rootWindowYorigin);
- } else {
+ "%dx%d%s%d%s%d %dx%d%s%d%s%d %s%d%s%d\n",
+ screen,
+ attr.screenWindowWidth,
+ attr.screenWindowHeight,
+ (attr.screenWindowXoffset < 0 ? "" : "+"),
+ attr.screenWindowXoffset,
+ (attr.screenWindowYoffset < 0 ? "" : "+"),
+ attr.screenWindowYoffset,
+ attr.rootWindowWidth,
+ attr.rootWindowHeight,
+ (attr.rootWindowXoffset < 0 ? "" : "+"),
+ attr.rootWindowXoffset,
+ (attr.rootWindowYoffset < 0 ? "" : "+"),
+ attr.rootWindowYoffset,
+ (attr.rootWindowXorigin < 0 ? "" : "+"),
+ attr.rootWindowXorigin,
+ (attr.rootWindowYorigin < 0 ? "" : "+"), attr.rootWindowYorigin);
+ }
+ else {
fprintf(stderr,
"Could not set screen #%d to "
- "%dx%d%s%d%s%d %dx%d%s%d%s%d %s%d%s%d\n"
+ "%dx%d%s%d%s%d %dx%d%s%d%s%d %s%d%s%d\n"
"[status = %d, errorScreen=%d]\n",
screen,
- attr.screenWindowWidth,
- attr.screenWindowHeight,
- (attr.screenWindowXoffset < 0 ? "" : "+"),
- attr.screenWindowXoffset,
- (attr.screenWindowYoffset < 0 ? "" : "+"),
- attr.screenWindowYoffset,
- attr.rootWindowWidth,
- attr.rootWindowHeight,
- (attr.rootWindowXoffset < 0 ? "" : "+"),
- attr.rootWindowXoffset,
- (attr.rootWindowYoffset < 0 ? "" : "+"),
- attr.rootWindowYoffset,
- (attr.rootWindowXorigin < 0 ? "" : "+"),
- attr.rootWindowXorigin,
- (attr.rootWindowYorigin < 0 ? "" : "+"),
- attr.rootWindowYorigin,
- status, errorScreen);
- return -1;
+ attr.screenWindowWidth,
+ attr.screenWindowHeight,
+ (attr.screenWindowXoffset < 0 ? "" : "+"),
+ attr.screenWindowXoffset,
+ (attr.screenWindowYoffset < 0 ? "" : "+"),
+ attr.screenWindowYoffset,
+ attr.rootWindowWidth,
+ attr.rootWindowHeight,
+ (attr.rootWindowXoffset < 0 ? "" : "+"),
+ attr.rootWindowXoffset,
+ (attr.rootWindowYoffset < 0 ? "" : "+"),
+ attr.rootWindowYoffset,
+ (attr.rootWindowXorigin < 0 ? "" : "+"),
+ attr.rootWindowXorigin,
+ (attr.rootWindowYorigin < 0 ? "" : "+"),
+ attr.rootWindowYorigin, status, errorScreen);
+ return -1;
}
XCloseDisplay(display);
diff --git a/xorg-server/hw/dmx/examples/dmxresize.c b/xorg-server/hw/dmx/examples/dmxresize.c
index caed91d8d..fed3bd08a 100644
--- a/xorg-server/hw/dmx/examples/dmxresize.c
+++ b/xorg-server/hw/dmx/examples/dmxresize.c
@@ -36,15 +36,16 @@
#include <X11/Xlib.h>
#include <X11/extensions/dmxext.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int event_base;
- int error_base;
- int major_version, minor_version, patch_version;
- int width, height, shiftX, shiftY, status;
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ int width, height, shiftX, shiftY, status;
DMXDesktopAttributes attr;
- unsigned int mask;
+ unsigned int mask;
if (argc != 6) {
printf("Usage: %s display width height shiftX shiftY\n", argv[0]);
@@ -56,7 +57,7 @@ int main(int argc, char **argv)
return -1;
}
- width = strtol(argv[2], NULL, 0);
+ width = strtol(argv[2], NULL, 0);
height = strtol(argv[3], NULL, 0);
shiftX = strtol(argv[4], NULL, 0);
shiftY = strtol(argv[5], NULL, 0);
@@ -76,11 +77,9 @@ int main(int argc, char **argv)
printf("Extension version: %d.%d patch %d\n",
major_version, minor_version, patch_version);
- mask = (DMXDesktopWidth |
- DMXDesktopHeight |
- DMXDesktopShiftX |
- DMXDesktopShiftY);
- attr.width = width;
+ mask = (DMXDesktopWidth |
+ DMXDesktopHeight | DMXDesktopShiftX | DMXDesktopShiftY);
+ attr.width = width;
attr.height = height;
attr.shiftX = shiftX;
attr.shiftY = shiftY;
@@ -98,7 +97,7 @@ int main(int argc, char **argv)
printf("status = %d (UNKNOWN ERROR *****)\n", status);
break;
}
-
+
XCloseDisplay(display);
return 0;
}
diff --git a/xorg-server/hw/dmx/examples/dmxrminput.c b/xorg-server/hw/dmx/examples/dmxrminput.c
index ef62cab8b..0113a7f5c 100644
--- a/xorg-server/hw/dmx/examples/dmxrminput.c
+++ b/xorg-server/hw/dmx/examples/dmxrminput.c
@@ -36,13 +36,14 @@
#include <X11/Xlib.h>
#include <X11/extensions/dmxext.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int event_base;
- int error_base;
- int major_version, minor_version, patch_version;
- int status;
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ int status;
if (argc != 3) {
printf("Usage: %s display id\n", argv[0]);
diff --git a/xorg-server/hw/dmx/examples/dmxrmscreen.c b/xorg-server/hw/dmx/examples/dmxrmscreen.c
index fecf0f6c1..627875bda 100644
--- a/xorg-server/hw/dmx/examples/dmxrmscreen.c
+++ b/xorg-server/hw/dmx/examples/dmxrmscreen.c
@@ -37,13 +37,14 @@
#include <X11/Xlib.h>
#include <X11/extensions/dmxext.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int event_base;
- int error_base;
- int major_version, minor_version, patch_version;
- int screenNum;
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ int screenNum;
if (argc != 3) {
printf("Usage: %s display screenNum\n", argv[0]);
@@ -74,7 +75,7 @@ int main(int argc, char **argv)
if (!DMXRemoveScreen(display, screenNum))
printf("Failed to remove screen #%d\n", screenNum);
-
+
XCloseDisplay(display);
return 0;
}
diff --git a/xorg-server/hw/dmx/examples/dmxwininfo.c b/xorg-server/hw/dmx/examples/dmxwininfo.c
index 3d027d530..9b1ce76b6 100644
--- a/xorg-server/hw/dmx/examples/dmxwininfo.c
+++ b/xorg-server/hw/dmx/examples/dmxwininfo.c
@@ -43,183 +43,180 @@
static const char *FontName = "fixed";
-
static void
-EventLoop(Display *dpy, Window win, GC gc)
+EventLoop(Display * dpy, Window win, GC gc)
{
- XEvent ev;
- while (1) {
- XNextEvent( dpy, &ev );
- switch (ev.type) {
- case ReparentNotify:
- break;
- case MapNotify:
- break;
- case ConfigureNotify:
- case Expose:
- {
+ XEvent ev;
+
+ while (1) {
+ XNextEvent(dpy, &ev);
+ switch (ev.type) {
+ case ReparentNotify:
+ break;
+ case MapNotify:
+ break;
+ case ConfigureNotify:
+ case Expose:
+ {
int numScreens, count, i;
DMXWindowAttributes *winInfo;
int x, y;
const char *msg = "DMX window info:";
DMXGetScreenCount(dpy, &numScreens);
- winInfo
- = (DMXWindowAttributes *)
+ winInfo = (DMXWindowAttributes *)
malloc(numScreens * sizeof(DMXWindowAttributes));
assert(winInfo);
- if (!DMXGetWindowAttributes(dpy, win, &count,
- numScreens, winInfo)) {
- printf("Could not get window information for 0x%08lx\n",
- (long unsigned)win);
+ if (!DMXGetWindowAttributes(dpy, win, &count, numScreens, winInfo)) {
+ printf("Could not get window information for 0x%08lx\n",
+ (long unsigned) win);
}
x = y = 50;
XClearWindow(dpy, win);
XDrawString(dpy, win, gc, x, y, msg, strlen(msg));
y += 20;
for (i = 0; i < count; i++) {
- char str[500];
- snprintf(str, sizeof(str),
- "screen %d: pos: %dx%d+%d+%d visible: %dx%d+%d+%d",
- winInfo[i].screen,
- winInfo[i].pos.width, winInfo[i].pos.height,
- winInfo[i].pos.x, winInfo[i].pos.y,
- winInfo[i].vis.width, winInfo[i].vis.height,
- winInfo[i].vis.x, winInfo[i].vis.y);
- XDrawString(dpy, win, gc, x, y, str, strlen(str));
- y += 20;
+ char str[500];
+
+ snprintf(str, sizeof(str),
+ "screen %d: pos: %dx%d+%d+%d visible: %dx%d+%d+%d",
+ winInfo[i].screen,
+ winInfo[i].pos.width, winInfo[i].pos.height,
+ winInfo[i].pos.x, winInfo[i].pos.y,
+ winInfo[i].vis.width, winInfo[i].vis.height,
+ winInfo[i].vis.x, winInfo[i].vis.y);
+ XDrawString(dpy, win, gc, x, y, str, strlen(str));
+ y += 20;
}
free(winInfo);
- }
- break;
- default:
- printf("Event type 0x%x\n", ev.type);
- }
- }
+ }
+ break;
+ default:
+ printf("Event type 0x%x\n", ev.type);
+ }
+ }
}
int
main(int argc, char *argv[])
{
- const char *displayName = NULL;
- Display *dpy;
- int event_base, error_base;
- int scr, n;
- long vinfoMask, attrMask;
- XVisualInfo vinfoTemp, *visInfo;
- Visual *vis;
- Window win, root;
- XSetWindowAttributes attr;
- XFontStruct *fontInfo;
- GC gc;
-
- if (argc > 1) {
- displayName = argv[1];
- }
-
- dpy = XOpenDisplay(displayName);
- if (!dpy) {
- fprintf(stderr, "Unable to open display %s\n", displayName);
- return -1;
- }
-
- if (!DMXQueryExtension(dpy, &event_base, &error_base)) {
- fprintf(stderr, "DMX extension not available on this display.\n");
- return -1;
- }
-
- scr = DefaultScreen(dpy);
- root = RootWindow(dpy, scr);
- vis = DefaultVisual(dpy, scr);
-
- vinfoMask = VisualIDMask;
- vinfoTemp.visualid = vis->visualid;
- visInfo = XGetVisualInfo(dpy, vinfoMask, &vinfoTemp, &n);
- if (!visInfo || n != 1) {
- fprintf(stderr, "Unable to get visual!\n");
- XCloseDisplay(dpy);
- return -1;
- }
-
- attr.background_pixel = 0;
- attr.border_pixel = 0;
- attr.colormap = XCreateColormap(dpy, root, visInfo->visual, AllocNone);
- attr.event_mask = StructureNotifyMask | ExposureMask;
- attrMask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
-
- win = XCreateWindow(dpy, root,
- 500, 500, 600, 400, /* x, y, w, h */
- 0, /* border_width */
- visInfo->depth, InputOutput,
- visInfo->visual, attrMask, &attr);
-
-
- if (!win) {
- fprintf(stderr, "Unable to create window!\n");
- XCloseDisplay(dpy);
- return -1;
- }
-
- fontInfo = XLoadQueryFont(dpy, FontName);
- if (!fontInfo) {
- fprintf(stderr, "Error: font %s not found\n", FontName);
- exit(0);
- }
-
- gc = XCreateGC(dpy, win, 0, NULL);
- XSetBackground(dpy, gc, BlackPixel(dpy, scr));
- XSetForeground(dpy, gc, WhitePixel(dpy, scr));
- XSetFont(dpy, gc, fontInfo->fid);
-
- XMapWindow(dpy, win);
-
- EventLoop(dpy, win, gc);
-
- XDestroyWindow(dpy, win);
- XCloseDisplay(dpy);
- return 0;
+ const char *displayName = NULL;
+ Display *dpy;
+ int event_base, error_base;
+ int scr, n;
+ long vinfoMask, attrMask;
+ XVisualInfo vinfoTemp, *visInfo;
+ Visual *vis;
+ Window win, root;
+ XSetWindowAttributes attr;
+ XFontStruct *fontInfo;
+ GC gc;
+
+ if (argc > 1) {
+ displayName = argv[1];
+ }
+
+ dpy = XOpenDisplay(displayName);
+ if (!dpy) {
+ fprintf(stderr, "Unable to open display %s\n", displayName);
+ return -1;
+ }
+
+ if (!DMXQueryExtension(dpy, &event_base, &error_base)) {
+ fprintf(stderr, "DMX extension not available on this display.\n");
+ return -1;
+ }
+
+ scr = DefaultScreen(dpy);
+ root = RootWindow(dpy, scr);
+ vis = DefaultVisual(dpy, scr);
+
+ vinfoMask = VisualIDMask;
+ vinfoTemp.visualid = vis->visualid;
+ visInfo = XGetVisualInfo(dpy, vinfoMask, &vinfoTemp, &n);
+ if (!visInfo || n != 1) {
+ fprintf(stderr, "Unable to get visual!\n");
+ XCloseDisplay(dpy);
+ return -1;
+ }
+
+ attr.background_pixel = 0;
+ attr.border_pixel = 0;
+ attr.colormap = XCreateColormap(dpy, root, visInfo->visual, AllocNone);
+ attr.event_mask = StructureNotifyMask | ExposureMask;
+ attrMask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
+
+ win = XCreateWindow(dpy, root, 500, 500, 600, 400, /* x, y, w, h */
+ 0, /* border_width */
+ visInfo->depth, InputOutput,
+ visInfo->visual, attrMask, &attr);
+
+ if (!win) {
+ fprintf(stderr, "Unable to create window!\n");
+ XCloseDisplay(dpy);
+ return -1;
+ }
+
+ fontInfo = XLoadQueryFont(dpy, FontName);
+ if (!fontInfo) {
+ fprintf(stderr, "Error: font %s not found\n", FontName);
+ exit(0);
+ }
+
+ gc = XCreateGC(dpy, win, 0, NULL);
+ XSetBackground(dpy, gc, BlackPixel(dpy, scr));
+ XSetForeground(dpy, gc, WhitePixel(dpy, scr));
+ XSetFont(dpy, gc, fontInfo->fid);
+
+ XMapWindow(dpy, win);
+
+ EventLoop(dpy, win, gc);
+
+ XDestroyWindow(dpy, win);
+ XCloseDisplay(dpy);
+ return 0;
}
#if 00
-static void make_window( char *title, int color_flag )
+static void
+make_window(char *title, int color_flag)
{
- int x = 10, y = 10, width = 400, height = 300;
- Display *dpy;
- int scr;
- Window root, win;
- Colormap cmap;
- XColor xcolor;
- int attr_flags;
- XVisualInfo *visinfo;
- XSetWindowAttributes attr;
- XTextProperty tp;
- XSizeHints sh;
- XEvent e;
- XMesaContext context;
- XMesaVisual visual;
- XMesaBuffer buffer;
-
-
- /*
- * Do the usual X things to make a window.
- */
-
- dpy = XOpenDisplay(NULL);
- if (!dpy) {
- printf("Couldn't open default display!\n");
- exit(1);
- }
-
- scr = DefaultScreen(dpy);
- root = RootWindow(dpy, scr);
-
- /* alloc visinfo struct */
- visinfo = (XVisualInfo *) malloc( sizeof(XVisualInfo) );
-
- /* Get a visual and colormap */
- if (color_flag) {
- /* Open TrueColor window */
+ int x = 10, y = 10, width = 400, height = 300;
+ Display *dpy;
+ int scr;
+ Window root, win;
+ Colormap cmap;
+ XColor xcolor;
+ int attr_flags;
+ XVisualInfo *visinfo;
+ XSetWindowAttributes attr;
+ XTextProperty tp;
+ XSizeHints sh;
+ XEvent e;
+ XMesaContext context;
+ XMesaVisual visual;
+ XMesaBuffer buffer;
+
+ /*
+ * Do the usual X things to make a window.
+ */
+
+ dpy = XOpenDisplay(NULL);
+ if (!dpy) {
+ printf("Couldn't open default display!\n");
+ exit(1);
+ }
+
+ scr = DefaultScreen(dpy);
+ root = RootWindow(dpy, scr);
+
+ /* alloc visinfo struct */
+ visinfo = (XVisualInfo *) malloc(sizeof(XVisualInfo));
+
+ /* Get a visual and colormap */
+ if (color_flag) {
+ /* Open TrueColor window */
/*
if (!XMatchVisualInfo( dpy, scr, 24, TrueColor, visinfo )) {
@@ -227,269 +224,254 @@ static void make_window( char *title, int color_flag )
exit(1);
}
*/
- if (!XMatchVisualInfo( dpy, scr, 8, PseudoColor, visinfo )) {
- printf("Couldn't get 8-bit PseudoColor visual!\n");
- exit(1);
- }
+ if (!XMatchVisualInfo(dpy, scr, 8, PseudoColor, visinfo)) {
+ printf("Couldn't get 8-bit PseudoColor visual!\n");
+ exit(1);
+ }
- cmap = XCreateColormap( dpy, root, visinfo->visual, AllocNone );
- Black = Red = Green = Blue = 0;
- }
- else {
- /* Open color index window */
+ cmap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
+ Black = Red = Green = Blue = 0;
+ }
+ else {
+ /* Open color index window */
- if (!XMatchVisualInfo( dpy, scr, 8, PseudoColor, visinfo )) {
- printf("Couldn't get 8-bit PseudoColor visual\n");
- exit(1);
- }
+ if (!XMatchVisualInfo(dpy, scr, 8, PseudoColor, visinfo)) {
+ printf("Couldn't get 8-bit PseudoColor visual\n");
+ exit(1);
+ }
- cmap = XCreateColormap( dpy, root, visinfo->visual, AllocNone );
+ cmap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
- /* Allocate colors */
- xcolor.red = 0x0;
- xcolor.green = 0x0;
- xcolor.blue = 0x0;
- xcolor.flags = DoRed | DoGreen | DoBlue;
- if (!XAllocColor( dpy, cmap, &xcolor )) {
- printf("Couldn't allocate black!\n");
- exit(1);
- }
- Black = xcolor.pixel;
-
- xcolor.red = 0xffff;
- xcolor.green = 0x0;
- xcolor.blue = 0x0;
- xcolor.flags = DoRed | DoGreen | DoBlue;
- if (!XAllocColor( dpy, cmap, &xcolor )) {
- printf("Couldn't allocate red!\n");
- exit(1);
- }
- Red = xcolor.pixel;
-
- xcolor.red = 0x0;
- xcolor.green = 0xffff;
- xcolor.blue = 0x0;
- xcolor.flags = DoRed | DoGreen | DoBlue;
- if (!XAllocColor( dpy, cmap, &xcolor )) {
- printf("Couldn't allocate green!\n");
- exit(1);
- }
- Green = xcolor.pixel;
-
- xcolor.red = 0x0;
- xcolor.green = 0x0;
- xcolor.blue = 0xffff;
- xcolor.flags = DoRed | DoGreen | DoBlue;
- if (!XAllocColor( dpy, cmap, &xcolor )) {
- printf("Couldn't allocate blue!\n");
- exit(1);
- }
- Blue = xcolor.pixel;
- }
-
- /* set window attributes */
- attr.colormap = cmap;
- attr.event_mask = ExposureMask | StructureNotifyMask;
- attr.border_pixel = BlackPixel( dpy, scr );
- attr.background_pixel = BlackPixel( dpy, scr );
- attr_flags = CWColormap | CWEventMask | CWBorderPixel | CWBackPixel;
-
- /* Create the window */
- win = XCreateWindow( dpy, root, x,y, width, height, 0,
- visinfo->depth, InputOutput,
- visinfo->visual,
- attr_flags, &attr);
- if (!win) {
- printf("Couldn't open window!\n");
- exit(1);
- }
-
- XStringListToTextProperty(&title, 1, &tp);
- sh.flags = USPosition | USSize;
- XSetWMProperties(dpy, win, &tp, &tp, 0, 0, &sh, 0, 0);
- XMapWindow(dpy, win);
- while (1) {
- XNextEvent( dpy, &e );
- if (e.type == MapNotify && e.xmap.window == win) {
- break;
- }
- }
-
-
- /*
- * Now do the special Mesa/Xlib stuff!
- */
-
- visual = XMesaCreateVisual( dpy, visinfo,
- (GLboolean) color_flag,
- GL_FALSE, /* alpha_flag */
- GL_FALSE, /* db_flag */
- GL_FALSE, /* stereo flag */
- GL_FALSE, /* ximage_flag */
- 0, /* depth size */
- 0, /* stencil size */
- 0,0,0,0, /* accum_size */
- 0, /* num samples */
- 0, /* level */
- 0 /* caveat */
- );
- if (!visual) {
- printf("Couldn't create Mesa/X visual!\n");
- exit(1);
- }
-
- /* Create a Mesa rendering context */
- context = XMesaCreateContext( visual,
- NULL /* share_list */
- );
- if (!context) {
- printf("Couldn't create Mesa/X context!\n");
- exit(1);
- }
-
- buffer = XMesaCreateWindowBuffer( visual, win );
- if (!buffer) {
- printf("Couldn't create Mesa/X buffer!\n");
- exit(1);
- }
-
-
- XMesaMakeCurrent( context, buffer );
-
- /* Ready to render! */
+ /* Allocate colors */
+ xcolor.red = 0x0;
+ xcolor.green = 0x0;
+ xcolor.blue = 0x0;
+ xcolor.flags = DoRed | DoGreen | DoBlue;
+ if (!XAllocColor(dpy, cmap, &xcolor)) {
+ printf("Couldn't allocate black!\n");
+ exit(1);
+ }
+ Black = xcolor.pixel;
+
+ xcolor.red = 0xffff;
+ xcolor.green = 0x0;
+ xcolor.blue = 0x0;
+ xcolor.flags = DoRed | DoGreen | DoBlue;
+ if (!XAllocColor(dpy, cmap, &xcolor)) {
+ printf("Couldn't allocate red!\n");
+ exit(1);
+ }
+ Red = xcolor.pixel;
+
+ xcolor.red = 0x0;
+ xcolor.green = 0xffff;
+ xcolor.blue = 0x0;
+ xcolor.flags = DoRed | DoGreen | DoBlue;
+ if (!XAllocColor(dpy, cmap, &xcolor)) {
+ printf("Couldn't allocate green!\n");
+ exit(1);
+ }
+ Green = xcolor.pixel;
+
+ xcolor.red = 0x0;
+ xcolor.green = 0x0;
+ xcolor.blue = 0xffff;
+ xcolor.flags = DoRed | DoGreen | DoBlue;
+ if (!XAllocColor(dpy, cmap, &xcolor)) {
+ printf("Couldn't allocate blue!\n");
+ exit(1);
+ }
+ Blue = xcolor.pixel;
+ }
+
+ /* set window attributes */
+ attr.colormap = cmap;
+ attr.event_mask = ExposureMask | StructureNotifyMask;
+ attr.border_pixel = BlackPixel(dpy, scr);
+ attr.background_pixel = BlackPixel(dpy, scr);
+ attr_flags = CWColormap | CWEventMask | CWBorderPixel | CWBackPixel;
+
+ /* Create the window */
+ win = XCreateWindow(dpy, root, x, y, width, height, 0,
+ visinfo->depth, InputOutput,
+ visinfo->visual, attr_flags, &attr);
+ if (!win) {
+ printf("Couldn't open window!\n");
+ exit(1);
+ }
+
+ XStringListToTextProperty(&title, 1, &tp);
+ sh.flags = USPosition | USSize;
+ XSetWMProperties(dpy, win, &tp, &tp, 0, 0, &sh, 0, 0);
+ XMapWindow(dpy, win);
+ while (1) {
+ XNextEvent(dpy, &e);
+ if (e.type == MapNotify && e.xmap.window == win) {
+ break;
+ }
+ }
+
+ /*
+ * Now do the special Mesa/Xlib stuff!
+ */
+
+ visual = XMesaCreateVisual(dpy, visinfo, (GLboolean) color_flag, GL_FALSE, /* alpha_flag */
+ GL_FALSE, /* db_flag */
+ GL_FALSE, /* stereo flag */
+ GL_FALSE, /* ximage_flag */
+ 0, /* depth size */
+ 0, /* stencil size */
+ 0, 0, 0, 0, /* accum_size */
+ 0, /* num samples */
+ 0, /* level */
+ 0 /* caveat */
+ );
+ if (!visual) {
+ printf("Couldn't create Mesa/X visual!\n");
+ exit(1);
+ }
+
+ /* Create a Mesa rendering context */
+ context = XMesaCreateContext(visual, NULL /* share_list */
+ );
+ if (!context) {
+ printf("Couldn't create Mesa/X context!\n");
+ exit(1);
+ }
+
+ buffer = XMesaCreateWindowBuffer(visual, win);
+ if (!buffer) {
+ printf("Couldn't create Mesa/X buffer!\n");
+ exit(1);
+ }
+
+ XMesaMakeCurrent(context, buffer);
+
+ /* Ready to render! */
}
-
-
-static void draw_cube( void )
+static void
+draw_cube(void)
{
- /* X faces */
- glIndexi( Red );
- glColor3f( 1.0, 0.0, 0.0 );
- glBegin( GL_POLYGON );
- glVertex3f( 1.0, 1.0, 1.0 );
- glVertex3f( 1.0, -1.0, 1.0 );
- glVertex3f( 1.0, -1.0, -1.0 );
- glVertex3f( 1.0, 1.0, -1.0 );
- glEnd();
-
- glBegin( GL_POLYGON );
- glVertex3f( -1.0, 1.0, 1.0 );
- glVertex3f( -1.0, 1.0, -1.0 );
- glVertex3f( -1.0, -1.0, -1.0 );
- glVertex3f( -1.0, -1.0, 1.0 );
- glEnd();
-
- /* Y faces */
- glIndexi( Green );
- glColor3f( 0.0, 1.0, 0.0 );
- glBegin( GL_POLYGON );
- glVertex3f( 1.0, 1.0, 1.0 );
- glVertex3f( 1.0, 1.0, -1.0 );
- glVertex3f( -1.0, 1.0, -1.0 );
- glVertex3f( -1.0, 1.0, 1.0 );
- glEnd();
-
- glBegin( GL_POLYGON );
- glVertex3f( 1.0, -1.0, 1.0 );
- glVertex3f( -1.0, -1.0, 1.0 );
- glVertex3f( -1.0, -1.0, -1.0 );
- glVertex3f( 1.0, -1.0, -1.0 );
- glEnd();
-
- /* Z faces */
- glIndexi( Blue );
- glColor3f( 0.0, 0.0, 1.0 );
- glBegin( GL_POLYGON );
- glVertex3f( 1.0, 1.0, 1.0 );
- glVertex3f( -1.0, 1.0, 1.0 );
- glVertex3f( -1.0, -1.0, 1.0 );
- glVertex3f( 1.0, -1.0, 1.0 );
- glEnd();
-
- glBegin( GL_POLYGON );
- glVertex3f( 1.0, 1.0, -1.0 );
- glVertex3f( 1.0,-1.0, -1.0 );
- glVertex3f( -1.0,-1.0, -1.0 );
- glVertex3f( -1.0, 1.0, -1.0 );
- glEnd();
+ /* X faces */
+ glIndexi(Red);
+ glColor3f(1.0, 0.0, 0.0);
+ glBegin(GL_POLYGON);
+ glVertex3f(1.0, 1.0, 1.0);
+ glVertex3f(1.0, -1.0, 1.0);
+ glVertex3f(1.0, -1.0, -1.0);
+ glVertex3f(1.0, 1.0, -1.0);
+ glEnd();
+
+ glBegin(GL_POLYGON);
+ glVertex3f(-1.0, 1.0, 1.0);
+ glVertex3f(-1.0, 1.0, -1.0);
+ glVertex3f(-1.0, -1.0, -1.0);
+ glVertex3f(-1.0, -1.0, 1.0);
+ glEnd();
+
+ /* Y faces */
+ glIndexi(Green);
+ glColor3f(0.0, 1.0, 0.0);
+ glBegin(GL_POLYGON);
+ glVertex3f(1.0, 1.0, 1.0);
+ glVertex3f(1.0, 1.0, -1.0);
+ glVertex3f(-1.0, 1.0, -1.0);
+ glVertex3f(-1.0, 1.0, 1.0);
+ glEnd();
+
+ glBegin(GL_POLYGON);
+ glVertex3f(1.0, -1.0, 1.0);
+ glVertex3f(-1.0, -1.0, 1.0);
+ glVertex3f(-1.0, -1.0, -1.0);
+ glVertex3f(1.0, -1.0, -1.0);
+ glEnd();
+
+ /* Z faces */
+ glIndexi(Blue);
+ glColor3f(0.0, 0.0, 1.0);
+ glBegin(GL_POLYGON);
+ glVertex3f(1.0, 1.0, 1.0);
+ glVertex3f(-1.0, 1.0, 1.0);
+ glVertex3f(-1.0, -1.0, 1.0);
+ glVertex3f(1.0, -1.0, 1.0);
+ glEnd();
+
+ glBegin(GL_POLYGON);
+ glVertex3f(1.0, 1.0, -1.0);
+ glVertex3f(1.0, -1.0, -1.0);
+ glVertex3f(-1.0, -1.0, -1.0);
+ glVertex3f(-1.0, 1.0, -1.0);
+ glEnd();
}
-
-
-
-static void display_loop( void )
+static void
+display_loop(void)
{
- GLfloat xrot, yrot, zrot;
+ GLfloat xrot, yrot, zrot;
- xrot = yrot = zrot = 0.0;
+ xrot = yrot = zrot = 0.0;
- glClearColor( 0.0, 0.0, 0.0, 0.0 );
- glClearIndex( Black );
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClearIndex(Black);
- glMatrixMode( GL_PROJECTION );
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 1.0, 10.0 );
- glTranslatef( 0.0, 0.0, -5.0 );
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 10.0);
+ glTranslatef(0.0, 0.0, -5.0);
- glMatrixMode( GL_MODELVIEW );
- glLoadIdentity();
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
- glCullFace( GL_BACK );
- glEnable( GL_CULL_FACE );
+ glCullFace(GL_BACK);
+ glEnable(GL_CULL_FACE);
- glShadeModel( GL_FLAT );
+ glShadeModel(GL_FLAT);
- while (1) {
- glClear( GL_COLOR_BUFFER_BIT );
- glPushMatrix();
- glRotatef( xrot, 1.0, 0.0, 0.0 );
- glRotatef( yrot, 0.0, 1.0, 0.0 );
- glRotatef( zrot, 0.0, 0.0, 1.0 );
+ while (1) {
+ glClear(GL_COLOR_BUFFER_BIT);
+ glPushMatrix();
+ glRotatef(xrot, 1.0, 0.0, 0.0);
+ glRotatef(yrot, 0.0, 1.0, 0.0);
+ glRotatef(zrot, 0.0, 0.0, 1.0);
- draw_cube();
+ draw_cube();
- glPopMatrix();
- glFinish();
+ glPopMatrix();
+ glFinish();
- xrot += 10.0;
- yrot += 7.0;
- zrot -= 3.0;
- }
+ xrot += 10.0;
+ yrot += 7.0;
+ zrot -= 3.0;
+ }
}
-
-
-
-int main( int argc, char *argv[] )
+int
+main(int argc, char *argv[])
{
- int mode = 0;
-
- if (argc >= 2)
- {
- if (strcmp(argv[1],"-ci")==0)
- mode = 0;
- else if (strcmp(argv[1],"-rgb")==0)
- mode = 1;
- else
- {
- printf("Bad flag: %s\n", argv[1]);
- printf("Specify -ci for 8-bit color index or -rgb for RGB mode\n");
- exit(1);
+ int mode = 0;
+
+ if (argc >= 2) {
+ if (strcmp(argv[1], "-ci") == 0)
+ mode = 0;
+ else if (strcmp(argv[1], "-rgb") == 0)
+ mode = 1;
+ else {
+ printf("Bad flag: %s\n", argv[1]);
+ printf("Specify -ci for 8-bit color index or -rgb for RGB mode\n");
+ exit(1);
}
- }
- else
- {
+ }
+ else {
printf("Specify -ci for 8-bit color index or -rgb for RGB mode\n");
printf("Defaulting to 8-bit color index\n");
- }
+ }
- make_window( argv[0], mode );
+ make_window(argv[0], mode);
- display_loop();
- return 0;
+ display_loop();
+ return 0;
}
-
#endif
diff --git a/xorg-server/hw/dmx/examples/ev.c b/xorg-server/hw/dmx/examples/ev.c
index ed23b8aa9..b70016a45 100644
--- a/xorg-server/hw/dmx/examples/ev.c
+++ b/xorg-server/hw/dmx/examples/ev.c
@@ -46,16 +46,17 @@
struct input_event event;
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- char name[64]; /* RATS: Use ok, but could be better */
- char buf[256] = { 0, }; /* RATS: Use ok */
- unsigned char mask[EV_MAX/8 + 1]; /* RATS: Use ok */
- int version;
- int fd = 0;
- int rc;
- int i, j;
- char *tmp;
+ char name[64]; /* RATS: Use ok, but could be better */
+ char buf[256] = { 0, }; /* RATS: Use ok */
+ unsigned char mask[EV_MAX / 8 + 1]; /* RATS: Use ok */
+ int version;
+ int fd = 0;
+ int rc;
+ int i, j;
+ char *tmp;
#define test_bit(bit) (mask[(bit)/8] & (1 << ((bit)%8)))
@@ -73,15 +74,32 @@ int main(int argc, char **argv)
for (j = 0; j < EV_MAX; j++) {
if (test_bit(j)) {
const char *type = "unknown";
- switch(j) {
- case EV_KEY: type = "keys/buttons"; break;
- case EV_REL: type = "relative"; break;
- case EV_ABS: type = "absolute"; break;
- case EV_MSC: type = "reserved"; break;
- case EV_LED: type = "leds"; break;
- case EV_SND: type = "sound"; break;
- case EV_REP: type = "repeat"; break;
- case EV_FF: type = "feedback"; break;
+
+ switch (j) {
+ case EV_KEY:
+ type = "keys/buttons";
+ break;
+ case EV_REL:
+ type = "relative";
+ break;
+ case EV_ABS:
+ type = "absolute";
+ break;
+ case EV_MSC:
+ type = "reserved";
+ break;
+ case EV_LED:
+ type = "leds";
+ break;
+ case EV_SND:
+ type = "sound";
+ break;
+ case EV_REP:
+ type = "repeat";
+ break;
+ case EV_FF:
+ type = "feedback";
+ break;
}
printf(" %s", type);
}
@@ -96,27 +114,27 @@ int main(int argc, char **argv)
if ((fd = open(name, O_RDWR, 0)) >= 0) {
printf("%s: open, fd = %d\n", name, fd);
for (i = 0; i < LED_MAX; i++) {
- event.time.tv_sec = time(0);
+ event.time.tv_sec = time(0);
event.time.tv_usec = 0;
- event.type = EV_LED;
- event.code = i;
- event.value = 0;
+ event.type = EV_LED;
+ event.code = i;
+ event.value = 0;
write(fd, &event, sizeof(event));
}
-
+
while ((rc = read(fd, &event, sizeof(event))) > 0) {
printf("%-24.24s.%06lu type 0x%04x; code 0x%04x;"
" value 0x%08x; ",
ctime(&event.time.tv_sec),
- event.time.tv_usec,
- event.type, event.code, event.value);
+ event.time.tv_usec, event.type, event.code, event.value);
switch (event.type) {
case EV_KEY:
if (event.code > BTN_MISC) {
printf("Button %d %s",
event.code & 0xff,
event.value ? "press" : "release");
- } else {
+ }
+ else {
printf("Key %d (0x%x) %s",
event.code & 0xff,
event.code & 0xff,
@@ -125,51 +143,125 @@ int main(int argc, char **argv)
break;
case EV_REL:
switch (event.code) {
- case REL_X: tmp = "X"; break;
- case REL_Y: tmp = "Y"; break;
- case REL_HWHEEL: tmp = "HWHEEL"; break;
- case REL_DIAL: tmp = "DIAL"; break;
- case REL_WHEEL: tmp = "WHEEL"; break;
- case REL_MISC: tmp = "MISC"; break;
- default: tmp = "UNKNOWN"; break;
+ case REL_X:
+ tmp = "X";
+ break;
+ case REL_Y:
+ tmp = "Y";
+ break;
+ case REL_HWHEEL:
+ tmp = "HWHEEL";
+ break;
+ case REL_DIAL:
+ tmp = "DIAL";
+ break;
+ case REL_WHEEL:
+ tmp = "WHEEL";
+ break;
+ case REL_MISC:
+ tmp = "MISC";
+ break;
+ default:
+ tmp = "UNKNOWN";
+ break;
}
printf("Relative %s %d", tmp, event.value);
break;
case EV_ABS:
switch (event.code) {
- case ABS_X: tmp = "X"; break;
- case ABS_Y: tmp = "Y"; break;
- case ABS_Z: tmp = "Z"; break;
- case ABS_RX: tmp = "RX"; break;
- case ABS_RY: tmp = "RY"; break;
- case ABS_RZ: tmp = "RZ"; break;
- case ABS_THROTTLE: tmp = "THROTTLE"; break;
- case ABS_RUDDER: tmp = "RUDDER"; break;
- case ABS_WHEEL: tmp = "WHEEL"; break;
- case ABS_GAS: tmp = "GAS"; break;
- case ABS_BRAKE: tmp = "BRAKE"; break;
- case ABS_HAT0X: tmp = "HAT0X"; break;
- case ABS_HAT0Y: tmp = "HAT0Y"; break;
- case ABS_HAT1X: tmp = "HAT1X"; break;
- case ABS_HAT1Y: tmp = "HAT1Y"; break;
- case ABS_HAT2X: tmp = "HAT2X"; break;
- case ABS_HAT2Y: tmp = "HAT2Y"; break;
- case ABS_HAT3X: tmp = "HAT3X"; break;
- case ABS_HAT3Y: tmp = "HAT3Y"; break;
- case ABS_PRESSURE: tmp = "PRESSURE"; break;
- case ABS_DISTANCE: tmp = "DISTANCE"; break;
- case ABS_TILT_X: tmp = "TILT_X"; break;
- case ABS_TILT_Y: tmp = "TILT_Y"; break;
- case ABS_MISC: tmp = "MISC"; break;
- default: tmp = "UNKNOWN"; break;
+ case ABS_X:
+ tmp = "X";
+ break;
+ case ABS_Y:
+ tmp = "Y";
+ break;
+ case ABS_Z:
+ tmp = "Z";
+ break;
+ case ABS_RX:
+ tmp = "RX";
+ break;
+ case ABS_RY:
+ tmp = "RY";
+ break;
+ case ABS_RZ:
+ tmp = "RZ";
+ break;
+ case ABS_THROTTLE:
+ tmp = "THROTTLE";
+ break;
+ case ABS_RUDDER:
+ tmp = "RUDDER";
+ break;
+ case ABS_WHEEL:
+ tmp = "WHEEL";
+ break;
+ case ABS_GAS:
+ tmp = "GAS";
+ break;
+ case ABS_BRAKE:
+ tmp = "BRAKE";
+ break;
+ case ABS_HAT0X:
+ tmp = "HAT0X";
+ break;
+ case ABS_HAT0Y:
+ tmp = "HAT0Y";
+ break;
+ case ABS_HAT1X:
+ tmp = "HAT1X";
+ break;
+ case ABS_HAT1Y:
+ tmp = "HAT1Y";
+ break;
+ case ABS_HAT2X:
+ tmp = "HAT2X";
+ break;
+ case ABS_HAT2Y:
+ tmp = "HAT2Y";
+ break;
+ case ABS_HAT3X:
+ tmp = "HAT3X";
+ break;
+ case ABS_HAT3Y:
+ tmp = "HAT3Y";
+ break;
+ case ABS_PRESSURE:
+ tmp = "PRESSURE";
+ break;
+ case ABS_DISTANCE:
+ tmp = "DISTANCE";
+ break;
+ case ABS_TILT_X:
+ tmp = "TILT_X";
+ break;
+ case ABS_TILT_Y:
+ tmp = "TILT_Y";
+ break;
+ case ABS_MISC:
+ tmp = "MISC";
+ break;
+ default:
+ tmp = "UNKNOWN";
+ break;
}
printf("Absolute %s %d", tmp, event.value);
break;
- case EV_MSC: printf("Misc"); break;
- case EV_LED: printf("Led"); break;
- case EV_SND: printf("Snd"); break;
- case EV_REP: printf("Rep"); break;
- case EV_FF: printf("FF"); break;
+ case EV_MSC:
+ printf("Misc");
+ break;
+ case EV_LED:
+ printf("Led");
+ break;
+ case EV_SND:
+ printf("Snd");
+ break;
+ case EV_REP:
+ printf("Rep");
+ break;
+ case EV_FF:
+ printf("FF");
+ break;
break;
}
printf("\n");
diff --git a/xorg-server/hw/dmx/examples/evi.c b/xorg-server/hw/dmx/examples/evi.c
index 644ea8f51..64dfb7eaa 100644
--- a/xorg-server/hw/dmx/examples/evi.c
+++ b/xorg-server/hw/dmx/examples/evi.c
@@ -36,20 +36,22 @@
#include <X11/Xlib.h>
#include <X11/extensions/XEVI.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int major_version, minor_version;
- ExtendedVisualInfo *evi;
- int count;
- int i;
+ Display *display = NULL;
+ int major_version, minor_version;
+ ExtendedVisualInfo *evi;
+ int count;
+ int i;
if (argc == 2) {
if (!(display = XOpenDisplay(argv[1]))) {
printf("Cannot open display %s\n", argv[1]);
return -1;
}
- } else {
+ }
+ else {
printf("Usage: %s display\n", argv[0]);
return -1;
}
@@ -71,14 +73,13 @@ int main(int argc, char **argv)
printf("%02d vid=0x%02lx screen=%d level=%d type=%u value=%u"
" min=%u max=%u conflicts=%u\n",
i,
- (long unsigned)evi[i].core_visual_id,
+ (long unsigned) evi[i].core_visual_id,
evi[i].screen,
evi[i].level,
evi[i].transparency_type,
evi[i].transparency_value,
evi[i].min_hw_colormaps,
- evi[i].max_hw_colormaps,
- evi[i].num_colormap_conflicts);
+ evi[i].max_hw_colormaps, evi[i].num_colormap_conflicts);
}
XCloseDisplay(display);
diff --git a/xorg-server/hw/dmx/examples/res.c b/xorg-server/hw/dmx/examples/res.c
index 901a1958b..138216e4c 100644
--- a/xorg-server/hw/dmx/examples/res.c
+++ b/xorg-server/hw/dmx/examples/res.c
@@ -36,21 +36,23 @@
#include <X11/Xlib.h>
#include <X11/extensions/XRes.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int major_version, minor_version;
- int event, error;
- int count;
- int i;
- XResClient *clients;
+ Display *display = NULL;
+ int major_version, minor_version;
+ int event, error;
+ int count;
+ int i;
+ XResClient *clients;
if (argc == 2) {
if (!(display = XOpenDisplay(argv[1]))) {
printf("Cannot open display %s\n", argv[1]);
return -1;
}
- } else {
+ }
+ else {
printf("Usage: %s display\n", argv[0]);
return -1;
}
@@ -65,7 +67,7 @@ int main(int argc, char **argv)
return -1;
}
printf("X-Resource extension present: event=%d error=%d\n", event, error);
-
+
if (!XResQueryVersion(display, &major_version, &minor_version)) {
printf("XResQueryVersion call failed\n");
return -1;
@@ -77,16 +79,16 @@ int main(int argc, char **argv)
printf("%d clients:\n", count);
for (i = 0; i < count; i++) {
- int c, j;
+ int c, j;
XResType *types;
-
- XResQueryClientResources(display, clients[i].resource_base,
- &c, &types);
+
+ XResQueryClientResources(display, clients[i].resource_base, &c, &types);
printf(" %3d: base = 0x%lx, mask = 0x%lx, %d resource types:\n",
- i, (long unsigned)clients[i].resource_base,
- (long unsigned)clients[i].resource_mask, c);
+ i, (long unsigned) clients[i].resource_base,
+ (long unsigned) clients[i].resource_mask, c);
for (j = 0; j < c; j++) {
char *name = XGetAtomName(display, types[j].resource_type);
+
printf(" %2d: %s %d\n", j, name, types[j].count);
XFree(name);
}
diff --git a/xorg-server/hw/dmx/examples/xbell.c b/xorg-server/hw/dmx/examples/xbell.c
index 79419d324..543db24bf 100644
--- a/xorg-server/hw/dmx/examples/xbell.c
+++ b/xorg-server/hw/dmx/examples/xbell.c
@@ -35,27 +35,29 @@
#include <stdlib.h>
#include <X11/Xlib.h>
-static void pkc(XKeyboardControl *kc, unsigned long vm)
+static void
+pkc(XKeyboardControl * kc, unsigned long vm)
{
- if (vm&KBKeyClickPercent)
+ if (vm & KBKeyClickPercent)
printf(" key_click_percent = %d\n", kc->key_click_percent);
- if (vm&KBBellPercent)
+ if (vm & KBBellPercent)
printf(" bell_percent = %d\n", kc->bell_percent);
- if (vm&KBBellPitch)
+ if (vm & KBBellPitch)
printf(" bell_pitch = %d\n", kc->bell_pitch);
- if (vm&KBBellDuration)
+ if (vm & KBBellDuration)
printf(" bell_duration = %d\n", kc->bell_duration);
- if (vm&KBLed)
+ if (vm & KBLed)
printf(" led = 0x%x\n", kc->led);
- if (vm&KBLedMode)
+ if (vm & KBLedMode)
printf(" led_mode = %d\n", kc->led_mode);
- if (vm&KBKey)
+ if (vm & KBKey)
printf(" key = %d\n", kc->key);
- if (vm&KBAutoRepeatMode)
+ if (vm & KBAutoRepeatMode)
printf(" auto_repeat_mode = %d\n", kc->auto_repeat_mode);
}
-static void pks(XKeyboardState *ks)
+static void
+pks(XKeyboardState * ks)
{
printf(" key_click_percent = %d\n", ks->key_click_percent);
printf(" bell_percent = %d\n", ks->bell_percent);
@@ -65,24 +67,23 @@ static void pks(XKeyboardState *ks)
printf(" global_auto_repeat = %d\n", ks->global_auto_repeat);
}
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = XOpenDisplay(NULL);
+ Display *display = XOpenDisplay(NULL);
XKeyboardControl kc;
- XKeyboardState ks;
- unsigned long vm;
+ XKeyboardState ks;
+ unsigned long vm;
if (argc != 5) {
printf("Usage: xbell percent baseVolume pitch duration\n");
return 1;
}
-
- vm = (KBBellPercent
- | KBBellPitch
- | KBBellDuration);
+
+ vm = (KBBellPercent | KBBellPitch | KBBellDuration);
kc.key_click_percent = atoi(argv[1]);
- kc.bell_percent = atoi(argv[2]);
- kc.bell_pitch = atoi(argv[3]);
+ kc.bell_percent = atoi(argv[2]);
+ kc.bell_pitch = atoi(argv[3]);
kc.bell_duration = atoi(argv[4]);
printf("Setting:\n");
@@ -92,9 +93,9 @@ int main(int argc, char **argv)
printf("Have:\n");
XGetKeyboardControl(display, &ks);
pks(&ks);
-
+
XBell(display, 100);
-
+
XCloseDisplay(display);
return 0;
}
diff --git a/xorg-server/hw/dmx/examples/xinput.c b/xorg-server/hw/dmx/examples/xinput.c
index b12daf201..db6601030 100644
--- a/xorg-server/hw/dmx/examples/xinput.c
+++ b/xorg-server/hw/dmx/examples/xinput.c
@@ -42,31 +42,42 @@
#include <X11/extensions/dmxext.h>
#include <sys/time.h>
-static const char *core(DMXInputAttributes *iinf)
+static const char *
+core(DMXInputAttributes * iinf)
{
- if (iinf->isCore) return "core";
- else if (iinf->sendsCore) return "extension (sends core events)";
- else return "extension";
+ if (iinf->isCore)
+ return "core";
+ else if (iinf->sendsCore)
+ return "extension (sends core events)";
+ else
+ return "extension";
}
-static void printdmxinfo(Display *display, int id)
+static void
+printdmxinfo(Display * display, int id)
{
- int event_base;
- int error_base;
- int major_version, minor_version, patch_version;
- DMXInputAttributes iinf;
- Display *backend;
- char *backendname = NULL;
-
- if (!DMXQueryExtension(display, &event_base, &error_base)) return;
+ int event_base;
+ int error_base;
+ int major_version, minor_version, patch_version;
+ DMXInputAttributes iinf;
+ Display *backend;
+ char *backendname = NULL;
+
+ if (!DMXQueryExtension(display, &event_base, &error_base))
+ return;
if (!DMXQueryVersion(display, &major_version, &minor_version,
- &patch_version)) return;
- if (major_version == 1 && minor_version == 0) return; /* too old */
- if (!DMXGetInputAttributes(display, id, &iinf)) return;
+ &patch_version))
+ return;
+ if (major_version == 1 && minor_version == 0)
+ return; /* too old */
+ if (!DMXGetInputAttributes(display, id, &iinf))
+ return;
printf(" DMX Information: ");
- if (iinf.detached) printf("detached ");
- else printf("active ");
+ if (iinf.detached)
+ printf("detached ");
+ else
+ printf("active ");
switch (iinf.inputType) {
case DMXLocalInputType:
printf("local, %s", core(&iinf));
@@ -78,12 +89,14 @@ static void printdmxinfo(Display *display, int id)
if (iinf.physicalId >= 0) {
if ((backend = XOpenDisplay(iinf.name))) {
XExtensionVersion *ext = XGetExtensionVersion(backend, INAME);
- if (ext && ext != (XExtensionVersion *)NoSuchExtension) {
+
+ if (ext && ext != (XExtensionVersion *) NoSuchExtension) {
int count, i;
XDeviceInfo *devInfo = XListInputDevices(backend, &count);
+
if (devInfo) {
for (i = 0; i < count; i++) {
- if ((unsigned)iinf.physicalId == devInfo[i].id
+ if ((unsigned) iinf.physicalId == devInfo[i].id
&& devInfo[i].name) {
backendname = strdup(devInfo[i].name);
break;
@@ -95,8 +108,9 @@ static void printdmxinfo(Display *display, int id)
XCloseDisplay(backend);
}
}
- printf("backend o%d/%s",iinf.physicalScreen, iinf.name);
- if (iinf.physicalId >= 0) printf("/id%d", iinf.physicalId);
+ printf("backend o%d/%s", iinf.physicalScreen, iinf.name);
+ if (iinf.physicalId >= 0)
+ printf("/id%d", iinf.physicalId);
if (backendname) {
printf("=%s", backendname);
free(backendname);
@@ -107,26 +121,31 @@ static void printdmxinfo(Display *display, int id)
printf("\n");
}
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int device = -1;
- int newmouse = -1;
- int newkbd = -1;
- int count;
- int i, j;
- XDeviceInfo *devInfo;
- XExtensionVersion *ext;
+ Display *display = NULL;
+ int device = -1;
+ int newmouse = -1;
+ int newkbd = -1;
+ int count;
+ int i, j;
+ XDeviceInfo *devInfo;
+ XExtensionVersion *ext;
if (argc == 2 || argc == 3 || argc == 4 || argc == 5) {
if (!(display = XOpenDisplay(argv[1]))) {
printf("Cannot open display %s\n", argv[1]);
return -1;
}
- if (argc >= 3) device = strtol(argv[2], NULL, 0);
- if (argc >= 4) newmouse = strtol(argv[3], NULL, 0);
- if (argc >= 5) newkbd = strtol(argv[4], NULL, 0);
- } else {
+ if (argc >= 3)
+ device = strtol(argv[2], NULL, 0);
+ if (argc >= 4)
+ newmouse = strtol(argv[3], NULL, 0);
+ if (argc >= 5)
+ newkbd = strtol(argv[4], NULL, 0);
+ }
+ else {
printf("Usage: %s display [device] [newmouse] [newkbd]\n", argv[0]);
return -1;
}
@@ -137,12 +156,11 @@ int main(int argc, char **argv)
}
ext = XGetExtensionVersion(display, INAME);
- if (!ext || ext == (XExtensionVersion *)NoSuchExtension) {
+ if (!ext || ext == (XExtensionVersion *) NoSuchExtension) {
printf("No XInputExtension\n");
return -1;
}
- printf("%s version %d.%d\n",
- INAME, ext->major_version, ext->minor_version);
+ printf("%s version %d.%d\n", INAME, ext->major_version, ext->minor_version);
if (!(devInfo = XListInputDevices(display, &count)) || !count) {
printf("Cannot list devices\n");
@@ -151,30 +169,52 @@ int main(int argc, char **argv)
for (i = 0; i < count; i++) {
XAnyClassPtr any;
- const char *kind = "Unknown";
- int has_key = 0;
-
+ const char *kind = "Unknown";
+ int has_key = 0;
+
switch (devInfo[i].use) {
- case IsXPointer: kind = "XPointer"; break;
- case IsXKeyboard: kind = "XKeyboard"; break;
- case IsXExtensionDevice: kind = "XExtensionDevice"; break;
+ case IsXPointer:
+ kind = "XPointer";
+ break;
+ case IsXKeyboard:
+ kind = "XKeyboard";
+ break;
+ case IsXExtensionDevice:
+ kind = "XExtensionDevice";
+ break;
}
printf("%2lu %-20.20s %-16.16s",
- (long unsigned)devInfo[i].id,
+ (long unsigned) devInfo[i].id,
devInfo[i].name ? devInfo[i].name : "", kind);
for (j = 0, any = devInfo[i].inputclassinfo;
j < devInfo[i].num_classes;
- any = (XAnyClassPtr)((char *)any + any->length), j++) {
- const char *class = "unk";
+ any = (XAnyClassPtr) ((char *) any + any->length), j++) {
+ const char *class = "unk";
+
switch (any->class) {
- case KeyClass: class = "key"; ++has_key; break;
- case ButtonClass: class = "btn"; break;
- case ValuatorClass: class = "val"; break;
- case FeedbackClass: class = "fdb"; break;
- case ProximityClass: class = "prx"; break;
- case FocusClass: class = "foc"; break;
- case OtherClass: class = "oth"; break;
+ case KeyClass:
+ class = "key";
+ ++has_key;
+ break;
+ case ButtonClass:
+ class = "btn";
+ break;
+ case ValuatorClass:
+ class = "val";
+ break;
+ case FeedbackClass:
+ class = "fdb";
+ break;
+ case ProximityClass:
+ class = "prx";
+ break;
+ case FocusClass:
+ class = "foc";
+ break;
+ case OtherClass:
+ class = "oth";
+ break;
}
printf(" %s", class);
}
@@ -182,10 +222,10 @@ int main(int argc, char **argv)
printdmxinfo(display, i);
if (has_key) {
- XkbDescPtr xkb;
+ XkbDescPtr xkb;
+
if ((xkb = XkbGetKeyboard(display,
- XkbAllComponentsMask,
- devInfo[i].id))) {
+ XkbAllComponentsMask, devInfo[i].id))) {
printf(" Xkb Information:\n");
printf(" Device id = %d\n", xkb->device_spec);
printf(" Min keycode = 0x%02x\n", xkb->min_key_code);
@@ -203,41 +243,37 @@ int main(int argc, char **argv)
}
if (newmouse >= 0) {
- XDevice *dev;
+ XDevice *dev;
printf("Trying to make device %d core mouse\n", newmouse);
dev = XOpenDevice(display, devInfo[newmouse].id);
- printf("Status = %d\n",
- XChangePointerDevice(display, dev, 0, 1));
+ printf("Status = %d\n", XChangePointerDevice(display, dev, 0, 1));
return 0;
}
if (newkbd >= 0) {
- XDevice *dev;
+ XDevice *dev;
printf("Trying to make device %d core keyboard\n", newkbd);
dev = XOpenDevice(display, devInfo[newkbd].id);
- printf("Status = %d\n",
- XChangeKeyboardDevice(display, dev));
+ printf("Status = %d\n", XChangeKeyboardDevice(display, dev));
return 0;
}
-
- if (device >=0){
+ if (device >= 0) {
#define MAX_EVENTS 100
- int cnt = 0;
- XDevice *dev;
+ int cnt = 0;
+ XDevice *dev;
XEventClass event_list[MAX_EVENTS];
- int event_type[MAX_EVENTS];
- const char *names[MAX_EVENTS];
- int total = 0;
+ int event_type[MAX_EVENTS];
+ const char *names[MAX_EVENTS];
+ int total = 0;
#define ADD(type) \
if (cnt >= MAX_EVENTS) abort(); \
names[cnt] = #type; \
type(dev, event_type[cnt], event_list[cnt]); \
if (event_type[cnt]) ++cnt
-
dev = XOpenDevice(display, devInfo[device].id);
ADD(DeviceKeyPress);
@@ -252,54 +288,55 @@ int main(int argc, char **argv)
ADD(DeviceStateNotify);
ADD(DeviceMappingNotify);
ADD(ChangeDeviceNotify);
-
+
for (i = 0; i < cnt; i++) {
printf("Waiting for %s events of type %d (%lu) on 0x%08lx\n",
names[i],
- event_type[i], (unsigned long)event_list[i],
- (long unsigned)DefaultRootWindow(display));
+ event_type[i], (unsigned long) event_list[i],
+ (long unsigned) DefaultRootWindow(display));
}
XSelectExtensionEvent(display, DefaultRootWindow(display),
event_list, cnt);
-
+
for (;;) {
XEvent event;
+
XNextEvent(display, &event);
for (i = 0; i < cnt; i++) {
- XDeviceMotionEvent *e = (XDeviceMotionEvent *)&event;
- XDeviceButtonEvent *b = (XDeviceButtonEvent *)&event;
+ XDeviceMotionEvent *e = (XDeviceMotionEvent *) & event;
+ XDeviceButtonEvent *b = (XDeviceButtonEvent *) & event;
+
if (event.type == event_type[i]) {
printf("%s id=%lu (%d @ %d,%d; s=0x%04x, d=%d, t=%lu)"
" axes_count=%d first=%d %d %d %d %d %d %d\n",
names[i],
- (long unsigned)e->deviceid,
+ (long unsigned) e->deviceid,
e->type,
e->x, e->y,
e->device_state,
b->button,
- (long unsigned)b->time,
+ (long unsigned) b->time,
e->axes_count,
e->first_axis,
e->axis_data[0],
e->axis_data[1],
e->axis_data[2],
- e->axis_data[3],
- e->axis_data[4],
- e->axis_data[5]);
+ e->axis_data[3], e->axis_data[4], e->axis_data[5]);
}
}
++total;
#if 0
- /* Used to check motion history for
- * extension devices. */
+ /* Used to check motion history for
+ * extension devices. */
if (!(total % 10)) {
XDeviceTimeCoord *tc;
- int n, m, a;
- struct timeval tv;
- unsigned long ms;
+ int n, m, a;
+ struct timeval tv;
+ unsigned long ms;
+
gettimeofday(&tv, NULL);
ms = tv.tv_sec * 1000 + tv.tv_usec / 1000;
- tc = XGetDeviceMotionEvents(display, dev, ms-1000, ms,
+ tc = XGetDeviceMotionEvents(display, dev, ms - 1000, ms,
&n, &m, &a);
printf("Got %d events of mode %s with %d axes\n",
n, m == Absolute ? "Absolute" : "Relative", a);
@@ -309,7 +346,7 @@ int main(int argc, char **argv)
}
XFreeDeviceMotionEvents(tc);
}
-#endif
+#endif
}
}
diff --git a/xorg-server/hw/dmx/examples/xled.c b/xorg-server/hw/dmx/examples/xled.c
index 270f80511..32e8e3770 100644
--- a/xorg-server/hw/dmx/examples/xled.c
+++ b/xorg-server/hw/dmx/examples/xled.c
@@ -40,23 +40,26 @@
#include <X11/extensions/XKBstr.h>
#include <sys/time.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int mask = 0;
- unsigned i;
- XKeyboardState ks;
- XKeyboardControl kc;
- XkbDescPtr xkb;
- int old[32];
+ Display *display = NULL;
+ int mask = 0;
+ unsigned i;
+ XKeyboardState ks;
+ XKeyboardControl kc;
+ XkbDescPtr xkb;
+ int old[32];
if (argc == 2 || argc == 3) {
if (!(display = XOpenDisplay(argv[1]))) {
printf("Cannot open display %s\n", argv[1]);
return -1;
}
- if (argc >= 3) mask = strtol(argv[2], NULL, 0);
- } else {
+ if (argc >= 3)
+ mask = strtol(argv[2], NULL, 0);
+ }
+ else {
printf("Usage: %s display [mask]\n", argv[0]);
return -1;
}
@@ -81,14 +84,13 @@ int main(int argc, char **argv)
for (i = 0; i < XkbNumIndicators; i++) {
if (xkb->indicators->phys_indicators & (1 << i)) {
printf("led %d = %d\n", i, xkb->indicators->maps[i].flags);
- old[i] = xkb->indicators->maps[i].flags;
+ old[i] = xkb->indicators->maps[i].flags;
xkb->indicators->maps[i].flags = XkbIM_NoAutomatic;
}
}
printf("XkbSetIndicatorMap = %d\n", XkbSetIndicatorMap(display, ~0, xkb));
XkbFreeKeyboard(xkb, 0, True);
-
if (!(xkb = XkbAllocKeyboard())) {
printf("Cannot allocate\n");
return -1;
@@ -105,7 +107,7 @@ int main(int argc, char **argv)
printf("XGetKeyboardControl = %d\n", XGetKeyboardControl(display, &ks));
printf("old mask = 0x%08lx\n", ks.led_mask);
for (i = 0; i < 5; i++) {
- kc.led = i + 1;
+ kc.led = i + 1;
kc.led_mode = (mask & (1 << i)) ? LedModeOn : LedModeOff;
printf("XChangeKeyboardControl = %d\n",
XChangeKeyboardControl(display, KBLed | KBLedMode, &kc));
diff --git a/xorg-server/hw/dmx/examples/xtest.c b/xorg-server/hw/dmx/examples/xtest.c
index 1e2d1cfff..9ce896a29 100644
--- a/xorg-server/hw/dmx/examples/xtest.c
+++ b/xorg-server/hw/dmx/examples/xtest.c
@@ -36,19 +36,21 @@
#include <X11/Xlib.h>
#include <X11/extensions/XTest.h>
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
- Display *display = NULL;
- int event_base;
- int error_base;
- int major_version, minor_version;
+ Display *display = NULL;
+ int event_base;
+ int error_base;
+ int major_version, minor_version;
if (argc == 2) {
if (!(display = XOpenDisplay(argv[1]))) {
printf("Cannot open display %s\n", argv[1]);
return -1;
}
- } else {
+ }
+ else {
printf("Usage: %s display\n", argv[0]);
return -1;
}
diff --git a/xorg-server/hw/dmx/glxProxy/compsize.c b/xorg-server/hw/dmx/glxProxy/compsize.c
index 5a5d5d0f1..c204d3ded 100644
--- a/xorg-server/hw/dmx/glxProxy/compsize.c
+++ b/xorg-server/hw/dmx/glxProxy/compsize.c
@@ -31,529 +31,611 @@
#include <GL/gl.h>
#include "compsize.h"
-GLint __glFogiv_size(GLenum pname)
+GLint
+__glFogiv_size(GLenum pname)
{
switch (pname) {
- case GL_FOG_COLOR: return 4;
- case GL_FOG_DENSITY: return 1;
- case GL_FOG_END: return 1;
- case GL_FOG_MODE: return 1;
- case GL_FOG_INDEX: return 1;
- case GL_FOG_START: return 1;
- default:
- return 0;
+ case GL_FOG_COLOR:
+ return 4;
+ case GL_FOG_DENSITY:
+ return 1;
+ case GL_FOG_END:
+ return 1;
+ case GL_FOG_MODE:
+ return 1;
+ case GL_FOG_INDEX:
+ return 1;
+ case GL_FOG_START:
+ return 1;
+ default:
+ return 0;
}
}
-GLint __glFogfv_size(GLenum pname)
+GLint
+__glFogfv_size(GLenum pname)
{
return __glFogiv_size(pname);
}
-GLint __glCallLists_size(GLsizei n, GLenum type)
+GLint
+__glCallLists_size(GLsizei n, GLenum type)
{
GLint size;
- if (n < 0) return 0;
+ if (n < 0)
+ return 0;
switch (type) {
- case GL_BYTE: size = 1; break;
- case GL_UNSIGNED_BYTE: size = 1; break;
- case GL_SHORT: size = 2; break;
- case GL_UNSIGNED_SHORT: size = 2; break;
- case GL_INT: size = 4; break;
- case GL_UNSIGNED_INT: size = 4; break;
- case GL_FLOAT: size = 4; break;
- case GL_2_BYTES: size = 2; break;
- case GL_3_BYTES: size = 3; break;
- case GL_4_BYTES: size = 4; break;
- default:
- return 0;
+ case GL_BYTE:
+ size = 1;
+ break;
+ case GL_UNSIGNED_BYTE:
+ size = 1;
+ break;
+ case GL_SHORT:
+ size = 2;
+ break;
+ case GL_UNSIGNED_SHORT:
+ size = 2;
+ break;
+ case GL_INT:
+ size = 4;
+ break;
+ case GL_UNSIGNED_INT:
+ size = 4;
+ break;
+ case GL_FLOAT:
+ size = 4;
+ break;
+ case GL_2_BYTES:
+ size = 2;
+ break;
+ case GL_3_BYTES:
+ size = 3;
+ break;
+ case GL_4_BYTES:
+ size = 4;
+ break;
+ default:
+ return 0;
}
return n * size;
}
-GLint __glDrawPixels_size(GLenum format, GLenum type, GLsizei w, GLsizei h)
+GLint
+__glDrawPixels_size(GLenum format, GLenum type, GLsizei w, GLsizei h)
{
GLint elements, esize;
-
+
switch (format) {
- case GL_COLOR_INDEX:
- case GL_STENCIL_INDEX:
- case GL_DEPTH_COMPONENT:
- elements = 1;
- break;
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- elements = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- elements = 2;
- break;
- case GL_RGB:
- elements = 3;
- break;
- case GL_RGBA:
- case GL_ABGR_EXT:
- elements = 4;
- break;
- default:
- return 0;
+ case GL_COLOR_INDEX:
+ case GL_STENCIL_INDEX:
+ case GL_DEPTH_COMPONENT:
+ elements = 1;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ case GL_ABGR_EXT:
+ elements = 4;
+ break;
+ default:
+ return 0;
}
switch (type) {
- case GL_BITMAP:
- if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
- return (h * ((w+7)/8));
- } else {
- return 0;
- }
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- esize = 1;
- break;
- case GL_UNSIGNED_BYTE_3_3_2:
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- esize = 1;
- elements = 1;
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- esize = 2;
- break;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- esize = 2;
- elements = 1;
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- esize = 4;
- break;
- case GL_UNSIGNED_INT_8_8_8_8:
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- esize = 4;
- elements = 1;
- break;
- default:
- return 0;
+ case GL_BITMAP:
+ if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
+ return (h * ((w + 7) / 8));
+ }
+ else {
+ return 0;
+ }
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ esize = 1;
+ elements = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ esize = 2;
+ elements = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ esize = 4;
+ elements = 1;
+ break;
+ default:
+ return 0;
}
return elements * esize * w * h;
}
-GLint __glBitmap_size(GLsizei w, GLsizei h)
+GLint
+__glBitmap_size(GLsizei w, GLsizei h)
{
return __glDrawPixels_size(GL_COLOR_INDEX, GL_BITMAP, w, h);
}
-GLint __glTexGendv_size(GLenum e)
+GLint
+__glTexGendv_size(GLenum e)
{
switch (e) {
- case GL_TEXTURE_GEN_MODE:
- return 1;
- case GL_OBJECT_PLANE:
- case GL_EYE_PLANE:
- return 4;
- default:
- return 0;
+ case GL_TEXTURE_GEN_MODE:
+ return 1;
+ case GL_OBJECT_PLANE:
+ case GL_EYE_PLANE:
+ return 4;
+ default:
+ return 0;
}
}
-GLint __glTexGenfv_size(GLenum e)
+GLint
+__glTexGenfv_size(GLenum e)
{
return __glTexGendv_size(e);
}
-GLint __glTexGeniv_size(GLenum e)
+GLint
+__glTexGeniv_size(GLenum e)
{
return __glTexGendv_size(e);
}
-GLint __glTexParameterfv_size(GLenum e)
+GLint
+__glTexParameterfv_size(GLenum e)
{
switch (e) {
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- case GL_TEXTURE_WRAP_R:
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- return 1;
- case GL_TEXTURE_BORDER_COLOR:
- return 4;
- case GL_TEXTURE_PRIORITY:
- return 1;
- case GL_TEXTURE_MIN_LOD:
- case GL_TEXTURE_MAX_LOD:
- case GL_TEXTURE_BASE_LEVEL:
- case GL_TEXTURE_MAX_LEVEL:
- return 1;
- default:
- return 0;
+ case GL_TEXTURE_WRAP_S:
+ case GL_TEXTURE_WRAP_T:
+ case GL_TEXTURE_WRAP_R:
+ case GL_TEXTURE_MIN_FILTER:
+ case GL_TEXTURE_MAG_FILTER:
+ return 1;
+ case GL_TEXTURE_BORDER_COLOR:
+ return 4;
+ case GL_TEXTURE_PRIORITY:
+ return 1;
+ case GL_TEXTURE_MIN_LOD:
+ case GL_TEXTURE_MAX_LOD:
+ case GL_TEXTURE_BASE_LEVEL:
+ case GL_TEXTURE_MAX_LEVEL:
+ return 1;
+ default:
+ return 0;
}
}
-GLint __glTexParameteriv_size(GLenum e)
+GLint
+__glTexParameteriv_size(GLenum e)
{
return __glTexParameterfv_size(e);
}
-GLint __glTexEnvfv_size(GLenum e)
+GLint
+__glTexEnvfv_size(GLenum e)
{
switch (e) {
- case GL_TEXTURE_ENV_MODE:
- return 1;
- case GL_TEXTURE_ENV_COLOR:
- return 4;
- default:
- return 0;
+ case GL_TEXTURE_ENV_MODE:
+ return 1;
+ case GL_TEXTURE_ENV_COLOR:
+ return 4;
+ default:
+ return 0;
}
}
-GLint __glTexEnviv_size(GLenum e)
+GLint
+__glTexEnviv_size(GLenum e)
{
return __glTexEnvfv_size(e);
}
-GLint __glTexImage1D_size(GLenum format, GLenum type, GLsizei w)
+GLint
+__glTexImage1D_size(GLenum format, GLenum type, GLsizei w)
{
GLint elements, esize;
- if (w < 0) return 0;
+ if (w < 0)
+ return 0;
switch (format) {
- case GL_COLOR_INDEX:
- elements = 1;
- break;
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- elements = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- elements = 2;
- break;
- case GL_RGB:
- elements = 3;
- break;
- case GL_RGBA:
- case GL_ABGR_EXT:
- elements = 4;
- break;
- default:
- return 0;
+ case GL_COLOR_INDEX:
+ elements = 1;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ case GL_ABGR_EXT:
+ elements = 4;
+ break;
+ default:
+ return 0;
}
switch (type) {
- case GL_BITMAP:
- if (format == GL_COLOR_INDEX) {
- return (w+7)/8;
- } else {
- return 0;
- }
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- esize = 1;
- break;
- case GL_UNSIGNED_BYTE_3_3_2:
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- esize = 1;
- elements = 1;
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- esize = 2;
- break;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- esize = 2;
- elements = 1;
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- esize = 4;
- break;
- case GL_UNSIGNED_INT_8_8_8_8:
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- esize = 4;
- elements = 1;
- break;
- default:
- return 0;
+ case GL_BITMAP:
+ if (format == GL_COLOR_INDEX) {
+ return (w + 7) / 8;
+ }
+ else {
+ return 0;
+ }
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ esize = 1;
+ elements = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ esize = 2;
+ elements = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ esize = 4;
+ elements = 1;
+ break;
+ default:
+ return 0;
}
return elements * esize * w;
}
-GLint __glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h)
+GLint
+__glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h)
{
GLint elements, esize;
- if (w < 0) return 0;
- if (h < 0) return 0;
+ if (w < 0)
+ return 0;
+ if (h < 0)
+ return 0;
switch (format) {
- case GL_COLOR_INDEX:
- elements = 1;
- break;
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- elements = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- elements = 2;
- break;
- case GL_RGB:
- elements = 3;
- break;
- case GL_RGBA:
- case GL_ABGR_EXT:
- elements = 4;
- break;
- default:
- return 0;
+ case GL_COLOR_INDEX:
+ elements = 1;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ case GL_ABGR_EXT:
+ elements = 4;
+ break;
+ default:
+ return 0;
}
switch (type) {
- case GL_BITMAP:
- if (format == GL_COLOR_INDEX) {
- return (h * ((w+7)/8));
- } else {
- return 0;
- }
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- esize = 1;
- break;
- case GL_UNSIGNED_BYTE_3_3_2:
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- esize = 1;
- elements = 1;
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- esize = 2;
- break;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- esize = 2;
- elements = 1;
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- esize = 4;
- break;
- case GL_UNSIGNED_INT_8_8_8_8:
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- esize = 4;
- elements = 1;
- break;
- default:
- return 0;
+ case GL_BITMAP:
+ if (format == GL_COLOR_INDEX) {
+ return (h * ((w + 7) / 8));
+ }
+ else {
+ return 0;
+ }
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ esize = 1;
+ elements = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ esize = 2;
+ elements = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ esize = 4;
+ elements = 1;
+ break;
+ default:
+ return 0;
}
return elements * esize * w * h;
}
-GLint __glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h,
- GLsizei d)
+GLint
+__glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h, GLsizei d)
{
GLint elements, esize;
- if (w < 0) return 0;
- if (h < 0) return 0;
- if (d < 0) return 0;
+ if (w < 0)
+ return 0;
+ if (h < 0)
+ return 0;
+ if (d < 0)
+ return 0;
switch (format) {
- case GL_COLOR_INDEX:
- elements = 1;
- break;
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- elements = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- elements = 2;
- break;
- case GL_RGB:
- elements = 3;
- break;
- case GL_RGBA:
- case GL_ABGR_EXT:
- elements = 4;
- break;
- default:
- return 0;
+ case GL_COLOR_INDEX:
+ elements = 1;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ case GL_ABGR_EXT:
+ elements = 4;
+ break;
+ default:
+ return 0;
}
switch (type) {
- case GL_BITMAP:
- if (format == GL_COLOR_INDEX) {
- return (d * (h * ((w+7)/8)));
- } else {
- return 0;
- }
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- esize = 1;
- break;
- case GL_UNSIGNED_BYTE_3_3_2:
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- esize = 1;
- elements = 1;
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- esize = 2;
- break;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- esize = 2;
- elements = 1;
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- esize = 4;
- break;
- case GL_UNSIGNED_INT_8_8_8_8:
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- esize = 4;
- elements = 1;
- break;
- default:
- return 0;
+ case GL_BITMAP:
+ if (format == GL_COLOR_INDEX) {
+ return (d * (h * ((w + 7) / 8)));
+ }
+ else {
+ return 0;
+ }
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ esize = 1;
+ elements = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ esize = 2;
+ elements = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ esize = 4;
+ elements = 1;
+ break;
+ default:
+ return 0;
}
return elements * esize * w * h * d;
}
-GLint __glLightfv_size(GLenum pname)
+GLint
+__glLightfv_size(GLenum pname)
{
switch (pname) {
- case GL_SPOT_EXPONENT: return 1;
- case GL_SPOT_CUTOFF: return 1;
- case GL_AMBIENT: return 4;
- case GL_DIFFUSE: return 4;
- case GL_SPECULAR: return 4;
- case GL_POSITION: return 4;
- case GL_SPOT_DIRECTION: return 3;
- case GL_CONSTANT_ATTENUATION: return 1;
- case GL_LINEAR_ATTENUATION: return 1;
- case GL_QUADRATIC_ATTENUATION: return 1;
- default:
- return 0;
+ case GL_SPOT_EXPONENT:
+ return 1;
+ case GL_SPOT_CUTOFF:
+ return 1;
+ case GL_AMBIENT:
+ return 4;
+ case GL_DIFFUSE:
+ return 4;
+ case GL_SPECULAR:
+ return 4;
+ case GL_POSITION:
+ return 4;
+ case GL_SPOT_DIRECTION:
+ return 3;
+ case GL_CONSTANT_ATTENUATION:
+ return 1;
+ case GL_LINEAR_ATTENUATION:
+ return 1;
+ case GL_QUADRATIC_ATTENUATION:
+ return 1;
+ default:
+ return 0;
}
}
-GLint __glLightiv_size(GLenum pname)
+GLint
+__glLightiv_size(GLenum pname)
{
return __glLightfv_size(pname);
}
-GLint __glLightModelfv_size(GLenum pname)
+GLint
+__glLightModelfv_size(GLenum pname)
{
switch (pname) {
- case GL_LIGHT_MODEL_AMBIENT: return 4;
- case GL_LIGHT_MODEL_LOCAL_VIEWER: return 1;
- case GL_LIGHT_MODEL_TWO_SIDE: return 1;
- case GL_LIGHT_MODEL_COLOR_CONTROL: return 1;
- default:
- return 0;
+ case GL_LIGHT_MODEL_AMBIENT:
+ return 4;
+ case GL_LIGHT_MODEL_LOCAL_VIEWER:
+ return 1;
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ return 1;
+ case GL_LIGHT_MODEL_COLOR_CONTROL:
+ return 1;
+ default:
+ return 0;
}
}
-GLint __glLightModeliv_size(GLenum pname)
+GLint
+__glLightModeliv_size(GLenum pname)
{
return __glLightModelfv_size(pname);
}
-GLint __glMaterialfv_size(GLenum pname)
+GLint
+__glMaterialfv_size(GLenum pname)
{
switch (pname) {
- case GL_SHININESS: return 1;
- case GL_EMISSION: return 4;
- case GL_AMBIENT: return 4;
- case GL_DIFFUSE: return 4;
- case GL_SPECULAR: return 4;
- case GL_AMBIENT_AND_DIFFUSE: return 4;
- case GL_COLOR_INDEXES: return 3;
- default:
- return 0;
+ case GL_SHININESS:
+ return 1;
+ case GL_EMISSION:
+ return 4;
+ case GL_AMBIENT:
+ return 4;
+ case GL_DIFFUSE:
+ return 4;
+ case GL_SPECULAR:
+ return 4;
+ case GL_AMBIENT_AND_DIFFUSE:
+ return 4;
+ case GL_COLOR_INDEXES:
+ return 3;
+ default:
+ return 0;
}
}
-GLint __glMaterialiv_size(GLenum pname)
+GLint
+__glMaterialiv_size(GLenum pname)
{
return __glMaterialfv_size(pname);
}
-GLint __glColorTableParameterfv_size(GLenum pname)
+GLint
+__glColorTableParameterfv_size(GLenum pname)
{
switch (pname) {
- case GL_COLOR_TABLE_FORMAT:
- case GL_COLOR_TABLE_WIDTH:
- case GL_COLOR_TABLE_RED_SIZE:
- case GL_COLOR_TABLE_GREEN_SIZE:
- case GL_COLOR_TABLE_BLUE_SIZE:
- case GL_COLOR_TABLE_ALPHA_SIZE:
- case GL_COLOR_TABLE_LUMINANCE_SIZE:
- case GL_COLOR_TABLE_INTENSITY_SIZE:
- return 1;
- case GL_COLOR_TABLE_SCALE:
- case GL_COLOR_TABLE_BIAS:
- return 4;
- default:
- return -1;
+ case GL_COLOR_TABLE_FORMAT:
+ case GL_COLOR_TABLE_WIDTH:
+ case GL_COLOR_TABLE_RED_SIZE:
+ case GL_COLOR_TABLE_GREEN_SIZE:
+ case GL_COLOR_TABLE_BLUE_SIZE:
+ case GL_COLOR_TABLE_ALPHA_SIZE:
+ case GL_COLOR_TABLE_LUMINANCE_SIZE:
+ case GL_COLOR_TABLE_INTENSITY_SIZE:
+ return 1;
+ case GL_COLOR_TABLE_SCALE:
+ case GL_COLOR_TABLE_BIAS:
+ return 4;
+ default:
+ return -1;
}
}
-GLint __glColorTableParameteriv_size(GLenum pname)
+GLint
+__glColorTableParameteriv_size(GLenum pname)
{
return __glColorTableParameterfv_size(pname);
}
-GLint __glConvolutionParameterfv_size(GLenum pname)
+GLint
+__glConvolutionParameterfv_size(GLenum pname)
{
- switch(pname) {
- case GL_CONVOLUTION_BORDER_MODE:
- return 1;
- case GL_CONVOLUTION_BORDER_COLOR:
- case GL_CONVOLUTION_FILTER_SCALE:
- case GL_CONVOLUTION_FILTER_BIAS:
- return 4;
- default: /* error: bad enum value */
- return -1;
+ switch (pname) {
+ case GL_CONVOLUTION_BORDER_MODE:
+ return 1;
+ case GL_CONVOLUTION_BORDER_COLOR:
+ case GL_CONVOLUTION_FILTER_SCALE:
+ case GL_CONVOLUTION_FILTER_BIAS:
+ return 4;
+ default: /* error: bad enum value */
+ return -1;
}
}
-GLint __glConvolutionParameteriv_size(GLenum pname)
+GLint
+__glConvolutionParameteriv_size(GLenum pname)
{
return __glConvolutionParameterfv_size(pname);
}
diff --git a/xorg-server/hw/dmx/glxProxy/g_disptab.c b/xorg-server/hw/dmx/glxProxy/g_disptab.c
index 3f0a6e77e..46177c4cc 100644
--- a/xorg-server/hw/dmx/glxProxy/g_disptab.c
+++ b/xorg-server/hw/dmx/glxProxy/g_disptab.c
@@ -35,578 +35,576 @@
#include "glxsingle.h"
__GLXdispatchSingleProcPtr __glXSingleTable[] = {
- __glXNoSuchSingleOpcode,
- __glXRender,
- __glXRenderLarge,
- __glXCreateContext,
- __glXDestroyContext,
- __glXMakeCurrent,
- __glXIsDirect,
- __glXQueryVersion,
- __glXWaitGL,
- __glXWaitX,
- __glXCopyContext,
- __glXSwapBuffers,
- __glXUseXFont,
- __glXCreateGLXPixmap,
- __glXGetVisualConfigs,
- __glXDestroyGLXPixmap,
- __glXVendorPrivate,
- __glXVendorPrivateWithReply,
- __glXQueryExtensionsString,
- __glXQueryServerString,
- __glXClientInfo,
- __glXGetFBConfigs, /* __glXGetFBConfigs */
- __glXCreatePixmap, /* __glXCreatePixmap,*/
- __glXDestroyGLXPixmap, /* __glXDestroyPixmap,*/
- __glXCreateNewContext, /* __glXCreateNewContext,*/
- __glXQueryContext, /* __glXQueryContext,*/
- __glXMakeContextCurrent, /* __glXMakeContextCurrent,*/
- __glXCreatePbuffer, /* __glXCreatePbuffer,*/
- __glXDestroyPbuffer, /* __glXDestroyPbuffer,*/
- __glXGetDrawableAttributes, /* __glXGetDrawableAttributes,*/
- __glXChangeDrawableAttributes, /* __glXChangeDrawableAttributes,*/
- __glXCreateWindow, /* __glXCreateWindow,*/
- __glXDestroyWindow, /* __glXDestroyWindow,*/
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXForwardSingleReq, /* __glXDisp_NewList, */
- __glXForwardSingleReq, /* __glXDisp_EndList, */
- __glXForwardSingleReq, /* __glXDisp_DeleteLists, */
- __glXForwardPipe0WithReply, /* __glXDisp_GenLists, */
- __glXForwardSingleReq, /* __glXDisp_FeedbackBuffer, */
- __glXForwardSingleReq, /* __glXDisp_SelectBuffer, */
- __glXForwardAllWithReply, /* __glXDisp_RenderMode, */
- __glXForwardAllWithReply, /* __glXDisp_Finish, */
- __glXForwardSingleReq, /* __glXDisp_PixelStoref, */
- __glXForwardSingleReq, /* __glXDisp_PixelStorei, */
- __glXDisp_ReadPixels, /* __glXDisp_ReadPixels, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetBooleanv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetClipPlane, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetDoublev, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetError, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetFloatv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetIntegerv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetLightfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetLightiv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetMapdv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetMapfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetMapiv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetMaterialfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetMaterialiv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapuiv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapusv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetPolygonStipple, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetString, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexEnvfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexEnviv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexGendv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexGenfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexGeniv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexImage, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexParameterfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexParameteriv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexLevelParameterfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetTexLevelParameteriv, */
- __glXForwardPipe0WithReply, /* __glXDisp_IsEnabled, */
- __glXForwardPipe0WithReply, /* __glXDisp_IsList, */
- __glXForwardSingleReq, /* __glXDisp_Flush, */
- __glXForwardPipe0WithReply, /* __glXDisp_AreTexturesResident, */
- __glXForwardSingleReq, /* __glXDisp_DeleteTextures, */
- __glXForwardAllWithReply, /* __glXDisp_GenTextures, */
- __glXForwardPipe0WithReply, /* __glXDisp_IsTexture, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetColorTable, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetColorTableParameterfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetColorTableParameteriv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionFilter, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionParameterfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionParameteriv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetSeparableFilter, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetHistogram, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetHistogramParameterfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetHistogramParameteriv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetMinmax, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetMinmaxParameterfv, */
- __glXForwardPipe0WithReply, /* __glXDisp_GetMinmaxParameteriv, */
+ __glXNoSuchSingleOpcode,
+ __glXRender,
+ __glXRenderLarge,
+ __glXCreateContext,
+ __glXDestroyContext,
+ __glXMakeCurrent,
+ __glXIsDirect,
+ __glXQueryVersion,
+ __glXWaitGL,
+ __glXWaitX,
+ __glXCopyContext,
+ __glXSwapBuffers,
+ __glXUseXFont,
+ __glXCreateGLXPixmap,
+ __glXGetVisualConfigs,
+ __glXDestroyGLXPixmap,
+ __glXVendorPrivate,
+ __glXVendorPrivateWithReply,
+ __glXQueryExtensionsString,
+ __glXQueryServerString,
+ __glXClientInfo,
+ __glXGetFBConfigs, /* __glXGetFBConfigs */
+ __glXCreatePixmap, /* __glXCreatePixmap, */
+ __glXDestroyGLXPixmap, /* __glXDestroyPixmap, */
+ __glXCreateNewContext, /* __glXCreateNewContext, */
+ __glXQueryContext, /* __glXQueryContext, */
+ __glXMakeContextCurrent, /* __glXMakeContextCurrent, */
+ __glXCreatePbuffer, /* __glXCreatePbuffer, */
+ __glXDestroyPbuffer, /* __glXDestroyPbuffer, */
+ __glXGetDrawableAttributes, /* __glXGetDrawableAttributes, */
+ __glXChangeDrawableAttributes, /* __glXChangeDrawableAttributes, */
+ __glXCreateWindow, /* __glXCreateWindow, */
+ __glXDestroyWindow, /* __glXDestroyWindow, */
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXForwardSingleReq, /* __glXDisp_NewList, */
+ __glXForwardSingleReq, /* __glXDisp_EndList, */
+ __glXForwardSingleReq, /* __glXDisp_DeleteLists, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GenLists, */
+ __glXForwardSingleReq, /* __glXDisp_FeedbackBuffer, */
+ __glXForwardSingleReq, /* __glXDisp_SelectBuffer, */
+ __glXForwardAllWithReply, /* __glXDisp_RenderMode, */
+ __glXForwardAllWithReply, /* __glXDisp_Finish, */
+ __glXForwardSingleReq, /* __glXDisp_PixelStoref, */
+ __glXForwardSingleReq, /* __glXDisp_PixelStorei, */
+ __glXDisp_ReadPixels, /* __glXDisp_ReadPixels, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetBooleanv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetClipPlane, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetDoublev, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetError, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetFloatv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetIntegerv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetLightfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetLightiv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMapdv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMapfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMapiv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMaterialfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMaterialiv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapuiv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapusv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetPolygonStipple, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetString, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexEnvfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexEnviv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexGendv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexGenfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexGeniv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexImage, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexParameterfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexParameteriv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexLevelParameterfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetTexLevelParameteriv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_IsEnabled, */
+ __glXForwardPipe0WithReply, /* __glXDisp_IsList, */
+ __glXForwardSingleReq, /* __glXDisp_Flush, */
+ __glXForwardPipe0WithReply, /* __glXDisp_AreTexturesResident, */
+ __glXForwardSingleReq, /* __glXDisp_DeleteTextures, */
+ __glXForwardAllWithReply, /* __glXDisp_GenTextures, */
+ __glXForwardPipe0WithReply, /* __glXDisp_IsTexture, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetColorTable, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetColorTableParameterfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetColorTableParameteriv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionFilter, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionParameterfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionParameteriv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetSeparableFilter, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetHistogram, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetHistogramParameterfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetHistogramParameteriv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMinmax, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMinmaxParameterfv, */
+ __glXForwardPipe0WithReply, /* __glXDisp_GetMinmaxParameteriv, */
};
__GLXdispatchSingleProcPtr __glXSwapSingleTable[] = {
- __glXNoSuchSingleOpcode,
- __glXSwapRender,
- __glXSwapRenderLarge,
- __glXSwapCreateContext,
- __glXSwapDestroyContext,
- __glXSwapMakeCurrent,
- __glXSwapIsDirect,
- __glXSwapQueryVersion,
- __glXSwapWaitGL,
- __glXSwapWaitX,
- __glXSwapCopyContext,
- __glXSwapSwapBuffers,
- __glXSwapUseXFont,
- __glXSwapCreateGLXPixmap,
- __glXSwapGetVisualConfigs,
- __glXSwapDestroyGLXPixmap,
- __glXSwapVendorPrivate,
- __glXSwapVendorPrivateWithReply,
- __glXSwapQueryExtensionsString,
- __glXSwapQueryServerString,
- __glXSwapClientInfo,
- __glXSwapGetFBConfigs,
- __glXSwapCreatePixmap,
- __glXSwapDestroyGLXPixmap,
- __glXSwapCreateNewContext,
- __glXSwapQueryContext,
- __glXSwapMakeContextCurrent,
- __glXSwapCreatePbuffer,
- __glXSwapDestroyPbuffer,
- __glXSwapGetDrawableAttributes,
- __glXSwapChangeDrawableAttributes,
- __glXSwapCreateWindow,
- __glXSwapDestroyWindow,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXNoSuchSingleOpcode,
- __glXForwardSingleReqSwap, /* __glXDisp_NewList, */
- __glXForwardSingleReqSwap, /* __glXDisp_EndList, */
- __glXForwardSingleReqSwap, /* __glXDisp_DeleteLists, */
- __glXForwardPipe0WithReplySwap, /* __glXDisp_GenLists, */
- __glXForwardSingleReqSwap, /* __glXDisp_FeedbackBuffer, */
- __glXForwardSingleReqSwap, /* __glXDisp_SelectBuffer, */
- __glXForwardAllWithReplySwapiv, /* __glXDisp_RenderMode, */
- __glXForwardAllWithReplySwap, /* __glXDisp_Finish, */
- __glXForwardSingleReqSwap, /* __glXDisp_PixelStoref, */
- __glXForwardSingleReqSwap, /* __glXDisp_PixelStorei, */
- __glXDisp_ReadPixels, /* __glXDisp_ReadPixels, */
- __glXForwardPipe0WithReplySwap, /* __glXDisp_GetBooleanv, */
- __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetClipPlane, */
- __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetDoublev, */
- __glXForwardPipe0WithReplySwap, /* __glXDisp_GetError, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetFloatv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetIntegerv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetLightfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetLightiv, */
- __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetMapdv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMapfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMapiv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMaterialfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMaterialiv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetPixelMapfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetPixelMapuiv, */
- __glXForwardPipe0WithReplySwapsv, /* __glXDisp_GetPixelMapusv, */
- __glXForwardPipe0WithReplySwap, /* __glXDisp_GetPolygonStipple, */
- __glXForwardPipe0WithReplySwap, /* __glXDisp_GetString, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexEnvfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexEnviv, */
- __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetTexGendv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexGenfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexGeniv, */
- __glXDispSwap_GetTexImage, /* __glXDisp_GetTexImage, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexParameterfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexParameteriv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexLevelParameterfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexLevelParameteriv, */
- __glXForwardPipe0WithReplySwap, /* __glXDisp_IsEnabled, */
- __glXForwardPipe0WithReplySwap, /* __glXDisp_IsList, */
- __glXForwardSingleReqSwap, /* __glXDisp_Flush, */
- __glXForwardPipe0WithReplySwap, /* __glXDisp_AreTexturesResident, */
- __glXForwardSingleReqSwap, /* __glXDisp_DeleteTextures, */
- __glXForwardAllWithReplySwapiv, /* __glXDisp_GenTextures, */
- __glXForwardPipe0WithReplySwap, /* __glXDisp_IsTexture, */
- __glXDispSwap_GetColorTable, /* __glXDisp_GetColorTable, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetColorTableParameterfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetColorTableParameteriv, */
- __glXDispSwap_GetColorTable, /* __glXDisp_GetConvolutionFilter, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetConvolutionParameterfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetConvolutionParameteriv, */
- __glXDispSwap_GetColorTable, /* __glXDisp_GetSeparableFilter, */
- __glXDispSwap_GetColorTable, /* __glXDisp_GetHistogram, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetHistogramParameterfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetHistogramParameteriv, */
- __glXDispSwap_GetColorTable, /* __glXDisp_GetMinmax, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMinmaxParameterfv, */
- __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMinmaxParameteriv, */
+ __glXNoSuchSingleOpcode,
+ __glXSwapRender,
+ __glXSwapRenderLarge,
+ __glXSwapCreateContext,
+ __glXSwapDestroyContext,
+ __glXSwapMakeCurrent,
+ __glXSwapIsDirect,
+ __glXSwapQueryVersion,
+ __glXSwapWaitGL,
+ __glXSwapWaitX,
+ __glXSwapCopyContext,
+ __glXSwapSwapBuffers,
+ __glXSwapUseXFont,
+ __glXSwapCreateGLXPixmap,
+ __glXSwapGetVisualConfigs,
+ __glXSwapDestroyGLXPixmap,
+ __glXSwapVendorPrivate,
+ __glXSwapVendorPrivateWithReply,
+ __glXSwapQueryExtensionsString,
+ __glXSwapQueryServerString,
+ __glXSwapClientInfo,
+ __glXSwapGetFBConfigs,
+ __glXSwapCreatePixmap,
+ __glXSwapDestroyGLXPixmap,
+ __glXSwapCreateNewContext,
+ __glXSwapQueryContext,
+ __glXSwapMakeContextCurrent,
+ __glXSwapCreatePbuffer,
+ __glXSwapDestroyPbuffer,
+ __glXSwapGetDrawableAttributes,
+ __glXSwapChangeDrawableAttributes,
+ __glXSwapCreateWindow,
+ __glXSwapDestroyWindow,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXNoSuchSingleOpcode,
+ __glXForwardSingleReqSwap, /* __glXDisp_NewList, */
+ __glXForwardSingleReqSwap, /* __glXDisp_EndList, */
+ __glXForwardSingleReqSwap, /* __glXDisp_DeleteLists, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_GenLists, */
+ __glXForwardSingleReqSwap, /* __glXDisp_FeedbackBuffer, */
+ __glXForwardSingleReqSwap, /* __glXDisp_SelectBuffer, */
+ __glXForwardAllWithReplySwapiv, /* __glXDisp_RenderMode, */
+ __glXForwardAllWithReplySwap, /* __glXDisp_Finish, */
+ __glXForwardSingleReqSwap, /* __glXDisp_PixelStoref, */
+ __glXForwardSingleReqSwap, /* __glXDisp_PixelStorei, */
+ __glXDisp_ReadPixels, /* __glXDisp_ReadPixels, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_GetBooleanv, */
+ __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetClipPlane, */
+ __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetDoublev, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_GetError, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetFloatv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetIntegerv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetLightfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetLightiv, */
+ __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetMapdv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMapfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMapiv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMaterialfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMaterialiv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetPixelMapfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetPixelMapuiv, */
+ __glXForwardPipe0WithReplySwapsv, /* __glXDisp_GetPixelMapusv, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_GetPolygonStipple, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_GetString, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexEnvfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexEnviv, */
+ __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetTexGendv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexGenfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexGeniv, */
+ __glXDispSwap_GetTexImage, /* __glXDisp_GetTexImage, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexParameterfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexParameteriv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexLevelParameterfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexLevelParameteriv, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_IsEnabled, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_IsList, */
+ __glXForwardSingleReqSwap, /* __glXDisp_Flush, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_AreTexturesResident, */
+ __glXForwardSingleReqSwap, /* __glXDisp_DeleteTextures, */
+ __glXForwardAllWithReplySwapiv, /* __glXDisp_GenTextures, */
+ __glXForwardPipe0WithReplySwap, /* __glXDisp_IsTexture, */
+ __glXDispSwap_GetColorTable, /* __glXDisp_GetColorTable, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetColorTableParameterfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetColorTableParameteriv, */
+ __glXDispSwap_GetColorTable, /* __glXDisp_GetConvolutionFilter, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetConvolutionParameterfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetConvolutionParameteriv, */
+ __glXDispSwap_GetColorTable, /* __glXDisp_GetSeparableFilter, */
+ __glXDispSwap_GetColorTable, /* __glXDisp_GetHistogram, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetHistogramParameterfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetHistogramParameteriv, */
+ __glXDispSwap_GetColorTable, /* __glXDisp_GetMinmax, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMinmaxParameterfv, */
+ __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMinmaxParameteriv, */
};
__GLXdispatchRenderProcPtr __glXSwapRenderTable[] = {
- __glXNoSuchRenderOpcode,
- __glXDispSwap_CallList,
- __glXDispSwap_CallLists,
- __glXDispSwap_ListBase,
- __glXDispSwap_Begin,
- __glXDispSwap_Bitmap,
- __glXDispSwap_Color3bv,
- __glXDispSwap_Color3dv,
- __glXDispSwap_Color3fv,
- __glXDispSwap_Color3iv,
- __glXDispSwap_Color3sv,
- __glXDispSwap_Color3ubv,
- __glXDispSwap_Color3uiv,
- __glXDispSwap_Color3usv,
- __glXDispSwap_Color4bv,
- __glXDispSwap_Color4dv,
- __glXDispSwap_Color4fv,
- __glXDispSwap_Color4iv,
- __glXDispSwap_Color4sv,
- __glXDispSwap_Color4ubv,
- __glXDispSwap_Color4uiv,
- __glXDispSwap_Color4usv,
- __glXDispSwap_EdgeFlagv,
- __glXDispSwap_End,
- __glXDispSwap_Indexdv,
- __glXDispSwap_Indexfv,
- __glXDispSwap_Indexiv,
- __glXDispSwap_Indexsv,
- __glXDispSwap_Normal3bv,
- __glXDispSwap_Normal3dv,
- __glXDispSwap_Normal3fv,
- __glXDispSwap_Normal3iv,
- __glXDispSwap_Normal3sv,
- __glXDispSwap_RasterPos2dv,
- __glXDispSwap_RasterPos2fv,
- __glXDispSwap_RasterPos2iv,
- __glXDispSwap_RasterPos2sv,
- __glXDispSwap_RasterPos3dv,
- __glXDispSwap_RasterPos3fv,
- __glXDispSwap_RasterPos3iv,
- __glXDispSwap_RasterPos3sv,
- __glXDispSwap_RasterPos4dv,
- __glXDispSwap_RasterPos4fv,
- __glXDispSwap_RasterPos4iv,
- __glXDispSwap_RasterPos4sv,
- __glXDispSwap_Rectdv,
- __glXDispSwap_Rectfv,
- __glXDispSwap_Rectiv,
- __glXDispSwap_Rectsv,
- __glXDispSwap_TexCoord1dv,
- __glXDispSwap_TexCoord1fv,
- __glXDispSwap_TexCoord1iv,
- __glXDispSwap_TexCoord1sv,
- __glXDispSwap_TexCoord2dv,
- __glXDispSwap_TexCoord2fv,
- __glXDispSwap_TexCoord2iv,
- __glXDispSwap_TexCoord2sv,
- __glXDispSwap_TexCoord3dv,
- __glXDispSwap_TexCoord3fv,
- __glXDispSwap_TexCoord3iv,
- __glXDispSwap_TexCoord3sv,
- __glXDispSwap_TexCoord4dv,
- __glXDispSwap_TexCoord4fv,
- __glXDispSwap_TexCoord4iv,
- __glXDispSwap_TexCoord4sv,
- __glXDispSwap_Vertex2dv,
- __glXDispSwap_Vertex2fv,
- __glXDispSwap_Vertex2iv,
- __glXDispSwap_Vertex2sv,
- __glXDispSwap_Vertex3dv,
- __glXDispSwap_Vertex3fv,
- __glXDispSwap_Vertex3iv,
- __glXDispSwap_Vertex3sv,
- __glXDispSwap_Vertex4dv,
- __glXDispSwap_Vertex4fv,
- __glXDispSwap_Vertex4iv,
- __glXDispSwap_Vertex4sv,
- __glXDispSwap_ClipPlane,
- __glXDispSwap_ColorMaterial,
- __glXDispSwap_CullFace,
- __glXDispSwap_Fogf,
- __glXDispSwap_Fogfv,
- __glXDispSwap_Fogi,
- __glXDispSwap_Fogiv,
- __glXDispSwap_FrontFace,
- __glXDispSwap_Hint,
- __glXDispSwap_Lightf,
- __glXDispSwap_Lightfv,
- __glXDispSwap_Lighti,
- __glXDispSwap_Lightiv,
- __glXDispSwap_LightModelf,
- __glXDispSwap_LightModelfv,
- __glXDispSwap_LightModeli,
- __glXDispSwap_LightModeliv,
- __glXDispSwap_LineStipple,
- __glXDispSwap_LineWidth,
- __glXDispSwap_Materialf,
- __glXDispSwap_Materialfv,
- __glXDispSwap_Materiali,
- __glXDispSwap_Materialiv,
- __glXDispSwap_PointSize,
- __glXDispSwap_PolygonMode,
- __glXDispSwap_PolygonStipple,
- __glXDispSwap_Scissor,
- __glXDispSwap_ShadeModel,
- __glXDispSwap_TexParameterf,
- __glXDispSwap_TexParameterfv,
- __glXDispSwap_TexParameteri,
- __glXDispSwap_TexParameteriv,
- __glXDispSwap_TexImage1D,
- __glXDispSwap_TexImage2D,
- __glXDispSwap_TexEnvf,
- __glXDispSwap_TexEnvfv,
- __glXDispSwap_TexEnvi,
- __glXDispSwap_TexEnviv,
- __glXDispSwap_TexGend,
- __glXDispSwap_TexGendv,
- __glXDispSwap_TexGenf,
- __glXDispSwap_TexGenfv,
- __glXDispSwap_TexGeni,
- __glXDispSwap_TexGeniv,
- __glXDispSwap_InitNames,
- __glXDispSwap_LoadName,
- __glXDispSwap_PassThrough,
- __glXDispSwap_PopName,
- __glXDispSwap_PushName,
- __glXDispSwap_DrawBuffer,
- __glXDispSwap_Clear,
- __glXDispSwap_ClearAccum,
- __glXDispSwap_ClearIndex,
- __glXDispSwap_ClearColor,
- __glXDispSwap_ClearStencil,
- __glXDispSwap_ClearDepth,
- __glXDispSwap_StencilMask,
- __glXDispSwap_ColorMask,
- __glXDispSwap_DepthMask,
- __glXDispSwap_IndexMask,
- __glXDispSwap_Accum,
- __glXDispSwap_Disable,
- __glXDispSwap_Enable,
- __glXNoSuchRenderOpcode,
- __glXDispSwap_PopAttrib,
- __glXDispSwap_PushAttrib,
- __glXDispSwap_Map1d,
- __glXDispSwap_Map1f,
- __glXDispSwap_Map2d,
- __glXDispSwap_Map2f,
- __glXDispSwap_MapGrid1d,
- __glXDispSwap_MapGrid1f,
- __glXDispSwap_MapGrid2d,
- __glXDispSwap_MapGrid2f,
- __glXDispSwap_EvalCoord1dv,
- __glXDispSwap_EvalCoord1fv,
- __glXDispSwap_EvalCoord2dv,
- __glXDispSwap_EvalCoord2fv,
- __glXDispSwap_EvalMesh1,
- __glXDispSwap_EvalPoint1,
- __glXDispSwap_EvalMesh2,
- __glXDispSwap_EvalPoint2,
- __glXDispSwap_AlphaFunc,
- __glXDispSwap_BlendFunc,
- __glXDispSwap_LogicOp,
- __glXDispSwap_StencilFunc,
- __glXDispSwap_StencilOp,
- __glXDispSwap_DepthFunc,
- __glXDispSwap_PixelZoom,
- __glXDispSwap_PixelTransferf,
- __glXDispSwap_PixelTransferi,
- __glXDispSwap_PixelMapfv,
- __glXDispSwap_PixelMapuiv,
- __glXDispSwap_PixelMapusv,
- __glXDispSwap_ReadBuffer,
- __glXDispSwap_CopyPixels,
- __glXDispSwap_DrawPixels,
- __glXDispSwap_DepthRange,
- __glXDispSwap_Frustum,
- __glXDispSwap_LoadIdentity,
- __glXDispSwap_LoadMatrixf,
- __glXDispSwap_LoadMatrixd,
- __glXDispSwap_MatrixMode,
- __glXDispSwap_MultMatrixf,
- __glXDispSwap_MultMatrixd,
- __glXDispSwap_Ortho,
- __glXDispSwap_PopMatrix,
- __glXDispSwap_PushMatrix,
- __glXDispSwap_Rotated,
- __glXDispSwap_Rotatef,
- __glXDispSwap_Scaled,
- __glXDispSwap_Scalef,
- __glXDispSwap_Translated,
- __glXDispSwap_Translatef,
- __glXDispSwap_Viewport,
- __glXDispSwap_PolygonOffset,
- __glXDispSwap_DrawArrays,
- __glXDispSwap_Indexubv,
- __glXDispSwap_ColorSubTable,
- __glXDispSwap_CopyColorSubTable,
- __glXDispSwap_ActiveTextureARB,
- __glXDispSwap_MultiTexCoord1dvARB,
- __glXDispSwap_MultiTexCoord1fvARB,
- __glXDispSwap_MultiTexCoord1ivARB,
- __glXDispSwap_MultiTexCoord1svARB,
- __glXDispSwap_MultiTexCoord2dvARB,
- __glXDispSwap_MultiTexCoord2fvARB,
- __glXDispSwap_MultiTexCoord2ivARB,
- __glXDispSwap_MultiTexCoord2svARB,
- __glXDispSwap_MultiTexCoord3dvARB,
- __glXDispSwap_MultiTexCoord3fvARB,
- __glXDispSwap_MultiTexCoord3ivARB,
- __glXDispSwap_MultiTexCoord3svARB,
- __glXDispSwap_MultiTexCoord4dvARB,
- __glXDispSwap_MultiTexCoord4fvARB,
- __glXDispSwap_MultiTexCoord4ivARB,
- __glXDispSwap_MultiTexCoord4svARB,
+ __glXNoSuchRenderOpcode,
+ __glXDispSwap_CallList,
+ __glXDispSwap_CallLists,
+ __glXDispSwap_ListBase,
+ __glXDispSwap_Begin,
+ __glXDispSwap_Bitmap,
+ __glXDispSwap_Color3bv,
+ __glXDispSwap_Color3dv,
+ __glXDispSwap_Color3fv,
+ __glXDispSwap_Color3iv,
+ __glXDispSwap_Color3sv,
+ __glXDispSwap_Color3ubv,
+ __glXDispSwap_Color3uiv,
+ __glXDispSwap_Color3usv,
+ __glXDispSwap_Color4bv,
+ __glXDispSwap_Color4dv,
+ __glXDispSwap_Color4fv,
+ __glXDispSwap_Color4iv,
+ __glXDispSwap_Color4sv,
+ __glXDispSwap_Color4ubv,
+ __glXDispSwap_Color4uiv,
+ __glXDispSwap_Color4usv,
+ __glXDispSwap_EdgeFlagv,
+ __glXDispSwap_End,
+ __glXDispSwap_Indexdv,
+ __glXDispSwap_Indexfv,
+ __glXDispSwap_Indexiv,
+ __glXDispSwap_Indexsv,
+ __glXDispSwap_Normal3bv,
+ __glXDispSwap_Normal3dv,
+ __glXDispSwap_Normal3fv,
+ __glXDispSwap_Normal3iv,
+ __glXDispSwap_Normal3sv,
+ __glXDispSwap_RasterPos2dv,
+ __glXDispSwap_RasterPos2fv,
+ __glXDispSwap_RasterPos2iv,
+ __glXDispSwap_RasterPos2sv,
+ __glXDispSwap_RasterPos3dv,
+ __glXDispSwap_RasterPos3fv,
+ __glXDispSwap_RasterPos3iv,
+ __glXDispSwap_RasterPos3sv,
+ __glXDispSwap_RasterPos4dv,
+ __glXDispSwap_RasterPos4fv,
+ __glXDispSwap_RasterPos4iv,
+ __glXDispSwap_RasterPos4sv,
+ __glXDispSwap_Rectdv,
+ __glXDispSwap_Rectfv,
+ __glXDispSwap_Rectiv,
+ __glXDispSwap_Rectsv,
+ __glXDispSwap_TexCoord1dv,
+ __glXDispSwap_TexCoord1fv,
+ __glXDispSwap_TexCoord1iv,
+ __glXDispSwap_TexCoord1sv,
+ __glXDispSwap_TexCoord2dv,
+ __glXDispSwap_TexCoord2fv,
+ __glXDispSwap_TexCoord2iv,
+ __glXDispSwap_TexCoord2sv,
+ __glXDispSwap_TexCoord3dv,
+ __glXDispSwap_TexCoord3fv,
+ __glXDispSwap_TexCoord3iv,
+ __glXDispSwap_TexCoord3sv,
+ __glXDispSwap_TexCoord4dv,
+ __glXDispSwap_TexCoord4fv,
+ __glXDispSwap_TexCoord4iv,
+ __glXDispSwap_TexCoord4sv,
+ __glXDispSwap_Vertex2dv,
+ __glXDispSwap_Vertex2fv,
+ __glXDispSwap_Vertex2iv,
+ __glXDispSwap_Vertex2sv,
+ __glXDispSwap_Vertex3dv,
+ __glXDispSwap_Vertex3fv,
+ __glXDispSwap_Vertex3iv,
+ __glXDispSwap_Vertex3sv,
+ __glXDispSwap_Vertex4dv,
+ __glXDispSwap_Vertex4fv,
+ __glXDispSwap_Vertex4iv,
+ __glXDispSwap_Vertex4sv,
+ __glXDispSwap_ClipPlane,
+ __glXDispSwap_ColorMaterial,
+ __glXDispSwap_CullFace,
+ __glXDispSwap_Fogf,
+ __glXDispSwap_Fogfv,
+ __glXDispSwap_Fogi,
+ __glXDispSwap_Fogiv,
+ __glXDispSwap_FrontFace,
+ __glXDispSwap_Hint,
+ __glXDispSwap_Lightf,
+ __glXDispSwap_Lightfv,
+ __glXDispSwap_Lighti,
+ __glXDispSwap_Lightiv,
+ __glXDispSwap_LightModelf,
+ __glXDispSwap_LightModelfv,
+ __glXDispSwap_LightModeli,
+ __glXDispSwap_LightModeliv,
+ __glXDispSwap_LineStipple,
+ __glXDispSwap_LineWidth,
+ __glXDispSwap_Materialf,
+ __glXDispSwap_Materialfv,
+ __glXDispSwap_Materiali,
+ __glXDispSwap_Materialiv,
+ __glXDispSwap_PointSize,
+ __glXDispSwap_PolygonMode,
+ __glXDispSwap_PolygonStipple,
+ __glXDispSwap_Scissor,
+ __glXDispSwap_ShadeModel,
+ __glXDispSwap_TexParameterf,
+ __glXDispSwap_TexParameterfv,
+ __glXDispSwap_TexParameteri,
+ __glXDispSwap_TexParameteriv,
+ __glXDispSwap_TexImage1D,
+ __glXDispSwap_TexImage2D,
+ __glXDispSwap_TexEnvf,
+ __glXDispSwap_TexEnvfv,
+ __glXDispSwap_TexEnvi,
+ __glXDispSwap_TexEnviv,
+ __glXDispSwap_TexGend,
+ __glXDispSwap_TexGendv,
+ __glXDispSwap_TexGenf,
+ __glXDispSwap_TexGenfv,
+ __glXDispSwap_TexGeni,
+ __glXDispSwap_TexGeniv,
+ __glXDispSwap_InitNames,
+ __glXDispSwap_LoadName,
+ __glXDispSwap_PassThrough,
+ __glXDispSwap_PopName,
+ __glXDispSwap_PushName,
+ __glXDispSwap_DrawBuffer,
+ __glXDispSwap_Clear,
+ __glXDispSwap_ClearAccum,
+ __glXDispSwap_ClearIndex,
+ __glXDispSwap_ClearColor,
+ __glXDispSwap_ClearStencil,
+ __glXDispSwap_ClearDepth,
+ __glXDispSwap_StencilMask,
+ __glXDispSwap_ColorMask,
+ __glXDispSwap_DepthMask,
+ __glXDispSwap_IndexMask,
+ __glXDispSwap_Accum,
+ __glXDispSwap_Disable,
+ __glXDispSwap_Enable,
+ __glXNoSuchRenderOpcode,
+ __glXDispSwap_PopAttrib,
+ __glXDispSwap_PushAttrib,
+ __glXDispSwap_Map1d,
+ __glXDispSwap_Map1f,
+ __glXDispSwap_Map2d,
+ __glXDispSwap_Map2f,
+ __glXDispSwap_MapGrid1d,
+ __glXDispSwap_MapGrid1f,
+ __glXDispSwap_MapGrid2d,
+ __glXDispSwap_MapGrid2f,
+ __glXDispSwap_EvalCoord1dv,
+ __glXDispSwap_EvalCoord1fv,
+ __glXDispSwap_EvalCoord2dv,
+ __glXDispSwap_EvalCoord2fv,
+ __glXDispSwap_EvalMesh1,
+ __glXDispSwap_EvalPoint1,
+ __glXDispSwap_EvalMesh2,
+ __glXDispSwap_EvalPoint2,
+ __glXDispSwap_AlphaFunc,
+ __glXDispSwap_BlendFunc,
+ __glXDispSwap_LogicOp,
+ __glXDispSwap_StencilFunc,
+ __glXDispSwap_StencilOp,
+ __glXDispSwap_DepthFunc,
+ __glXDispSwap_PixelZoom,
+ __glXDispSwap_PixelTransferf,
+ __glXDispSwap_PixelTransferi,
+ __glXDispSwap_PixelMapfv,
+ __glXDispSwap_PixelMapuiv,
+ __glXDispSwap_PixelMapusv,
+ __glXDispSwap_ReadBuffer,
+ __glXDispSwap_CopyPixels,
+ __glXDispSwap_DrawPixels,
+ __glXDispSwap_DepthRange,
+ __glXDispSwap_Frustum,
+ __glXDispSwap_LoadIdentity,
+ __glXDispSwap_LoadMatrixf,
+ __glXDispSwap_LoadMatrixd,
+ __glXDispSwap_MatrixMode,
+ __glXDispSwap_MultMatrixf,
+ __glXDispSwap_MultMatrixd,
+ __glXDispSwap_Ortho,
+ __glXDispSwap_PopMatrix,
+ __glXDispSwap_PushMatrix,
+ __glXDispSwap_Rotated,
+ __glXDispSwap_Rotatef,
+ __glXDispSwap_Scaled,
+ __glXDispSwap_Scalef,
+ __glXDispSwap_Translated,
+ __glXDispSwap_Translatef,
+ __glXDispSwap_Viewport,
+ __glXDispSwap_PolygonOffset,
+ __glXDispSwap_DrawArrays,
+ __glXDispSwap_Indexubv,
+ __glXDispSwap_ColorSubTable,
+ __glXDispSwap_CopyColorSubTable,
+ __glXDispSwap_ActiveTextureARB,
+ __glXDispSwap_MultiTexCoord1dvARB,
+ __glXDispSwap_MultiTexCoord1fvARB,
+ __glXDispSwap_MultiTexCoord1ivARB,
+ __glXDispSwap_MultiTexCoord1svARB,
+ __glXDispSwap_MultiTexCoord2dvARB,
+ __glXDispSwap_MultiTexCoord2fvARB,
+ __glXDispSwap_MultiTexCoord2ivARB,
+ __glXDispSwap_MultiTexCoord2svARB,
+ __glXDispSwap_MultiTexCoord3dvARB,
+ __glXDispSwap_MultiTexCoord3fvARB,
+ __glXDispSwap_MultiTexCoord3ivARB,
+ __glXDispSwap_MultiTexCoord3svARB,
+ __glXDispSwap_MultiTexCoord4dvARB,
+ __glXDispSwap_MultiTexCoord4fvARB,
+ __glXDispSwap_MultiTexCoord4ivARB,
+ __glXDispSwap_MultiTexCoord4svARB,
};
-__GLXRenderSwapInfo __glXSwapRenderTable_EXT[] =
-{
- {4, 4, NULL}, /* X_GLrop_BlendColorEXT */
- {4, 1, NULL}, /* X_GLrop_BlendEquationEXT */
- {4, 2, NULL}, /* X_GLrop_PolygonOffsetEXT */
- {4, 0, __glXDispSwap_TexSubImage1D}, /* X_GLrop_TexSubImage1DEXT */
- {4, 0, __glXDispSwap_TexSubImage2D}, /* X_GLrop_TexSubImage2DEXT */
- {4, 0, __glXDispSwap_ConvolutionFilter1D}, /* X_GLrop_ConvolutionFilter1DEXT */
- {4, 0, __glXDispSwap_ConvolutionFilter2D}, /* X_GLrop_ConvolutionFilter2DEXT */
- {4, 3, NULL}, /* X_GLrop_ConvolutionParameterfEXT */
- {4, 0, __glXDispSwap_ConvolutionParameterfv}, /* X_GLrop_ConvolutionParameterfvEXT */
- {4, 3, NULL}, /* X_GLrop_ConvolutionParameteriEXT */
- {4, 0, __glXDispSwap_ConvolutionParameteriv}, /* X_GLrop_ConvolutionParameterivEXT */
- {4, 0, __glXDispSwap_CopyConvolutionFilter1D}, /* X_GLrop_CopyConvolutionFilter1DEXT */
- {4, 0, __glXDispSwap_CopyConvolutionFilter2D}, /* X_GLrop_CopyConvolutionFilter2DEXT */
- {4, 0, __glXDispSwap_SeparableFilter2D}, /* X_GLrop_SeparableFilter2DEXT */
- {4, 3, NULL}, /* X_GLrop_HistogramEXT */
- {4, 2, NULL}, /* X_GLrop_MinmaxEXT */
- {4, 1, NULL}, /* X_GLrop_ResetHistogramEXT */
- {4, 1, NULL}, /* X_GLrop_ResetMinmaxEXT */
- {4, 0, __glXDispSwap_TexImage3D}, /* X_GLrop_TexImage3DEXT */
- {4, 0, __glXDispSwap_TexSubImage3D}, /* X_GLrop_TexSubImage3DEXT */
- {4, 0, __glXDispSwap_DrawArrays}, /* X_GLrop_DrawArraysEXT */
- {4, 2, NULL}, /* X_GLrop_BindTextureEXT */
- {4, 0, __glXDispSwap_PrioritizeTextures}, /* X_GLrop_PrioritizeTexturesEXT */
- {4, 0, __glXDispSwap_CopyTexImage1D}, /* X_GLrop_CopyTexImage1DEXT */
- {4, 0, __glXDispSwap_CopyTexImage2D}, /* X_GLrop_CopyTexImage2DEXT */
- {4, 0, __glXDispSwap_CopyTexSubImage1D}, /* X_GLrop_CopyTexSubImage1DEXT */
- {4, 0, __glXDispSwap_CopyTexSubImage2D}, /* X_GLrop_CopyTexSubImage2DEXT */
- {4, 0, __glXDispSwap_CopyTexSubImage3D}, /* X_GLrop_CopyTexSubImage3DEXT */
+__GLXRenderSwapInfo __glXSwapRenderTable_EXT[] = {
+ {4, 4, NULL}, /* X_GLrop_BlendColorEXT */
+ {4, 1, NULL}, /* X_GLrop_BlendEquationEXT */
+ {4, 2, NULL}, /* X_GLrop_PolygonOffsetEXT */
+ {4, 0, __glXDispSwap_TexSubImage1D}, /* X_GLrop_TexSubImage1DEXT */
+ {4, 0, __glXDispSwap_TexSubImage2D}, /* X_GLrop_TexSubImage2DEXT */
+ {4, 0, __glXDispSwap_ConvolutionFilter1D}, /* X_GLrop_ConvolutionFilter1DEXT */
+ {4, 0, __glXDispSwap_ConvolutionFilter2D}, /* X_GLrop_ConvolutionFilter2DEXT */
+ {4, 3, NULL}, /* X_GLrop_ConvolutionParameterfEXT */
+ {4, 0, __glXDispSwap_ConvolutionParameterfv}, /* X_GLrop_ConvolutionParameterfvEXT */
+ {4, 3, NULL}, /* X_GLrop_ConvolutionParameteriEXT */
+ {4, 0, __glXDispSwap_ConvolutionParameteriv}, /* X_GLrop_ConvolutionParameterivEXT */
+ {4, 0, __glXDispSwap_CopyConvolutionFilter1D}, /* X_GLrop_CopyConvolutionFilter1DEXT */
+ {4, 0, __glXDispSwap_CopyConvolutionFilter2D}, /* X_GLrop_CopyConvolutionFilter2DEXT */
+ {4, 0, __glXDispSwap_SeparableFilter2D}, /* X_GLrop_SeparableFilter2DEXT */
+ {4, 3, NULL}, /* X_GLrop_HistogramEXT */
+ {4, 2, NULL}, /* X_GLrop_MinmaxEXT */
+ {4, 1, NULL}, /* X_GLrop_ResetHistogramEXT */
+ {4, 1, NULL}, /* X_GLrop_ResetMinmaxEXT */
+ {4, 0, __glXDispSwap_TexImage3D}, /* X_GLrop_TexImage3DEXT */
+ {4, 0, __glXDispSwap_TexSubImage3D}, /* X_GLrop_TexSubImage3DEXT */
+ {4, 0, __glXDispSwap_DrawArrays}, /* X_GLrop_DrawArraysEXT */
+ {4, 2, NULL}, /* X_GLrop_BindTextureEXT */
+ {4, 0, __glXDispSwap_PrioritizeTextures}, /* X_GLrop_PrioritizeTexturesEXT */
+ {4, 0, __glXDispSwap_CopyTexImage1D}, /* X_GLrop_CopyTexImage1DEXT */
+ {4, 0, __glXDispSwap_CopyTexImage2D}, /* X_GLrop_CopyTexImage2DEXT */
+ {4, 0, __glXDispSwap_CopyTexSubImage1D}, /* X_GLrop_CopyTexSubImage1DEXT */
+ {4, 0, __glXDispSwap_CopyTexSubImage2D}, /* X_GLrop_CopyTexSubImage2DEXT */
+ {4, 0, __glXDispSwap_CopyTexSubImage3D}, /* X_GLrop_CopyTexSubImage3DEXT */
};
-
diff --git a/xorg-server/hw/dmx/glxProxy/g_disptab.h b/xorg-server/hw/dmx/glxProxy/g_disptab.h
index c497c88e5..530338798 100644
--- a/xorg-server/hw/dmx/glxProxy/g_disptab.h
+++ b/xorg-server/hw/dmx/glxProxy/g_disptab.h
@@ -31,633 +31,637 @@
* Silicon Graphics, Inc.
*/
-extern int __glXRender(__GLXclientState*, GLbyte*);
-extern int __glXRenderLarge(__GLXclientState*, GLbyte*);
-extern int __glXSendLargeCommand(__GLXclientState *cl, GLXContextTag contextTag);
-extern int __glXCreateContext(__GLXclientState*, GLbyte*);
-extern int __glXCreateNewContext(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDestroyContext(__GLXclientState*, GLbyte*);
-extern int __glXMakeCurrent(__GLXclientState*, GLbyte*);
-extern int __glXMakeContextCurrent(__GLXclientState*, GLbyte*);
-extern int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDestroyPbuffer(__GLXclientState *cl, GLbyte *pc);
-extern int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc);
-extern int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc);
-extern int __glXIsDirect(__GLXclientState*, GLbyte*);
-extern int __glXQueryVersion(__GLXclientState*, GLbyte*);
-extern int __glXWaitGL(__GLXclientState*, GLbyte*);
-extern int __glXWaitX(__GLXclientState*, GLbyte*);
-extern int __glXCopyContext(__GLXclientState*, GLbyte*);
-extern int __glXSwapBuffers(__GLXclientState*, GLbyte*);
-extern int __glXUseXFont(__GLXclientState*, GLbyte*);
-extern int __glXCreateGLXPixmap(__GLXclientState*, GLbyte*);
-extern int __glXCreatePixmap(__GLXclientState *cl, GLbyte *pc);
-extern int __glXGetVisualConfigs(__GLXclientState*, GLbyte*);
-extern int __glXDestroyGLXPixmap(__GLXclientState*, GLbyte*);
-extern int __glXVendorPrivate(__GLXclientState*, GLbyte*);
-extern int __glXVendorPrivateWithReply(__GLXclientState*, GLbyte*);
-extern int __glXQueryExtensionsString(__GLXclientState*, GLbyte*);
-extern int __glXQueryServerString(__GLXclientState*, GLbyte*);
-extern int __glXClientInfo(__GLXclientState*, GLbyte*);
-extern int __glXGetFBConfigs(__GLXclientState*, GLbyte*);
-extern int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDestroyWindow(__GLXclientState *cl, GLbyte *pc);
-extern int __glXQueryContext(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDisp_NewList(__GLXclientState*, GLbyte*);
-extern int __glXDisp_EndList(__GLXclientState*, GLbyte*);
-extern int __glXDisp_DeleteLists(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GenLists(__GLXclientState*, GLbyte*);
-extern int __glXDisp_FeedbackBuffer(__GLXclientState*, GLbyte*);
-extern int __glXDisp_SelectBuffer(__GLXclientState*, GLbyte*);
-extern int __glXDisp_RenderMode(__GLXclientState*, GLbyte*);
-extern int __glXDisp_Finish(__GLXclientState*, GLbyte*);
-extern int __glXDisp_PixelStoref(__GLXclientState*, GLbyte*);
-extern int __glXDisp_PixelStorei(__GLXclientState*, GLbyte*);
-extern int __glXDisp_ReadPixels(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetBooleanv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetClipPlane(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetDoublev(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetError(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetFloatv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetIntegerv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetLightfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetLightiv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetMapdv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetMapfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetMapiv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetMaterialfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetMaterialiv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetPixelMapfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetPixelMapuiv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetPixelMapusv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetPolygonStipple(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetString(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexEnvfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexEnviv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexGendv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexGenfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexGeniv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexImage(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexLevelParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetTexLevelParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_IsEnabled(__GLXclientState*, GLbyte*);
-extern int __glXDisp_IsList(__GLXclientState*, GLbyte*);
-extern int __glXDisp_Flush(__GLXclientState*, GLbyte*);
-extern int __glXDisp_AreTexturesResident(__GLXclientState*, GLbyte*);
-extern int __glXDisp_DeleteTextures(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GenTextures(__GLXclientState*, GLbyte*);
-extern int __glXDisp_IsTexture(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetColorTable(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetColorTableParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetColorTableParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetConvolutionFilter(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetConvolutionParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetConvolutionParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetSeparableFilter(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetHistogram(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetHistogramParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetHistogramParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetMinmax(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetMinmaxParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDisp_GetMinmaxParameteriv(__GLXclientState*, GLbyte*);
+extern int __glXRender(__GLXclientState *, GLbyte *);
+extern int __glXRenderLarge(__GLXclientState *, GLbyte *);
+extern int __glXSendLargeCommand(__GLXclientState * cl,
+ GLXContextTag contextTag);
+extern int __glXCreateContext(__GLXclientState *, GLbyte *);
+extern int __glXCreateNewContext(__GLXclientState * cl, GLbyte * pc);
+extern int __glXDestroyContext(__GLXclientState *, GLbyte *);
+extern int __glXMakeCurrent(__GLXclientState *, GLbyte *);
+extern int __glXMakeContextCurrent(__GLXclientState *, GLbyte *);
+extern int __glXCreatePbuffer(__GLXclientState * cl, GLbyte * pc);
+extern int __glXDestroyPbuffer(__GLXclientState * cl, GLbyte * pc);
+extern int __glXGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc);
+extern int __glXChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc);
+extern int __glXIsDirect(__GLXclientState *, GLbyte *);
+extern int __glXQueryVersion(__GLXclientState *, GLbyte *);
+extern int __glXWaitGL(__GLXclientState *, GLbyte *);
+extern int __glXWaitX(__GLXclientState *, GLbyte *);
+extern int __glXCopyContext(__GLXclientState *, GLbyte *);
+extern int __glXSwapBuffers(__GLXclientState *, GLbyte *);
+extern int __glXUseXFont(__GLXclientState *, GLbyte *);
+extern int __glXCreateGLXPixmap(__GLXclientState *, GLbyte *);
+extern int __glXCreatePixmap(__GLXclientState * cl, GLbyte * pc);
+extern int __glXGetVisualConfigs(__GLXclientState *, GLbyte *);
+extern int __glXDestroyGLXPixmap(__GLXclientState *, GLbyte *);
+extern int __glXVendorPrivate(__GLXclientState *, GLbyte *);
+extern int __glXVendorPrivateWithReply(__GLXclientState *, GLbyte *);
+extern int __glXQueryExtensionsString(__GLXclientState *, GLbyte *);
+extern int __glXQueryServerString(__GLXclientState *, GLbyte *);
+extern int __glXClientInfo(__GLXclientState *, GLbyte *);
+extern int __glXGetFBConfigs(__GLXclientState *, GLbyte *);
+extern int __glXCreateWindow(__GLXclientState * cl, GLbyte * pc);
+extern int __glXDestroyWindow(__GLXclientState * cl, GLbyte * pc);
+extern int __glXQueryContext(__GLXclientState * cl, GLbyte * pc);
+extern int __glXDisp_NewList(__GLXclientState *, GLbyte *);
+extern int __glXDisp_EndList(__GLXclientState *, GLbyte *);
+extern int __glXDisp_DeleteLists(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GenLists(__GLXclientState *, GLbyte *);
+extern int __glXDisp_FeedbackBuffer(__GLXclientState *, GLbyte *);
+extern int __glXDisp_SelectBuffer(__GLXclientState *, GLbyte *);
+extern int __glXDisp_RenderMode(__GLXclientState *, GLbyte *);
+extern int __glXDisp_Finish(__GLXclientState *, GLbyte *);
+extern int __glXDisp_PixelStoref(__GLXclientState *, GLbyte *);
+extern int __glXDisp_PixelStorei(__GLXclientState *, GLbyte *);
+extern int __glXDisp_ReadPixels(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetBooleanv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetClipPlane(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetDoublev(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetError(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetFloatv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetIntegerv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetLightfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetLightiv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetMapdv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetMapfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetMapiv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetMaterialfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetMaterialiv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetPixelMapfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetPixelMapuiv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetPixelMapusv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetPolygonStipple(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetString(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexEnvfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexEnviv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexGendv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexGenfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexGeniv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexImage(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexParameteriv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexLevelParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetTexLevelParameteriv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_IsEnabled(__GLXclientState *, GLbyte *);
+extern int __glXDisp_IsList(__GLXclientState *, GLbyte *);
+extern int __glXDisp_Flush(__GLXclientState *, GLbyte *);
+extern int __glXDisp_AreTexturesResident(__GLXclientState *, GLbyte *);
+extern int __glXDisp_DeleteTextures(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GenTextures(__GLXclientState *, GLbyte *);
+extern int __glXDisp_IsTexture(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetColorTable(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetColorTableParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetColorTableParameteriv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetConvolutionFilter(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetConvolutionParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetConvolutionParameteriv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetSeparableFilter(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetHistogram(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetHistogramParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetHistogramParameteriv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetMinmax(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetMinmaxParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDisp_GetMinmaxParameteriv(__GLXclientState *, GLbyte *);
-extern void __glXDisp_CallList(GLbyte*);
-extern void __glXDisp_CallLists(GLbyte*);
-extern void __glXDisp_ListBase(GLbyte*);
-extern void __glXDisp_Begin(GLbyte*);
-extern void __glXDisp_Bitmap(GLbyte*);
-extern void __glXDisp_Color3bv(GLbyte*);
-extern void __glXDisp_Color3dv(GLbyte*);
-extern void __glXDisp_Color3fv(GLbyte*);
-extern void __glXDisp_Color3iv(GLbyte*);
-extern void __glXDisp_Color3sv(GLbyte*);
-extern void __glXDisp_Color3ubv(GLbyte*);
-extern void __glXDisp_Color3uiv(GLbyte*);
-extern void __glXDisp_Color3usv(GLbyte*);
-extern void __glXDisp_Color4bv(GLbyte*);
-extern void __glXDisp_Color4dv(GLbyte*);
-extern void __glXDisp_Color4fv(GLbyte*);
-extern void __glXDisp_Color4iv(GLbyte*);
-extern void __glXDisp_Color4sv(GLbyte*);
-extern void __glXDisp_Color4ubv(GLbyte*);
-extern void __glXDisp_Color4uiv(GLbyte*);
-extern void __glXDisp_Color4usv(GLbyte*);
-extern void __glXDisp_EdgeFlagv(GLbyte*);
-extern void __glXDisp_End(GLbyte*);
-extern void __glXDisp_Indexdv(GLbyte*);
-extern void __glXDisp_Indexfv(GLbyte*);
-extern void __glXDisp_Indexiv(GLbyte*);
-extern void __glXDisp_Indexsv(GLbyte*);
-extern void __glXDisp_Normal3bv(GLbyte*);
-extern void __glXDisp_Normal3dv(GLbyte*);
-extern void __glXDisp_Normal3fv(GLbyte*);
-extern void __glXDisp_Normal3iv(GLbyte*);
-extern void __glXDisp_Normal3sv(GLbyte*);
-extern void __glXDisp_RasterPos2dv(GLbyte*);
-extern void __glXDisp_RasterPos2fv(GLbyte*);
-extern void __glXDisp_RasterPos2iv(GLbyte*);
-extern void __glXDisp_RasterPos2sv(GLbyte*);
-extern void __glXDisp_RasterPos3dv(GLbyte*);
-extern void __glXDisp_RasterPos3fv(GLbyte*);
-extern void __glXDisp_RasterPos3iv(GLbyte*);
-extern void __glXDisp_RasterPos3sv(GLbyte*);
-extern void __glXDisp_RasterPos4dv(GLbyte*);
-extern void __glXDisp_RasterPos4fv(GLbyte*);
-extern void __glXDisp_RasterPos4iv(GLbyte*);
-extern void __glXDisp_RasterPos4sv(GLbyte*);
-extern void __glXDisp_Rectdv(GLbyte*);
-extern void __glXDisp_Rectfv(GLbyte*);
-extern void __glXDisp_Rectiv(GLbyte*);
-extern void __glXDisp_Rectsv(GLbyte*);
-extern void __glXDisp_TexCoord1dv(GLbyte*);
-extern void __glXDisp_TexCoord1fv(GLbyte*);
-extern void __glXDisp_TexCoord1iv(GLbyte*);
-extern void __glXDisp_TexCoord1sv(GLbyte*);
-extern void __glXDisp_TexCoord2dv(GLbyte*);
-extern void __glXDisp_TexCoord2fv(GLbyte*);
-extern void __glXDisp_TexCoord2iv(GLbyte*);
-extern void __glXDisp_TexCoord2sv(GLbyte*);
-extern void __glXDisp_TexCoord3dv(GLbyte*);
-extern void __glXDisp_TexCoord3fv(GLbyte*);
-extern void __glXDisp_TexCoord3iv(GLbyte*);
-extern void __glXDisp_TexCoord3sv(GLbyte*);
-extern void __glXDisp_TexCoord4dv(GLbyte*);
-extern void __glXDisp_TexCoord4fv(GLbyte*);
-extern void __glXDisp_TexCoord4iv(GLbyte*);
-extern void __glXDisp_TexCoord4sv(GLbyte*);
-extern void __glXDisp_Vertex2dv(GLbyte*);
-extern void __glXDisp_Vertex2fv(GLbyte*);
-extern void __glXDisp_Vertex2iv(GLbyte*);
-extern void __glXDisp_Vertex2sv(GLbyte*);
-extern void __glXDisp_Vertex3dv(GLbyte*);
-extern void __glXDisp_Vertex3fv(GLbyte*);
-extern void __glXDisp_Vertex3iv(GLbyte*);
-extern void __glXDisp_Vertex3sv(GLbyte*);
-extern void __glXDisp_Vertex4dv(GLbyte*);
-extern void __glXDisp_Vertex4fv(GLbyte*);
-extern void __glXDisp_Vertex4iv(GLbyte*);
-extern void __glXDisp_Vertex4sv(GLbyte*);
-extern void __glXDisp_ClipPlane(GLbyte*);
-extern void __glXDisp_ColorMaterial(GLbyte*);
-extern void __glXDisp_CullFace(GLbyte*);
-extern void __glXDisp_Fogf(GLbyte*);
-extern void __glXDisp_Fogfv(GLbyte*);
-extern void __glXDisp_Fogi(GLbyte*);
-extern void __glXDisp_Fogiv(GLbyte*);
-extern void __glXDisp_FrontFace(GLbyte*);
-extern void __glXDisp_Hint(GLbyte*);
-extern void __glXDisp_Lightf(GLbyte*);
-extern void __glXDisp_Lightfv(GLbyte*);
-extern void __glXDisp_Lighti(GLbyte*);
-extern void __glXDisp_Lightiv(GLbyte*);
-extern void __glXDisp_LightModelf(GLbyte*);
-extern void __glXDisp_LightModelfv(GLbyte*);
-extern void __glXDisp_LightModeli(GLbyte*);
-extern void __glXDisp_LightModeliv(GLbyte*);
-extern void __glXDisp_LineStipple(GLbyte*);
-extern void __glXDisp_LineWidth(GLbyte*);
-extern void __glXDisp_Materialf(GLbyte*);
-extern void __glXDisp_Materialfv(GLbyte*);
-extern void __glXDisp_Materiali(GLbyte*);
-extern void __glXDisp_Materialiv(GLbyte*);
-extern void __glXDisp_PointSize(GLbyte*);
-extern void __glXDisp_PolygonMode(GLbyte*);
-extern void __glXDisp_PolygonStipple(GLbyte*);
-extern void __glXDisp_Scissor(GLbyte*);
-extern void __glXDisp_ShadeModel(GLbyte*);
-extern void __glXDisp_TexParameterf(GLbyte*);
-extern void __glXDisp_TexParameterfv(GLbyte*);
-extern void __glXDisp_TexParameteri(GLbyte*);
-extern void __glXDisp_TexParameteriv(GLbyte*);
-extern void __glXDisp_TexImage1D(GLbyte*);
-extern void __glXDisp_TexImage2D(GLbyte*);
-extern void __glXDisp_TexEnvf(GLbyte*);
-extern void __glXDisp_TexEnvfv(GLbyte*);
-extern void __glXDisp_TexEnvi(GLbyte*);
-extern void __glXDisp_TexEnviv(GLbyte*);
-extern void __glXDisp_TexGend(GLbyte*);
-extern void __glXDisp_TexGendv(GLbyte*);
-extern void __glXDisp_TexGenf(GLbyte*);
-extern void __glXDisp_TexGenfv(GLbyte*);
-extern void __glXDisp_TexGeni(GLbyte*);
-extern void __glXDisp_TexGeniv(GLbyte*);
-extern void __glXDisp_InitNames(GLbyte*);
-extern void __glXDisp_LoadName(GLbyte*);
-extern void __glXDisp_PassThrough(GLbyte*);
-extern void __glXDisp_PopName(GLbyte*);
-extern void __glXDisp_PushName(GLbyte*);
-extern void __glXDisp_DrawBuffer(GLbyte*);
-extern void __glXDisp_Clear(GLbyte*);
-extern void __glXDisp_ClearAccum(GLbyte*);
-extern void __glXDisp_ClearIndex(GLbyte*);
-extern void __glXDisp_ClearColor(GLbyte*);
-extern void __glXDisp_ClearStencil(GLbyte*);
-extern void __glXDisp_ClearDepth(GLbyte*);
-extern void __glXDisp_StencilMask(GLbyte*);
-extern void __glXDisp_ColorMask(GLbyte*);
-extern void __glXDisp_DepthMask(GLbyte*);
-extern void __glXDisp_IndexMask(GLbyte*);
-extern void __glXDisp_Accum(GLbyte*);
-extern void __glXDisp_Disable(GLbyte*);
-extern void __glXDisp_Enable(GLbyte*);
-extern void __glXDisp_PopAttrib(GLbyte*);
-extern void __glXDisp_PushAttrib(GLbyte*);
-extern void __glXDisp_Map1d(GLbyte*);
-extern void __glXDisp_Map1f(GLbyte*);
-extern void __glXDisp_Map2d(GLbyte*);
-extern void __glXDisp_Map2f(GLbyte*);
-extern void __glXDisp_MapGrid1d(GLbyte*);
-extern void __glXDisp_MapGrid1f(GLbyte*);
-extern void __glXDisp_MapGrid2d(GLbyte*);
-extern void __glXDisp_MapGrid2f(GLbyte*);
-extern void __glXDisp_EvalCoord1dv(GLbyte*);
-extern void __glXDisp_EvalCoord1fv(GLbyte*);
-extern void __glXDisp_EvalCoord2dv(GLbyte*);
-extern void __glXDisp_EvalCoord2fv(GLbyte*);
-extern void __glXDisp_EvalMesh1(GLbyte*);
-extern void __glXDisp_EvalPoint1(GLbyte*);
-extern void __glXDisp_EvalMesh2(GLbyte*);
-extern void __glXDisp_EvalPoint2(GLbyte*);
-extern void __glXDisp_AlphaFunc(GLbyte*);
-extern void __glXDisp_BlendFunc(GLbyte*);
-extern void __glXDisp_LogicOp(GLbyte*);
-extern void __glXDisp_StencilFunc(GLbyte*);
-extern void __glXDisp_StencilOp(GLbyte*);
-extern void __glXDisp_DepthFunc(GLbyte*);
-extern void __glXDisp_PixelZoom(GLbyte*);
-extern void __glXDisp_PixelTransferf(GLbyte*);
-extern void __glXDisp_PixelTransferi(GLbyte*);
-extern void __glXDisp_PixelMapfv(GLbyte*);
-extern void __glXDisp_PixelMapuiv(GLbyte*);
-extern void __glXDisp_PixelMapusv(GLbyte*);
-extern void __glXDisp_ReadBuffer(GLbyte*);
-extern void __glXDisp_CopyPixels(GLbyte*);
-extern void __glXDisp_DrawPixels(GLbyte*);
-extern void __glXDisp_DepthRange(GLbyte*);
-extern void __glXDisp_Frustum(GLbyte*);
-extern void __glXDisp_LoadIdentity(GLbyte*);
-extern void __glXDisp_LoadMatrixf(GLbyte*);
-extern void __glXDisp_LoadMatrixd(GLbyte*);
-extern void __glXDisp_MatrixMode(GLbyte*);
-extern void __glXDisp_MultMatrixf(GLbyte*);
-extern void __glXDisp_MultMatrixd(GLbyte*);
-extern void __glXDisp_Ortho(GLbyte*);
-extern void __glXDisp_PopMatrix(GLbyte*);
-extern void __glXDisp_PushMatrix(GLbyte*);
-extern void __glXDisp_Rotated(GLbyte*);
-extern void __glXDisp_Rotatef(GLbyte*);
-extern void __glXDisp_Scaled(GLbyte*);
-extern void __glXDisp_Scalef(GLbyte*);
-extern void __glXDisp_Translated(GLbyte*);
-extern void __glXDisp_Translatef(GLbyte*);
-extern void __glXDisp_Viewport(GLbyte*);
-extern void __glXDisp_PolygonOffset(GLbyte*);
-extern void __glXDisp_DrawArrays(GLbyte*);
-extern void __glXDisp_Indexubv(GLbyte*);
-extern void __glXDisp_ColorSubTable(GLbyte*);
-extern void __glXDisp_CopyColorSubTable(GLbyte*);
-extern void __glXDisp_ActiveTextureARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord1dvARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord1fvARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord1ivARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord1svARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord2dvARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord2fvARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord2ivARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord2svARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord3dvARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord3fvARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord3ivARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord3svARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord4dvARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord4fvARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord4ivARB(GLbyte*);
-extern void __glXDisp_MultiTexCoord4svARB(GLbyte*);
+extern void __glXDisp_CallList(GLbyte *);
+extern void __glXDisp_CallLists(GLbyte *);
+extern void __glXDisp_ListBase(GLbyte *);
+extern void __glXDisp_Begin(GLbyte *);
+extern void __glXDisp_Bitmap(GLbyte *);
+extern void __glXDisp_Color3bv(GLbyte *);
+extern void __glXDisp_Color3dv(GLbyte *);
+extern void __glXDisp_Color3fv(GLbyte *);
+extern void __glXDisp_Color3iv(GLbyte *);
+extern void __glXDisp_Color3sv(GLbyte *);
+extern void __glXDisp_Color3ubv(GLbyte *);
+extern void __glXDisp_Color3uiv(GLbyte *);
+extern void __glXDisp_Color3usv(GLbyte *);
+extern void __glXDisp_Color4bv(GLbyte *);
+extern void __glXDisp_Color4dv(GLbyte *);
+extern void __glXDisp_Color4fv(GLbyte *);
+extern void __glXDisp_Color4iv(GLbyte *);
+extern void __glXDisp_Color4sv(GLbyte *);
+extern void __glXDisp_Color4ubv(GLbyte *);
+extern void __glXDisp_Color4uiv(GLbyte *);
+extern void __glXDisp_Color4usv(GLbyte *);
+extern void __glXDisp_EdgeFlagv(GLbyte *);
+extern void __glXDisp_End(GLbyte *);
+extern void __glXDisp_Indexdv(GLbyte *);
+extern void __glXDisp_Indexfv(GLbyte *);
+extern void __glXDisp_Indexiv(GLbyte *);
+extern void __glXDisp_Indexsv(GLbyte *);
+extern void __glXDisp_Normal3bv(GLbyte *);
+extern void __glXDisp_Normal3dv(GLbyte *);
+extern void __glXDisp_Normal3fv(GLbyte *);
+extern void __glXDisp_Normal3iv(GLbyte *);
+extern void __glXDisp_Normal3sv(GLbyte *);
+extern void __glXDisp_RasterPos2dv(GLbyte *);
+extern void __glXDisp_RasterPos2fv(GLbyte *);
+extern void __glXDisp_RasterPos2iv(GLbyte *);
+extern void __glXDisp_RasterPos2sv(GLbyte *);
+extern void __glXDisp_RasterPos3dv(GLbyte *);
+extern void __glXDisp_RasterPos3fv(GLbyte *);
+extern void __glXDisp_RasterPos3iv(GLbyte *);
+extern void __glXDisp_RasterPos3sv(GLbyte *);
+extern void __glXDisp_RasterPos4dv(GLbyte *);
+extern void __glXDisp_RasterPos4fv(GLbyte *);
+extern void __glXDisp_RasterPos4iv(GLbyte *);
+extern void __glXDisp_RasterPos4sv(GLbyte *);
+extern void __glXDisp_Rectdv(GLbyte *);
+extern void __glXDisp_Rectfv(GLbyte *);
+extern void __glXDisp_Rectiv(GLbyte *);
+extern void __glXDisp_Rectsv(GLbyte *);
+extern void __glXDisp_TexCoord1dv(GLbyte *);
+extern void __glXDisp_TexCoord1fv(GLbyte *);
+extern void __glXDisp_TexCoord1iv(GLbyte *);
+extern void __glXDisp_TexCoord1sv(GLbyte *);
+extern void __glXDisp_TexCoord2dv(GLbyte *);
+extern void __glXDisp_TexCoord2fv(GLbyte *);
+extern void __glXDisp_TexCoord2iv(GLbyte *);
+extern void __glXDisp_TexCoord2sv(GLbyte *);
+extern void __glXDisp_TexCoord3dv(GLbyte *);
+extern void __glXDisp_TexCoord3fv(GLbyte *);
+extern void __glXDisp_TexCoord3iv(GLbyte *);
+extern void __glXDisp_TexCoord3sv(GLbyte *);
+extern void __glXDisp_TexCoord4dv(GLbyte *);
+extern void __glXDisp_TexCoord4fv(GLbyte *);
+extern void __glXDisp_TexCoord4iv(GLbyte *);
+extern void __glXDisp_TexCoord4sv(GLbyte *);
+extern void __glXDisp_Vertex2dv(GLbyte *);
+extern void __glXDisp_Vertex2fv(GLbyte *);
+extern void __glXDisp_Vertex2iv(GLbyte *);
+extern void __glXDisp_Vertex2sv(GLbyte *);
+extern void __glXDisp_Vertex3dv(GLbyte *);
+extern void __glXDisp_Vertex3fv(GLbyte *);
+extern void __glXDisp_Vertex3iv(GLbyte *);
+extern void __glXDisp_Vertex3sv(GLbyte *);
+extern void __glXDisp_Vertex4dv(GLbyte *);
+extern void __glXDisp_Vertex4fv(GLbyte *);
+extern void __glXDisp_Vertex4iv(GLbyte *);
+extern void __glXDisp_Vertex4sv(GLbyte *);
+extern void __glXDisp_ClipPlane(GLbyte *);
+extern void __glXDisp_ColorMaterial(GLbyte *);
+extern void __glXDisp_CullFace(GLbyte *);
+extern void __glXDisp_Fogf(GLbyte *);
+extern void __glXDisp_Fogfv(GLbyte *);
+extern void __glXDisp_Fogi(GLbyte *);
+extern void __glXDisp_Fogiv(GLbyte *);
+extern void __glXDisp_FrontFace(GLbyte *);
+extern void __glXDisp_Hint(GLbyte *);
+extern void __glXDisp_Lightf(GLbyte *);
+extern void __glXDisp_Lightfv(GLbyte *);
+extern void __glXDisp_Lighti(GLbyte *);
+extern void __glXDisp_Lightiv(GLbyte *);
+extern void __glXDisp_LightModelf(GLbyte *);
+extern void __glXDisp_LightModelfv(GLbyte *);
+extern void __glXDisp_LightModeli(GLbyte *);
+extern void __glXDisp_LightModeliv(GLbyte *);
+extern void __glXDisp_LineStipple(GLbyte *);
+extern void __glXDisp_LineWidth(GLbyte *);
+extern void __glXDisp_Materialf(GLbyte *);
+extern void __glXDisp_Materialfv(GLbyte *);
+extern void __glXDisp_Materiali(GLbyte *);
+extern void __glXDisp_Materialiv(GLbyte *);
+extern void __glXDisp_PointSize(GLbyte *);
+extern void __glXDisp_PolygonMode(GLbyte *);
+extern void __glXDisp_PolygonStipple(GLbyte *);
+extern void __glXDisp_Scissor(GLbyte *);
+extern void __glXDisp_ShadeModel(GLbyte *);
+extern void __glXDisp_TexParameterf(GLbyte *);
+extern void __glXDisp_TexParameterfv(GLbyte *);
+extern void __glXDisp_TexParameteri(GLbyte *);
+extern void __glXDisp_TexParameteriv(GLbyte *);
+extern void __glXDisp_TexImage1D(GLbyte *);
+extern void __glXDisp_TexImage2D(GLbyte *);
+extern void __glXDisp_TexEnvf(GLbyte *);
+extern void __glXDisp_TexEnvfv(GLbyte *);
+extern void __glXDisp_TexEnvi(GLbyte *);
+extern void __glXDisp_TexEnviv(GLbyte *);
+extern void __glXDisp_TexGend(GLbyte *);
+extern void __glXDisp_TexGendv(GLbyte *);
+extern void __glXDisp_TexGenf(GLbyte *);
+extern void __glXDisp_TexGenfv(GLbyte *);
+extern void __glXDisp_TexGeni(GLbyte *);
+extern void __glXDisp_TexGeniv(GLbyte *);
+extern void __glXDisp_InitNames(GLbyte *);
+extern void __glXDisp_LoadName(GLbyte *);
+extern void __glXDisp_PassThrough(GLbyte *);
+extern void __glXDisp_PopName(GLbyte *);
+extern void __glXDisp_PushName(GLbyte *);
+extern void __glXDisp_DrawBuffer(GLbyte *);
+extern void __glXDisp_Clear(GLbyte *);
+extern void __glXDisp_ClearAccum(GLbyte *);
+extern void __glXDisp_ClearIndex(GLbyte *);
+extern void __glXDisp_ClearColor(GLbyte *);
+extern void __glXDisp_ClearStencil(GLbyte *);
+extern void __glXDisp_ClearDepth(GLbyte *);
+extern void __glXDisp_StencilMask(GLbyte *);
+extern void __glXDisp_ColorMask(GLbyte *);
+extern void __glXDisp_DepthMask(GLbyte *);
+extern void __glXDisp_IndexMask(GLbyte *);
+extern void __glXDisp_Accum(GLbyte *);
+extern void __glXDisp_Disable(GLbyte *);
+extern void __glXDisp_Enable(GLbyte *);
+extern void __glXDisp_PopAttrib(GLbyte *);
+extern void __glXDisp_PushAttrib(GLbyte *);
+extern void __glXDisp_Map1d(GLbyte *);
+extern void __glXDisp_Map1f(GLbyte *);
+extern void __glXDisp_Map2d(GLbyte *);
+extern void __glXDisp_Map2f(GLbyte *);
+extern void __glXDisp_MapGrid1d(GLbyte *);
+extern void __glXDisp_MapGrid1f(GLbyte *);
+extern void __glXDisp_MapGrid2d(GLbyte *);
+extern void __glXDisp_MapGrid2f(GLbyte *);
+extern void __glXDisp_EvalCoord1dv(GLbyte *);
+extern void __glXDisp_EvalCoord1fv(GLbyte *);
+extern void __glXDisp_EvalCoord2dv(GLbyte *);
+extern void __glXDisp_EvalCoord2fv(GLbyte *);
+extern void __glXDisp_EvalMesh1(GLbyte *);
+extern void __glXDisp_EvalPoint1(GLbyte *);
+extern void __glXDisp_EvalMesh2(GLbyte *);
+extern void __glXDisp_EvalPoint2(GLbyte *);
+extern void __glXDisp_AlphaFunc(GLbyte *);
+extern void __glXDisp_BlendFunc(GLbyte *);
+extern void __glXDisp_LogicOp(GLbyte *);
+extern void __glXDisp_StencilFunc(GLbyte *);
+extern void __glXDisp_StencilOp(GLbyte *);
+extern void __glXDisp_DepthFunc(GLbyte *);
+extern void __glXDisp_PixelZoom(GLbyte *);
+extern void __glXDisp_PixelTransferf(GLbyte *);
+extern void __glXDisp_PixelTransferi(GLbyte *);
+extern void __glXDisp_PixelMapfv(GLbyte *);
+extern void __glXDisp_PixelMapuiv(GLbyte *);
+extern void __glXDisp_PixelMapusv(GLbyte *);
+extern void __glXDisp_ReadBuffer(GLbyte *);
+extern void __glXDisp_CopyPixels(GLbyte *);
+extern void __glXDisp_DrawPixels(GLbyte *);
+extern void __glXDisp_DepthRange(GLbyte *);
+extern void __glXDisp_Frustum(GLbyte *);
+extern void __glXDisp_LoadIdentity(GLbyte *);
+extern void __glXDisp_LoadMatrixf(GLbyte *);
+extern void __glXDisp_LoadMatrixd(GLbyte *);
+extern void __glXDisp_MatrixMode(GLbyte *);
+extern void __glXDisp_MultMatrixf(GLbyte *);
+extern void __glXDisp_MultMatrixd(GLbyte *);
+extern void __glXDisp_Ortho(GLbyte *);
+extern void __glXDisp_PopMatrix(GLbyte *);
+extern void __glXDisp_PushMatrix(GLbyte *);
+extern void __glXDisp_Rotated(GLbyte *);
+extern void __glXDisp_Rotatef(GLbyte *);
+extern void __glXDisp_Scaled(GLbyte *);
+extern void __glXDisp_Scalef(GLbyte *);
+extern void __glXDisp_Translated(GLbyte *);
+extern void __glXDisp_Translatef(GLbyte *);
+extern void __glXDisp_Viewport(GLbyte *);
+extern void __glXDisp_PolygonOffset(GLbyte *);
+extern void __glXDisp_DrawArrays(GLbyte *);
+extern void __glXDisp_Indexubv(GLbyte *);
+extern void __glXDisp_ColorSubTable(GLbyte *);
+extern void __glXDisp_CopyColorSubTable(GLbyte *);
+extern void __glXDisp_ActiveTextureARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord1dvARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord1fvARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord1ivARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord1svARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord2dvARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord2fvARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord2ivARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord2svARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord3dvARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord3fvARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord3ivARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord3svARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord4dvARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord4fvARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord4ivARB(GLbyte *);
+extern void __glXDisp_MultiTexCoord4svARB(GLbyte *);
-extern int __glXSwapRender(__GLXclientState*, GLbyte*);
-extern int __glXSwapRenderLarge(__GLXclientState*, GLbyte*);
-extern int __glXSwapCreateContext(__GLXclientState*, GLbyte*);
-extern int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapDestroyContext(__GLXclientState*, GLbyte*);
-extern int __glXSwapMakeCurrent(__GLXclientState*, GLbyte*);
-extern int __glXSwapMakeContextCurrent(__GLXclientState*, GLbyte*);
-extern int __glXSwapCreatePbuffer(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapDestroyPbuffer(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapIsDirect(__GLXclientState*, GLbyte*);
-extern int __glXSwapQueryVersion(__GLXclientState*, GLbyte*);
-extern int __glXSwapWaitGL(__GLXclientState*, GLbyte*);
-extern int __glXSwapWaitX(__GLXclientState*, GLbyte*);
-extern int __glXSwapCopyContext(__GLXclientState*, GLbyte*);
-extern int __glXSwapSwapBuffers(__GLXclientState*, GLbyte*);
-extern int __glXSwapUseXFont(__GLXclientState*, GLbyte*);
-extern int __glXSwapCreateGLXPixmap(__GLXclientState*, GLbyte*);
-extern int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapGetVisualConfigs(__GLXclientState*, GLbyte*);
-extern int __glXSwapDestroyGLXPixmap(__GLXclientState*, GLbyte*);
-extern int __glXSwapVendorPrivate(__GLXclientState*, GLbyte*);
-extern int __glXSwapVendorPrivateWithReply(__GLXclientState*, GLbyte*);
-extern int __glXSwapQueryExtensionsString(__GLXclientState*, GLbyte*);
-extern int __glXSwapQueryServerString(__GLXclientState*, GLbyte*);
-extern int __glXSwapClientInfo(__GLXclientState*, GLbyte*);
-extern int __glXSwapGetFBConfigs(__GLXclientState*, GLbyte*);
-extern int __glXSwapCreateWindow(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapDestroyWindow(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapQueryContext(__GLXclientState *cl, GLbyte *pc);
-extern int __glXDispSwap_NewList(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_EndList(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_DeleteLists(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GenLists(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_FeedbackBuffer(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_SelectBuffer(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_RenderMode(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_Finish(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_PixelStoref(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_PixelStorei(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_ReadPixels(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetBooleanv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetClipPlane(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetDoublev(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetError(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetFloatv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetIntegerv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetLightfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetLightiv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetMapdv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetMapfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetMapiv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetMaterialfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetMaterialiv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetPixelMapfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetPixelMapuiv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetPixelMapusv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetPolygonStipple(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetString(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexEnvfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexEnviv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexGendv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexGenfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexGeniv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexImage(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexLevelParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_IsEnabled(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_IsList(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_Flush(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_AreTexturesResident(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_DeleteTextures(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GenTextures(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_IsTexture(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetColorTable(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetColorTableParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetColorTableParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetConvolutionFilter(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetSeparableFilter(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetHistogram(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetHistogramParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetHistogramParameteriv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetMinmax(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState*, GLbyte*);
-extern int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState*, GLbyte*);
+extern int __glXSwapRender(__GLXclientState *, GLbyte *);
+extern int __glXSwapRenderLarge(__GLXclientState *, GLbyte *);
+extern int __glXSwapCreateContext(__GLXclientState *, GLbyte *);
+extern int __glXSwapCreateNewContext(__GLXclientState * cl, GLbyte * pc);
+extern int __glXSwapDestroyContext(__GLXclientState *, GLbyte *);
+extern int __glXSwapMakeCurrent(__GLXclientState *, GLbyte *);
+extern int __glXSwapMakeContextCurrent(__GLXclientState *, GLbyte *);
+extern int __glXSwapCreatePbuffer(__GLXclientState * cl, GLbyte * pc);
+extern int __glXSwapDestroyPbuffer(__GLXclientState * cl, GLbyte * pc);
+extern int __glXSwapGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc);
+extern int __glXSwapChangeDrawableAttributes(__GLXclientState * cl,
+ GLbyte * pc);
+extern int __glXSwapIsDirect(__GLXclientState *, GLbyte *);
+extern int __glXSwapQueryVersion(__GLXclientState *, GLbyte *);
+extern int __glXSwapWaitGL(__GLXclientState *, GLbyte *);
+extern int __glXSwapWaitX(__GLXclientState *, GLbyte *);
+extern int __glXSwapCopyContext(__GLXclientState *, GLbyte *);
+extern int __glXSwapSwapBuffers(__GLXclientState *, GLbyte *);
+extern int __glXSwapUseXFont(__GLXclientState *, GLbyte *);
+extern int __glXSwapCreateGLXPixmap(__GLXclientState *, GLbyte *);
+extern int __glXSwapCreatePixmap(__GLXclientState * cl, GLbyte * pc);
+extern int __glXSwapGetVisualConfigs(__GLXclientState *, GLbyte *);
+extern int __glXSwapDestroyGLXPixmap(__GLXclientState *, GLbyte *);
+extern int __glXSwapVendorPrivate(__GLXclientState *, GLbyte *);
+extern int __glXSwapVendorPrivateWithReply(__GLXclientState *, GLbyte *);
+extern int __glXSwapQueryExtensionsString(__GLXclientState *, GLbyte *);
+extern int __glXSwapQueryServerString(__GLXclientState *, GLbyte *);
+extern int __glXSwapClientInfo(__GLXclientState *, GLbyte *);
+extern int __glXSwapGetFBConfigs(__GLXclientState *, GLbyte *);
+extern int __glXSwapCreateWindow(__GLXclientState * cl, GLbyte * pc);
+extern int __glXSwapDestroyWindow(__GLXclientState * cl, GLbyte * pc);
+extern int __glXSwapQueryContext(__GLXclientState * cl, GLbyte * pc);
+extern int __glXDispSwap_NewList(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_EndList(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_DeleteLists(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GenLists(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_FeedbackBuffer(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_SelectBuffer(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_RenderMode(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_Finish(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_PixelStoref(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_PixelStorei(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_ReadPixels(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetBooleanv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetClipPlane(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetDoublev(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetError(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetFloatv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetIntegerv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetLightfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetLightiv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetMapdv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetMapfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetMapiv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetMaterialfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetMaterialiv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetPixelMapfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetPixelMapuiv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetPixelMapusv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetPolygonStipple(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetString(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexEnvfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexEnviv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexGendv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexGenfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexGeniv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexImage(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexParameteriv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexLevelParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_IsEnabled(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_IsList(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_Flush(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_AreTexturesResident(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_DeleteTextures(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GenTextures(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_IsTexture(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetColorTable(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetColorTableParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetColorTableParameteriv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetConvolutionFilter(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState *,
+ GLbyte *);
+extern int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState *,
+ GLbyte *);
+extern int __glXDispSwap_GetSeparableFilter(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetHistogram(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetHistogramParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetHistogramParameteriv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetMinmax(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState *, GLbyte *);
+extern int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState *, GLbyte *);
-extern void __glXDispSwap_CallList(GLbyte*);
-extern void __glXDispSwap_CallLists(GLbyte*);
-extern void __glXDispSwap_ListBase(GLbyte*);
-extern void __glXDispSwap_Begin(GLbyte*);
-extern void __glXDispSwap_Bitmap(GLbyte*);
-extern void __glXDispSwap_Color3bv(GLbyte*);
-extern void __glXDispSwap_Color3dv(GLbyte*);
-extern void __glXDispSwap_Color3fv(GLbyte*);
-extern void __glXDispSwap_Color3iv(GLbyte*);
-extern void __glXDispSwap_Color3sv(GLbyte*);
-extern void __glXDispSwap_Color3ubv(GLbyte*);
-extern void __glXDispSwap_Color3uiv(GLbyte*);
-extern void __glXDispSwap_Color3usv(GLbyte*);
-extern void __glXDispSwap_Color4bv(GLbyte*);
-extern void __glXDispSwap_Color4dv(GLbyte*);
-extern void __glXDispSwap_Color4fv(GLbyte*);
-extern void __glXDispSwap_Color4iv(GLbyte*);
-extern void __glXDispSwap_Color4sv(GLbyte*);
-extern void __glXDispSwap_Color4ubv(GLbyte*);
-extern void __glXDispSwap_Color4uiv(GLbyte*);
-extern void __glXDispSwap_Color4usv(GLbyte*);
-extern void __glXDispSwap_EdgeFlagv(GLbyte*);
-extern void __glXDispSwap_End(GLbyte*);
-extern void __glXDispSwap_Indexdv(GLbyte*);
-extern void __glXDispSwap_Indexfv(GLbyte*);
-extern void __glXDispSwap_Indexiv(GLbyte*);
-extern void __glXDispSwap_Indexsv(GLbyte*);
-extern void __glXDispSwap_Normal3bv(GLbyte*);
-extern void __glXDispSwap_Normal3dv(GLbyte*);
-extern void __glXDispSwap_Normal3fv(GLbyte*);
-extern void __glXDispSwap_Normal3iv(GLbyte*);
-extern void __glXDispSwap_Normal3sv(GLbyte*);
-extern void __glXDispSwap_RasterPos2dv(GLbyte*);
-extern void __glXDispSwap_RasterPos2fv(GLbyte*);
-extern void __glXDispSwap_RasterPos2iv(GLbyte*);
-extern void __glXDispSwap_RasterPos2sv(GLbyte*);
-extern void __glXDispSwap_RasterPos3dv(GLbyte*);
-extern void __glXDispSwap_RasterPos3fv(GLbyte*);
-extern void __glXDispSwap_RasterPos3iv(GLbyte*);
-extern void __glXDispSwap_RasterPos3sv(GLbyte*);
-extern void __glXDispSwap_RasterPos4dv(GLbyte*);
-extern void __glXDispSwap_RasterPos4fv(GLbyte*);
-extern void __glXDispSwap_RasterPos4iv(GLbyte*);
-extern void __glXDispSwap_RasterPos4sv(GLbyte*);
-extern void __glXDispSwap_Rectdv(GLbyte*);
-extern void __glXDispSwap_Rectfv(GLbyte*);
-extern void __glXDispSwap_Rectiv(GLbyte*);
-extern void __glXDispSwap_Rectsv(GLbyte*);
-extern void __glXDispSwap_TexCoord1dv(GLbyte*);
-extern void __glXDispSwap_TexCoord1fv(GLbyte*);
-extern void __glXDispSwap_TexCoord1iv(GLbyte*);
-extern void __glXDispSwap_TexCoord1sv(GLbyte*);
-extern void __glXDispSwap_TexCoord2dv(GLbyte*);
-extern void __glXDispSwap_TexCoord2fv(GLbyte*);
-extern void __glXDispSwap_TexCoord2iv(GLbyte*);
-extern void __glXDispSwap_TexCoord2sv(GLbyte*);
-extern void __glXDispSwap_TexCoord3dv(GLbyte*);
-extern void __glXDispSwap_TexCoord3fv(GLbyte*);
-extern void __glXDispSwap_TexCoord3iv(GLbyte*);
-extern void __glXDispSwap_TexCoord3sv(GLbyte*);
-extern void __glXDispSwap_TexCoord4dv(GLbyte*);
-extern void __glXDispSwap_TexCoord4fv(GLbyte*);
-extern void __glXDispSwap_TexCoord4iv(GLbyte*);
-extern void __glXDispSwap_TexCoord4sv(GLbyte*);
-extern void __glXDispSwap_Vertex2dv(GLbyte*);
-extern void __glXDispSwap_Vertex2fv(GLbyte*);
-extern void __glXDispSwap_Vertex2iv(GLbyte*);
-extern void __glXDispSwap_Vertex2sv(GLbyte*);
-extern void __glXDispSwap_Vertex3dv(GLbyte*);
-extern void __glXDispSwap_Vertex3fv(GLbyte*);
-extern void __glXDispSwap_Vertex3iv(GLbyte*);
-extern void __glXDispSwap_Vertex3sv(GLbyte*);
-extern void __glXDispSwap_Vertex4dv(GLbyte*);
-extern void __glXDispSwap_Vertex4fv(GLbyte*);
-extern void __glXDispSwap_Vertex4iv(GLbyte*);
-extern void __glXDispSwap_Vertex4sv(GLbyte*);
-extern void __glXDispSwap_ClipPlane(GLbyte*);
-extern void __glXDispSwap_ColorMaterial(GLbyte*);
-extern void __glXDispSwap_CullFace(GLbyte*);
-extern void __glXDispSwap_Fogf(GLbyte*);
-extern void __glXDispSwap_Fogfv(GLbyte*);
-extern void __glXDispSwap_Fogi(GLbyte*);
-extern void __glXDispSwap_Fogiv(GLbyte*);
-extern void __glXDispSwap_FrontFace(GLbyte*);
-extern void __glXDispSwap_Hint(GLbyte*);
-extern void __glXDispSwap_Lightf(GLbyte*);
-extern void __glXDispSwap_Lightfv(GLbyte*);
-extern void __glXDispSwap_Lighti(GLbyte*);
-extern void __glXDispSwap_Lightiv(GLbyte*);
-extern void __glXDispSwap_LightModelf(GLbyte*);
-extern void __glXDispSwap_LightModelfv(GLbyte*);
-extern void __glXDispSwap_LightModeli(GLbyte*);
-extern void __glXDispSwap_LightModeliv(GLbyte*);
-extern void __glXDispSwap_LineStipple(GLbyte*);
-extern void __glXDispSwap_LineWidth(GLbyte*);
-extern void __glXDispSwap_Materialf(GLbyte*);
-extern void __glXDispSwap_Materialfv(GLbyte*);
-extern void __glXDispSwap_Materiali(GLbyte*);
-extern void __glXDispSwap_Materialiv(GLbyte*);
-extern void __glXDispSwap_PointSize(GLbyte*);
-extern void __glXDispSwap_PolygonMode(GLbyte*);
-extern void __glXDispSwap_PolygonStipple(GLbyte*);
-extern void __glXDispSwap_Scissor(GLbyte*);
-extern void __glXDispSwap_ShadeModel(GLbyte*);
-extern void __glXDispSwap_TexParameterf(GLbyte*);
-extern void __glXDispSwap_TexParameterfv(GLbyte*);
-extern void __glXDispSwap_TexParameteri(GLbyte*);
-extern void __glXDispSwap_TexParameteriv(GLbyte*);
-extern void __glXDispSwap_TexImage1D(GLbyte*);
-extern void __glXDispSwap_TexImage2D(GLbyte*);
-extern void __glXDispSwap_TexEnvf(GLbyte*);
-extern void __glXDispSwap_TexEnvfv(GLbyte*);
-extern void __glXDispSwap_TexEnvi(GLbyte*);
-extern void __glXDispSwap_TexEnviv(GLbyte*);
-extern void __glXDispSwap_TexGend(GLbyte*);
-extern void __glXDispSwap_TexGendv(GLbyte*);
-extern void __glXDispSwap_TexGenf(GLbyte*);
-extern void __glXDispSwap_TexGenfv(GLbyte*);
-extern void __glXDispSwap_TexGeni(GLbyte*);
-extern void __glXDispSwap_TexGeniv(GLbyte*);
-extern void __glXDispSwap_InitNames(GLbyte*);
-extern void __glXDispSwap_LoadName(GLbyte*);
-extern void __glXDispSwap_PassThrough(GLbyte*);
-extern void __glXDispSwap_PopName(GLbyte*);
-extern void __glXDispSwap_PushName(GLbyte*);
-extern void __glXDispSwap_DrawBuffer(GLbyte*);
-extern void __glXDispSwap_Clear(GLbyte*);
-extern void __glXDispSwap_ClearAccum(GLbyte*);
-extern void __glXDispSwap_ClearIndex(GLbyte*);
-extern void __glXDispSwap_ClearColor(GLbyte*);
-extern void __glXDispSwap_ClearStencil(GLbyte*);
-extern void __glXDispSwap_ClearDepth(GLbyte*);
-extern void __glXDispSwap_StencilMask(GLbyte*);
-extern void __glXDispSwap_ColorMask(GLbyte*);
-extern void __glXDispSwap_DepthMask(GLbyte*);
-extern void __glXDispSwap_IndexMask(GLbyte*);
-extern void __glXDispSwap_Accum(GLbyte*);
-extern void __glXDispSwap_Disable(GLbyte*);
-extern void __glXDispSwap_Enable(GLbyte*);
-extern void __glXDispSwap_PopAttrib(GLbyte*);
-extern void __glXDispSwap_PushAttrib(GLbyte*);
-extern void __glXDispSwap_Map1d(GLbyte*);
-extern void __glXDispSwap_Map1f(GLbyte*);
-extern void __glXDispSwap_Map2d(GLbyte*);
-extern void __glXDispSwap_Map2f(GLbyte*);
-extern void __glXDispSwap_MapGrid1d(GLbyte*);
-extern void __glXDispSwap_MapGrid1f(GLbyte*);
-extern void __glXDispSwap_MapGrid2d(GLbyte*);
-extern void __glXDispSwap_MapGrid2f(GLbyte*);
-extern void __glXDispSwap_EvalCoord1dv(GLbyte*);
-extern void __glXDispSwap_EvalCoord1fv(GLbyte*);
-extern void __glXDispSwap_EvalCoord2dv(GLbyte*);
-extern void __glXDispSwap_EvalCoord2fv(GLbyte*);
-extern void __glXDispSwap_EvalMesh1(GLbyte*);
-extern void __glXDispSwap_EvalPoint1(GLbyte*);
-extern void __glXDispSwap_EvalMesh2(GLbyte*);
-extern void __glXDispSwap_EvalPoint2(GLbyte*);
-extern void __glXDispSwap_AlphaFunc(GLbyte*);
-extern void __glXDispSwap_BlendFunc(GLbyte*);
-extern void __glXDispSwap_LogicOp(GLbyte*);
-extern void __glXDispSwap_StencilFunc(GLbyte*);
-extern void __glXDispSwap_StencilOp(GLbyte*);
-extern void __glXDispSwap_DepthFunc(GLbyte*);
-extern void __glXDispSwap_PixelZoom(GLbyte*);
-extern void __glXDispSwap_PixelTransferf(GLbyte*);
-extern void __glXDispSwap_PixelTransferi(GLbyte*);
-extern void __glXDispSwap_PixelMapfv(GLbyte*);
-extern void __glXDispSwap_PixelMapuiv(GLbyte*);
-extern void __glXDispSwap_PixelMapusv(GLbyte*);
-extern void __glXDispSwap_ReadBuffer(GLbyte*);
-extern void __glXDispSwap_CopyPixels(GLbyte*);
-extern void __glXDispSwap_DrawPixels(GLbyte*);
-extern void __glXDispSwap_DepthRange(GLbyte*);
-extern void __glXDispSwap_Frustum(GLbyte*);
-extern void __glXDispSwap_LoadIdentity(GLbyte*);
-extern void __glXDispSwap_LoadMatrixf(GLbyte*);
-extern void __glXDispSwap_LoadMatrixd(GLbyte*);
-extern void __glXDispSwap_MatrixMode(GLbyte*);
-extern void __glXDispSwap_MultMatrixf(GLbyte*);
-extern void __glXDispSwap_MultMatrixd(GLbyte*);
-extern void __glXDispSwap_Ortho(GLbyte*);
-extern void __glXDispSwap_PopMatrix(GLbyte*);
-extern void __glXDispSwap_PushMatrix(GLbyte*);
-extern void __glXDispSwap_Rotated(GLbyte*);
-extern void __glXDispSwap_Rotatef(GLbyte*);
-extern void __glXDispSwap_Scaled(GLbyte*);
-extern void __glXDispSwap_Scalef(GLbyte*);
-extern void __glXDispSwap_Translated(GLbyte*);
-extern void __glXDispSwap_Translatef(GLbyte*);
-extern void __glXDispSwap_Viewport(GLbyte*);
-extern void __glXDispSwap_PolygonOffset(GLbyte*);
-extern void __glXDispSwap_DrawArrays(GLbyte*);
-extern void __glXDispSwap_Indexubv(GLbyte*);
-extern void __glXDispSwap_ColorSubTable(GLbyte*);
-extern void __glXDispSwap_CopyColorSubTable(GLbyte*);
-extern void __glXDispSwap_ActiveTextureARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord1dvARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord1fvARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord1ivARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord1svARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord2dvARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord2fvARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord2ivARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord2svARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord3dvARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord3fvARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord3ivARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord3svARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord4dvARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord4fvARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord4ivARB(GLbyte*);
-extern void __glXDispSwap_MultiTexCoord4svARB(GLbyte*);
+extern void __glXDispSwap_CallList(GLbyte *);
+extern void __glXDispSwap_CallLists(GLbyte *);
+extern void __glXDispSwap_ListBase(GLbyte *);
+extern void __glXDispSwap_Begin(GLbyte *);
+extern void __glXDispSwap_Bitmap(GLbyte *);
+extern void __glXDispSwap_Color3bv(GLbyte *);
+extern void __glXDispSwap_Color3dv(GLbyte *);
+extern void __glXDispSwap_Color3fv(GLbyte *);
+extern void __glXDispSwap_Color3iv(GLbyte *);
+extern void __glXDispSwap_Color3sv(GLbyte *);
+extern void __glXDispSwap_Color3ubv(GLbyte *);
+extern void __glXDispSwap_Color3uiv(GLbyte *);
+extern void __glXDispSwap_Color3usv(GLbyte *);
+extern void __glXDispSwap_Color4bv(GLbyte *);
+extern void __glXDispSwap_Color4dv(GLbyte *);
+extern void __glXDispSwap_Color4fv(GLbyte *);
+extern void __glXDispSwap_Color4iv(GLbyte *);
+extern void __glXDispSwap_Color4sv(GLbyte *);
+extern void __glXDispSwap_Color4ubv(GLbyte *);
+extern void __glXDispSwap_Color4uiv(GLbyte *);
+extern void __glXDispSwap_Color4usv(GLbyte *);
+extern void __glXDispSwap_EdgeFlagv(GLbyte *);
+extern void __glXDispSwap_End(GLbyte *);
+extern void __glXDispSwap_Indexdv(GLbyte *);
+extern void __glXDispSwap_Indexfv(GLbyte *);
+extern void __glXDispSwap_Indexiv(GLbyte *);
+extern void __glXDispSwap_Indexsv(GLbyte *);
+extern void __glXDispSwap_Normal3bv(GLbyte *);
+extern void __glXDispSwap_Normal3dv(GLbyte *);
+extern void __glXDispSwap_Normal3fv(GLbyte *);
+extern void __glXDispSwap_Normal3iv(GLbyte *);
+extern void __glXDispSwap_Normal3sv(GLbyte *);
+extern void __glXDispSwap_RasterPos2dv(GLbyte *);
+extern void __glXDispSwap_RasterPos2fv(GLbyte *);
+extern void __glXDispSwap_RasterPos2iv(GLbyte *);
+extern void __glXDispSwap_RasterPos2sv(GLbyte *);
+extern void __glXDispSwap_RasterPos3dv(GLbyte *);
+extern void __glXDispSwap_RasterPos3fv(GLbyte *);
+extern void __glXDispSwap_RasterPos3iv(GLbyte *);
+extern void __glXDispSwap_RasterPos3sv(GLbyte *);
+extern void __glXDispSwap_RasterPos4dv(GLbyte *);
+extern void __glXDispSwap_RasterPos4fv(GLbyte *);
+extern void __glXDispSwap_RasterPos4iv(GLbyte *);
+extern void __glXDispSwap_RasterPos4sv(GLbyte *);
+extern void __glXDispSwap_Rectdv(GLbyte *);
+extern void __glXDispSwap_Rectfv(GLbyte *);
+extern void __glXDispSwap_Rectiv(GLbyte *);
+extern void __glXDispSwap_Rectsv(GLbyte *);
+extern void __glXDispSwap_TexCoord1dv(GLbyte *);
+extern void __glXDispSwap_TexCoord1fv(GLbyte *);
+extern void __glXDispSwap_TexCoord1iv(GLbyte *);
+extern void __glXDispSwap_TexCoord1sv(GLbyte *);
+extern void __glXDispSwap_TexCoord2dv(GLbyte *);
+extern void __glXDispSwap_TexCoord2fv(GLbyte *);
+extern void __glXDispSwap_TexCoord2iv(GLbyte *);
+extern void __glXDispSwap_TexCoord2sv(GLbyte *);
+extern void __glXDispSwap_TexCoord3dv(GLbyte *);
+extern void __glXDispSwap_TexCoord3fv(GLbyte *);
+extern void __glXDispSwap_TexCoord3iv(GLbyte *);
+extern void __glXDispSwap_TexCoord3sv(GLbyte *);
+extern void __glXDispSwap_TexCoord4dv(GLbyte *);
+extern void __glXDispSwap_TexCoord4fv(GLbyte *);
+extern void __glXDispSwap_TexCoord4iv(GLbyte *);
+extern void __glXDispSwap_TexCoord4sv(GLbyte *);
+extern void __glXDispSwap_Vertex2dv(GLbyte *);
+extern void __glXDispSwap_Vertex2fv(GLbyte *);
+extern void __glXDispSwap_Vertex2iv(GLbyte *);
+extern void __glXDispSwap_Vertex2sv(GLbyte *);
+extern void __glXDispSwap_Vertex3dv(GLbyte *);
+extern void __glXDispSwap_Vertex3fv(GLbyte *);
+extern void __glXDispSwap_Vertex3iv(GLbyte *);
+extern void __glXDispSwap_Vertex3sv(GLbyte *);
+extern void __glXDispSwap_Vertex4dv(GLbyte *);
+extern void __glXDispSwap_Vertex4fv(GLbyte *);
+extern void __glXDispSwap_Vertex4iv(GLbyte *);
+extern void __glXDispSwap_Vertex4sv(GLbyte *);
+extern void __glXDispSwap_ClipPlane(GLbyte *);
+extern void __glXDispSwap_ColorMaterial(GLbyte *);
+extern void __glXDispSwap_CullFace(GLbyte *);
+extern void __glXDispSwap_Fogf(GLbyte *);
+extern void __glXDispSwap_Fogfv(GLbyte *);
+extern void __glXDispSwap_Fogi(GLbyte *);
+extern void __glXDispSwap_Fogiv(GLbyte *);
+extern void __glXDispSwap_FrontFace(GLbyte *);
+extern void __glXDispSwap_Hint(GLbyte *);
+extern void __glXDispSwap_Lightf(GLbyte *);
+extern void __glXDispSwap_Lightfv(GLbyte *);
+extern void __glXDispSwap_Lighti(GLbyte *);
+extern void __glXDispSwap_Lightiv(GLbyte *);
+extern void __glXDispSwap_LightModelf(GLbyte *);
+extern void __glXDispSwap_LightModelfv(GLbyte *);
+extern void __glXDispSwap_LightModeli(GLbyte *);
+extern void __glXDispSwap_LightModeliv(GLbyte *);
+extern void __glXDispSwap_LineStipple(GLbyte *);
+extern void __glXDispSwap_LineWidth(GLbyte *);
+extern void __glXDispSwap_Materialf(GLbyte *);
+extern void __glXDispSwap_Materialfv(GLbyte *);
+extern void __glXDispSwap_Materiali(GLbyte *);
+extern void __glXDispSwap_Materialiv(GLbyte *);
+extern void __glXDispSwap_PointSize(GLbyte *);
+extern void __glXDispSwap_PolygonMode(GLbyte *);
+extern void __glXDispSwap_PolygonStipple(GLbyte *);
+extern void __glXDispSwap_Scissor(GLbyte *);
+extern void __glXDispSwap_ShadeModel(GLbyte *);
+extern void __glXDispSwap_TexParameterf(GLbyte *);
+extern void __glXDispSwap_TexParameterfv(GLbyte *);
+extern void __glXDispSwap_TexParameteri(GLbyte *);
+extern void __glXDispSwap_TexParameteriv(GLbyte *);
+extern void __glXDispSwap_TexImage1D(GLbyte *);
+extern void __glXDispSwap_TexImage2D(GLbyte *);
+extern void __glXDispSwap_TexEnvf(GLbyte *);
+extern void __glXDispSwap_TexEnvfv(GLbyte *);
+extern void __glXDispSwap_TexEnvi(GLbyte *);
+extern void __glXDispSwap_TexEnviv(GLbyte *);
+extern void __glXDispSwap_TexGend(GLbyte *);
+extern void __glXDispSwap_TexGendv(GLbyte *);
+extern void __glXDispSwap_TexGenf(GLbyte *);
+extern void __glXDispSwap_TexGenfv(GLbyte *);
+extern void __glXDispSwap_TexGeni(GLbyte *);
+extern void __glXDispSwap_TexGeniv(GLbyte *);
+extern void __glXDispSwap_InitNames(GLbyte *);
+extern void __glXDispSwap_LoadName(GLbyte *);
+extern void __glXDispSwap_PassThrough(GLbyte *);
+extern void __glXDispSwap_PopName(GLbyte *);
+extern void __glXDispSwap_PushName(GLbyte *);
+extern void __glXDispSwap_DrawBuffer(GLbyte *);
+extern void __glXDispSwap_Clear(GLbyte *);
+extern void __glXDispSwap_ClearAccum(GLbyte *);
+extern void __glXDispSwap_ClearIndex(GLbyte *);
+extern void __glXDispSwap_ClearColor(GLbyte *);
+extern void __glXDispSwap_ClearStencil(GLbyte *);
+extern void __glXDispSwap_ClearDepth(GLbyte *);
+extern void __glXDispSwap_StencilMask(GLbyte *);
+extern void __glXDispSwap_ColorMask(GLbyte *);
+extern void __glXDispSwap_DepthMask(GLbyte *);
+extern void __glXDispSwap_IndexMask(GLbyte *);
+extern void __glXDispSwap_Accum(GLbyte *);
+extern void __glXDispSwap_Disable(GLbyte *);
+extern void __glXDispSwap_Enable(GLbyte *);
+extern void __glXDispSwap_PopAttrib(GLbyte *);
+extern void __glXDispSwap_PushAttrib(GLbyte *);
+extern void __glXDispSwap_Map1d(GLbyte *);
+extern void __glXDispSwap_Map1f(GLbyte *);
+extern void __glXDispSwap_Map2d(GLbyte *);
+extern void __glXDispSwap_Map2f(GLbyte *);
+extern void __glXDispSwap_MapGrid1d(GLbyte *);
+extern void __glXDispSwap_MapGrid1f(GLbyte *);
+extern void __glXDispSwap_MapGrid2d(GLbyte *);
+extern void __glXDispSwap_MapGrid2f(GLbyte *);
+extern void __glXDispSwap_EvalCoord1dv(GLbyte *);
+extern void __glXDispSwap_EvalCoord1fv(GLbyte *);
+extern void __glXDispSwap_EvalCoord2dv(GLbyte *);
+extern void __glXDispSwap_EvalCoord2fv(GLbyte *);
+extern void __glXDispSwap_EvalMesh1(GLbyte *);
+extern void __glXDispSwap_EvalPoint1(GLbyte *);
+extern void __glXDispSwap_EvalMesh2(GLbyte *);
+extern void __glXDispSwap_EvalPoint2(GLbyte *);
+extern void __glXDispSwap_AlphaFunc(GLbyte *);
+extern void __glXDispSwap_BlendFunc(GLbyte *);
+extern void __glXDispSwap_LogicOp(GLbyte *);
+extern void __glXDispSwap_StencilFunc(GLbyte *);
+extern void __glXDispSwap_StencilOp(GLbyte *);
+extern void __glXDispSwap_DepthFunc(GLbyte *);
+extern void __glXDispSwap_PixelZoom(GLbyte *);
+extern void __glXDispSwap_PixelTransferf(GLbyte *);
+extern void __glXDispSwap_PixelTransferi(GLbyte *);
+extern void __glXDispSwap_PixelMapfv(GLbyte *);
+extern void __glXDispSwap_PixelMapuiv(GLbyte *);
+extern void __glXDispSwap_PixelMapusv(GLbyte *);
+extern void __glXDispSwap_ReadBuffer(GLbyte *);
+extern void __glXDispSwap_CopyPixels(GLbyte *);
+extern void __glXDispSwap_DrawPixels(GLbyte *);
+extern void __glXDispSwap_DepthRange(GLbyte *);
+extern void __glXDispSwap_Frustum(GLbyte *);
+extern void __glXDispSwap_LoadIdentity(GLbyte *);
+extern void __glXDispSwap_LoadMatrixf(GLbyte *);
+extern void __glXDispSwap_LoadMatrixd(GLbyte *);
+extern void __glXDispSwap_MatrixMode(GLbyte *);
+extern void __glXDispSwap_MultMatrixf(GLbyte *);
+extern void __glXDispSwap_MultMatrixd(GLbyte *);
+extern void __glXDispSwap_Ortho(GLbyte *);
+extern void __glXDispSwap_PopMatrix(GLbyte *);
+extern void __glXDispSwap_PushMatrix(GLbyte *);
+extern void __glXDispSwap_Rotated(GLbyte *);
+extern void __glXDispSwap_Rotatef(GLbyte *);
+extern void __glXDispSwap_Scaled(GLbyte *);
+extern void __glXDispSwap_Scalef(GLbyte *);
+extern void __glXDispSwap_Translated(GLbyte *);
+extern void __glXDispSwap_Translatef(GLbyte *);
+extern void __glXDispSwap_Viewport(GLbyte *);
+extern void __glXDispSwap_PolygonOffset(GLbyte *);
+extern void __glXDispSwap_DrawArrays(GLbyte *);
+extern void __glXDispSwap_Indexubv(GLbyte *);
+extern void __glXDispSwap_ColorSubTable(GLbyte *);
+extern void __glXDispSwap_CopyColorSubTable(GLbyte *);
+extern void __glXDispSwap_ActiveTextureARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord1dvARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord1fvARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord1ivARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord1svARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord2dvARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord2fvARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord2ivARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord2svARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord3dvARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord3fvARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord3ivARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord3svARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord4dvARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord4fvARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord4ivARB(GLbyte *);
+extern void __glXDispSwap_MultiTexCoord4svARB(GLbyte *);
-extern void __glXDispSwap_TexSubImage1D(GLbyte*);
-extern void __glXDispSwap_TexSubImage2D(GLbyte*);
-extern void __glXDispSwap_ConvolutionFilter1D(GLbyte*);
-extern void __glXDispSwap_ConvolutionFilter2D(GLbyte*);
-extern void __glXDispSwap_ConvolutionParameterfv(GLbyte*);
-extern void __glXDispSwap_ConvolutionParameteriv(GLbyte*);
-extern void __glXDispSwap_CopyConvolutionFilter1D(GLbyte*);
-extern void __glXDispSwap_CopyConvolutionFilter2D(GLbyte*);
-extern void __glXDispSwap_SeparableFilter2D(GLbyte*);
-extern void __glXDispSwap_TexImage3D(GLbyte*);
-extern void __glXDispSwap_TexSubImage3D(GLbyte*);
-extern void __glXDispSwap_DrawArrays(GLbyte*);
-extern void __glXDispSwap_PrioritizeTextures(GLbyte*);
-extern void __glXDispSwap_CopyTexImage1D(GLbyte*);
-extern void __glXDispSwap_CopyTexImage2D(GLbyte*);
-extern void __glXDispSwap_CopyTexSubImage1D(GLbyte*);
-extern void __glXDispSwap_CopyTexSubImage2D(GLbyte*);
-extern void __glXDispSwap_CopyTexSubImage3D(GLbyte*);
+extern void __glXDispSwap_TexSubImage1D(GLbyte *);
+extern void __glXDispSwap_TexSubImage2D(GLbyte *);
+extern void __glXDispSwap_ConvolutionFilter1D(GLbyte *);
+extern void __glXDispSwap_ConvolutionFilter2D(GLbyte *);
+extern void __glXDispSwap_ConvolutionParameterfv(GLbyte *);
+extern void __glXDispSwap_ConvolutionParameteriv(GLbyte *);
+extern void __glXDispSwap_CopyConvolutionFilter1D(GLbyte *);
+extern void __glXDispSwap_CopyConvolutionFilter2D(GLbyte *);
+extern void __glXDispSwap_SeparableFilter2D(GLbyte *);
+extern void __glXDispSwap_TexImage3D(GLbyte *);
+extern void __glXDispSwap_TexSubImage3D(GLbyte *);
+extern void __glXDispSwap_DrawArrays(GLbyte *);
+extern void __glXDispSwap_PrioritizeTextures(GLbyte *);
+extern void __glXDispSwap_CopyTexImage1D(GLbyte *);
+extern void __glXDispSwap_CopyTexImage2D(GLbyte *);
+extern void __glXDispSwap_CopyTexSubImage1D(GLbyte *);
+extern void __glXDispSwap_CopyTexSubImage2D(GLbyte *);
+extern void __glXDispSwap_CopyTexSubImage3D(GLbyte *);
#define __GLX_MIN_GLXCMD_OPCODE 1
#define __GLX_MAX_GLXCMD_OPCODE 20
@@ -673,4 +677,4 @@ extern void __glXDispSwap_CopyTexSubImage3D(GLbyte*);
extern __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE];
extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[__GLX_SINGLE_TABLE_SIZE];
-#endif /* _GLX_g_disptab_h_ */
+#endif /* _GLX_g_disptab_h_ */
diff --git a/xorg-server/hw/dmx/glxProxy/g_renderswap.c b/xorg-server/hw/dmx/glxProxy/g_renderswap.c
index e434a71b6..ce1c609bd 100644
--- a/xorg-server/hw/dmx/glxProxy/g_renderswap.c
+++ b/xorg-server/hw/dmx/glxProxy/g_renderswap.c
@@ -34,2401 +34,2630 @@
#include "unpack.h"
#include "compsize.h"
-void __glXDispSwap_CallList(GLbyte *pc)
+void
+__glXDispSwap_CallList(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_ListBase(GLbyte *pc)
+void
+__glXDispSwap_ListBase(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_Begin(GLbyte *pc)
+void
+__glXDispSwap_Begin(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_Color3bv(GLbyte *pc)
+void
+__glXDispSwap_Color3bv(GLbyte * pc)
{
}
-void __glXDispSwap_Color3dv(GLbyte *pc)
+void
+__glXDispSwap_Color3dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 24);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 24);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Color3fv(GLbyte *pc)
+void
+__glXDispSwap_Color3fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Color3iv(GLbyte *pc)
+void
+__glXDispSwap_Color3iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Color3sv(GLbyte *pc)
+void
+__glXDispSwap_Color3sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Color3ubv(GLbyte *pc)
+void
+__glXDispSwap_Color3ubv(GLbyte * pc)
{
}
-void __glXDispSwap_Color3uiv(GLbyte *pc)
+void
+__glXDispSwap_Color3uiv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Color3usv(GLbyte *pc)
+void
+__glXDispSwap_Color3usv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Color4bv(GLbyte *pc)
+void
+__glXDispSwap_Color4bv(GLbyte * pc)
{
}
-void __glXDispSwap_Color4dv(GLbyte *pc)
+void
+__glXDispSwap_Color4dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 32);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 32);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Color4fv(GLbyte *pc)
+void
+__glXDispSwap_Color4fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Color4iv(GLbyte *pc)
+void
+__glXDispSwap_Color4iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Color4sv(GLbyte *pc)
+void
+__glXDispSwap_Color4sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Color4ubv(GLbyte *pc)
+void
+__glXDispSwap_Color4ubv(GLbyte * pc)
{
}
-void __glXDispSwap_Color4uiv(GLbyte *pc)
+void
+__glXDispSwap_Color4uiv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Color4usv(GLbyte *pc)
+void
+__glXDispSwap_Color4usv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_EdgeFlagv(GLbyte *pc)
+void
+__glXDispSwap_EdgeFlagv(GLbyte * pc)
{
}
-void __glXDispSwap_End(GLbyte *pc)
+void
+__glXDispSwap_End(GLbyte * pc)
{
}
-void __glXDispSwap_Indexdv(GLbyte *pc)
+void
+__glXDispSwap_Indexdv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 8);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 8);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_Indexfv(GLbyte *pc)
+void
+__glXDispSwap_Indexfv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_Indexiv(GLbyte *pc)
+void
+__glXDispSwap_Indexiv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 1);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_Indexsv(GLbyte *pc)
+void
+__glXDispSwap_Indexsv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 1);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_Normal3bv(GLbyte *pc)
+void
+__glXDispSwap_Normal3bv(GLbyte * pc)
{
}
-void __glXDispSwap_Normal3dv(GLbyte *pc)
+void
+__glXDispSwap_Normal3dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 24);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 24);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Normal3fv(GLbyte *pc)
+void
+__glXDispSwap_Normal3fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Normal3iv(GLbyte *pc)
+void
+__glXDispSwap_Normal3iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Normal3sv(GLbyte *pc)
+void
+__glXDispSwap_Normal3sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_RasterPos2dv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos2dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 16);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 16);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_RasterPos2fv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos2fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_RasterPos2iv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos2iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_RasterPos2sv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos2sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_RasterPos3dv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos3dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 24);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 24);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_RasterPos3fv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos3fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_RasterPos3iv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos3iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_RasterPos3sv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos3sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_RasterPos4dv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos4dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 32);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 32);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_RasterPos4fv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos4fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_RasterPos4iv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos4iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_RasterPos4sv(GLbyte *pc)
+void
+__glXDispSwap_RasterPos4sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Rectdv(GLbyte *pc)
+void
+__glXDispSwap_Rectdv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 32);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 32);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
- __GLX_SWAP_DOUBLE_ARRAY(pc + 16, 2);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 16, 2);
}
-void __glXDispSwap_Rectfv(GLbyte *pc)
+void
+__glXDispSwap_Rectfv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
- __GLX_SWAP_FLOAT_ARRAY(pc + 8, 2);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, 2);
}
-void __glXDispSwap_Rectiv(GLbyte *pc)
+void
+__glXDispSwap_Rectiv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 2);
- __GLX_SWAP_INT_ARRAY(pc + 8, 2);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_INT_ARRAY(pc + 8, 2);
}
-void __glXDispSwap_Rectsv(GLbyte *pc)
+void
+__glXDispSwap_Rectsv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
- __GLX_SWAP_SHORT_ARRAY(pc + 4, 2);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_SHORT_ARRAY(pc + 4, 2);
}
-void __glXDispSwap_TexCoord1dv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord1dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 8);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 8);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_TexCoord1fv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord1fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_TexCoord1iv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord1iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 1);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_TexCoord1sv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord1sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 1);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_TexCoord2dv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord2dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 16);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 16);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_TexCoord2fv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord2fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_TexCoord2iv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord2iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_TexCoord2sv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord2sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_TexCoord3dv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord3dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 24);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 24);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_TexCoord3fv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord3fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_TexCoord3iv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord3iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_TexCoord3sv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord3sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_TexCoord4dv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord4dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 32);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 32);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_TexCoord4fv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord4fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_TexCoord4iv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord4iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_TexCoord4sv(GLbyte *pc)
+void
+__glXDispSwap_TexCoord4sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Vertex2dv(GLbyte *pc)
+void
+__glXDispSwap_Vertex2dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 16);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 16);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_Vertex2fv(GLbyte *pc)
+void
+__glXDispSwap_Vertex2fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_Vertex2iv(GLbyte *pc)
+void
+__glXDispSwap_Vertex2iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_Vertex2sv(GLbyte *pc)
+void
+__glXDispSwap_Vertex2sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_Vertex3dv(GLbyte *pc)
+void
+__glXDispSwap_Vertex3dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 24);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 24);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Vertex3fv(GLbyte *pc)
+void
+__glXDispSwap_Vertex3fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Vertex3iv(GLbyte *pc)
+void
+__glXDispSwap_Vertex3iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Vertex3sv(GLbyte *pc)
+void
+__glXDispSwap_Vertex3sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_Vertex4dv(GLbyte *pc)
+void
+__glXDispSwap_Vertex4dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 32);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 32);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Vertex4fv(GLbyte *pc)
+void
+__glXDispSwap_Vertex4fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Vertex4iv(GLbyte *pc)
+void
+__glXDispSwap_Vertex4iv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_INT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_Vertex4sv(GLbyte *pc)
+void
+__glXDispSwap_Vertex4sv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
+ __GLX_SWAP_SHORT_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_ClipPlane(GLbyte *pc)
+void
+__glXDispSwap_ClipPlane(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 36);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 36);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_INT(pc + 32);
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+ __GLX_SWAP_INT(pc + 32);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_ColorMaterial(GLbyte *pc)
+void
+__glXDispSwap_ColorMaterial(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_CullFace(GLbyte *pc)
+void
+__glXDispSwap_CullFace(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_Fogf(GLbyte *pc)
+void
+__glXDispSwap_Fogf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
}
-void __glXDispSwap_Fogfv(GLbyte *pc)
+void
+__glXDispSwap_Fogfv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- pname = *(GLenum *)(pc + 0);
- compsize = __glFogfv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize);
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *) (pc + 0);
+ compsize = __glFogfv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize);
}
-void __glXDispSwap_Fogi(GLbyte *pc)
+void
+__glXDispSwap_Fogi(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_Fogiv(GLbyte *pc)
+void
+__glXDispSwap_Fogiv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
- __GLX_SWAP_INT(pc + 0);
- pname = *(GLenum *)(pc + 0);
- compsize = __glFogiv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT_ARRAY(pc + 4, compsize);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *) (pc + 0);
+ compsize = __glFogiv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT_ARRAY(pc + 4, compsize);
}
-void __glXDispSwap_FrontFace(GLbyte *pc)
+void
+__glXDispSwap_FrontFace(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_Hint(GLbyte *pc)
+void
+__glXDispSwap_Hint(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_Lightf(GLbyte *pc)
+void
+__glXDispSwap_Lightf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
}
-void __glXDispSwap_Lightfv(GLbyte *pc)
+void
+__glXDispSwap_Lightfv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glLightfv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glLightfv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_Lighti(GLbyte *pc)
+void
+__glXDispSwap_Lighti(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_Lightiv(GLbyte *pc)
+void
+__glXDispSwap_Lightiv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glLightiv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glLightiv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_LightModelf(GLbyte *pc)
+void
+__glXDispSwap_LightModelf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
}
-void __glXDispSwap_LightModelfv(GLbyte *pc)
+void
+__glXDispSwap_LightModelfv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- pname = *(GLenum *)(pc + 0);
- compsize = __glLightModelfv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize);
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *) (pc + 0);
+ compsize = __glLightModelfv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize);
}
-void __glXDispSwap_LightModeli(GLbyte *pc)
+void
+__glXDispSwap_LightModeli(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_LightModeliv(GLbyte *pc)
+void
+__glXDispSwap_LightModeliv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- pname = *(GLenum *)(pc + 0);
- compsize = __glLightModeliv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT_ARRAY(pc + 4, compsize);
+ __GLX_SWAP_INT(pc + 0);
+ pname = *(GLenum *) (pc + 0);
+ compsize = __glLightModeliv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT_ARRAY(pc + 4, compsize);
}
-void __glXDispSwap_LineStipple(GLbyte *pc)
+void
+__glXDispSwap_LineStipple(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_SHORT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT(pc + 4);
}
-void __glXDispSwap_LineWidth(GLbyte *pc)
+void
+__glXDispSwap_LineWidth(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 0);
}
-void __glXDispSwap_Materialf(GLbyte *pc)
+void
+__glXDispSwap_Materialf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
}
-void __glXDispSwap_Materialfv(GLbyte *pc)
+void
+__glXDispSwap_Materialfv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glMaterialfv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glMaterialfv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_Materiali(GLbyte *pc)
+void
+__glXDispSwap_Materiali(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_Materialiv(GLbyte *pc)
+void
+__glXDispSwap_Materialiv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glMaterialiv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glMaterialiv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_PointSize(GLbyte *pc)
+void
+__glXDispSwap_PointSize(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 0);
}
-void __glXDispSwap_PolygonMode(GLbyte *pc)
+void
+__glXDispSwap_PolygonMode(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_Scissor(GLbyte *pc)
+void
+__glXDispSwap_Scissor(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
}
-void __glXDispSwap_ShadeModel(GLbyte *pc)
+void
+__glXDispSwap_ShadeModel(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_TexParameterf(GLbyte *pc)
+void
+__glXDispSwap_TexParameterf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
}
-void __glXDispSwap_TexParameterfv(GLbyte *pc)
+void
+__glXDispSwap_TexParameterfv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glTexParameterfv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glTexParameterfv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_TexParameteri(GLbyte *pc)
+void
+__glXDispSwap_TexParameteri(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_TexParameteriv(GLbyte *pc)
+void
+__glXDispSwap_TexParameteriv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glTexParameteriv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glTexParameteriv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_TexEnvf(GLbyte *pc)
+void
+__glXDispSwap_TexEnvf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
}
-void __glXDispSwap_TexEnvfv(GLbyte *pc)
+void
+__glXDispSwap_TexEnvfv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glTexEnvfv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glTexEnvfv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_TexEnvi(GLbyte *pc)
+void
+__glXDispSwap_TexEnvi(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_TexEnviv(GLbyte *pc)
+void
+__glXDispSwap_TexEnviv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glTexEnviv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glTexEnviv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_TexGend(GLbyte *pc)
+void
+__glXDispSwap_TexGend(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 16);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 16);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_DOUBLE(pc + 0);
}
-void __glXDispSwap_TexGendv(GLbyte *pc)
+void
+__glXDispSwap_TexGendv(GLbyte * pc)
{
- GLenum pname;
- GLint cmdlen;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint cmdlen;
+ GLint compsize;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glTexGendv_size(pname);
- if (compsize < 0) compsize = 0;
- cmdlen = __GLX_PAD(8+compsize*8);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glTexGendv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ cmdlen = __GLX_PAD(8 + compsize * 8);
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, cmdlen);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, cmdlen);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_DOUBLE_ARRAY(pc + 8, compsize);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_TexGenf(GLbyte *pc)
+void
+__glXDispSwap_TexGenf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
}
-void __glXDispSwap_TexGenfv(GLbyte *pc)
+void
+__glXDispSwap_TexGenfv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glTexGenfv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glTexGenfv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_TexGeni(GLbyte *pc)
+void
+__glXDispSwap_TexGeni(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_TexGeniv(GLbyte *pc)
+void
+__glXDispSwap_TexGeniv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glTexGeniv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glTexGeniv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_InitNames(GLbyte *pc)
+void
+__glXDispSwap_InitNames(GLbyte * pc)
{
}
-void __glXDispSwap_LoadName(GLbyte *pc)
+void
+__glXDispSwap_LoadName(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_PassThrough(GLbyte *pc)
+void
+__glXDispSwap_PassThrough(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 0);
}
-void __glXDispSwap_PopName(GLbyte *pc)
+void
+__glXDispSwap_PopName(GLbyte * pc)
{
}
-void __glXDispSwap_PushName(GLbyte *pc)
+void
+__glXDispSwap_PushName(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_DrawBuffer(GLbyte *pc)
+void
+__glXDispSwap_DrawBuffer(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_Clear(GLbyte *pc)
+void
+__glXDispSwap_Clear(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_ClearAccum(GLbyte *pc)
+void
+__glXDispSwap_ClearAccum(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
- __GLX_SWAP_FLOAT(pc + 12);
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 12);
}
-void __glXDispSwap_ClearIndex(GLbyte *pc)
+void
+__glXDispSwap_ClearIndex(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 0);
}
-void __glXDispSwap_ClearColor(GLbyte *pc)
+void
+__glXDispSwap_ClearColor(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
- __GLX_SWAP_FLOAT(pc + 12);
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 12);
}
-void __glXDispSwap_ClearStencil(GLbyte *pc)
+void
+__glXDispSwap_ClearStencil(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_ClearDepth(GLbyte *pc)
+void
+__glXDispSwap_ClearDepth(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 8);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 8);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 0);
}
-void __glXDispSwap_StencilMask(GLbyte *pc)
+void
+__glXDispSwap_StencilMask(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_ColorMask(GLbyte *pc)
+void
+__glXDispSwap_ColorMask(GLbyte * pc)
{
}
-void __glXDispSwap_DepthMask(GLbyte *pc)
+void
+__glXDispSwap_DepthMask(GLbyte * pc)
{
}
-void __glXDispSwap_IndexMask(GLbyte *pc)
+void
+__glXDispSwap_IndexMask(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_Accum(GLbyte *pc)
+void
+__glXDispSwap_Accum(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
}
-void __glXDispSwap_Disable(GLbyte *pc)
+void
+__glXDispSwap_Disable(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_Enable(GLbyte *pc)
+void
+__glXDispSwap_Enable(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_PopAttrib(GLbyte *pc)
+void
+__glXDispSwap_PopAttrib(GLbyte * pc)
{
}
-void __glXDispSwap_PushAttrib(GLbyte *pc)
+void
+__glXDispSwap_PushAttrib(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_MapGrid1d(GLbyte *pc)
+void
+__glXDispSwap_MapGrid1d(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 20);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 20);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_INT(pc + 16);
- __GLX_SWAP_DOUBLE(pc + 0);
- __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
}
-void __glXDispSwap_MapGrid1f(GLbyte *pc)
+void
+__glXDispSwap_MapGrid1f(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
}
-void __glXDispSwap_MapGrid2d(GLbyte *pc)
+void
+__glXDispSwap_MapGrid2d(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 40);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 40);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_INT(pc + 32);
- __GLX_SWAP_DOUBLE(pc + 0);
- __GLX_SWAP_DOUBLE(pc + 8);
- __GLX_SWAP_INT(pc + 36);
- __GLX_SWAP_DOUBLE(pc + 16);
- __GLX_SWAP_DOUBLE(pc + 24);
+ __GLX_SWAP_INT(pc + 32);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_INT(pc + 36);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
}
-void __glXDispSwap_MapGrid2f(GLbyte *pc)
+void
+__glXDispSwap_MapGrid2f(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_FLOAT(pc + 16);
- __GLX_SWAP_FLOAT(pc + 20);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_FLOAT(pc + 16);
+ __GLX_SWAP_FLOAT(pc + 20);
}
-void __glXDispSwap_EvalCoord1dv(GLbyte *pc)
+void
+__glXDispSwap_EvalCoord1dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 8);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 8);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_EvalCoord1fv(GLbyte *pc)
+void
+__glXDispSwap_EvalCoord1fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_EvalCoord2dv(GLbyte *pc)
+void
+__glXDispSwap_EvalCoord2dv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 16);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 16);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_EvalCoord2fv(GLbyte *pc)
+void
+__glXDispSwap_EvalCoord2fv(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_EvalMesh1(GLbyte *pc)
+void
+__glXDispSwap_EvalMesh1(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_EvalPoint1(GLbyte *pc)
+void
+__glXDispSwap_EvalPoint1(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_EvalMesh2(GLbyte *pc)
+void
+__glXDispSwap_EvalMesh2(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
}
-void __glXDispSwap_EvalPoint2(GLbyte *pc)
+void
+__glXDispSwap_EvalPoint2(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_AlphaFunc(GLbyte *pc)
+void
+__glXDispSwap_AlphaFunc(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
}
-void __glXDispSwap_BlendFunc(GLbyte *pc)
+void
+__glXDispSwap_BlendFunc(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_LogicOp(GLbyte *pc)
+void
+__glXDispSwap_LogicOp(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_StencilFunc(GLbyte *pc)
+void
+__glXDispSwap_StencilFunc(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_StencilOp(GLbyte *pc)
+void
+__glXDispSwap_StencilOp(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_DepthFunc(GLbyte *pc)
+void
+__glXDispSwap_DepthFunc(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_PixelZoom(GLbyte *pc)
+void
+__glXDispSwap_PixelZoom(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
}
-void __glXDispSwap_PixelTransferf(GLbyte *pc)
+void
+__glXDispSwap_PixelTransferf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
}
-void __glXDispSwap_PixelTransferi(GLbyte *pc)
+void
+__glXDispSwap_PixelTransferi(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_PixelMapfv(GLbyte *pc)
+void
+__glXDispSwap_PixelMapfv(GLbyte * pc)
{
- GLint mapsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLint mapsize;
- __GLX_SWAP_INT(pc + 4);
- mapsize = *(GLint *)(pc + 4);
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 8, mapsize);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ mapsize = *(GLint *) (pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, mapsize);
}
-void __glXDispSwap_PixelMapuiv(GLbyte *pc)
+void
+__glXDispSwap_PixelMapuiv(GLbyte * pc)
{
- GLint mapsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLint mapsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 4);
- mapsize = *(GLint *)(pc + 4);
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 8, mapsize);
+ __GLX_SWAP_INT(pc + 4);
+ mapsize = *(GLint *) (pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, mapsize);
}
-void __glXDispSwap_PixelMapusv(GLbyte *pc)
+void
+__glXDispSwap_PixelMapusv(GLbyte * pc)
{
- GLint mapsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLint mapsize;
- __GLX_SWAP_INT(pc + 4);
- mapsize = *(GLint *)(pc + 4);
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_SHORT_ARRAY(pc + 8, mapsize);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ mapsize = *(GLint *) (pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT_ARRAY(pc + 8, mapsize);
}
-void __glXDispSwap_ReadBuffer(GLbyte *pc)
+void
+__glXDispSwap_ReadBuffer(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_CopyPixels(GLbyte *pc)
+void
+__glXDispSwap_CopyPixels(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
}
-void __glXDispSwap_DepthRange(GLbyte *pc)
+void
+__glXDispSwap_DepthRange(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 16);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 16);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE(pc + 0);
- __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
}
-void __glXDispSwap_Frustum(GLbyte *pc)
+void
+__glXDispSwap_Frustum(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 48);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 48);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE(pc + 0);
- __GLX_SWAP_DOUBLE(pc + 8);
- __GLX_SWAP_DOUBLE(pc + 16);
- __GLX_SWAP_DOUBLE(pc + 24);
- __GLX_SWAP_DOUBLE(pc + 32);
- __GLX_SWAP_DOUBLE(pc + 40);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
+ __GLX_SWAP_DOUBLE(pc + 32);
+ __GLX_SWAP_DOUBLE(pc + 40);
}
-void __glXDispSwap_LoadIdentity(GLbyte *pc)
+void
+__glXDispSwap_LoadIdentity(GLbyte * pc)
{
}
-void __glXDispSwap_LoadMatrixf(GLbyte *pc)
+void
+__glXDispSwap_LoadMatrixf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16);
}
-void __glXDispSwap_LoadMatrixd(GLbyte *pc)
+void
+__glXDispSwap_LoadMatrixd(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 128);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 128);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 16);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 16);
}
-void __glXDispSwap_MatrixMode(GLbyte *pc)
+void
+__glXDispSwap_MatrixMode(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_MultMatrixf(GLbyte *pc)
+void
+__glXDispSwap_MultMatrixf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16);
}
-void __glXDispSwap_MultMatrixd(GLbyte *pc)
+void
+__glXDispSwap_MultMatrixd(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 128);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 128);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 16);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 16);
}
-void __glXDispSwap_Ortho(GLbyte *pc)
+void
+__glXDispSwap_Ortho(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 48);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 48);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE(pc + 0);
- __GLX_SWAP_DOUBLE(pc + 8);
- __GLX_SWAP_DOUBLE(pc + 16);
- __GLX_SWAP_DOUBLE(pc + 24);
- __GLX_SWAP_DOUBLE(pc + 32);
- __GLX_SWAP_DOUBLE(pc + 40);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
+ __GLX_SWAP_DOUBLE(pc + 32);
+ __GLX_SWAP_DOUBLE(pc + 40);
}
-void __glXDispSwap_PopMatrix(GLbyte *pc)
+void
+__glXDispSwap_PopMatrix(GLbyte * pc)
{
}
-void __glXDispSwap_PushMatrix(GLbyte *pc)
+void
+__glXDispSwap_PushMatrix(GLbyte * pc)
{
}
-void __glXDispSwap_Rotated(GLbyte *pc)
+void
+__glXDispSwap_Rotated(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 32);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 32);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE(pc + 0);
- __GLX_SWAP_DOUBLE(pc + 8);
- __GLX_SWAP_DOUBLE(pc + 16);
- __GLX_SWAP_DOUBLE(pc + 24);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 24);
}
-void __glXDispSwap_Rotatef(GLbyte *pc)
+void
+__glXDispSwap_Rotatef(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
- __GLX_SWAP_FLOAT(pc + 12);
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 12);
}
-void __glXDispSwap_Scaled(GLbyte *pc)
+void
+__glXDispSwap_Scaled(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 24);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 24);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE(pc + 0);
- __GLX_SWAP_DOUBLE(pc + 8);
- __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
}
-void __glXDispSwap_Scalef(GLbyte *pc)
+void
+__glXDispSwap_Scalef(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
}
-void __glXDispSwap_Translated(GLbyte *pc)
+void
+__glXDispSwap_Translated(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 24);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 24);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_DOUBLE(pc + 0);
- __GLX_SWAP_DOUBLE(pc + 8);
- __GLX_SWAP_DOUBLE(pc + 16);
+ __GLX_SWAP_DOUBLE(pc + 0);
+ __GLX_SWAP_DOUBLE(pc + 8);
+ __GLX_SWAP_DOUBLE(pc + 16);
}
-void __glXDispSwap_Translatef(GLbyte *pc)
+void
+__glXDispSwap_Translatef(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
}
-void __glXDispSwap_Viewport(GLbyte *pc)
+void
+__glXDispSwap_Viewport(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
}
-void __glXDispSwap_PolygonOffset(GLbyte *pc)
+void
+__glXDispSwap_PolygonOffset(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
}
-void __glXDispSwap_CopyTexImage1D(GLbyte *pc)
+void
+__glXDispSwap_CopyTexImage1D(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
- __GLX_SWAP_INT(pc + 20);
- __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 24);
}
-void __glXDispSwap_CopyTexImage2D(GLbyte *pc)
+void
+__glXDispSwap_CopyTexImage2D(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
- __GLX_SWAP_INT(pc + 20);
- __GLX_SWAP_INT(pc + 24);
- __GLX_SWAP_INT(pc + 28);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_INT(pc + 28);
}
-void __glXDispSwap_CopyTexSubImage1D(GLbyte *pc)
+void
+__glXDispSwap_CopyTexSubImage1D(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
- __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
}
-void __glXDispSwap_CopyTexSubImage2D(GLbyte *pc)
+void
+__glXDispSwap_CopyTexSubImage2D(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
- __GLX_SWAP_INT(pc + 20);
- __GLX_SWAP_INT(pc + 24);
- __GLX_SWAP_INT(pc + 28);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_INT(pc + 28);
}
-void __glXDispSwap_BindTexture(GLbyte *pc)
+void
+__glXDispSwap_BindTexture(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_PrioritizeTextures(GLbyte *pc)
+void
+__glXDispSwap_PrioritizeTextures(GLbyte * pc)
{
- GLsizei n;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLsizei n;
- __GLX_SWAP_INT(pc + 0);
- n = *(GLsizei *)(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 4, n);
- __GLX_SWAP_FLOAT_ARRAY(pc + 4+n*4, n);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 0);
+ n = *(GLsizei *) (pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 4, n);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4 + n * 4, n);
}
-void __glXDispSwap_Indexubv(GLbyte *pc)
+void
+__glXDispSwap_Indexubv(GLbyte * pc)
{
}
-void __glXDispSwap_BlendColor(GLbyte *pc)
+void
+__glXDispSwap_BlendColor(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_FLOAT(pc + 0);
- __GLX_SWAP_FLOAT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
- __GLX_SWAP_FLOAT(pc + 12);
+ __GLX_SWAP_FLOAT(pc + 0);
+ __GLX_SWAP_FLOAT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_FLOAT(pc + 12);
}
-void __glXDispSwap_BlendEquation(GLbyte *pc)
+void
+__glXDispSwap_BlendEquation(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_ColorTableParameterfv(GLbyte *pc)
+void
+__glXDispSwap_ColorTableParameterfv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glColorTableParameterfv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glColorTableParameterfv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_ColorTableParameteriv(GLbyte *pc)
+void
+__glXDispSwap_ColorTableParameteriv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glColorTableParameteriv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glColorTableParameteriv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_CopyColorTable(GLbyte *pc)
+void
+__glXDispSwap_CopyColorTable(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
}
-void __glXDispSwap_CopyColorSubTable(GLbyte *pc)
+void
+__glXDispSwap_CopyColorSubTable(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
}
-void __glXDispSwap_ConvolutionParameterf(GLbyte *pc)
+void
+__glXDispSwap_ConvolutionParameterf(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_FLOAT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_FLOAT(pc + 8);
}
-void __glXDispSwap_ConvolutionParameterfv(GLbyte *pc)
+void
+__glXDispSwap_ConvolutionParameterfv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glConvolutionParameterfv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glConvolutionParameterfv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_ConvolutionParameteri(GLbyte *pc)
+void
+__glXDispSwap_ConvolutionParameteri(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_ConvolutionParameteriv(GLbyte *pc)
+void
+__glXDispSwap_ConvolutionParameteriv(GLbyte * pc)
{
- GLenum pname;
- GLint compsize;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ GLenum pname;
+ GLint compsize;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 4);
- pname = *(GLenum *)(pc + 4);
- compsize = __glConvolutionParameteriv_size(pname);
- if (compsize < 0) compsize = 0;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
+ __GLX_SWAP_INT(pc + 4);
+ pname = *(GLenum *) (pc + 4);
+ compsize = __glConvolutionParameteriv_size(pname);
+ if (compsize < 0)
+ compsize = 0;
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 8, compsize);
}
-void __glXDispSwap_CopyConvolutionFilter1D(GLbyte *pc)
+void
+__glXDispSwap_CopyConvolutionFilter1D(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
}
-void __glXDispSwap_CopyConvolutionFilter2D(GLbyte *pc)
+void
+__glXDispSwap_CopyConvolutionFilter2D(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
- __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
}
-void __glXDispSwap_Histogram(GLbyte *pc)
+void
+__glXDispSwap_Histogram(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
}
-void __glXDispSwap_Minmax(GLbyte *pc)
+void
+__glXDispSwap_Minmax(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
}
-void __glXDispSwap_ResetHistogram(GLbyte *pc)
+void
+__glXDispSwap_ResetHistogram(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_ResetMinmax(GLbyte *pc)
+void
+__glXDispSwap_ResetMinmax(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_CopyTexSubImage3D(GLbyte *pc)
+void
+__glXDispSwap_CopyTexSubImage3D(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT(pc + 4);
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_INT(pc + 12);
- __GLX_SWAP_INT(pc + 16);
- __GLX_SWAP_INT(pc + 20);
- __GLX_SWAP_INT(pc + 24);
- __GLX_SWAP_INT(pc + 28);
- __GLX_SWAP_INT(pc + 32);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 4);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_INT(pc + 12);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_INT(pc + 20);
+ __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_INT(pc + 28);
+ __GLX_SWAP_INT(pc + 32);
}
-void __glXDispSwap_ActiveTextureARB(GLbyte *pc)
+void
+__glXDispSwap_ActiveTextureARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT(pc + 0);
}
-void __glXDispSwap_MultiTexCoord1dvARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord1dvARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 12);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 12);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_INT(pc + 8);
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
+ __GLX_SWAP_INT(pc + 8);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1);
}
-void __glXDispSwap_MultiTexCoord1fvARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord1fvARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 4, 1);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, 1);
}
-void __glXDispSwap_MultiTexCoord1ivARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord1ivARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 4, 1);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 4, 1);
}
-void __glXDispSwap_MultiTexCoord1svARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord1svARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_SHORT_ARRAY(pc + 4, 1);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT_ARRAY(pc + 4, 1);
}
-void __glXDispSwap_MultiTexCoord2dvARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord2dvARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 20);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 20);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_INT(pc + 16);
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
+ __GLX_SWAP_INT(pc + 16);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2);
}
-void __glXDispSwap_MultiTexCoord2fvARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord2fvARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 4, 2);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, 2);
}
-void __glXDispSwap_MultiTexCoord2ivARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord2ivARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 4, 2);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 4, 2);
}
-void __glXDispSwap_MultiTexCoord2svARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord2svARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_SHORT_ARRAY(pc + 4, 2);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT_ARRAY(pc + 4, 2);
}
-void __glXDispSwap_MultiTexCoord3dvARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord3dvARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 28);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 28);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_INT(pc + 24);
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
+ __GLX_SWAP_INT(pc + 24);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3);
}
-void __glXDispSwap_MultiTexCoord3fvARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord3fvARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 4, 3);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, 3);
}
-void __glXDispSwap_MultiTexCoord3ivARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord3ivARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 4, 3);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 4, 3);
}
-void __glXDispSwap_MultiTexCoord3svARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord3svARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_SHORT_ARRAY(pc + 4, 3);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT_ARRAY(pc + 4, 3);
}
-void __glXDispSwap_MultiTexCoord4dvARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord4dvARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
#ifdef __GLX_ALIGN64
- if ((unsigned long)(pc) & 7) {
- __GLX_MEM_COPY(pc-4, pc, 36);
- pc -= 4;
- }
+ if ((unsigned long) (pc) & 7) {
+ __GLX_MEM_COPY(pc - 4, pc, 36);
+ pc -= 4;
+ }
#endif
- __GLX_SWAP_INT(pc + 32);
- __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
+ __GLX_SWAP_INT(pc + 32);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4);
}
-void __glXDispSwap_MultiTexCoord4fvARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord4fvARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_FLOAT_ARRAY(pc + 4, 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_FLOAT_ARRAY(pc + 4, 4);
}
-void __glXDispSwap_MultiTexCoord4ivARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord4ivARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_INT_ARRAY(pc + 4, 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_INT_ARRAY(pc + 4, 4);
}
-void __glXDispSwap_MultiTexCoord4svARB(GLbyte *pc)
+void
+__glXDispSwap_MultiTexCoord4svARB(GLbyte * pc)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT(pc + 0);
- __GLX_SWAP_SHORT_ARRAY(pc + 4, 4);
+ __GLX_SWAP_INT(pc + 0);
+ __GLX_SWAP_SHORT_ARRAY(pc + 4, 4);
}
-
diff --git a/xorg-server/hw/dmx/glxProxy/glxcmds.c b/xorg-server/hw/dmx/glxProxy/glxcmds.c
index fb4bce850..49c6ef1ed 100644
--- a/xorg-server/hw/dmx/glxProxy/glxcmds.c
+++ b/xorg-server/hw/dmx/glxProxy/glxcmds.c
@@ -59,71 +59,78 @@
#endif
extern __GLXFBConfig **__glXFBConfigs;
-extern int __glXNumFBConfigs;
+extern int __glXNumFBConfigs;
-extern int glxIsExtensionSupported( char *ext );
-extern int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc);
+extern int glxIsExtensionSupported(char *ext);
+extern int __glXGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc);
#define BE_TO_CLIENT_ERROR(x) \
( (x) >= __glXerrorBase ? \
(x) - dmxScreen->glxErrorBase + __glXerrorBase \
: (x) )
-static __GLXFBConfig *glxLookupFBConfig( GLXFBConfigID id )
+static __GLXFBConfig *
+glxLookupFBConfig(GLXFBConfigID id)
{
- int i,j;
+ int i, j;
- for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) {
- if ( __glXFBConfigs[j]->id == id)
- return __glXFBConfigs[j];
- }
+ for (i = 0, j = 0; i < __glXNumFBConfigs;
+ i++, j += (__glXNumActiveScreens + 1)) {
+ if (__glXFBConfigs[j]->id == id)
+ return __glXFBConfigs[j];
+ }
- return NULL;
+ return NULL;
}
-static __GLXFBConfig *glxLookupFBConfigByVID( VisualID vid )
+static __GLXFBConfig *
+glxLookupFBConfigByVID(VisualID vid)
{
- int i,j;
+ int i, j;
- for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) {
- if ( __glXFBConfigs[j]->associatedVisualId == vid)
- return __glXFBConfigs[j];
- }
+ for (i = 0, j = 0; i < __glXNumFBConfigs;
+ i++, j += (__glXNumActiveScreens + 1)) {
+ if (__glXFBConfigs[j]->associatedVisualId == vid)
+ return __glXFBConfigs[j];
+ }
- return NULL;
+ return NULL;
}
-static __GLXFBConfig *glxLookupBackEndFBConfig( GLXFBConfigID id, int screen )
+static __GLXFBConfig *
+glxLookupBackEndFBConfig(GLXFBConfigID id, int screen)
{
- int i;
- int j;
+ int i;
+ int j;
- for (i=0, j=0; i<__glXNumFBConfigs; i++,j+=(__glXNumActiveScreens+1) ) {
- if ( __glXFBConfigs[j]->id == id)
- return __glXFBConfigs[j+screen+1];
- }
+ for (i = 0, j = 0; i < __glXNumFBConfigs;
+ i++, j += (__glXNumActiveScreens + 1)) {
+ if (__glXFBConfigs[j]->id == id)
+ return __glXFBConfigs[j + screen + 1];
+ }
- return NULL;
+ return NULL;
}
-Display *GetBackEndDisplay( __GLXclientState *cl, int s )
+Display *
+GetBackEndDisplay(__GLXclientState * cl, int s)
{
- if (! cl->be_displays[s] ) {
- cl->be_displays[s] = XOpenDisplay( DisplayString(dmxScreens[s].beDisplay) );
- }
- return cl->be_displays[s];
+ if (!cl->be_displays[s]) {
+ cl->be_displays[s] =
+ XOpenDisplay(DisplayString(dmxScreens[s].beDisplay));
+ }
+ return cl->be_displays[s];
}
/*
** Create a GL context with the given properties.
*/
-static int CreateContext(__GLXclientState *cl,
- GLXContextID gcId,
- VisualID vid, GLXFBConfigID fbconfigId,
- int screen,
- GLXContextID shareList,
- int isDirect )
+static int
+CreateContext(__GLXclientState * cl,
+ GLXContextID gcId,
+ VisualID vid, GLXFBConfigID fbconfigId,
+ int screen, GLXContextID shareList, int isDirect)
{
ClientPtr client = cl->client;
xGLXCreateContextReq *be_req;
@@ -142,20 +149,19 @@ static int CreateContext(__GLXclientState *cl,
GLXFBConfigID be_fbconfigId = 0;
int num_be_screens;
Display *dpy;
-
+
/*
- ** Check if screen exists.
- */
+ ** Check if screen exists.
+ */
if (screen >= screenInfo.numScreens) {
- client->errorValue = screen;
- return BadValue;
+ client->errorValue = screen;
+ return BadValue;
}
-
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
@@ -164,87 +170,88 @@ static int CreateContext(__GLXclientState *cl,
**
*/
if (shareList == None) {
- shareglxc = NULL;
- } else {
- dixLookupResourceByType((pointer*) &shareglxc, shareList,
- __glXContextRes, NullClient, DixUnknownAccess);
- if (!shareglxc) {
- client->errorValue = shareList;
- return __glXBadContext;
- }
+ shareglxc = NULL;
+ }
+ else {
+ dixLookupResourceByType((pointer *) &shareglxc, shareList,
+ __glXContextRes, NullClient, DixUnknownAccess);
+ if (!shareglxc) {
+ client->errorValue = shareList;
+ return __glXBadContext;
+ }
}
/*
- ** Allocate memory for the new context
- */
+ ** Allocate memory for the new context
+ */
glxc = calloc(1, sizeof(__GLXcontext));
if (!glxc) {
- return BadAlloc;
+ return BadAlloc;
}
pScreen = screenInfo.screens[screen];
pGlxScreen = &__glXActiveScreens[screen];
if (fbconfigId != None) {
- glxc->pFBConfig = glxLookupFBConfig( fbconfigId );
- if (!glxc->pFBConfig) {
- client->errorValue = fbconfigId;
- free( glxc );
- return BadValue;
- }
- visual = glxc->pFBConfig->associatedVisualId;
+ glxc->pFBConfig = glxLookupFBConfig(fbconfigId);
+ if (!glxc->pFBConfig) {
+ client->errorValue = fbconfigId;
+ free(glxc);
+ return BadValue;
+ }
+ visual = glxc->pFBConfig->associatedVisualId;
}
else {
- glxc->pFBConfig = NULL;
+ glxc->pFBConfig = NULL;
}
if (visual != None) {
- /*
- ** Check if the visual ID is valid for this screen.
- */
- pVisual = pScreen->visuals;
- for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
- if (pVisual->vid == visual) {
- break;
- }
- }
- if (i == pScreen->numVisuals) {
- client->errorValue = visual;
- free( glxc );
- return BadValue;
- }
-
- pGlxVisual = pGlxScreen->pGlxVisual;
- for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
- if (pGlxVisual->vid == visual) {
- break;
- }
- }
- if (i == pGlxScreen->numVisuals) {
- /*
- ** Visual not support on this screen by this OpenGL implementation.
- */
- client->errorValue = visual;
- free( glxc );
- return BadValue;
- }
-
- if ( glxc->pFBConfig == NULL ) {
- glxc->pFBConfig = glxLookupFBConfigByVID( visual );
-
- if ( glxc->pFBConfig == NULL ) {
- /*
- * visual does not have an FBConfig ???
- client->errorValue = visual;
- free( glxc );
- return BadValue;
- */
- }
- }
+ /*
+ ** Check if the visual ID is valid for this screen.
+ */
+ pVisual = pScreen->visuals;
+ for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
+ if (pVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pScreen->numVisuals) {
+ client->errorValue = visual;
+ free(glxc);
+ return BadValue;
+ }
+
+ pGlxVisual = pGlxScreen->pGlxVisual;
+ for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
+ if (pGlxVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pGlxScreen->numVisuals) {
+ /*
+ ** Visual not support on this screen by this OpenGL implementation.
+ */
+ client->errorValue = visual;
+ free(glxc);
+ return BadValue;
+ }
+
+ if (glxc->pFBConfig == NULL) {
+ glxc->pFBConfig = glxLookupFBConfigByVID(visual);
+
+ if (glxc->pFBConfig == NULL) {
+ /*
+ * visual does not have an FBConfig ???
+ client->errorValue = visual;
+ free( glxc );
+ return BadValue;
+ */
+ }
+ }
}
else {
- pVisual = NULL;
- pGlxVisual = NULL;
+ pVisual = NULL;
+ pGlxVisual = NULL;
}
glxc->pScreen = pScreen;
@@ -256,140 +263,152 @@ static int CreateContext(__GLXclientState *cl,
* allocate memory for back-end servers info
*/
num_be_screens = to_screen - from_screen + 1;
- glxc->real_ids = (XID *)malloc(sizeof(XID) * num_be_screens);
+ glxc->real_ids = (XID *) malloc(sizeof(XID) * num_be_screens);
if (!glxc->real_ids) {
- return BadAlloc;
+ return BadAlloc;
}
- glxc->real_vids = (XID *)malloc(sizeof(XID) * num_be_screens);
+ glxc->real_vids = (XID *) malloc(sizeof(XID) * num_be_screens);
if (!glxc->real_vids) {
- return BadAlloc;
+ return BadAlloc;
}
for (screen = from_screen; screen <= to_screen; screen++) {
- int sent = 0;
- pScreen = screenInfo.screens[screen];
- pGlxScreen = &__glXActiveScreens[screen];
- dmxScreen = &dmxScreens[screen];
-
- if (glxc->pFBConfig) {
- __GLXFBConfig *beFBConfig = glxLookupBackEndFBConfig( glxc->pFBConfig->id,
- screen );
- be_fbconfigId = beFBConfig->id;
- }
-
- if (pGlxVisual) {
-
- be_vid = glxMatchGLXVisualInConfigList( pGlxVisual,
- dmxScreen->glxVisuals,
- dmxScreen->numGlxVisuals );
-
- if (!be_vid) {
- /* visual is not supported on the back-end server */
- free( glxc->real_ids );
- free( glxc->real_vids );
- free( glxc );
- return BadValue;
- }
- }
-
- glxc->real_ids[screen-from_screen] = XAllocID(GetBackEndDisplay(cl,screen));
-
- /* send the create context request to the back-end server */
- dpy = GetBackEndDisplay(cl,screen);
- if (glxc->pFBConfig) {
- /*Since for a certain visual both RGB and COLOR INDEX
- *can be on then the only parmeter to choose the renderType
- * should be the class of the colormap since all 4 first
- * classes does not support RGB mode only COLOR INDEX ,
- * and so TrueColor and DirectColor does not support COLOR INDEX*/
- int renderType = glxc->pFBConfig->renderType;
- if ( pVisual ) {
- switch ( pVisual->class ){
- case PseudoColor:
- case StaticColor:
- case GrayScale:
- case StaticGray:
- renderType = GLX_COLOR_INDEX_TYPE;
- break;
- case TrueColor:
- case DirectColor:
- default:
- renderType = GLX_RGBA_TYPE;
- break;
- }
- }
- if ( __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- LockDisplay(dpy);
- GetReq(GLXCreateNewContext,be_new_req);
- be_new_req->reqType = dmxScreen->glxMajorOpcode;
- be_new_req->glxCode = X_GLXCreateNewContext;
- be_new_req->context = (unsigned int)glxc->real_ids[screen-from_screen];
- be_new_req->fbconfig = (unsigned int)be_fbconfigId;
- be_new_req->screen = DefaultScreen(dpy);
- be_new_req->renderType = renderType;
-
- be_new_req->shareList = (shareglxc ? shareglxc->real_ids[screen-from_screen] : 0);
- be_new_req->isDirect = 0;
- UnlockDisplay(dpy);
- glxc->real_vids[screen-from_screen] = be_fbconfigId;
- sent = 1;
- }
- else if (glxIsExtensionSupported("GLX_SGIX_fbconfig")) {
-
- xGLXCreateContextWithConfigSGIXReq *ext_req;
- xGLXVendorPrivateReq *vpreq;
- LockDisplay(dpy);
- GetReqExtra(GLXVendorPrivate,
- sz_xGLXCreateContextWithConfigSGIXReq - sz_xGLXVendorPrivateReq,
- vpreq);
- ext_req = (xGLXCreateContextWithConfigSGIXReq *)vpreq;
- ext_req->reqType = dmxScreen->glxMajorOpcode;
- ext_req->glxCode = X_GLXVendorPrivate;
- ext_req->vendorCode = X_GLXvop_CreateContextWithConfigSGIX;
- ext_req->context = (unsigned int)glxc->real_ids[screen-from_screen];
- ext_req->fbconfig = (unsigned int)be_fbconfigId;
- ext_req->screen = DefaultScreen(dpy);
- ext_req->renderType = renderType;
- ext_req->shareList = (shareglxc ? shareglxc->real_ids[screen-from_screen] : 0);
- ext_req->isDirect = 0;
- UnlockDisplay(dpy);
- glxc->real_vids[screen-from_screen] = be_fbconfigId;
- sent = 1;
- }
- }
-
- if (!sent) {
- LockDisplay(dpy);
- GetReq(GLXCreateContext,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXCreateContext;
- be_req->context = (unsigned int)glxc->real_ids[screen-from_screen];
- be_req->visual = (unsigned int)be_vid;
- be_req->screen = DefaultScreen(dpy);
- be_req->shareList = (shareglxc ? shareglxc->real_ids[screen-from_screen] : 0);
- be_req->isDirect = 0;
- UnlockDisplay(dpy);
- glxc->real_vids[screen-from_screen] = be_vid;
- }
- SyncHandle();
+ int sent = 0;
+
+ pScreen = screenInfo.screens[screen];
+ pGlxScreen = &__glXActiveScreens[screen];
+ dmxScreen = &dmxScreens[screen];
+
+ if (glxc->pFBConfig) {
+ __GLXFBConfig *beFBConfig =
+ glxLookupBackEndFBConfig(glxc->pFBConfig->id,
+ screen);
+
+ be_fbconfigId = beFBConfig->id;
+ }
+
+ if (pGlxVisual) {
+
+ be_vid = glxMatchGLXVisualInConfigList(pGlxVisual,
+ dmxScreen->glxVisuals,
+ dmxScreen->numGlxVisuals);
+
+ if (!be_vid) {
+ /* visual is not supported on the back-end server */
+ free(glxc->real_ids);
+ free(glxc->real_vids);
+ free(glxc);
+ return BadValue;
+ }
+ }
+
+ glxc->real_ids[screen - from_screen] =
+ XAllocID(GetBackEndDisplay(cl, screen));
+
+ /* send the create context request to the back-end server */
+ dpy = GetBackEndDisplay(cl, screen);
+ if (glxc->pFBConfig) {
+ /*Since for a certain visual both RGB and COLOR INDEX
+ *can be on then the only parmeter to choose the renderType
+ * should be the class of the colormap since all 4 first
+ * classes does not support RGB mode only COLOR INDEX ,
+ * and so TrueColor and DirectColor does not support COLOR INDEX*/
+ int renderType = glxc->pFBConfig->renderType;
+
+ if (pVisual) {
+ switch (pVisual->class) {
+ case PseudoColor:
+ case StaticColor:
+ case GrayScale:
+ case StaticGray:
+ renderType = GLX_COLOR_INDEX_TYPE;
+ break;
+ case TrueColor:
+ case DirectColor:
+ default:
+ renderType = GLX_RGBA_TYPE;
+ break;
+ }
+ }
+ if (__GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ LockDisplay(dpy);
+ GetReq(GLXCreateNewContext, be_new_req);
+ be_new_req->reqType = dmxScreen->glxMajorOpcode;
+ be_new_req->glxCode = X_GLXCreateNewContext;
+ be_new_req->context =
+ (unsigned int) glxc->real_ids[screen - from_screen];
+ be_new_req->fbconfig = (unsigned int) be_fbconfigId;
+ be_new_req->screen = DefaultScreen(dpy);
+ be_new_req->renderType = renderType;
+
+ be_new_req->shareList =
+ (shareglxc ? shareglxc->real_ids[screen - from_screen] : 0);
+ be_new_req->isDirect = 0;
+ UnlockDisplay(dpy);
+ glxc->real_vids[screen - from_screen] = be_fbconfigId;
+ sent = 1;
+ }
+ else if (glxIsExtensionSupported("GLX_SGIX_fbconfig")) {
+
+ xGLXCreateContextWithConfigSGIXReq *ext_req;
+ xGLXVendorPrivateReq *vpreq;
+
+ LockDisplay(dpy);
+ GetReqExtra(GLXVendorPrivate,
+ sz_xGLXCreateContextWithConfigSGIXReq -
+ sz_xGLXVendorPrivateReq, vpreq);
+ ext_req = (xGLXCreateContextWithConfigSGIXReq *) vpreq;
+ ext_req->reqType = dmxScreen->glxMajorOpcode;
+ ext_req->glxCode = X_GLXVendorPrivate;
+ ext_req->vendorCode = X_GLXvop_CreateContextWithConfigSGIX;
+ ext_req->context =
+ (unsigned int) glxc->real_ids[screen - from_screen];
+ ext_req->fbconfig = (unsigned int) be_fbconfigId;
+ ext_req->screen = DefaultScreen(dpy);
+ ext_req->renderType = renderType;
+ ext_req->shareList =
+ (shareglxc ? shareglxc->real_ids[screen - from_screen] : 0);
+ ext_req->isDirect = 0;
+ UnlockDisplay(dpy);
+ glxc->real_vids[screen - from_screen] = be_fbconfigId;
+ sent = 1;
+ }
+ }
+
+ if (!sent) {
+ LockDisplay(dpy);
+ GetReq(GLXCreateContext, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXCreateContext;
+ be_req->context =
+ (unsigned int) glxc->real_ids[screen - from_screen];
+ be_req->visual = (unsigned int) be_vid;
+ be_req->screen = DefaultScreen(dpy);
+ be_req->shareList =
+ (shareglxc ? shareglxc->real_ids[screen - from_screen] : 0);
+ be_req->isDirect = 0;
+ UnlockDisplay(dpy);
+ glxc->real_vids[screen - from_screen] = be_vid;
+ }
+ SyncHandle();
}
/*
- ** Register this context as a resource.
- */
- if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
- free( glxc->real_ids );
- free( glxc->real_vids );
- free( glxc );
- client->errorValue = gcId;
- return BadAlloc;
- }
-
+ ** Register this context as a resource.
+ */
+ if (!AddResource(gcId, __glXContextRes, (pointer) glxc)) {
+ free(glxc->real_ids);
+ free(glxc->real_vids);
+ free(glxc);
+ client->errorValue = gcId;
+ return BadAlloc;
+ }
+
/*
- ** Finally, now that everything is working, setup the rest of the
- ** context.
- */
+ ** Finally, now that everything is working, setup the rest of the
+ ** context.
+ */
glxc->id = gcId;
glxc->share_id = shareList;
glxc->idExists = GL_TRUE;
@@ -398,38 +417,43 @@ static int CreateContext(__GLXclientState *cl,
return Success;
}
-int __glXCreateContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXCreateContext(__GLXclientState * cl, GLbyte * pc)
{
xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
- return( CreateContext(cl, req->context,req->visual, None,
- req->screen, req->shareList, req->isDirect) );
+ return (CreateContext(cl, req->context, req->visual, None,
+ req->screen, req->shareList, req->isDirect));
}
-int __glXCreateNewContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXCreateNewContext(__GLXclientState * cl, GLbyte * pc)
{
xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
- return( CreateContext(cl, req->context,None, req->fbconfig,
- req->screen, req->shareList, req->isDirect) );
+ return (CreateContext(cl, req->context, None, req->fbconfig,
+ req->screen, req->shareList, req->isDirect));
}
-int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXCreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc)
{
- xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc;
+ xGLXCreateContextWithConfigSGIXReq *req =
+ (xGLXCreateContextWithConfigSGIXReq *) pc;
- return( CreateContext(cl, req->context, None, req->fbconfig,
- req->screen, req->shareList, req->isDirect) );
+ return (CreateContext(cl, req->context, None, req->fbconfig,
+ req->screen, req->shareList, req->isDirect));
}
-int __glXQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXQueryMaxSwapBarriersSGIX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXQueryMaxSwapBarriersSGIXReq *req =
- (xGLXQueryMaxSwapBarriersSGIXReq *)pc;
+ (xGLXQueryMaxSwapBarriersSGIXReq *) pc;
xGLXQueryMaxSwapBarriersSGIXReply reply;
reply.type = X_Reply;
@@ -438,19 +462,21 @@ int __glXQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc)
reply.max = QueryMaxSwapBarriersSGIX(req->screen);
if (client->swapped) {
- __glXSwapQueryMaxSwapBarriersSGIXReply(client, &reply);
- } else {
- WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply,
- (char *)&reply);
+ __glXSwapQueryMaxSwapBarriersSGIXReply(client, &reply);
+ }
+ else {
+ WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply,
+ (char *) &reply);
}
return Success;
}
-int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXBindSwapBarrierSGIX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *)pc;
+ xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *) pc;
DrawablePtr pDraw;
__GLXpixmap *pGlxPixmap = NULL;
__glXWindow *pGlxWindow = NULL;
@@ -458,29 +484,32 @@ int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixGetAttrAccess);
if (rc != Success) {
- dixLookupResourceByType((pointer*) &pGlxPixmap, req->drawable,
- __glXPixmapRes, NullClient, DixUnknownAccess);
- if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
+ dixLookupResourceByType((pointer *) &pGlxPixmap, req->drawable,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
+ if (pGlxPixmap)
+ pDraw = pGlxPixmap->pDraw;
}
- if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxWindow, req->drawable,
- __glXWindowRes, NullClient, DixUnknownAccess);
- if (pGlxWindow) pDraw = pGlxWindow->pDraw;
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ dixLookupResourceByType((pointer *) &pGlxWindow, req->drawable,
+ __glXWindowRes, NullClient, DixUnknownAccess);
+ if (pGlxWindow)
+ pDraw = pGlxWindow->pDraw;
}
if (!pDraw) {
- client->errorValue = req->drawable;
- return __glXBadDrawable;
+ client->errorValue = req->drawable;
+ return __glXBadDrawable;
}
return BindSwapBarrierSGIX(pDraw, req->barrier);
}
-int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXJoinSwapGroupSGIX(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *)pc;
+ xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *) pc;
DrawablePtr pDraw, pMember = NULL;
__GLXpixmap *pGlxPixmap = NULL;
__glXWindow *pGlxWindow = NULL;
@@ -488,53 +517,57 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixManageAccess);
if (rc != Success) {
- dixLookupResourceByType((pointer*) &pGlxPixmap, req->drawable,
- __glXPixmapRes, NullClient, DixUnknownAccess);
- if (pGlxPixmap) pDraw = pGlxPixmap->pDraw;
+ dixLookupResourceByType((pointer *) &pGlxPixmap, req->drawable,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
+ if (pGlxPixmap)
+ pDraw = pGlxPixmap->pDraw;
}
- if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxWindow, req->drawable,
- __glXWindowRes, NullClient, DixUnknownAccess);
- if (pGlxWindow) pDraw = pGlxWindow->pDraw;
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ dixLookupResourceByType((pointer *) &pGlxWindow, req->drawable,
+ __glXWindowRes, NullClient, DixUnknownAccess);
+ if (pGlxWindow)
+ pDraw = pGlxWindow->pDraw;
}
if (!pDraw) {
- client->errorValue = req->drawable;
- return __glXBadDrawable;
+ client->errorValue = req->drawable;
+ return __glXBadDrawable;
}
if (req->member != None) {
- rc = dixLookupDrawable(&pMember, req->member, client, 0,
- DixGetAttrAccess);
- if (rc != Success) {
- dixLookupResourceByType((pointer*) &pGlxPixmap, req->member,
+ rc = dixLookupDrawable(&pMember, req->member, client, 0,
+ DixGetAttrAccess);
+ if (rc != Success) {
+ dixLookupResourceByType((pointer *) &pGlxPixmap, req->member,
__glXPixmapRes, NullClient,
DixUnknownAccess);
- if (pGlxPixmap) pMember = pGlxPixmap->pDraw;
- }
+ if (pGlxPixmap)
+ pMember = pGlxPixmap->pDraw;
+ }
- if (!pMember && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxWindow, req->member,
+ if (!pMember && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ dixLookupResourceByType((pointer *) &pGlxWindow, req->member,
__glXWindowRes, NullClient,
DixUnknownAccess);
- if (pGlxWindow) pMember = pGlxWindow->pDraw;
- }
+ if (pGlxWindow)
+ pMember = pGlxWindow->pDraw;
+ }
- if (!pMember) {
- client->errorValue = req->member;
- return __glXBadDrawable;
- }
+ if (!pMember) {
+ client->errorValue = req->member;
+ return __glXBadDrawable;
+ }
}
return JoinSwapGroupSGIX(pDraw, pMember);
}
-
/*
** Destroy a GL context as an X resource.
*/
-int __glXDestroyContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDestroyContext(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
@@ -544,46 +577,47 @@ int __glXDestroyContext(__GLXclientState *cl, GLbyte *pc)
int from_screen = 0;
int to_screen = 0;
int s;
-
- dixLookupResourceByType((pointer*) &glxc, gcId, __glXContextRes,
- NullClient, DixUnknownAccess);
+
+ dixLookupResourceByType((pointer *) &glxc, gcId, __glXContextRes,
+ NullClient, DixUnknownAccess);
if (glxc) {
- /*
- ** Just free the resource; don't actually destroy the context,
- ** because it might be in use. The
- ** destroy method will be called by the resource destruction routine
- ** if necessary.
- */
- FreeResourceByType(gcId, __glXContextRes, FALSE);
+ /*
+ ** Just free the resource; don't actually destroy the context,
+ ** because it might be in use. The
+ ** destroy method will be called by the resource destruction routine
+ ** if necessary.
+ */
+ FreeResourceByType(gcId, __glXContextRes, FALSE);
- from_screen = to_screen = glxc->pScreen->myNum;
+ from_screen = to_screen = glxc->pScreen->myNum;
- } else {
- client->errorValue = gcId;
- return __glXBadContext;
+ }
+ else {
+ client->errorValue = gcId;
+ return __glXBadContext;
}
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
/*
* send DestroyContext request to all back-end servers
*/
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
- LockDisplay(dpy);
- GetReq(GLXDestroyContext,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXDestroyContext;
- be_req->context = glxc->real_ids[s-from_screen];
- UnlockDisplay(dpy);
- SyncHandle();
+ LockDisplay(dpy);
+ GetReq(GLXDestroyContext, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXDestroyContext;
+ be_req->context = glxc->real_ids[s - from_screen];
+ UnlockDisplay(dpy);
+ SyncHandle();
}
return Success;
@@ -600,83 +634,97 @@ int __glXDestroyContext(__GLXclientState *cl, GLbyte *pc)
/*
** Add a current context, and return the tag that will be used to refer to it.
*/
-static int AddCurrentContext(__GLXclientState *cl, __GLXcontext *glxc, DrawablePtr pDraw)
+static int
+AddCurrentContext(__GLXclientState * cl, __GLXcontext * glxc, DrawablePtr pDraw)
{
int i;
int num = cl->numCurrentContexts;
__GLXcontext **table = cl->currentContexts;
- if (!glxc) return -1;
-
+ if (!glxc)
+ return -1;
+
/*
- ** Try to find an empty slot and use it.
- */
- for (i=0; i < num; i++) {
- if (!table[i]) {
- table[i] = glxc;
- return i+1;
- }
+ ** Try to find an empty slot and use it.
+ */
+ for (i = 0; i < num; i++) {
+ if (!table[i]) {
+ table[i] = glxc;
+ return i + 1;
+ }
}
/*
- ** Didn't find a free slot, so we'll have to grow the table.
- */
+ ** Didn't find a free slot, so we'll have to grow the table.
+ */
if (!num) {
- table = (__GLXcontext **) malloc(sizeof(__GLXcontext *));
- cl->currentDrawables = (DrawablePtr *) malloc(sizeof(DrawablePtr));
- cl->be_currentCTag = (GLXContextTag *) malloc(screenInfo.numScreens *sizeof(GLXContextTag));
- } else {
- table = (__GLXcontext **) realloc(table,
- (num+1)*sizeof(__GLXcontext *));
- cl->currentDrawables = (DrawablePtr *) realloc(
- cl->currentDrawables ,
- (num+1)*sizeof(DrawablePtr));
- cl->be_currentCTag = (GLXContextTag *) realloc(cl->be_currentCTag,
- (num+1)*screenInfo.numScreens*sizeof(GLXContextTag));
+ table = (__GLXcontext **) malloc(sizeof(__GLXcontext *));
+ cl->currentDrawables = (DrawablePtr *) malloc(sizeof(DrawablePtr));
+ cl->be_currentCTag =
+ (GLXContextTag *) malloc(screenInfo.numScreens *
+ sizeof(GLXContextTag));
+ }
+ else {
+ table = (__GLXcontext **) realloc(table,
+ (num + 1) * sizeof(__GLXcontext *));
+ cl->currentDrawables = (DrawablePtr *) realloc(cl->currentDrawables,
+ (num +
+ 1) *
+ sizeof(DrawablePtr));
+ cl->be_currentCTag =
+ (GLXContextTag *) realloc(cl->be_currentCTag,
+ (num +
+ 1) * screenInfo.numScreens *
+ sizeof(GLXContextTag));
}
table[num] = glxc;
cl->currentDrawables[num] = pDraw;
cl->currentContexts = table;
cl->numCurrentContexts++;
- memset(cl->be_currentCTag + num*screenInfo.numScreens, 0,
- screenInfo.numScreens * sizeof(GLXContextTag));
+ memset(cl->be_currentCTag + num * screenInfo.numScreens, 0,
+ screenInfo.numScreens * sizeof(GLXContextTag));
- return num+1;
+ return num + 1;
}
/*
** Given a tag, change the current context for the corresponding entry.
*/
-static void ChangeCurrentContext(__GLXclientState *cl, __GLXcontext *glxc,
- GLXContextTag tag)
+static void
+ChangeCurrentContext(__GLXclientState * cl, __GLXcontext * glxc,
+ GLXContextTag tag)
{
__GLXcontext **table = cl->currentContexts;
- table[tag-1] = glxc;
+
+ table[tag - 1] = glxc;
}
/*
** Given a tag, and back-end screen number, retrives the current back-end
** tag.
*/
-int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s)
+int
+GetCurrentBackEndTag(__GLXclientState * cl, GLXContextTag tag, int s)
{
- if (tag >0) {
- return( cl->be_currentCTag[ (tag-1)*screenInfo.numScreens + s ] );
- }
- else {
- return 0;
- }
+ if (tag > 0) {
+ return (cl->be_currentCTag[(tag - 1) * screenInfo.numScreens + s]);
+ }
+ else {
+ return 0;
+ }
}
/*
** Given a tag, and back-end screen number, sets the current back-end
** tag.
*/
-static void SetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s, GLXContextTag be_tag)
+static void
+SetCurrentBackEndTag(__GLXclientState * cl, GLXContextTag tag, int s,
+ GLXContextTag be_tag)
{
- if (tag >0) {
- cl->be_currentCTag[ (tag-1)*screenInfo.numScreens + s ] = be_tag;
- }
+ if (tag > 0) {
+ cl->be_currentCTag[(tag - 1) * screenInfo.numScreens + s] = be_tag;
+ }
}
/*
@@ -684,45 +732,51 @@ static void SetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s,
** context's entry in the table as the context tag. A tag must be greater
** than 0.
*/
-__GLXcontext *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag)
+__GLXcontext *
+__glXLookupContextByTag(__GLXclientState * cl, GLXContextTag tag)
{
int num = cl->numCurrentContexts;
if (tag < 1 || tag > num) {
- return 0;
- } else {
- return cl->currentContexts[tag-1];
+ return 0;
+ }
+ else {
+ return cl->currentContexts[tag - 1];
}
}
-DrawablePtr __glXLookupDrawableByTag(__GLXclientState *cl, GLXContextTag tag)
+DrawablePtr
+__glXLookupDrawableByTag(__GLXclientState * cl, GLXContextTag tag)
{
int num = cl->numCurrentContexts;
if (tag < 1 || tag > num) {
- return 0;
- } else {
- return cl->currentDrawables[tag-1];
+ return 0;
+ }
+ else {
+ return cl->currentDrawables[tag - 1];
}
}
/*****************************************************************************/
-static void StopUsingContext(__GLXcontext *glxc)
+static void
+StopUsingContext(__GLXcontext * glxc)
{
if (glxc) {
- if (glxc == __glXLastContext) {
- /* Tell server GL library */
- __glXLastContext = 0;
- }
- glxc->isCurrent = GL_FALSE;
- if (!glxc->idExists) {
- __glXFreeContext(glxc);
- }
+ if (glxc == __glXLastContext) {
+ /* Tell server GL library */
+ __glXLastContext = 0;
+ }
+ glxc->isCurrent = GL_FALSE;
+ if (!glxc->idExists) {
+ __glXFreeContext(glxc);
+ }
}
}
-static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc)
+static void
+StartUsingContext(__GLXclientState * cl, __GLXcontext * glxc)
{
glxc->isCurrent = GL_TRUE;
}
@@ -731,11 +785,11 @@ static void StartUsingContext(__GLXclientState *cl, __GLXcontext *glxc)
/*
** Make an OpenGL context and drawable current.
*/
-static int MakeCurrent(__GLXclientState *cl,
- GLXDrawable drawable,
- GLXDrawable readdrawable,
- GLXContextID context,
- GLXContextTag oldContextTag)
+static int
+MakeCurrent(__GLXclientState * cl,
+ GLXDrawable drawable,
+ GLXDrawable readdrawable,
+ GLXContextID context, GLXContextTag oldContextTag)
{
ClientPtr client = cl->client;
DrawablePtr pDraw = NULL;
@@ -758,6 +812,7 @@ static int MakeCurrent(__GLXclientState *cl,
__glXWindow *pGlxReadWindow = NULL;
__glXPbuffer *pGlxPbuffer = NULL;
__glXPbuffer *pGlxReadPbuffer = NULL;
+
#ifdef PANORAMIX
PanoramiXRes *pXinDraw = NULL;
PanoramiXRes *pXinReadDraw = NULL;
@@ -767,117 +822,122 @@ static int MakeCurrent(__GLXclientState *cl,
int s, rc;
/*
- ** If one is None and the other isn't, it's a bad match.
- */
+ ** If one is None and the other isn't, it's a bad match.
+ */
if ((drawId == None && contextId != None) ||
- (drawId != None && contextId == None)) {
- return BadMatch;
+ (drawId != None && contextId == None)) {
+ return BadMatch;
}
-
+
/*
- ** Lookup old context. If we have one, it must be in a usable state.
- */
+ ** Lookup old context. If we have one, it must be in a usable state.
+ */
if (tag != 0) {
- prevglxc = __glXLookupContextByTag(cl, tag);
- if (!prevglxc) {
- /*
- ** Tag for previous context is invalid.
- */
- return __glXBadContextTag;
- }
- } else {
- prevglxc = 0;
+ prevglxc = __glXLookupContextByTag(cl, tag);
+ if (!prevglxc) {
+ /*
+ ** Tag for previous context is invalid.
+ */
+ return __glXBadContextTag;
+ }
+ }
+ else {
+ prevglxc = 0;
}
/*
- ** Lookup new context. It must not be current for someone else.
- */
+ ** Lookup new context. It must not be current for someone else.
+ */
if (contextId != None) {
- dixLookupResourceByType((pointer*) &glxc, contextId, __glXContextRes,
- NullClient, DixUnknownAccess);
- if (!glxc) {
- client->errorValue = contextId;
- return __glXBadContext;
- }
- if ((glxc != prevglxc) && glxc->isCurrent) {
- /* Context is current to somebody else */
- return BadAccess;
- }
- } else {
- /* Switching to no context. Ignore new drawable. */
- glxc = 0;
+ dixLookupResourceByType((pointer *) &glxc, contextId, __glXContextRes,
+ NullClient, DixUnknownAccess);
+ if (!glxc) {
+ client->errorValue = contextId;
+ return __glXBadContext;
+ }
+ if ((glxc != prevglxc) && glxc->isCurrent) {
+ /* Context is current to somebody else */
+ return BadAccess;
+ }
+ }
+ else {
+ /* Switching to no context. Ignore new drawable. */
+ glxc = 0;
}
if (drawId != None) {
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
- if (rc == Success) {
- if (pDraw->type == DRAWABLE_WINDOW) {
- /*
- ** Drawable is an X Window.
- */
- VisualID vid;
- pWin = (WindowPtr)pDraw;
- vid = wVisual(pWin);
-
- new_reply.writeVid = (glxc->pFBConfig ? glxc->pFBConfig->id : vid);
- new_reply.writeType = GLX_WINDOW_TYPE;
-
- /*
- ** Check if window and context are similar.
- */
- if ((vid != glxc->pVisual->vid) ||
- (pWin->drawable.pScreen != glxc->pScreen)) {
- client->errorValue = drawId;
- return BadMatch;
- }
-
- from_screen = to_screen = pWin->drawable.pScreen->myNum;
-
- } else {
- /*
- ** An X Pixmap is not allowed as a parameter (a GLX Pixmap
- ** is, but it must first be created with glxCreateGLXPixmap).
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
+ if (rc == Success) {
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ /*
+ ** Drawable is an X Window.
+ */
+ VisualID vid;
+
+ pWin = (WindowPtr) pDraw;
+ vid = wVisual(pWin);
+
+ new_reply.writeVid =
+ (glxc->pFBConfig ? glxc->pFBConfig->id : vid);
+ new_reply.writeType = GLX_WINDOW_TYPE;
+
+ /*
+ ** Check if window and context are similar.
+ */
+ if ((vid != glxc->pVisual->vid) ||
+ (pWin->drawable.pScreen != glxc->pScreen)) {
+ client->errorValue = drawId;
+ return BadMatch;
+ }
+
+ from_screen = to_screen = pWin->drawable.pScreen->myNum;
+
+ }
+ else {
+ /*
+ ** An X Pixmap is not allowed as a parameter (a GLX Pixmap
+ ** is, but it must first be created with glxCreateGLXPixmap).
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
if (!pDraw) {
- dixLookupResourceByType((pointer*) &pGlxPixmap, drawId,
- __glXPixmapRes, NullClient,
- DixUnknownAccess);
- if (pGlxPixmap) {
- /*
- ** Check if pixmap and context are similar.
- */
- if (pGlxPixmap->pScreen != glxc->pScreen ||
- pGlxPixmap->pGlxVisual != glxc->pGlxVisual) {
- client->errorValue = drawId;
- return BadMatch;
- }
- pDraw = pGlxPixmap->pDraw;
-
- new_reply.writeVid = (glxc->pFBConfig ? glxc->pFBConfig->id :
- pGlxPixmap->pGlxVisual->vid);
-
- new_reply.writeType = GLX_PIXMAP_TYPE;
-
- from_screen = to_screen = pGlxPixmap->pScreen->myNum;
-
- }
- }
-
- if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxWindow, drawId,
- __glXWindowRes, NullClient,
- DixUnknownAccess);
+ dixLookupResourceByType((pointer *) &pGlxPixmap, drawId,
+ __glXPixmapRes, NullClient,
+ DixUnknownAccess);
+ if (pGlxPixmap) {
+ /*
+ ** Check if pixmap and context are similar.
+ */
+ if (pGlxPixmap->pScreen != glxc->pScreen ||
+ pGlxPixmap->pGlxVisual != glxc->pGlxVisual) {
+ client->errorValue = drawId;
+ return BadMatch;
+ }
+ pDraw = pGlxPixmap->pDraw;
+
+ new_reply.writeVid = (glxc->pFBConfig ? glxc->pFBConfig->id :
+ pGlxPixmap->pGlxVisual->vid);
+
+ new_reply.writeType = GLX_PIXMAP_TYPE;
+
+ from_screen = to_screen = pGlxPixmap->pScreen->myNum;
+
+ }
+ }
+
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ dixLookupResourceByType((pointer *) &pGlxWindow, drawId,
+ __glXWindowRes, NullClient,
+ DixUnknownAccess);
if (pGlxWindow) {
/*
- ** Drawable is a GLXWindow.
- **
- ** Check if GLX window and context are similar.
- */
+ ** Drawable is a GLXWindow.
+ **
+ ** Check if GLX window and context are similar.
+ */
if (pGlxWindow->pScreen != glxc->pScreen ||
pGlxWindow->pGlxFBConfig != glxc->pFBConfig) {
client->errorValue = drawId;
@@ -889,103 +949,107 @@ static int MakeCurrent(__GLXclientState *cl,
new_reply.writeType = GLX_GLXWINDOW_TYPE;
}
- }
+ }
- if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxPbuffer, drawId,
- __glXPbufferRes, NullClient,
- DixUnknownAccess);
- if (pGlxPbuffer) {
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ dixLookupResourceByType((pointer *) &pGlxPbuffer, drawId,
+ __glXPbufferRes, NullClient,
+ DixUnknownAccess);
+ if (pGlxPbuffer) {
if (pGlxPbuffer->pScreen != glxc->pScreen ||
pGlxPbuffer->pFBConfig != glxc->pFBConfig) {
client->errorValue = drawId;
return BadMatch;
}
- pDraw = (DrawablePtr)pGlxPbuffer;
+ pDraw = (DrawablePtr) pGlxPbuffer;
new_reply.writeVid = pGlxPbuffer->pFBConfig->id;
new_reply.writeType = GLX_PBUFFER_TYPE;
- }
- }
-
- if (!pDraw) {
- /*
- ** Drawable is not a Window , GLXWindow or a GLXPixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- } else {
- pDraw = 0;
- }
-
- if (readId != None && readId != drawId ) {
- rc = dixLookupDrawable(&pReadDraw, readId, client, 0, DixReadAccess);
- if (rc == Success) {
- if (pReadDraw->type == DRAWABLE_WINDOW) {
- /*
- ** Drawable is an X Window.
- */
- VisualID vid;
- pReadWin = (WindowPtr)pDraw;
- vid = wVisual(pReadWin);
-
- new_reply.readVid = (glxc->pFBConfig ? glxc->pFBConfig->id : vid);
- new_reply.readType = GLX_WINDOW_TYPE;
-
- /*
- ** Check if window and context are similar.
- */
- if ((vid != glxc->pVisual->vid) ||
- (pReadWin->drawable.pScreen != glxc->pScreen)) {
- client->errorValue = readId;
- return BadMatch;
- }
-
- } else {
-
- /*
- ** An X Pixmap is not allowed as a parameter (a GLX Pixmap
- ** is, but it must first be created with glxCreateGLXPixmap).
- */
- client->errorValue = readId;
- return __glXBadDrawable;
- }
- }
-
- if (!pReadDraw) {
- dixLookupResourceByType((pointer*) &pReadGlxPixmap, readId,
- __glXPixmapRes, NullClient,
- DixUnknownAccess);
- if (pReadGlxPixmap) {
- /*
- ** Check if pixmap and context are similar.
- */
- if (pReadGlxPixmap->pScreen != glxc->pScreen ||
- pReadGlxPixmap->pGlxVisual != glxc->pGlxVisual) {
- client->errorValue = readId;
- return BadMatch;
- }
- pReadDraw = pReadGlxPixmap->pDraw;
-
- new_reply.readVid = (glxc->pFBConfig ? glxc->pFBConfig->id :
- pReadGlxPixmap->pGlxVisual->vid );
- new_reply.readType = GLX_PIXMAP_TYPE;
-
- }
- }
-
- if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxReadWindow, readId,
- __glXWindowRes, NullClient,
- DixUnknownAccess);
+ }
+ }
+
+ if (!pDraw) {
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ }
+ else {
+ pDraw = 0;
+ }
+
+ if (readId != None && readId != drawId) {
+ rc = dixLookupDrawable(&pReadDraw, readId, client, 0, DixReadAccess);
+ if (rc == Success) {
+ if (pReadDraw->type == DRAWABLE_WINDOW) {
+ /*
+ ** Drawable is an X Window.
+ */
+ VisualID vid;
+
+ pReadWin = (WindowPtr) pDraw;
+ vid = wVisual(pReadWin);
+
+ new_reply.readVid =
+ (glxc->pFBConfig ? glxc->pFBConfig->id : vid);
+ new_reply.readType = GLX_WINDOW_TYPE;
+
+ /*
+ ** Check if window and context are similar.
+ */
+ if ((vid != glxc->pVisual->vid) ||
+ (pReadWin->drawable.pScreen != glxc->pScreen)) {
+ client->errorValue = readId;
+ return BadMatch;
+ }
+
+ }
+ else {
+
+ /*
+ ** An X Pixmap is not allowed as a parameter (a GLX Pixmap
+ ** is, but it must first be created with glxCreateGLXPixmap).
+ */
+ client->errorValue = readId;
+ return __glXBadDrawable;
+ }
+ }
+
+ if (!pReadDraw) {
+ dixLookupResourceByType((pointer *) &pReadGlxPixmap, readId,
+ __glXPixmapRes, NullClient,
+ DixUnknownAccess);
+ if (pReadGlxPixmap) {
+ /*
+ ** Check if pixmap and context are similar.
+ */
+ if (pReadGlxPixmap->pScreen != glxc->pScreen ||
+ pReadGlxPixmap->pGlxVisual != glxc->pGlxVisual) {
+ client->errorValue = readId;
+ return BadMatch;
+ }
+ pReadDraw = pReadGlxPixmap->pDraw;
+
+ new_reply.readVid = (glxc->pFBConfig ? glxc->pFBConfig->id :
+ pReadGlxPixmap->pGlxVisual->vid);
+ new_reply.readType = GLX_PIXMAP_TYPE;
+
+ }
+ }
+
+ if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ dixLookupResourceByType((pointer *) &pGlxReadWindow, readId,
+ __glXWindowRes, NullClient,
+ DixUnknownAccess);
if (pGlxReadWindow) {
/*
- ** Drawable is a GLXWindow.
- **
- ** Check if GLX window and context are similar.
- */
+ ** Drawable is a GLXWindow.
+ **
+ ** Check if GLX window and context are similar.
+ */
if (pGlxReadWindow->pScreen != glxc->pScreen ||
pGlxReadWindow->pGlxFBConfig != glxc->pFBConfig) {
client->errorValue = readId;
@@ -996,140 +1060,143 @@ static int MakeCurrent(__GLXclientState *cl,
new_reply.readVid = pGlxReadWindow->pGlxFBConfig->id;
new_reply.readType = GLX_GLXWINDOW_TYPE;
}
- }
+ }
- if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxReadPbuffer, readId,
- __glXPbufferRes, NullClient,
- DixUnknownAccess);
- if (pGlxReadPbuffer) {
+ if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ dixLookupResourceByType((pointer *) &pGlxReadPbuffer, readId,
+ __glXPbufferRes, NullClient,
+ DixUnknownAccess);
+ if (pGlxReadPbuffer) {
if (pGlxReadPbuffer->pScreen != glxc->pScreen ||
pGlxReadPbuffer->pFBConfig != glxc->pFBConfig) {
client->errorValue = drawId;
return BadMatch;
}
- pReadDraw = (DrawablePtr)pGlxReadPbuffer;
+ pReadDraw = (DrawablePtr) pGlxReadPbuffer;
new_reply.readVid = pGlxReadPbuffer->pFBConfig->id;
new_reply.readType = GLX_PBUFFER_TYPE;
- }
- }
+ }
+ }
- if (!pReadDraw) {
- /*
- ** Drawable is neither a Window nor a GLXPixmap.
- */
- client->errorValue = readId;
- return __glXBadDrawable;
- }
+ if (!pReadDraw) {
+ /*
+ ** Drawable is neither a Window nor a GLXPixmap.
+ */
+ client->errorValue = readId;
+ return __glXBadDrawable;
+ }
- } else {
- pReadDraw = pDraw;
- pReadGlxPixmap = pGlxPixmap;
- pReadWin = pWin;
- new_reply.readVid = new_reply.writeVid;
- new_reply.readType = new_reply.writeType;
+ }
+ else {
+ pReadDraw = pDraw;
+ pReadGlxPixmap = pGlxPixmap;
+ pReadWin = pWin;
+ new_reply.readVid = new_reply.writeVid;
+ new_reply.readType = new_reply.writeType;
}
if (prevglxc) {
- if (prevglxc->pGlxPixmap) {
- /*
- ** The previous drawable was a glx pixmap, release it.
- */
- prevglxc->pGlxPixmap->refcnt--;
- __glXFreeGLXPixmap( prevglxc->pGlxPixmap );
- prevglxc->pGlxPixmap = 0;
- }
-
- if (prevglxc->pGlxReadPixmap) {
- /*
- ** The previous drawable was a glx pixmap, release it.
- */
- prevglxc->pGlxReadPixmap->refcnt--;
- __glXFreeGLXPixmap( prevglxc->pGlxReadPixmap );
- prevglxc->pGlxReadPixmap = 0;
- }
-
- if (prevglxc->pGlxWindow) {
- /*
- ** The previous drawable was a glx window, release it.
- */
- prevglxc->pGlxWindow->refcnt--;
- __glXFreeGLXWindow( prevglxc->pGlxWindow );
- prevglxc->pGlxWindow = 0;
- }
-
- if (prevglxc->pGlxReadWindow) {
- /*
- ** The previous drawable was a glx window, release it.
- */
- prevglxc->pGlxReadWindow->refcnt--;
- __glXFreeGLXWindow( prevglxc->pGlxReadWindow );
- prevglxc->pGlxReadWindow = 0;
- }
-
- if (prevglxc->pGlxPbuffer) {
- /*
- ** The previous drawable was a glx Pbuffer, release it.
- */
- prevglxc->pGlxPbuffer->refcnt--;
- __glXFreeGLXPbuffer( prevglxc->pGlxPbuffer );
- prevglxc->pGlxPbuffer = 0;
- }
-
- if (prevglxc->pGlxReadPbuffer) {
- /*
- ** The previous drawable was a glx Pbuffer, release it.
- */
- prevglxc->pGlxReadPbuffer->refcnt--;
- __glXFreeGLXPbuffer( prevglxc->pGlxReadPbuffer );
- prevglxc->pGlxReadPbuffer = 0;
- }
-
- ChangeCurrentContext(cl, glxc, tag);
- ChangeCurrentContext(cl, glxc, tag);
- StopUsingContext(prevglxc);
- } else {
- tag = AddCurrentContext(cl, glxc, pDraw);
+ if (prevglxc->pGlxPixmap) {
+ /*
+ ** The previous drawable was a glx pixmap, release it.
+ */
+ prevglxc->pGlxPixmap->refcnt--;
+ __glXFreeGLXPixmap(prevglxc->pGlxPixmap);
+ prevglxc->pGlxPixmap = 0;
+ }
+
+ if (prevglxc->pGlxReadPixmap) {
+ /*
+ ** The previous drawable was a glx pixmap, release it.
+ */
+ prevglxc->pGlxReadPixmap->refcnt--;
+ __glXFreeGLXPixmap(prevglxc->pGlxReadPixmap);
+ prevglxc->pGlxReadPixmap = 0;
+ }
+
+ if (prevglxc->pGlxWindow) {
+ /*
+ ** The previous drawable was a glx window, release it.
+ */
+ prevglxc->pGlxWindow->refcnt--;
+ __glXFreeGLXWindow(prevglxc->pGlxWindow);
+ prevglxc->pGlxWindow = 0;
+ }
+
+ if (prevglxc->pGlxReadWindow) {
+ /*
+ ** The previous drawable was a glx window, release it.
+ */
+ prevglxc->pGlxReadWindow->refcnt--;
+ __glXFreeGLXWindow(prevglxc->pGlxReadWindow);
+ prevglxc->pGlxReadWindow = 0;
+ }
+
+ if (prevglxc->pGlxPbuffer) {
+ /*
+ ** The previous drawable was a glx Pbuffer, release it.
+ */
+ prevglxc->pGlxPbuffer->refcnt--;
+ __glXFreeGLXPbuffer(prevglxc->pGlxPbuffer);
+ prevglxc->pGlxPbuffer = 0;
+ }
+
+ if (prevglxc->pGlxReadPbuffer) {
+ /*
+ ** The previous drawable was a glx Pbuffer, release it.
+ */
+ prevglxc->pGlxReadPbuffer->refcnt--;
+ __glXFreeGLXPbuffer(prevglxc->pGlxReadPbuffer);
+ prevglxc->pGlxReadPbuffer = 0;
+ }
+
+ ChangeCurrentContext(cl, glxc, tag);
+ ChangeCurrentContext(cl, glxc, tag);
+ StopUsingContext(prevglxc);
+ }
+ else {
+ tag = AddCurrentContext(cl, glxc, pDraw);
}
if (glxc) {
- glxc->pGlxPixmap = pGlxPixmap;
- glxc->pGlxReadPixmap = pReadGlxPixmap;
- glxc->pGlxWindow = pGlxWindow;
- glxc->pGlxReadWindow = pGlxReadWindow;
- glxc->pGlxPbuffer = pGlxPbuffer;
- glxc->pGlxReadPbuffer = pGlxReadPbuffer;
+ glxc->pGlxPixmap = pGlxPixmap;
+ glxc->pGlxReadPixmap = pReadGlxPixmap;
+ glxc->pGlxWindow = pGlxWindow;
+ glxc->pGlxReadWindow = pGlxReadWindow;
+ glxc->pGlxPbuffer = pGlxPbuffer;
+ glxc->pGlxReadPbuffer = pGlxReadPbuffer;
- if (pGlxPixmap) {
- pGlxPixmap->refcnt++;
- }
+ if (pGlxPixmap) {
+ pGlxPixmap->refcnt++;
+ }
- if (pReadGlxPixmap) {
- pReadGlxPixmap->refcnt++;
- }
+ if (pReadGlxPixmap) {
+ pReadGlxPixmap->refcnt++;
+ }
- if (pGlxWindow) {
- pGlxWindow->refcnt++;
- }
+ if (pGlxWindow) {
+ pGlxWindow->refcnt++;
+ }
- if (pGlxReadWindow) {
- pGlxReadWindow->refcnt++;
- }
+ if (pGlxReadWindow) {
+ pGlxReadWindow->refcnt++;
+ }
- if (pGlxPbuffer) {
- pGlxPbuffer->refcnt++;
- }
+ if (pGlxPbuffer) {
+ pGlxPbuffer->refcnt++;
+ }
- if (pGlxReadPbuffer) {
- pGlxReadPbuffer->refcnt++;
- }
+ if (pGlxReadPbuffer) {
+ pGlxReadPbuffer->refcnt++;
+ }
- StartUsingContext(cl, glxc);
- new_reply.contextTag = tag;
- } else {
- new_reply.contextTag = 0;
+ StartUsingContext(cl, glxc);
+ new_reply.contextTag = tag;
+ }
+ else {
+ new_reply.contextTag = 0;
}
new_reply.length = 0;
new_reply.type = X_Reply;
@@ -1137,216 +1204,226 @@ static int MakeCurrent(__GLXclientState *cl,
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
-
- if (pDraw && new_reply.writeType != GLX_PBUFFER_TYPE) {
- dixLookupResourceByClass((pointer*) &pXinDraw,
- pDraw->id, XRC_DRAWABLE,
- client, DixReadAccess);
- }
-
- if (pReadDraw && pReadDraw != pDraw &&
- new_reply.readType != GLX_PBUFFER_TYPE) {
- dixLookupResourceByClass((pointer*) &pXinReadDraw,
- pReadDraw->id, XRC_DRAWABLE,
- client, DixReadAccess);
- }
- else {
- pXinReadDraw = pXinDraw;
- }
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+
+ if (pDraw && new_reply.writeType != GLX_PBUFFER_TYPE) {
+ dixLookupResourceByClass((pointer *) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess);
+ }
+
+ if (pReadDraw && pReadDraw != pDraw &&
+ new_reply.readType != GLX_PBUFFER_TYPE) {
+ dixLookupResourceByClass((pointer *) &pXinReadDraw,
+ pReadDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess);
+ }
+ else {
+ pXinReadDraw = pXinDraw;
+ }
}
#endif
-
/* send the MakeCurrent request to all required
* back-end servers.
*/
- for (s = from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
- unsigned int be_draw = None;
- unsigned int be_read_draw = None;
-
- if (pGlxPixmap) {
- be_draw = pGlxPixmap->be_xids[s];
- }
- else if (pGlxPbuffer) {
- be_draw = pGlxPbuffer->be_xids[s];
- }
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
+ unsigned int be_draw = None;
+ unsigned int be_read_draw = None;
+
+ if (pGlxPixmap) {
+ be_draw = pGlxPixmap->be_xids[s];
+ }
+ else if (pGlxPbuffer) {
+ be_draw = pGlxPbuffer->be_xids[s];
+ }
#ifdef PANORAMIX
- else if (pXinDraw) {
- dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess);
- }
+ else if (pXinDraw) {
+ dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess);
+ }
#endif
- else if (pGlxWindow) {
- pWin = (WindowPtr)pGlxWindow->pDraw;
- }
-
- if (pWin && be_draw == None) {
- be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- if (!be_draw) {
- /* it might be that the window did not created yet on the */
- /* back-end server (lazy window creation option), force */
- /* creation of the window */
- dmxCreateAndRealizeWindow( pWin, TRUE );
- be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- }
- }
-
- /*
- * Before sending the MakeCurrent request - sync the
- * X11 connection to the back-end servers to make sure
- * that drawable is already created
- */
- dmxSync( dmxScreen, 1 );
-
- if (drawId == readId) {
- LockDisplay(dpy);
- GetReq(GLXMakeCurrent, be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXMakeCurrent;
- be_req->drawable = be_draw;
- be_req->context = (unsigned int)(glxc ? glxc->real_ids[s-from_screen] : 0);
- be_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
- if (!_XReply(dpy, (xReply *) &be_reply, 0, False)) {
-
- /* The make current failed */
- UnlockDisplay(dpy);
- SyncHandle();
- return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- SetCurrentBackEndTag( cl, tag, s, be_reply.contextTag );
- }
- else {
-
- if (pReadGlxPixmap) {
- be_read_draw = pReadGlxPixmap->be_xids[s];
- }
- else if (pGlxReadPbuffer) {
- be_read_draw = pGlxReadPbuffer->be_xids[s];
- }
+ else if (pGlxWindow) {
+ pWin = (WindowPtr) pGlxWindow->pDraw;
+ }
+
+ if (pWin && be_draw == None) {
+ be_draw = (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window;
+ if (!be_draw) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow(pWin, TRUE);
+ be_draw = (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window;
+ }
+ }
+
+ /*
+ * Before sending the MakeCurrent request - sync the
+ * X11 connection to the back-end servers to make sure
+ * that drawable is already created
+ */
+ dmxSync(dmxScreen, 1);
+
+ if (drawId == readId) {
+ LockDisplay(dpy);
+ GetReq(GLXMakeCurrent, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXMakeCurrent;
+ be_req->drawable = be_draw;
+ be_req->context =
+ (unsigned int) (glxc ? glxc->real_ids[s - from_screen] : 0);
+ be_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
+ if (!_XReply(dpy, (xReply *) & be_reply, 0, False)) {
+
+ /* The make current failed */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code));
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ SetCurrentBackEndTag(cl, tag, s, be_reply.contextTag);
+ }
+ else {
+
+ if (pReadGlxPixmap) {
+ be_read_draw = pReadGlxPixmap->be_xids[s];
+ }
+ else if (pGlxReadPbuffer) {
+ be_read_draw = pGlxReadPbuffer->be_xids[s];
+ }
#ifdef PANORAMIX
- else if (pXinReadDraw) {
- dixLookupWindow(&pReadWin, pXinReadDraw->info[s].id, client,
- DixReadAccess);
- }
+ else if (pXinReadDraw) {
+ dixLookupWindow(&pReadWin, pXinReadDraw->info[s].id, client,
+ DixReadAccess);
+ }
#endif
- else if (pGlxReadWindow) {
- pReadWin = (WindowPtr)pGlxReadWindow->pDraw;
- }
-
- if (pReadWin && be_read_draw == None) {
- be_read_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pReadWin))->window;
- if (!be_read_draw) {
- /* it might be that the window did not created yet on the */
- /* back-end server (lazy window creation option), force */
- /* creation of the window */
- dmxCreateAndRealizeWindow( pReadWin, TRUE );
- be_read_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pReadWin))->window;
- dmxSync( dmxScreen, 1 );
- }
- }
-
- if ( __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- LockDisplay(dpy);
- GetReq(GLXMakeContextCurrent, be_new_req);
- be_new_req->reqType = dmxScreen->glxMajorOpcode;
- be_new_req->glxCode = X_GLXMakeContextCurrent;
- be_new_req->drawable = be_draw;
- be_new_req->readdrawable = be_read_draw;
- be_new_req->context = (unsigned int)(glxc ? glxc->real_ids[s-from_screen] : 0);
- be_new_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
- if (!_XReply(dpy, (xReply *) &be_new_reply, 0, False)) {
-
- /* The make current failed */
- UnlockDisplay(dpy);
- SyncHandle();
- return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- SetCurrentBackEndTag( cl, tag, s, be_new_reply.contextTag );
- }
- else if (glxIsExtensionSupported("GLX_SGI_make_current_read")) {
- xGLXMakeCurrentReadSGIReq *ext_req;
- xGLXVendorPrivateWithReplyReq *vpreq;
- xGLXMakeCurrentReadSGIReply ext_reply;
-
- LockDisplay(dpy);
- GetReqExtra(GLXVendorPrivateWithReply,
- sz_xGLXMakeCurrentReadSGIReq - sz_xGLXVendorPrivateWithReplyReq,
- vpreq);
- ext_req = (xGLXMakeCurrentReadSGIReq *)vpreq;
- ext_req->reqType = dmxScreen->glxMajorOpcode;
- ext_req->glxCode = X_GLXVendorPrivateWithReply;
- ext_req->vendorCode = X_GLXvop_MakeCurrentReadSGI;
- ext_req->drawable = be_draw;
- ext_req->readable = be_read_draw;
- ext_req->context = (unsigned int)(glxc ? glxc->real_ids[s-from_screen] : 0);
- ext_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
- if (!_XReply(dpy, (xReply *) &ext_reply, 0, False)) {
-
- /* The make current failed */
- UnlockDisplay(dpy);
- SyncHandle();
- return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- SetCurrentBackEndTag( cl, tag, s, ext_reply.contextTag );
-
- }
- else {
- return BadMatch;
- }
- }
-
- XFlush( dpy );
+ else if (pGlxReadWindow) {
+ pReadWin = (WindowPtr) pGlxReadWindow->pDraw;
+ }
+
+ if (pReadWin && be_read_draw == None) {
+ be_read_draw =
+ (unsigned int) (DMX_GET_WINDOW_PRIV(pReadWin))->window;
+ if (!be_read_draw) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow(pReadWin, TRUE);
+ be_read_draw =
+ (unsigned int) (DMX_GET_WINDOW_PRIV(pReadWin))->window;
+ dmxSync(dmxScreen, 1);
+ }
+ }
+
+ if (__GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ LockDisplay(dpy);
+ GetReq(GLXMakeContextCurrent, be_new_req);
+ be_new_req->reqType = dmxScreen->glxMajorOpcode;
+ be_new_req->glxCode = X_GLXMakeContextCurrent;
+ be_new_req->drawable = be_draw;
+ be_new_req->readdrawable = be_read_draw;
+ be_new_req->context =
+ (unsigned int) (glxc ? glxc->real_ids[s - from_screen] : 0);
+ be_new_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
+ if (!_XReply(dpy, (xReply *) & be_new_reply, 0, False)) {
+
+ /* The make current failed */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code));
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ SetCurrentBackEndTag(cl, tag, s, be_new_reply.contextTag);
+ }
+ else if (glxIsExtensionSupported("GLX_SGI_make_current_read")) {
+ xGLXMakeCurrentReadSGIReq *ext_req;
+ xGLXVendorPrivateWithReplyReq *vpreq;
+ xGLXMakeCurrentReadSGIReply ext_reply;
+
+ LockDisplay(dpy);
+ GetReqExtra(GLXVendorPrivateWithReply,
+ sz_xGLXMakeCurrentReadSGIReq -
+ sz_xGLXVendorPrivateWithReplyReq, vpreq);
+ ext_req = (xGLXMakeCurrentReadSGIReq *) vpreq;
+ ext_req->reqType = dmxScreen->glxMajorOpcode;
+ ext_req->glxCode = X_GLXVendorPrivateWithReply;
+ ext_req->vendorCode = X_GLXvop_MakeCurrentReadSGI;
+ ext_req->drawable = be_draw;
+ ext_req->readable = be_read_draw;
+ ext_req->context =
+ (unsigned int) (glxc ? glxc->real_ids[s - from_screen] : 0);
+ ext_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s);
+ if (!_XReply(dpy, (xReply *) & ext_reply, 0, False)) {
+
+ /* The make current failed */
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code));
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ SetCurrentBackEndTag(cl, tag, s, ext_reply.contextTag);
+
+ }
+ else {
+ return BadMatch;
+ }
+ }
+
+ XFlush(dpy);
}
if (client->swapped) {
- __glXSwapMakeCurrentReply(client, &new_reply);
- } else {
- WriteToClient(client, sz_xGLXMakeContextCurrentReply, (char *)&new_reply);
+ __glXSwapMakeCurrentReply(client, &new_reply);
+ }
+ else {
+ WriteToClient(client, sz_xGLXMakeContextCurrentReply,
+ (char *) &new_reply);
}
return Success;
}
-int __glXMakeCurrent(__GLXclientState *cl, GLbyte *pc)
+int
+__glXMakeCurrent(__GLXclientState * cl, GLbyte * pc)
{
xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
- return( MakeCurrent(cl, req->drawable, req->drawable,
- req->context, req->oldContextTag ) );
+ return (MakeCurrent(cl, req->drawable, req->drawable,
+ req->context, req->oldContextTag));
}
-int __glXMakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
+int
+__glXMakeContextCurrent(__GLXclientState * cl, GLbyte * pc)
{
xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
- return( MakeCurrent(cl, req->drawable, req->readdrawable,
- req->context, req->oldContextTag ) );
+ return (MakeCurrent(cl, req->drawable, req->readdrawable,
+ req->context, req->oldContextTag));
}
-int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
+int
+__glXMakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc)
{
xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
- return( MakeCurrent(cl, req->drawable, req->readable,
- req->context, req->oldContextTag ) );
+ return (MakeCurrent(cl, req->drawable, req->readable,
+ req->context, req->oldContextTag));
}
-int __glXIsDirect(__GLXclientState *cl, GLbyte *pc)
+int
+__glXIsDirect(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
@@ -1354,13 +1431,13 @@ int __glXIsDirect(__GLXclientState *cl, GLbyte *pc)
__GLXcontext *glxc;
/*
- ** Find the GL context.
- */
- dixLookupResourceByType((pointer*) &glxc, req->context, __glXContextRes,
+ ** Find the GL context.
+ */
+ dixLookupResourceByType((pointer *) &glxc, req->context, __glXContextRes,
NullClient, DixUnknownAccess);
if (!glxc) {
- client->errorValue = req->context;
- return __glXBadContext;
+ client->errorValue = req->context;
+ return __glXBadContext;
}
reply.isDirect = 0;
@@ -1369,25 +1446,28 @@ int __glXIsDirect(__GLXclientState *cl, GLbyte *pc)
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- __glXSwapIsDirectReply(client, &reply);
- } else {
- WriteToClient(client, sz_xGLXIsDirectReply, (char *)&reply);
+ __glXSwapIsDirectReply(client, &reply);
+ }
+ else {
+ WriteToClient(client, sz_xGLXIsDirectReply, (char *) &reply);
}
return Success;
}
-int __glXQueryVersion(__GLXclientState *cl, GLbyte *pc)
+int
+__glXQueryVersion(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
+
/* xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; */
xGLXQueryVersionReply reply;
/*
- ** Server should take into consideration the version numbers sent by the
- ** client if it wants to work with older clients; however, in this
- ** implementation the server just returns its version number.
- */
+ ** Server should take into consideration the version numbers sent by the
+ ** client if it wants to work with older clients; however, in this
+ ** implementation the server just returns its version number.
+ */
reply.majorVersion = __glXVersionMajor;
reply.minorVersion = __glXVersionMinor;
reply.length = 0;
@@ -1395,98 +1475,104 @@ int __glXQueryVersion(__GLXclientState *cl, GLbyte *pc)
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- __glXSwapQueryVersionReply(client, &reply);
- } else {
- WriteToClient(client, sz_xGLXQueryVersionReply, (char *)&reply);
+ __glXSwapQueryVersionReply(client, &reply);
+ }
+ else {
+ WriteToClient(client, sz_xGLXQueryVersionReply, (char *) &reply);
}
return Success;
}
-int __glXWaitGL(__GLXclientState *cl, GLbyte *pc)
+int
+__glXWaitGL(__GLXclientState * cl, GLbyte * pc)
{
- xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc;
- xGLXWaitGLReq *be_req = (xGLXWaitGLReq *)pc;
+ xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc;
+ xGLXWaitGLReq *be_req = (xGLXWaitGLReq *) pc;
int from_screen = 0;
int to_screen = 0;
int s;
__GLXcontext *glxc = NULL;
-
+
if (req->contextTag != 0) {
- glxc = __glXLookupContextByTag(cl, req->contextTag);
- if (glxc) {
- from_screen = to_screen = glxc->pScreen->myNum;
- }
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (glxc) {
+ from_screen = to_screen = glxc->pScreen->myNum;
+ }
}
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
- LockDisplay(dpy);
- GetReq(GLXWaitGL,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXWaitGL;
- be_req->contextTag = (glxc ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
- UnlockDisplay(dpy);
- SyncHandle();
+ LockDisplay(dpy);
+ GetReq(GLXWaitGL, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXWaitGL;
+ be_req->contextTag =
+ (glxc ? GetCurrentBackEndTag(cl, req->contextTag, s) : 0);
+ UnlockDisplay(dpy);
+ SyncHandle();
- XSync(dpy, False);
+ XSync(dpy, False);
}
-
+
return Success;
}
-int __glXWaitX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXWaitX(__GLXclientState * cl, GLbyte * pc)
{
- xGLXWaitXReq *req = (xGLXWaitXReq *)pc;
+ xGLXWaitXReq *req = (xGLXWaitXReq *) pc;
xGLXWaitXReq *be_req;
int from_screen = 0;
int to_screen = 0;
int s;
__GLXcontext *glxc = NULL;
-
+
if (req->contextTag != 0) {
- glxc = __glXLookupContextByTag(cl, req->contextTag);
- if (glxc) {
- from_screen = to_screen = glxc->pScreen->myNum;
- }
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (glxc) {
+ from_screen = to_screen = glxc->pScreen->myNum;
+ }
}
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
- dmxSync( dmxScreen, 1 );
+ dmxSync(dmxScreen, 1);
- LockDisplay(dpy);
- GetReq(GLXWaitX,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXWaitX;
- be_req->contextTag = (glxc ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
- UnlockDisplay(dpy);
- SyncHandle();
+ LockDisplay(dpy);
+ GetReq(GLXWaitX, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXWaitX;
+ be_req->contextTag =
+ (glxc ? GetCurrentBackEndTag(cl, req->contextTag, s) : 0);
+ UnlockDisplay(dpy);
+ SyncHandle();
- XFlush( dpy );
+ XFlush(dpy);
}
return Success;
}
-int __glXCopyContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXCopyContext(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXCopyContextReq *be_req;
@@ -1501,81 +1587,83 @@ int __glXCopyContext(__GLXclientState *cl, GLbyte *pc)
int to_screen = 0;
/*
- ** Check that each context exists.
- */
- dixLookupResourceByType((pointer*) &src, source, __glXContextRes,
+ ** Check that each context exists.
+ */
+ dixLookupResourceByType((pointer *) &src, source, __glXContextRes,
NullClient, DixUnknownAccess);
if (!src) {
- client->errorValue = source;
- return __glXBadContext;
+ client->errorValue = source;
+ return __glXBadContext;
}
- dixLookupResourceByType((pointer*) &dst, dest, __glXContextRes,
+ dixLookupResourceByType((pointer *) &dst, dest, __glXContextRes,
NullClient, DixUnknownAccess);
if (!dst) {
- client->errorValue = dest;
- return __glXBadContext;
+ client->errorValue = dest;
+ return __glXBadContext;
}
/*
- ** They must be in the same address space, and same screen.
- */
+ ** They must be in the same address space, and same screen.
+ */
if (src->pGlxScreen != dst->pGlxScreen) {
- client->errorValue = source;
- return BadMatch;
+ client->errorValue = source;
+ return BadMatch;
}
/*
- ** The destination context must not be current for any client.
- */
+ ** The destination context must not be current for any client.
+ */
if (dst->isCurrent) {
- client->errorValue = dest;
- return BadAccess;
+ client->errorValue = dest;
+ return BadAccess;
}
if (tag) {
- __GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
-
- if (!tagcx) {
- return __glXBadContextTag;
- }
- if (tagcx != src) {
- /*
- ** This would be caused by a faulty implementation of the client
- ** library.
- */
- return BadMatch;
- }
+ __GLXcontext *tagcx = __glXLookupContextByTag(cl, tag);
+
+ if (!tagcx) {
+ return __glXBadContextTag;
+ }
+ if (tagcx != src) {
+ /*
+ ** This would be caused by a faulty implementation of the client
+ ** library.
+ */
+ return BadMatch;
+ }
}
from_screen = to_screen = src->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
- LockDisplay(dpy);
- GetReq(GLXCopyContext,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXCopyContext;
- be_req->source = (unsigned int)src->real_ids[s-from_screen];
- be_req->dest = (unsigned int)dst->real_ids[s-from_screen];
- be_req->mask = mask;
- be_req->contextTag = (tag ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
- UnlockDisplay(dpy);
- SyncHandle();
+ LockDisplay(dpy);
+ GetReq(GLXCopyContext, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXCopyContext;
+ be_req->source = (unsigned int) src->real_ids[s - from_screen];
+ be_req->dest = (unsigned int) dst->real_ids[s - from_screen];
+ be_req->mask = mask;
+ be_req->contextTag =
+ (tag ? GetCurrentBackEndTag(cl, req->contextTag, s) : 0);
+ UnlockDisplay(dpy);
+ SyncHandle();
}
return Success;
}
-int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
+int
+__glXGetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
@@ -1588,75 +1676,75 @@ int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
screen = req->screen;
if (screen >= screenInfo.numScreens) {
- /* The client library must send a valid screen number. */
- client->errorValue = screen;
- return BadValue;
+ /* The client library must send a valid screen number. */
+ client->errorValue = screen;
+ return BadValue;
}
pGlxScreen = &__glXActiveScreens[screen];
reply.numVisuals = pGlxScreen->numGLXVisuals;
reply.numProps = __GLX_TOTAL_CONFIG;
reply.length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 *
- __GLX_TOTAL_CONFIG) >> 2;
+ __GLX_TOTAL_CONFIG) >> 2;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
- WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply);
-
- for (i=0; i < pGlxScreen->numVisuals; i++) {
- pGlxVisual = &pGlxScreen->pGlxVisual[i];
- if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) {
- /* not a usable visual */
- continue;
- }
- p = 0;
- buf[p++] = pGlxVisual->vid;
- buf[p++] = pGlxVisual->class;
- buf[p++] = pGlxVisual->rgba;
-
- buf[p++] = pGlxVisual->redSize;
- buf[p++] = pGlxVisual->greenSize;
- buf[p++] = pGlxVisual->blueSize;
- buf[p++] = pGlxVisual->alphaSize;
- buf[p++] = pGlxVisual->accumRedSize;
- buf[p++] = pGlxVisual->accumGreenSize;
- buf[p++] = pGlxVisual->accumBlueSize;
- buf[p++] = pGlxVisual->accumAlphaSize;
-
- buf[p++] = pGlxVisual->doubleBuffer;
- buf[p++] = pGlxVisual->stereo;
-
- buf[p++] = pGlxVisual->bufferSize;
- buf[p++] = pGlxVisual->depthSize;
- buf[p++] = pGlxVisual->stencilSize;
- buf[p++] = pGlxVisual->auxBuffers;
- buf[p++] = pGlxVisual->level;
- /*
- ** Add token/value pairs for extensions.
- */
- buf[p++] = GLX_VISUAL_CAVEAT_EXT;
- buf[p++] = pGlxVisual->visualRating;
- buf[p++] = GLX_TRANSPARENT_TYPE_EXT;
- buf[p++] = pGlxVisual->transparentPixel;
- buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentRed;
- buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentGreen;
- buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentBlue;
- buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentAlpha;
- buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT;
- buf[p++] = pGlxVisual->transparentIndex;
- buf[p++] = GLX_SAMPLES_SGIS;
- buf[p++] = pGlxVisual->multiSampleSize;
- buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
- buf[p++] = pGlxVisual->nMultiSampleBuffers;
- buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX;
- buf[p++] = pGlxVisual->visualSelectGroup;
-
- WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
- (char *)buf);
+ WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *) &reply);
+
+ for (i = 0; i < pGlxScreen->numVisuals; i++) {
+ pGlxVisual = &pGlxScreen->pGlxVisual[i];
+ if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) {
+ /* not a usable visual */
+ continue;
+ }
+ p = 0;
+ buf[p++] = pGlxVisual->vid;
+ buf[p++] = pGlxVisual->class;
+ buf[p++] = pGlxVisual->rgba;
+
+ buf[p++] = pGlxVisual->redSize;
+ buf[p++] = pGlxVisual->greenSize;
+ buf[p++] = pGlxVisual->blueSize;
+ buf[p++] = pGlxVisual->alphaSize;
+ buf[p++] = pGlxVisual->accumRedSize;
+ buf[p++] = pGlxVisual->accumGreenSize;
+ buf[p++] = pGlxVisual->accumBlueSize;
+ buf[p++] = pGlxVisual->accumAlphaSize;
+
+ buf[p++] = pGlxVisual->doubleBuffer;
+ buf[p++] = pGlxVisual->stereo;
+
+ buf[p++] = pGlxVisual->bufferSize;
+ buf[p++] = pGlxVisual->depthSize;
+ buf[p++] = pGlxVisual->stencilSize;
+ buf[p++] = pGlxVisual->auxBuffers;
+ buf[p++] = pGlxVisual->level;
+ /*
+ ** Add token/value pairs for extensions.
+ */
+ buf[p++] = GLX_VISUAL_CAVEAT_EXT;
+ buf[p++] = pGlxVisual->visualRating;
+ buf[p++] = GLX_TRANSPARENT_TYPE_EXT;
+ buf[p++] = pGlxVisual->transparentPixel;
+ buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentRed;
+ buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentGreen;
+ buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentBlue;
+ buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentAlpha;
+ buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT;
+ buf[p++] = pGlxVisual->transparentIndex;
+ buf[p++] = GLX_SAMPLES_SGIS;
+ buf[p++] = pGlxVisual->multiSampleSize;
+ buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
+ buf[p++] = pGlxVisual->nMultiSampleBuffers;
+ buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX;
+ buf[p++] = pGlxVisual->visualSelectGroup;
+
+ WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
+ (char *) buf);
}
return Success;
}
@@ -1664,9 +1752,10 @@ int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
/*
** Create a GLX Pixmap from an X Pixmap.
*/
-static int CreateGLXPixmap(__GLXclientState *cl,
- VisualID visual, GLXFBConfigID fbconfigId,
- int screenNum, XID pixmapId, XID glxpixmapId )
+static int
+CreateGLXPixmap(__GLXclientState * cl,
+ VisualID visual, GLXFBConfigID fbconfigId,
+ int screenNum, XID pixmapId, XID glxpixmapId)
{
ClientPtr client = cl->client;
xGLXCreateGLXPixmapReq *be_req;
@@ -1680,107 +1769,107 @@ static int CreateGLXPixmap(__GLXclientState *cl,
__GLXFBConfig *pFBConfig;
int i, s, rc;
int from_screen, to_screen;
+
#ifdef PANORAMIX
PanoramiXRes *pXinDraw = NULL;
#endif
rc = dixLookupDrawable(&pDraw, pixmapId, client, M_DRAWABLE_PIXMAP,
- DixAddAccess);
+ DixAddAccess);
if (rc != Success)
- return rc;
+ return rc;
/*
- ** Check if screen of visual matches screen of pixmap.
- */
+ ** Check if screen of visual matches screen of pixmap.
+ */
pScreen = pDraw->pScreen;
if (screenNum != pScreen->myNum) {
- return BadMatch;
+ return BadMatch;
}
if (fbconfigId == 0 && visual == 0) {
- return BadValue;
+ return BadValue;
}
if (fbconfigId != None) {
- pFBConfig = glxLookupFBConfig( fbconfigId );
- if (!pFBConfig) {
- client->errorValue = fbconfigId;
- return BadValue;
- }
- visual = pFBConfig->associatedVisualId;
+ pFBConfig = glxLookupFBConfig(fbconfigId);
+ if (!pFBConfig) {
+ client->errorValue = fbconfigId;
+ return BadValue;
+ }
+ visual = pFBConfig->associatedVisualId;
}
else {
- pFBConfig = NULL;
+ pFBConfig = NULL;
}
if (visual != None) {
- /*
- ** Find the VisualRec for this visual.
- */
- pVisual = pScreen->visuals;
- for (i=0; i < pScreen->numVisuals; i++, pVisual++) {
- if (pVisual->vid == visual) {
- break;
- }
- }
- if (i == pScreen->numVisuals) {
- client->errorValue = visual;
- return BadValue;
- }
- /*
- ** Check if depth of visual matches depth of pixmap.
- */
- if (pVisual->nplanes != pDraw->depth) {
- client->errorValue = visual;
- return BadMatch;
- }
-
- /*
- ** Get configuration of the visual.
- */
- pGlxScreen = &__glXActiveScreens[screenNum];
- pGlxVisual = pGlxScreen->pGlxVisual;
- for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
- if (pGlxVisual->vid == visual) {
- break;
- }
- }
- if (i == pGlxScreen->numVisuals) {
- /*
- ** Visual not support on this screen by this OpenGL implementation.
- */
- client->errorValue = visual;
- return BadValue;
- }
-
-
- /* find the FBConfig for that visual (if any) */
- if ( pFBConfig == NULL ) {
- pFBConfig = glxLookupFBConfigByVID( visual );
-
- if ( pFBConfig == NULL ) {
- /*
- * visual does not have an FBConfig ???
- client->errorValue = visual;
- return BadValue;
- */
- }
- }
+ /*
+ ** Find the VisualRec for this visual.
+ */
+ pVisual = pScreen->visuals;
+ for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
+ if (pVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pScreen->numVisuals) {
+ client->errorValue = visual;
+ return BadValue;
+ }
+ /*
+ ** Check if depth of visual matches depth of pixmap.
+ */
+ if (pVisual->nplanes != pDraw->depth) {
+ client->errorValue = visual;
+ return BadMatch;
+ }
+
+ /*
+ ** Get configuration of the visual.
+ */
+ pGlxScreen = &__glXActiveScreens[screenNum];
+ pGlxVisual = pGlxScreen->pGlxVisual;
+ for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
+ if (pGlxVisual->vid == visual) {
+ break;
+ }
+ }
+ if (i == pGlxScreen->numVisuals) {
+ /*
+ ** Visual not support on this screen by this OpenGL implementation.
+ */
+ client->errorValue = visual;
+ return BadValue;
+ }
+
+ /* find the FBConfig for that visual (if any) */
+ if (pFBConfig == NULL) {
+ pFBConfig = glxLookupFBConfigByVID(visual);
+
+ if (pFBConfig == NULL) {
+ /*
+ * visual does not have an FBConfig ???
+ client->errorValue = visual;
+ return BadValue;
+ */
+ }
+ }
}
else {
- pVisual = NULL;
- pGlxVisual = NULL;
- pGlxScreen = &__glXActiveScreens[pDraw->pScreen->myNum];
+ pVisual = NULL;
+ pGlxVisual = NULL;
+ pGlxScreen = &__glXActiveScreens[pDraw->pScreen->myNum];
}
pGlxPixmap = (__GLXpixmap *) malloc(sizeof(__GLXpixmap));
if (!pGlxPixmap) {
- return BadAlloc;
+ return BadAlloc;
}
pGlxPixmap->be_xids = (XID *) malloc(sizeof(XID) * screenInfo.numScreens);
if (!pGlxPixmap->be_xids) {
- free( pGlxPixmap );
- return BadAlloc;
+ free(pGlxPixmap);
+ return BadAlloc;
}
pGlxPixmap->pDraw = pDraw;
@@ -1792,8 +1881,8 @@ static int CreateGLXPixmap(__GLXclientState *cl,
pGlxPixmap->refcnt = 0;
/*
- ** Bump the ref count on the X pixmap so it won't disappear.
- */
+ ** Bump the ref count on the X pixmap so it won't disappear.
+ */
((PixmapPtr) pDraw)->refcnt++;
/*
@@ -1802,121 +1891,128 @@ static int CreateGLXPixmap(__GLXclientState *cl,
from_screen = to_screen = screenNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
- dixLookupResourceByClass((pointer*) &pXinDraw,
- pDraw->id, XRC_DRAWABLE,
- client, DixReadAccess);
+ dixLookupResourceByClass((pointer *) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess);
}
#endif
- for (s=from_screen; s<=to_screen; s++) {
+ for (s = from_screen; s <= to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
- Pixmap be_pixmap;
- DrawablePtr pRealDraw = pDraw;
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
+ Pixmap be_pixmap;
+ DrawablePtr pRealDraw = pDraw;
#ifdef PANORAMIX
- if (pXinDraw) {
- dixLookupDrawable(&pRealDraw, pXinDraw->info[s].id, client, 0,
- DixAddAccess);
- }
+ if (pXinDraw) {
+ dixLookupDrawable(&pRealDraw, pXinDraw->info[s].id, client, 0,
+ DixAddAccess);
+ }
#endif
- be_pixmap = (DMX_GET_PIXMAP_PRIV((PixmapPtr)pRealDraw))->pixmap;
-
- /* make sure pixmap already created on back-end */
- dmxSync( dmxScreen, 1 );
-
- if ( pFBConfig && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- __GLXFBConfig *be_FBConfig = glxLookupBackEndFBConfig( pFBConfig->id, s );
-
- LockDisplay(dpy);
- pGlxPixmap->be_xids[s] = XAllocID(dpy);
- GetReq(GLXCreatePixmap,be_new_req);
- be_new_req->reqType = dmxScreen->glxMajorOpcode;
- be_new_req->glxCode = X_GLXCreatePixmap;
- be_new_req->screen = DefaultScreen(dpy);
- be_new_req->fbconfig = be_FBConfig->id;
- be_new_req->pixmap = (unsigned int)be_pixmap;
- be_new_req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
- be_new_req->numAttribs = 0;
- UnlockDisplay(dpy);
- SyncHandle();
- }
- else if (pFBConfig && glxIsExtensionSupported("GLX_SGIX_fbconfig")) {
- __GLXFBConfig *be_FBConfig = glxLookupBackEndFBConfig( pFBConfig->id, s );
- xGLXCreateGLXPixmapWithConfigSGIXReq *ext_req;
- xGLXVendorPrivateReq *vpreq;
-
- LockDisplay(dpy);
- pGlxPixmap->be_xids[s] = XAllocID(dpy);
- GetReqExtra(GLXVendorPrivate,
- sz_xGLXCreateGLXPixmapWithConfigSGIXReq-sz_xGLXVendorPrivateReq,
- vpreq);
- ext_req = (xGLXCreateGLXPixmapWithConfigSGIXReq *)vpreq;
- ext_req->reqType = dmxScreen->glxMajorOpcode;
- ext_req->glxCode = X_GLXVendorPrivate;
- ext_req->vendorCode = X_GLXvop_CreateGLXPixmapWithConfigSGIX;
- ext_req->screen = DefaultScreen(dpy);
- ext_req->fbconfig = be_FBConfig->id;
- ext_req->pixmap = (unsigned int)be_pixmap;
- ext_req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
- UnlockDisplay(dpy);
- SyncHandle();
- }
- else if (pGlxVisual) {
- LockDisplay(dpy);
- pGlxPixmap->be_xids[s] = XAllocID(dpy);
- GetReq(GLXCreateGLXPixmap,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXCreateGLXPixmap;
- be_req->screen = DefaultScreen(dpy);
- be_req->visual = (unsigned int)glxMatchGLXVisualInConfigList(
- pGlxVisual,
- dmxScreen->glxVisuals,
- dmxScreen->numGlxVisuals );
- be_req->pixmap = (unsigned int)be_pixmap;
- be_req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
- UnlockDisplay(dpy);
- SyncHandle();
- }
- else {
- client->errorValue = ( visual ? visual : fbconfigId );
- free( pGlxPixmap );
- return BadValue;
- }
-
- XFlush( dpy );
+ be_pixmap = (DMX_GET_PIXMAP_PRIV((PixmapPtr) pRealDraw))->pixmap;
+
+ /* make sure pixmap already created on back-end */
+ dmxSync(dmxScreen, 1);
+
+ if (pFBConfig && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ __GLXFBConfig *be_FBConfig =
+ glxLookupBackEndFBConfig(pFBConfig->id, s);
+
+ LockDisplay(dpy);
+ pGlxPixmap->be_xids[s] = XAllocID(dpy);
+ GetReq(GLXCreatePixmap, be_new_req);
+ be_new_req->reqType = dmxScreen->glxMajorOpcode;
+ be_new_req->glxCode = X_GLXCreatePixmap;
+ be_new_req->screen = DefaultScreen(dpy);
+ be_new_req->fbconfig = be_FBConfig->id;
+ be_new_req->pixmap = (unsigned int) be_pixmap;
+ be_new_req->glxpixmap = (unsigned int) pGlxPixmap->be_xids[s];
+ be_new_req->numAttribs = 0;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ else if (pFBConfig && glxIsExtensionSupported("GLX_SGIX_fbconfig")) {
+ __GLXFBConfig *be_FBConfig =
+ glxLookupBackEndFBConfig(pFBConfig->id, s);
+ xGLXCreateGLXPixmapWithConfigSGIXReq *ext_req;
+ xGLXVendorPrivateReq *vpreq;
+
+ LockDisplay(dpy);
+ pGlxPixmap->be_xids[s] = XAllocID(dpy);
+ GetReqExtra(GLXVendorPrivate,
+ sz_xGLXCreateGLXPixmapWithConfigSGIXReq -
+ sz_xGLXVendorPrivateReq, vpreq);
+ ext_req = (xGLXCreateGLXPixmapWithConfigSGIXReq *) vpreq;
+ ext_req->reqType = dmxScreen->glxMajorOpcode;
+ ext_req->glxCode = X_GLXVendorPrivate;
+ ext_req->vendorCode = X_GLXvop_CreateGLXPixmapWithConfigSGIX;
+ ext_req->screen = DefaultScreen(dpy);
+ ext_req->fbconfig = be_FBConfig->id;
+ ext_req->pixmap = (unsigned int) be_pixmap;
+ ext_req->glxpixmap = (unsigned int) pGlxPixmap->be_xids[s];
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ else if (pGlxVisual) {
+ LockDisplay(dpy);
+ pGlxPixmap->be_xids[s] = XAllocID(dpy);
+ GetReq(GLXCreateGLXPixmap, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXCreateGLXPixmap;
+ be_req->screen = DefaultScreen(dpy);
+ be_req->visual =
+ (unsigned int) glxMatchGLXVisualInConfigList(pGlxVisual,
+ dmxScreen->
+ glxVisuals,
+ dmxScreen->
+ numGlxVisuals);
+ be_req->pixmap = (unsigned int) be_pixmap;
+ be_req->glxpixmap = (unsigned int) pGlxPixmap->be_xids[s];
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+ else {
+ client->errorValue = (visual ? visual : fbconfigId);
+ free(pGlxPixmap);
+ return BadValue;
+ }
+
+ XFlush(dpy);
}
if (!(AddResource(glxpixmapId, __glXPixmapRes, pGlxPixmap))) {
- free( pGlxPixmap );
- return BadAlloc;
+ free(pGlxPixmap);
+ return BadAlloc;
}
return Success;
}
-int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+int
+__glXCreateGLXPixmap(__GLXclientState * cl, GLbyte * pc)
{
xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
- return( CreateGLXPixmap(cl, req->visual, None,
- req->screen, req->pixmap, req->glxpixmap) );
+ return (CreateGLXPixmap(cl, req->visual, None,
+ req->screen, req->pixmap, req->glxpixmap));
}
-int __glXCreatePixmap(__GLXclientState *cl, GLbyte *pc)
+int
+__glXCreatePixmap(__GLXclientState * cl, GLbyte * pc)
{
xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
- return( CreateGLXPixmap(cl, None, req->fbconfig,
- req->screen, req->pixmap, req->glxpixmap) );
+ return (CreateGLXPixmap(cl, None, req->fbconfig,
+ req->screen, req->pixmap, req->glxpixmap));
}
-int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDestroyGLXPixmap(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
@@ -1926,13 +2022,13 @@ int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
int from_screen, to_screen;
/*
- ** Check if it's a valid GLX pixmap.
- */
- dixLookupResourceByType((pointer*) &pGlxPixmap, glxpixmap,
+ ** Check if it's a valid GLX pixmap.
+ */
+ dixLookupResourceByType((pointer *) &pGlxPixmap, glxpixmap,
__glXPixmapRes, NullClient, DixUnknownAccess);
if (!pGlxPixmap) {
- client->errorValue = glxpixmap;
- return __glXBadPixmap;
+ client->errorValue = glxpixmap;
+ return __glXBadPixmap;
}
FreeResource(glxpixmap, FALSE);
@@ -1942,28 +2038,27 @@ int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
from_screen = to_screen = pGlxPixmap->pDraw->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
- /* make sure pixmap exist in back-end */
- dmxSync( dmxScreen, 1 );
+ /* make sure pixmap exist in back-end */
+ dmxSync(dmxScreen, 1);
- LockDisplay(dpy);
- GetReq(GLXDestroyGLXPixmap,req);
- req->reqType = dmxScreen->glxMajorOpcode;
- req->glxCode = X_GLXDestroyGLXPixmap;
- req->glxpixmap = (unsigned int)pGlxPixmap->be_xids[s];
- UnlockDisplay(dpy);
- SyncHandle();
+ LockDisplay(dpy);
+ GetReq(GLXDestroyGLXPixmap, req);
+ req->reqType = dmxScreen->glxMajorOpcode;
+ req->glxCode = X_GLXDestroyGLXPixmap;
+ req->glxpixmap = (unsigned int) pGlxPixmap->be_xids[s];
+ UnlockDisplay(dpy);
+ SyncHandle();
}
-
return Success;
}
@@ -1974,7 +2069,8 @@ int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
** this time that is of value. Consequently, this code must be
** implemented by somebody other than SGI.
*/
-int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
+int
+__glXDoSwapBuffers(__GLXclientState * cl, XID drawId, GLXContextTag tag)
{
ClientPtr client = cl->client;
DrawablePtr pDraw;
@@ -1982,6 +2078,7 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
WindowPtr pWin = NULL;
__GLXpixmap *pGlxPixmap = NULL;
__GLXcontext *glxc = NULL;
+
#ifdef PANORAMIX
PanoramiXRes *pXinDraw = NULL;
#endif
@@ -1989,152 +2086,154 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
int from_screen = 0;
int to_screen = 0;
int s, rc;
-
+
/*
- ** Check that the GLX drawable is valid.
- */
+ ** Check that the GLX drawable is valid.
+ */
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
if (rc == Success) {
from_screen = to_screen = pDraw->pScreen->myNum;
- if (pDraw->type == DRAWABLE_WINDOW) {
- /*
- ** Drawable is an X window.
- */
- pWin = (WindowPtr)pDraw;
- } else {
- /*
- ** Drawable is an X pixmap, which is not allowed.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ /*
+ ** Drawable is an X window.
+ */
+ pWin = (WindowPtr) pDraw;
+ }
+ else {
+ /*
+ ** Drawable is an X pixmap, which is not allowed.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
if (!pDraw) {
- dixLookupResourceByType((pointer*) &pGlxPixmap, drawId,
- __glXPixmapRes, NullClient, DixUnknownAccess);
- if (pGlxPixmap) {
- /*
- ** Drawable is a GLX pixmap.
- */
- pDraw = pGlxPixmap->pDraw;
- from_screen = to_screen = pGlxPixmap->pScreen->myNum;
- }
- }
-
- if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxWindow, drawId,
- __glXWindowRes, NullClient, DixUnknownAccess);
- if (pGlxWindow) {
- /*
- ** Drawable is a GLXWindow.
- */
- pDraw = pGlxWindow->pDraw;
- from_screen = to_screen = pGlxWindow->pScreen->myNum;
- }
+ dixLookupResourceByType((pointer *) &pGlxPixmap, drawId,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
+ if (pGlxPixmap) {
+ /*
+ ** Drawable is a GLX pixmap.
+ */
+ pDraw = pGlxPixmap->pDraw;
+ from_screen = to_screen = pGlxPixmap->pScreen->myNum;
+ }
+ }
+
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ dixLookupResourceByType((pointer *) &pGlxWindow, drawId,
+ __glXWindowRes, NullClient, DixUnknownAccess);
+ if (pGlxWindow) {
+ /*
+ ** Drawable is a GLXWindow.
+ */
+ pDraw = pGlxWindow->pDraw;
+ from_screen = to_screen = pGlxWindow->pScreen->myNum;
+ }
}
if (!pDraw) {
- /*
- ** Drawable is neither a X window nor a GLX pixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
+ /*
+ ** Drawable is neither a X window nor a GLX pixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
}
if (tag) {
- glxc = __glXLookupContextByTag(cl, tag);
- if (!glxc) {
- return __glXBadContextTag;
- }
+ glxc = __glXLookupContextByTag(cl, tag);
+ if (!glxc) {
+ return __glXBadContextTag;
+ }
}
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
- dixLookupResourceByClass((pointer*) &pXinDraw,
- pDraw->id, XRC_DRAWABLE,
- client, DixReadAccess);
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
+ dixLookupResourceByClass((pointer *) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess);
}
#endif
/* If requested, send a glFinish to all back-end servers before swapping. */
if (dmxGLXFinishSwap) {
- for (s=from_screen; s<=to_screen; s++) {
- Display *dpy = GetBackEndDisplay(cl,s);
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- xGLXSingleReq *finishReq;
- xGLXSingleReply reply;
-
-#define X_GLXSingle 0 /* needed by GetReq below */
-
- LockDisplay(dpy);
- GetReq(GLXSingle,finishReq);
- finishReq->reqType = dmxScreen->glxMajorOpcode;
- finishReq->glxCode = X_GLsop_Finish;
- finishReq->contextTag = (tag ? GetCurrentBackEndTag(cl,tag,s) : 0);
- (void) _XReply(dpy, (xReply*) &reply, 0, False);
- UnlockDisplay(dpy);
- SyncHandle();
- }
+ for (s = from_screen; s <= to_screen; s++) {
+ Display *dpy = GetBackEndDisplay(cl, s);
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ xGLXSingleReq *finishReq;
+ xGLXSingleReply reply;
+
+#define X_GLXSingle 0 /* needed by GetReq below */
+
+ LockDisplay(dpy);
+ GetReq(GLXSingle, finishReq);
+ finishReq->reqType = dmxScreen->glxMajorOpcode;
+ finishReq->glxCode = X_GLsop_Finish;
+ finishReq->contextTag =
+ (tag ? GetCurrentBackEndTag(cl, tag, s) : 0);
+ (void) _XReply(dpy, (xReply *) & reply, 0, False);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
}
/* If requested, send an XSync to all back-end servers before swapping. */
if (dmxGLXSyncSwap) {
- for (s=from_screen; s<=to_screen; s++)
- XSync(GetBackEndDisplay(cl,s), False);
+ for (s = from_screen; s <= to_screen; s++)
+ XSync(GetBackEndDisplay(cl, s), False);
}
-
/* send the SwapBuffers request to all back-end servers */
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
- unsigned int be_draw = 0;
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
+ unsigned int be_draw = 0;
- if (pGlxPixmap) {
- be_draw = (unsigned int)pGlxPixmap->be_xids[s];
- }
+ if (pGlxPixmap) {
+ be_draw = (unsigned int) pGlxPixmap->be_xids[s];
+ }
#ifdef PANORAMIX
- else if (pXinDraw) {
- dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess);
- }
+ else if (pXinDraw) {
+ dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess);
+ }
#endif
- else if (pGlxWindow) {
- pWin = (WindowPtr)pGlxWindow->pDraw;
- }
-
- if (pWin && !be_draw) {
- be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- if (!be_draw) {
- /* it might be that the window did not created yet on the */
- /* back-end server (lazy window creation option), force */
- /* creation of the window */
- dmxCreateAndRealizeWindow( pWin, TRUE );
- be_draw = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- }
- }
-
- dmxSync( dmxScreen, 1 );
-
- LockDisplay(dpy);
- GetReq(GLXSwapBuffers,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXSwapBuffers;
- be_req->drawable = be_draw;
- be_req->contextTag = ( tag ? GetCurrentBackEndTag(cl,tag,s) : 0 );
- UnlockDisplay(dpy);
- SyncHandle();
- XFlush(dpy);
+ else if (pGlxWindow) {
+ pWin = (WindowPtr) pGlxWindow->pDraw;
+ }
+
+ if (pWin && !be_draw) {
+ be_draw = (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window;
+ if (!be_draw) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow(pWin, TRUE);
+ be_draw = (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window;
+ }
+ }
+
+ dmxSync(dmxScreen, 1);
+
+ LockDisplay(dpy);
+ GetReq(GLXSwapBuffers, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXSwapBuffers;
+ be_req->drawable = be_draw;
+ be_req->contextTag = (tag ? GetCurrentBackEndTag(cl, tag, s) : 0);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ XFlush(dpy);
}
return Success;
}
-int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapBuffers(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
DrawablePtr pDraw;
@@ -2145,68 +2244,67 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
__GLXcontext *glxc = NULL;
__glXWindow *pGlxWindow = NULL;
int rc;
-
+
/*
- ** Check that the GLX drawable is valid.
- */
+ ** Check that the GLX drawable is valid.
+ */
rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess);
if (rc == Success) {
- if (pDraw->type != DRAWABLE_WINDOW) {
- /*
- ** Drawable is an X pixmap, which is not allowed.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
+ if (pDraw->type != DRAWABLE_WINDOW) {
+ /*
+ ** Drawable is an X pixmap, which is not allowed.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
if (!pDraw) {
- dixLookupResourceByType((pointer*) &pGlxPixmap, drawId,
- __glXPixmapRes, NullClient, DixUnknownAccess);
- if (pGlxPixmap) {
- /*
- ** Drawable is a GLX pixmap.
- */
- pDraw = pGlxPixmap->pDraw;
- }
- }
-
- if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) {
- dixLookupResourceByType((pointer*) &pGlxWindow, drawId,
- __glXWindowRes, NullClient, DixUnknownAccess);
- if (pGlxWindow) {
- /*
- ** Drawable is a GLXWindow.
- */
- pDraw = pGlxWindow->pDraw;
- }
+ dixLookupResourceByType((pointer *) &pGlxPixmap, drawId,
+ __glXPixmapRes, NullClient, DixUnknownAccess);
+ if (pGlxPixmap) {
+ /*
+ ** Drawable is a GLX pixmap.
+ */
+ pDraw = pGlxPixmap->pDraw;
+ }
+ }
+
+ if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) {
+ dixLookupResourceByType((pointer *) &pGlxWindow, drawId,
+ __glXWindowRes, NullClient, DixUnknownAccess);
+ if (pGlxWindow) {
+ /*
+ ** Drawable is a GLXWindow.
+ */
+ pDraw = pGlxWindow->pDraw;
+ }
}
if (!pDraw) {
- /*
- ** Drawable is neither a X window nor a GLX pixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
+ /*
+ ** Drawable is neither a X window nor a GLX pixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
}
if (tag) {
- glxc = __glXLookupContextByTag(cl, tag);
- if (!glxc) {
- return __glXBadContextTag;
- }
+ glxc = __glXLookupContextByTag(cl, tag);
+ if (!glxc) {
+ return __glXBadContextTag;
+ }
}
if (pDraw &&
- pDraw->type == DRAWABLE_WINDOW &&
- DMX_GET_WINDOW_PRIV((WindowPtr)pDraw)->swapGroup) {
- return SGSwapBuffers(cl, drawId, tag, pDraw);
+ pDraw->type == DRAWABLE_WINDOW &&
+ DMX_GET_WINDOW_PRIV((WindowPtr) pDraw)->swapGroup) {
+ return SGSwapBuffers(cl, drawId, tag, pDraw);
}
return __glXDoSwapBuffers(cl, drawId, tag);
}
-
/************************************************************************/
/*
@@ -2217,7 +2315,8 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
/*
** Execute all the drawing commands in a request.
*/
-int __glXRender(__GLXclientState *cl, GLbyte *pc)
+int
+__glXRender(__GLXclientState * cl, GLbyte * pc)
{
xGLXRenderReq *req;
xGLXRenderReq *be_req;
@@ -2228,23 +2327,23 @@ int __glXRender(__GLXclientState *cl, GLbyte *pc)
int s;
/*
- ** NOTE: much of this code also appears in the byteswapping version of this
- ** routine, __glXSwapRender(). Any changes made here should also be
- ** duplicated there.
- */
-
+ ** NOTE: much of this code also appears in the byteswapping version of this
+ ** routine, __glXSwapRender(). Any changes made here should also be
+ ** duplicated there.
+ */
+
req = (xGLXRenderReq *) pc;
glxc = __glXLookupContextByTag(cl, req->contextTag);
if (!glxc) {
- return 0;
+ return 0;
}
from_screen = to_screen = glxc->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
@@ -2254,19 +2353,19 @@ int __glXRender(__GLXclientState *cl, GLbyte *pc)
/*
* just forward the request to back-end server(s)
*/
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
- LockDisplay(dpy);
- GetReq(GLXRender,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXRender;
- be_req->length = req->length;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- _XSend(dpy, (const char *)pc, size);
- UnlockDisplay(dpy);
- SyncHandle();
+ LockDisplay(dpy);
+ GetReq(GLXRender, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXRender;
+ be_req->length = req->length;
+ be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s);
+ _XSend(dpy, (const char *) pc, size);
+ UnlockDisplay(dpy);
+ SyncHandle();
}
return Success;
@@ -2275,7 +2374,8 @@ int __glXRender(__GLXclientState *cl, GLbyte *pc)
/*
** Execute a large rendering request (one that spans multiple X requests).
*/
-int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
+int
+__glXRenderLarge(__GLXclientState * cl, GLbyte * pc)
{
xGLXRenderLargeReq *req;
xGLXRenderLargeReq *be_req;
@@ -2285,22 +2385,22 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
int s;
/*
- ** NOTE: much of this code also appears in the byteswapping version of this
- ** routine, __glXSwapRenderLarge(). Any changes made here should also be
- ** duplicated there.
- */
-
+ ** NOTE: much of this code also appears in the byteswapping version of this
+ ** routine, __glXSwapRenderLarge(). Any changes made here should also be
+ ** duplicated there.
+ */
+
req = (xGLXRenderLargeReq *) pc;
glxc = __glXLookupContextByTag(cl, req->contextTag);
if (!glxc) {
- return 0;
+ return 0;
}
from_screen = to_screen = glxc->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
@@ -2309,82 +2409,82 @@ int __glXRenderLarge(__GLXclientState *cl, GLbyte *pc)
/*
* just forward the request to back-end server(s)
*/
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
- GetReq(GLXRenderLarge,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXRenderLarge;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- be_req->length = req->length;
- be_req->requestNumber = req->requestNumber;
- be_req->requestTotal = req->requestTotal;
- be_req->dataBytes = req->dataBytes;
- Data(dpy, (const char *)pc, req->dataBytes);
- UnlockDisplay(dpy);
- SyncHandle();
+ GetReq(GLXRenderLarge, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXRenderLarge;
+ be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s);
+ be_req->length = req->length;
+ be_req->requestNumber = req->requestNumber;
+ be_req->requestTotal = req->requestTotal;
+ be_req->dataBytes = req->dataBytes;
+ Data(dpy, (const char *) pc, req->dataBytes);
+ UnlockDisplay(dpy);
+ SyncHandle();
}
return Success;
}
-
/************************************************************************/
-int __glXVendorPrivate(__GLXclientState *cl, GLbyte *pc)
+int
+__glXVendorPrivate(__GLXclientState * cl, GLbyte * pc)
{
xGLXVendorPrivateReq *req;
req = (xGLXVendorPrivateReq *) pc;
- switch( req->vendorCode ) {
-
- case X_GLvop_DeleteTexturesEXT:
- return __glXVForwardSingleReq( cl, pc );
- break;
-
- case X_GLXvop_SwapIntervalSGI:
- if (glxIsExtensionSupported("SGI_swap_control")) {
- return __glXVForwardSingleReq( cl, pc );
- }
- else {
- return Success;
- }
- break;
-
-#if 0 /* glx 1.3 */
- case X_GLXvop_CreateGLXVideoSourceSGIX:
- break;
- case X_GLXvop_DestroyGLXVideoSourceSGIX:
- break;
- case X_GLXvop_CreateGLXPixmapWithConfigSGIX:
- break;
- case X_GLXvop_DestroyGLXPbufferSGIX:
- break;
- case X_GLXvop_ChangeDrawableAttributesSGIX:
- break;
+ switch (req->vendorCode) {
+
+ case X_GLvop_DeleteTexturesEXT:
+ return __glXVForwardSingleReq(cl, pc);
+ break;
+
+ case X_GLXvop_SwapIntervalSGI:
+ if (glxIsExtensionSupported("SGI_swap_control")) {
+ return __glXVForwardSingleReq(cl, pc);
+ }
+ else {
+ return Success;
+ }
+ break;
+
+#if 0 /* glx 1.3 */
+ case X_GLXvop_CreateGLXVideoSourceSGIX:
+ break;
+ case X_GLXvop_DestroyGLXVideoSourceSGIX:
+ break;
+ case X_GLXvop_CreateGLXPixmapWithConfigSGIX:
+ break;
+ case X_GLXvop_DestroyGLXPbufferSGIX:
+ break;
+ case X_GLXvop_ChangeDrawableAttributesSGIX:
+ break;
#endif
- case X_GLXvop_BindSwapBarrierSGIX:
- return __glXBindSwapBarrierSGIX( cl, pc );
- break;
+ case X_GLXvop_BindSwapBarrierSGIX:
+ return __glXBindSwapBarrierSGIX(cl, pc);
+ break;
- case X_GLXvop_JoinSwapGroupSGIX:
- return __glXJoinSwapGroupSGIX( cl, pc );
- break;
+ case X_GLXvop_JoinSwapGroupSGIX:
+ return __glXJoinSwapGroupSGIX(cl, pc);
+ break;
- case X_GLXvop_CreateContextWithConfigSGIX:
- return __glXCreateContextWithConfigSGIX( cl, pc );
- break;
+ case X_GLXvop_CreateContextWithConfigSGIX:
+ return __glXCreateContextWithConfigSGIX(cl, pc);
+ break;
- default:
- /*
- ** unsupported private request
- */
- cl->client->errorValue = req->vendorCode;
- return __glXUnsupportedPrivateRequest;
+ default:
+ /*
+ ** unsupported private request
+ */
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
}
cl->client->errorValue = req->vendorCode;
@@ -2392,78 +2492,79 @@ int __glXVendorPrivate(__GLXclientState *cl, GLbyte *pc)
}
-int __glXVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
+int
+__glXVendorPrivateWithReply(__GLXclientState * cl, GLbyte * pc)
{
xGLXVendorPrivateWithReplyReq *req;
req = (xGLXVendorPrivateWithReplyReq *) pc;
- switch( req->vendorCode ) {
-
- case X_GLvop_GetConvolutionFilterEXT:
- case X_GLvop_GetConvolutionParameterfvEXT:
- case X_GLvop_GetConvolutionParameterivEXT:
- case X_GLvop_GetSeparableFilterEXT:
- case X_GLvop_GetHistogramEXT:
- case X_GLvop_GetHistogramParameterivEXT:
- case X_GLvop_GetMinmaxEXT:
- case X_GLvop_GetMinmaxParameterfvEXT:
- case X_GLvop_GetMinmaxParameterivEXT:
- case X_GLvop_AreTexturesResidentEXT:
- case X_GLvop_IsTextureEXT:
- return( __glXVForwardPipe0WithReply(cl, pc) );
- break;
-
- case X_GLvop_GenTexturesEXT:
- return( __glXVForwardAllWithReply(cl, pc) );
- break;
-
-
-#if 0 /* glx1.3 */
- case X_GLvop_GetDetailTexFuncSGIS:
- case X_GLvop_GetSharpenTexFuncSGIS:
- case X_GLvop_GetColorTableSGI:
- case X_GLvop_GetColorTableParameterfvSGI:
- case X_GLvop_GetColorTableParameterivSGI:
- case X_GLvop_GetTexFilterFuncSGIS:
- case X_GLvop_GetInstrumentsSGIX:
- case X_GLvop_InstrumentsBufferSGIX:
- case X_GLvop_PollInstrumentsSGIX:
- case X_GLvop_FlushRasterSGIX:
- case X_GLXvop_CreateGLXPbufferSGIX:
- case X_GLXvop_GetDrawableAttributesSGIX:
- case X_GLXvop_QueryHyperpipeNetworkSGIX:
- case X_GLXvop_QueryHyperpipeConfigSGIX:
- case X_GLXvop_HyperpipeConfigSGIX:
- case X_GLXvop_DestroyHyperpipeConfigSGIX:
+ switch (req->vendorCode) {
+
+ case X_GLvop_GetConvolutionFilterEXT:
+ case X_GLvop_GetConvolutionParameterfvEXT:
+ case X_GLvop_GetConvolutionParameterivEXT:
+ case X_GLvop_GetSeparableFilterEXT:
+ case X_GLvop_GetHistogramEXT:
+ case X_GLvop_GetHistogramParameterivEXT:
+ case X_GLvop_GetMinmaxEXT:
+ case X_GLvop_GetMinmaxParameterfvEXT:
+ case X_GLvop_GetMinmaxParameterivEXT:
+ case X_GLvop_AreTexturesResidentEXT:
+ case X_GLvop_IsTextureEXT:
+ return (__glXVForwardPipe0WithReply(cl, pc));
+ break;
+
+ case X_GLvop_GenTexturesEXT:
+ return (__glXVForwardAllWithReply(cl, pc));
+ break;
+
+#if 0 /* glx1.3 */
+ case X_GLvop_GetDetailTexFuncSGIS:
+ case X_GLvop_GetSharpenTexFuncSGIS:
+ case X_GLvop_GetColorTableSGI:
+ case X_GLvop_GetColorTableParameterfvSGI:
+ case X_GLvop_GetColorTableParameterivSGI:
+ case X_GLvop_GetTexFilterFuncSGIS:
+ case X_GLvop_GetInstrumentsSGIX:
+ case X_GLvop_InstrumentsBufferSGIX:
+ case X_GLvop_PollInstrumentsSGIX:
+ case X_GLvop_FlushRasterSGIX:
+ case X_GLXvop_CreateGLXPbufferSGIX:
+ case X_GLXvop_GetDrawableAttributesSGIX:
+ case X_GLXvop_QueryHyperpipeNetworkSGIX:
+ case X_GLXvop_QueryHyperpipeConfigSGIX:
+ case X_GLXvop_HyperpipeConfigSGIX:
+ case X_GLXvop_DestroyHyperpipeConfigSGIX:
#endif
- case X_GLXvop_QueryMaxSwapBarriersSGIX:
- return( __glXQueryMaxSwapBarriersSGIX(cl, pc) );
- break;
+ case X_GLXvop_QueryMaxSwapBarriersSGIX:
+ return (__glXQueryMaxSwapBarriersSGIX(cl, pc));
+ break;
- case X_GLXvop_GetFBConfigsSGIX:
- return( __glXGetFBConfigsSGIX(cl, pc) );
- break;
+ case X_GLXvop_GetFBConfigsSGIX:
+ return (__glXGetFBConfigsSGIX(cl, pc));
+ break;
- case X_GLXvop_MakeCurrentReadSGI:
- return( __glXMakeCurrentReadSGI(cl, pc) );
- break;
+ case X_GLXvop_MakeCurrentReadSGI:
+ return (__glXMakeCurrentReadSGI(cl, pc));
+ break;
- case X_GLXvop_QueryContextInfoEXT:
- return( __glXQueryContextInfoEXT(cl,pc) );
- break;
+ case X_GLXvop_QueryContextInfoEXT:
+ return (__glXQueryContextInfoEXT(cl, pc));
+ break;
- default:
- /*
- ** unsupported private request
- */
- cl->client->errorValue = req->vendorCode;
- return __glXUnsupportedPrivateRequest;
+ default:
+ /*
+ ** unsupported private request
+ */
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
}
}
-int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
+int
+__glXQueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc;
@@ -2484,34 +2585,36 @@ int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
screen = req->screen;
/*
- ** Check if screen exists.
- */
+ ** Check if screen exists.
+ */
if ((screen < 0) || (screen >= screenInfo.numScreens)) {
- client->errorValue = screen;
- return BadValue;
+ client->errorValue = screen;
+ return BadValue;
}
#ifdef FWD_QUERY_REQ
dmxScreen = &dmxScreens[screen];
/* Send the glXQueryServerString request */
- dpy = GetBackEndDisplay(cl,screen);
+ dpy = GetBackEndDisplay(cl, screen);
LockDisplay(dpy);
- GetReq(GLXQueryExtensionsString,be_req);
+ GetReq(GLXQueryExtensionsString, be_req);
be_req->reqType = dmxScreen->glxMajorOpcode;
be_req->glxCode = X_GLXQueryServerString;
be_req->screen = DefaultScreen(dpy);
- _XReply(dpy, (xReply*) &be_reply, 0, False);
- len = (int)be_reply.length;
- numbytes = (int)be_reply.n;
+ _XReply(dpy, (xReply *) & be_reply, 0, False);
+ len = (int) be_reply.length;
+ numbytes = (int) be_reply.n;
slop = numbytes * __GLX_SIZE_INT8 & 3;
- be_buf = (char *)malloc(numbytes);
+ be_buf = (char *) malloc(numbytes);
if (!be_buf) {
/* Throw data on the floor */
_XEatData(dpy, len);
- } else {
- _XRead(dpy, (char *)be_buf, numbytes);
- if (slop) _XEatData(dpy,4-slop);
+ }
+ else {
+ _XRead(dpy, (char *) be_buf, numbytes);
+ if (slop)
+ _XEatData(dpy, 4 - slop);
}
UnlockDisplay(dpy);
SyncHandle();
@@ -2532,15 +2635,18 @@ int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
if (client->swapped) {
glxSwapQueryExtensionsStringReply(client, &reply, be_buf);
- } else {
- WriteToClient(client, sz_xGLXQueryExtensionsStringReply,(char *)&reply);
- WriteToClient(client, (int)(length << 2), (char *)be_buf);
+ }
+ else {
+ WriteToClient(client, sz_xGLXQueryExtensionsStringReply,
+ (char *) &reply);
+ WriteToClient(client, (int) (length << 2), (char *) be_buf);
}
return Success;
}
-int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc)
+int
+__glXQueryServerString(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc;
@@ -2550,46 +2656,49 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc)
size_t length;
int len, numbytes;
char *be_buf;
+
#ifdef FWD_QUERY_REQ
xGLXQueryServerStringReq *be_req;
xGLXQueryServerStringReply be_reply;
DMXScreenInfo *dmxScreen;
Display *dpy;
- int slop;
+ int slop;
#endif
name = req->name;
screen = req->screen;
/*
- ** Check if screen exists.
- */
+ ** Check if screen exists.
+ */
if ((screen < 0) || (screen >= screenInfo.numScreens)) {
- client->errorValue = screen;
- return BadValue;
+ client->errorValue = screen;
+ return BadValue;
}
#ifdef FWD_QUERY_REQ
dmxScreen = &dmxScreens[screen];
/* Send the glXQueryServerString request */
- dpy = GetBackEndDisplay(cl,screen);
+ dpy = GetBackEndDisplay(cl, screen);
LockDisplay(dpy);
- GetReq(GLXQueryServerString,be_req);
+ GetReq(GLXQueryServerString, be_req);
be_req->reqType = dmxScreen->glxMajorOpcode;
be_req->glxCode = X_GLXQueryServerString;
be_req->screen = DefaultScreen(dpy);
be_req->name = name;
- _XReply(dpy, (xReply*) &be_reply, 0, False);
- len = (int)be_reply.length;
- numbytes = (int)be_reply.n;
+ _XReply(dpy, (xReply *) & be_reply, 0, False);
+ len = (int) be_reply.length;
+ numbytes = (int) be_reply.n;
slop = numbytes * __GLX_SIZE_INT8 & 3;
- be_buf = (char *)malloc(numbytes);
+ be_buf = (char *) malloc(numbytes);
if (!be_buf) {
/* Throw data on the floor */
_XEatData(dpy, len);
- } else {
- _XRead(dpy, (char *)be_buf, numbytes);
- if (slop) _XEatData(dpy,4-slop);
+ }
+ else {
+ _XRead(dpy, (char *) be_buf, numbytes);
+ if (slop)
+ _XEatData(dpy, 4 - slop);
}
UnlockDisplay(dpy);
SyncHandle();
@@ -2608,15 +2717,17 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc)
if (client->swapped) {
glxSwapQueryServerStringReply(client, &reply, be_buf);
- } else {
- WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)&reply);
- WriteToClient(client, (int)(length << 2), be_buf);
+ }
+ else {
+ WriteToClient(client, sz_xGLXQueryServerStringReply, (char *) &reply);
+ WriteToClient(client, (int) (length << 2), be_buf);
}
return Success;
}
-int __glXClientInfo(__GLXclientState *cl, GLbyte *pc)
+int
+__glXClientInfo(__GLXclientState * cl, GLbyte * pc)
{
xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc;
xGLXClientInfoReq *be_req;
@@ -2624,38 +2735,38 @@ int __glXClientInfo(__GLXclientState *cl, GLbyte *pc)
int from_screen = 0;
int to_screen = 0;
int s;
-
+
cl->GLClientmajorVersion = req->major;
cl->GLClientminorVersion = req->minor;
free(cl->GLClientextensions);
- buf = (const char *)(req+1);
+ buf = (const char *) (req + 1);
cl->GLClientextensions = strdup(buf);
to_screen = screenInfo.numScreens - 1;
- for (s=from_screen; s<=to_screen; s++)
- {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
- LockDisplay(dpy);
- GetReq(GLXClientInfo,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXClientInfo;
- be_req->major = req->major;
- be_req->minor = req->minor;
- be_req->length = req->length;
- be_req->numbytes = req->numbytes;
- Data(dpy, buf, req->numbytes);
+ LockDisplay(dpy);
+ GetReq(GLXClientInfo, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXClientInfo;
+ be_req->major = req->major;
+ be_req->minor = req->minor;
+ be_req->length = req->length;
+ be_req->numbytes = req->numbytes;
+ Data(dpy, buf, req->numbytes);
- UnlockDisplay(dpy);
- SyncHandle();
+ UnlockDisplay(dpy);
+ SyncHandle();
}
return Success;
}
-int __glXUseXFont(__GLXclientState *cl, GLbyte *pc)
+int
+__glXUseXFont(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXUseXFontReq *req;
@@ -2665,66 +2776,66 @@ int __glXUseXFont(__GLXclientState *cl, GLbyte *pc)
int from_screen = 0;
int to_screen = 0;
int s;
- dmxFontPrivPtr pFontPriv;
+ dmxFontPrivPtr pFontPriv;
DMXScreenInfo *dmxScreen;
Display *dpy;
req = (xGLXUseXFontReq *) pc;
if (req->contextTag != 0) {
- glxc = __glXLookupContextByTag(cl, req->contextTag);
- if (glxc) {
- from_screen = to_screen = glxc->pScreen->myNum;
- }
+ glxc = __glXLookupContextByTag(cl, req->contextTag);
+ if (glxc) {
+ from_screen = to_screen = glxc->pScreen->myNum;
+ }
}
/*
- ** Font can actually be either the ID of a font or the ID of a GC
- ** containing a font.
- */
- dixLookupResourceByType((pointer*) &pFont, req->font, RT_FONT,
+ ** Font can actually be either the ID of a font or the ID of a GC
+ ** containing a font.
+ */
+ dixLookupResourceByType((pointer *) &pFont, req->font, RT_FONT,
NullClient, DixUnknownAccess);
if (!pFont) {
GC *pGC;
- dixLookupResourceByType((pointer*) &pGC, req->font,
- RT_GC, NullClient,
- DixUnknownAccess);
+
+ dixLookupResourceByType((pointer *) &pGC, req->font,
+ RT_GC, NullClient, DixUnknownAccess);
if (!pGC) {
- client->errorValue = req->font;
+ client->errorValue = req->font;
return BadFont;
- }
- pFont = pGC->font;
+ }
+ pFont = pGC->font;
}
pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex);
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
+ for (s = from_screen; s <= to_screen; s++) {
+ dmxScreen = &dmxScreens[s];
+ dpy = GetBackEndDisplay(cl, s);
- for (s=from_screen; s<=to_screen; s++) {
- dmxScreen = &dmxScreens[s];
- dpy = GetBackEndDisplay(cl,s);
-
- dmxSync( dmxScreen, 1 );
+ dmxSync(dmxScreen, 1);
- LockDisplay(dpy);
- GetReq(GLXUseXFont,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXUseXFont;
- be_req->contextTag = (glxc ? GetCurrentBackEndTag(cl,req->contextTag,s) : 0);
- be_req->font = pFontPriv->font[s]->fid;
- be_req->first = req->first;
- be_req->count = req->count;
- be_req->listBase = req->listBase;
- UnlockDisplay(dpy);
- SyncHandle();
+ LockDisplay(dpy);
+ GetReq(GLXUseXFont, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXUseXFont;
+ be_req->contextTag =
+ (glxc ? GetCurrentBackEndTag(cl, req->contextTag, s) : 0);
+ be_req->font = pFontPriv->font[s]->fid;
+ be_req->first = req->first;
+ be_req->count = req->count;
+ be_req->listBase = req->listBase;
+ UnlockDisplay(dpy);
+ SyncHandle();
- XSync( dpy, False );
+ XSync(dpy, False);
}
return Success;
@@ -2734,7 +2845,8 @@ int __glXUseXFont(__GLXclientState *cl, GLbyte *pc)
* start GLX 1.3 here
*/
-int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
+int
+__glXGetFBConfigs(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
@@ -2747,9 +2859,9 @@ int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
__GLXscreenInfo *pGlxScreen;
if (screen >= screenInfo.numScreens) {
- /* The client library must send a valid screen number. */
- client->errorValue = screen;
- return BadValue;
+ /* The client library must send a valid screen number. */
+ client->errorValue = screen;
+ return BadValue;
}
pGlxScreen = &__glXActiveScreens[screen];
@@ -2762,169 +2874,174 @@ int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
- __GLX_SWAP_INT(&reply.numFBConfigs);
- __GLX_SWAP_INT(&reply.numAttribs);
- }
- WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *)&reply);
-
- for (i=0; i < numFBConfigs; i++) {
- int associatedVisualId = 0;
- int drawableTypeIndex;
- pFBConfig = __glXFBConfigs[ i * (screenInfo.numScreens+1) ];
-
- p = 0;
- /* core attributes */
- buf[p++] = GLX_FBCONFIG_ID;
- buf[p++] = pFBConfig->id;
- buf[p++] = GLX_BUFFER_SIZE;
- buf[p++] = pFBConfig->indexBits;
- buf[p++] = GLX_LEVEL;
- buf[p++] = pFBConfig->level;
- buf[p++] = GLX_DOUBLEBUFFER;
- buf[p++] = pFBConfig->doubleBufferMode;
- buf[p++] = GLX_STEREO;
- buf[p++] = pFBConfig->stereoMode;
- buf[p++] = GLX_AUX_BUFFERS;
- buf[p++] = pFBConfig->maxAuxBuffers;
- buf[p++] = GLX_RED_SIZE;
- buf[p++] = pFBConfig->redBits;
- buf[p++] = GLX_GREEN_SIZE;
- buf[p++] = pFBConfig->greenBits;
- buf[p++] = GLX_BLUE_SIZE;
- buf[p++] = pFBConfig->blueBits;
- buf[p++] = GLX_ALPHA_SIZE;
- buf[p++] = pFBConfig->alphaBits;
- buf[p++] = GLX_DEPTH_SIZE;
- buf[p++] = pFBConfig->depthBits;
- buf[p++] = GLX_STENCIL_SIZE;
- buf[p++] = pFBConfig->stencilBits;
- buf[p++] = GLX_ACCUM_RED_SIZE;
- buf[p++] = pFBConfig->accumRedBits;
- buf[p++] = GLX_ACCUM_GREEN_SIZE;
- buf[p++] = pFBConfig->accumGreenBits;
- buf[p++] = GLX_ACCUM_BLUE_SIZE;
- buf[p++] = pFBConfig->accumBlueBits;
- buf[p++] = GLX_ACCUM_ALPHA_SIZE;
- buf[p++] = pFBConfig->accumAlphaBits;
- buf[p++] = GLX_RENDER_TYPE;
- buf[p++] = pFBConfig->renderType;
- buf[p++] = GLX_DRAWABLE_TYPE;
- drawableTypeIndex = p;
- buf[p++] = pFBConfig->drawableType;
- buf[p++] = GLX_X_VISUAL_TYPE;
- buf[p++] = pFBConfig->visualType;
- buf[p++] = GLX_CONFIG_CAVEAT;
- buf[p++] = pFBConfig->visualCaveat;
- buf[p++] = GLX_TRANSPARENT_TYPE;
- buf[p++] = pFBConfig->transparentType;
- buf[p++] = GLX_TRANSPARENT_RED_VALUE;
- buf[p++] = pFBConfig->transparentRed;
- buf[p++] = GLX_TRANSPARENT_GREEN_VALUE;
- buf[p++] = pFBConfig->transparentGreen;
- buf[p++] = GLX_TRANSPARENT_BLUE_VALUE;
- buf[p++] = pFBConfig->transparentBlue;
- buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE;
- buf[p++] = pFBConfig->transparentAlpha;
- buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
- buf[p++] = pFBConfig->transparentIndex;
- buf[p++] = GLX_MAX_PBUFFER_WIDTH;
- buf[p++] = pFBConfig->maxPbufferWidth;
- buf[p++] = GLX_MAX_PBUFFER_HEIGHT;
- buf[p++] = pFBConfig->maxPbufferHeight;
- buf[p++] = GLX_MAX_PBUFFER_PIXELS;
- buf[p++] = pFBConfig->maxPbufferPixels;
-
- /*
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_INT(&reply.numFBConfigs);
+ __GLX_SWAP_INT(&reply.numAttribs);
+ }
+ WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *) &reply);
+
+ for (i = 0; i < numFBConfigs; i++) {
+ int associatedVisualId = 0;
+ int drawableTypeIndex;
+
+ pFBConfig = __glXFBConfigs[i * (screenInfo.numScreens + 1)];
+
+ p = 0;
+ /* core attributes */
+ buf[p++] = GLX_FBCONFIG_ID;
+ buf[p++] = pFBConfig->id;
+ buf[p++] = GLX_BUFFER_SIZE;
+ buf[p++] = pFBConfig->indexBits;
+ buf[p++] = GLX_LEVEL;
+ buf[p++] = pFBConfig->level;
+ buf[p++] = GLX_DOUBLEBUFFER;
+ buf[p++] = pFBConfig->doubleBufferMode;
+ buf[p++] = GLX_STEREO;
+ buf[p++] = pFBConfig->stereoMode;
+ buf[p++] = GLX_AUX_BUFFERS;
+ buf[p++] = pFBConfig->maxAuxBuffers;
+ buf[p++] = GLX_RED_SIZE;
+ buf[p++] = pFBConfig->redBits;
+ buf[p++] = GLX_GREEN_SIZE;
+ buf[p++] = pFBConfig->greenBits;
+ buf[p++] = GLX_BLUE_SIZE;
+ buf[p++] = pFBConfig->blueBits;
+ buf[p++] = GLX_ALPHA_SIZE;
+ buf[p++] = pFBConfig->alphaBits;
+ buf[p++] = GLX_DEPTH_SIZE;
+ buf[p++] = pFBConfig->depthBits;
+ buf[p++] = GLX_STENCIL_SIZE;
+ buf[p++] = pFBConfig->stencilBits;
+ buf[p++] = GLX_ACCUM_RED_SIZE;
+ buf[p++] = pFBConfig->accumRedBits;
+ buf[p++] = GLX_ACCUM_GREEN_SIZE;
+ buf[p++] = pFBConfig->accumGreenBits;
+ buf[p++] = GLX_ACCUM_BLUE_SIZE;
+ buf[p++] = pFBConfig->accumBlueBits;
+ buf[p++] = GLX_ACCUM_ALPHA_SIZE;
+ buf[p++] = pFBConfig->accumAlphaBits;
+ buf[p++] = GLX_RENDER_TYPE;
+ buf[p++] = pFBConfig->renderType;
+ buf[p++] = GLX_DRAWABLE_TYPE;
+ drawableTypeIndex = p;
+ buf[p++] = pFBConfig->drawableType;
+ buf[p++] = GLX_X_VISUAL_TYPE;
+ buf[p++] = pFBConfig->visualType;
+ buf[p++] = GLX_CONFIG_CAVEAT;
+ buf[p++] = pFBConfig->visualCaveat;
+ buf[p++] = GLX_TRANSPARENT_TYPE;
+ buf[p++] = pFBConfig->transparentType;
+ buf[p++] = GLX_TRANSPARENT_RED_VALUE;
+ buf[p++] = pFBConfig->transparentRed;
+ buf[p++] = GLX_TRANSPARENT_GREEN_VALUE;
+ buf[p++] = pFBConfig->transparentGreen;
+ buf[p++] = GLX_TRANSPARENT_BLUE_VALUE;
+ buf[p++] = pFBConfig->transparentBlue;
+ buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE;
+ buf[p++] = pFBConfig->transparentAlpha;
+ buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
+ buf[p++] = pFBConfig->transparentIndex;
+ buf[p++] = GLX_MAX_PBUFFER_WIDTH;
+ buf[p++] = pFBConfig->maxPbufferWidth;
+ buf[p++] = GLX_MAX_PBUFFER_HEIGHT;
+ buf[p++] = pFBConfig->maxPbufferHeight;
+ buf[p++] = GLX_MAX_PBUFFER_PIXELS;
+ buf[p++] = pFBConfig->maxPbufferPixels;
+
+ /*
* find the visual of the back-end server and match a visual
- * on the proxy.
- * do only once - if a visual is not yet associated.
- */
- if (pFBConfig->associatedVisualId == (unsigned int)-1) {
- DMXScreenInfo *dmxScreen = &dmxScreens[screen];
- __GLXFBConfig *be_pFBConfig = __glXFBConfigs[ i * (screenInfo.numScreens+1)+screen+1 ];
- __GLXvisualConfig *pGlxVisual = NULL;
- int v;
- int found = 0;
- for (v=0; v<dmxScreen->numGlxVisuals; v++) {
- if (dmxScreen->glxVisuals[v].vid == be_pFBConfig->associatedVisualId) {
- pGlxVisual = &dmxScreen->glxVisuals[v];
- break;
- }
- }
-
- if (pGlxVisual) {
- for (v=0; v<pGlxScreen->numVisuals; v++) {
- if (glxVisualsMatch(&pGlxScreen->pGlxVisual[v], pGlxVisual)) {
- associatedVisualId = pGlxScreen->pGlxVisual[v].vid;
- found = 1;
- break;
- }
- }
- }
-
- if (!found) {
- associatedVisualId = 0;
- pFBConfig->drawableType &= ~(GLX_WINDOW_BIT);
- buf[drawableTypeIndex] = pFBConfig->drawableType;
- }
+ * on the proxy.
+ * do only once - if a visual is not yet associated.
+ */
+ if (pFBConfig->associatedVisualId == (unsigned int) -1) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[screen];
+ __GLXFBConfig *be_pFBConfig =
+ __glXFBConfigs[i * (screenInfo.numScreens + 1) + screen + 1];
+ __GLXvisualConfig *pGlxVisual = NULL;
+ int v;
+ int found = 0;
+
+ for (v = 0; v < dmxScreen->numGlxVisuals; v++) {
+ if (dmxScreen->glxVisuals[v].vid ==
+ be_pFBConfig->associatedVisualId) {
+ pGlxVisual = &dmxScreen->glxVisuals[v];
+ break;
+ }
+ }
+
+ if (pGlxVisual) {
+ for (v = 0; v < pGlxScreen->numVisuals; v++) {
+ if (glxVisualsMatch(&pGlxScreen->pGlxVisual[v], pGlxVisual)) {
+ associatedVisualId = pGlxScreen->pGlxVisual[v].vid;
+ found = 1;
+ break;
+ }
+ }
+ }
+
+ if (!found) {
+ associatedVisualId = 0;
+ pFBConfig->drawableType &= ~(GLX_WINDOW_BIT);
+ buf[drawableTypeIndex] = pFBConfig->drawableType;
+ }
#ifdef PANORAMIX
- else if (!noPanoramiXExtension) {
- /* convert the associated visualId to the panoramix one */
- pFBConfig->associatedVisualId =
- PanoramiXTranslateVisualID(screen, v);
- }
+ else if (!noPanoramiXExtension) {
+ /* convert the associated visualId to the panoramix one */
+ pFBConfig->associatedVisualId =
+ PanoramiXTranslateVisualID(screen, v);
+ }
#endif
- }
- else {
- associatedVisualId = pFBConfig->associatedVisualId;
- }
-
- buf[p++] = GLX_VISUAL_ID;
- buf[p++] = associatedVisualId;
-
- /* SGIS_multisample attributes */
- buf[p++] = GLX_SAMPLES_SGIS;
- buf[p++] = pFBConfig->multiSampleSize;
- buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
- buf[p++] = pFBConfig->nMultiSampleBuffers;
-
- /* SGIX_pbuffer specific attributes */
- buf[p++] = GLX_OPTIMAL_PBUFFER_WIDTH_SGIX;
- buf[p++] = pFBConfig->optimalPbufferWidth;
- buf[p++] = GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX;
- buf[p++] = pFBConfig->optimalPbufferHeight;
-
- buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX;
- buf[p++] = pFBConfig->visualSelectGroup;
-
- if (client->swapped) {
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_INT_ARRAY((int *)buf, 2*numAttribs);
- }
- WriteToClient(client, 2*numAttribs * __GLX_SIZE_CARD32, (char *)buf);
+ }
+ else {
+ associatedVisualId = pFBConfig->associatedVisualId;
+ }
+
+ buf[p++] = GLX_VISUAL_ID;
+ buf[p++] = associatedVisualId;
+
+ /* SGIS_multisample attributes */
+ buf[p++] = GLX_SAMPLES_SGIS;
+ buf[p++] = pFBConfig->multiSampleSize;
+ buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
+ buf[p++] = pFBConfig->nMultiSampleBuffers;
+
+ /* SGIX_pbuffer specific attributes */
+ buf[p++] = GLX_OPTIMAL_PBUFFER_WIDTH_SGIX;
+ buf[p++] = pFBConfig->optimalPbufferWidth;
+ buf[p++] = GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX;
+ buf[p++] = pFBConfig->optimalPbufferHeight;
+
+ buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX;
+ buf[p++] = pFBConfig->visualSelectGroup;
+
+ if (client->swapped) {
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ __GLX_SWAP_INT_ARRAY((int *) buf, 2 * numAttribs);
+ }
+ WriteToClient(client, 2 * numAttribs * __GLX_SIZE_CARD32, (char *) buf);
}
return Success;
}
-int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc)
{
- xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *)pc;
- xGLXGetFBConfigsReq new_req;
+ xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
+ xGLXGetFBConfigsReq new_req;
- new_req.reqType = req->reqType;
- new_req.glxCode = req->glxCode;
- new_req.length = req->length;
- new_req.screen = req->screen;
+ new_req.reqType = req->reqType;
+ new_req.glxCode = req->glxCode;
+ new_req.length = req->length;
+ new_req.screen = req->screen;
- return( __glXGetFBConfigs( cl, (GLbyte *)&new_req ) );
+ return (__glXGetFBConfigs(cl, (GLbyte *) & new_req));
}
-
-int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
+int
+__glXCreateWindow(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
@@ -2942,86 +3059,87 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
pointer val;
/*
- ** Check if windowId is valid
- */
+ ** Check if windowId is valid
+ */
rc = dixLookupDrawable(&pDraw, windowId, client, M_DRAWABLE_WINDOW,
- DixAddAccess);
+ DixAddAccess);
if (rc != Success)
- return rc;
+ return rc;
/*
- ** Check if screen of window matches screen of fbconfig.
- */
+ ** Check if screen of window matches screen of fbconfig.
+ */
pScreen = pDraw->pScreen;
if (screen != pScreen->myNum) {
- return BadMatch;
+ return BadMatch;
}
/*
- ** Find the FBConfigRec for this fbconfigid.
- */
+ ** Find the FBConfigRec for this fbconfigid.
+ */
if (!(pGlxFBConfig = glxLookupFBConfig(fbconfigId))) {
- client->errorValue = fbconfigId;
- return __glXBadFBConfig;
+ client->errorValue = fbconfigId;
+ return __glXBadFBConfig;
}
visId = pGlxFBConfig->associatedVisualId;
/*
- ** Check if the fbconfig supports rendering to windows
- */
- if( !(pGlxFBConfig->drawableType & GLX_WINDOW_BIT) ) {
- return BadMatch;
+ ** Check if the fbconfig supports rendering to windows
+ */
+ if (!(pGlxFBConfig->drawableType & GLX_WINDOW_BIT)) {
+ return BadMatch;
}
if (visId != None) {
- /*
- ** Check if the visual ID is valid for this screen.
- */
- pVisual = pScreen->visuals;
- for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
- if (pVisual->vid == visId) {
- break;
- }
- }
- if (i == pScreen->numVisuals) {
- client->errorValue = visId;
- return BadValue;
- }
-
/*
- ** Check if color buffer depth of fbconfig matches depth
- ** of window.
- */
+ ** Check if the visual ID is valid for this screen.
+ */
+ pVisual = pScreen->visuals;
+ for (i = 0; i < pScreen->numVisuals; i++, pVisual++) {
+ if (pVisual->vid == visId) {
+ break;
+ }
+ }
+ if (i == pScreen->numVisuals) {
+ client->errorValue = visId;
+ return BadValue;
+ }
+
+ /*
+ ** Check if color buffer depth of fbconfig matches depth
+ ** of window.
+ */
if (pVisual->nplanes != pDraw->depth) {
- return BadMatch;
- }
- } else
- /*
- ** The window was created with no visual that corresponds
- ** to fbconfig
- */
- return BadMatch;
+ return BadMatch;
+ }
+ }
+ else
+ /*
+ ** The window was created with no visual that corresponds
+ ** to fbconfig
+ */
+ return BadMatch;
/*
- ** Check if there is already a fbconfig associated with this window
- */
+ ** Check if there is already a fbconfig associated with this window
+ */
if (Success == dixLookupResourceByType(&val,
- glxwindowId, __glXWindowRes,
- NullClient, DixUnknownAccess)) {
- client->errorValue = glxwindowId;
- return BadAlloc;
+ glxwindowId, __glXWindowRes,
+ NullClient, DixUnknownAccess)) {
+ client->errorValue = glxwindowId;
+ return BadAlloc;
}
pGlxWindow = (__glXWindow *) malloc(sizeof(__glXWindow));
if (!pGlxWindow) {
- return BadAlloc;
+ return BadAlloc;
}
/*
- ** Register this GLX window as a resource
- */
+ ** Register this GLX window as a resource
+ */
if (!(AddResource(glxwindowId, __glXWindowRes, pGlxWindow))) {
- return BadAlloc;
+ return BadAlloc;
}
pGlxWindow->pDraw = pDraw;
@@ -3034,7 +3152,8 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc)
return Success;
}
-int __glXDestroyWindow(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDestroyWindow(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
@@ -3042,24 +3161,25 @@ int __glXDestroyWindow(__GLXclientState *cl, GLbyte *pc)
pointer val;
/*
- ** Check if it's a valid GLX window.
- */
+ ** Check if it's a valid GLX window.
+ */
if (Success != dixLookupResourceByType(&val,
- glxwindow, __glXWindowRes,
- NullClient, DixUnknownAccess)) {
- client->errorValue = glxwindow;
- return __glXBadDrawable;
+ glxwindow, __glXWindowRes,
+ NullClient, DixUnknownAccess)) {
+ client->errorValue = glxwindow;
+ return __glXBadDrawable;
}
/*
- ** The glx window destructor will check whether it's current before
- ** freeing anything.
- */
- FreeResource(glxwindow, RT_NONE);
+ ** The glx window destructor will check whether it's current before
+ ** freeing anything.
+ */
+ FreeResource(glxwindow, RT_NONE);
return Success;
}
-int __glXQueryContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXQueryContext(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
__GLXcontext *ctx;
@@ -3069,8 +3189,8 @@ int __glXQueryContext(__GLXclientState *cl, GLbyte *pc)
int *sendBuf, *pSendBuf;
int nReplyBytes;
- req = (xGLXQueryContextReq *)pc;
- dixLookupResourceByType((pointer*) &ctx, req->context, __glXContextRes,
+ req = (xGLXQueryContextReq *) pc;
+ dixLookupResourceByType((pointer *) &ctx, req->context, __glXContextRes,
NullClient, DixUnknownAccess);
if (!ctx) {
client->errorValue = req->context;
@@ -3085,27 +3205,29 @@ int __glXQueryContext(__GLXclientState *cl, GLbyte *pc)
reply.n = nProps;
nReplyBytes = reply.length << 2;
- sendBuf = (int *)malloc(nReplyBytes);
+ sendBuf = (int *) malloc(nReplyBytes);
pSendBuf = sendBuf;
*pSendBuf++ = GLX_FBCONFIG_ID;
- *pSendBuf++ = (int)(ctx->pFBConfig->id);
+ *pSendBuf++ = (int) (ctx->pFBConfig->id);
*pSendBuf++ = GLX_RENDER_TYPE;
- *pSendBuf++ = (int)(ctx->pFBConfig->renderType);
+ *pSendBuf++ = (int) (ctx->pFBConfig->renderType);
*pSendBuf++ = GLX_SCREEN;
- *pSendBuf++ = (int)(ctx->pScreen->myNum);
+ *pSendBuf++ = (int) (ctx->pScreen->myNum);
if (client->swapped) {
__glXSwapQueryContextReply(client, &reply, sendBuf);
- } else {
- WriteToClient(client, sz_xGLXQueryContextReply, (char *)&reply);
- WriteToClient(client, nReplyBytes, (char *)sendBuf);
}
- free((char *)sendBuf);
+ else {
+ WriteToClient(client, sz_xGLXQueryContextReply, (char *) &reply);
+ WriteToClient(client, nReplyBytes, (char *) sendBuf);
+ }
+ free((char *) sendBuf);
return Success;
}
-int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
+int
+__glXQueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
__GLXcontext *ctx;
@@ -3115,10 +3237,10 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
int *sendBuf, *pSendBuf;
int nReplyBytes;
- req = (xGLXQueryContextInfoEXTReq *)pc;
- dixLookupResourceByType((pointer*) &ctx,
- req->context, __glXContextRes,
- client, DixReadAccess);
+ req = (xGLXQueryContextInfoEXTReq *) pc;
+ dixLookupResourceByType((pointer *) &ctx,
+ req->context, __glXContextRes,
+ client, DixReadAccess);
if (!ctx) {
client->errorValue = req->context;
@@ -3133,32 +3255,34 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc)
reply.n = nProps;
nReplyBytes = reply.length << 2;
- sendBuf = (int *)malloc(nReplyBytes);
+ sendBuf = (int *) malloc(nReplyBytes);
pSendBuf = sendBuf;
*pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
- *pSendBuf++ = (int)(ctx->share_id);
+ *pSendBuf++ = (int) (ctx->share_id);
*pSendBuf++ = GLX_VISUAL_ID_EXT;
- *pSendBuf++ = (int)(ctx->pVisual ? ctx->pVisual->vid : 0);
+ *pSendBuf++ = (int) (ctx->pVisual ? ctx->pVisual->vid : 0);
*pSendBuf++ = GLX_SCREEN_EXT;
- *pSendBuf++ = (int)(ctx->pScreen->myNum);
+ *pSendBuf++ = (int) (ctx->pScreen->myNum);
*pSendBuf++ = GLX_FBCONFIG_ID;
- *pSendBuf++ = (int)(ctx->pFBConfig ? ctx->pFBConfig->id : 0);
+ *pSendBuf++ = (int) (ctx->pFBConfig ? ctx->pFBConfig->id : 0);
if (client->swapped) {
__glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
- } else {
- WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)&reply);
- WriteToClient(client, nReplyBytes, (char *)sendBuf);
}
- free((char *)sendBuf);
+ else {
+ WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *) &reply);
+ WriteToClient(client, nReplyBytes, (char *) sendBuf);
+ }
+ free((char *) sendBuf);
return Success;
}
-int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
+int
+__glXCreatePbuffer(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
- xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *)pc;
+ xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;
xGLXCreatePbufferReq *be_req;
int screen = req->screen;
GLXFBConfigID fbconfigId = req->fbconfig;
@@ -3175,9 +3299,9 @@ int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
int s;
int from_screen, to_screen;
- /*
- ** Look up screen and FBConfig.
- */
+ /*
+ ** Look up screen and FBConfig.
+ */
if (screen >= screenInfo.numScreens) {
/* The client library must send a valid screen number. */
client->errorValue = screen;
@@ -3186,22 +3310,22 @@ int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
pScreen = screenInfo.screens[screen];
/*
- ** Find the FBConfigRec for this fbconfigid.
- */
+ ** Find the FBConfigRec for this fbconfigid.
+ */
if (!(pGlxFBConfig = glxLookupFBConfig(fbconfigId))) {
- client->errorValue = fbconfigId;
- return __glXBadFBConfig;
+ client->errorValue = fbconfigId;
+ return __glXBadFBConfig;
}
/*
- ** Create the GLX part of the Pbuffer.
- */
+ ** Create the GLX part of the Pbuffer.
+ */
pGlxPbuffer = (__glXPbuffer *) malloc(sizeof(__glXPbuffer));
if (!pGlxPbuffer) {
return BadAlloc;
}
- pGlxPbuffer->be_xids = (XID *) malloc( sizeof(XID) * screenInfo.numScreens );
+ pGlxPbuffer->be_xids = (XID *) malloc(sizeof(XID) * screenInfo.numScreens);
if (!pGlxPbuffer->be_xids) {
free(pGlxPbuffer);
return BadAlloc;
@@ -3213,53 +3337,53 @@ int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
from_screen = to_screen = screen;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
- for (s=from_screen; s<=to_screen; s++) {
- dpy = GetBackEndDisplay(cl,s);
- be_xid = XAllocID(dpy);
- dmxScreen = &dmxScreens[s];
- be_pGlxFBConfig = glxLookupBackEndFBConfig( pGlxFBConfig->id, s );
-
- attr = (int *)( req+1 );
-
- LockDisplay(dpy);
- GetReqExtra(GLXCreatePbuffer, 2 * numAttribs * __GLX_SIZE_CARD32, be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXCreatePbuffer;
- be_req->screen = be_pGlxFBConfig->screen;
- be_req->fbconfig = be_pGlxFBConfig->id;
- be_req->pbuffer = be_xid;
- be_req->numAttribs = numAttribs;
-
- /* Send attributes */
- if ( attr != NULL ) {
- CARD32 *pc = (CARD32 *)(be_req + 1);
-
- while (numAttribs-- > 0) {
- *pc++ = *attr++; /* token */
- *pc++ = *attr++; /* value */
- }
- }
+ for (s = from_screen; s <= to_screen; s++) {
+ dpy = GetBackEndDisplay(cl, s);
+ be_xid = XAllocID(dpy);
+ dmxScreen = &dmxScreens[s];
+ be_pGlxFBConfig = glxLookupBackEndFBConfig(pGlxFBConfig->id, s);
+
+ attr = (int *) (req + 1);
+
+ LockDisplay(dpy);
+ GetReqExtra(GLXCreatePbuffer, 2 * numAttribs * __GLX_SIZE_CARD32,
+ be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXCreatePbuffer;
+ be_req->screen = be_pGlxFBConfig->screen;
+ be_req->fbconfig = be_pGlxFBConfig->id;
+ be_req->pbuffer = be_xid;
+ be_req->numAttribs = numAttribs;
+
+ /* Send attributes */
+ if (attr != NULL) {
+ CARD32 *pc = (CARD32 *) (be_req + 1);
+
+ while (numAttribs-- > 0) {
+ *pc++ = *attr++; /* token */
+ *pc++ = *attr++; /* value */
+ }
+ }
- UnlockDisplay(dpy);
- SyncHandle();
+ UnlockDisplay(dpy);
+ SyncHandle();
- pGlxPbuffer->be_xids[s] = be_xid;
+ pGlxPbuffer->be_xids[s] = be_xid;
}
-
pGlxPbuffer->idExists = True;
pGlxPbuffer->refcnt = 0;
pGlxPbuffer->pFBConfig = pGlxFBConfig;
pGlxPbuffer->pScreen = pScreen;
/*
- ** Register the resource.
- */
+ ** Register the resource.
+ */
if (!(AddResource(pbuffer, __glXPbufferRes, pGlxPbuffer))) {
return BadAlloc;
}
@@ -3268,7 +3392,8 @@ int __glXCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
}
-int __glXDestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDestroyPbuffer(__GLXclientState * cl, GLbyte * pc)
{
ClientPtr client = cl->client;
xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
@@ -3282,13 +3407,13 @@ int __glXDestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
int from_screen, to_screen;
/*
- ** Check if it's a valid Pbuffer
- */
- dixLookupResourceByType((pointer*) &pGlxPbuffer, pbuffer,
+ ** Check if it's a valid Pbuffer
+ */
+ dixLookupResourceByType((pointer *) &pGlxPbuffer, pbuffer,
__glXPbufferRes, NullClient, DixUnknownAccess);
if (!pGlxPbuffer) {
- client->errorValue = pbuffer;
- return __glXBadPbuffer;
+ client->errorValue = pbuffer;
+ return __glXBadPbuffer;
}
screen = pGlxPbuffer->pScreen->myNum;
@@ -3296,327 +3421,342 @@ int __glXDestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
from_screen = to_screen = screen;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
- for (s=from_screen; s<=to_screen; s++) {
- dpy = GetBackEndDisplay(cl,s);
- dmxScreen = &dmxScreens[s];
+ for (s = from_screen; s <= to_screen; s++) {
+ dpy = GetBackEndDisplay(cl, s);
+ dmxScreen = &dmxScreens[s];
- /* send the destroy request to the back-end server */
- LockDisplay(dpy);
- GetReq(GLXDestroyPbuffer, be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXDestroyPbuffer;
- be_req->pbuffer = pGlxPbuffer->be_xids[s];
- UnlockDisplay(dpy);
- SyncHandle();
+ /* send the destroy request to the back-end server */
+ LockDisplay(dpy);
+ GetReq(GLXDestroyPbuffer, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXDestroyPbuffer;
+ be_req->pbuffer = pGlxPbuffer->be_xids[s];
+ UnlockDisplay(dpy);
+ SyncHandle();
}
- FreeResource(pbuffer, RT_NONE);
+ FreeResource(pbuffer, RT_NONE);
return Success;
}
-int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+int
+__glXGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
{
- xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
- xGLXGetDrawableAttributesReq *be_req;
- xGLXGetDrawableAttributesReply reply;
- ClientPtr client = cl->client;
- GLXDrawable drawId = req->drawable;
- GLXDrawable be_drawable = 0;
- DrawablePtr pDraw = NULL;
- Display *dpy;
- int screen, rc;
- DMXScreenInfo *dmxScreen;
- CARD32 *attribs = NULL;
- int attribs_size = 0;
+ xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *) pc;
+ xGLXGetDrawableAttributesReq *be_req;
+ xGLXGetDrawableAttributesReply reply;
+ ClientPtr client = cl->client;
+ GLXDrawable drawId = req->drawable;
+ GLXDrawable be_drawable = 0;
+ DrawablePtr pDraw = NULL;
+ Display *dpy;
+ int screen, rc;
+ DMXScreenInfo *dmxScreen;
+ CARD32 *attribs = NULL;
+ int attribs_size = 0;
+
#ifdef PANORAMIX
PanoramiXRes *pXinDraw = NULL;
#endif
- if (drawId != None) {
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
- if (rc == Success && pDraw->type == DRAWABLE_WINDOW) {
- WindowPtr pWin = (WindowPtr)pDraw;
- be_drawable = 0;
- screen = pWin->drawable.pScreen->myNum;
- } else {
- /*
- ** Drawable is not a Window , GLXWindow or a GLXPixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- if (!pDraw) {
- __GLXpixmap *pGlxPixmap;
- dixLookupResourceByType((pointer*) &pGlxPixmap,
- drawId, __glXPixmapRes,
- NullClient, DixUnknownAccess);
- if (pGlxPixmap) {
- pDraw = pGlxPixmap->pDraw;
- screen = pGlxPixmap->pScreen->myNum;
+ if (drawId != None) {
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess);
+ if (rc == Success && pDraw->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr) pDraw;
+
+ be_drawable = 0;
+ screen = pWin->drawable.pScreen->myNum;
+ }
+ else {
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ if (!pDraw) {
+ __GLXpixmap *pGlxPixmap;
+
+ dixLookupResourceByType((pointer *) &pGlxPixmap,
+ drawId, __glXPixmapRes,
+ NullClient, DixUnknownAccess);
+ if (pGlxPixmap) {
+ pDraw = pGlxPixmap->pDraw;
+ screen = pGlxPixmap->pScreen->myNum;
be_drawable = pGlxPixmap->be_xids[screen];
- }
- }
-
- if (!pDraw) {
- __glXWindow *pGlxWindow;
- dixLookupResourceByType((pointer*) &pGlxWindow,
- drawId, __glXWindowRes,
- NullClient, DixUnknownAccess);
- if (pGlxWindow) {
- pDraw = pGlxWindow->pDraw;
- screen = pGlxWindow->pScreen->myNum;
- be_drawable = 0;
- }
- }
-
- if (!pDraw) {
- __glXPbuffer *pGlxPbuffer;
- dixLookupResourceByType((pointer*) &pGlxPbuffer,
- drawId, __glXPbufferRes,
- NullClient, DixUnknownAccess);
- if (pGlxPbuffer) {
- pDraw = (DrawablePtr)pGlxPbuffer;
- screen = pGlxPbuffer->pScreen->myNum;
- be_drawable = pGlxPbuffer->be_xids[screen];
- }
- }
+ }
+ }
+
+ if (!pDraw) {
+ __glXWindow *pGlxWindow;
+
+ dixLookupResourceByType((pointer *) &pGlxWindow,
+ drawId, __glXWindowRes,
+ NullClient, DixUnknownAccess);
+ if (pGlxWindow) {
+ pDraw = pGlxWindow->pDraw;
+ screen = pGlxWindow->pScreen->myNum;
+ be_drawable = 0;
+ }
+ }
+
+ if (!pDraw) {
+ __glXPbuffer *pGlxPbuffer;
+
+ dixLookupResourceByType((pointer *) &pGlxPbuffer,
+ drawId, __glXPbufferRes,
+ NullClient, DixUnknownAccess);
+ if (pGlxPbuffer) {
+ pDraw = (DrawablePtr) pGlxPbuffer;
+ screen = pGlxPbuffer->pScreen->myNum;
+ be_drawable = pGlxPbuffer->be_xids[screen];
+ }
+ }
}
if (!pDraw) {
- /*
- ** Drawable is not a Window , GLXWindow or a GLXPixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- /* if the drawable is a window or GLXWindow -
- * we need to find the base id on the back-end server
- */
- if (!be_drawable) {
- WindowPtr pWin = (WindowPtr)pDraw;
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ /* if the drawable is a window or GLXWindow -
+ * we need to find the base id on the back-end server
+ */
+ if (!be_drawable) {
+ WindowPtr pWin = (WindowPtr) pDraw;
#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- if (Success != dixLookupResourceByClass((pointer*) &pXinDraw,
- pDraw->id, XRC_DRAWABLE,
- client, DixReadAccess)) {
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- dixLookupWindow(&pWin, pXinDraw->info[screen].id, client,
- DixReadAccess);
- }
+ if (!noPanoramiXExtension) {
+ if (Success != dixLookupResourceByClass((pointer *) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess)) {
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ dixLookupWindow(&pWin, pXinDraw->info[screen].id, client,
+ DixReadAccess);
+ }
#endif
- if (pWin) {
- be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- if (!be_drawable) {
- /* it might be that the window did not created yet on the */
- /* back-end server (lazy window creation option), force */
- /* creation of the window */
- dmxCreateAndRealizeWindow( pWin, TRUE );
- be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- }
- }
- else {
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
-
-
- /* send the request to the back-end server */
- dpy = GetBackEndDisplay(cl,screen);
- dmxScreen = &dmxScreens[screen];
-
- /* make sure drawable exists on back-end */
- dmxSync( dmxScreen, 1 );
-
- LockDisplay(dpy);
- GetReq(GLXGetDrawableAttributes, be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXGetDrawableAttributes;
- be_req->drawable = be_drawable;
- be_req->length = req->length;
- if (!_XReply(dpy, (xReply *) &reply, 0, False)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return( BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code) );
- }
-
- if (reply.numAttribs) {
- attribs_size = 2 * reply.numAttribs * __GLX_SIZE_CARD32;
- attribs = (CARD32 *) malloc(attribs_size);
- if (attribs == NULL) {
- UnlockDisplay(dpy);
- SyncHandle();
- return BadAlloc;
- }
-
- _XRead(dpy, (char *) attribs, attribs_size);
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
-
- /* send the reply back to the client */
- reply.sequenceNumber = client->sequence;
- if (client->swapped) {
- __glXSwapGetDrawableAttributesReply(client, &reply, (int *)attribs);
- }
- else {
- WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *)&reply);
- WriteToClient(client, attribs_size, (char *)attribs);
- }
-
- free(attribs);
-
- return Success;
+ if (pWin) {
+ be_drawable = (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window;
+ if (!be_drawable) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow(pWin, TRUE);
+ be_drawable =
+ (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window;
+ }
+ }
+ else {
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+ /* send the request to the back-end server */
+ dpy = GetBackEndDisplay(cl, screen);
+ dmxScreen = &dmxScreens[screen];
+
+ /* make sure drawable exists on back-end */
+ dmxSync(dmxScreen, 1);
+
+ LockDisplay(dpy);
+ GetReq(GLXGetDrawableAttributes, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXGetDrawableAttributes;
+ be_req->drawable = be_drawable;
+ be_req->length = req->length;
+ if (!_XReply(dpy, (xReply *) & reply, 0, False)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return (BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code));
+ }
+
+ if (reply.numAttribs) {
+ attribs_size = 2 * reply.numAttribs * __GLX_SIZE_CARD32;
+ attribs = (CARD32 *) malloc(attribs_size);
+ if (attribs == NULL) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return BadAlloc;
+ }
+
+ _XRead(dpy, (char *) attribs, attribs_size);
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ /* send the reply back to the client */
+ reply.sequenceNumber = client->sequence;
+ if (client->swapped) {
+ __glXSwapGetDrawableAttributesReply(client, &reply, (int *) attribs);
+ }
+ else {
+ WriteToClient(client, sz_xGLXGetDrawableAttributesReply,
+ (char *) &reply);
+ WriteToClient(client, attribs_size, (char *) attribs);
+ }
+
+ free(attribs);
+
+ return Success;
}
-int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+int
+__glXChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
{
- xGLXChangeDrawableAttributesReq *req = (xGLXChangeDrawableAttributesReq *)pc;
- xGLXChangeDrawableAttributesReq *be_req;
- ClientPtr client = cl->client;
- GLXDrawable drawId = req->drawable;
- GLXDrawable be_drawable = 0;
- DrawablePtr pDraw = NULL;
- Display *dpy;
- int screen, rc;
- DMXScreenInfo *dmxScreen;
-
- if (drawId != None) {
- rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixSetAttrAccess);
- if (rc == Success && pDraw->type == DRAWABLE_WINDOW) {
- be_drawable = 0;
- screen = pDraw->pScreen->myNum;
- } else {
- /*
- ** Drawable is not a Window , GLXWindow or a GLXPixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- if (!pDraw) {
- __GLXpixmap *pGlxPixmap;
- dixLookupResourceByType((pointer*) &pGlxPixmap,
- drawId, __glXPixmapRes,
- NullClient, DixUnknownAccess);
- if (pGlxPixmap) {
- pDraw = pGlxPixmap->pDraw;
- screen = pGlxPixmap->pScreen->myNum;
+ xGLXChangeDrawableAttributesReq *req =
+ (xGLXChangeDrawableAttributesReq *) pc;
+ xGLXChangeDrawableAttributesReq *be_req;
+ ClientPtr client = cl->client;
+ GLXDrawable drawId = req->drawable;
+ GLXDrawable be_drawable = 0;
+ DrawablePtr pDraw = NULL;
+ Display *dpy;
+ int screen, rc;
+ DMXScreenInfo *dmxScreen;
+
+ if (drawId != None) {
+ rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixSetAttrAccess);
+ if (rc == Success && pDraw->type == DRAWABLE_WINDOW) {
+ be_drawable = 0;
+ screen = pDraw->pScreen->myNum;
+ }
+ else {
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ if (!pDraw) {
+ __GLXpixmap *pGlxPixmap;
+
+ dixLookupResourceByType((pointer *) &pGlxPixmap,
+ drawId, __glXPixmapRes,
+ NullClient, DixUnknownAccess);
+ if (pGlxPixmap) {
+ pDraw = pGlxPixmap->pDraw;
+ screen = pGlxPixmap->pScreen->myNum;
be_drawable = pGlxPixmap->be_xids[screen];
- }
- }
-
- if (!pDraw) {
- __glXWindow *pGlxWindow;
- dixLookupResourceByType((pointer*) &pGlxWindow,
- drawId, __glXWindowRes,
- NullClient, DixUnknownAccess);
- if (pGlxWindow) {
- pDraw = pGlxWindow->pDraw;
- screen = pGlxWindow->pScreen->myNum;
- be_drawable = 0;
- }
- }
-
- if (!pDraw) {
- __glXPbuffer *pGlxPbuffer;
- dixLookupResourceByType((pointer*) &pGlxPbuffer,
- drawId, __glXPbufferRes,
- NullClient, DixUnknownAccess);
- if (pGlxPbuffer) {
- pDraw = (DrawablePtr)pGlxPbuffer;
- screen = pGlxPbuffer->pScreen->myNum;
- be_drawable = pGlxPbuffer->be_xids[screen];
- }
- }
- }
-
- if (!pDraw) {
- /*
- ** Drawable is not a Window , GLXWindow or a GLXPixmap.
- */
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- /* if the drawable is a window or GLXWindow -
- * we need to find the base id on the back-end server
- */
- if (!be_drawable) {
- WindowPtr pWin = (WindowPtr)pDraw;
+ }
+ }
+
+ if (!pDraw) {
+ __glXWindow *pGlxWindow;
+
+ dixLookupResourceByType((pointer *) &pGlxWindow,
+ drawId, __glXWindowRes,
+ NullClient, DixUnknownAccess);
+ if (pGlxWindow) {
+ pDraw = pGlxWindow->pDraw;
+ screen = pGlxWindow->pScreen->myNum;
+ be_drawable = 0;
+ }
+ }
+
+ if (!pDraw) {
+ __glXPbuffer *pGlxPbuffer;
+
+ dixLookupResourceByType((pointer *) &pGlxPbuffer,
+ drawId, __glXPbufferRes,
+ NullClient, DixUnknownAccess);
+ if (pGlxPbuffer) {
+ pDraw = (DrawablePtr) pGlxPbuffer;
+ screen = pGlxPbuffer->pScreen->myNum;
+ be_drawable = pGlxPbuffer->be_xids[screen];
+ }
+ }
+ }
+
+ if (!pDraw) {
+ /*
+ ** Drawable is not a Window , GLXWindow or a GLXPixmap.
+ */
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ /* if the drawable is a window or GLXWindow -
+ * we need to find the base id on the back-end server
+ */
+ if (!be_drawable) {
+ WindowPtr pWin = (WindowPtr) pDraw;
#ifdef PANORAMIX
- if (!noPanoramiXExtension) {
- PanoramiXRes *pXinDraw;
- if (Success != dixLookupResourceByClass((pointer*) &pXinDraw,
- pDraw->id, XRC_DRAWABLE,
- client, DixReadAccess)) {
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
-
- dixLookupWindow(&pWin, pXinDraw->info[screen].id, client,
- DixReadAccess);
- }
+ if (!noPanoramiXExtension) {
+ PanoramiXRes *pXinDraw;
+
+ if (Success != dixLookupResourceByClass((pointer *) &pXinDraw,
+ pDraw->id, XRC_DRAWABLE,
+ client, DixReadAccess)) {
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+
+ dixLookupWindow(&pWin, pXinDraw->info[screen].id, client,
+ DixReadAccess);
+ }
#endif
- if (pWin) {
- be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- if (!be_drawable) {
- /* it might be that the window did not created yet on the */
- /* back-end server (lazy window creation option), force */
- /* creation of the window */
- dmxCreateAndRealizeWindow( pWin, TRUE );
- be_drawable = (unsigned int)(DMX_GET_WINDOW_PRIV(pWin))->window;
- }
- }
- else {
- client->errorValue = drawId;
- return __glXBadDrawable;
- }
- }
-
-
- /* send the request to the back-end server */
- dpy = GetBackEndDisplay(cl,screen);
- dmxScreen = &dmxScreens[screen];
-
- /* make sure drawable exists on back-end */
- dmxSync( dmxScreen, 1 );
-
- LockDisplay(dpy);
- GetReqExtra(GLXChangeDrawableAttributes,
- 2 * req->numAttribs * __GLX_SIZE_CARD32, be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLXChangeDrawableAttributes;
- be_req->drawable = be_drawable;
- be_req->numAttribs = req->numAttribs;
- be_req->length = req->length;
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return Success;
+ if (pWin) {
+ be_drawable = (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window;
+ if (!be_drawable) {
+ /* it might be that the window did not created yet on the */
+ /* back-end server (lazy window creation option), force */
+ /* creation of the window */
+ dmxCreateAndRealizeWindow(pWin, TRUE);
+ be_drawable =
+ (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window;
+ }
+ }
+ else {
+ client->errorValue = drawId;
+ return __glXBadDrawable;
+ }
+ }
+
+ /* send the request to the back-end server */
+ dpy = GetBackEndDisplay(cl, screen);
+ dmxScreen = &dmxScreens[screen];
+
+ /* make sure drawable exists on back-end */
+ dmxSync(dmxScreen, 1);
+
+ LockDisplay(dpy);
+ GetReqExtra(GLXChangeDrawableAttributes,
+ 2 * req->numAttribs * __GLX_SIZE_CARD32, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLXChangeDrawableAttributes;
+ be_req->drawable = be_drawable;
+ be_req->numAttribs = req->numAttribs;
+ be_req->length = req->length;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return Success;
}
-int __glXSendLargeCommand(__GLXclientState *cl, GLXContextTag contextTag)
+int
+__glXSendLargeCommand(__GLXclientState * cl, GLXContextTag contextTag)
{
- ClientPtr client = cl->client;
+ ClientPtr client = cl->client;
xGLXRenderLargeReq *req;
GLint maxSize, amount;
GLint totalRequests, requestNumber;
@@ -3626,56 +3766,57 @@ int __glXSendLargeCommand(__GLXclientState *cl, GLXContextTag contextTag)
int s;
int from_screen, to_screen;
- maxSize = cl->largeCmdMaxReqDataSize - (GLint)sizeof(xGLXRenderLargeReq);
+ maxSize = cl->largeCmdMaxReqDataSize - (GLint) sizeof(xGLXRenderLargeReq);
dataLen = cl->largeCmdBytesTotal;
totalRequests = (dataLen / maxSize);
- if (dataLen % maxSize) totalRequests++;
+ if (dataLen % maxSize)
+ totalRequests++;
glxc = __glXLookupContextByTag(cl, contextTag);
if (!glxc) {
- client->errorValue = contextTag;
- return __glXBadContext;
+ client->errorValue = contextTag;
+ return __glXBadContext;
}
from_screen = to_screen = glxc->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
/*
- ** Send enough requests until the whole array is sent.
- */
+ ** Send enough requests until the whole array is sent.
+ */
requestNumber = 1;
data = cl->largeCmdBuf;
while (dataLen > 0) {
- amount = dataLen;
- if (amount > maxSize) {
- amount = maxSize;
- }
-
- for (s=from_screen; s<=to_screen; s++) {
-
- Display *dpy = GetBackEndDisplay(cl,s);
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
-
- LockDisplay(dpy);
- GetReq(GLXRenderLarge,req);
- req->reqType = dmxScreen->glxMajorOpcode;
- req->glxCode = X_GLXRenderLarge;
- req->contextTag = GetCurrentBackEndTag(cl,contextTag,s);
- req->length += (amount + 3) >> 2;
- req->requestNumber = requestNumber++;
- req->requestTotal = totalRequests;
- req->dataBytes = amount;
- Data(dpy, ((const char*)data), amount);
- dataLen -= amount;
- data = ((GLbyte *) data) + amount;
- UnlockDisplay(dpy);
- SyncHandle();
- }
+ amount = dataLen;
+ if (amount > maxSize) {
+ amount = maxSize;
+ }
+
+ for (s = from_screen; s <= to_screen; s++) {
+
+ Display *dpy = GetBackEndDisplay(cl, s);
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+
+ LockDisplay(dpy);
+ GetReq(GLXRenderLarge, req);
+ req->reqType = dmxScreen->glxMajorOpcode;
+ req->glxCode = X_GLXRenderLarge;
+ req->contextTag = GetCurrentBackEndTag(cl, contextTag, s);
+ req->length += (amount + 3) >> 2;
+ req->requestNumber = requestNumber++;
+ req->requestTotal = totalRequests;
+ req->dataBytes = amount;
+ Data(dpy, ((const char *) data), amount);
+ dataLen -= amount;
+ data = ((GLbyte *) data) + amount;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
}
return Success;
diff --git a/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c b/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c
index f28a79df6..ec0e83d09 100644
--- a/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c
+++ b/xorg-server/hw/dmx/glxProxy/glxcmdsswap.c
@@ -39,9 +39,9 @@
#include "glxext.h"
#include "glxvendor.h"
-extern int glxIsExtensionSupported( char *ext );
+extern int glxIsExtensionSupported(char *ext);
-int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc);
+int __glXSwapGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc);
/************************************************************************/
@@ -52,9 +52,11 @@ int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc);
** it is called at the end of the unswapped routine.
*/
-int __glXSwapCreateContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapCreateContext(__GLXclientState * cl, GLbyte * pc)
{
xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -66,9 +68,11 @@ int __glXSwapCreateContext(__GLXclientState *cl, GLbyte *pc)
return __glXCreateContext(cl, pc);
}
-int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapCreateNewContext(__GLXclientState * cl, GLbyte * pc)
{
xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -80,9 +84,11 @@ int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc)
return __glXCreateNewContext(cl, pc);
}
-int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapCreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc)
{
- xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc;
+ xGLXCreateContextWithConfigSGIXReq *req =
+ (xGLXCreateContextWithConfigSGIXReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -94,10 +100,11 @@ int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc)
return __glXCreateContextWithConfigSGIX(cl, pc);
}
-int __glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState * cl, GLbyte * pc)
{
xGLXQueryMaxSwapBarriersSGIXReq *req =
- (xGLXQueryMaxSwapBarriersSGIXReq *)pc;
+ (xGLXQueryMaxSwapBarriersSGIXReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -106,9 +113,11 @@ int __glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc)
return __glXQueryMaxSwapBarriersSGIX(cl, pc);
}
-int __glXSwapBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapBindSwapBarrierSGIX(__GLXclientState * cl, GLbyte * pc)
{
- xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *)pc;
+ xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -118,9 +127,11 @@ int __glXSwapBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc)
return __glXBindSwapBarrierSGIX(cl, pc);
}
-int __glXSwapJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapJoinSwapGroupSGIX(__GLXclientState * cl, GLbyte * pc)
{
- xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *)pc;
+ xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -130,9 +141,11 @@ int __glXSwapJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc)
return __glXJoinSwapGroupSGIX(cl, pc);
}
-int __glXSwapDestroyContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapDestroyContext(__GLXclientState * cl, GLbyte * pc)
{
xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -141,9 +154,11 @@ int __glXSwapDestroyContext(__GLXclientState *cl, GLbyte *pc)
return __glXDestroyContext(cl, pc);
}
-int __glXSwapMakeCurrent(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapMakeCurrent(__GLXclientState * cl, GLbyte * pc)
{
xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -154,9 +169,11 @@ int __glXSwapMakeCurrent(__GLXclientState *cl, GLbyte *pc)
return __glXMakeCurrent(cl, pc);
}
-int __glXSwapMakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapMakeContextCurrent(__GLXclientState * cl, GLbyte * pc)
{
xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -168,9 +185,11 @@ int __glXSwapMakeContextCurrent(__GLXclientState *cl, GLbyte *pc)
return __glXMakeContextCurrent(cl, pc);
}
-int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapMakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc)
{
xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -182,9 +201,11 @@ int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc)
return __glXMakeCurrentReadSGI(cl, pc);
}
-int __glXSwapIsDirect(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapIsDirect(__GLXclientState * cl, GLbyte * pc)
{
xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -193,9 +214,11 @@ int __glXSwapIsDirect(__GLXclientState *cl, GLbyte *pc)
return __glXIsDirect(cl, pc);
}
-int __glXSwapQueryVersion(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapQueryVersion(__GLXclientState * cl, GLbyte * pc)
{
xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -205,9 +228,11 @@ int __glXSwapQueryVersion(__GLXclientState *cl, GLbyte *pc)
return __glXQueryVersion(cl, pc);
}
-int __glXSwapWaitGL(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapWaitGL(__GLXclientState * cl, GLbyte * pc)
{
xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -216,9 +241,11 @@ int __glXSwapWaitGL(__GLXclientState *cl, GLbyte *pc)
return __glXWaitGL(cl, pc);
}
-int __glXSwapWaitX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapWaitX(__GLXclientState * cl, GLbyte * pc)
{
xGLXWaitXReq *req = (xGLXWaitXReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -227,9 +254,11 @@ int __glXSwapWaitX(__GLXclientState *cl, GLbyte *pc)
return __glXWaitX(cl, pc);
}
-int __glXSwapCopyContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapCopyContext(__GLXclientState * cl, GLbyte * pc)
{
xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -240,9 +269,10 @@ int __glXSwapCopyContext(__GLXclientState *cl, GLbyte *pc)
return __glXCopyContext(cl, pc);
}
-int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapGetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
+ ClientPtr client = cl->client;
xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc;
xGLXGetVisualConfigsReply reply;
__GLXscreenInfo *pGlxScreen;
@@ -250,62 +280,63 @@ int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
CARD32 buf[__GLX_TOTAL_CONFIG];
unsigned int screen;
int i, p;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
__GLX_SWAP_INT(&req->screen);
screen = req->screen;
if (screen >= screenInfo.numScreens) {
- /* The client library must send a valid screen number. */
- client->errorValue = screen;
- return BadValue;
+ /* The client library must send a valid screen number. */
+ client->errorValue = screen;
+ return BadValue;
}
pGlxScreen = &__glXActiveScreens[screen];
reply.numVisuals = pGlxScreen->numGLXVisuals;
reply.numProps = __GLX_TOTAL_CONFIG;
reply.length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 *
- __GLX_TOTAL_CONFIG) >> 2;
+ __GLX_TOTAL_CONFIG) >> 2;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
-
+
__GLX_SWAP_SHORT(&reply.sequenceNumber);
__GLX_SWAP_INT(&reply.length);
__GLX_SWAP_INT(&reply.numVisuals);
__GLX_SWAP_INT(&reply.numProps);
- WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply);
-
- for (i=0; i < pGlxScreen->numVisuals; i++) {
- pGlxVisual = &pGlxScreen->pGlxVisual[i];
- if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) {
- /* not a usable visual */
- continue;
- }
- p = 0;
- buf[p++] = pGlxVisual->vid;
- buf[p++] = pGlxVisual->class;
- buf[p++] = pGlxVisual->rgba;
-
- buf[p++] = pGlxVisual->redSize;
- buf[p++] = pGlxVisual->greenSize;
- buf[p++] = pGlxVisual->blueSize;
- buf[p++] = pGlxVisual->alphaSize;
- buf[p++] = pGlxVisual->accumRedSize;
- buf[p++] = pGlxVisual->accumGreenSize;
- buf[p++] = pGlxVisual->accumBlueSize;
- buf[p++] = pGlxVisual->accumAlphaSize;
-
- buf[p++] = pGlxVisual->doubleBuffer;
- buf[p++] = pGlxVisual->stereo;
-
- buf[p++] = pGlxVisual->bufferSize;
- buf[p++] = pGlxVisual->depthSize;
- buf[p++] = pGlxVisual->stencilSize;
- buf[p++] = pGlxVisual->auxBuffers;
- buf[p++] = pGlxVisual->level;
+ WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *) &reply);
+
+ for (i = 0; i < pGlxScreen->numVisuals; i++) {
+ pGlxVisual = &pGlxScreen->pGlxVisual[i];
+ if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) {
+ /* not a usable visual */
+ continue;
+ }
+ p = 0;
+ buf[p++] = pGlxVisual->vid;
+ buf[p++] = pGlxVisual->class;
+ buf[p++] = pGlxVisual->rgba;
+
+ buf[p++] = pGlxVisual->redSize;
+ buf[p++] = pGlxVisual->greenSize;
+ buf[p++] = pGlxVisual->blueSize;
+ buf[p++] = pGlxVisual->alphaSize;
+ buf[p++] = pGlxVisual->accumRedSize;
+ buf[p++] = pGlxVisual->accumGreenSize;
+ buf[p++] = pGlxVisual->accumBlueSize;
+ buf[p++] = pGlxVisual->accumAlphaSize;
+
+ buf[p++] = pGlxVisual->doubleBuffer;
+ buf[p++] = pGlxVisual->stereo;
+
+ buf[p++] = pGlxVisual->bufferSize;
+ buf[p++] = pGlxVisual->depthSize;
+ buf[p++] = pGlxVisual->stencilSize;
+ buf[p++] = pGlxVisual->auxBuffers;
+ buf[p++] = pGlxVisual->level;
/*
- ** Add token/value pairs for extensions.
- */
+ ** Add token/value pairs for extensions.
+ */
buf[p++] = GLX_VISUAL_CAVEAT_EXT;
buf[p++] = pGlxVisual->visualRating;
buf[p++] = GLX_TRANSPARENT_TYPE_EXT;
@@ -321,16 +352,18 @@ int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT;
buf[p++] = pGlxVisual->transparentIndex;
- __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG);
- WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
- (char *)buf);
+ __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG);
+ WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG,
+ (char *) buf);
}
return Success;
}
-int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapCreateGLXPixmap(__GLXclientState * cl, GLbyte * pc)
{
xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -342,9 +375,11 @@ int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc)
return __glXCreateGLXPixmap(cl, pc);
}
-int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapCreatePixmap(__GLXclientState * cl, GLbyte * pc)
{
xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -357,9 +392,11 @@ int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc)
return __glXCreatePixmap(cl, pc);
}
-int __glXSwapDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapDestroyGLXPixmap(__GLXclientState * cl, GLbyte * pc)
{
xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -368,9 +405,11 @@ int __glXSwapDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc)
return __glXDestroyGLXPixmap(cl, pc);
}
-int __glXSwapSwapBuffers(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapSwapBuffers(__GLXclientState * cl, GLbyte * pc)
{
xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -380,9 +419,11 @@ int __glXSwapSwapBuffers(__GLXclientState *cl, GLbyte *pc)
return __glXSwapBuffers(cl, pc);
}
-int __glXSwapUseXFont(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapUseXFont(__GLXclientState * cl, GLbyte * pc)
{
xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -395,10 +436,11 @@ int __glXSwapUseXFont(__GLXclientState *cl, GLbyte *pc)
return __glXUseXFont(cl, pc);
}
-
-int __glXSwapQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapQueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
{
xGLXQueryExtensionsStringReq *req = NULL;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -407,9 +449,11 @@ int __glXSwapQueryExtensionsString(__GLXclientState *cl, GLbyte *pc)
return __glXQueryExtensionsString(cl, pc);
}
-int __glXSwapQueryServerString(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapQueryServerString(__GLXclientState * cl, GLbyte * pc)
{
- xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *)pc;
+ xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -419,9 +463,11 @@ int __glXSwapQueryServerString(__GLXclientState *cl, GLbyte *pc)
return __glXQueryServerString(cl, pc);
}
-int __glXSwapClientInfo(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapClientInfo(__GLXclientState * cl, GLbyte * pc)
{
- xGLXClientInfoReq *req = (xGLXClientInfoReq *)pc;
+ xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -432,15 +478,17 @@ int __glXSwapClientInfo(__GLXclientState *cl, GLbyte *pc)
return __glXClientInfo(cl, pc);
}
-int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc)
+int
+__glXSwapQueryContextInfoEXT(__GLXclientState * cl, char *pc)
{
xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->context);
- return __glXQueryContextInfoEXT(cl, (GLbyte *)pc);
+ return __glXQueryContextInfoEXT(cl, (GLbyte *) pc);
}
/************************************************************************/
@@ -449,7 +497,8 @@ int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc)
** Swap replies.
*/
-void __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReadSGIReply *reply)
+void
+__glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReadSGIReply * reply)
{
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&reply->sequenceNumber);
@@ -459,103 +508,120 @@ void __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReadSGIReply *r
__GLX_SWAP_INT(&reply->writeType);
__GLX_SWAP_INT(&reply->readVid);
__GLX_SWAP_INT(&reply->readType);
- WriteToClient(client, sz_xGLXMakeCurrentReadSGIReply, (char *)reply);
+ WriteToClient(client, sz_xGLXMakeCurrentReadSGIReply, (char *) reply);
}
-void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply *reply)
+void
+__glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply)
{
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&reply->sequenceNumber);
__GLX_SWAP_INT(&reply->length);
- WriteToClient(client, sz_xGLXIsDirectReply, (char *)reply);
+ WriteToClient(client, sz_xGLXIsDirectReply, (char *) reply);
}
-void __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply *reply)
+void
+__glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply * reply)
{
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&reply->sequenceNumber);
__GLX_SWAP_INT(&reply->length);
__GLX_SWAP_INT(&reply->majorVersion);
__GLX_SWAP_INT(&reply->minorVersion);
- WriteToClient(client, sz_xGLXQueryVersionReply, (char *)reply);
+ WriteToClient(client, sz_xGLXQueryVersionReply, (char *) reply);
}
-void glxSwapQueryExtensionsStringReply(ClientPtr client,
- xGLXQueryExtensionsStringReply *reply, char *buf)
+void
+glxSwapQueryExtensionsStringReply(ClientPtr client,
+ xGLXQueryExtensionsStringReply * reply,
+ char *buf)
{
int length = reply->length;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
__GLX_SWAP_SHORT(&reply->sequenceNumber);
__GLX_SWAP_INT(&reply->length);
__GLX_SWAP_INT(&reply->n);
- WriteToClient(client, sz_xGLXQueryExtensionsStringReply, (char *)reply);
- __GLX_SWAP_INT_ARRAY((int *)buf, length);
+ WriteToClient(client, sz_xGLXQueryExtensionsStringReply, (char *) reply);
+ __GLX_SWAP_INT_ARRAY((int *) buf, length);
WriteToClient(client, length << 2, buf);
}
-void glxSwapQueryServerStringReply(ClientPtr client,
- xGLXQueryServerStringReply *reply, char *buf)
+void
+glxSwapQueryServerStringReply(ClientPtr client,
+ xGLXQueryServerStringReply * reply, char *buf)
{
int length = reply->length;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&reply->sequenceNumber);
__GLX_SWAP_INT(&reply->length);
__GLX_SWAP_INT(&reply->n);
- WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)reply);
+ WriteToClient(client, sz_xGLXQueryServerStringReply, (char *) reply);
/** no swap is needed for an array of chars **/
/* __GLX_SWAP_INT_ARRAY((int *)buf, length); */
WriteToClient(client, length << 2, buf);
}
-void __glXSwapQueryContextInfoEXTReply(ClientPtr client, xGLXQueryContextInfoEXTReply *reply, int *buf)
+void
+__glXSwapQueryContextInfoEXTReply(ClientPtr client,
+ xGLXQueryContextInfoEXTReply * reply,
+ int *buf)
{
int length = reply->length;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
__GLX_SWAP_SHORT(&reply->sequenceNumber);
__GLX_SWAP_INT(&reply->length);
__GLX_SWAP_INT(&reply->n);
- WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)reply);
- __GLX_SWAP_INT_ARRAY((int *)buf, length);
- WriteToClient(client, length << 2, (char *)buf);
+ WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *) reply);
+ __GLX_SWAP_INT_ARRAY((int *) buf, length);
+ WriteToClient(client, length << 2, (char *) buf);
}
-
-void __glXSwapQueryContextReply(ClientPtr client,
- xGLXQueryContextReply *reply, int *buf)
+void
+__glXSwapQueryContextReply(ClientPtr client,
+ xGLXQueryContextReply * reply, int *buf)
{
int length = reply->length;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
__GLX_SWAP_SHORT(&reply->sequenceNumber);
__GLX_SWAP_INT(&reply->length);
__GLX_SWAP_INT(&reply->n);
- WriteToClient(client, sz_xGLXQueryContextReply, (char *)reply);
- __GLX_SWAP_INT_ARRAY((int *)buf, length);
- WriteToClient(client, length << 2, (char *)buf);
+ WriteToClient(client, sz_xGLXQueryContextReply, (char *) reply);
+ __GLX_SWAP_INT_ARRAY((int *) buf, length);
+ WriteToClient(client, length << 2, (char *) buf);
}
-void __glXSwapGetDrawableAttributesReply(ClientPtr client,
- xGLXGetDrawableAttributesReply *reply, int *buf)
+void
+__glXSwapGetDrawableAttributesReply(ClientPtr client,
+ xGLXGetDrawableAttributesReply * reply,
+ int *buf)
{
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
__GLX_SWAP_SHORT(&reply->sequenceNumber);
__GLX_SWAP_INT(&reply->length);
__GLX_SWAP_INT(&reply->numAttribs);
- __GLX_SWAP_INT_ARRAY( buf, reply->length );
- WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *)reply);
- WriteToClient(client, reply->length << 2, (char *)buf);
+ __GLX_SWAP_INT_ARRAY(buf, reply->length);
+ WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *) reply);
+ WriteToClient(client, reply->length << 2, (char *) buf);
}
-void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client, xGLXQueryMaxSwapBarriersSGIXReply *reply)
+void
+__glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client,
+ xGLXQueryMaxSwapBarriersSGIXReply *
+ reply)
{
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&reply->sequenceNumber);
__GLX_SWAP_INT(&reply->length);
__GLX_SWAP_INT(&reply->max);
- WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, (char *)reply);
+ WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, (char *) reply);
}
/************************************************************************/
@@ -565,21 +631,23 @@ void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client, xGLXQueryMaxSwapBa
** client library to send batches of GL rendering commands.
*/
-int __glXSwapRender(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapRender(__GLXclientState * cl, GLbyte * pc)
{
xGLXRenderReq *req;
int left;
__GLXrenderHeader *hdr;
ClientPtr client = cl->client;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
/*
- ** NOTE: much of this code also appears in the nonswapping version of this
- ** routine, __glXRender(). Any changes made here should also be
- ** duplicated there.
- */
-
+ ** NOTE: much of this code also appears in the nonswapping version of this
+ ** routine, __glXRender(). Any changes made here should also be
+ ** duplicated there.
+ */
+
req = (xGLXRenderReq *) pc;
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->contextTag);
@@ -587,74 +655,81 @@ int __glXSwapRender(__GLXclientState *cl, GLbyte *pc)
pc += sz_xGLXRenderReq;
left = (req->length << 2) - sz_xGLXRenderReq;
while (left > 0) {
- void (* proc)(GLbyte *);
- CARD16 opcode;
-
- /*
- ** Verify that the header length and the overall length agree.
- ** Also, each command must be word aligned.
- */
- hdr = (__GLXrenderHeader *) pc;
- __GLX_SWAP_SHORT(&hdr->length);
- __GLX_SWAP_SHORT(&hdr->opcode);
-
- /*
+ void (*proc) (GLbyte *);
+ CARD16 opcode;
+
+ /*
+ ** Verify that the header length and the overall length agree.
+ ** Also, each command must be word aligned.
+ */
+ hdr = (__GLXrenderHeader *) pc;
+ __GLX_SWAP_SHORT(&hdr->length);
+ __GLX_SWAP_SHORT(&hdr->opcode);
+
+ /*
* call the command procedure to swap any arguments
- */
- opcode = hdr->opcode;
- if ( (opcode >= __GLX_MIN_RENDER_OPCODE) &&
- (opcode <= __GLX_MAX_RENDER_OPCODE) ) {
- proc = __glXSwapRenderTable[opcode];
+ */
+ opcode = hdr->opcode;
+ if ((opcode >= __GLX_MIN_RENDER_OPCODE) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE)) {
+ proc = __glXSwapRenderTable[opcode];
#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
- } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
- (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) {
- int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
- __GLXRenderSwapInfo *info = &__glXSwapRenderTable_EXT[index];
- if (info->swapfunc) {
- proc = info->swapfunc;
- }
- else {
- proc = NULL;
- if (info->elem_size == 4 && info->nelems > 0) {
- __GLX_SWAP_INT_ARRAY( (int *)(pc + __GLX_RENDER_HDR_SIZE),
- info->nelems );
- }
- else if (info->elem_size == 2 && info->nelems > 0) {
- __GLX_SWAP_SHORT_ARRAY( (short *)(pc + __GLX_RENDER_HDR_SIZE),
- info->nelems );
- }
- else if (info->elem_size == 8 && info->nelems > 0) {
- __GLX_SWAP_DOUBLE_ARRAY( (double *)(pc + __GLX_RENDER_HDR_SIZE),
- info->nelems );
- }
- }
-#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
- } else {
- client->errorValue = 0;
- return __glXBadRenderRequest;
- }
-
- if (proc != NULL)
- (*proc)(pc + __GLX_RENDER_HDR_SIZE);
-
- /*
- * proceed to the next command
- */
- pc += hdr->length;
- left -= hdr->length;
+ }
+ else if ((opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE_EXT)) {
+ int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
+ __GLXRenderSwapInfo *info = &__glXSwapRenderTable_EXT[index];
+
+ if (info->swapfunc) {
+ proc = info->swapfunc;
+ }
+ else {
+ proc = NULL;
+ if (info->elem_size == 4 && info->nelems > 0) {
+ __GLX_SWAP_INT_ARRAY((int *) (pc + __GLX_RENDER_HDR_SIZE),
+ info->nelems);
+ }
+ else if (info->elem_size == 2 && info->nelems > 0) {
+ __GLX_SWAP_SHORT_ARRAY((short *) (pc +
+ __GLX_RENDER_HDR_SIZE),
+ info->nelems);
+ }
+ else if (info->elem_size == 8 && info->nelems > 0) {
+ __GLX_SWAP_DOUBLE_ARRAY((double *) (pc +
+ __GLX_RENDER_HDR_SIZE),
+ info->nelems);
+ }
+ }
+#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
+ }
+ else {
+ client->errorValue = 0;
+ return __glXBadRenderRequest;
+ }
+
+ if (proc != NULL)
+ (*proc) (pc + __GLX_RENDER_HDR_SIZE);
+
+ /*
+ * proceed to the next command
+ */
+ pc += hdr->length;
+ left -= hdr->length;
}
- return __glXRender( cl, (GLbyte *)req );
+ return __glXRender(cl, (GLbyte *) req);
}
/*
** Execute a large rendering request (one that spans multiple X requests).
*/
-int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapRenderLarge(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
+ ClientPtr client = cl->client;
xGLXRenderLargeReq *req;
__GLXrenderLargeHeader *hdr;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
@@ -666,134 +741,139 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_SHORT(&req->requestTotal);
pc += sz_xGLXRenderLargeReq;
-
+
if (req->requestNumber == 1) {
- void (* proc)(GLbyte *) = NULL;
- __GLXRenderSwapInfo *info = NULL;
- CARD16 opcode;
+ void (*proc) (GLbyte *) = NULL;
+ __GLXRenderSwapInfo *info = NULL;
+ CARD16 opcode;
- hdr = (__GLXrenderLargeHeader *) pc;
- __GLX_SWAP_INT(&hdr->length);
- __GLX_SWAP_INT(&hdr->opcode);
+ hdr = (__GLXrenderLargeHeader *) pc;
+ __GLX_SWAP_INT(&hdr->length);
+ __GLX_SWAP_INT(&hdr->opcode);
- /*
+ /*
* call the command procedure to swap any arguments
- * Note that we are assuming that all arguments that needs to be
- * swaped are on the first req only !
- */
- opcode = hdr->opcode;
- if ( (opcode >= __GLX_MIN_RENDER_OPCODE) &&
- (opcode <= __GLX_MAX_RENDER_OPCODE) ) {
- proc = __glXSwapRenderTable[opcode];
+ * Note that we are assuming that all arguments that needs to be
+ * swaped are on the first req only !
+ */
+ opcode = hdr->opcode;
+ if ((opcode >= __GLX_MIN_RENDER_OPCODE) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE)) {
+ proc = __glXSwapRenderTable[opcode];
#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT
- } else if ( (opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
- (opcode <= __GLX_MAX_RENDER_OPCODE_EXT) ) {
- int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
- info = &__glXSwapRenderTable_EXT[index];
- if (info->swapfunc) {
- proc = info->swapfunc;
- }
-#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
- } else {
- client->errorValue = 0;
- cl->largeCmdRequestsTotal = 0;
- return __glXBadLargeRequest;
- }
-
- /*
- ** Make enough space in the buffer, then copy the entire request.
- */
- if (cl->largeCmdBufSize < hdr->length) {
- if (!cl->largeCmdBuf) {
- cl->largeCmdBuf = (GLbyte *) malloc(hdr->length);
- } else {
- cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, hdr->length);
- }
- if (!cl->largeCmdBuf) {
- cl->largeCmdRequestsTotal = 0;
- return BadAlloc;
- }
- cl->largeCmdBufSize = hdr->length;
- }
- memcpy(cl->largeCmdBuf, pc, req->dataBytes);
-
- cl->largeCmdBytesSoFar = req->dataBytes;
- cl->largeCmdBytesTotal = hdr->length;
- cl->largeCmdRequestsSoFar = 1;
- cl->largeCmdRequestsTotal = req->requestTotal;
- cl->largeCmdRequestsSwapProc = proc;
- cl->largeCmdMaxReqDataSize = req->dataBytes;
- cl->largeCmdRequestsSwap_info = info;
-
- return Success;
-
+ }
+ else if ((opcode >= __GLX_MIN_RENDER_OPCODE_EXT) &&
+ (opcode <= __GLX_MAX_RENDER_OPCODE_EXT)) {
+ int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT;
+
+ info = &__glXSwapRenderTable_EXT[index];
+ if (info->swapfunc) {
+ proc = info->swapfunc;
+ }
+#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */
+ }
+ else {
+ client->errorValue = 0;
+ cl->largeCmdRequestsTotal = 0;
+ return __glXBadLargeRequest;
+ }
+
+ /*
+ ** Make enough space in the buffer, then copy the entire request.
+ */
+ if (cl->largeCmdBufSize < hdr->length) {
+ if (!cl->largeCmdBuf) {
+ cl->largeCmdBuf = (GLbyte *) malloc(hdr->length);
+ }
+ else {
+ cl->largeCmdBuf =
+ (GLbyte *) realloc(cl->largeCmdBuf, hdr->length);
+ }
+ if (!cl->largeCmdBuf) {
+ cl->largeCmdRequestsTotal = 0;
+ return BadAlloc;
+ }
+ cl->largeCmdBufSize = hdr->length;
+ }
+ memcpy(cl->largeCmdBuf, pc, req->dataBytes);
+
+ cl->largeCmdBytesSoFar = req->dataBytes;
+ cl->largeCmdBytesTotal = hdr->length;
+ cl->largeCmdRequestsSoFar = 1;
+ cl->largeCmdRequestsTotal = req->requestTotal;
+ cl->largeCmdRequestsSwapProc = proc;
+ cl->largeCmdMaxReqDataSize = req->dataBytes;
+ cl->largeCmdRequestsSwap_info = info;
+
+ return Success;
}
else if (req->requestNumber < cl->largeCmdRequestsTotal) {
- /*
- * This is not the first nor last request - just copy the data
- */
- if ( cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) {
- cl->largeCmdRequestsTotal = 0;
- return __glXBadLargeRequest;
- }
+ /*
+ * This is not the first nor last request - just copy the data
+ */
+ if (cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) {
+ cl->largeCmdRequestsTotal = 0;
+ return __glXBadLargeRequest;
+ }
- memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar,
- pc, req->dataBytes);
+ memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, req->dataBytes);
- cl->largeCmdBytesSoFar += req->dataBytes;
+ cl->largeCmdBytesSoFar += req->dataBytes;
- if (req->dataBytes > cl->largeCmdMaxReqDataSize)
- cl->largeCmdMaxReqDataSize = req->dataBytes;
+ if (req->dataBytes > cl->largeCmdMaxReqDataSize)
+ cl->largeCmdMaxReqDataSize = req->dataBytes;
- return Success;
+ return Success;
}
else if (req->requestNumber == cl->largeCmdRequestsTotal) {
- /*
- * this is the last request
- * copy the remainder bytes, call the procedure to swap any
- * needed data, and then call to transfer the command to all
- * back-end servers
- */
- if ( cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) {
- cl->largeCmdRequestsTotal = 0;
- return __glXBadLargeRequest;
- }
-
- memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar,
- pc, req->dataBytes);
-
- cl->largeCmdBytesSoFar += req->dataBytes;
-
- if (req->dataBytes > cl->largeCmdMaxReqDataSize)
- cl->largeCmdMaxReqDataSize = req->dataBytes;
-
- if (cl->largeCmdRequestsSwapProc != NULL) {
- (*cl->largeCmdRequestsSwapProc)(cl->largeCmdBuf + __GLX_RENDER_LARGE_HDR_SIZE);
- }
- else if (cl->largeCmdRequestsSwap_info &&
- cl->largeCmdRequestsSwap_info->nelems > 0) {
- if (cl->largeCmdRequestsSwap_info->elem_size == 4) {
- __GLX_SWAP_INT_ARRAY( (int *)(pc + __GLX_RENDER_LARGE_HDR_SIZE),
- cl->largeCmdRequestsSwap_info->nelems );
- }
- else if (cl->largeCmdRequestsSwap_info->elem_size == 2) {
- __GLX_SWAP_SHORT_ARRAY( (short *)(pc + __GLX_RENDER_LARGE_HDR_SIZE),
- cl->largeCmdRequestsSwap_info->nelems );
- }
- else if (cl->largeCmdRequestsSwap_info->elem_size == 8) {
- __GLX_SWAP_DOUBLE_ARRAY( (double *)(pc + __GLX_RENDER_LARGE_HDR_SIZE),
- cl->largeCmdRequestsSwap_info->nelems );
- }
- }
-
- cl->largeCmdRequestsTotal = 0;
- return( __glXSendLargeCommand(cl, req->contextTag) );
+ /*
+ * this is the last request
+ * copy the remainder bytes, call the procedure to swap any
+ * needed data, and then call to transfer the command to all
+ * back-end servers
+ */
+ if (cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) {
+ cl->largeCmdRequestsTotal = 0;
+ return __glXBadLargeRequest;
+ }
+
+ memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, req->dataBytes);
+
+ cl->largeCmdBytesSoFar += req->dataBytes;
+
+ if (req->dataBytes > cl->largeCmdMaxReqDataSize)
+ cl->largeCmdMaxReqDataSize = req->dataBytes;
+
+ if (cl->largeCmdRequestsSwapProc != NULL) {
+ (*cl->largeCmdRequestsSwapProc) (cl->largeCmdBuf +
+ __GLX_RENDER_LARGE_HDR_SIZE);
+ }
+ else if (cl->largeCmdRequestsSwap_info &&
+ cl->largeCmdRequestsSwap_info->nelems > 0) {
+ if (cl->largeCmdRequestsSwap_info->elem_size == 4) {
+ __GLX_SWAP_INT_ARRAY((int *) (pc + __GLX_RENDER_LARGE_HDR_SIZE),
+ cl->largeCmdRequestsSwap_info->nelems);
+ }
+ else if (cl->largeCmdRequestsSwap_info->elem_size == 2) {
+ __GLX_SWAP_SHORT_ARRAY((short *) (pc +
+ __GLX_RENDER_LARGE_HDR_SIZE),
+ cl->largeCmdRequestsSwap_info->nelems);
+ }
+ else if (cl->largeCmdRequestsSwap_info->elem_size == 8) {
+ __GLX_SWAP_DOUBLE_ARRAY((double *) (pc +
+ __GLX_RENDER_LARGE_HDR_SIZE),
+ cl->largeCmdRequestsSwap_info->nelems);
+ }
+ }
+
+ cl->largeCmdRequestsTotal = 0;
+ return (__glXSendLargeCommand(cl, req->contextTag));
}
else {
- cl->largeCmdRequestsTotal = 0;
- return __glXBadLargeRequest;
+ cl->largeCmdRequestsTotal = 0;
+ return __glXBadLargeRequest;
}
}
@@ -805,7 +885,8 @@ int __glXSwapRenderLarge(__GLXclientState *cl, GLbyte *pc)
** allocating these entry points in the dispatch table.
*/
-int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapVendorPrivate(__GLXclientState * cl, GLbyte * pc)
{
xGLXVendorPrivateReq *req;
CARD32 vendorCode;
@@ -816,58 +897,58 @@ int __glXSwapVendorPrivate(__GLXclientState *cl, GLbyte *pc)
vendorCode = req->vendorCode;
__GLX_SWAP_INT(&vendorCode);
-
- switch( vendorCode ) {
-
- case X_GLvop_DeleteTexturesEXT:
- return __glXVForwardSingleReqSwap( cl, pc );
- break;
-
- case X_GLXvop_SwapIntervalSGI:
- if (glxIsExtensionSupported("SGI_swap_control")) {
- return __glXVForwardSingleReqSwap( cl, pc );
- }
- else {
- return Success;
- }
- break;
-
-#if 0 /* glx 1.3 */
- case X_GLXvop_CreateGLXVideoSourceSGIX:
- break;
- case X_GLXvop_DestroyGLXVideoSourceSGIX:
- break;
- case X_GLXvop_CreateGLXPixmapWithConfigSGIX:
- break;
- case X_GLXvop_DestroyGLXPbufferSGIX:
- break;
- case X_GLXvop_ChangeDrawableAttributesSGIX:
- break;
+ switch (vendorCode) {
+
+ case X_GLvop_DeleteTexturesEXT:
+ return __glXVForwardSingleReqSwap(cl, pc);
+ break;
+
+ case X_GLXvop_SwapIntervalSGI:
+ if (glxIsExtensionSupported("SGI_swap_control")) {
+ return __glXVForwardSingleReqSwap(cl, pc);
+ }
+ else {
+ return Success;
+ }
+ break;
+
+#if 0 /* glx 1.3 */
+ case X_GLXvop_CreateGLXVideoSourceSGIX:
+ break;
+ case X_GLXvop_DestroyGLXVideoSourceSGIX:
+ break;
+ case X_GLXvop_CreateGLXPixmapWithConfigSGIX:
+ break;
+ case X_GLXvop_DestroyGLXPbufferSGIX:
+ break;
+ case X_GLXvop_ChangeDrawableAttributesSGIX:
+ break;
#endif
- case X_GLXvop_JoinSwapGroupSGIX:
- return __glXSwapJoinSwapGroupSGIX( cl, pc );
- break;
+ case X_GLXvop_JoinSwapGroupSGIX:
+ return __glXSwapJoinSwapGroupSGIX(cl, pc);
+ break;
- case X_GLXvop_BindSwapBarrierSGIX:
- return __glXSwapBindSwapBarrierSGIX( cl, pc );
- break;
+ case X_GLXvop_BindSwapBarrierSGIX:
+ return __glXSwapBindSwapBarrierSGIX(cl, pc);
+ break;
- case X_GLXvop_CreateContextWithConfigSGIX:
- return __glXSwapCreateContextWithConfigSGIX( cl, pc );
- break;
+ case X_GLXvop_CreateContextWithConfigSGIX:
+ return __glXSwapCreateContextWithConfigSGIX(cl, pc);
+ break;
- default:
- /*
- ** unsupported private request
- */
- cl->client->errorValue = req->vendorCode;
- return __glXUnsupportedPrivateRequest;
+ default:
+ /*
+ ** unsupported private request
+ */
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
}
}
-int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapVendorPrivateWithReply(__GLXclientState * cl, GLbyte * pc)
{
xGLXVendorPrivateWithReplyReq *req;
CARD32 vendorCode;
@@ -878,76 +959,78 @@ int __glXSwapVendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc)
vendorCode = req->vendorCode;
__GLX_SWAP_INT(&vendorCode);
- switch( vendorCode ) {
-
- case X_GLvop_GetConvolutionFilterEXT:
- case X_GLvop_GetSeparableFilterEXT:
- case X_GLvop_GetHistogramEXT:
- case X_GLvop_GetMinmaxEXT:
- return( __glXNoSuchSingleOpcode(cl, pc) );
- break;
-
- case X_GLvop_GetConvolutionParameterfvEXT:
- case X_GLvop_GetConvolutionParameterivEXT:
- case X_GLvop_GetHistogramParameterivEXT:
- case X_GLvop_GetMinmaxParameterfvEXT:
- case X_GLvop_GetMinmaxParameterivEXT:
- case X_GLvop_GenTexturesEXT:
- return( __glXVForwardAllWithReplySwapiv(cl, pc) );
- break;
-
- case X_GLvop_AreTexturesResidentEXT:
- case X_GLvop_IsTextureEXT:
- return( __glXVForwardPipe0WithReplySwap(cl, pc) );
- break;
-
-#if 0 /* glx1.3 */
- case X_GLvop_GetDetailTexFuncSGIS:
- case X_GLvop_GetSharpenTexFuncSGIS:
- case X_GLvop_GetColorTableSGI:
- case X_GLvop_GetColorTableParameterfvSGI:
- case X_GLvop_GetColorTableParameterivSGI:
- case X_GLvop_GetTexFilterFuncSGIS:
- case X_GLvop_GetInstrumentsSGIX:
- case X_GLvop_InstrumentsBufferSGIX:
- case X_GLvop_PollInstrumentsSGIX:
- case X_GLvop_FlushRasterSGIX:
- case X_GLXvop_CreateGLXPbufferSGIX:
- case X_GLXvop_GetDrawableAttributesSGIX:
- case X_GLXvop_QueryHyperpipeNetworkSGIX:
- case X_GLXvop_QueryHyperpipeConfigSGIX:
- case X_GLXvop_HyperpipeConfigSGIX:
- case X_GLXvop_DestroyHyperpipeConfigSGIX:
+ switch (vendorCode) {
+
+ case X_GLvop_GetConvolutionFilterEXT:
+ case X_GLvop_GetSeparableFilterEXT:
+ case X_GLvop_GetHistogramEXT:
+ case X_GLvop_GetMinmaxEXT:
+ return (__glXNoSuchSingleOpcode(cl, pc));
+ break;
+
+ case X_GLvop_GetConvolutionParameterfvEXT:
+ case X_GLvop_GetConvolutionParameterivEXT:
+ case X_GLvop_GetHistogramParameterivEXT:
+ case X_GLvop_GetMinmaxParameterfvEXT:
+ case X_GLvop_GetMinmaxParameterivEXT:
+ case X_GLvop_GenTexturesEXT:
+ return (__glXVForwardAllWithReplySwapiv(cl, pc));
+ break;
+
+ case X_GLvop_AreTexturesResidentEXT:
+ case X_GLvop_IsTextureEXT:
+ return (__glXVForwardPipe0WithReplySwap(cl, pc));
+ break;
+
+#if 0 /* glx1.3 */
+ case X_GLvop_GetDetailTexFuncSGIS:
+ case X_GLvop_GetSharpenTexFuncSGIS:
+ case X_GLvop_GetColorTableSGI:
+ case X_GLvop_GetColorTableParameterfvSGI:
+ case X_GLvop_GetColorTableParameterivSGI:
+ case X_GLvop_GetTexFilterFuncSGIS:
+ case X_GLvop_GetInstrumentsSGIX:
+ case X_GLvop_InstrumentsBufferSGIX:
+ case X_GLvop_PollInstrumentsSGIX:
+ case X_GLvop_FlushRasterSGIX:
+ case X_GLXvop_CreateGLXPbufferSGIX:
+ case X_GLXvop_GetDrawableAttributesSGIX:
+ case X_GLXvop_QueryHyperpipeNetworkSGIX:
+ case X_GLXvop_QueryHyperpipeConfigSGIX:
+ case X_GLXvop_HyperpipeConfigSGIX:
+ case X_GLXvop_DestroyHyperpipeConfigSGIX:
#endif
- case X_GLXvop_QueryMaxSwapBarriersSGIX:
- return( __glXSwapQueryMaxSwapBarriersSGIX(cl, pc) );
- break;
-
- case X_GLXvop_GetFBConfigsSGIX:
- return( __glXSwapGetFBConfigsSGIX(cl, pc) );
- break;
-
- case X_GLXvop_MakeCurrentReadSGI:
- return( __glXSwapMakeCurrentReadSGI(cl, pc) );
- break;
-
- case X_GLXvop_QueryContextInfoEXT:
- return( __glXSwapQueryContextInfoEXT(cl,(char *)pc) );
- break;
-
- default:
- /*
- ** unsupported private request
- */
- cl->client->errorValue = req->vendorCode;
- return __glXUnsupportedPrivateRequest;
+ case X_GLXvop_QueryMaxSwapBarriersSGIX:
+ return (__glXSwapQueryMaxSwapBarriersSGIX(cl, pc));
+ break;
+
+ case X_GLXvop_GetFBConfigsSGIX:
+ return (__glXSwapGetFBConfigsSGIX(cl, pc));
+ break;
+
+ case X_GLXvop_MakeCurrentReadSGI:
+ return (__glXSwapMakeCurrentReadSGI(cl, pc));
+ break;
+
+ case X_GLXvop_QueryContextInfoEXT:
+ return (__glXSwapQueryContextInfoEXT(cl, (char *) pc));
+ break;
+
+ default:
+ /*
+ ** unsupported private request
+ */
+ cl->client->errorValue = req->vendorCode;
+ return __glXUnsupportedPrivateRequest;
}
}
-int __glXSwapGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapGetFBConfigs(__GLXclientState * cl, GLbyte * pc)
{
xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -956,22 +1039,25 @@ int __glXSwapGetFBConfigs(__GLXclientState *cl, GLbyte *pc)
return __glXGetFBConfigs(cl, pc);
}
-int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc)
{
- xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *)pc;
- xGLXGetFBConfigsReq new_req;
+ xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
+ xGLXGetFBConfigsReq new_req;
- new_req.reqType = req->reqType;
- new_req.glxCode = req->glxCode;
- new_req.length = req->length;
- new_req.screen = req->screen;
+ new_req.reqType = req->reqType;
+ new_req.glxCode = req->glxCode;
+ new_req.length = req->length;
+ new_req.screen = req->screen;
- return( __glXSwapGetFBConfigs( cl, (GLbyte *)&new_req ) );
+ return (__glXSwapGetFBConfigs(cl, (GLbyte *) & new_req));
}
-int __glXSwapCreateWindow(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapCreateWindow(__GLXclientState * cl, GLbyte * pc)
{
xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
@@ -981,37 +1067,42 @@ int __glXSwapCreateWindow(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(&req->glxwindow);
__GLX_SWAP_INT(&req->numAttribs);
- return( __glXCreateWindow( cl, (GLbyte *)pc ) );
+ return (__glXCreateWindow(cl, (GLbyte *) pc));
}
-int __glXSwapDestroyWindow(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapDestroyWindow(__GLXclientState * cl, GLbyte * pc)
{
xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->glxwindow);
- return( __glXDestroyWindow( cl, (GLbyte *)pc ) );
+ return (__glXDestroyWindow(cl, (GLbyte *) pc));
}
-int __glXSwapQueryContext(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapQueryContext(__GLXclientState * cl, GLbyte * pc)
{
- xGLXQueryContextReq *req = (xGLXQueryContextReq *)pc;
+ xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->context);
- return( __glXQueryContext(cl, (GLbyte *)pc) );
-
+ return (__glXQueryContext(cl, (GLbyte *) pc));
+
}
-int __glXSwapCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapCreatePbuffer(__GLXclientState * cl, GLbyte * pc)
{
- xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *)pc;
+ xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc;
int nattr = req->numAttribs;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
@@ -1020,43 +1111,49 @@ int __glXSwapCreatePbuffer(__GLXclientState *cl, GLbyte *pc)
__GLX_SWAP_INT(&req->fbconfig);
__GLX_SWAP_INT(&req->pbuffer);
__GLX_SWAP_INT(&req->numAttribs);
- __GLX_SWAP_INT_ARRAY( (int *)(req+1), nattr*2 );
+ __GLX_SWAP_INT_ARRAY((int *) (req + 1), nattr * 2);
- return( __glXCreatePbuffer( cl, pc ) );
+ return (__glXCreatePbuffer(cl, pc));
}
-int __glXSwapDestroyPbuffer(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapDestroyPbuffer(__GLXclientState * cl, GLbyte * pc)
{
xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->pbuffer);
- return( __glXDestroyPbuffer( cl, (GLbyte *)pc ) );
+ return (__glXDestroyPbuffer(cl, (GLbyte *) pc));
}
-int __glXSwapGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
{
- xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
+ xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *) pc;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->drawable);
- return( __glXGetDrawableAttributes(cl, pc) );
+ return (__glXGetDrawableAttributes(cl, pc));
}
-int __glXSwapChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
+int
+__glXSwapChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc)
{
- xGLXChangeDrawableAttributesReq *req = (xGLXChangeDrawableAttributesReq *)pc;
+ xGLXChangeDrawableAttributesReq *req =
+ (xGLXChangeDrawableAttributesReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->drawable);
__GLX_SWAP_INT(&req->numAttribs);
- __GLX_SWAP_INT_ARRAY( (int *)(req+1), req->numAttribs * 2 );
+ __GLX_SWAP_INT_ARRAY((int *) (req + 1), req->numAttribs * 2);
- return( __glXChangeDrawableAttributes(cl, pc) );
+ return (__glXChangeDrawableAttributes(cl, pc));
}
diff --git a/xorg-server/hw/dmx/glxProxy/glxext.c b/xorg-server/hw/dmx/glxProxy/glxext.c
index 4da16a77d..b0710ccc6 100644
--- a/xorg-server/hw/dmx/glxProxy/glxext.c
+++ b/xorg-server/hw/dmx/glxProxy/glxext.c
@@ -1,496 +1,517 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * 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 including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-
-#include "glxserver.h"
-#include <windowstr.h>
-#include <propertyst.h>
-#include <os.h>
-#include "g_disptab.h"
-#include "glxutil.h"
-#include "glxext.h"
-#include "glxvisuals.h"
-#include "micmap.h"
-#include "glxswap.h"
-
-/*
-** Stubs to satisfy miinitext.c references.
-*/
-typedef int __GLXprovider;
-__GLXprovider __glXDRISWRastProvider;
-void GlxPushProvider(__GLXprovider *provider) { }
-
-/*
-** Forward declarations.
-*/
-static int __glXSwapDispatch(ClientPtr);
-static int __glXDispatch(ClientPtr);
-
-/*
-** Called when the extension is reset.
-*/
-static void ResetExtension(ExtensionEntry* extEntry)
-{
- __glXFlushContextCache();
- __glXScreenReset();
- SwapBarrierReset();
-}
-
-/*
-** Initialize the per-client context storage.
-*/
-static void ResetClientState(int clientIndex)
-{
- __GLXclientState *cl = __glXClients[clientIndex];
- Display **keep_be_displays;
- int i;
-
- free(cl->returnBuf);
- free(cl->currentContexts);
- free(cl->currentDrawables);
- free(cl->largeCmdBuf);
-
- for (i=0; i< screenInfo.numScreens; i++) {
- if (cl->be_displays[i])
- XCloseDisplay( cl->be_displays[i] );
- }
-
- keep_be_displays = cl->be_displays;
- memset(cl, 0, sizeof(__GLXclientState));
- cl->be_displays = keep_be_displays;
-
- /*
- ** By default, assume that the client supports
- ** GLX major version 1 minor version 0 protocol.
- */
- cl->GLClientmajorVersion = 1;
- cl->GLClientminorVersion = 0;
- free(cl->GLClientextensions);
-
- memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *));
-}
-
-
-/*
-** This procedure is called when the client who created the context goes
-** away OR when glXDestroyContext is called. In either case, all we do is
-** flag that the ID is no longer valid, and (maybe) free the context.
-** use.
-*/
-static int ContextGone(__GLXcontext* cx, XID id)
-{
- cx->idExists = GL_FALSE;
- if (!cx->isCurrent) {
- __glXFreeContext(cx);
- }
-
- return True;
-}
-
-/*
-** Free a client's state.
-*/
-static int ClientGone(int clientIndex, XID id)
-{
- __GLXcontext *cx;
- __GLXclientState *cl = __glXClients[clientIndex];
- int i;
-
- if (cl) {
- /*
- ** Free all the contexts that are current for this client.
- */
- for (i=0; i < cl->numCurrentContexts; i++) {
- cx = cl->currentContexts[i];
- if (cx) {
- cx->isCurrent = GL_FALSE;
- if (!cx->idExists) {
- __glXFreeContext(cx);
- }
- }
- }
- /*
- ** Re-initialize the client state structure. Don't free it because
- ** we'll probably get another client with this index and use the struct
- ** again. There is a maximum of MAXCLIENTS of these structures.
- */
- ResetClientState(clientIndex);
- }
-
- return True;
-}
-
-/*
-** Free a GLX Pixmap.
-*/
-void __glXFreeGLXPixmap( __GLXpixmap *pGlxPixmap )
-{
- if (!pGlxPixmap->idExists &&
- !pGlxPixmap->refcnt) {
-
- PixmapPtr pPixmap = (PixmapPtr) pGlxPixmap->pDraw;
-
- /*
- ** The DestroyPixmap routine should decrement the refcount and free
- ** only if it's zero.
- */
- (*pGlxPixmap->pScreen->DestroyPixmap)(pPixmap);
- free(pGlxPixmap->be_xids);
- free(pGlxPixmap);
- }
-
-}
-
-static int PixmapGone(__GLXpixmap *pGlxPixmap, XID id)
-{
-
- pGlxPixmap->idExists = False;
- __glXFreeGLXPixmap( pGlxPixmap );
-
- return True;
-}
-
-void __glXFreeGLXWindow(__glXWindow *pGlxWindow)
-{
- if (!pGlxWindow->idExists && !pGlxWindow->refcnt) {
- WindowPtr pWindow = (WindowPtr) pGlxWindow->pDraw;
- WindowPtr ret;
-
- dixLookupResourceByType((pointer) &ret,
- pWindow->drawable.id, RT_WINDOW,
- NullClient, DixUnknownAccess);
- if (ret == pWindow) {
- (*pGlxWindow->pScreen->DestroyWindow)(pWindow);
- }
-
- free(pGlxWindow);
- }
-}
-
-static void WindowGone(__glXWindow *pGlxWindow, XID id)
-{
- pGlxWindow->idExists = False;
- __glXFreeGLXWindow(pGlxWindow);
-}
-
-void __glXFreeGLXPbuffer(__glXPbuffer *pGlxPbuffer)
-{
- if (!pGlxPbuffer->idExists && !pGlxPbuffer->refcnt) {
- free(pGlxPbuffer->be_xids);
- free(pGlxPbuffer);
- }
-}
-
-static void PbufferGone(__glXPbuffer *pGlxPbuffer, XID id)
-{
- pGlxPbuffer->idExists = False;
- __glXFreeGLXPbuffer(pGlxPbuffer);
-}
-
-/*
-** Free a context.
-*/
-GLboolean __glXFreeContext(__GLXcontext *cx)
-{
- if (cx->idExists || cx->isCurrent) return GL_FALSE;
-
- free(cx->feedbackBuf);
- free(cx->selectBuf);
- free(cx->real_ids);
- free(cx->real_vids);
-
- if (cx->pGlxPixmap) {
- /*
- ** The previous drawable was a glx pixmap, release it.
- */
- cx->pGlxPixmap->refcnt--;
- __glXFreeGLXPixmap( cx->pGlxPixmap );
- cx->pGlxPixmap = 0;
- }
-
- if (cx->pGlxReadPixmap) {
- /*
- ** The previous drawable was a glx pixmap, release it.
- */
- cx->pGlxReadPixmap->refcnt--;
- __glXFreeGLXPixmap( cx->pGlxReadPixmap );
- cx->pGlxReadPixmap = 0;
- }
-
- if (cx->pGlxWindow) {
- /*
- ** The previous drawable was a glx window, release it.
- */
- cx->pGlxWindow->refcnt--;
- __glXFreeGLXWindow( cx->pGlxWindow );
- cx->pGlxWindow = 0;
- }
-
- if (cx->pGlxReadWindow) {
- /*
- ** The previous drawable was a glx window, release it.
- */
- cx->pGlxReadWindow->refcnt--;
- __glXFreeGLXWindow( cx->pGlxReadWindow );
- cx->pGlxReadWindow = 0;
- }
-
- free(cx);
-
- if (cx == __glXLastContext) {
- __glXFlushContextCache();
- }
-
- return GL_TRUE;
-}
-
-/*
-** Initialize the GLX extension.
-*/
-void GlxExtensionInit(void)
-{
- ExtensionEntry *extEntry;
- int i;
- int glxSupported = 1;
-
- /*
- // do not initialize GLX extension if GLX is not supported
- // by ALL back-end servers.
- */
- for (i=0; i<screenInfo.numScreens; i++) {
- glxSupported &= (dmxScreens[i].glxMajorOpcode > 0);
- }
-
- if (!glxSupported || !dmxGLXProxy) {
- return;
- }
-
- __glXContextRes = CreateNewResourceType((DeleteType)ContextGone,
- "GLXContext");
- __glXClientRes = CreateNewResourceType((DeleteType)ClientGone,
- "GLXClient");
- __glXPixmapRes = CreateNewResourceType((DeleteType)PixmapGone,
- "GLXPixmap");
- __glXWindowRes = CreateNewResourceType((DeleteType)WindowGone,
- "GLXWindow");
- __glXPbufferRes = CreateNewResourceType((DeleteType)PbufferGone,
- "GLXPbuffer");
-
- if (!__glXContextRes || !__glXClientRes || !__glXPixmapRes ||
- !__glXWindowRes || !__glXPbufferRes)
- return;
-
- /*
- ** Add extension to server extensions.
- */
- extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS,
- __GLX_NUMBER_ERRORS, __glXDispatch,
- __glXSwapDispatch, ResetExtension,
- StandardMinorOpcode);
- if (!extEntry) {
- FatalError("__glXExtensionInit: AddExtensions failed\n");
- return;
- }
- /*
- if (!AddExtensionAlias(GLX_EXTENSION_ALIAS, extEntry)) {
- ErrorF("__glXExtensionInit: AddExtensionAlias failed\n");
- return;
- }
- */
-
- __glXerrorBase = extEntry->errorBase;
- __glXBadContext = extEntry->errorBase + GLXBadContext;
- __glXBadContextState = extEntry->errorBase + GLXBadContextState;
- __glXBadDrawable = extEntry->errorBase + GLXBadDrawable;
- __glXBadPixmap = extEntry->errorBase + GLXBadPixmap;
- __glXBadContextTag = extEntry->errorBase + GLXBadContextTag;
- __glXBadCurrentWindow = extEntry->errorBase + GLXBadCurrentWindow;
- __glXBadRenderRequest = extEntry->errorBase + GLXBadRenderRequest;
- __glXBadLargeRequest = extEntry->errorBase + GLXBadLargeRequest;
- __glXUnsupportedPrivateRequest = extEntry->errorBase +
- GLXUnsupportedPrivateRequest;
- __glXBadFBConfig = extEntry->errorBase + GLXBadFBConfig;
- __glXBadPbuffer = extEntry->errorBase + GLXBadPbuffer;
-
- /*
- ** Initialize table of client state. There is never a client 0.
- */
- for (i=1; i <= MAXCLIENTS; i++) {
- __glXClients[i] = 0;
- }
-
- /*
- ** Initialize screen specific data.
- */
- __glXScreenInit(screenInfo.numScreens);
-
- /*
- ** Initialize swap barrier support.
- */
- SwapBarrierInit();
-}
-
-/************************************************************************/
-
-Bool __glXCoreType(void)
-{
- return 0;
-}
-
-/************************************************************************/
-
-void __glXFlushContextCache(void)
-{
- __glXLastContext = 0;
-}
-
-/************************************************************************/
-
-/*
-** Top level dispatcher; all commands are executed from here down.
-*/
-static int __glXDispatch(ClientPtr client)
-{
- REQUEST(xGLXSingleReq);
- CARD8 opcode;
- int (*proc)(__GLXclientState *cl, GLbyte *pc);
- __GLXclientState *cl;
-
- opcode = stuff->glxCode;
- cl = __glXClients[client->index];
- if (!cl) {
- cl = calloc(1, sizeof(__GLXclientState));
- __glXClients[client->index] = cl;
- if (!cl) {
- return BadAlloc;
- }
-
- cl->be_displays = calloc(screenInfo.numScreens, sizeof(Display *));
- if (!cl->be_displays) {
- free( cl );
- return BadAlloc;
- }
- }
-
- if (!cl->inUse) {
- /*
- ** This is first request from this client. Associate a resource
- ** with the client so we will be notified when the client dies.
- */
- XID xid = FakeClientID(client->index);
- if (!AddResource( xid, __glXClientRes, (pointer)(long)client->index)) {
- return BadAlloc;
- }
- ResetClientState(client->index);
- cl->largeCmdRequestsTotal = 0;
- cl->inUse = GL_TRUE;
- cl->client = client;
- }
-
- /*
- ** Check for valid opcode.
- */
- if (opcode >= __GLX_SINGLE_TABLE_SIZE) {
- return BadRequest;
- }
-
- /*
- ** Use the opcode to index into the procedure table.
- */
- proc = __glXSingleTable[opcode];
- return (*proc)(cl, (GLbyte *) stuff);
-}
-
-static int __glXSwapDispatch(ClientPtr client)
-{
- REQUEST(xGLXSingleReq);
- CARD8 opcode;
- int (*proc)(__GLXclientState *cl, GLbyte *pc);
- __GLXclientState *cl;
-
- opcode = stuff->glxCode;
- cl = __glXClients[client->index];
- if (!cl) {
- cl = calloc(1, sizeof(__GLXclientState));
- __glXClients[client->index] = cl;
- if (!cl) {
- return BadAlloc;
- }
-
- cl->be_displays = calloc(screenInfo.numScreens, sizeof(Display *));
- if (!cl->be_displays) {
- free( cl );
- return BadAlloc;
- }
- }
-
- if (!cl->inUse) {
- /*
- ** This is first request from this client. Associate a resource
- ** with the client so we will be notified when the client dies.
- */
- XID xid = FakeClientID(client->index);
- if (!AddResource( xid, __glXClientRes, (pointer)(long)client->index)) {
- return BadAlloc;
- }
- ResetClientState(client->index);
- cl->inUse = GL_TRUE;
- cl->client = client;
- }
-
- /*
- ** Check for valid opcode.
- */
- if (opcode >= __GLX_SINGLE_TABLE_SIZE) {
- return BadRequest;
- }
-
- /*
- ** Use the opcode to index into the procedure table.
- */
- proc = __glXSwapSingleTable[opcode];
- return (*proc)(cl, (GLbyte *) stuff);
-}
-
-int __glXNoSuchSingleOpcode(__GLXclientState *cl, GLbyte *pc)
-{
- return BadRequest;
-}
-
-void __glXNoSuchRenderOpcode(GLbyte *pc)
-{
- return;
-}
-
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * 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 including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * 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
+ * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+
+#include "glxserver.h"
+#include <windowstr.h>
+#include <propertyst.h>
+#include <os.h>
+#include "g_disptab.h"
+#include "glxutil.h"
+#include "glxext.h"
+#include "glxvisuals.h"
+#include "micmap.h"
+#include "glxswap.h"
+
+/*
+** Stubs to satisfy miinitext.c references.
+*/
+typedef int __GLXprovider;
+__GLXprovider __glXDRISWRastProvider;
+void
+GlxPushProvider(__GLXprovider * provider)
+{
+}
+
+/*
+** Forward declarations.
+*/
+static int __glXSwapDispatch(ClientPtr);
+static int __glXDispatch(ClientPtr);
+
+/*
+** Called when the extension is reset.
+*/
+static void
+ResetExtension(ExtensionEntry * extEntry)
+{
+ __glXFlushContextCache();
+ __glXScreenReset();
+ SwapBarrierReset();
+}
+
+/*
+** Initialize the per-client context storage.
+*/
+static void
+ResetClientState(int clientIndex)
+{
+ __GLXclientState *cl = __glXClients[clientIndex];
+ Display **keep_be_displays;
+ int i;
+
+ free(cl->returnBuf);
+ free(cl->currentContexts);
+ free(cl->currentDrawables);
+ free(cl->largeCmdBuf);
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ if (cl->be_displays[i])
+ XCloseDisplay(cl->be_displays[i]);
+ }
+
+ keep_be_displays = cl->be_displays;
+ memset(cl, 0, sizeof(__GLXclientState));
+ cl->be_displays = keep_be_displays;
+
+ /*
+ ** By default, assume that the client supports
+ ** GLX major version 1 minor version 0 protocol.
+ */
+ cl->GLClientmajorVersion = 1;
+ cl->GLClientminorVersion = 0;
+ free(cl->GLClientextensions);
+
+ memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *));
+}
+
+/*
+** This procedure is called when the client who created the context goes
+** away OR when glXDestroyContext is called. In either case, all we do is
+** flag that the ID is no longer valid, and (maybe) free the context.
+** use.
+*/
+static int
+ContextGone(__GLXcontext * cx, XID id)
+{
+ cx->idExists = GL_FALSE;
+ if (!cx->isCurrent) {
+ __glXFreeContext(cx);
+ }
+
+ return True;
+}
+
+/*
+** Free a client's state.
+*/
+static int
+ClientGone(int clientIndex, XID id)
+{
+ __GLXcontext *cx;
+ __GLXclientState *cl = __glXClients[clientIndex];
+ int i;
+
+ if (cl) {
+ /*
+ ** Free all the contexts that are current for this client.
+ */
+ for (i = 0; i < cl->numCurrentContexts; i++) {
+ cx = cl->currentContexts[i];
+ if (cx) {
+ cx->isCurrent = GL_FALSE;
+ if (!cx->idExists) {
+ __glXFreeContext(cx);
+ }
+ }
+ }
+ /*
+ ** Re-initialize the client state structure. Don't free it because
+ ** we'll probably get another client with this index and use the struct
+ ** again. There is a maximum of MAXCLIENTS of these structures.
+ */
+ ResetClientState(clientIndex);
+ }
+
+ return True;
+}
+
+/*
+** Free a GLX Pixmap.
+*/
+void
+__glXFreeGLXPixmap(__GLXpixmap * pGlxPixmap)
+{
+ if (!pGlxPixmap->idExists && !pGlxPixmap->refcnt) {
+
+ PixmapPtr pPixmap = (PixmapPtr) pGlxPixmap->pDraw;
+
+ /*
+ ** The DestroyPixmap routine should decrement the refcount and free
+ ** only if it's zero.
+ */
+ (*pGlxPixmap->pScreen->DestroyPixmap) (pPixmap);
+ free(pGlxPixmap->be_xids);
+ free(pGlxPixmap);
+ }
+
+}
+
+static int
+PixmapGone(__GLXpixmap * pGlxPixmap, XID id)
+{
+
+ pGlxPixmap->idExists = False;
+ __glXFreeGLXPixmap(pGlxPixmap);
+
+ return True;
+}
+
+void
+__glXFreeGLXWindow(__glXWindow * pGlxWindow)
+{
+ if (!pGlxWindow->idExists && !pGlxWindow->refcnt) {
+ WindowPtr pWindow = (WindowPtr) pGlxWindow->pDraw;
+ WindowPtr ret;
+
+ dixLookupResourceByType((pointer) &ret,
+ pWindow->drawable.id, RT_WINDOW,
+ NullClient, DixUnknownAccess);
+ if (ret == pWindow) {
+ (*pGlxWindow->pScreen->DestroyWindow) (pWindow);
+ }
+
+ free(pGlxWindow);
+ }
+}
+
+static void
+WindowGone(__glXWindow * pGlxWindow, XID id)
+{
+ pGlxWindow->idExists = False;
+ __glXFreeGLXWindow(pGlxWindow);
+}
+
+void
+__glXFreeGLXPbuffer(__glXPbuffer * pGlxPbuffer)
+{
+ if (!pGlxPbuffer->idExists && !pGlxPbuffer->refcnt) {
+ free(pGlxPbuffer->be_xids);
+ free(pGlxPbuffer);
+ }
+}
+
+static void
+PbufferGone(__glXPbuffer * pGlxPbuffer, XID id)
+{
+ pGlxPbuffer->idExists = False;
+ __glXFreeGLXPbuffer(pGlxPbuffer);
+}
+
+/*
+** Free a context.
+*/
+GLboolean
+__glXFreeContext(__GLXcontext * cx)
+{
+ if (cx->idExists || cx->isCurrent)
+ return GL_FALSE;
+
+ free(cx->feedbackBuf);
+ free(cx->selectBuf);
+ free(cx->real_ids);
+ free(cx->real_vids);
+
+ if (cx->pGlxPixmap) {
+ /*
+ ** The previous drawable was a glx pixmap, release it.
+ */
+ cx->pGlxPixmap->refcnt--;
+ __glXFreeGLXPixmap(cx->pGlxPixmap);
+ cx->pGlxPixmap = 0;
+ }
+
+ if (cx->pGlxReadPixmap) {
+ /*
+ ** The previous drawable was a glx pixmap, release it.
+ */
+ cx->pGlxReadPixmap->refcnt--;
+ __glXFreeGLXPixmap(cx->pGlxReadPixmap);
+ cx->pGlxReadPixmap = 0;
+ }
+
+ if (cx->pGlxWindow) {
+ /*
+ ** The previous drawable was a glx window, release it.
+ */
+ cx->pGlxWindow->refcnt--;
+ __glXFreeGLXWindow(cx->pGlxWindow);
+ cx->pGlxWindow = 0;
+ }
+
+ if (cx->pGlxReadWindow) {
+ /*
+ ** The previous drawable was a glx window, release it.
+ */
+ cx->pGlxReadWindow->refcnt--;
+ __glXFreeGLXWindow(cx->pGlxReadWindow);
+ cx->pGlxReadWindow = 0;
+ }
+
+ free(cx);
+
+ if (cx == __glXLastContext) {
+ __glXFlushContextCache();
+ }
+
+ return GL_TRUE;
+}
+
+/*
+** Initialize the GLX extension.
+*/
+void
+GlxExtensionInit(void)
+{
+ ExtensionEntry *extEntry;
+ int i;
+ int glxSupported = 1;
+
+ /*
+ // do not initialize GLX extension if GLX is not supported
+ // by ALL back-end servers.
+ */
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ glxSupported &= (dmxScreens[i].glxMajorOpcode > 0);
+ }
+
+ if (!glxSupported || !dmxGLXProxy) {
+ return;
+ }
+
+ __glXContextRes = CreateNewResourceType((DeleteType) ContextGone,
+ "GLXContext");
+ __glXClientRes = CreateNewResourceType((DeleteType) ClientGone,
+ "GLXClient");
+ __glXPixmapRes = CreateNewResourceType((DeleteType) PixmapGone,
+ "GLXPixmap");
+ __glXWindowRes = CreateNewResourceType((DeleteType) WindowGone,
+ "GLXWindow");
+ __glXPbufferRes = CreateNewResourceType((DeleteType) PbufferGone,
+ "GLXPbuffer");
+
+ if (!__glXContextRes || !__glXClientRes || !__glXPixmapRes ||
+ !__glXWindowRes || !__glXPbufferRes)
+ return;
+
+ /*
+ ** Add extension to server extensions.
+ */
+ extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS,
+ __GLX_NUMBER_ERRORS, __glXDispatch,
+ __glXSwapDispatch, ResetExtension,
+ StandardMinorOpcode);
+ if (!extEntry) {
+ FatalError("__glXExtensionInit: AddExtensions failed\n");
+ return;
+ }
+ /*
+ if (!AddExtensionAlias(GLX_EXTENSION_ALIAS, extEntry)) {
+ ErrorF("__glXExtensionInit: AddExtensionAlias failed\n");
+ return;
+ }
+ */
+
+ __glXerrorBase = extEntry->errorBase;
+ __glXBadContext = extEntry->errorBase + GLXBadContext;
+ __glXBadContextState = extEntry->errorBase + GLXBadContextState;
+ __glXBadDrawable = extEntry->errorBase + GLXBadDrawable;
+ __glXBadPixmap = extEntry->errorBase + GLXBadPixmap;
+ __glXBadContextTag = extEntry->errorBase + GLXBadContextTag;
+ __glXBadCurrentWindow = extEntry->errorBase + GLXBadCurrentWindow;
+ __glXBadRenderRequest = extEntry->errorBase + GLXBadRenderRequest;
+ __glXBadLargeRequest = extEntry->errorBase + GLXBadLargeRequest;
+ __glXUnsupportedPrivateRequest = extEntry->errorBase +
+ GLXUnsupportedPrivateRequest;
+ __glXBadFBConfig = extEntry->errorBase + GLXBadFBConfig;
+ __glXBadPbuffer = extEntry->errorBase + GLXBadPbuffer;
+
+ /*
+ ** Initialize table of client state. There is never a client 0.
+ */
+ for (i = 1; i <= MAXCLIENTS; i++) {
+ __glXClients[i] = 0;
+ }
+
+ /*
+ ** Initialize screen specific data.
+ */
+ __glXScreenInit(screenInfo.numScreens);
+
+ /*
+ ** Initialize swap barrier support.
+ */
+ SwapBarrierInit();
+}
+
+/************************************************************************/
+
+Bool
+__glXCoreType(void)
+{
+ return 0;
+}
+
+/************************************************************************/
+
+void
+__glXFlushContextCache(void)
+{
+ __glXLastContext = 0;
+}
+
+/************************************************************************/
+
+/*
+** Top level dispatcher; all commands are executed from here down.
+*/
+static int
+__glXDispatch(ClientPtr client)
+{
+ REQUEST(xGLXSingleReq);
+ CARD8 opcode;
+ int (*proc) (__GLXclientState * cl, GLbyte * pc);
+ __GLXclientState *cl;
+
+ opcode = stuff->glxCode;
+ cl = __glXClients[client->index];
+ if (!cl) {
+ cl = calloc(1, sizeof(__GLXclientState));
+ __glXClients[client->index] = cl;
+ if (!cl) {
+ return BadAlloc;
+ }
+
+ cl->be_displays = calloc(screenInfo.numScreens, sizeof(Display *));
+ if (!cl->be_displays) {
+ free(cl);
+ return BadAlloc;
+ }
+ }
+
+ if (!cl->inUse) {
+ /*
+ ** This is first request from this client. Associate a resource
+ ** with the client so we will be notified when the client dies.
+ */
+ XID xid = FakeClientID(client->index);
+
+ if (!AddResource(xid, __glXClientRes, (pointer) (long) client->index)) {
+ return BadAlloc;
+ }
+ ResetClientState(client->index);
+ cl->largeCmdRequestsTotal = 0;
+ cl->inUse = GL_TRUE;
+ cl->client = client;
+ }
+
+ /*
+ ** Check for valid opcode.
+ */
+ if (opcode >= __GLX_SINGLE_TABLE_SIZE) {
+ return BadRequest;
+ }
+
+ /*
+ ** Use the opcode to index into the procedure table.
+ */
+ proc = __glXSingleTable[opcode];
+ return (*proc) (cl, (GLbyte *) stuff);
+}
+
+static int
+__glXSwapDispatch(ClientPtr client)
+{
+ REQUEST(xGLXSingleReq);
+ CARD8 opcode;
+ int (*proc) (__GLXclientState * cl, GLbyte * pc);
+ __GLXclientState *cl;
+
+ opcode = stuff->glxCode;
+ cl = __glXClients[client->index];
+ if (!cl) {
+ cl = calloc(1, sizeof(__GLXclientState));
+ __glXClients[client->index] = cl;
+ if (!cl) {
+ return BadAlloc;
+ }
+
+ cl->be_displays = calloc(screenInfo.numScreens, sizeof(Display *));
+ if (!cl->be_displays) {
+ free(cl);
+ return BadAlloc;
+ }
+ }
+
+ if (!cl->inUse) {
+ /*
+ ** This is first request from this client. Associate a resource
+ ** with the client so we will be notified when the client dies.
+ */
+ XID xid = FakeClientID(client->index);
+
+ if (!AddResource(xid, __glXClientRes, (pointer) (long) client->index)) {
+ return BadAlloc;
+ }
+ ResetClientState(client->index);
+ cl->inUse = GL_TRUE;
+ cl->client = client;
+ }
+
+ /*
+ ** Check for valid opcode.
+ */
+ if (opcode >= __GLX_SINGLE_TABLE_SIZE) {
+ return BadRequest;
+ }
+
+ /*
+ ** Use the opcode to index into the procedure table.
+ */
+ proc = __glXSwapSingleTable[opcode];
+ return (*proc) (cl, (GLbyte *) stuff);
+}
+
+int
+__glXNoSuchSingleOpcode(__GLXclientState * cl, GLbyte * pc)
+{
+ return BadRequest;
+}
+
+void
+__glXNoSuchRenderOpcode(GLbyte * pc)
+{
+ return;
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxext.h b/xorg-server/hw/dmx/glxProxy/glxext.h
index 3e3e5b7f3..881152d1c 100644
--- a/xorg-server/hw/dmx/glxProxy/glxext.h
+++ b/xorg-server/hw/dmx/glxProxy/glxext.h
@@ -1,78 +1,71 @@
-#ifndef _glxext_h_
-#define _glxext_h_
-
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * 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 including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-/*
- * Added by VA Linux for XFree86 4.0.x
- */
-typedef struct {
- int type;
- void (*resetExtension)(void);
- Bool (*initVisuals)(
- VisualPtr * visualp,
- DepthPtr * depthp,
- int * nvisualp,
- int * ndepthp,
- int * rootDepthp,
- VisualID * defaultVisp,
- unsigned long sizes,
- int bitsPerRGB
- );
- void (*setVisualConfigs)(
- int nconfigs,
- __GLXvisualConfig *configs,
- void **privates
- );
-} __GLXextensionInfo;
-
-extern GLboolean __glXFreeContext(__GLXcontext *glxc);
-extern void __glXFlushContextCache(void);
-
-extern void __glXFreeGLXWindow(__glXWindow *pGlxWindow);
-extern void __glXFreeGLXPixmap( __GLXpixmap *pGlxPixmap );
-
-extern void __glXNoSuchRenderOpcode(GLbyte*);
-extern int __glXNoSuchSingleOpcode(__GLXclientState*, GLbyte*);
-extern void __glXErrorCallBack(GLenum code);
-extern void __glXClearErrorOccured(void);
-extern GLboolean __glXErrorOccured(void);
-extern void __glXResetLargeCommandStatus(__GLXclientState*);
-
-extern int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc);
-extern int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, char *pc);
-
-extern void GlxExtensionInit(void);
-
-extern Bool __glXCoreType(void);
-
-#endif /* _glxext_h_ */
-
+#ifndef _glxext_h_
+#define _glxext_h_
+
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * 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 including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * 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
+ * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+/*
+ * Added by VA Linux for XFree86 4.0.x
+ */
+typedef struct {
+ int type;
+ void (*resetExtension) (void);
+ Bool (*initVisuals) (VisualPtr * visualp,
+ DepthPtr * depthp,
+ int *nvisualp,
+ int *ndepthp,
+ int *rootDepthp,
+ VisualID * defaultVisp,
+ unsigned long sizes, int bitsPerRGB);
+ void (*setVisualConfigs) (int nconfigs,
+ __GLXvisualConfig * configs, void **privates);
+} __GLXextensionInfo;
+
+extern GLboolean __glXFreeContext(__GLXcontext * glxc);
+extern void __glXFlushContextCache(void);
+
+extern void __glXFreeGLXWindow(__glXWindow * pGlxWindow);
+extern void __glXFreeGLXPixmap(__GLXpixmap * pGlxPixmap);
+
+extern void __glXNoSuchRenderOpcode(GLbyte *);
+extern int __glXNoSuchSingleOpcode(__GLXclientState *, GLbyte *);
+extern void __glXErrorCallBack(GLenum code);
+extern void __glXClearErrorOccured(void);
+extern GLboolean __glXErrorOccured(void);
+extern void __glXResetLargeCommandStatus(__GLXclientState *);
+
+extern int __glXQueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc);
+extern int __glXSwapQueryContextInfoEXT(__GLXclientState * cl, char *pc);
+
+extern void GlxExtensionInit(void);
+
+extern Bool __glXCoreType(void);
+
+#endif /* _glxext_h_ */
diff --git a/xorg-server/hw/dmx/glxProxy/glxfbconfig.c b/xorg-server/hw/dmx/glxProxy/glxfbconfig.c
index 3611cf61e..2f46bd07a 100644
--- a/xorg-server/hw/dmx/glxProxy/glxfbconfig.c
+++ b/xorg-server/hw/dmx/glxProxy/glxfbconfig.c
@@ -1,106 +1,106 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * 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 including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#include "glxfbconfig.h"
-
-int AreFBConfigsMatch( __GLXFBConfig *c1, __GLXFBConfig *c2 )
-{
- int match;
-
- match = (
- (c1->visualType == c2->visualType) &&
- (c1->transparentType == c2->transparentType) &&
- (c1->transparentRed == c2->transparentRed) &&
- (c1->transparentGreen == c2->transparentGreen) &&
- (c1->transparentBlue == c2->transparentBlue) &&
- (c1->transparentAlpha == c2->transparentAlpha) &&
- (c1->transparentIndex == c2->transparentIndex) &&
- (c1->visualCaveat == c2->visualCaveat) &&
- (c1->drawableType == c2->drawableType) &&
- (c1->renderType == c2->renderType) &&
-#if 0
- (c1->maxPbufferWidth == c2->maxPbufferWidth) &&
- (c1->maxPbufferHeight == c2->maxPbufferHeight) &&
- (c1->maxPbufferPixels == c2->maxPbufferPixels) &&
- (c1->optimalPbufferWidth == c2->optimalPbufferWidth) &&
- (c1->optimalPbufferHeight == c2->optimalPbufferHeight) &&
-#endif
- (c1->visualSelectGroup == c2->visualSelectGroup) &&
- (c1->rgbMode == c2->rgbMode) &&
- (c1->colorIndexMode == c2->colorIndexMode) &&
- (c1->doubleBufferMode == c2->doubleBufferMode) &&
- (c1->stereoMode == c2->stereoMode) &&
- (c1->haveAccumBuffer == c2->haveAccumBuffer) &&
- (c1->haveDepthBuffer == c2->haveDepthBuffer) &&
- (c1->haveStencilBuffer == c2->haveStencilBuffer) &&
- (c1->accumRedBits == c2->accumRedBits) &&
- (c1->accumGreenBits == c2->accumGreenBits) &&
- (c1->accumBlueBits == c2->accumBlueBits) &&
- (c1->accumAlphaBits == c2->accumAlphaBits) &&
- (c1->depthBits == c2->depthBits) &&
- (c1->stencilBits == c2->stencilBits) &&
- (c1->indexBits == c2->indexBits) &&
- (c1->redBits == c2->redBits) &&
- (c1->greenBits == c2->greenBits) &&
- (c1->blueBits == c2->blueBits) &&
- (c1->alphaBits == c2->alphaBits) &&
- (c1->redMask == c2->redMask) &&
- (c1->greenMask == c2->greenMask) &&
- (c1->blueMask == c2->blueMask) &&
- (c1->alphaMask == c2->alphaMask) &&
- (c1->multiSampleSize == c2->multiSampleSize) &&
- (c1->nMultiSampleBuffers == c2->nMultiSampleBuffers) &&
- (c1->maxAuxBuffers == c2->maxAuxBuffers) &&
- (c1->level == c2->level) &&
- (c1->extendedRange == c2->extendedRange) &&
- (c1->minRed == c2->minRed) &&
- (c1->maxRed == c2->maxRed) &&
- (c1->minGreen == c2->minGreen) &&
- (c1->maxGreen == c2->maxGreen) &&
- (c1->minBlue == c2->minBlue) &&
- (c1->maxBlue == c2->maxBlue) &&
- (c1->minAlpha == c2->minAlpha) &&
- (c1->maxAlpha == c2->maxAlpha)
- );
-
- return match;
-}
-
-__GLXFBConfig *FindMatchingFBConfig( __GLXFBConfig *c, __GLXFBConfig *configs, int nconfigs )
-{
- int i;
-
- for (i=0; i<nconfigs; i++) {
- if ( AreFBConfigsMatch( c, configs + i ) )
- return configs + i;
- }
-
- return 0;
-}
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * 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 including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * 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
+ * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#include "glxfbconfig.h"
+
+int
+AreFBConfigsMatch(__GLXFBConfig * c1, __GLXFBConfig * c2)
+{
+ int match;
+
+ match = ((c1->visualType == c2->visualType) &&
+ (c1->transparentType == c2->transparentType) &&
+ (c1->transparentRed == c2->transparentRed) &&
+ (c1->transparentGreen == c2->transparentGreen) &&
+ (c1->transparentBlue == c2->transparentBlue) &&
+ (c1->transparentAlpha == c2->transparentAlpha) &&
+ (c1->transparentIndex == c2->transparentIndex) &&
+ (c1->visualCaveat == c2->visualCaveat) &&
+ (c1->drawableType == c2->drawableType) &&
+ (c1->renderType == c2->renderType) &&
+#if 0
+ (c1->maxPbufferWidth == c2->maxPbufferWidth) &&
+ (c1->maxPbufferHeight == c2->maxPbufferHeight) &&
+ (c1->maxPbufferPixels == c2->maxPbufferPixels) &&
+ (c1->optimalPbufferWidth == c2->optimalPbufferWidth) &&
+ (c1->optimalPbufferHeight == c2->optimalPbufferHeight) &&
+#endif
+ (c1->visualSelectGroup == c2->visualSelectGroup) &&
+ (c1->rgbMode == c2->rgbMode) &&
+ (c1->colorIndexMode == c2->colorIndexMode) &&
+ (c1->doubleBufferMode == c2->doubleBufferMode) &&
+ (c1->stereoMode == c2->stereoMode) &&
+ (c1->haveAccumBuffer == c2->haveAccumBuffer) &&
+ (c1->haveDepthBuffer == c2->haveDepthBuffer) &&
+ (c1->haveStencilBuffer == c2->haveStencilBuffer) &&
+ (c1->accumRedBits == c2->accumRedBits) &&
+ (c1->accumGreenBits == c2->accumGreenBits) &&
+ (c1->accumBlueBits == c2->accumBlueBits) &&
+ (c1->accumAlphaBits == c2->accumAlphaBits) &&
+ (c1->depthBits == c2->depthBits) &&
+ (c1->stencilBits == c2->stencilBits) &&
+ (c1->indexBits == c2->indexBits) &&
+ (c1->redBits == c2->redBits) &&
+ (c1->greenBits == c2->greenBits) &&
+ (c1->blueBits == c2->blueBits) &&
+ (c1->alphaBits == c2->alphaBits) &&
+ (c1->redMask == c2->redMask) &&
+ (c1->greenMask == c2->greenMask) &&
+ (c1->blueMask == c2->blueMask) &&
+ (c1->alphaMask == c2->alphaMask) &&
+ (c1->multiSampleSize == c2->multiSampleSize) &&
+ (c1->nMultiSampleBuffers == c2->nMultiSampleBuffers) &&
+ (c1->maxAuxBuffers == c2->maxAuxBuffers) &&
+ (c1->level == c2->level) &&
+ (c1->extendedRange == c2->extendedRange) &&
+ (c1->minRed == c2->minRed) &&
+ (c1->maxRed == c2->maxRed) &&
+ (c1->minGreen == c2->minGreen) &&
+ (c1->maxGreen == c2->maxGreen) &&
+ (c1->minBlue == c2->minBlue) &&
+ (c1->maxBlue == c2->maxBlue) &&
+ (c1->minAlpha == c2->minAlpha) && (c1->maxAlpha == c2->maxAlpha)
+ );
+
+ return match;
+}
+
+__GLXFBConfig *
+FindMatchingFBConfig(__GLXFBConfig * c, __GLXFBConfig * configs, int nconfigs)
+{
+ int i;
+
+ for (i = 0; i < nconfigs; i++) {
+ if (AreFBConfigsMatch(c, configs + i))
+ return configs + i;
+ }
+
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxfbconfig.h b/xorg-server/hw/dmx/glxProxy/glxfbconfig.h
index c5e94043b..6626410d9 100644
--- a/xorg-server/hw/dmx/glxProxy/glxfbconfig.h
+++ b/xorg-server/hw/dmx/glxProxy/glxfbconfig.h
@@ -32,7 +32,8 @@
#include <GL/glxint.h>
-int AreFBConfigsMatch( __GLXFBConfig *c1, __GLXFBConfig *c2 );
-__GLXFBConfig *FindMatchingFBConfig( __GLXFBConfig *c, __GLXFBConfig *configs, int nconfigs );
+int AreFBConfigsMatch(__GLXFBConfig * c1, __GLXFBConfig * c2);
+__GLXFBConfig *FindMatchingFBConfig(__GLXFBConfig * c, __GLXFBConfig * configs,
+ int nconfigs);
#endif
diff --git a/xorg-server/hw/dmx/glxProxy/glxscreens.c b/xorg-server/hw/dmx/glxProxy/glxscreens.c
index baa4a65a7..f725bd138 100644
--- a/xorg-server/hw/dmx/glxProxy/glxscreens.c
+++ b/xorg-server/hw/dmx/glxProxy/glxscreens.c
@@ -49,285 +49,296 @@ __GLXscreenInfo *__glXActiveScreens;
GLint __glXNumActiveScreens;
__GLXFBConfig **__glXFBConfigs;
-int __glXNumFBConfigs;
+int __glXNumFBConfigs;
static char GLXServerVendorName[] = "SGI DMX/glxProxy";
static char GLXServerVersion[64];
static char GLXServerExtensions[] =
- "GLX_EXT_visual_info "
- "GLX_EXT_visual_rating "
- "GLX_EXT_import_context "
- "GLX_SGIX_fbconfig "
- "GLX_SGI_make_current_read "
- "GLX_SGI_swap_control "
- ;
+ "GLX_EXT_visual_info "
+ "GLX_EXT_visual_rating "
+ "GLX_EXT_import_context "
+ "GLX_SGIX_fbconfig " "GLX_SGI_make_current_read " "GLX_SGI_swap_control ";
static char ExtensionsString[1024];
-static void CalcServerVersionAndExtensions( void )
+static void
+CalcServerVersionAndExtensions(void)
{
- int s;
- xGLXQueryVersionReq *req;
- xGLXQueryVersionReply reply;
- char **be_extensions;
- char *ext;
- char *denied_extensions;
-
- /*
- * set the server glx version to be the minimum version
- * supported by all back-end servers
- */
- __glXVersionMajor = 0;
- __glXVersionMinor = 0;
- for (s=0; s<__glXNumActiveScreens; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = dmxScreen->beDisplay;
-
- /* Send the glXQueryVersion request */
- LockDisplay(dpy);
- GetReq(GLXQueryVersion,req);
- req->reqType = dmxScreen->glxMajorOpcode;
- req->glxCode = X_GLXQueryVersion;
- req->majorVersion = GLX_SERVER_MAJOR_VERSION;
- req->minorVersion = GLX_SERVER_MINOR_VERSION;
- _XReply(dpy, (xReply*) &reply, 0, False);
- UnlockDisplay(dpy);
- SyncHandle();
-
- if (s == 0) {
- __glXVersionMajor = reply.majorVersion;
- __glXVersionMinor = reply.minorVersion;
- }
- else {
- if (reply.majorVersion < __glXVersionMajor) {
- __glXVersionMajor = reply.majorVersion;
- __glXVersionMinor = reply.minorVersion;
- }
- else if ( (reply.majorVersion == __glXVersionMajor) &&
- (reply.minorVersion < __glXVersionMinor) ) {
- __glXVersionMinor = reply.minorVersion;
- }
- }
-
- }
-
- if (GLX_SERVER_MAJOR_VERSION < __glXVersionMajor) {
- __glXVersionMajor = GLX_SERVER_MAJOR_VERSION;
- __glXVersionMinor = GLX_SERVER_MINOR_VERSION;
- }
- else if ( (GLX_SERVER_MAJOR_VERSION == __glXVersionMajor) &&
- (GLX_SERVER_MINOR_VERSION < __glXVersionMinor) ) {
- __glXVersionMinor = GLX_SERVER_MINOR_VERSION;
- }
-
- snprintf(GLXServerVersion, sizeof(GLXServerVersion),
+ int s;
+ xGLXQueryVersionReq *req;
+ xGLXQueryVersionReply reply;
+ char **be_extensions;
+ char *ext;
+ char *denied_extensions;
+
+ /*
+ * set the server glx version to be the minimum version
+ * supported by all back-end servers
+ */
+ __glXVersionMajor = 0;
+ __glXVersionMinor = 0;
+ for (s = 0; s < __glXNumActiveScreens; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = dmxScreen->beDisplay;
+
+ /* Send the glXQueryVersion request */
+ LockDisplay(dpy);
+ GetReq(GLXQueryVersion, req);
+ req->reqType = dmxScreen->glxMajorOpcode;
+ req->glxCode = X_GLXQueryVersion;
+ req->majorVersion = GLX_SERVER_MAJOR_VERSION;
+ req->minorVersion = GLX_SERVER_MINOR_VERSION;
+ _XReply(dpy, (xReply *) & reply, 0, False);
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ if (s == 0) {
+ __glXVersionMajor = reply.majorVersion;
+ __glXVersionMinor = reply.minorVersion;
+ }
+ else {
+ if (reply.majorVersion < __glXVersionMajor) {
+ __glXVersionMajor = reply.majorVersion;
+ __glXVersionMinor = reply.minorVersion;
+ }
+ else if ((reply.majorVersion == __glXVersionMajor) &&
+ (reply.minorVersion < __glXVersionMinor)) {
+ __glXVersionMinor = reply.minorVersion;
+ }
+ }
+
+ }
+
+ if (GLX_SERVER_MAJOR_VERSION < __glXVersionMajor) {
+ __glXVersionMajor = GLX_SERVER_MAJOR_VERSION;
+ __glXVersionMinor = GLX_SERVER_MINOR_VERSION;
+ }
+ else if ((GLX_SERVER_MAJOR_VERSION == __glXVersionMajor) &&
+ (GLX_SERVER_MINOR_VERSION < __glXVersionMinor)) {
+ __glXVersionMinor = GLX_SERVER_MINOR_VERSION;
+ }
+
+ snprintf(GLXServerVersion, sizeof(GLXServerVersion),
"%d.%d DMX %d back-end server(s)",
- __glXVersionMajor, __glXVersionMinor, __glXNumActiveScreens );
- /*
- * set the ExtensionsString to the minimum extensions string
- */
- ExtensionsString[0] = '\0';
-
- /*
- * read extensions strings of all back-end servers
- */
- be_extensions = (char **)malloc( __glXNumActiveScreens * sizeof(char *) );
- if (!be_extensions)
- return;
-
- for (s=0; s<__glXNumActiveScreens; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = dmxScreen->beDisplay;
- xGLXQueryServerStringReq *req;
- xGLXQueryServerStringReply reply;
- int length, numbytes, slop;
-
- /* Send the glXQueryServerString request */
- LockDisplay(dpy);
- GetReq(GLXQueryServerString,req);
- req->reqType = dmxScreen->glxMajorOpcode;
- req->glxCode = X_GLXQueryServerString;
- req->screen = DefaultScreen(dpy);
- req->name = GLX_EXTENSIONS;
- _XReply(dpy, (xReply*) &reply, 0, False);
-
- length = (int)reply.length;
- numbytes = (int)reply.n;
- slop = numbytes * __GLX_SIZE_INT8 & 3;
- be_extensions[s] = (char *)malloc(numbytes);
- if (!be_extensions[s]) {
- /* Throw data on the floor */
- _XEatData(dpy, length);
- } else {
- _XRead(dpy, (char *)be_extensions[s], numbytes);
- if (slop) _XEatData(dpy,4-slop);
- }
- UnlockDisplay(dpy);
- SyncHandle();
- }
-
- /*
- * extensions string will include only extensions that our
- * server supports as well as all back-end servers supports.
- * extensions that are in the DMX_DENY_EXTENSIONS string will
- * not be supported.
- */
- denied_extensions = getenv("DMX_DENY_GLX_EXTENSIONS");
- ext = strtok(GLXServerExtensions, " ");
- while( ext ) {
- int supported = 1;
-
- if (denied_extensions && strstr(denied_extensions, ext)) {
- supported = 0;
- }
- else {
- for (s=0; s<__glXNumActiveScreens && supported; s++) {
- if ( !strstr(be_extensions[s], ext) ) {
- supported = 0;
- }
- }
- }
-
- if (supported) {
- strcat(ExtensionsString, ext);
- strcat(ExtensionsString, " ");
- }
-
- ext = strtok(NULL, " ");
- }
-
- /*
- * release temporary storage
- */
- for (s=0; s<__glXNumActiveScreens; s++) {
- free(be_extensions[s]);
- }
- free( be_extensions );
-
- if (dmxGLXSwapGroupSupport) {
- if (!denied_extensions ||
- !strstr(denied_extensions, "GLX_SGIX_swap_group")) {
- strcat(ExtensionsString, "GLX_SGIX_swap_group");
- if (!denied_extensions ||
- !strstr(denied_extensions, "GLX_SGIX_swap_barrier")) {
- strcat(ExtensionsString, " GLX_SGIX_swap_barrier");
- }
- }
- }
+ __glXVersionMajor, __glXVersionMinor, __glXNumActiveScreens);
+ /*
+ * set the ExtensionsString to the minimum extensions string
+ */
+ ExtensionsString[0] = '\0';
+
+ /*
+ * read extensions strings of all back-end servers
+ */
+ be_extensions = (char **) malloc(__glXNumActiveScreens * sizeof(char *));
+ if (!be_extensions)
+ return;
+
+ for (s = 0; s < __glXNumActiveScreens; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = dmxScreen->beDisplay;
+ xGLXQueryServerStringReq *req;
+ xGLXQueryServerStringReply reply;
+ int length, numbytes, slop;
+
+ /* Send the glXQueryServerString request */
+ LockDisplay(dpy);
+ GetReq(GLXQueryServerString, req);
+ req->reqType = dmxScreen->glxMajorOpcode;
+ req->glxCode = X_GLXQueryServerString;
+ req->screen = DefaultScreen(dpy);
+ req->name = GLX_EXTENSIONS;
+ _XReply(dpy, (xReply *) & reply, 0, False);
+
+ length = (int) reply.length;
+ numbytes = (int) reply.n;
+ slop = numbytes * __GLX_SIZE_INT8 & 3;
+ be_extensions[s] = (char *) malloc(numbytes);
+ if (!be_extensions[s]) {
+ /* Throw data on the floor */
+ _XEatData(dpy, length);
+ }
+ else {
+ _XRead(dpy, (char *) be_extensions[s], numbytes);
+ if (slop)
+ _XEatData(dpy, 4 - slop);
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ }
+
+ /*
+ * extensions string will include only extensions that our
+ * server supports as well as all back-end servers supports.
+ * extensions that are in the DMX_DENY_EXTENSIONS string will
+ * not be supported.
+ */
+ denied_extensions = getenv("DMX_DENY_GLX_EXTENSIONS");
+ ext = strtok(GLXServerExtensions, " ");
+ while (ext) {
+ int supported = 1;
+
+ if (denied_extensions && strstr(denied_extensions, ext)) {
+ supported = 0;
+ }
+ else {
+ for (s = 0; s < __glXNumActiveScreens && supported; s++) {
+ if (!strstr(be_extensions[s], ext)) {
+ supported = 0;
+ }
+ }
+ }
+
+ if (supported) {
+ strcat(ExtensionsString, ext);
+ strcat(ExtensionsString, " ");
+ }
+
+ ext = strtok(NULL, " ");
+ }
+
+ /*
+ * release temporary storage
+ */
+ for (s = 0; s < __glXNumActiveScreens; s++) {
+ free(be_extensions[s]);
+ }
+ free(be_extensions);
+
+ if (dmxGLXSwapGroupSupport) {
+ if (!denied_extensions ||
+ !strstr(denied_extensions, "GLX_SGIX_swap_group")) {
+ strcat(ExtensionsString, "GLX_SGIX_swap_group");
+ if (!denied_extensions ||
+ !strstr(denied_extensions, "GLX_SGIX_swap_barrier")) {
+ strcat(ExtensionsString, " GLX_SGIX_swap_barrier");
+ }
+ }
+ }
}
-void __glXScreenInit(GLint numscreens)
+void
+__glXScreenInit(GLint numscreens)
{
- int s;
- int c;
- DMXScreenInfo *dmxScreen0 = &dmxScreens[0];
- __glXNumActiveScreens = numscreens;
-
+ int s;
+ int c;
+ DMXScreenInfo *dmxScreen0 = &dmxScreens[0];
- CalcServerVersionAndExtensions();
+ __glXNumActiveScreens = numscreens;
+ CalcServerVersionAndExtensions();
- __glXFBConfigs = NULL;
- __glXNumFBConfigs = 0;
+ __glXFBConfigs = NULL;
+ __glXNumFBConfigs = 0;
- if ( (__glXVersionMajor == 1 && __glXVersionMinor >= 3) ||
+ if ((__glXVersionMajor == 1 && __glXVersionMinor >= 3) ||
(__glXVersionMajor > 1) ||
- ( strstr(ExtensionsString, "GLX_SGIX_fbconfig") ) ) {
-
- /*
- // Initialize FBConfig info.
- // find the set of FBConfigs that are present on all back-end
- // servers - only those configs will be supported
- */
- __glXFBConfigs = (__GLXFBConfig **)malloc( dmxScreen0->numFBConfigs *
- (numscreens+1) * sizeof(__GLXFBConfig *) );
- __glXNumFBConfigs = 0;
-
- for (c=0; c<dmxScreen0->numFBConfigs; c++) {
- __GLXFBConfig *cfg = NULL;
-
- if (numscreens > 1) {
- for (s=1; s<numscreens; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
-
- cfg = FindMatchingFBConfig( &dmxScreen0->fbconfigs[c],
- dmxScreen->fbconfigs,
- dmxScreen->numFBConfigs );
- __glXFBConfigs[ __glXNumFBConfigs * (numscreens+1) + s + 1 ] = cfg;
- if (!cfg) {
- dmxLog(dmxInfo,"screen0 FBConfig 0x%x is missing on screen#%d\n", dmxScreen0->fbconfigs[c].id, s);
- break;
- }
- else {
- dmxLog(dmxInfo,"screen0 FBConfig 0x%x matched to 0x%x on screen#%d\n", dmxScreen0->fbconfigs[c].id, cfg->id, s);
- }
- }
- }
- else {
- cfg = &dmxScreen0->fbconfigs[c];
- }
-
- if (cfg) {
-
- /* filter out overlay visuals */
- if (cfg->level == 0) {
- __GLXFBConfig *proxy_cfg;
-
- __glXFBConfigs[ __glXNumFBConfigs * (numscreens+1) + 1 ] =
- &dmxScreen0->fbconfigs[c];
-
- proxy_cfg = malloc( sizeof(__GLXFBConfig) );
- memcpy( proxy_cfg, cfg, sizeof(__GLXFBConfig) );
- proxy_cfg->id = FakeClientID(0);
- /* visual will be associated later in __glXGetFBConfigs */
- proxy_cfg->associatedVisualId = (unsigned int)-1;
-
- __glXFBConfigs[ __glXNumFBConfigs * (numscreens+1) + 0 ] = proxy_cfg;
-
- __glXNumFBConfigs++;
- }
-
- }
-
- }
+ (strstr(ExtensionsString, "GLX_SGIX_fbconfig"))) {
+
+ /*
+ // Initialize FBConfig info.
+ // find the set of FBConfigs that are present on all back-end
+ // servers - only those configs will be supported
+ */
+ __glXFBConfigs = (__GLXFBConfig **) malloc(dmxScreen0->numFBConfigs *
+ (numscreens +
+ 1) *
+ sizeof(__GLXFBConfig *));
+ __glXNumFBConfigs = 0;
+
+ for (c = 0; c < dmxScreen0->numFBConfigs; c++) {
+ __GLXFBConfig *cfg = NULL;
+
+ if (numscreens > 1) {
+ for (s = 1; s < numscreens; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+
+ cfg = FindMatchingFBConfig(&dmxScreen0->fbconfigs[c],
+ dmxScreen->fbconfigs,
+ dmxScreen->numFBConfigs);
+ __glXFBConfigs[__glXNumFBConfigs * (numscreens + 1) + s +
+ 1] = cfg;
+ if (!cfg) {
+ dmxLog(dmxInfo,
+ "screen0 FBConfig 0x%x is missing on screen#%d\n",
+ dmxScreen0->fbconfigs[c].id, s);
+ break;
+ }
+ else {
+ dmxLog(dmxInfo,
+ "screen0 FBConfig 0x%x matched to 0x%x on screen#%d\n",
+ dmxScreen0->fbconfigs[c].id, cfg->id, s);
+ }
+ }
+ }
+ else {
+ cfg = &dmxScreen0->fbconfigs[c];
+ }
+
+ if (cfg) {
+
+ /* filter out overlay visuals */
+ if (cfg->level == 0) {
+ __GLXFBConfig *proxy_cfg;
+
+ __glXFBConfigs[__glXNumFBConfigs * (numscreens + 1) + 1] =
+ &dmxScreen0->fbconfigs[c];
+
+ proxy_cfg = malloc(sizeof(__GLXFBConfig));
+ memcpy(proxy_cfg, cfg, sizeof(__GLXFBConfig));
+ proxy_cfg->id = FakeClientID(0);
+ /* visual will be associated later in __glXGetFBConfigs */
+ proxy_cfg->associatedVisualId = (unsigned int) -1;
+
+ __glXFBConfigs[__glXNumFBConfigs * (numscreens + 1) + 0] =
+ proxy_cfg;
+
+ __glXNumFBConfigs++;
+ }
+
+ }
+
+ }
}
}
-void __glXScreenReset(void)
+void
+__glXScreenReset(void)
{
- __glXNumActiveScreens = 0;
+ __glXNumActiveScreens = 0;
}
-char *__glXGetServerString( unsigned int name )
+char *
+__glXGetServerString(unsigned int name)
{
- char *ret = NULL;
+ char *ret = NULL;
- switch( name) {
+ switch (name) {
- case GLX_VENDOR:
- ret = GLXServerVendorName;
- break;
+ case GLX_VENDOR:
+ ret = GLXServerVendorName;
+ break;
- case GLX_VERSION:
- ret = GLXServerVersion;
- break;
+ case GLX_VERSION:
+ ret = GLXServerVersion;
+ break;
- case GLX_EXTENSIONS:
- ret = ExtensionsString;
- break;
+ case GLX_EXTENSIONS:
+ ret = ExtensionsString;
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
- return ret;
+ return ret;
}
-int glxIsExtensionSupported( char *ext )
+int
+glxIsExtensionSupported(char *ext)
{
- return( strstr(ExtensionsString, ext) != NULL );
+ return (strstr(ExtensionsString, ext) != NULL);
}
diff --git a/xorg-server/hw/dmx/glxProxy/glxserver.h b/xorg-server/hw/dmx/glxProxy/glxserver.h
index 03e95b865..ad9496619 100644
--- a/xorg-server/hw/dmx/glxProxy/glxserver.h
+++ b/xorg-server/hw/dmx/glxProxy/glxserver.h
@@ -41,8 +41,7 @@
#include <resource.h>
#include <scrnintstr.h>
-
-#define GL_GLEXT_PROTOTYPES /* we want prototypes */
+#define GL_GLEXT_PROTOTYPES /* we want prototypes */
#include <GL/gl.h>
#include <GL/glxproto.h>
#include <GL/glxint.h>
@@ -52,7 +51,6 @@
#include "glxcontext.h"
#include "glxerror.h"
-
#define GLX_SERVER_MAJOR_VERSION 1
#define GLX_SERVER_MINOR_VERSION 3
@@ -84,14 +82,15 @@ extern GLint __glXNumActiveScreens;
** The last context used (from the server's persective) is cached.
*/
extern __GLXcontext *__glXLastContext;
-extern __GLXcontext *__glXForceCurrent(__GLXclientState*, GLXContextTag, int*);
+extern __GLXcontext *__glXForceCurrent(__GLXclientState *, GLXContextTag,
+ int *);
/************************************************************************/
typedef struct {
- int elem_size; /* element size in bytes */
- int nelems; /* number of elements to swap */
- void (*swapfunc)(GLbyte *pc);
+ int elem_size; /* element size in bytes */
+ int nelems; /* number of elements to swap */
+ void (*swapfunc) (GLbyte * pc);
} __GLXRenderSwapInfo;
/*
@@ -99,20 +98,20 @@ typedef struct {
*/
struct __GLXclientStateRec {
/*
- ** Whether this structure is currently being used to support a client.
- */
+ ** Whether this structure is currently being used to support a client.
+ */
Bool inUse;
/*
- ** Buffer for returned data.
- */
+ ** Buffer for returned data.
+ */
GLbyte *returnBuf;
GLint returnBufSize;
/*
- ** Keep a list of all the contexts that are current for this client's
- ** threads.
- */
+ ** Keep a list of all the contexts that are current for this client's
+ ** threads.
+ */
__GLXcontext **currentContexts;
DrawablePtr *currentDrawables;
GLint numCurrentContexts;
@@ -124,18 +123,18 @@ struct __GLXclientStateRec {
int GLClientminorVersion;
char *GLClientextensions;
- GLXContextTag *be_currentCTag;
+ GLXContextTag *be_currentCTag;
Display **be_displays;
/*
- ** Keep track of large rendering commands, which span multiple requests.
- */
- GLint largeCmdBytesSoFar; /* bytes received so far */
- GLint largeCmdBytesTotal; /* total bytes expected */
- GLint largeCmdRequestsSoFar; /* requests received so far */
- GLint largeCmdRequestsTotal; /* total requests expected */
- void (*largeCmdRequestsSwapProc)(GLbyte *);
- __GLXRenderSwapInfo *largeCmdRequestsSwap_info;
+ ** Keep track of large rendering commands, which span multiple requests.
+ */
+ GLint largeCmdBytesSoFar; /* bytes received so far */
+ GLint largeCmdBytesTotal; /* total bytes expected */
+ GLint largeCmdRequestsSoFar; /* requests received so far */
+ GLint largeCmdRequestsTotal; /* total requests expected */
+ void (*largeCmdRequestsSwapProc) (GLbyte *);
+ __GLXRenderSwapInfo *largeCmdRequestsSwap_info;
GLbyte *largeCmdBuf;
GLint largeCmdBufSize;
GLint largeCmdMaxReqDataSize;
@@ -149,9 +148,9 @@ extern __GLXclientState *__glXClients[];
/*
** Dispatch tables.
*/
-typedef void (*__GLXdispatchRenderProcPtr)(GLbyte *);
-typedef int (*__GLXdispatchSingleProcPtr)(__GLXclientState *, GLbyte *);
-typedef int (*__GLXdispatchVendorPrivProcPtr)(__GLXclientState *, GLbyte *);
+typedef void (*__GLXdispatchRenderProcPtr) (GLbyte *);
+typedef int (*__GLXdispatchSingleProcPtr) (__GLXclientState *, GLbyte *);
+typedef int (*__GLXdispatchVendorPrivProcPtr) (__GLXclientState *, GLbyte *);
extern __GLXdispatchSingleProcPtr __glXSingleTable[];
extern __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[];
extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[];
@@ -163,7 +162,7 @@ extern __GLXRenderSwapInfo __glXSwapRenderTable_EXT[];
/*
* Dispatch for GLX commands.
*/
-typedef int (*__GLXprocPtr)(__GLXclientState *, char *pc);
+typedef int (*__GLXprocPtr) (__GLXclientState *, char *pc);
extern __GLXprocPtr __glXProcTable[];
/*
@@ -171,7 +170,7 @@ extern __GLXprocPtr __glXProcTable[];
*/
typedef struct {
int bytes;
- int (*varsize)(GLbyte *pc, Bool swap);
+ int (*varsize) (GLbyte * pc, Bool swap);
} __GLXrenderSizeData;
extern __GLXrenderSizeData __glXRenderSizeTable[];
extern __GLXrenderSizeData __glXRenderSizeTable_EXT[];
@@ -194,37 +193,38 @@ extern RESTYPE __glXPbufferRes;
** Prototypes.
*/
-
extern char *__glXcombine_strings(const char *, const char *);
-extern void __glXDisp_DrawArrays(GLbyte*);
-extern void __glXDispSwap_DrawArrays(GLbyte*);
-
+extern void __glXDisp_DrawArrays(GLbyte *);
+extern void __glXDispSwap_DrawArrays(GLbyte *);
/*
** Routines for sending swapped replies.
*/
-extern void __glXSwapMakeCurrentReply(ClientPtr client,
- xGLXMakeCurrentReadSGIReply *reply);
+extern void __glXSwapMakeCurrentReply(ClientPtr client,
+ xGLXMakeCurrentReadSGIReply * reply);
-extern void __glXSwapIsDirectReply(ClientPtr client,
- xGLXIsDirectReply *reply);
+extern void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply);
extern void __glXSwapQueryVersionReply(ClientPtr client,
- xGLXQueryVersionReply *reply);
+ xGLXQueryVersionReply * reply);
extern void __glXSwapQueryContextInfoEXTReply(ClientPtr client,
- xGLXQueryContextInfoEXTReply *reply,
- int *buf);
+ xGLXQueryContextInfoEXTReply *
+ reply, int *buf);
extern void glxSwapQueryExtensionsStringReply(ClientPtr client,
- xGLXQueryExtensionsStringReply *reply, char *buf);
+ xGLXQueryExtensionsStringReply *
+ reply, char *buf);
extern void glxSwapQueryServerStringReply(ClientPtr client,
- xGLXQueryServerStringReply *reply, char *buf);
+ xGLXQueryServerStringReply * reply,
+ char *buf);
extern void __glXSwapQueryContextReply(ClientPtr client,
- xGLXQueryContextReply *reply, int *buf);
+ xGLXQueryContextReply * reply, int *buf);
extern void __glXSwapGetDrawableAttributesReply(ClientPtr client,
- xGLXGetDrawableAttributesReply *reply, int *buf);
+ xGLXGetDrawableAttributesReply *
+ reply, int *buf);
extern void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client,
- xGLXQueryMaxSwapBarriersSGIXReply *reply);
+ xGLXQueryMaxSwapBarriersSGIXReply
+ * reply);
/*
* Routines for computing the size of variably-sized rendering commands.
@@ -232,55 +232,54 @@ extern void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client,
extern int __glXTypeSize(GLenum enm);
extern int __glXImageSize(GLenum format, GLenum type, GLsizei w, GLsizei h,
- GLint rowLength, GLint skipRows, GLint alignment);
+ GLint rowLength, GLint skipRows, GLint alignment);
extern int __glXImage3DSize(GLenum format, GLenum type,
- GLsizei w, GLsizei h, GLsizei d,
- GLint imageHeight, GLint rowLength,
- GLint skipImages, GLint skipRows,
- GLint alignment);
-
-extern int __glXCallListsReqSize(GLbyte *pc, Bool swap);
-extern int __glXBitmapReqSize(GLbyte *pc, Bool swap);
-extern int __glXFogfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXFogivReqSize(GLbyte *pc, Bool swap);
-extern int __glXLightfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXLightivReqSize(GLbyte *pc, Bool swap);
-extern int __glXLightModelfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXLightModelivReqSize(GLbyte *pc, Bool swap);
-extern int __glXMaterialfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXMaterialivReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexParameterfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexParameterivReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexImage1DReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexImage2DReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexEnvfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexEnvivReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexGendvReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexGenfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexGenivReqSize(GLbyte *pc, Bool swap);
-extern int __glXMap1dReqSize(GLbyte *pc, Bool swap);
-extern int __glXMap1fReqSize(GLbyte *pc, Bool swap);
-extern int __glXMap2dReqSize(GLbyte *pc, Bool swap);
-extern int __glXMap2fReqSize(GLbyte *pc, Bool swap);
-extern int __glXPixelMapfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXPixelMapuivReqSize(GLbyte *pc, Bool swap);
-extern int __glXPixelMapusvReqSize(GLbyte *pc, Bool swap);
-extern int __glXDrawPixelsReqSize(GLbyte *pc, Bool swap);
-extern int __glXDrawArraysSize(GLbyte *pc, Bool swap);
-extern int __glXPrioritizeTexturesReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexSubImage1DReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexSubImage2DReqSize(GLbyte *pc, Bool swap);
-extern int __glXTexImage3DReqSize(GLbyte *pc, Bool swap );
-extern int __glXTexSubImage3DReqSize(GLbyte *pc, Bool swap);
-extern int __glXConvolutionFilter1DReqSize(GLbyte *pc, Bool swap);
-extern int __glXConvolutionFilter2DReqSize(GLbyte *pc, Bool swap);
-extern int __glXConvolutionParameterivReqSize(GLbyte *pc, Bool swap);
-extern int __glXConvolutionParameterfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXSeparableFilter2DReqSize(GLbyte *pc, Bool swap);
-extern int __glXColorTableReqSize(GLbyte *pc, Bool swap);
-extern int __glXColorSubTableReqSize(GLbyte *pc, Bool swap);
-extern int __glXColorTableParameterfvReqSize(GLbyte *pc, Bool swap);
-extern int __glXColorTableParameterivReqSize(GLbyte *pc, Bool swap);
+ GLsizei w, GLsizei h, GLsizei d,
+ GLint imageHeight, GLint rowLength,
+ GLint skipImages, GLint skipRows, GLint alignment);
+
+extern int __glXCallListsReqSize(GLbyte * pc, Bool swap);
+extern int __glXBitmapReqSize(GLbyte * pc, Bool swap);
+extern int __glXFogfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXFogivReqSize(GLbyte * pc, Bool swap);
+extern int __glXLightfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXLightivReqSize(GLbyte * pc, Bool swap);
+extern int __glXLightModelfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXLightModelivReqSize(GLbyte * pc, Bool swap);
+extern int __glXMaterialfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXMaterialivReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexParameterfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexParameterivReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexImage1DReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexImage2DReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexEnvfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexEnvivReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexGendvReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexGenfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexGenivReqSize(GLbyte * pc, Bool swap);
+extern int __glXMap1dReqSize(GLbyte * pc, Bool swap);
+extern int __glXMap1fReqSize(GLbyte * pc, Bool swap);
+extern int __glXMap2dReqSize(GLbyte * pc, Bool swap);
+extern int __glXMap2fReqSize(GLbyte * pc, Bool swap);
+extern int __glXPixelMapfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXPixelMapuivReqSize(GLbyte * pc, Bool swap);
+extern int __glXPixelMapusvReqSize(GLbyte * pc, Bool swap);
+extern int __glXDrawPixelsReqSize(GLbyte * pc, Bool swap);
+extern int __glXDrawArraysSize(GLbyte * pc, Bool swap);
+extern int __glXPrioritizeTexturesReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexSubImage1DReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexSubImage2DReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexImage3DReqSize(GLbyte * pc, Bool swap);
+extern int __glXTexSubImage3DReqSize(GLbyte * pc, Bool swap);
+extern int __glXConvolutionFilter1DReqSize(GLbyte * pc, Bool swap);
+extern int __glXConvolutionFilter2DReqSize(GLbyte * pc, Bool swap);
+extern int __glXConvolutionParameterivReqSize(GLbyte * pc, Bool swap);
+extern int __glXConvolutionParameterfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXSeparableFilter2DReqSize(GLbyte * pc, Bool swap);
+extern int __glXColorTableReqSize(GLbyte * pc, Bool swap);
+extern int __glXColorSubTableReqSize(GLbyte * pc, Bool swap);
+extern int __glXColorTableParameterfvReqSize(GLbyte * pc, Bool swap);
+extern int __glXColorTableParameterivReqSize(GLbyte * pc, Bool swap);
/*
* Routines for computing the size of returned data.
@@ -290,8 +289,8 @@ extern int __glXConvolutionParameterfvSize(GLenum pname);
extern int __glXColorTableParameterfvSize(GLenum pname);
extern int __glXColorTableParameterivSize(GLenum pname);
-extern void __glXFreeGLXWindow(__glXWindow *pGlxWindow);
-extern void __glXFreeGLXPbuffer(__glXPbuffer *pGlxPbuffer);
+extern void __glXFreeGLXWindow(__glXWindow * pGlxWindow);
+extern void __glXFreeGLXPbuffer(__glXPbuffer * pGlxPbuffer);
extern int __glXVersionMajor;
extern int __glXVersionMinor;
@@ -300,4 +299,4 @@ extern int __glXVersionMinor;
( (__glXVersionMajor > (major)) || \
((__glXVersionMajor == (major)) && (__glXVersionMinor >= (minor))) )
-#endif /* !__GLX_server_h__ */
+#endif /* !__GLX_server_h__ */
diff --git a/xorg-server/hw/dmx/glxProxy/glxsingle.c b/xorg-server/hw/dmx/glxProxy/glxsingle.c
index 33cc612a7..63786cf79 100644
--- a/xorg-server/hw/dmx/glxProxy/glxsingle.c
+++ b/xorg-server/hw/dmx/glxProxy/glxsingle.c
@@ -68,7 +68,7 @@
dpy->bufptr += SIZEOF(x##name##Req);\
dpy->request++
-#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
+#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
#define GetReqSingle(name, req) \
WORD64ALIGN\
if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\
@@ -79,100 +79,101 @@
dpy->request++
#endif
-#define X_GLXSingle 0 /* needed by GetReqExtra */
+#define X_GLXSingle 0 /* needed by GetReqExtra */
-extern Display *GetBackEndDisplay( __GLXclientState *cl, int s );
-extern int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s);
+extern Display *GetBackEndDisplay(__GLXclientState * cl, int s);
+extern int GetCurrentBackEndTag(__GLXclientState * cl, GLXContextTag tag,
+ int s);
static int swap_vec_element_size = 0;
-static void SendSwappedReply( ClientPtr client,
- xGLXSingleReply *reply,
- char *buf,
- int buf_size )
+static void
+SendSwappedReply(ClientPtr client,
+ xGLXSingleReply * reply, char *buf, int buf_size)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_SHORT(&reply->sequenceNumber);
- __GLX_SWAP_INT(&reply->length);
- __GLX_SWAP_INT(&reply->retval);
- __GLX_SWAP_INT(&reply->size);
-
- if ( (buf_size == 0) && (swap_vec_element_size > 0) ) {
- /*
- * the reply has single component - need to swap pad3
- */
- if (swap_vec_element_size == 2) {
- __GLX_SWAP_SHORT(&reply->pad3);
- }
- else if (swap_vec_element_size == 4) {
- __GLX_SWAP_INT(&reply->pad3);
- __GLX_SWAP_INT(&reply->pad4); /* some requests use also pad4
- * i.e GetConvolutionFilter
- */
- }
- else if (swap_vec_element_size == 8) {
- __GLX_SWAP_DOUBLE(&reply->pad3);
- }
- }
- else if ( (buf_size > 0) && (swap_vec_element_size > 0) ) {
- /*
- * the reply has vector of elements which needs to be swapped
- */
- int vsize = buf_size / swap_vec_element_size;
- char *p = buf;
- int i;
-
- for (i=0; i<vsize; i++) {
- if (swap_vec_element_size == 2) {
- __GLX_SWAP_SHORT(p);
- }
- else if (swap_vec_element_size == 4) {
- __GLX_SWAP_INT(p);
- }
- else if (swap_vec_element_size == 8) {
- __GLX_SWAP_DOUBLE(p);
- }
-
- p += swap_vec_element_size;
- }
-
- /*
- * swap pad words as well - for case that some single reply uses
- * them as well
- */
- __GLX_SWAP_INT(&reply->pad3);
- __GLX_SWAP_INT(&reply->pad4);
- __GLX_SWAP_INT(&reply->pad5);
- __GLX_SWAP_INT(&reply->pad6);
-
- }
-
- WriteToClient(client, sizeof(xGLXSingleReply),(char *)reply);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->retval);
+ __GLX_SWAP_INT(&reply->size);
+
+ if ((buf_size == 0) && (swap_vec_element_size > 0)) {
+ /*
+ * the reply has single component - need to swap pad3
+ */
+ if (swap_vec_element_size == 2) {
+ __GLX_SWAP_SHORT(&reply->pad3);
+ }
+ else if (swap_vec_element_size == 4) {
+ __GLX_SWAP_INT(&reply->pad3);
+ __GLX_SWAP_INT(&reply->pad4); /* some requests use also pad4
+ * i.e GetConvolutionFilter
+ */
+ }
+ else if (swap_vec_element_size == 8) {
+ __GLX_SWAP_DOUBLE(&reply->pad3);
+ }
+ }
+ else if ((buf_size > 0) && (swap_vec_element_size > 0)) {
+ /*
+ * the reply has vector of elements which needs to be swapped
+ */
+ int vsize = buf_size / swap_vec_element_size;
+ char *p = buf;
+ int i;
+
+ for (i = 0; i < vsize; i++) {
+ if (swap_vec_element_size == 2) {
+ __GLX_SWAP_SHORT(p);
+ }
+ else if (swap_vec_element_size == 4) {
+ __GLX_SWAP_INT(p);
+ }
+ else if (swap_vec_element_size == 8) {
+ __GLX_SWAP_DOUBLE(p);
+ }
+
+ p += swap_vec_element_size;
+ }
+
+ /*
+ * swap pad words as well - for case that some single reply uses
+ * them as well
+ */
+ __GLX_SWAP_INT(&reply->pad3);
+ __GLX_SWAP_INT(&reply->pad4);
+ __GLX_SWAP_INT(&reply->pad5);
+ __GLX_SWAP_INT(&reply->pad6);
+
+ }
+
+ WriteToClient(client, sizeof(xGLXSingleReply), (char *) reply);
if (buf_size > 0)
- WriteToClient(client, buf_size, (char *)buf);
+ WriteToClient(client, buf_size, (char *) buf);
}
-int __glXForwardSingleReq( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardSingleReq(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- xGLXSingleReq *be_req;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
+ xGLXSingleReq *be_req;
__GLXcontext *glxc;
- int from_screen = 0;
- int to_screen = 0;
- int buf_size;
- int s;
+ int from_screen = 0;
+ int to_screen = 0;
+ int buf_size;
+ int s;
glxc = __glXLookupContextByTag(cl, req->contextTag);
if (!glxc) {
- return 0;
+ return 0;
}
from_screen = to_screen = glxc->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
@@ -182,47 +183,48 @@ int __glXForwardSingleReq( __GLXclientState *cl, GLbyte *pc )
/*
* just forward the request to back-end server(s)
*/
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
-
- LockDisplay(dpy);
- GetReqSingle(GLXSingle,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = req->glxCode;
- be_req->length = req->length;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- if (buf_size > 0)
- _XSend(dpy, (const char *)pc, buf_size);
- UnlockDisplay(dpy);
- SyncHandle();
-
- if (req->glxCode == X_GLsop_Flush) {
- XFlush(dpy);
- }
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
+
+ LockDisplay(dpy);
+ GetReqSingle(GLXSingle, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *) pc, buf_size);
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ if (req->glxCode == X_GLsop_Flush) {
+ XFlush(dpy);
+ }
}
return Success;
}
-int __glXForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- xGLXSingleReq *be_req;
- xGLXSingleReply reply;
- xGLXSingleReply be_reply;
+ ClientPtr client = cl->client;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
+ xGLXSingleReq *be_req;
+ xGLXSingleReply reply;
+ xGLXSingleReply be_reply;
__GLXcontext *glxc;
- int buf_size;
- char *be_buf = NULL;
- int be_buf_size;
- DMXScreenInfo *dmxScreen;
- Display *dpy;
+ int buf_size;
+ char *be_buf = NULL;
+ int be_buf_size;
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
glxc = __glXLookupContextByTag(cl, req->contextTag);
if (!glxc) {
- return __glXBadContext;
+ return __glXBadContext;
}
pc += sz_xGLXSingleReq;
@@ -235,29 +237,30 @@ int __glXForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
* send the request to the first back-end server
*/
LockDisplay(dpy);
- GetReqSingle(GLXSingle,be_req);
+ GetReqSingle(GLXSingle, be_req);
be_req->reqType = dmxScreen->glxMajorOpcode;
be_req->glxCode = req->glxCode;
be_req->length = req->length;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,glxc->pScreen->myNum);
- if (buf_size > 0)
- _XSend(dpy, (const char *)pc, buf_size);
+ be_req->contextTag =
+ GetCurrentBackEndTag(cl, req->contextTag, glxc->pScreen->myNum);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *) pc, buf_size);
/*
* get the reply from the back-end server
*/
- _XReply(dpy, (xReply*) &be_reply, 0, False);
+ _XReply(dpy, (xReply *) & be_reply, 0, False);
be_buf_size = be_reply.length << 2;
if (be_buf_size > 0) {
- be_buf = (char *)malloc( be_buf_size );
- if (be_buf) {
- _XRead(dpy, be_buf, be_buf_size);
- }
- else {
- /* Throw data on the floor */
- _XEatData(dpy, be_buf_size);
- return BadAlloc;
- }
+ be_buf = (char *) malloc(be_buf_size);
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ return BadAlloc;
+ }
}
UnlockDisplay(dpy);
@@ -275,47 +278,49 @@ int __glXForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
reply.pad4 = be_reply.pad4;
if (client->swapped) {
- SendSwappedReply( client, &reply, be_buf, be_buf_size );
+ SendSwappedReply(client, &reply, be_buf, be_buf_size);
}
else {
- WriteToClient(client, sizeof(xGLXSingleReply),(char *)&reply);
- if (be_buf_size > 0)
- WriteToClient(client, be_buf_size, (char *)be_buf);
+ WriteToClient(client, sizeof(xGLXSingleReply), (char *) &reply);
+ if (be_buf_size > 0)
+ WriteToClient(client, be_buf_size, (char *) be_buf);
}
- if (be_buf_size > 0) free(be_buf);
+ if (be_buf_size > 0)
+ free(be_buf);
return Success;
}
-int __glXForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardAllWithReply(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- xGLXSingleReq *be_req;
- xGLXSingleReply reply;
- xGLXSingleReply be_reply;
+ ClientPtr client = cl->client;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
+ xGLXSingleReq *be_req;
+ xGLXSingleReply reply;
+ xGLXSingleReply be_reply;
__GLXcontext *glxc;
- int buf_size;
- char *be_buf = NULL;
- int be_buf_size = 0;
- int from_screen = 0;
- int to_screen = 0;
- int s;
+ int buf_size;
+ char *be_buf = NULL;
+ int be_buf_size = 0;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
- DMXScreenInfo *dmxScreen;
- Display *dpy;
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
glxc = __glXLookupContextByTag(cl, req->contextTag);
if (!glxc) {
- return 0;
+ return 0;
}
from_screen = to_screen = glxc->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
@@ -325,42 +330,42 @@ int __glXForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
/*
* send the request to the first back-end server(s)
*/
- for (s=to_screen; s>=from_screen; s--) {
- dmxScreen = &dmxScreens[s];
- dpy = GetBackEndDisplay(cl,s);
-
- LockDisplay(dpy);
- GetReqSingle(GLXSingle,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = req->glxCode;
- be_req->length = req->length;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- if (buf_size > 0)
- _XSend(dpy, (const char *)pc, buf_size);
-
- /*
- * get the reply from the back-end server
- */
- _XReply(dpy, (xReply*) &be_reply, 0, False);
- be_buf_size = be_reply.length << 2;
- if (be_buf_size > 0) {
- be_buf = (char *)malloc( be_buf_size );
- if (be_buf) {
- _XRead(dpy, be_buf, be_buf_size);
- }
- else {
- /* Throw data on the floor */
- _XEatData(dpy, be_buf_size);
- return BadAlloc;
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- if (s > from_screen && be_buf_size > 0) {
- free(be_buf);
- }
+ for (s = to_screen; s >= from_screen; s--) {
+ dmxScreen = &dmxScreens[s];
+ dpy = GetBackEndDisplay(cl, s);
+
+ LockDisplay(dpy);
+ GetReqSingle(GLXSingle, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *) pc, buf_size);
+
+ /*
+ * get the reply from the back-end server
+ */
+ _XReply(dpy, (xReply *) & be_reply, 0, False);
+ be_buf_size = be_reply.length << 2;
+ if (be_buf_size > 0) {
+ be_buf = (char *) malloc(be_buf_size);
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ return BadAlloc;
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ if (s > from_screen && be_buf_size > 0) {
+ free(be_buf);
+ }
}
/*
@@ -375,380 +380,409 @@ int __glXForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
reply.pad4 = be_reply.pad4;
if (client->swapped) {
- SendSwappedReply( client, &reply, be_buf, be_buf_size );
+ SendSwappedReply(client, &reply, be_buf, be_buf_size);
}
else {
- WriteToClient(client, sizeof(xGLXSingleReply),(char *)&reply);
- if (be_buf_size > 0)
- WriteToClient(client, be_buf_size, (char *)be_buf);
+ WriteToClient(client, sizeof(xGLXSingleReply), (char *) &reply);
+ if (be_buf_size > 0)
+ WriteToClient(client, be_buf_size, (char *) be_buf);
}
- if (be_buf_size > 0) free(be_buf);
+ if (be_buf_size > 0)
+ free(be_buf);
return Success;
}
-int __glXForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardSingleReqSwap(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 0;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXForwardSingleReq( cl, pc ) );
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXSingleReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXForwardSingleReq(cl, pc));
}
-int __glXForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardPipe0WithReplySwap(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 0;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXForwardPipe0WithReply( cl, pc ) );
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXSingleReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXForwardPipe0WithReply(cl, pc));
}
-int __glXForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardPipe0WithReplySwapsv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
- swap_vec_element_size = 2;
+ swap_vec_element_size = 2;
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXSingleReq / 4;
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
- return( __glXForwardPipe0WithReply( cl, pc ) );
+ return (__glXForwardPipe0WithReply(cl, pc));
}
-int __glXForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardPipe0WithReplySwapiv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- swap_vec_element_size = 4;
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
+ swap_vec_element_size = 4;
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXSingleReq / 4;
- return( __glXForwardPipe0WithReply( cl, pc ) );
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXForwardPipe0WithReply(cl, pc));
}
-int __glXForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardPipe0WithReplySwapdv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- swap_vec_element_size = 8;
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
+ swap_vec_element_size = 8;
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXSingleReq / 4;
- return( __glXForwardPipe0WithReply( cl, pc ) );
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXForwardPipe0WithReply(cl, pc));
}
-int __glXForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardAllWithReplySwap(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
- swap_vec_element_size = 0;
+ swap_vec_element_size = 0;
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXSingleReq / 4;
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
- return( __glXForwardAllWithReply( cl, pc ) );
+ return (__glXForwardAllWithReply(cl, pc));
}
-int __glXForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardAllWithReplySwapsv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
- swap_vec_element_size = 2;
+ swap_vec_element_size = 2;
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXSingleReq / 4;
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
- return( __glXForwardAllWithReply( cl, pc ) );
+ return (__glXForwardAllWithReply(cl, pc));
}
-int __glXForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardAllWithReplySwapiv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- swap_vec_element_size = 4;
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
+ swap_vec_element_size = 4;
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXSingleReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
- return( __glXForwardAllWithReply( cl, pc ) );
+ return (__glXForwardAllWithReply(cl, pc));
}
-int __glXForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXForwardAllWithReplySwapdv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
- swap_vec_element_size = 8;
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->contextTag);
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXSingleReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXSingleReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
+ swap_vec_element_size = 8;
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXSingleReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXSingleReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
- return( __glXForwardAllWithReply( cl, pc ) );
+ return (__glXForwardAllWithReply(cl, pc));
}
-static GLint __glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h,
- int *elementbits_return, int *rowbytes_return )
+static GLint
+__glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h,
+ int *elementbits_return, int *rowbytes_return)
{
GLint elements, esize;
GLint rowsize, padding;
if (w < 0 || h < 0) {
- return -1;
+ return -1;
}
switch (format) {
- case GL_COLOR_INDEX:
- case GL_STENCIL_INDEX:
- case GL_DEPTH_COMPONENT:
- elements = 1;
- break;
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_LUMINANCE:
- elements = 1;
- break;
- case GL_LUMINANCE_ALPHA:
- elements = 2;
- break;
- case GL_RGB:
- case GL_BGR:
- elements = 3;
- break;
- case GL_RGBA:
- case GL_BGRA:
- case GL_ABGR_EXT:
- elements = 4;
- break;
- default:
- return -1;
+ case GL_COLOR_INDEX:
+ case GL_STENCIL_INDEX:
+ case GL_DEPTH_COMPONENT:
+ elements = 1;
+ break;
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ case GL_BGR:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ case GL_BGRA:
+ case GL_ABGR_EXT:
+ elements = 4;
+ break;
+ default:
+ return -1;
}
/*
- ** According to the GLX protocol, each row must be padded to a multiple of
- ** 4 bytes. 4 bytes also happens to be the default alignment in the pixel
- ** store modes of the GL.
- */
+ ** According to the GLX protocol, each row must be padded to a multiple of
+ ** 4 bytes. 4 bytes also happens to be the default alignment in the pixel
+ ** store modes of the GL.
+ */
switch (type) {
- case GL_BITMAP:
- if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
- rowsize = ((w * elements)+7)/8;
- padding = rowsize % 4;
- if (padding) {
- rowsize += 4 - padding;
- }
- if (elementbits_return) *elementbits_return = elements;
- if (rowbytes_return) *rowbytes_return = rowsize;
- return rowsize * h;
- } else {
- return -1;
- }
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- esize = 1;
- break;
- case GL_UNSIGNED_BYTE_3_3_2:
- case GL_UNSIGNED_BYTE_2_3_3_REV:
- esize = 1;
- elements = 1;
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- esize = 2;
- break;
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT_5_6_5_REV:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- esize = 2;
- elements = 1;
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- esize = 4;
- break;
- case GL_UNSIGNED_INT_8_8_8_8:
- case GL_UNSIGNED_INT_8_8_8_8_REV:
- case GL_UNSIGNED_INT_10_10_10_2:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- esize = 4;
- elements = 1;
- break;
- default:
- return -1;
+ case GL_BITMAP:
+ if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
+ rowsize = ((w * elements) + 7) / 8;
+ padding = rowsize % 4;
+ if (padding) {
+ rowsize += 4 - padding;
+ }
+ if (elementbits_return)
+ *elementbits_return = elements;
+ if (rowbytes_return)
+ *rowbytes_return = rowsize;
+ return rowsize * h;
+ }
+ else {
+ return -1;
+ }
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ esize = 1;
+ elements = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ esize = 2;
+ elements = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ case GL_UNSIGNED_INT_10_10_10_2:
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ esize = 4;
+ elements = 1;
+ break;
+ default:
+ return -1;
}
rowsize = w * elements * esize;
padding = rowsize % 4;
if (padding) {
- rowsize += 4 - padding;
+ rowsize += 4 - padding;
}
- if (elementbits_return) *elementbits_return = esize*elements*8;
- if (rowbytes_return) *rowbytes_return = rowsize;
+ if (elementbits_return)
+ *elementbits_return = esize * elements * 8;
+ if (rowbytes_return)
+ *rowbytes_return = rowsize;
return rowsize * h;
}
-static int intersectRect( int x1, int x2, int y1, int y2,
- int X1, int X2, int Y1, int Y2,
- int *ix1, int *ix2, int *iy1, int *iy2 )
+static int
+intersectRect(int x1, int x2, int y1, int y2,
+ int X1, int X2, int Y1, int Y2,
+ int *ix1, int *ix2, int *iy1, int *iy2)
{
- int right = (x2 < X2 ? x2 : X2);
- int bottom = (y2 < Y2 ? y2 : Y2);
- int left = (x1 > X1 ? x1 : X1);
- int top = (y1 > Y1 ? y1 : Y1);
- int width = right - left + 1;
- int height = bottom - top + 1;
-
- if ( (width <= 0) || (height <= 0) ) {
- *ix1 = *ix2 = *iy1 = *iy2 = 0;
- return 0;
- }
- else {
- *ix1 = left;
- *ix2 = right;
- *iy1 = top;
- *iy2 = bottom;
- return width * height;
- }
+ int right = (x2 < X2 ? x2 : X2);
+ int bottom = (y2 < Y2 ? y2 : Y2);
+ int left = (x1 > X1 ? x1 : X1);
+ int top = (y1 > Y1 ? y1 : Y1);
+ int width = right - left + 1;
+ int height = bottom - top + 1;
+
+ if ((width <= 0) || (height <= 0)) {
+ *ix1 = *ix2 = *iy1 = *iy2 = 0;
+ return 0;
+ }
+ else {
+ *ix1 = left;
+ *ix2 = right;
+ *iy1 = top;
+ *iy2 = bottom;
+ return width * height;
+ }
}
-int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc)
{
- xGLXSingleReq *req = (xGLXSingleReq *)pc;
+ xGLXSingleReq *req = (xGLXSingleReq *) pc;
xGLXSingleReq *be_req;
xGLXReadPixelsReply reply;
xGLXReadPixelsReply be_reply;
GLbyte *be_pc;
- GLint x,y;
+ GLint x, y;
GLsizei width, height;
GLenum format, type;
GLboolean swapBytes, lsbFirst;
@@ -763,254 +797,262 @@ int __glXDisp_ReadPixels(__GLXclientState *cl, GLbyte *pc)
int win_x1, win_x2;
int win_y1, win_y2;
int ebits, rowsize;
+
__GLX_DECLARE_SWAP_VARIABLES;
if (client->swapped) {
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_SWAP_INT(&req->contextTag);
}
glxc = __glXLookupContextByTag(cl, req->contextTag);
if (!glxc) {
- return 0;
+ return 0;
}
from_screen = to_screen = glxc->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
pc += sz_xGLXSingleReq;
- x = *(GLint *)(pc + 0);
- y = *(GLint *)(pc + 4);
- width = *(GLsizei *)(pc + 8);
- height = *(GLsizei *)(pc + 12);
- format = *(GLenum *)(pc + 16);
- type = *(GLenum *)(pc + 20);
- swapBytes = *(GLboolean *)(pc + 24);
- lsbFirst = *(GLboolean *)(pc + 25);
+ x = *(GLint *) (pc + 0);
+ y = *(GLint *) (pc + 4);
+ width = *(GLsizei *) (pc + 8);
+ height = *(GLsizei *) (pc + 12);
+ format = *(GLenum *) (pc + 16);
+ type = *(GLenum *) (pc + 20);
+ swapBytes = *(GLboolean *) (pc + 24);
+ lsbFirst = *(GLboolean *) (pc + 25);
if (client->swapped) {
- __GLX_SWAP_INT(&x);
- __GLX_SWAP_INT(&y);
- __GLX_SWAP_INT(&width);
- __GLX_SWAP_INT(&height);
- __GLX_SWAP_INT(&format);
- __GLX_SWAP_INT(&type);
- swapBytes = !swapBytes;
+ __GLX_SWAP_INT(&x);
+ __GLX_SWAP_INT(&y);
+ __GLX_SWAP_INT(&width);
+ __GLX_SWAP_INT(&height);
+ __GLX_SWAP_INT(&format);
+ __GLX_SWAP_INT(&type);
+ swapBytes = !swapBytes;
}
- buf_size = __glReadPixels_size(format,type,width,height, &ebits, &rowsize);
+ buf_size =
+ __glReadPixels_size(format, type, width, height, &ebits, &rowsize);
if (buf_size > 0) {
- buf = (char *) malloc( buf_size );
- if ( !buf ) {
- return BadAlloc;
- }
+ buf = (char *) malloc(buf_size);
+ if (!buf) {
+ return BadAlloc;
+ }
}
else {
- buf_size = 0;
- buf = NULL;
+ buf_size = 0;
+ buf = NULL;
}
if (buf_size > 0) {
- /*
- * Get the current drawable this context is bound to
- */
- pDraw = __glXLookupDrawableByTag( cl, req->contextTag );
- win_x1 = pDraw->x + x;
- win_x2 = win_x1 + width - 1;
- win_y1 = (dmxGlobalHeight - pDraw->y - pDraw->height) + y;
- win_y2 = win_y1 + height - 1;
- if (pDraw->type != DRAWABLE_WINDOW) {
- from_screen = to_screen = 0;
- }
-
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
- int scr_x1 = dmxScreen->rootXOrigin;
- int scr_x2 = dmxScreen->rootXOrigin + dmxScreen->scrnWidth - 1;
- int scr_y1 = dmxScreen->rootYOrigin;
- int scr_y2 = dmxScreen->rootYOrigin + dmxScreen->scrnHeight - 1;
- int wx1, wx2, wy1, wy2;
- int sx, sy, sw, sh;
- int npixels;
-
- /*
- * find the window portion that is on the current screen
- */
- if (pDraw->type == DRAWABLE_WINDOW) {
- npixels = intersectRect( scr_x1, scr_x2, scr_y1, scr_y2,
- win_x1, win_x2, win_y1, win_y2,
- &wx1, &wx2, &wy1, &wy2 );
- }
- else {
- wx1 = win_x1;
- wx2 = win_x2;
- wy1 = win_y1;
- wy2 = win_y2;
- npixels = (wx2-wx1+1) * (wy2-wy1+1);
- }
-
- if (npixels > 0) {
-
- /* send the request to the back-end server */
- LockDisplay(dpy);
- GetReqExtra(GLXSingle,__GLX_PAD(26),be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = X_GLsop_ReadPixels;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- be_pc = ((GLbyte *)(be_req) + sz_xGLXSingleReq);
-
- sx = wx1 - pDraw->x;
- sy = wy1 - (dmxGlobalHeight - pDraw->y - pDraw->height);
- sw = (wx2-wx1+1);
- sh = (wy2-wy1+1);
-
- *(GLint *)(be_pc + 0) = sx; /* x */
- *(GLint *)(be_pc + 4) = sy; /* y */
- *(GLsizei *)(be_pc + 8) = sw; /* width */
- *(GLsizei *)(be_pc + 12) = sh; /* height */
- *(GLenum *)(be_pc + 16) = format;
- *(GLenum *)(be_pc + 20) = type;
- *(GLboolean *)(be_pc + 24) = swapBytes;
- *(GLboolean *)(be_pc + 25) = lsbFirst;
-
- _XReply(dpy, (xReply*) &be_reply, 0, False);
-
- if (be_reply.length > 0) {
- char *be_buf;
- int be_buf_size = be_reply.length << 2;
-
- be_buf = (char *) malloc( be_buf_size );
- if (be_buf) {
- _XRead(dpy, be_buf, be_buf_size);
-
- /* copy pixels data to the right location of the */
- /* reply buffer */
- if ( type != GL_BITMAP ) {
- int pbytes = ebits / 8;
- char *dst = buf + (sy-y)*rowsize + (sx-x)*pbytes;
- char *src = be_buf;
- int pad = (pbytes * sw) % 4;
- int r;
-
- for (r=0; r<sh; r++) {
- memcpy( dst, src, pbytes*sw );
- dst += rowsize;
- src += (pbytes*sw + (pad ? 4-pad : 0) );
- }
- }
- else {
- /* this is a GL_BITMAP pixel type, should copy bits */
- int r;
- int src_rowsize = bits_to_bytes(sw * ebits);
- int src_pad = src_rowsize % 4;
- if ( src_pad ) {
- src_rowsize += (4 - src_pad);
- }
-
- for (r=0; r<sh; r++) {
- unsigned char dst_mask = 0x80 >> (sx % 8);
- unsigned char src_mask = 0x80;
- char *dst = buf + (sy-y+r)*rowsize + (sx-x)/8;
- char *src = be_buf + r*src_rowsize;
- int b;
-
- for (b=0; b<sw*ebits; b++) {
- if ( *src & src_mask ) {
- *dst |= dst_mask;
- }
- else {
- *dst &= ~dst_mask;
- }
-
- if (dst_mask > 1) dst_mask >>= 1;
- else {
- dst_mask = 0x80;
- dst++;
- }
-
- if (src_mask > 1) src_mask >>= 1;
- else {
- src_mask = 0x80;
- src++;
- }
- }
- }
-
- }
-
- free( be_buf );
- }
- else {
- /* Throw data on the floor */
- _XEatData(dpy, be_buf_size);
- free( buf );
- return BadAlloc;
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- } /* of npixels > 0 */
-
- } /* of for loop */
-
- } /* of if buf_size > 0 */
+ /*
+ * Get the current drawable this context is bound to
+ */
+ pDraw = __glXLookupDrawableByTag(cl, req->contextTag);
+ win_x1 = pDraw->x + x;
+ win_x2 = win_x1 + width - 1;
+ win_y1 = (dmxGlobalHeight - pDraw->y - pDraw->height) + y;
+ win_y2 = win_y1 + height - 1;
+ if (pDraw->type != DRAWABLE_WINDOW) {
+ from_screen = to_screen = 0;
+ }
+
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
+ int scr_x1 = dmxScreen->rootXOrigin;
+ int scr_x2 = dmxScreen->rootXOrigin + dmxScreen->scrnWidth - 1;
+ int scr_y1 = dmxScreen->rootYOrigin;
+ int scr_y2 = dmxScreen->rootYOrigin + dmxScreen->scrnHeight - 1;
+ int wx1, wx2, wy1, wy2;
+ int sx, sy, sw, sh;
+ int npixels;
+
+ /*
+ * find the window portion that is on the current screen
+ */
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ npixels = intersectRect(scr_x1, scr_x2, scr_y1, scr_y2,
+ win_x1, win_x2, win_y1, win_y2,
+ &wx1, &wx2, &wy1, &wy2);
+ }
+ else {
+ wx1 = win_x1;
+ wx2 = win_x2;
+ wy1 = win_y1;
+ wy2 = win_y2;
+ npixels = (wx2 - wx1 + 1) * (wy2 - wy1 + 1);
+ }
+
+ if (npixels > 0) {
+
+ /* send the request to the back-end server */
+ LockDisplay(dpy);
+ GetReqExtra(GLXSingle, __GLX_PAD(26), be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = X_GLsop_ReadPixels;
+ be_req->contextTag =
+ GetCurrentBackEndTag(cl, req->contextTag, s);
+ be_pc = ((GLbyte *) (be_req) + sz_xGLXSingleReq);
+
+ sx = wx1 - pDraw->x;
+ sy = wy1 - (dmxGlobalHeight - pDraw->y - pDraw->height);
+ sw = (wx2 - wx1 + 1);
+ sh = (wy2 - wy1 + 1);
+
+ *(GLint *) (be_pc + 0) = sx; /* x */
+ *(GLint *) (be_pc + 4) = sy; /* y */
+ *(GLsizei *) (be_pc + 8) = sw; /* width */
+ *(GLsizei *) (be_pc + 12) = sh; /* height */
+ *(GLenum *) (be_pc + 16) = format;
+ *(GLenum *) (be_pc + 20) = type;
+ *(GLboolean *) (be_pc + 24) = swapBytes;
+ *(GLboolean *) (be_pc + 25) = lsbFirst;
+
+ _XReply(dpy, (xReply *) & be_reply, 0, False);
+
+ if (be_reply.length > 0) {
+ char *be_buf;
+ int be_buf_size = be_reply.length << 2;
+
+ be_buf = (char *) malloc(be_buf_size);
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+
+ /* copy pixels data to the right location of the */
+ /* reply buffer */
+ if (type != GL_BITMAP) {
+ int pbytes = ebits / 8;
+ char *dst =
+ buf + (sy - y) * rowsize + (sx - x) * pbytes;
+ char *src = be_buf;
+ int pad = (pbytes * sw) % 4;
+ int r;
+
+ for (r = 0; r < sh; r++) {
+ memcpy(dst, src, pbytes * sw);
+ dst += rowsize;
+ src += (pbytes * sw + (pad ? 4 - pad : 0));
+ }
+ }
+ else {
+ /* this is a GL_BITMAP pixel type, should copy bits */
+ int r;
+ int src_rowsize = bits_to_bytes(sw * ebits);
+ int src_pad = src_rowsize % 4;
+
+ if (src_pad) {
+ src_rowsize += (4 - src_pad);
+ }
+
+ for (r = 0; r < sh; r++) {
+ unsigned char dst_mask = 0x80 >> (sx % 8);
+ unsigned char src_mask = 0x80;
+ char *dst =
+ buf + (sy - y + r) * rowsize + (sx - x) / 8;
+ char *src = be_buf + r * src_rowsize;
+ int b;
+
+ for (b = 0; b < sw * ebits; b++) {
+ if (*src & src_mask) {
+ *dst |= dst_mask;
+ }
+ else {
+ *dst &= ~dst_mask;
+ }
+
+ if (dst_mask > 1)
+ dst_mask >>= 1;
+ else {
+ dst_mask = 0x80;
+ dst++;
+ }
+
+ if (src_mask > 1)
+ src_mask >>= 1;
+ else {
+ src_mask = 0x80;
+ src++;
+ }
+ }
+ }
+
+ }
+
+ free(be_buf);
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ free(buf);
+ return BadAlloc;
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ } /* of npixels > 0 */
+
+ } /* of for loop */
+
+ } /* of if buf_size > 0 */
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.length = buf_size >> 2;
if (client->swapped) {
- __GLX_SWAP_SHORT(&reply.sequenceNumber);
- __GLX_SWAP_INT(&reply.length);
+ __GLX_SWAP_SHORT(&reply.sequenceNumber);
+ __GLX_SWAP_INT(&reply.length);
}
- WriteToClient(client, sizeof(xGLXReadPixelsReply),(char *)&reply);
+ WriteToClient(client, sizeof(xGLXReadPixelsReply), (char *) &reply);
if (buf_size > 0) {
- WriteToClient(client, buf_size, (char *)buf);
- free( buf );
+ WriteToClient(client, buf_size, (char *) buf);
+ free(buf);
}
return Success;
}
-int __glXDispSwap_GetTexImage(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDispSwap_GetTexImage(__GLXclientState * cl, GLbyte * pc)
{
__GLX_DECLARE_SWAP_VARIABLES;
GLbyte *lpc = pc;
lpc += sz_xGLXSingleReq;
- __GLX_SWAP_INT(lpc+0);
- __GLX_SWAP_INT(lpc+4);
- __GLX_SWAP_INT(lpc+8);
- __GLX_SWAP_INT(lpc+12);
+ __GLX_SWAP_INT(lpc + 0);
+ __GLX_SWAP_INT(lpc + 4);
+ __GLX_SWAP_INT(lpc + 8);
+ __GLX_SWAP_INT(lpc + 12);
/* reverse swapBytes */
- *(GLboolean *)(lpc + 16) = ! *(GLboolean *)(lpc + 16);
+ *(GLboolean *) (lpc + 16) = !*(GLboolean *) (lpc + 16);
- return( __glXForwardPipe0WithReplySwap( cl, pc ) );
+ return (__glXForwardPipe0WithReplySwap(cl, pc));
}
-int __glXDispSwap_GetColorTable(__GLXclientState *cl, GLbyte *pc)
+int
+__glXDispSwap_GetColorTable(__GLXclientState * cl, GLbyte * pc)
{
__GLX_DECLARE_SWAP_VARIABLES;
GLbyte *lpc = pc;
lpc += sz_xGLXSingleReq;
- __GLX_SWAP_INT(lpc+0);
- __GLX_SWAP_INT(lpc+4);
- __GLX_SWAP_INT(lpc+8);
+ __GLX_SWAP_INT(lpc + 0);
+ __GLX_SWAP_INT(lpc + 4);
+ __GLX_SWAP_INT(lpc + 8);
/* reverse swapBytes */
- *(GLboolean *)(lpc + 12) = ! *(GLboolean *)(lpc + 12);
+ *(GLboolean *) (lpc + 12) = !*(GLboolean *) (lpc + 12);
- return( __glXForwardPipe0WithReplySwap( cl, pc ) );
+ return (__glXForwardPipe0WithReplySwap(cl, pc));
}
-
-
diff --git a/xorg-server/hw/dmx/glxProxy/glxswap.c b/xorg-server/hw/dmx/glxProxy/glxswap.c
index 1471d8b5f..87a748621 100644
--- a/xorg-server/hw/dmx/glxProxy/glxswap.c
+++ b/xorg-server/hw/dmx/glxProxy/glxswap.c
@@ -1,538 +1,562 @@
-/*
- * Copyright 2003 Red Hat Inc., Raleigh, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Kevin E. Martin <kem@redhat.com>
- *
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "dmx.h"
-#include "dmxwindow.h"
-#include "glxserver.h"
-#include "glxswap.h"
-
-extern int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId,
- GLXContextTag tag);
-
-typedef struct _SwapGroup *SwapGroupPtr;
-
-static Bool SwapBarrierIsReadyToSwap(GLuint barrier);
-static void SwapSwapBarrier(GLuint barrier);
-static void UpdateSwapBarrierList(GLuint barrier,
- SwapGroupPtr pOldSwap,
- SwapGroupPtr pNewSwap);
-
-
-/************************************************************************
- *
- * Swap Groups
- *
- ************************************************************************/
-
-typedef struct _SwapGroup {
- WindowPtr pWin;
- SwapGroupPtr pNext;
-
- Bool swapping;
- Bool sleeping;
- GLuint barrier;
-
- XID drawable;
- GLXContextTag tag;
- __GLXclientState *clState;
-} SwapGroupRec;
-
-
-static void SwapSwapGroup(SwapGroupPtr pSwap)
-{
- SwapGroupPtr pCur;
-
- /* All drawables in swap group are ready to swap, so just swap all
- * drawables buffers and then wake up those clients that were
- * previously sleeping */
-
- for (pCur = pSwap; pCur; pCur = pCur->pNext) {
- if (pCur->swapping) {
- /* Swap pCur's buffers */
- __glXDoSwapBuffers(pCur->clState, pCur->drawable, pCur->tag);
- pCur->swapping = FALSE;
- }
-
- /* Wakeup client */
- if (pCur->sleeping) {
- ClientWakeup(pCur->clState->client);
- pCur->sleeping = FALSE;
- }
- }
-}
-
-static Bool SwapGroupIsReadyToSwap(SwapGroupPtr pSwap)
-{
- Bool isReady = TRUE;
-
- /* The swap group is ready to swap when all drawables are ready to
- * swap. NOTE: A drawable is also ready to swap if it is not
- * currently mapped */
- for (; pSwap; pSwap = pSwap->pNext) {
- isReady &= (pSwap->swapping || !pSwap->pWin->mapped);
- /* FIXME: Should we use pSwap->pWin->mapped or ...->realized ??? */
- }
-
- return isReady;
-}
-
-static Bool SGSwapCleanup(ClientPtr client, pointer closure)
-{
- /* SwapGroupPtr pSwap = (SwapGroupPtr)closure; */
-
- /* This should not be called unless the client has died in which
- * case we should remove the buffer from the swap list */
-
- return TRUE;
-}
-
-int SGSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag,
- DrawablePtr pDraw)
-{
- WindowPtr pWin = (WindowPtr)pDraw;
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
- SwapGroupPtr pSwap = pWinPriv->swapGroup;
- SwapGroupPtr pCur;
-
- for (pCur = pSwap; pCur && pCur->pWin != pWin; pCur = pCur->pNext);
- if (!pCur)
- return BadDrawable;
-
- pCur->clState = cl;
- pCur->drawable = drawId;
- pCur->tag = tag;
-
- /* We are now in the process of swapping */
- pCur->swapping = TRUE;
-
- if (pSwap->barrier && SwapBarrierIsReadyToSwap(pSwap->barrier)) {
- /* The swap group is bound to a barrier and the barrier is ready
- * to swap, so swap all the swap groups that are bound to this
- * group's swap barrier */
- SwapSwapBarrier(pSwap->barrier);
- } else if (!pSwap->barrier && SwapGroupIsReadyToSwap(pSwap)) {
- /* Do the swap if the entire swap group is ready to swap and the
- * group is not bound to a swap barrier */
- SwapSwapGroup(pSwap);
- } else {
- /* The swap group/barrier is not yet ready to swap, so put
- * client to sleep until the rest are ready to swap */
- ClientSleep(cl->client, SGSwapCleanup, (pointer)pWin);
- pCur->sleeping = TRUE;
- }
-
- return Success;
-}
-
-static void SGWindowUnmapped(WindowPtr pWin)
-{
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
- SwapGroupPtr pSwap = pWinPriv->swapGroup;
-
- /* Now that one of the windows in the swap group has been unmapped,
- * see if the entire swap group/barrier is ready to swap */
-
- if (pSwap->barrier && SwapBarrierIsReadyToSwap(pSwap->barrier)) {
- SwapSwapBarrier(pSwap->barrier);
- } else if (!pSwap->barrier && SwapGroupIsReadyToSwap(pSwap)) {
- SwapSwapGroup(pSwap);
- }
-}
-
-static void SGWindowDestroyed(WindowPtr pWin)
-{
- JoinSwapGroupSGIX((DrawablePtr)pWin, NULL);
-}
-
-static SwapGroupPtr CreateSwapEntry(WindowPtr pWin)
-{
- SwapGroupPtr pEntry;
-
- /* Allocate new swap group */
- pEntry = malloc(sizeof(*pEntry));
- if (!pEntry) return NULL;
-
- /* Initialize swap group */
- pEntry->pWin = pWin;
- pEntry->pNext = NULL;
- pEntry->swapping = FALSE;
- pEntry->sleeping = FALSE;
- pEntry->barrier = 0;
- /* The following are not initialized until SwapBuffers is called:
- * pEntry->drawable
- * pEntry->tag
- * pEntry->clState
- */
-
- return pEntry;
-}
-
-static void FreeSwapEntry(SwapGroupPtr pEntry)
-{
- /* Since we have removed the drawable from its previous swap group
- * and it won't be added to another swap group, the only thing that
- * we need to do is to make sure that the drawable's client is not
- * sleeping. This could happen if one thread is sleeping, while
- * another thread called glxJoinSwapGroup(). Note that all sleeping
- * threads should also be swapping, but there is a small window in
- * the SGSwapBuffer() logic, above, where swapping can be set but
- * sleeping is not. We check both independently here just to be
- * pedantic. */
-
- /* Handle swap buffer request */
- if (pEntry->swapping)
- __glXDoSwapBuffers(pEntry->clState, pEntry->drawable, pEntry->tag);
-
- /* Wake up client */
- if (pEntry->sleeping)
- ClientWakeup(pEntry->clState->client);
-
- /* We can free the pEntry entry since it has already been removed
- * from the swap group list and it won't be needed any longer */
- free(pEntry);
-}
-
-int JoinSwapGroupSGIX(DrawablePtr pDraw, DrawablePtr pMember)
-{
- if (pDraw->type == DRAWABLE_WINDOW) {
- WindowPtr pWin = (WindowPtr)pDraw;
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
- SwapGroupPtr pOldSwap = NULL;
- SwapGroupPtr pEntry;
-
- /* If pDraw and pMember are already members of the same swap
- * group, just return Success since there is nothing to do */
- for (pEntry = pWinPriv->swapGroup; pEntry; pEntry = pEntry->pNext)
- if (pEntry->pWin == (WindowPtr)pMember)
- return Success;
-
- /* Remove pDraw from its current swap group */
- if (pWinPriv->swapGroup) {
- SwapGroupPtr pSwapGroup = pWinPriv->swapGroup;
- SwapGroupPtr pPrev;
-
- /* Find old swap entry in swap group and save in pOldSwap
- * for later use */
- for (pOldSwap = pWinPriv->swapGroup, pPrev = NULL;
- pOldSwap && pOldSwap->pWin != pWin;
- pPrev = pOldSwap, pOldSwap = pOldSwap->pNext);
- if (!pOldSwap)
- return BadDrawable;
-
- /* Remove pDraw's swap group entry from swap group list */
- if (pPrev) {
- pPrev->pNext = pOldSwap->pNext;
- } else {
- /* pWin is at the head of the swap group list, so we
- * need to update all other members of this swap
- * group */
- for (pEntry = pOldSwap->pNext; pEntry; pEntry = pEntry->pNext)
- DMX_GET_WINDOW_PRIV(pEntry->pWin)->swapGroup
- = pOldSwap->pNext;
-
- /* Update the barrier list as well */
- if (pOldSwap->barrier)
- UpdateSwapBarrierList(pOldSwap->barrier,
- pOldSwap, pOldSwap->pNext);
-
- /* Set pSwapGroup to point to the swap group without
- * pOldSwap */
- pSwapGroup = pOldSwap->pNext;
- }
-
- /* Check to see if current swap group can now swap since we
- * know at this point that pDraw and pMember are guaranteed
- * to previously be in different swap groups */
- if (pSwapGroup && SwapGroupIsReadyToSwap(pSwapGroup)) {
- SwapSwapGroup(pSwapGroup);
- }
-
- /* Make the old swap entry a standalone group */
- pOldSwap->pNext = NULL;
- pOldSwap->barrier = 0;
-
- /* Reset pWin's swap group */
- pWinPriv->swapGroup = NULL;
- pWinPriv->windowDestroyed = NULL;
- pWinPriv->windowUnmapped = NULL;
- }
-
- if (!pMember || pMember->type != DRAWABLE_WINDOW) {
- /* Free old swap group since it is no longer needed */
- if (pOldSwap) FreeSwapEntry(pOldSwap);
- } else if (pDraw == pMember && pOldSwap) {
- /* Special case where pDraw was previously created and we
- * are now just putting it to its own swap group */
- pWinPriv->swapGroup = pOldSwap;
- pWinPriv->windowDestroyed = SGWindowDestroyed;
- pWinPriv->windowUnmapped = SGWindowUnmapped;
-
- /* Check to see if pDraw is ready to swap */
- if (SwapGroupIsReadyToSwap(pOldSwap))
- SwapSwapGroup(pOldSwap);
- } else if (pMember->type == DRAWABLE_WINDOW) {
- WindowPtr pMemberWin = (WindowPtr)pMember;
- dmxWinPrivPtr pMemberPriv = DMX_GET_WINDOW_PRIV(pMemberWin);
- SwapGroupPtr pMemberSwapGroup = pMemberPriv->swapGroup;
-
- /* Finally, how we can add pDraw to pMember's swap group */
-
- /* If pMember is not currently in a swap group, then create
- * one for it since we are just about to add pDraw to it. */
- if (!pMemberSwapGroup) {
- /* Create new swap group */
- pMemberSwapGroup = CreateSwapEntry(pMemberWin);
- if (!pMemberSwapGroup) {
- if (pOldSwap) FreeSwapEntry(pOldSwap);
- return BadAlloc;
- }
-
- /* Set pMember's swap group */
- pMemberPriv->swapGroup = pMemberSwapGroup;
- pMemberPriv->windowDestroyed = SGWindowDestroyed;
- pMemberPriv->windowUnmapped = SGWindowUnmapped;
- }
-
- /* If pDraw == pMember, that means pDraw was not a member of
- * a group previously (or it would have been handled by the
- * special case above), so no additional work is required
- * since we just created a new swap group for pMember (i.e.,
- * pDraw). */
-
- if (pDraw != pMember) {
- /* If pDraw was not previously in a swap group, then create
- * an entry for it */
- if (!pOldSwap) {
- /* Create new swap group */
- pOldSwap = CreateSwapEntry(pWin);
- if (!pOldSwap) {
- /* If we just created a swap group for pMember, we
- * need to free it here */
- if (pMemberSwapGroup->pNext == NULL) {
- FreeSwapEntry(pMemberSwapGroup);
- pMemberPriv->swapGroup = NULL;
- }
- return BadAlloc;
- }
- }
-
- /* Find last entry in pMember's swap group */
- for (pEntry = pMemberSwapGroup;
- pEntry->pNext;
- pEntry = pEntry->pNext);
-
- /* Add pDraw's swap group entry to pMember's swap group list */
- pEntry->pNext = pOldSwap;
-
- /* Add pDraw to pMember's swap barrier */
- pOldSwap->barrier = pEntry->barrier;
-
- /* Set pDraw's swap group */
- pWinPriv->swapGroup = pMemberSwapGroup;
- pWinPriv->windowDestroyed = SGWindowDestroyed;
- pWinPriv->windowUnmapped = SGWindowUnmapped;
- }
- }
- }
-
- return Success;
-}
-
-
-/************************************************************************
- *
- * Swap Barriers
- *
- ************************************************************************/
-
-#define GLX_MAX_SWAP_BARRIERS 10
-
-typedef struct _SwapBarrier *SwapBarrierPtr;
-typedef struct _SwapBarrier {
- SwapGroupPtr pSwap;
- SwapBarrierPtr pNext;
-} SwapBarrierRec;
-
-static SwapBarrierPtr SwapBarrierList[GLX_MAX_SWAP_BARRIERS+1];
-
-void SwapBarrierInit(void)
-{
- int i;
-
- for (i = 0; i <= GLX_MAX_SWAP_BARRIERS; i++)
- SwapBarrierList[i] = NULL;
-}
-
-void SwapBarrierReset(void)
-{
- int i;
-
- for (i = 0; i <= GLX_MAX_SWAP_BARRIERS; i++) {
- SwapBarrierPtr pBarrier, pNextBarrier;
- for (pBarrier = SwapBarrierList[i];
- pBarrier;
- pBarrier = pNextBarrier) {
- pNextBarrier = pBarrier->pNext;
- free(pBarrier);
- }
- SwapBarrierList[i] = NULL;
- }
-}
-
-int QueryMaxSwapBarriersSGIX(int screen)
-{
- return GLX_MAX_SWAP_BARRIERS;
-}
-
-static Bool BindSwapGroupToBarrier(GLuint barrier, SwapGroupPtr pSwapGroup)
-{
- SwapBarrierPtr pBarrier;
-
- pBarrier = malloc(sizeof(*pBarrier));
- if (!pBarrier) return FALSE;
-
- /* Add the swap group to barrier's list */
- pBarrier->pSwap = pSwapGroup;
- pBarrier->pNext = SwapBarrierList[barrier];
- SwapBarrierList[barrier] = pBarrier;
-
- return TRUE;
-}
-
-static Bool UnbindSwapGroupFromBarrier(GLuint barrier, SwapGroupPtr pSwapGroup)
-{
- SwapBarrierPtr pBarrier, pPrevBarrier;
-
- /* Find the swap group in barrier's list */
- for (pBarrier = SwapBarrierList[barrier], pPrevBarrier = NULL;
- pBarrier && pBarrier->pSwap != pSwapGroup;
- pPrevBarrier = pBarrier, pBarrier = pBarrier->pNext);
- if (!pBarrier) return FALSE;
-
- /* Remove the swap group from barrier's list */
- if (pPrevBarrier) pPrevBarrier->pNext = pBarrier->pNext;
- else SwapBarrierList[barrier] = pBarrier->pNext;
-
- /* Free memory */
- free(pBarrier);
-
- return TRUE;
-}
-
-static void UpdateSwapBarrierList(GLuint barrier,
- SwapGroupPtr pOldSwap,
- SwapGroupPtr pNewSwap)
-{
- SwapBarrierPtr pBarrier;
-
- /* If the old swap group is being destroyed, then we need to remove
- * the swap group from the list entirely */
- if (!pNewSwap) {
- UnbindSwapGroupFromBarrier(barrier, pOldSwap);
- return;
- }
-
- /* Otherwise, find the old swap group in the barrier list and change
- * it to the new swap group */
- for (pBarrier = SwapBarrierList[barrier];
- pBarrier;
- pBarrier = pBarrier->pNext) {
- if (pBarrier->pSwap == pOldSwap) {
- pBarrier->pSwap = pNewSwap;
- return;
- }
- }
-}
-
-static Bool SwapBarrierIsReadyToSwap(GLuint barrier)
-{
- SwapBarrierPtr pBarrier;
- Bool isReady = TRUE;
-
- /* The swap barier is ready to swap when swap groups that are bound
- * to barrier are ready to swap */
- for (pBarrier = SwapBarrierList[barrier];
- pBarrier;
- pBarrier = pBarrier->pNext)
- isReady &= SwapGroupIsReadyToSwap(pBarrier->pSwap);
-
- return isReady;
-}
-
-static void SwapSwapBarrier(GLuint barrier)
-{
- SwapBarrierPtr pBarrier;
-
- /* Swap each group that is a member of this barrier */
- for (pBarrier = SwapBarrierList[barrier];
- pBarrier;
- pBarrier = pBarrier->pNext)
- SwapSwapGroup(pBarrier->pSwap);
-}
-
-int BindSwapBarrierSGIX(DrawablePtr pDraw, int barrier)
-{
- /* FIXME: Check for errors when pDraw->type != DRAWABLE_WINDOW */
-
- if (barrier < 0 || barrier > GLX_MAX_SWAP_BARRIERS)
- return BadValue;
-
- if (pDraw->type == DRAWABLE_WINDOW) {
- WindowPtr pWin = (WindowPtr)pDraw;
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
- SwapGroupPtr pSwapGroup = pWinPriv->swapGroup;
- SwapGroupPtr pCur;
-
- if (!pSwapGroup) return BadDrawable;
- if (barrier && pSwapGroup->barrier) return BadValue;
-
- /* Update the swap barrier list */
- if (barrier) {
- if (!BindSwapGroupToBarrier(barrier, pSwapGroup))
- return BadAlloc;
- } else {
- if (!UnbindSwapGroupFromBarrier(pSwapGroup->barrier, pSwapGroup))
- return BadDrawable;
- }
-
- /* Set the barrier for each member of this swap group */
- for (pCur = pSwapGroup; pCur; pCur = pCur->pNext)
- pCur->barrier = barrier;
- }
-
- return Success;
-}
+/*
+ * Copyright 2003 Red Hat Inc., Raleigh, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Kevin E. Martin <kem@redhat.com>
+ *
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "dmx.h"
+#include "dmxwindow.h"
+#include "glxserver.h"
+#include "glxswap.h"
+
+extern int __glXDoSwapBuffers(__GLXclientState * cl, XID drawId,
+ GLXContextTag tag);
+
+typedef struct _SwapGroup *SwapGroupPtr;
+
+static Bool SwapBarrierIsReadyToSwap(GLuint barrier);
+static void SwapSwapBarrier(GLuint barrier);
+static void UpdateSwapBarrierList(GLuint barrier,
+ SwapGroupPtr pOldSwap, SwapGroupPtr pNewSwap);
+
+/************************************************************************
+ *
+ * Swap Groups
+ *
+ ************************************************************************/
+
+typedef struct _SwapGroup {
+ WindowPtr pWin;
+ SwapGroupPtr pNext;
+
+ Bool swapping;
+ Bool sleeping;
+ GLuint barrier;
+
+ XID drawable;
+ GLXContextTag tag;
+ __GLXclientState *clState;
+} SwapGroupRec;
+
+static void
+SwapSwapGroup(SwapGroupPtr pSwap)
+{
+ SwapGroupPtr pCur;
+
+ /* All drawables in swap group are ready to swap, so just swap all
+ * drawables buffers and then wake up those clients that were
+ * previously sleeping */
+
+ for (pCur = pSwap; pCur; pCur = pCur->pNext) {
+ if (pCur->swapping) {
+ /* Swap pCur's buffers */
+ __glXDoSwapBuffers(pCur->clState, pCur->drawable, pCur->tag);
+ pCur->swapping = FALSE;
+ }
+
+ /* Wakeup client */
+ if (pCur->sleeping) {
+ ClientWakeup(pCur->clState->client);
+ pCur->sleeping = FALSE;
+ }
+ }
+}
+
+static Bool
+SwapGroupIsReadyToSwap(SwapGroupPtr pSwap)
+{
+ Bool isReady = TRUE;
+
+ /* The swap group is ready to swap when all drawables are ready to
+ * swap. NOTE: A drawable is also ready to swap if it is not
+ * currently mapped */
+ for (; pSwap; pSwap = pSwap->pNext) {
+ isReady &= (pSwap->swapping || !pSwap->pWin->mapped);
+ /* FIXME: Should we use pSwap->pWin->mapped or ...->realized ??? */
+ }
+
+ return isReady;
+}
+
+static Bool
+SGSwapCleanup(ClientPtr client, pointer closure)
+{
+ /* SwapGroupPtr pSwap = (SwapGroupPtr)closure; */
+
+ /* This should not be called unless the client has died in which
+ * case we should remove the buffer from the swap list */
+
+ return TRUE;
+}
+
+int
+SGSwapBuffers(__GLXclientState * cl, XID drawId, GLXContextTag tag,
+ DrawablePtr pDraw)
+{
+ WindowPtr pWin = (WindowPtr) pDraw;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
+ SwapGroupPtr pSwap = pWinPriv->swapGroup;
+ SwapGroupPtr pCur;
+
+ for (pCur = pSwap; pCur && pCur->pWin != pWin; pCur = pCur->pNext);
+ if (!pCur)
+ return BadDrawable;
+
+ pCur->clState = cl;
+ pCur->drawable = drawId;
+ pCur->tag = tag;
+
+ /* We are now in the process of swapping */
+ pCur->swapping = TRUE;
+
+ if (pSwap->barrier && SwapBarrierIsReadyToSwap(pSwap->barrier)) {
+ /* The swap group is bound to a barrier and the barrier is ready
+ * to swap, so swap all the swap groups that are bound to this
+ * group's swap barrier */
+ SwapSwapBarrier(pSwap->barrier);
+ }
+ else if (!pSwap->barrier && SwapGroupIsReadyToSwap(pSwap)) {
+ /* Do the swap if the entire swap group is ready to swap and the
+ * group is not bound to a swap barrier */
+ SwapSwapGroup(pSwap);
+ }
+ else {
+ /* The swap group/barrier is not yet ready to swap, so put
+ * client to sleep until the rest are ready to swap */
+ ClientSleep(cl->client, SGSwapCleanup, (pointer) pWin);
+ pCur->sleeping = TRUE;
+ }
+
+ return Success;
+}
+
+static void
+SGWindowUnmapped(WindowPtr pWin)
+{
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
+ SwapGroupPtr pSwap = pWinPriv->swapGroup;
+
+ /* Now that one of the windows in the swap group has been unmapped,
+ * see if the entire swap group/barrier is ready to swap */
+
+ if (pSwap->barrier && SwapBarrierIsReadyToSwap(pSwap->barrier)) {
+ SwapSwapBarrier(pSwap->barrier);
+ }
+ else if (!pSwap->barrier && SwapGroupIsReadyToSwap(pSwap)) {
+ SwapSwapGroup(pSwap);
+ }
+}
+
+static void
+SGWindowDestroyed(WindowPtr pWin)
+{
+ JoinSwapGroupSGIX((DrawablePtr) pWin, NULL);
+}
+
+static SwapGroupPtr
+CreateSwapEntry(WindowPtr pWin)
+{
+ SwapGroupPtr pEntry;
+
+ /* Allocate new swap group */
+ pEntry = malloc(sizeof(*pEntry));
+ if (!pEntry)
+ return NULL;
+
+ /* Initialize swap group */
+ pEntry->pWin = pWin;
+ pEntry->pNext = NULL;
+ pEntry->swapping = FALSE;
+ pEntry->sleeping = FALSE;
+ pEntry->barrier = 0;
+ /* The following are not initialized until SwapBuffers is called:
+ * pEntry->drawable
+ * pEntry->tag
+ * pEntry->clState
+ */
+
+ return pEntry;
+}
+
+static void
+FreeSwapEntry(SwapGroupPtr pEntry)
+{
+ /* Since we have removed the drawable from its previous swap group
+ * and it won't be added to another swap group, the only thing that
+ * we need to do is to make sure that the drawable's client is not
+ * sleeping. This could happen if one thread is sleeping, while
+ * another thread called glxJoinSwapGroup(). Note that all sleeping
+ * threads should also be swapping, but there is a small window in
+ * the SGSwapBuffer() logic, above, where swapping can be set but
+ * sleeping is not. We check both independently here just to be
+ * pedantic. */
+
+ /* Handle swap buffer request */
+ if (pEntry->swapping)
+ __glXDoSwapBuffers(pEntry->clState, pEntry->drawable, pEntry->tag);
+
+ /* Wake up client */
+ if (pEntry->sleeping)
+ ClientWakeup(pEntry->clState->client);
+
+ /* We can free the pEntry entry since it has already been removed
+ * from the swap group list and it won't be needed any longer */
+ free(pEntry);
+}
+
+int
+JoinSwapGroupSGIX(DrawablePtr pDraw, DrawablePtr pMember)
+{
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr) pDraw;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
+ SwapGroupPtr pOldSwap = NULL;
+ SwapGroupPtr pEntry;
+
+ /* If pDraw and pMember are already members of the same swap
+ * group, just return Success since there is nothing to do */
+ for (pEntry = pWinPriv->swapGroup; pEntry; pEntry = pEntry->pNext)
+ if (pEntry->pWin == (WindowPtr) pMember)
+ return Success;
+
+ /* Remove pDraw from its current swap group */
+ if (pWinPriv->swapGroup) {
+ SwapGroupPtr pSwapGroup = pWinPriv->swapGroup;
+ SwapGroupPtr pPrev;
+
+ /* Find old swap entry in swap group and save in pOldSwap
+ * for later use */
+ for (pOldSwap = pWinPriv->swapGroup, pPrev = NULL;
+ pOldSwap && pOldSwap->pWin != pWin;
+ pPrev = pOldSwap, pOldSwap = pOldSwap->pNext);
+ if (!pOldSwap)
+ return BadDrawable;
+
+ /* Remove pDraw's swap group entry from swap group list */
+ if (pPrev) {
+ pPrev->pNext = pOldSwap->pNext;
+ }
+ else {
+ /* pWin is at the head of the swap group list, so we
+ * need to update all other members of this swap
+ * group */
+ for (pEntry = pOldSwap->pNext; pEntry; pEntry = pEntry->pNext)
+ DMX_GET_WINDOW_PRIV(pEntry->pWin)->swapGroup
+ = pOldSwap->pNext;
+
+ /* Update the barrier list as well */
+ if (pOldSwap->barrier)
+ UpdateSwapBarrierList(pOldSwap->barrier,
+ pOldSwap, pOldSwap->pNext);
+
+ /* Set pSwapGroup to point to the swap group without
+ * pOldSwap */
+ pSwapGroup = pOldSwap->pNext;
+ }
+
+ /* Check to see if current swap group can now swap since we
+ * know at this point that pDraw and pMember are guaranteed
+ * to previously be in different swap groups */
+ if (pSwapGroup && SwapGroupIsReadyToSwap(pSwapGroup)) {
+ SwapSwapGroup(pSwapGroup);
+ }
+
+ /* Make the old swap entry a standalone group */
+ pOldSwap->pNext = NULL;
+ pOldSwap->barrier = 0;
+
+ /* Reset pWin's swap group */
+ pWinPriv->swapGroup = NULL;
+ pWinPriv->windowDestroyed = NULL;
+ pWinPriv->windowUnmapped = NULL;
+ }
+
+ if (!pMember || pMember->type != DRAWABLE_WINDOW) {
+ /* Free old swap group since it is no longer needed */
+ if (pOldSwap)
+ FreeSwapEntry(pOldSwap);
+ }
+ else if (pDraw == pMember && pOldSwap) {
+ /* Special case where pDraw was previously created and we
+ * are now just putting it to its own swap group */
+ pWinPriv->swapGroup = pOldSwap;
+ pWinPriv->windowDestroyed = SGWindowDestroyed;
+ pWinPriv->windowUnmapped = SGWindowUnmapped;
+
+ /* Check to see if pDraw is ready to swap */
+ if (SwapGroupIsReadyToSwap(pOldSwap))
+ SwapSwapGroup(pOldSwap);
+ }
+ else if (pMember->type == DRAWABLE_WINDOW) {
+ WindowPtr pMemberWin = (WindowPtr) pMember;
+ dmxWinPrivPtr pMemberPriv = DMX_GET_WINDOW_PRIV(pMemberWin);
+ SwapGroupPtr pMemberSwapGroup = pMemberPriv->swapGroup;
+
+ /* Finally, how we can add pDraw to pMember's swap group */
+
+ /* If pMember is not currently in a swap group, then create
+ * one for it since we are just about to add pDraw to it. */
+ if (!pMemberSwapGroup) {
+ /* Create new swap group */
+ pMemberSwapGroup = CreateSwapEntry(pMemberWin);
+ if (!pMemberSwapGroup) {
+ if (pOldSwap)
+ FreeSwapEntry(pOldSwap);
+ return BadAlloc;
+ }
+
+ /* Set pMember's swap group */
+ pMemberPriv->swapGroup = pMemberSwapGroup;
+ pMemberPriv->windowDestroyed = SGWindowDestroyed;
+ pMemberPriv->windowUnmapped = SGWindowUnmapped;
+ }
+
+ /* If pDraw == pMember, that means pDraw was not a member of
+ * a group previously (or it would have been handled by the
+ * special case above), so no additional work is required
+ * since we just created a new swap group for pMember (i.e.,
+ * pDraw). */
+
+ if (pDraw != pMember) {
+ /* If pDraw was not previously in a swap group, then create
+ * an entry for it */
+ if (!pOldSwap) {
+ /* Create new swap group */
+ pOldSwap = CreateSwapEntry(pWin);
+ if (!pOldSwap) {
+ /* If we just created a swap group for pMember, we
+ * need to free it here */
+ if (pMemberSwapGroup->pNext == NULL) {
+ FreeSwapEntry(pMemberSwapGroup);
+ pMemberPriv->swapGroup = NULL;
+ }
+ return BadAlloc;
+ }
+ }
+
+ /* Find last entry in pMember's swap group */
+ for (pEntry = pMemberSwapGroup;
+ pEntry->pNext; pEntry = pEntry->pNext);
+
+ /* Add pDraw's swap group entry to pMember's swap group list */
+ pEntry->pNext = pOldSwap;
+
+ /* Add pDraw to pMember's swap barrier */
+ pOldSwap->barrier = pEntry->barrier;
+
+ /* Set pDraw's swap group */
+ pWinPriv->swapGroup = pMemberSwapGroup;
+ pWinPriv->windowDestroyed = SGWindowDestroyed;
+ pWinPriv->windowUnmapped = SGWindowUnmapped;
+ }
+ }
+ }
+
+ return Success;
+}
+
+/************************************************************************
+ *
+ * Swap Barriers
+ *
+ ************************************************************************/
+
+#define GLX_MAX_SWAP_BARRIERS 10
+
+typedef struct _SwapBarrier *SwapBarrierPtr;
+typedef struct _SwapBarrier {
+ SwapGroupPtr pSwap;
+ SwapBarrierPtr pNext;
+} SwapBarrierRec;
+
+static SwapBarrierPtr SwapBarrierList[GLX_MAX_SWAP_BARRIERS + 1];
+
+void
+SwapBarrierInit(void)
+{
+ int i;
+
+ for (i = 0; i <= GLX_MAX_SWAP_BARRIERS; i++)
+ SwapBarrierList[i] = NULL;
+}
+
+void
+SwapBarrierReset(void)
+{
+ int i;
+
+ for (i = 0; i <= GLX_MAX_SWAP_BARRIERS; i++) {
+ SwapBarrierPtr pBarrier, pNextBarrier;
+
+ for (pBarrier = SwapBarrierList[i]; pBarrier; pBarrier = pNextBarrier) {
+ pNextBarrier = pBarrier->pNext;
+ free(pBarrier);
+ }
+ SwapBarrierList[i] = NULL;
+ }
+}
+
+int
+QueryMaxSwapBarriersSGIX(int screen)
+{
+ return GLX_MAX_SWAP_BARRIERS;
+}
+
+static Bool
+BindSwapGroupToBarrier(GLuint barrier, SwapGroupPtr pSwapGroup)
+{
+ SwapBarrierPtr pBarrier;
+
+ pBarrier = malloc(sizeof(*pBarrier));
+ if (!pBarrier)
+ return FALSE;
+
+ /* Add the swap group to barrier's list */
+ pBarrier->pSwap = pSwapGroup;
+ pBarrier->pNext = SwapBarrierList[barrier];
+ SwapBarrierList[barrier] = pBarrier;
+
+ return TRUE;
+}
+
+static Bool
+UnbindSwapGroupFromBarrier(GLuint barrier, SwapGroupPtr pSwapGroup)
+{
+ SwapBarrierPtr pBarrier, pPrevBarrier;
+
+ /* Find the swap group in barrier's list */
+ for (pBarrier = SwapBarrierList[barrier], pPrevBarrier = NULL;
+ pBarrier && pBarrier->pSwap != pSwapGroup;
+ pPrevBarrier = pBarrier, pBarrier = pBarrier->pNext);
+ if (!pBarrier)
+ return FALSE;
+
+ /* Remove the swap group from barrier's list */
+ if (pPrevBarrier)
+ pPrevBarrier->pNext = pBarrier->pNext;
+ else
+ SwapBarrierList[barrier] = pBarrier->pNext;
+
+ /* Free memory */
+ free(pBarrier);
+
+ return TRUE;
+}
+
+static void
+UpdateSwapBarrierList(GLuint barrier,
+ SwapGroupPtr pOldSwap, SwapGroupPtr pNewSwap)
+{
+ SwapBarrierPtr pBarrier;
+
+ /* If the old swap group is being destroyed, then we need to remove
+ * the swap group from the list entirely */
+ if (!pNewSwap) {
+ UnbindSwapGroupFromBarrier(barrier, pOldSwap);
+ return;
+ }
+
+ /* Otherwise, find the old swap group in the barrier list and change
+ * it to the new swap group */
+ for (pBarrier = SwapBarrierList[barrier];
+ pBarrier; pBarrier = pBarrier->pNext) {
+ if (pBarrier->pSwap == pOldSwap) {
+ pBarrier->pSwap = pNewSwap;
+ return;
+ }
+ }
+}
+
+static Bool
+SwapBarrierIsReadyToSwap(GLuint barrier)
+{
+ SwapBarrierPtr pBarrier;
+ Bool isReady = TRUE;
+
+ /* The swap barier is ready to swap when swap groups that are bound
+ * to barrier are ready to swap */
+ for (pBarrier = SwapBarrierList[barrier];
+ pBarrier; pBarrier = pBarrier->pNext)
+ isReady &= SwapGroupIsReadyToSwap(pBarrier->pSwap);
+
+ return isReady;
+}
+
+static void
+SwapSwapBarrier(GLuint barrier)
+{
+ SwapBarrierPtr pBarrier;
+
+ /* Swap each group that is a member of this barrier */
+ for (pBarrier = SwapBarrierList[barrier];
+ pBarrier; pBarrier = pBarrier->pNext)
+ SwapSwapGroup(pBarrier->pSwap);
+}
+
+int
+BindSwapBarrierSGIX(DrawablePtr pDraw, int barrier)
+{
+ /* FIXME: Check for errors when pDraw->type != DRAWABLE_WINDOW */
+
+ if (barrier < 0 || barrier > GLX_MAX_SWAP_BARRIERS)
+ return BadValue;
+
+ if (pDraw->type == DRAWABLE_WINDOW) {
+ WindowPtr pWin = (WindowPtr) pDraw;
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin);
+ SwapGroupPtr pSwapGroup = pWinPriv->swapGroup;
+ SwapGroupPtr pCur;
+
+ if (!pSwapGroup)
+ return BadDrawable;
+ if (barrier && pSwapGroup->barrier)
+ return BadValue;
+
+ /* Update the swap barrier list */
+ if (barrier) {
+ if (!BindSwapGroupToBarrier(barrier, pSwapGroup))
+ return BadAlloc;
+ }
+ else {
+ if (!UnbindSwapGroupFromBarrier(pSwapGroup->barrier, pSwapGroup))
+ return BadDrawable;
+ }
+
+ /* Set the barrier for each member of this swap group */
+ for (pCur = pSwapGroup; pCur; pCur = pCur->pNext)
+ pCur->barrier = barrier;
+ }
+
+ return Success;
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxutil.c b/xorg-server/hw/dmx/glxProxy/glxutil.c
index 1b9ad6962..f90dbf141 100644
--- a/xorg-server/hw/dmx/glxProxy/glxutil.c
+++ b/xorg-server/hw/dmx/glxProxy/glxutil.c
@@ -1,34 +1,37 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * 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 including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#include "glxserver.h"
-#include "glxutil.h"
-
-void __glXNop(void) {}
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * 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 including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * 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
+ * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#include "glxserver.h"
+#include "glxutil.h"
+
+void
+__glXNop(void)
+{
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxutil.h b/xorg-server/hw/dmx/glxProxy/glxutil.h
index 15237b258..d3c72862d 100644
--- a/xorg-server/hw/dmx/glxProxy/glxutil.h
+++ b/xorg-server/hw/dmx/glxProxy/glxutil.h
@@ -1,42 +1,41 @@
-#ifndef _glxcmds_h_
-#define _glxcmds_h_
-
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * 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 including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-extern void __glXNop(void);
-
-/* context helper routines */
-extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag);
-extern DrawablePtr __glXLookupDrawableByTag(__GLXclientState *cl, GLXContextTag tag);
-
-
-#endif /* _glxcmds_h_ */
-
+#ifndef _glxcmds_h_
+#define _glxcmds_h_
+
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * 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 including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * 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
+ * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+extern void __glXNop(void);
+
+/* context helper routines */
+extern __GLXcontext *__glXLookupContextByTag(__GLXclientState *, GLXContextTag);
+extern DrawablePtr __glXLookupDrawableByTag(__GLXclientState * cl,
+ GLXContextTag tag);
+
+#endif /* _glxcmds_h_ */
diff --git a/xorg-server/hw/dmx/glxProxy/glxvendor.c b/xorg-server/hw/dmx/glxProxy/glxvendor.c
index 0b6ba4134..963c92e87 100644
--- a/xorg-server/hw/dmx/glxProxy/glxvendor.c
+++ b/xorg-server/hw/dmx/glxProxy/glxvendor.c
@@ -67,7 +67,7 @@
dpy->bufptr += SIZEOF(x##name##Req);\
dpy->request++
-#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
+#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
#define GetReqVendorPrivate(name, req) \
WORD64ALIGN\
if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\
@@ -78,92 +78,93 @@
dpy->request++
#endif
-extern Display *GetBackEndDisplay( __GLXclientState *cl, int s );
-extern int GetCurrentBackEndTag(__GLXclientState *cl, GLXContextTag tag, int s);
+extern Display *GetBackEndDisplay(__GLXclientState * cl, int s);
+extern int GetCurrentBackEndTag(__GLXclientState * cl, GLXContextTag tag,
+ int s);
static int swap_vec_element_size = 0;
-static void SendSwappedReply( ClientPtr client,
- xGLXVendorPrivReply *reply,
- char *buf,
- int buf_size )
+static void
+SendSwappedReply(ClientPtr client,
+ xGLXVendorPrivReply * reply, char *buf, int buf_size)
{
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_SWAP_SHORT(&reply->sequenceNumber);
- __GLX_SWAP_INT(&reply->length);
- __GLX_SWAP_INT(&reply->retval);
- __GLX_SWAP_INT(&reply->size);
-
- if ( (buf_size == 0) && (swap_vec_element_size > 0) ) {
- /*
- * the reply has single component - need to swap pad3
- */
- if (swap_vec_element_size == 2) {
- __GLX_SWAP_SHORT(&reply->pad3);
- }
- else if (swap_vec_element_size == 4) {
- __GLX_SWAP_INT(&reply->pad3);
- __GLX_SWAP_INT(&reply->pad4);
- }
- else if (swap_vec_element_size == 8) {
- __GLX_SWAP_DOUBLE(&reply->pad3);
- }
- }
- else if ( (buf_size > 0) && (swap_vec_element_size > 0) ) {
- /*
- * the reply has vector of elements which needs to be swapped
- */
- int vsize = buf_size / swap_vec_element_size;
- char *p = buf;
- int i;
-
- for (i=0; i<vsize; i++) {
- if (swap_vec_element_size == 2) {
- __GLX_SWAP_SHORT(p);
- }
- else if (swap_vec_element_size == 4) {
- __GLX_SWAP_INT(p);
- }
- else if (swap_vec_element_size == 8) {
- __GLX_SWAP_DOUBLE(p);
- }
-
- p += swap_vec_element_size;
- }
-
- __GLX_SWAP_INT(&reply->pad3);
- __GLX_SWAP_INT(&reply->pad4);
- __GLX_SWAP_INT(&reply->pad5);
- __GLX_SWAP_INT(&reply->pad6);
-
- }
-
- WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)reply);
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_SWAP_SHORT(&reply->sequenceNumber);
+ __GLX_SWAP_INT(&reply->length);
+ __GLX_SWAP_INT(&reply->retval);
+ __GLX_SWAP_INT(&reply->size);
+
+ if ((buf_size == 0) && (swap_vec_element_size > 0)) {
+ /*
+ * the reply has single component - need to swap pad3
+ */
+ if (swap_vec_element_size == 2) {
+ __GLX_SWAP_SHORT(&reply->pad3);
+ }
+ else if (swap_vec_element_size == 4) {
+ __GLX_SWAP_INT(&reply->pad3);
+ __GLX_SWAP_INT(&reply->pad4);
+ }
+ else if (swap_vec_element_size == 8) {
+ __GLX_SWAP_DOUBLE(&reply->pad3);
+ }
+ }
+ else if ((buf_size > 0) && (swap_vec_element_size > 0)) {
+ /*
+ * the reply has vector of elements which needs to be swapped
+ */
+ int vsize = buf_size / swap_vec_element_size;
+ char *p = buf;
+ int i;
+
+ for (i = 0; i < vsize; i++) {
+ if (swap_vec_element_size == 2) {
+ __GLX_SWAP_SHORT(p);
+ }
+ else if (swap_vec_element_size == 4) {
+ __GLX_SWAP_INT(p);
+ }
+ else if (swap_vec_element_size == 8) {
+ __GLX_SWAP_DOUBLE(p);
+ }
+
+ p += swap_vec_element_size;
+ }
+
+ __GLX_SWAP_INT(&reply->pad3);
+ __GLX_SWAP_INT(&reply->pad4);
+ __GLX_SWAP_INT(&reply->pad5);
+ __GLX_SWAP_INT(&reply->pad6);
+
+ }
+
+ WriteToClient(client, sizeof(xGLXVendorPrivReply), (char *) reply);
if (buf_size > 0)
- WriteToClient(client, buf_size, (char *)buf);
+ WriteToClient(client, buf_size, (char *) buf);
}
-int __glXVForwardSingleReq( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardSingleReq(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- xGLXVendorPrivateReq *be_req;
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+ xGLXVendorPrivateReq *be_req;
__GLXcontext *glxc;
- int from_screen = 0;
- int to_screen = 0;
- int buf_size;
- int s;
+ int from_screen = 0;
+ int to_screen = 0;
+ int buf_size;
+ int s;
glxc = __glXLookupContextByTag(cl, req->contextTag);
if (!glxc) {
- return 0;
+ return 0;
}
from_screen = to_screen = glxc->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
@@ -173,43 +174,44 @@ int __glXVForwardSingleReq( __GLXclientState *cl, GLbyte *pc )
/*
* just forward the request to back-end server(s)
*/
- for (s=from_screen; s<=to_screen; s++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[s];
- Display *dpy = GetBackEndDisplay(cl,s);
-
- LockDisplay(dpy);
- GetReqVendorPrivate(GLXVendorPrivate,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = req->glxCode;
- be_req->length = req->length;
- be_req->vendorCode = req->vendorCode;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- if (buf_size > 0)
- _XSend(dpy, (const char *)pc, buf_size);
- UnlockDisplay(dpy);
- SyncHandle();
+ for (s = from_screen; s <= to_screen; s++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[s];
+ Display *dpy = GetBackEndDisplay(cl, s);
+
+ LockDisplay(dpy);
+ GetReqVendorPrivate(GLXVendorPrivate, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->vendorCode = req->vendorCode;
+ be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *) pc, buf_size);
+ UnlockDisplay(dpy);
+ SyncHandle();
}
return Success;
}
-int __glXVForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- xGLXVendorPrivateReq *be_req;
- xGLXVendorPrivReply reply;
- xGLXVendorPrivReply be_reply;
+ ClientPtr client = cl->client;
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+ xGLXVendorPrivateReq *be_req;
+ xGLXVendorPrivReply reply;
+ xGLXVendorPrivReply be_reply;
__GLXcontext *glxc;
- int buf_size;
- char *be_buf = NULL;
- int be_buf_size;
- DMXScreenInfo *dmxScreen;
- Display *dpy;
+ int buf_size;
+ char *be_buf = NULL;
+ int be_buf_size;
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
glxc = __glXLookupContextByTag(cl, req->contextTag);
if (!glxc) {
- return __glXBadContext;
+ return __glXBadContext;
}
pc += sz_xGLXVendorPrivateReq;
@@ -222,30 +224,31 @@ int __glXVForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
* send the request to the first back-end server
*/
LockDisplay(dpy);
- GetReqVendorPrivate(GLXVendorPrivate,be_req);
+ GetReqVendorPrivate(GLXVendorPrivate, be_req);
be_req->reqType = dmxScreen->glxMajorOpcode;
be_req->glxCode = req->glxCode;
be_req->length = req->length;
be_req->vendorCode = req->vendorCode;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag, glxc->pScreen->myNum);
- if (buf_size > 0)
- _XSend(dpy, (const char *)pc, buf_size);
+ be_req->contextTag =
+ GetCurrentBackEndTag(cl, req->contextTag, glxc->pScreen->myNum);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *) pc, buf_size);
/*
* get the reply from the back-end server
*/
- _XReply(dpy, (xReply*) &be_reply, 0, False);
+ _XReply(dpy, (xReply *) & be_reply, 0, False);
be_buf_size = be_reply.length << 2;
if (be_buf_size > 0) {
- be_buf = (char *)malloc( be_buf_size );
- if (be_buf) {
- _XRead(dpy, be_buf, be_buf_size);
- }
- else {
- /* Throw data on the floor */
- _XEatData(dpy, be_buf_size);
- return BadAlloc;
- }
+ be_buf = (char *) malloc(be_buf_size);
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ return BadAlloc;
+ }
}
UnlockDisplay(dpy);
@@ -254,52 +257,54 @@ int __glXVForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc )
/*
* send the reply to the client
*/
- memcpy( &reply, &be_reply, sz_xGLXVendorPrivReply );
+ memcpy(&reply, &be_reply, sz_xGLXVendorPrivReply);
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- SendSwappedReply( client, &reply, be_buf, be_buf_size );
+ SendSwappedReply(client, &reply, be_buf, be_buf_size);
}
else {
- WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)&reply);
- if (be_buf_size > 0)
- WriteToClient(client, be_buf_size, (char *)be_buf);
+ WriteToClient(client, sizeof(xGLXVendorPrivReply), (char *) &reply);
+ if (be_buf_size > 0)
+ WriteToClient(client, be_buf_size, (char *) be_buf);
}
- if (be_buf_size > 0) free(be_buf);
+ if (be_buf_size > 0)
+ free(be_buf);
return Success;
}
-int __glXVForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardAllWithReply(__GLXclientState * cl, GLbyte * pc)
{
- ClientPtr client = cl->client;
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- xGLXVendorPrivateReq *be_req;
- xGLXVendorPrivReply reply;
- xGLXVendorPrivReply be_reply;
+ ClientPtr client = cl->client;
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+ xGLXVendorPrivateReq *be_req;
+ xGLXVendorPrivReply reply;
+ xGLXVendorPrivReply be_reply;
__GLXcontext *glxc;
- int buf_size;
- char *be_buf = NULL;
- int be_buf_size = 0;
- int from_screen = 0;
- int to_screen = 0;
- int s;
+ int buf_size;
+ char *be_buf = NULL;
+ int be_buf_size = 0;
+ int from_screen = 0;
+ int to_screen = 0;
+ int s;
- DMXScreenInfo *dmxScreen;
- Display *dpy;
+ DMXScreenInfo *dmxScreen;
+ Display *dpy;
glxc = __glXLookupContextByTag(cl, req->contextTag);
if (!glxc) {
- return 0;
+ return 0;
}
from_screen = to_screen = glxc->pScreen->myNum;
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
- from_screen = 0;
- to_screen = screenInfo.numScreens - 1;
+ from_screen = 0;
+ to_screen = screenInfo.numScreens - 1;
}
#endif
@@ -309,277 +314,303 @@ int __glXVForwardAllWithReply( __GLXclientState *cl, GLbyte *pc )
/*
* send the request to the first back-end server(s)
*/
- for (s=to_screen; s>=from_screen; s--) {
- dmxScreen = &dmxScreens[s];
- dpy = GetBackEndDisplay(cl,s);
-
- LockDisplay(dpy);
- GetReqVendorPrivate(GLXVendorPrivate,be_req);
- be_req->reqType = dmxScreen->glxMajorOpcode;
- be_req->glxCode = req->glxCode;
- be_req->length = req->length;
- be_req->vendorCode = req->vendorCode;
- be_req->contextTag = GetCurrentBackEndTag(cl,req->contextTag,s);
- if (buf_size > 0)
- _XSend(dpy, (const char *)pc, buf_size);
-
- /*
- * get the reply from the back-end server
- */
- _XReply(dpy, (xReply*) &be_reply, 0, False);
- be_buf_size = be_reply.length << 2;
- if (be_buf_size > 0) {
- be_buf = (char *)malloc( be_buf_size );
- if (be_buf) {
- _XRead(dpy, be_buf, be_buf_size);
- }
- else {
- /* Throw data on the floor */
- _XEatData(dpy, be_buf_size);
- return BadAlloc;
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- if (s > from_screen && be_buf_size > 0) {
- free(be_buf);
- }
+ for (s = to_screen; s >= from_screen; s--) {
+ dmxScreen = &dmxScreens[s];
+ dpy = GetBackEndDisplay(cl, s);
+
+ LockDisplay(dpy);
+ GetReqVendorPrivate(GLXVendorPrivate, be_req);
+ be_req->reqType = dmxScreen->glxMajorOpcode;
+ be_req->glxCode = req->glxCode;
+ be_req->length = req->length;
+ be_req->vendorCode = req->vendorCode;
+ be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s);
+ if (buf_size > 0)
+ _XSend(dpy, (const char *) pc, buf_size);
+
+ /*
+ * get the reply from the back-end server
+ */
+ _XReply(dpy, (xReply *) & be_reply, 0, False);
+ be_buf_size = be_reply.length << 2;
+ if (be_buf_size > 0) {
+ be_buf = (char *) malloc(be_buf_size);
+ if (be_buf) {
+ _XRead(dpy, be_buf, be_buf_size);
+ }
+ else {
+ /* Throw data on the floor */
+ _XEatData(dpy, be_buf_size);
+ return BadAlloc;
+ }
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ if (s > from_screen && be_buf_size > 0) {
+ free(be_buf);
+ }
}
/*
* send the reply to the client
*/
- memcpy( &reply, &be_reply, sz_xGLXVendorPrivReply );
+ memcpy(&reply, &be_reply, sz_xGLXVendorPrivReply);
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
if (client->swapped) {
- SendSwappedReply( client, &reply, be_buf, be_buf_size );
+ SendSwappedReply(client, &reply, be_buf, be_buf_size);
}
else {
- WriteToClient(client, sizeof(xGLXVendorPrivReply),(char *)&reply);
- if (be_buf_size > 0)
- WriteToClient(client, be_buf_size, (char *)be_buf);
+ WriteToClient(client, sizeof(xGLXVendorPrivReply), (char *) &reply);
+ if (be_buf_size > 0)
+ WriteToClient(client, be_buf_size, (char *) be_buf);
}
- if (be_buf_size > 0) free(be_buf);
+ if (be_buf_size > 0)
+ free(be_buf);
return Success;
}
-int __glXVForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardSingleReqSwap(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
+ __GLX_DECLARE_SWAP_VARIABLES;
- swap_vec_element_size = 0;
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
- return( __glXVForwardSingleReq( cl, pc ) );
+ swap_vec_element_size = 0;
+
+ return (__glXVForwardSingleReq(cl, pc));
}
-int __glXVForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardPipe0WithReplySwap(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 0;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardPipe0WithReply( cl, pc ) );
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXVendorPrivateReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXVForwardPipe0WithReply(cl, pc));
}
-int __glXVForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardPipe0WithReplySwapsv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 2;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardPipe0WithReply( cl, pc ) );
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 2;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXVendorPrivateReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXVForwardPipe0WithReply(cl, pc));
}
-int __glXVForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardPipe0WithReplySwapiv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 4;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardPipe0WithReply( cl, pc ) );
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 4;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXVendorPrivateReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXVForwardPipe0WithReply(cl, pc));
}
-int __glXVForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardPipe0WithReplySwapdv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 8;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardPipe0WithReply( cl, pc ) );
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 8;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXVendorPrivateReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXVForwardPipe0WithReply(cl, pc));
}
-int __glXVForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardAllWithReplySwap(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 0;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardAllWithReply( cl, pc ) );
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 0;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXVendorPrivateReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXVForwardAllWithReply(cl, pc));
}
-int __glXVForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardAllWithReplySwapsv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 2;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardAllWithReply( cl, pc ) );
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 2;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXVendorPrivateReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXVForwardAllWithReply(cl, pc));
}
-int __glXVForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardAllWithReplySwapiv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 4;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardAllWithReply( cl, pc ) );
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 4;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXVendorPrivateReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXVForwardAllWithReply(cl, pc));
}
-int __glXVForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc )
+int
+__glXVForwardAllWithReplySwapdv(__GLXclientState * cl, GLbyte * pc)
{
- xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *)pc;
- __GLX_DECLARE_SWAP_VARIABLES;
- __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
-
- __GLX_SWAP_SHORT(&req->length);
- __GLX_SWAP_INT(&req->vendorCode);
- __GLX_SWAP_INT(&req->contextTag);
-
- swap_vec_element_size = 8;
-
- /*
- * swap extra data in request - assuming all data
- * (if available) are arrays of 4 bytes components !
- */
- if (req->length > sz_xGLXVendorPrivateReq/4) {
- int *data = (int *)(req+1);
- int count = req->length - sz_xGLXVendorPrivateReq/4;
- __GLX_SWAP_INT_ARRAY(data, count );
- }
-
- return( __glXVForwardAllWithReply( cl, pc ) );
-}
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+ __GLX_DECLARE_SWAP_ARRAY_VARIABLES;
+
+ __GLX_SWAP_SHORT(&req->length);
+ __GLX_SWAP_INT(&req->vendorCode);
+ __GLX_SWAP_INT(&req->contextTag);
+
+ swap_vec_element_size = 8;
+
+ /*
+ * swap extra data in request - assuming all data
+ * (if available) are arrays of 4 bytes components !
+ */
+ if (req->length > sz_xGLXVendorPrivateReq / 4) {
+ int *data = (int *) (req + 1);
+ int count = req->length - sz_xGLXVendorPrivateReq / 4;
+
+ __GLX_SWAP_INT_ARRAY(data, count);
+ }
+
+ return (__glXVForwardAllWithReply(cl, pc));
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxvendor.h b/xorg-server/hw/dmx/glxProxy/glxvendor.h
index fbc901cef..0d160ab9f 100644
--- a/xorg-server/hw/dmx/glxProxy/glxvendor.h
+++ b/xorg-server/hw/dmx/glxProxy/glxvendor.h
@@ -31,20 +31,23 @@
#ifndef __GLXVENDOR_H
#define __GLXVENDOR_H
-extern int __glXVForwardSingleReq( __GLXclientState *cl, GLbyte *pc );
-extern int __glXVForwardPipe0WithReply( __GLXclientState *cl, GLbyte *pc );
-extern int __glXVForwardAllWithReply( __GLXclientState *cl, GLbyte *pc );
+extern int __glXVForwardSingleReq(__GLXclientState * cl, GLbyte * pc);
+extern int __glXVForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc);
+extern int __glXVForwardAllWithReply(__GLXclientState * cl, GLbyte * pc);
-extern int __glXVForwardSingleReqSwap( __GLXclientState *cl, GLbyte *pc );
+extern int __glXVForwardSingleReqSwap(__GLXclientState * cl, GLbyte * pc);
-extern int __glXVForwardPipe0WithReplySwap( __GLXclientState *cl, GLbyte *pc );
-extern int __glXVForwardPipe0WithReplySwapsv( __GLXclientState *cl, GLbyte *pc );
-extern int __glXVForwardPipe0WithReplySwapiv( __GLXclientState *cl, GLbyte *pc );
-extern int __glXVForwardPipe0WithReplySwapdv( __GLXclientState *cl, GLbyte *pc );
+extern int __glXVForwardPipe0WithReplySwap(__GLXclientState * cl, GLbyte * pc);
+extern int __glXVForwardPipe0WithReplySwapsv(__GLXclientState * cl,
+ GLbyte * pc);
+extern int __glXVForwardPipe0WithReplySwapiv(__GLXclientState * cl,
+ GLbyte * pc);
+extern int __glXVForwardPipe0WithReplySwapdv(__GLXclientState * cl,
+ GLbyte * pc);
-extern int __glXVForwardAllWithReplySwap( __GLXclientState *cl, GLbyte *pc );
-extern int __glXVForwardAllWithReplySwapsv( __GLXclientState *cl, GLbyte *pc );
-extern int __glXVForwardAllWithReplySwapiv( __GLXclientState *cl, GLbyte *pc );
-extern int __glXVForwardAllWithReplySwapdv( __GLXclientState *cl, GLbyte *pc );
+extern int __glXVForwardAllWithReplySwap(__GLXclientState * cl, GLbyte * pc);
+extern int __glXVForwardAllWithReplySwapsv(__GLXclientState * cl, GLbyte * pc);
+extern int __glXVForwardAllWithReplySwapiv(__GLXclientState * cl, GLbyte * pc);
+extern int __glXVForwardAllWithReplySwapdv(__GLXclientState * cl, GLbyte * pc);
#endif
diff --git a/xorg-server/hw/dmx/glxProxy/glxvisuals.c b/xorg-server/hw/dmx/glxProxy/glxvisuals.c
index ae5e86772..3fca04f0d 100644
--- a/xorg-server/hw/dmx/glxProxy/glxvisuals.c
+++ b/xorg-server/hw/dmx/glxProxy/glxvisuals.c
@@ -1,152 +1,158 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * 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 including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "glxserver.h"
-#include "glxvisuals.h"
-
-int glxVisualsMatch( __GLXvisualConfig *v1, __GLXvisualConfig *v2 )
-{
- if ( (v1->class == v2->class) &&
- (v1->rgba == v2->rgba) &&
- (v1->redSize == v2->redSize) &&
- (v1->greenSize == v2->greenSize) &&
- (v1->blueSize == v2->blueSize) &&
- (v1->alphaSize == v2->alphaSize) &&
- (v1->redMask == v2->redMask) &&
- (v1->greenMask == v2->greenMask) &&
- (v1->blueMask == v2->blueMask) &&
- (v1->alphaMask == v2->alphaMask) &&
- (v1->accumRedSize == v2->accumRedSize) &&
- (v1->accumGreenSize == v2->accumGreenSize) &&
- (v1->accumBlueSize == v2->accumBlueSize) &&
- (v1->accumAlphaSize == v2->accumAlphaSize) &&
- (v1->doubleBuffer == v2->doubleBuffer) &&
- (v1->stereo == v2->stereo) &&
- (v1->bufferSize == v2->bufferSize) &&
- (v1->depthSize == v2->depthSize) &&
- (v1->stencilSize == v2->stencilSize) &&
- (v1->auxBuffers == v2->auxBuffers) &&
- (v1->level == v2->level) &&
- (v1->visualRating == v2->visualRating) &&
- (v1->transparentPixel == v2->transparentPixel) &&
- (v1->transparentRed == v2->transparentRed) &&
- (v1->transparentGreen == v2->transparentGreen) &&
- (v1->transparentBlue == v2->transparentBlue) &&
- (v1->transparentAlpha == v2->transparentAlpha) &&
- (v1->transparentIndex == v2->transparentIndex) &&
- (v1->multiSampleSize == v2->multiSampleSize) &&
- (v1->nMultiSampleBuffers == v2->nMultiSampleBuffers) &&
- (v1->visualSelectGroup == v2->visualSelectGroup) ) {
-
- return 1;
-
- }
-
- return 0;
-
-}
-
-VisualID glxMatchGLXVisualInConfigList( __GLXvisualConfig *pGlxVisual, __GLXvisualConfig *configs, int nconfigs )
-{
- int i;
-
- for (i=0; i<nconfigs; i++) {
-
- if (glxVisualsMatch( pGlxVisual, &configs[i] )) {
-
- return configs[i].vid;
-
- }
- }
-
- return 0;
-}
-
-VisualID glxMatchVisualInConfigList( ScreenPtr pScreen, VisualPtr pVisual, __GLXvisualConfig *configs, int nconfigs )
-{
- __GLXscreenInfo *pGlxScreen;
- __GLXvisualConfig *pGlxVisual;
- int i;
-
- /* check that the glx extension has been initialized */
- if ( !__glXActiveScreens )
- return 0;
-
- pGlxScreen = &__glXActiveScreens[pScreen->myNum];
- pGlxVisual = pGlxScreen->pGlxVisual;
-
- /* find the glx visual info for pVisual */
- for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
- if (pGlxVisual->vid == pVisual->vid) {
- break;
- }
- }
- if (i == pGlxScreen->numVisuals) {
- /*
- * the visual is not supported by glx
- */
- return 0;
- }
-
- return( glxMatchGLXVisualInConfigList(pGlxVisual, configs, nconfigs) );
-}
-
-VisualPtr glxMatchVisual( ScreenPtr pScreen, VisualPtr pVisual, ScreenPtr pMatchScreen )
-{
- __GLXscreenInfo *pGlxScreen2;
- int j;
- VisualID vid;
-
- /* check that the glx extension has been initialized */
- if ( !__glXActiveScreens )
- return NULL;
-
- pGlxScreen2 = &__glXActiveScreens[pMatchScreen->myNum];
-
- vid = glxMatchVisualInConfigList( pScreen, pVisual,
- pGlxScreen2->pGlxVisual,
- pGlxScreen2->numVisuals );
- if (vid) {
- /*
- * find the X visual of the matching glx visual
- */
- for (j=0; j<pMatchScreen->numVisuals; j++) {
- if (vid == pMatchScreen->visuals[j].vid) {
- return &pMatchScreen->visuals[j];
- }
- }
- }
-
- return 0;
-}
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * 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 including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * 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
+ * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "glxserver.h"
+#include "glxvisuals.h"
+
+int
+glxVisualsMatch(__GLXvisualConfig * v1, __GLXvisualConfig * v2)
+{
+ if ((v1->class == v2->class) &&
+ (v1->rgba == v2->rgba) &&
+ (v1->redSize == v2->redSize) &&
+ (v1->greenSize == v2->greenSize) &&
+ (v1->blueSize == v2->blueSize) &&
+ (v1->alphaSize == v2->alphaSize) &&
+ (v1->redMask == v2->redMask) &&
+ (v1->greenMask == v2->greenMask) &&
+ (v1->blueMask == v2->blueMask) &&
+ (v1->alphaMask == v2->alphaMask) &&
+ (v1->accumRedSize == v2->accumRedSize) &&
+ (v1->accumGreenSize == v2->accumGreenSize) &&
+ (v1->accumBlueSize == v2->accumBlueSize) &&
+ (v1->accumAlphaSize == v2->accumAlphaSize) &&
+ (v1->doubleBuffer == v2->doubleBuffer) &&
+ (v1->stereo == v2->stereo) &&
+ (v1->bufferSize == v2->bufferSize) &&
+ (v1->depthSize == v2->depthSize) &&
+ (v1->stencilSize == v2->stencilSize) &&
+ (v1->auxBuffers == v2->auxBuffers) &&
+ (v1->level == v2->level) &&
+ (v1->visualRating == v2->visualRating) &&
+ (v1->transparentPixel == v2->transparentPixel) &&
+ (v1->transparentRed == v2->transparentRed) &&
+ (v1->transparentGreen == v2->transparentGreen) &&
+ (v1->transparentBlue == v2->transparentBlue) &&
+ (v1->transparentAlpha == v2->transparentAlpha) &&
+ (v1->transparentIndex == v2->transparentIndex) &&
+ (v1->multiSampleSize == v2->multiSampleSize) &&
+ (v1->nMultiSampleBuffers == v2->nMultiSampleBuffers) &&
+ (v1->visualSelectGroup == v2->visualSelectGroup)) {
+
+ return 1;
+
+ }
+
+ return 0;
+
+}
+
+VisualID
+glxMatchGLXVisualInConfigList(__GLXvisualConfig * pGlxVisual,
+ __GLXvisualConfig * configs, int nconfigs)
+{
+ int i;
+
+ for (i = 0; i < nconfigs; i++) {
+
+ if (glxVisualsMatch(pGlxVisual, &configs[i])) {
+
+ return configs[i].vid;
+
+ }
+ }
+
+ return 0;
+}
+
+VisualID
+glxMatchVisualInConfigList(ScreenPtr pScreen, VisualPtr pVisual,
+ __GLXvisualConfig * configs, int nconfigs)
+{
+ __GLXscreenInfo *pGlxScreen;
+ __GLXvisualConfig *pGlxVisual;
+ int i;
+
+ /* check that the glx extension has been initialized */
+ if (!__glXActiveScreens)
+ return 0;
+
+ pGlxScreen = &__glXActiveScreens[pScreen->myNum];
+ pGlxVisual = pGlxScreen->pGlxVisual;
+
+ /* find the glx visual info for pVisual */
+ for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) {
+ if (pGlxVisual->vid == pVisual->vid) {
+ break;
+ }
+ }
+ if (i == pGlxScreen->numVisuals) {
+ /*
+ * the visual is not supported by glx
+ */
+ return 0;
+ }
+
+ return (glxMatchGLXVisualInConfigList(pGlxVisual, configs, nconfigs));
+}
+
+VisualPtr
+glxMatchVisual(ScreenPtr pScreen, VisualPtr pVisual, ScreenPtr pMatchScreen)
+{
+ __GLXscreenInfo *pGlxScreen2;
+ int j;
+ VisualID vid;
+
+ /* check that the glx extension has been initialized */
+ if (!__glXActiveScreens)
+ return NULL;
+
+ pGlxScreen2 = &__glXActiveScreens[pMatchScreen->myNum];
+
+ vid = glxMatchVisualInConfigList(pScreen, pVisual,
+ pGlxScreen2->pGlxVisual,
+ pGlxScreen2->numVisuals);
+ if (vid) {
+ /*
+ * find the X visual of the matching glx visual
+ */
+ for (j = 0; j < pMatchScreen->numVisuals; j++) {
+ if (vid == pMatchScreen->visuals[j].vid) {
+ return &pMatchScreen->visuals[j];
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/xorg-server/hw/dmx/glxProxy/glxvisuals.h b/xorg-server/hw/dmx/glxProxy/glxvisuals.h
index 4245313ba..e1e023878 100644
--- a/xorg-server/hw/dmx/glxProxy/glxvisuals.h
+++ b/xorg-server/hw/dmx/glxProxy/glxvisuals.h
@@ -1,42 +1,46 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * 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 including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#ifndef _GLX_VISUALS_H
-#define _GLX_VISUALS_H
-
-int glxVisualsMatch( __GLXvisualConfig *v1, __GLXvisualConfig *v2 );
-
-VisualID glxMatchGLXVisualInConfigList( __GLXvisualConfig *pGlxVisual, __GLXvisualConfig *configs, int nconfigs );
-
-VisualID glxMatchVisualInConfigList( ScreenPtr pScreen, VisualPtr pVisual, __GLXvisualConfig *configs, int nconfigs );
-
-VisualPtr glxMatchVisual( ScreenPtr pScreen, VisualPtr pVisual, ScreenPtr pMatchScreen );
-
-#endif
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * 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 including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * 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
+ * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#ifndef _GLX_VISUALS_H
+#define _GLX_VISUALS_H
+
+int glxVisualsMatch(__GLXvisualConfig * v1, __GLXvisualConfig * v2);
+
+VisualID glxMatchGLXVisualInConfigList(__GLXvisualConfig * pGlxVisual,
+ __GLXvisualConfig * configs,
+ int nconfigs);
+
+VisualID glxMatchVisualInConfigList(ScreenPtr pScreen, VisualPtr pVisual,
+ __GLXvisualConfig * configs, int nconfigs);
+
+VisualPtr glxMatchVisual(ScreenPtr pScreen, VisualPtr pVisual,
+ ScreenPtr pMatchScreen);
+
+#endif
diff --git a/xorg-server/hw/dmx/glxProxy/render2swap.c b/xorg-server/hw/dmx/glxProxy/render2swap.c
index da9b565de..166ec8882 100644
--- a/xorg-server/hw/dmx/glxProxy/render2swap.c
+++ b/xorg-server/hw/dmx/glxProxy/render2swap.c
@@ -32,7 +32,8 @@
#include "unpack.h"
#include "g_disptab.h"
-static GLint __glEvalComputeK(GLenum target)
+static GLint
+__glEvalComputeK(GLenum target)
{
switch (target) {
case GL_MAP1_VERTEX_4:
@@ -41,33 +42,35 @@ static GLint __glEvalComputeK(GLenum target)
case GL_MAP2_VERTEX_4:
case GL_MAP2_COLOR_4:
case GL_MAP2_TEXTURE_COORD_4:
- return 4;
+ return 4;
case GL_MAP1_VERTEX_3:
case GL_MAP1_TEXTURE_COORD_3:
case GL_MAP1_NORMAL:
case GL_MAP2_VERTEX_3:
case GL_MAP2_TEXTURE_COORD_3:
case GL_MAP2_NORMAL:
- return 3;
+ return 3;
case GL_MAP1_TEXTURE_COORD_2:
case GL_MAP2_TEXTURE_COORD_2:
- return 2;
+ return 2;
case GL_MAP1_TEXTURE_COORD_1:
case GL_MAP2_TEXTURE_COORD_1:
case GL_MAP1_INDEX:
case GL_MAP2_INDEX:
- return 1;
+ return 1;
default:
- return 0;
+ return 0;
}
}
-void __glXDispSwap_Map1f(GLbyte *pc)
+void
+__glXDispSwap_Map1f(GLbyte * pc)
{
GLint order, k;
GLfloat u1, u2, *points;
GLenum target;
GLint compsize;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
@@ -75,30 +78,33 @@ void __glXDispSwap_Map1f(GLbyte *pc)
__GLX_SWAP_INT(pc + 12);
__GLX_SWAP_FLOAT(pc + 4);
__GLX_SWAP_FLOAT(pc + 8);
-
- target = *(GLenum *)(pc + 0);
- order = *(GLint *)(pc + 12);
- u1 = *(GLfloat *)(pc + 4);
- u2 = *(GLfloat *)(pc + 8);
- points = (GLfloat *)(pc + 16);
+
+ target = *(GLenum *) (pc + 0);
+ order = *(GLint *) (pc + 12);
+ u1 = *(GLfloat *) (pc + 4);
+ u2 = *(GLfloat *) (pc + 8);
+ points = (GLfloat *) (pc + 16);
k = __glEvalComputeK(target);
if (order <= 0 || k < 0) {
- /* Erroneous command. */
- compsize = 0;
- } else {
- compsize = order * k;
+ /* Erroneous command. */
+ compsize = 0;
+ }
+ else {
+ compsize = order * k;
}
__GLX_SWAP_FLOAT_ARRAY(points, compsize);
}
-void __glXDispSwap_Map2f(GLbyte *pc)
+void
+__glXDispSwap_Map2f(GLbyte * pc)
{
GLint uorder, vorder, ustride, vstride, k;
GLfloat u1, u2, v1, v2, *points;
GLenum target;
GLint compsize;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
@@ -109,35 +115,38 @@ void __glXDispSwap_Map2f(GLbyte *pc)
__GLX_SWAP_FLOAT(pc + 8);
__GLX_SWAP_FLOAT(pc + 16);
__GLX_SWAP_FLOAT(pc + 20);
-
- target = *(GLenum *)(pc + 0);
- uorder = *(GLint *)(pc + 12);
- vorder = *(GLint *)(pc + 24);
- u1 = *(GLfloat *)(pc + 4);
- u2 = *(GLfloat *)(pc + 8);
- v1 = *(GLfloat *)(pc + 16);
- v2 = *(GLfloat *)(pc + 20);
- points = (GLfloat *)(pc + 28);
+
+ target = *(GLenum *) (pc + 0);
+ uorder = *(GLint *) (pc + 12);
+ vorder = *(GLint *) (pc + 24);
+ u1 = *(GLfloat *) (pc + 4);
+ u2 = *(GLfloat *) (pc + 8);
+ v1 = *(GLfloat *) (pc + 16);
+ v2 = *(GLfloat *) (pc + 20);
+ points = (GLfloat *) (pc + 28);
k = __glEvalComputeK(target);
ustride = vorder * k;
vstride = k;
if (vorder <= 0 || uorder <= 0 || k < 0) {
- /* Erroneous command. */
- compsize = 0;
- } else {
- compsize = uorder * vorder * k;
+ /* Erroneous command. */
+ compsize = 0;
+ }
+ else {
+ compsize = uorder * vorder * k;
}
__GLX_SWAP_FLOAT_ARRAY(points, compsize);
}
-void __glXDispSwap_Map1d(GLbyte *pc)
+void
+__glXDispSwap_Map1d(GLbyte * pc)
{
GLint order, k, compsize;
GLenum target;
GLdouble u1, u2, *points;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
@@ -146,41 +155,45 @@ void __glXDispSwap_Map1d(GLbyte *pc)
__GLX_SWAP_INT(pc + 16);
__GLX_SWAP_INT(pc + 20);
- target = *(GLenum*) (pc + 16);
- order = *(GLint*) (pc + 20);
+ target = *(GLenum *) (pc + 16);
+ order = *(GLint *) (pc + 20);
k = __glEvalComputeK(target);
if (order <= 0 || k < 0) {
- /* Erroneous command. */
- compsize = 0;
- } else {
- compsize = order * k;
+ /* Erroneous command. */
+ compsize = 0;
}
- __GLX_GET_DOUBLE(u1,pc);
- __GLX_GET_DOUBLE(u2,pc+8);
- __GLX_SWAP_DOUBLE_ARRAY(pc+24, compsize);
+ else {
+ compsize = order * k;
+ }
+ __GLX_GET_DOUBLE(u1, pc);
+ __GLX_GET_DOUBLE(u2, pc + 8);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 24, compsize);
pc += 24;
#ifdef __GLX_ALIGN64
- if (((unsigned long)pc) & 7) {
- /*
- ** Copy the doubles up 4 bytes, trashing the command but aligning
- ** the data in the process
- */
- __GLX_MEM_COPY(pc-4, pc, compsize*8);
- points = (GLdouble*) (pc - 4);
- } else {
- points = (GLdouble*) pc;
+ if (((unsigned long) pc) & 7) {
+ /*
+ ** Copy the doubles up 4 bytes, trashing the command but aligning
+ ** the data in the process
+ */
+ __GLX_MEM_COPY(pc - 4, pc, compsize * 8);
+ points = (GLdouble *) (pc - 4);
+ }
+ else {
+ points = (GLdouble *) pc;
}
#else
- points = (GLdouble*) pc;
+ points = (GLdouble *) pc;
#endif
}
-void __glXDispSwap_Map2d(GLbyte *pc)
+void
+__glXDispSwap_Map2d(GLbyte * pc)
{
GLdouble u1, u2, v1, v2, *points;
GLint uorder, vorder, ustride, vstride, k, compsize;
GLenum target;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
@@ -192,80 +205,86 @@ void __glXDispSwap_Map2d(GLbyte *pc)
__GLX_SWAP_INT(pc + 36);
__GLX_SWAP_INT(pc + 40);
- target = *(GLenum *)(pc + 32);
- uorder = *(GLint *)(pc + 36);
- vorder = *(GLint *)(pc + 40);
+ target = *(GLenum *) (pc + 32);
+ uorder = *(GLint *) (pc + 36);
+ vorder = *(GLint *) (pc + 40);
k = __glEvalComputeK(target);
if (vorder <= 0 || uorder <= 0 || k < 0) {
- /* Erroneous command. */
- compsize = 0;
- } else {
- compsize = uorder * vorder * k;
+ /* Erroneous command. */
+ compsize = 0;
+ }
+ else {
+ compsize = uorder * vorder * k;
}
- __GLX_GET_DOUBLE(u1,pc);
- __GLX_GET_DOUBLE(u2,pc+8);
- __GLX_GET_DOUBLE(v1,pc+16);
- __GLX_GET_DOUBLE(v2,pc+24);
- __GLX_SWAP_DOUBLE_ARRAY(pc+44, compsize);
+ __GLX_GET_DOUBLE(u1, pc);
+ __GLX_GET_DOUBLE(u2, pc + 8);
+ __GLX_GET_DOUBLE(v1, pc + 16);
+ __GLX_GET_DOUBLE(v2, pc + 24);
+ __GLX_SWAP_DOUBLE_ARRAY(pc + 44, compsize);
pc += 44;
ustride = vorder * k;
vstride = k;
#ifdef __GLX_ALIGN64
- if (((unsigned long)pc) & 7) {
- /*
- ** Copy the doubles up 4 bytes, trashing the command but aligning
- ** the data in the process
- */
- __GLX_MEM_COPY(pc-4, pc, compsize*8);
- points = (GLdouble*) (pc - 4);
- } else {
- points = (GLdouble*) pc;
+ if (((unsigned long) pc) & 7) {
+ /*
+ ** Copy the doubles up 4 bytes, trashing the command but aligning
+ ** the data in the process
+ */
+ __GLX_MEM_COPY(pc - 4, pc, compsize * 8);
+ points = (GLdouble *) (pc - 4);
+ }
+ else {
+ points = (GLdouble *) pc;
}
#else
- points = (GLdouble*) pc;
+ points = (GLdouble *) pc;
#endif
}
-void __glXDispSwap_CallLists(GLbyte *pc)
+void
+__glXDispSwap_CallLists(GLbyte * pc)
{
GLenum type;
GLsizei n;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_DECLARE_SWAP_ARRAY_VARIABLES;
__GLX_SWAP_INT(pc + 4);
__GLX_SWAP_INT(pc + 0);
- type = *(GLenum *)(pc + 4);
- n = *(GLsizei *)(pc + 0);
+ type = *(GLenum *) (pc + 4);
+ n = *(GLsizei *) (pc + 0);
switch (type) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- case GL_2_BYTES:
- case GL_3_BYTES:
- case GL_4_BYTES:
- break;
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- __GLX_SWAP_SHORT_ARRAY(pc+8, n);
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- __GLX_SWAP_INT_ARRAY(pc+8, n);
- break;
- case GL_FLOAT:
- __GLX_SWAP_FLOAT_ARRAY(pc+8, n);
- break;
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_2_BYTES:
+ case GL_3_BYTES:
+ case GL_4_BYTES:
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ __GLX_SWAP_SHORT_ARRAY(pc + 8, n);
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ __GLX_SWAP_INT_ARRAY(pc + 8, n);
+ break;
+ case GL_FLOAT:
+ __GLX_SWAP_FLOAT_ARRAY(pc + 8, n);
+ break;
}
}
-void __glXDispSwap_DrawArrays(GLbyte *pc)
+void
+__glXDispSwap_DrawArrays(GLbyte * pc)
{
- __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *)pc;
+ __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *) pc;
__GLXdispatchDrawArraysComponentHeader *compHeader;
int i;
+
__GLX_DECLARE_SWAP_VARIABLES;
__GLX_SWAP_INT(&hdr->numVertexes);
@@ -276,10 +295,10 @@ void __glXDispSwap_DrawArrays(GLbyte *pc)
compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc;
/* compute stride (same for all component arrays) */
- for (i=0; i<hdr->numComponents; i++) {
- __GLX_SWAP_INT(&compHeader[i].datatype);
- __GLX_SWAP_INT(&compHeader[i].numVals);
- __GLX_SWAP_INT(&compHeader[i].component);
+ for (i = 0; i < hdr->numComponents; i++) {
+ __GLX_SWAP_INT(&compHeader[i].datatype);
+ __GLX_SWAP_INT(&compHeader[i].numVals);
+ __GLX_SWAP_INT(&compHeader[i].component);
}
diff --git a/xorg-server/hw/dmx/glxProxy/renderpixswap.c b/xorg-server/hw/dmx/glxProxy/renderpixswap.c
index e0ed7e77d..3458e611c 100644
--- a/xorg-server/hw/dmx/glxProxy/renderpixswap.c
+++ b/xorg-server/hw/dmx/glxProxy/renderpixswap.c
@@ -1,383 +1,406 @@
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * 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 including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#include "glxserver.h"
-#include "unpack.h"
-#include "g_disptab.h"
-
-void __glXDispSwap_PolygonStipple(GLbyte *pc)
-{
- __GLXpixelHeader *hdr = (__GLXpixelHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_Bitmap(GLbyte *pc)
-{
- __GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_FLOAT((GLbyte *)&hdr->xorig);
- __GLX_SWAP_FLOAT((GLbyte *)&hdr->yorig);
- __GLX_SWAP_FLOAT((GLbyte *)&hdr->xmove);
- __GLX_SWAP_FLOAT((GLbyte *)&hdr->ymove);
-
- hdr->swapBytes = !hdr->swapBytes;
-
-}
-
-void __glXDispSwap_TexImage1D(GLbyte *pc)
-{
- __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->level);
- __GLX_SWAP_INT((GLbyte *)&hdr->components);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_INT((GLbyte *)&hdr->border);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_TexImage2D(GLbyte *pc)
-{
- __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->level);
- __GLX_SWAP_INT((GLbyte *)&hdr->components);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_INT((GLbyte *)&hdr->border);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_TexImage3D(GLbyte *pc)
-{
- __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight);
- __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipImages);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->level);
- __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_INT((GLbyte *)&hdr->depth);
- __GLX_SWAP_INT((GLbyte *)&hdr->size4d);
- __GLX_SWAP_INT((GLbyte *)&hdr->border);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_DrawPixels(GLbyte *pc)
-{
- __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_TexSubImage1D(GLbyte *pc)
-{
- __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->level);
- __GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_TexSubImage2D(GLbyte *pc)
-{
- __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->level);
- __GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
- __GLX_SWAP_INT((GLbyte *)&hdr->yoffset);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_TexSubImage3D(GLbyte *pc)
-{
- __GLXdispatchTexSubImage3DHeader *hdr =
- (__GLXdispatchTexSubImage3DHeader *) pc;
-
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->imageHeight);
- __GLX_SWAP_INT((GLbyte *)&hdr->imageDepth);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipImages);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipVolumes);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->level);
- __GLX_SWAP_INT((GLbyte *)&hdr->xoffset);
- __GLX_SWAP_INT((GLbyte *)&hdr->yoffset);
- __GLX_SWAP_INT((GLbyte *)&hdr->zoffset);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_INT((GLbyte *)&hdr->depth);
- __GLX_SWAP_INT((GLbyte *)&hdr->size4d);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_ColorTable(GLbyte *pc)
-{
- __GLXdispatchColorTableHeader *hdr =
- (__GLXdispatchColorTableHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_ColorSubTable(GLbyte *pc)
-{
- __GLXdispatchColorSubTableHeader *hdr =
- (__GLXdispatchColorSubTableHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->start);
- __GLX_SWAP_INT((GLbyte *)&hdr->count);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_ConvolutionFilter1D(GLbyte *pc)
-{
- __GLXdispatchConvolutionFilterHeader *hdr =
- (__GLXdispatchConvolutionFilterHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_ConvolutionFilter2D(GLbyte *pc)
-{
- __GLXdispatchConvolutionFilterHeader *hdr =
- (__GLXdispatchConvolutionFilterHeader *) pc;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
-
-void __glXDispSwap_SeparableFilter2D(GLbyte *pc)
-{
- __GLXdispatchConvolutionFilterHeader *hdr =
- (__GLXdispatchConvolutionFilterHeader *) pc;
- GLint hdrlen;
- __GLX_DECLARE_SWAP_VARIABLES;
-
- hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->rowLength);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipRows);
- __GLX_SWAP_INT((GLbyte *)&hdr->skipPixels);
- __GLX_SWAP_INT((GLbyte *)&hdr->alignment);
-
- __GLX_SWAP_INT((GLbyte *)&hdr->target);
- __GLX_SWAP_INT((GLbyte *)&hdr->internalformat);
- __GLX_SWAP_INT((GLbyte *)&hdr->width);
- __GLX_SWAP_INT((GLbyte *)&hdr->height);
- __GLX_SWAP_INT((GLbyte *)&hdr->format);
- __GLX_SWAP_INT((GLbyte *)&hdr->type);
-
- /*
- ** Just invert swapBytes flag; the GL will figure out if it needs to swap
- ** the pixel data.
- */
- hdr->swapBytes = !hdr->swapBytes;
-}
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * 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 including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * 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
+ * SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#include "glxserver.h"
+#include "unpack.h"
+#include "g_disptab.h"
+
+void
+__glXDispSwap_PolygonStipple(GLbyte * pc)
+{
+ __GLXpixelHeader *hdr = (__GLXpixelHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_Bitmap(GLbyte * pc)
+{
+ __GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_FLOAT((GLbyte *) & hdr->xorig);
+ __GLX_SWAP_FLOAT((GLbyte *) & hdr->yorig);
+ __GLX_SWAP_FLOAT((GLbyte *) & hdr->xmove);
+ __GLX_SWAP_FLOAT((GLbyte *) & hdr->ymove);
+
+ hdr->swapBytes = !hdr->swapBytes;
+
+}
+
+void
+__glXDispSwap_TexImage1D(GLbyte * pc)
+{
+ __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->level);
+ __GLX_SWAP_INT((GLbyte *) & hdr->components);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_INT((GLbyte *) & hdr->border);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_TexImage2D(GLbyte * pc)
+{
+ __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->level);
+ __GLX_SWAP_INT((GLbyte *) & hdr->components);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_INT((GLbyte *) & hdr->border);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_TexImage3D(GLbyte * pc)
+{
+ __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->imageHeight);
+ __GLX_SWAP_INT((GLbyte *) & hdr->imageDepth);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipImages);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipVolumes);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->level);
+ __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_INT((GLbyte *) & hdr->depth);
+ __GLX_SWAP_INT((GLbyte *) & hdr->size4d);
+ __GLX_SWAP_INT((GLbyte *) & hdr->border);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_DrawPixels(GLbyte * pc)
+{
+ __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_TexSubImage1D(GLbyte * pc)
+{
+ __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->level);
+ __GLX_SWAP_INT((GLbyte *) & hdr->xoffset);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_TexSubImage2D(GLbyte * pc)
+{
+ __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->level);
+ __GLX_SWAP_INT((GLbyte *) & hdr->xoffset);
+ __GLX_SWAP_INT((GLbyte *) & hdr->yoffset);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_TexSubImage3D(GLbyte * pc)
+{
+ __GLXdispatchTexSubImage3DHeader *hdr =
+ (__GLXdispatchTexSubImage3DHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->imageHeight);
+ __GLX_SWAP_INT((GLbyte *) & hdr->imageDepth);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipImages);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipVolumes);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->level);
+ __GLX_SWAP_INT((GLbyte *) & hdr->xoffset);
+ __GLX_SWAP_INT((GLbyte *) & hdr->yoffset);
+ __GLX_SWAP_INT((GLbyte *) & hdr->zoffset);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_INT((GLbyte *) & hdr->depth);
+ __GLX_SWAP_INT((GLbyte *) & hdr->size4d);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_ColorTable(GLbyte * pc)
+{
+ __GLXdispatchColorTableHeader *hdr = (__GLXdispatchColorTableHeader *) pc;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_ColorSubTable(GLbyte * pc)
+{
+ __GLXdispatchColorSubTableHeader *hdr =
+ (__GLXdispatchColorSubTableHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->start);
+ __GLX_SWAP_INT((GLbyte *) & hdr->count);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_ConvolutionFilter1D(GLbyte * pc)
+{
+ __GLXdispatchConvolutionFilterHeader *hdr =
+ (__GLXdispatchConvolutionFilterHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_ConvolutionFilter2D(GLbyte * pc)
+{
+ __GLXdispatchConvolutionFilterHeader *hdr =
+ (__GLXdispatchConvolutionFilterHeader *) pc;
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
+
+void
+__glXDispSwap_SeparableFilter2D(GLbyte * pc)
+{
+ __GLXdispatchConvolutionFilterHeader *hdr =
+ (__GLXdispatchConvolutionFilterHeader *) pc;
+ GLint hdrlen;
+
+ __GLX_DECLARE_SWAP_VARIABLES;
+
+ hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_HDR_SIZE);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->rowLength);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipRows);
+ __GLX_SWAP_INT((GLbyte *) & hdr->skipPixels);
+ __GLX_SWAP_INT((GLbyte *) & hdr->alignment);
+
+ __GLX_SWAP_INT((GLbyte *) & hdr->target);
+ __GLX_SWAP_INT((GLbyte *) & hdr->internalformat);
+ __GLX_SWAP_INT((GLbyte *) & hdr->width);
+ __GLX_SWAP_INT((GLbyte *) & hdr->height);
+ __GLX_SWAP_INT((GLbyte *) & hdr->format);
+ __GLX_SWAP_INT((GLbyte *) & hdr->type);
+
+ /*
+ ** Just invert swapBytes flag; the GL will figure out if it needs to swap
+ ** the pixel data.
+ */
+ hdr->swapBytes = !hdr->swapBytes;
+}
diff --git a/xorg-server/hw/dmx/input/ChkNotMaskEv.c b/xorg-server/hw/dmx/input/ChkNotMaskEv.c
index 635332e63..bde04ae23 100644
--- a/xorg-server/hw/dmx/input/ChkNotMaskEv.c
+++ b/xorg-server/hw/dmx/input/ChkNotMaskEv.c
@@ -67,40 +67,40 @@ extern long const _Xevent_to_mask[];
* If not, flush buffer and see if any more events are readable. If one
* matches, return. If all else fails, tell the user no events found.
*/
-Bool XCheckNotMaskEvent (Display *dpy, long mask, XEvent *event)
+Bool
+XCheckNotMaskEvent(Display * dpy, long mask, XEvent * event)
{
- register _XQEvent *prev, *qelt;
- unsigned long qe_serial = 0;
- int n; /* time through count */
+ register _XQEvent *prev, *qelt;
+ unsigned long qe_serial = 0;
+ int n; /* time through count */
- LockDisplay(dpy);
- prev = NULL;
- for (n = 3; --n >= 0;) {
- for (qelt = prev ? prev->next : dpy->head;
- qelt;
- prev = qelt, qelt = qelt->next) {
- if (qelt->event.type >= LASTEvent
- || !(_Xevent_to_mask[qelt->event.type] & mask)) {
- *event = qelt->event;
- _XDeq(dpy, prev, qelt);
- UnlockDisplay(dpy);
- return True;
- }
- }
- if (prev)
- qe_serial = prev->qserial_num;
- switch (n) {
- case 2:
- _XEventsQueued(dpy, QueuedAfterReading);
- break;
- case 1:
- _XFlush(dpy);
- break;
- }
- if (prev && prev->qserial_num != qe_serial)
- /* another thread has snatched this event */
- prev = NULL;
- }
- UnlockDisplay(dpy);
- return False;
+ LockDisplay(dpy);
+ prev = NULL;
+ for (n = 3; --n >= 0;) {
+ for (qelt = prev ? prev->next : dpy->head;
+ qelt; prev = qelt, qelt = qelt->next) {
+ if (qelt->event.type >= LASTEvent
+ || !(_Xevent_to_mask[qelt->event.type] & mask)) {
+ *event = qelt->event;
+ _XDeq(dpy, prev, qelt);
+ UnlockDisplay(dpy);
+ return True;
+ }
+ }
+ if (prev)
+ qe_serial = prev->qserial_num;
+ switch (n) {
+ case 2:
+ _XEventsQueued(dpy, QueuedAfterReading);
+ break;
+ case 1:
+ _XFlush(dpy);
+ break;
+ }
+ if (prev && prev->qserial_num != qe_serial)
+ /* another thread has snatched this event */
+ prev = NULL;
+ }
+ UnlockDisplay(dpy);
+ return False;
}
diff --git a/xorg-server/hw/dmx/input/dmxarg.c b/xorg-server/hw/dmx/input/dmxarg.c
index 49a1da9af..4a74b4c9e 100644
--- a/xorg-server/hw/dmx/input/dmxarg.c
+++ b/xorg-server/hw/dmx/input/dmxarg.c
@@ -51,86 +51,99 @@
/** Stores the parsed argument list. */
struct _dmxArg {
- int argc; /**< Number of arguments in argv */
- int argm; /**< Maximum number of arguments store-able in argv */
+ int argc; /**< Number of arguments in argv */
+ int argm; /**< Maximum number of arguments store-able in argv */
const char **argv; /**< Arguments */
};
/** Create an (externally opaque) \a dmxArg object. */
-dmxArg dmxArgCreate(void)
+dmxArg
+dmxArgCreate(void)
{
- dmxArg a = malloc(sizeof(*a));
- a->argc = 0;
- a->argm = 2;
- a->argv = malloc(a->argm * sizeof(*a->argv));
+ dmxArg a = malloc(sizeof(*a));
+
+ a->argc = 0;
+ a->argm = 2;
+ a->argv = malloc(a->argm * sizeof(*a->argv));
a->argv[0] = NULL;
return a;
}
/** Free the specified \a dmxArg object. */
-void dmxArgFree(dmxArg a)
+void
+dmxArgFree(dmxArg a)
{
int i;
- for (i = 0; i < a->argc; i++) free((char *)a->argv[i]);
+ for (i = 0; i < a->argc; i++)
+ free((char *) a->argv[i]);
free(a->argv);
free(a);
}
/** Add the \a string as the next argument in the \a dmxArg object. */
-void dmxArgAdd(dmxArg a, const char *string)
+void
+dmxArgAdd(dmxArg a, const char *string)
{
if (a->argm <= a->argc + 2)
a->argv = realloc(a->argv, sizeof(*a->argv) * (a->argm *= 2));
a->argv[a->argc++] = strdup(string);
- a->argv[a->argc] = NULL;
+ a->argv[a->argc] = NULL;
}
/** Return the argument number \a item in the \a dmxArg object.
* Arguments are 0 based. NULL will be returned for values less than 0
* or equal to or greater than the number of arguments in the object. */
-const char *dmxArgV(dmxArg a, int item)
+const char *
+dmxArgV(dmxArg a, int item)
{
- if (item < 0 || item >= a->argc) return NULL;
+ if (item < 0 || item >= a->argc)
+ return NULL;
return a->argv[item];
}
/** Return the number of arguments in the \a dmxArg object. */
-int dmxArgC(dmxArg a)
+int
+dmxArgC(dmxArg a)
{
return a->argc;
}
/** Parse a string into arguments delimited by commas. Return a new \a
* dmxArg object containing the arguments. */
-dmxArg dmxArgParse(const char *string)
+dmxArg
+dmxArgParse(const char *string)
{
- char *tmp;
- char *start, *pt;
+ char *tmp;
+ char *start, *pt;
dmxArg a = dmxArgCreate();
- int done;
- int len;
+ int done;
+ int len;
- if (!string) return a;
+ if (!string)
+ return a;
len = strlen(string) + 2;
tmp = malloc(len);
strncpy(tmp, string, len);
for (start = pt = tmp, done = 0; !done && *pt; start = ++pt) {
- for (;*pt && *pt != ','; pt++);
- if (!*pt) done = 1;
+ for (; *pt && *pt != ','; pt++);
+ if (!*pt)
+ done = 1;
*pt = '\0';
dmxArgAdd(a, start);
}
- if (!done) dmxArgAdd(a, ""); /* Final comma */
-
+ if (!done)
+ dmxArgAdd(a, ""); /* Final comma */
+
free(tmp);
return a;
}
#if DMX_ARG_TEST
-static void dmxArgPrint(dmxArg a)
+static void
+dmxArgPrint(dmxArg a)
{
int i;
@@ -139,7 +152,8 @@ static void dmxArgPrint(dmxArg a)
printf(" argv[%d] = \"%s\"\n", i, dmxArgV(a, i));
}
-static void dmxArgTest(const char *string)
+static void
+dmxArgTest(const char *string)
{
dmxArg a;
@@ -155,7 +169,8 @@ static void dmxArgTest(const char *string)
dmxArgFree(a);
}
-int main(void)
+int
+main(void)
{
dmxArgTest(NULL);
dmxArgTest("");
diff --git a/xorg-server/hw/dmx/input/dmxbackend.c b/xorg-server/hw/dmx/input/dmxbackend.c
index 35e9e9616..9463c87d3 100644
--- a/xorg-server/hw/dmx/input/dmxbackend.c
+++ b/xorg-server/hw/dmx/input/dmxbackend.c
@@ -1,616 +1,665 @@
-/*
- * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * David H. Dawes <dawes@xfree86.org>
- * Kevin E. Martin <kem@redhat.com>
- * Rickard E. (Rik) Faith <faith@redhat.com>
- */
-
-/** \file
- * These routines support taking input from devices on the backend
- * (output) displays. \see dmxcommon.c. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#define DMX_BACKEND_DEBUG 0
-
-#include "dmxinputinit.h"
-#include "dmxbackend.h"
-#include "dmxcommon.h"
-#include "dmxconsole.h"
-#include "dmxcursor.h"
-#include "dmxprop.h"
-#include "dmxsync.h"
-#include "dmxcb.h" /* For dmxGlobalWidth and dmxGlobalHeight */
-#include "dmxevents.h" /* For dmxGetGlobalPosition */
-#include "ChkNotMaskEv.h"
-
-#include "inputstr.h"
-#include "input.h"
-#include <X11/keysym.h>
-#include "mipointer.h"
-#include "scrnintstr.h"
-#include "windowstr.h"
-
-/* Private area for backend devices. */
-typedef struct _myPrivate {
- DMX_COMMON_PRIVATE;
- int myScreen;
- DMXScreenInfo *grabbedScreen;
-
- int lastX, lastY;
- int centerX, centerY;
- int relative;
- int newscreen;
- int initialized;
- DevicePtr mou, kbd;
- int entered;
- int offX, offY;
-} myPrivate;
-
-#if DMX_BACKEND_DEBUG
-#define DMXDBG0(f) dmxLog(dmxDebug,f)
-#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a)
-#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
-#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
-#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d)
-#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
-#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g)
-#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
-#define DMXDBG8(f,a,b,c,d,e,g,h,i) dmxLog(dmxDebug,f,a,b,c,d,e,g,h,i)
-#define DMXDBG9(f,a,b,c,d,e,g,h,i,j) dmxLog(dmxDebug,f,a,b,c,d,e,g,h,i,j)
-#else
-#define DMXDBG0(f)
-#define DMXDBG1(f,a)
-#define DMXDBG2(f,a,b)
-#define DMXDBG3(f,a,b,c)
-#define DMXDBG4(f,a,b,c,d)
-#define DMXDBG5(f,a,b,c,d,e)
-#define DMXDBG6(f,a,b,c,d,e,g)
-#define DMXDBG7(f,a,b,c,d,e,g,h)
-#define DMXDBG8(f,a,b,c,d,e,g,h,i)
-#define DMXDBG9(f,a,b,c,d,e,g,h,i,j)
-#endif
-
-/** Create and return a private data structure. */
-pointer dmxBackendCreatePrivate(DeviceIntPtr pDevice)
-{
- GETDMXLOCALFROMPDEVICE;
- myPrivate *priv = calloc(1, sizeof(*priv));
- priv->dmxLocal = dmxLocal;
- return priv;
-}
-
-/** Destroy the private data structure. No checking is performed to
- * verify that the structure was actually created by
- * #dmxBackendCreatePrivate. */
-void dmxBackendDestroyPrivate(pointer private)
-{
- free(private);
-}
-
-static void *dmxBackendTestScreen(DMXScreenInfo *dmxScreen, void *closure)
-{
- long target = (long)closure;
-
- if (dmxScreen->index == target) return dmxScreen;
- return NULL;
-}
-
-/* Return non-zero if screen and priv->myScreen are on the same physical
- * backend display (1 if they are the same screen, 2 if they are
- * different screens). Since this is a common operation, the results
- * are cached. The cache is invalidated if \a priv is NULL (this should
- * be done with each server generation and reconfiguration). */
-static int dmxBackendSameDisplay(myPrivate *priv, long screen)
-{
- static myPrivate *oldpriv = NULL;
- static int oldscreen = -1;
- static int retcode = 0;
-
- if (priv == oldpriv && screen == oldscreen) return retcode;
- if (!priv) { /* Invalidate cache */
- oldpriv = NULL;
- oldscreen = -1;
- retcode = 0;
- return 0;
- }
-
- if (screen == priv->myScreen) retcode = 1;
- else if (screen < 0 || screen >= dmxNumScreens) retcode = 0;
- else if (dmxPropertyIterate(priv->be,
- dmxBackendTestScreen,
- (void *)screen)) retcode = 2;
- else retcode = 0;
-
- oldpriv = priv;
- oldscreen = screen;
- return retcode;
-}
-
-static void *dmxBackendTestEvents(DMXScreenInfo *dmxScreen, void *closure)
-{
- XEvent *X = (XEvent *)closure;
-
- if (XCheckNotMaskEvent(dmxScreen->beDisplay, ExposureMask, X))
- return dmxScreen;
- return NULL;
-}
-
-static void *dmxBackendTestMotionEvent(DMXScreenInfo *dmxScreen, void *closure)
-{
- XEvent *X = (XEvent *)closure;
-
- if (XCheckTypedEvent(dmxScreen->beDisplay, MotionNotify, X))
- return dmxScreen;
- return NULL;
-}
-
-static DMXScreenInfo *dmxBackendGetEvent(myPrivate *priv, XEvent *X)
-{
- DMXScreenInfo *dmxScreen;
-
- if ((dmxScreen = dmxPropertyIterate(priv->be, dmxBackendTestEvents, X)))
- return dmxScreen;
- return NULL;
-}
-
-static DMXScreenInfo *dmxBackendPendingMotionEvent(myPrivate *priv, int save)
-{
- DMXScreenInfo *dmxScreen;
- XEvent N;
-
- if ((dmxScreen = dmxPropertyIterate(priv->be,
- dmxBackendTestMotionEvent, &N))) {
- if (save) XPutBackEvent(dmxScreen->beDisplay, &N);
- return dmxScreen;
- }
- return NULL;
-}
-
-static void *dmxBackendTestWindow(DMXScreenInfo *dmxScreen, void *closure)
-{
- Window win = (Window)(long)closure;
- if (dmxScreen->scrnWin == win) return dmxScreen;
- return NULL;
-}
-
-static DMXScreenInfo *dmxBackendFindWindow(myPrivate *priv, Window win)
-{
- return dmxPropertyIterate(priv->be, dmxBackendTestWindow,
- (void *)(long)win);
-}
-
-/* If the cursor is over a set of overlapping screens and one of those
- * screens takes backend input, then we want that particular screen to
- * be current, not one of the other ones. */
-static int dmxBackendFindOverlapping(myPrivate *priv, int screen, int x, int y)
-{
- DMXScreenInfo *start = &dmxScreens[screen];
- DMXScreenInfo *pt;
-
- if (!start->over) return screen;
-
- for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
- if (pt->index == priv->myScreen
- && dmxOnScreen(x, y, &dmxScreens[pt->index])) return pt->index;
- if (pt == start) break;
- }
- return screen;
-}
-
-/* Return non-zero if \a x and \a y are off \a screen. */
-static int dmxBackendOffscreen(int screen, int x, int y)
-{
- DMXScreenInfo *dmxScreen = &dmxScreens[screen];
-
- return (!dmxOnScreen(x, y, dmxScreen));
-}
-
-/** This routine is called from #dmxCoreMotion for each motion
- * event. \a x and \a y are global coordinants. */
-void dmxBackendUpdatePosition(pointer private, int x, int y)
-{
- GETPRIVFROMPRIVATE;
- int screen = miPointerGetScreen(inputInfo.pointer)->myNum;
- DMXScreenInfo *dmxScreen = &dmxScreens[priv->myScreen];
- int oldRelative = priv->relative;
- int topscreen = dmxBackendFindOverlapping(priv, screen, x, y);
- int same = dmxBackendSameDisplay(priv, topscreen);
- int offscreen = dmxBackendOffscreen(priv->myScreen, x, y);
- int offthis = dmxBackendOffscreen(screen, x, y);
-
- DMXDBG9("dmxBackendUpdatePosition(%d,%d) my=%d mi=%d rel=%d"
- " topscreen=%d same=%d offscreen=%d offthis=%d\n",
- x, y, priv->myScreen, screen, priv->relative,
- topscreen, same, offscreen, offthis);
-
- if (offscreen) {
- /* If the cursor is off the input screen, it should be moving
- * relative unless it is visible on a screen of the same display
- * (i.e., one that shares the mouse). */
- if (same == 2 && !offthis) {
- if (priv->relative) {
- DMXDBG0(" Off screen, but not absolute\n");
- priv->relative = 0;
- }
- } else {
- if (!priv->relative) {
- DMXDBG0(" Off screen, but not relative\n");
- priv->relative = 1;
- }
- }
- } else {
- if (topscreen != screen) {
- DMXDBG2(" Using screen %d instead of %d (from mi)\n",
- topscreen, screen);
- }
- if (same) {
- if (priv->relative) {
- DMXDBG0(" On screen, but not absolute\n");
- priv->relative = 0;
- }
- } else {
- if (!priv->relative) {
- DMXDBG0(" Not on screen, but not relative\n");
- priv->relative = 1;
- }
- }
- }
-
- if (oldRelative != priv->relative) {
- DMXDBG2(" Do switch, relative=%d same=%d\n",
- priv->relative, same);
- /* Discard all pre-switch events */
- dmxSync(dmxScreen, TRUE);
- while (dmxBackendPendingMotionEvent(priv, FALSE));
-
- if (dmxInput->console && offscreen) {
- /* Our special case is a console window and a backend window
- * share a display. In this case, the cursor is either on
- * the backend window (taking absolute input), or not (in
- * which case the cursor needs to be in the console
- * window). */
- if (priv->grabbedScreen) {
- DMXDBG2(" *** force ungrab on %s, display=%p\n",
- priv->grabbedScreen->name,
- priv->grabbedScreen->beDisplay);
- XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime);
- dmxSync(priv->grabbedScreen, TRUE);
- priv->grabbedScreen = NULL;
- }
- DMXDBG0(" Capturing console\n");
- dmxConsoleCapture(dmxInput);
- } else {
- priv->newscreen = 1;
- if (priv->relative && !dmxInput->console) {
- DMXDBG5(" Hide cursor; warp from %d,%d to %d,%d on %d\n",
- priv->lastX, priv->lastY, priv->centerX, priv->centerY,
- priv->myScreen);
- dmxConsoleUncapture(dmxInput);
- dmxHideCursor(dmxScreen);
- priv->lastX = priv->centerX;
- priv->lastY = priv->centerY;
- XWarpPointer(priv->display, None, priv->window,
- 0, 0, 0, 0, priv->lastX, priv->lastY);
- dmxSync(dmxScreen, TRUE);
- } else {
- DMXDBG0(" Check cursor\n");
- dmxCheckCursor();
- }
- }
- }
-}
-
-/** Get events from the X queue on the backend servers and put the
- * events into the DMX event queue. */
-void dmxBackendCollectEvents(DevicePtr pDev,
- dmxMotionProcPtr motion,
- dmxEnqueueProcPtr enqueue,
- dmxCheckSpecialProcPtr checkspecial,
- DMXBlockType block)
-{
- GETPRIVFROMPDEV;
- GETDMXINPUTFROMPRIV;
- XEvent X;
- DMXScreenInfo *dmxScreen;
- int left = 0;
- int entered = priv->entered;
- int ignoreLeave = 0;
- int v[2];
- int retcode;
-
- while ((dmxScreen = dmxBackendGetEvent(priv, &X))) {
- switch (X.type) {
- case EnterNotify:
- dmxCommonSaveState(priv);
- if (entered++)
- continue;
- priv->entered = 1;
- ignoreLeave = 1;
- DMXDBG5("dmxBackendCollectEvents: Enter %lu %d,%d; GRAB %s %p\n",
- X.xcrossing.root, X.xcrossing.x, X.xcrossing.y,
- dmxScreen->name, dmxScreen->beDisplay);
- XRaiseWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
- priv->grabbedScreen = dmxScreen;
- if ((retcode = XGrabPointer(dmxScreen->beDisplay,
- dmxScreen->scrnWin,
- True, 0, GrabModeAsync,
- GrabModeAsync, None, None,
- CurrentTime))) {
- dmxLog(dmxError,
- "XGrabPointer failed during backend enter (%d)\n",
- retcode);
- }
- break;
- case LeaveNotify:
- if (ignoreLeave) {
- ignoreLeave = 0;
- continue;
- }
- dmxCommonRestoreState(priv);
- if (left++)
- continue;
- DMXDBG7("dmxBackendCollectEvents: Leave %lu %d,%d %d %d %s %s\n",
- X.xcrossing.root, X.xcrossing.x, X.xcrossing.y,
- X.xcrossing.detail, X.xcrossing.focus,
- priv->grabbedScreen ? "UNGRAB" : "",
- dmxScreen->name);
- if (priv->grabbedScreen) {
- XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime);
- dmxSync(priv->grabbedScreen, TRUE);
- priv->grabbedScreen = NULL;
- }
- break;
- case MotionNotify:
- DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)"
- " newscreen=%d: %d %d (e=%d; last=%d,%d)\n",
- dmxScreen->index, priv->myScreen,
- miPointerCurrentScreen()->myNum,
- priv->newscreen,
- X.xmotion.x, X.xmotion.y,
- entered, priv->lastX, priv->lastY);
- if (dmxBackendPendingMotionEvent(priv, TRUE))
- continue;
- if (!(dmxScreen = dmxBackendFindWindow(priv, X.xmotion.window)))
- dmxLog(dmxFatal,
- " Event on non-existant window %lu\n",
- X.xmotion.window);
- if (!priv->relative || dmxInput->console) {
- int newX = X.xmotion.x - dmxScreen->rootX;
- int newY = X.xmotion.y - dmxScreen->rootY;
-
- if (!priv->newscreen) {
- int width = dmxScreen->rootWidth;
- int height = dmxScreen->rootHeight;
- if (!newX) newX = -1;
- if (newX == width - 1) newX = width;
- if (!newY) newY = -1;
- if (newY == height - 1) newY = height;
- }
- priv->newscreen = 0;
- v[0] = dmxScreen->rootXOrigin + newX;
- v[1] = dmxScreen->rootYOrigin + newY;
- DMXDBG8(" Absolute move: %d,%d (r=%dx%d+%d+%d s=%dx%d)\n",
- v[0], v[1],
- priv->be->rootWidth, priv->be->rootHeight,
- priv->be->rootX, priv->be->rootY,
- priv->be->scrnWidth, priv->be->scrnHeight);
- motion(priv->mou, v, 0, 2, DMX_ABSOLUTE, block);
- priv->entered = 0;
- } else {
- int newX = priv->lastX - X.xmotion.x;
- int newY = priv->lastY - X.xmotion.y;
- priv->lastX = X.xmotion.x;
- priv->lastY = X.xmotion.y;
- v[0] = newX;
- v[1] = newY;
- DMXDBG2(" Relative move: %d, %d\n", v[0], v[1]);
- motion(priv->mou, v, 0, 2, DMX_RELATIVE, block);
- }
- if (entered && priv->relative) {
- DMXDBG4(" **** Relative %d %d instead of absolute %d %d\n",
- v[0], v[1],
- (dmxScreen->rootXOrigin + X.xmotion.x
- - dmxScreen->rootX),
- (dmxScreen->rootYOrigin + X.xmotion.y
- - dmxScreen->rootY));
- }
- break;
-
- case KeyPress:
- case KeyRelease:
- enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block);
- break;
- case ButtonPress:
- case ButtonRelease:
- /* fall-through */
- default:
- /* Pass the whole event here, because
- * this may be an extension event. */
- enqueue(priv->mou, X.type, X.xbutton.button, 0, &X, block);
- break;
- }
- }
-}
-
-/** Called after input events are processed from the DMX queue. No
- * event processing actually takes place here, but this is a convenient
- * place to update the pointer. */
-void dmxBackendProcessInput(pointer private)
-{
- GETPRIVFROMPRIVATE;
-
- DMXDBG6("dmxBackendProcessInput: myScreen=%d relative=%d"
- " last=%d,%d center=%d,%d\n",
- priv->myScreen, priv->relative,
- priv->lastX, priv->lastY,
- priv->centerX, priv->centerY);
-
- if (priv->relative
- && !dmxInput->console
- && (priv->lastX != priv->centerX || priv->lastY != priv->centerY)) {
- DMXDBG4(" warping pointer from last=%d,%d to center=%d,%d\n",
- priv->lastX, priv->lastY, priv->centerX, priv->centerY);
- priv->lastX = priv->centerX;
- priv->lastY = priv->centerY;
- XWarpPointer(priv->display, None, priv->window,
- 0, 0, 0, 0, priv->lastX, priv->lastY);
- dmxSync(&dmxScreens[priv->myScreen], TRUE);
- }
-}
-
-static void dmxBackendComputeCenter(myPrivate *priv)
-{
- int centerX;
- int centerY;
-
- centerX = priv->be->rootWidth / 2 + priv->be->rootX;
- centerY = priv->be->rootHeight / 2 + priv->be->rootY;
-
- if (centerX > priv->be->rootWidth) centerX = priv->be->rootWidth - 1;
- if (centerY > priv->be->rootHeight) centerY = priv->be->rootHeight - 1;
- if (centerX < 1) centerX = 1;
- if (centerY < 1) centerY = 1;
-
- priv->centerX = centerX;
- priv->centerY = centerY;
-}
-
-static DMXScreenInfo *dmxBackendInitPrivate(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
- DMXScreenInfo *dmxScreen;
- int i;
-
- /* Fill in myPrivate */
- for (i = 0,dmxScreen = &dmxScreens[0]; i<dmxNumScreens; i++,dmxScreen++) {
- if (dmxPropertySameDisplay(dmxScreen, dmxInput->name)) {
- priv->display = dmxScreen->beDisplay;
- priv->window = dmxScreen->scrnWin;
- priv->be = dmxScreen;
- break;
- }
- }
-
- if (i >= dmxNumScreens)
- dmxLog(dmxFatal,
- "%s is not an existing backend display - cannot initialize\n",
- dmxInput->name);
-
- return dmxScreen;
-}
-
-/** Re-initialized the backend device described by \a pDev (after a
- * reconfig). */
-void dmxBackendLateReInit(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- int x, y;
-
- DMXDBG1("dmxBackendLateReInit miPointerCurrentScreen() = %p\n",
- miPointerCurrentScreen());
-
- dmxBackendSameDisplay(NULL, 0); /* Invalidate cache */
- dmxBackendInitPrivate(pDev);
- dmxBackendComputeCenter(priv);
- dmxGetGlobalPosition(&x, &y);
- dmxInvalidateGlobalPosition(); /* To force event processing */
- dmxBackendUpdatePosition(priv, x, y);
-}
-
-/** Initialized the backend device described by \a pDev. */
-void dmxBackendInit(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- DMXScreenInfo *dmxScreen;
-
- dmxBackendSameDisplay(NULL, 0); /* Invalidate cache */
-
- if (dmxLocal->type == DMX_LOCAL_MOUSE) priv->mou = pDev;
- if (dmxLocal->type == DMX_LOCAL_KEYBOARD) priv->kbd = pDev;
- if (priv->initialized++) return; /* Only do once for mouse/keyboard pair */
-
- dmxScreen = dmxBackendInitPrivate(pDev);
-
- /* Finish initialization using computed values or constants. */
- dmxBackendComputeCenter(priv);
- priv->eventMask = (EnterWindowMask|LeaveWindowMask);
- priv->myScreen = dmxScreen->index;
- priv->lastX = priv->centerX;
- priv->lastY = priv->centerY;
- priv->relative = 0;
- priv->newscreen = 0;
-}
-
-/** Get information about the backend pointer (for initialization). */
-void dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
-{
- const DMXScreenInfo *dmxScreen = dmxBackendInitPrivate(pDev);
-
- info->buttonClass = 1;
- dmxCommonMouGetMap(pDev, info->map, &info->numButtons);
- info->valuatorClass = 1;
- info->numRelAxes = 2;
- info->minval[0] = 0;
- info->minval[1] = 0;
- info->maxval[0] = dmxScreen->beWidth;
- info->maxval[1] = dmxScreen->beHeight;
- info->res[0] = 1;
- info->minres[0] = 0;
- info->maxres[0] = 1;
- info->ptrFeedbackClass = 1;
-}
-
-/** Get information about the backend keyboard (for initialization). */
-void dmxBackendKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
-{
- dmxCommonKbdGetInfo(pDev, info);
- info->keyboard = 1;
- info->keyClass = 1;
- dmxCommonKbdGetMap(pDev, &info->keySyms, info->modMap);
- info->freemap = 1;
- info->focusClass = 1;
- info->kbdFeedbackClass = 1;
-}
-
-/** Process #DMXFunctionType functions. The only function handled here
- * is to acknowledge a pending server shutdown. */
-int dmxBackendFunctions(pointer private, DMXFunctionType function)
-{
- switch (function) {
- case DMX_FUNCTION_TERMINATE:
- return 1;
- default:
- return 0;
- }
-}
+/*
+ * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * David H. Dawes <dawes@xfree86.org>
+ * Kevin E. Martin <kem@redhat.com>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ */
+
+/** \file
+ * These routines support taking input from devices on the backend
+ * (output) displays. \see dmxcommon.c. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_BACKEND_DEBUG 0
+
+#include "dmxinputinit.h"
+#include "dmxbackend.h"
+#include "dmxcommon.h"
+#include "dmxconsole.h"
+#include "dmxcursor.h"
+#include "dmxprop.h"
+#include "dmxsync.h"
+#include "dmxcb.h" /* For dmxGlobalWidth and dmxGlobalHeight */
+#include "dmxevents.h" /* For dmxGetGlobalPosition */
+#include "ChkNotMaskEv.h"
+
+#include "inputstr.h"
+#include "input.h"
+#include <X11/keysym.h>
+#include "mipointer.h"
+#include "scrnintstr.h"
+#include "windowstr.h"
+
+/* Private area for backend devices. */
+typedef struct _myPrivate {
+ DMX_COMMON_PRIVATE;
+ int myScreen;
+ DMXScreenInfo *grabbedScreen;
+
+ int lastX, lastY;
+ int centerX, centerY;
+ int relative;
+ int newscreen;
+ int initialized;
+ DevicePtr mou, kbd;
+ int entered;
+ int offX, offY;
+} myPrivate;
+
+#if DMX_BACKEND_DEBUG
+#define DMXDBG0(f) dmxLog(dmxDebug,f)
+#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a)
+#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
+#define DMXDBG8(f,a,b,c,d,e,g,h,i) dmxLog(dmxDebug,f,a,b,c,d,e,g,h,i)
+#define DMXDBG9(f,a,b,c,d,e,g,h,i,j) dmxLog(dmxDebug,f,a,b,c,d,e,g,h,i,j)
+#else
+#define DMXDBG0(f)
+#define DMXDBG1(f,a)
+#define DMXDBG2(f,a,b)
+#define DMXDBG3(f,a,b,c)
+#define DMXDBG4(f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h)
+#define DMXDBG8(f,a,b,c,d,e,g,h,i)
+#define DMXDBG9(f,a,b,c,d,e,g,h,i,j)
+#endif
+
+/** Create and return a private data structure. */
+pointer
+dmxBackendCreatePrivate(DeviceIntPtr pDevice)
+{
+ GETDMXLOCALFROMPDEVICE;
+ myPrivate *priv = calloc(1, sizeof(*priv));
+
+ priv->dmxLocal = dmxLocal;
+ return priv;
+}
+
+/** Destroy the private data structure. No checking is performed to
+ * verify that the structure was actually created by
+ * #dmxBackendCreatePrivate. */
+void
+dmxBackendDestroyPrivate(pointer private)
+{
+ free(private);
+}
+
+static void *
+dmxBackendTestScreen(DMXScreenInfo * dmxScreen, void *closure)
+{
+ long target = (long) closure;
+
+ if (dmxScreen->index == target)
+ return dmxScreen;
+ return NULL;
+}
+
+/* Return non-zero if screen and priv->myScreen are on the same physical
+ * backend display (1 if they are the same screen, 2 if they are
+ * different screens). Since this is a common operation, the results
+ * are cached. The cache is invalidated if \a priv is NULL (this should
+ * be done with each server generation and reconfiguration). */
+static int
+dmxBackendSameDisplay(myPrivate * priv, long screen)
+{
+ static myPrivate *oldpriv = NULL;
+ static int oldscreen = -1;
+ static int retcode = 0;
+
+ if (priv == oldpriv && screen == oldscreen)
+ return retcode;
+ if (!priv) { /* Invalidate cache */
+ oldpriv = NULL;
+ oldscreen = -1;
+ retcode = 0;
+ return 0;
+ }
+
+ if (screen == priv->myScreen)
+ retcode = 1;
+ else if (screen < 0 || screen >= dmxNumScreens)
+ retcode = 0;
+ else if (dmxPropertyIterate(priv->be,
+ dmxBackendTestScreen, (void *) screen))
+ retcode = 2;
+ else
+ retcode = 0;
+
+ oldpriv = priv;
+ oldscreen = screen;
+ return retcode;
+}
+
+static void *
+dmxBackendTestEvents(DMXScreenInfo * dmxScreen, void *closure)
+{
+ XEvent *X = (XEvent *) closure;
+
+ if (XCheckNotMaskEvent(dmxScreen->beDisplay, ExposureMask, X))
+ return dmxScreen;
+ return NULL;
+}
+
+static void *
+dmxBackendTestMotionEvent(DMXScreenInfo * dmxScreen, void *closure)
+{
+ XEvent *X = (XEvent *) closure;
+
+ if (XCheckTypedEvent(dmxScreen->beDisplay, MotionNotify, X))
+ return dmxScreen;
+ return NULL;
+}
+
+static DMXScreenInfo *
+dmxBackendGetEvent(myPrivate * priv, XEvent * X)
+{
+ DMXScreenInfo *dmxScreen;
+
+ if ((dmxScreen = dmxPropertyIterate(priv->be, dmxBackendTestEvents, X)))
+ return dmxScreen;
+ return NULL;
+}
+
+static DMXScreenInfo *
+dmxBackendPendingMotionEvent(myPrivate * priv, int save)
+{
+ DMXScreenInfo *dmxScreen;
+ XEvent N;
+
+ if ((dmxScreen = dmxPropertyIterate(priv->be,
+ dmxBackendTestMotionEvent, &N))) {
+ if (save)
+ XPutBackEvent(dmxScreen->beDisplay, &N);
+ return dmxScreen;
+ }
+ return NULL;
+}
+
+static void *
+dmxBackendTestWindow(DMXScreenInfo * dmxScreen, void *closure)
+{
+ Window win = (Window) (long) closure;
+
+ if (dmxScreen->scrnWin == win)
+ return dmxScreen;
+ return NULL;
+}
+
+static DMXScreenInfo *
+dmxBackendFindWindow(myPrivate * priv, Window win)
+{
+ return dmxPropertyIterate(priv->be, dmxBackendTestWindow,
+ (void *) (long) win);
+}
+
+/* If the cursor is over a set of overlapping screens and one of those
+ * screens takes backend input, then we want that particular screen to
+ * be current, not one of the other ones. */
+static int
+dmxBackendFindOverlapping(myPrivate * priv, int screen, int x, int y)
+{
+ DMXScreenInfo *start = &dmxScreens[screen];
+ DMXScreenInfo *pt;
+
+ if (!start->over)
+ return screen;
+
+ for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) {
+ if (pt->index == priv->myScreen
+ && dmxOnScreen(x, y, &dmxScreens[pt->index]))
+ return pt->index;
+ if (pt == start)
+ break;
+ }
+ return screen;
+}
+
+/* Return non-zero if \a x and \a y are off \a screen. */
+static int
+dmxBackendOffscreen(int screen, int x, int y)
+{
+ DMXScreenInfo *dmxScreen = &dmxScreens[screen];
+
+ return (!dmxOnScreen(x, y, dmxScreen));
+}
+
+/** This routine is called from #dmxCoreMotion for each motion
+ * event. \a x and \a y are global coordinants. */
+void
+dmxBackendUpdatePosition(pointer private, int x, int y)
+{
+ GETPRIVFROMPRIVATE;
+ int screen = miPointerGetScreen(inputInfo.pointer)->myNum;
+ DMXScreenInfo *dmxScreen = &dmxScreens[priv->myScreen];
+ int oldRelative = priv->relative;
+ int topscreen = dmxBackendFindOverlapping(priv, screen, x, y);
+ int same = dmxBackendSameDisplay(priv, topscreen);
+ int offscreen = dmxBackendOffscreen(priv->myScreen, x, y);
+ int offthis = dmxBackendOffscreen(screen, x, y);
+
+ DMXDBG9("dmxBackendUpdatePosition(%d,%d) my=%d mi=%d rel=%d"
+ " topscreen=%d same=%d offscreen=%d offthis=%d\n",
+ x, y, priv->myScreen, screen, priv->relative,
+ topscreen, same, offscreen, offthis);
+
+ if (offscreen) {
+ /* If the cursor is off the input screen, it should be moving
+ * relative unless it is visible on a screen of the same display
+ * (i.e., one that shares the mouse). */
+ if (same == 2 && !offthis) {
+ if (priv->relative) {
+ DMXDBG0(" Off screen, but not absolute\n");
+ priv->relative = 0;
+ }
+ }
+ else {
+ if (!priv->relative) {
+ DMXDBG0(" Off screen, but not relative\n");
+ priv->relative = 1;
+ }
+ }
+ }
+ else {
+ if (topscreen != screen) {
+ DMXDBG2(" Using screen %d instead of %d (from mi)\n",
+ topscreen, screen);
+ }
+ if (same) {
+ if (priv->relative) {
+ DMXDBG0(" On screen, but not absolute\n");
+ priv->relative = 0;
+ }
+ }
+ else {
+ if (!priv->relative) {
+ DMXDBG0(" Not on screen, but not relative\n");
+ priv->relative = 1;
+ }
+ }
+ }
+
+ if (oldRelative != priv->relative) {
+ DMXDBG2(" Do switch, relative=%d same=%d\n", priv->relative, same);
+ /* Discard all pre-switch events */
+ dmxSync(dmxScreen, TRUE);
+ while (dmxBackendPendingMotionEvent(priv, FALSE));
+
+ if (dmxInput->console && offscreen) {
+ /* Our special case is a console window and a backend window
+ * share a display. In this case, the cursor is either on
+ * the backend window (taking absolute input), or not (in
+ * which case the cursor needs to be in the console
+ * window). */
+ if (priv->grabbedScreen) {
+ DMXDBG2(" *** force ungrab on %s, display=%p\n",
+ priv->grabbedScreen->name,
+ priv->grabbedScreen->beDisplay);
+ XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime);
+ dmxSync(priv->grabbedScreen, TRUE);
+ priv->grabbedScreen = NULL;
+ }
+ DMXDBG0(" Capturing console\n");
+ dmxConsoleCapture(dmxInput);
+ }
+ else {
+ priv->newscreen = 1;
+ if (priv->relative && !dmxInput->console) {
+ DMXDBG5(" Hide cursor; warp from %d,%d to %d,%d on %d\n",
+ priv->lastX, priv->lastY, priv->centerX, priv->centerY,
+ priv->myScreen);
+ dmxConsoleUncapture(dmxInput);
+ dmxHideCursor(dmxScreen);
+ priv->lastX = priv->centerX;
+ priv->lastY = priv->centerY;
+ XWarpPointer(priv->display, None, priv->window,
+ 0, 0, 0, 0, priv->lastX, priv->lastY);
+ dmxSync(dmxScreen, TRUE);
+ }
+ else {
+ DMXDBG0(" Check cursor\n");
+ dmxCheckCursor();
+ }
+ }
+ }
+}
+
+/** Get events from the X queue on the backend servers and put the
+ * events into the DMX event queue. */
+void
+dmxBackendCollectEvents(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial, DMXBlockType block)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+ XEvent X;
+ DMXScreenInfo *dmxScreen;
+ int left = 0;
+ int entered = priv->entered;
+ int ignoreLeave = 0;
+ int v[2];
+ int retcode;
+
+ while ((dmxScreen = dmxBackendGetEvent(priv, &X))) {
+ switch (X.type) {
+ case EnterNotify:
+ dmxCommonSaveState(priv);
+ if (entered++)
+ continue;
+ priv->entered = 1;
+ ignoreLeave = 1;
+ DMXDBG5("dmxBackendCollectEvents: Enter %lu %d,%d; GRAB %s %p\n",
+ X.xcrossing.root, X.xcrossing.x, X.xcrossing.y,
+ dmxScreen->name, dmxScreen->beDisplay);
+ XRaiseWindow(dmxScreen->beDisplay, dmxScreen->scrnWin);
+ priv->grabbedScreen = dmxScreen;
+ if ((retcode = XGrabPointer(dmxScreen->beDisplay,
+ dmxScreen->scrnWin,
+ True, 0, GrabModeAsync,
+ GrabModeAsync, None, None,
+ CurrentTime))) {
+ dmxLog(dmxError,
+ "XGrabPointer failed during backend enter (%d)\n",
+ retcode);
+ }
+ break;
+ case LeaveNotify:
+ if (ignoreLeave) {
+ ignoreLeave = 0;
+ continue;
+ }
+ dmxCommonRestoreState(priv);
+ if (left++)
+ continue;
+ DMXDBG7("dmxBackendCollectEvents: Leave %lu %d,%d %d %d %s %s\n",
+ X.xcrossing.root, X.xcrossing.x, X.xcrossing.y,
+ X.xcrossing.detail, X.xcrossing.focus,
+ priv->grabbedScreen ? "UNGRAB" : "", dmxScreen->name);
+ if (priv->grabbedScreen) {
+ XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime);
+ dmxSync(priv->grabbedScreen, TRUE);
+ priv->grabbedScreen = NULL;
+ }
+ break;
+ case MotionNotify:
+ DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)"
+ " newscreen=%d: %d %d (e=%d; last=%d,%d)\n",
+ dmxScreen->index, priv->myScreen,
+ miPointerCurrentScreen()->myNum,
+ priv->newscreen,
+ X.xmotion.x, X.xmotion.y,
+ entered, priv->lastX, priv->lastY);
+ if (dmxBackendPendingMotionEvent(priv, TRUE))
+ continue;
+ if (!(dmxScreen = dmxBackendFindWindow(priv, X.xmotion.window)))
+ dmxLog(dmxFatal,
+ " Event on non-existant window %lu\n",
+ X.xmotion.window);
+ if (!priv->relative || dmxInput->console) {
+ int newX = X.xmotion.x - dmxScreen->rootX;
+ int newY = X.xmotion.y - dmxScreen->rootY;
+
+ if (!priv->newscreen) {
+ int width = dmxScreen->rootWidth;
+ int height = dmxScreen->rootHeight;
+
+ if (!newX)
+ newX = -1;
+ if (newX == width - 1)
+ newX = width;
+ if (!newY)
+ newY = -1;
+ if (newY == height - 1)
+ newY = height;
+ }
+ priv->newscreen = 0;
+ v[0] = dmxScreen->rootXOrigin + newX;
+ v[1] = dmxScreen->rootYOrigin + newY;
+ DMXDBG8(" Absolute move: %d,%d (r=%dx%d+%d+%d s=%dx%d)\n",
+ v[0], v[1],
+ priv->be->rootWidth, priv->be->rootHeight,
+ priv->be->rootX, priv->be->rootY,
+ priv->be->scrnWidth, priv->be->scrnHeight);
+ motion(priv->mou, v, 0, 2, DMX_ABSOLUTE, block);
+ priv->entered = 0;
+ }
+ else {
+ int newX = priv->lastX - X.xmotion.x;
+ int newY = priv->lastY - X.xmotion.y;
+
+ priv->lastX = X.xmotion.x;
+ priv->lastY = X.xmotion.y;
+ v[0] = newX;
+ v[1] = newY;
+ DMXDBG2(" Relative move: %d, %d\n", v[0], v[1]);
+ motion(priv->mou, v, 0, 2, DMX_RELATIVE, block);
+ }
+ if (entered && priv->relative) {
+ DMXDBG4(" **** Relative %d %d instead of absolute %d %d\n",
+ v[0], v[1],
+ (dmxScreen->rootXOrigin + X.xmotion.x
+ - dmxScreen->rootX),
+ (dmxScreen->rootYOrigin + X.xmotion.y
+ - dmxScreen->rootY));
+ }
+ break;
+
+ case KeyPress:
+ case KeyRelease:
+ enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block);
+ break;
+ case ButtonPress:
+ case ButtonRelease:
+ /* fall-through */
+ default:
+ /* Pass the whole event here, because
+ * this may be an extension event. */
+ enqueue(priv->mou, X.type, X.xbutton.button, 0, &X, block);
+ break;
+ }
+ }
+}
+
+/** Called after input events are processed from the DMX queue. No
+ * event processing actually takes place here, but this is a convenient
+ * place to update the pointer. */
+void
+dmxBackendProcessInput(pointer private)
+{
+ GETPRIVFROMPRIVATE;
+
+ DMXDBG6("dmxBackendProcessInput: myScreen=%d relative=%d"
+ " last=%d,%d center=%d,%d\n",
+ priv->myScreen, priv->relative,
+ priv->lastX, priv->lastY, priv->centerX, priv->centerY);
+
+ if (priv->relative
+ && !dmxInput->console
+ && (priv->lastX != priv->centerX || priv->lastY != priv->centerY)) {
+ DMXDBG4(" warping pointer from last=%d,%d to center=%d,%d\n",
+ priv->lastX, priv->lastY, priv->centerX, priv->centerY);
+ priv->lastX = priv->centerX;
+ priv->lastY = priv->centerY;
+ XWarpPointer(priv->display, None, priv->window,
+ 0, 0, 0, 0, priv->lastX, priv->lastY);
+ dmxSync(&dmxScreens[priv->myScreen], TRUE);
+ }
+}
+
+static void
+dmxBackendComputeCenter(myPrivate * priv)
+{
+ int centerX;
+ int centerY;
+
+ centerX = priv->be->rootWidth / 2 + priv->be->rootX;
+ centerY = priv->be->rootHeight / 2 + priv->be->rootY;
+
+ if (centerX > priv->be->rootWidth)
+ centerX = priv->be->rootWidth - 1;
+ if (centerY > priv->be->rootHeight)
+ centerY = priv->be->rootHeight - 1;
+ if (centerX < 1)
+ centerX = 1;
+ if (centerY < 1)
+ centerY = 1;
+
+ priv->centerX = centerX;
+ priv->centerY = centerY;
+}
+
+static DMXScreenInfo *
+dmxBackendInitPrivate(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+ DMXScreenInfo *dmxScreen;
+ int i;
+
+ /* Fill in myPrivate */
+ for (i = 0, dmxScreen = &dmxScreens[0]; i < dmxNumScreens; i++, dmxScreen++) {
+ if (dmxPropertySameDisplay(dmxScreen, dmxInput->name)) {
+ priv->display = dmxScreen->beDisplay;
+ priv->window = dmxScreen->scrnWin;
+ priv->be = dmxScreen;
+ break;
+ }
+ }
+
+ if (i >= dmxNumScreens)
+ dmxLog(dmxFatal,
+ "%s is not an existing backend display - cannot initialize\n",
+ dmxInput->name);
+
+ return dmxScreen;
+}
+
+/** Re-initialized the backend device described by \a pDev (after a
+ * reconfig). */
+void
+dmxBackendLateReInit(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ int x, y;
+
+ DMXDBG1("dmxBackendLateReInit miPointerCurrentScreen() = %p\n",
+ miPointerCurrentScreen());
+
+ dmxBackendSameDisplay(NULL, 0); /* Invalidate cache */
+ dmxBackendInitPrivate(pDev);
+ dmxBackendComputeCenter(priv);
+ dmxGetGlobalPosition(&x, &y);
+ dmxInvalidateGlobalPosition(); /* To force event processing */
+ dmxBackendUpdatePosition(priv, x, y);
+}
+
+/** Initialized the backend device described by \a pDev. */
+void
+dmxBackendInit(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ DMXScreenInfo *dmxScreen;
+
+ dmxBackendSameDisplay(NULL, 0); /* Invalidate cache */
+
+ if (dmxLocal->type == DMX_LOCAL_MOUSE)
+ priv->mou = pDev;
+ if (dmxLocal->type == DMX_LOCAL_KEYBOARD)
+ priv->kbd = pDev;
+ if (priv->initialized++)
+ return; /* Only do once for mouse/keyboard pair */
+
+ dmxScreen = dmxBackendInitPrivate(pDev);
+
+ /* Finish initialization using computed values or constants. */
+ dmxBackendComputeCenter(priv);
+ priv->eventMask = (EnterWindowMask | LeaveWindowMask);
+ priv->myScreen = dmxScreen->index;
+ priv->lastX = priv->centerX;
+ priv->lastY = priv->centerY;
+ priv->relative = 0;
+ priv->newscreen = 0;
+}
+
+/** Get information about the backend pointer (for initialization). */
+void
+dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ const DMXScreenInfo *dmxScreen = dmxBackendInitPrivate(pDev);
+
+ info->buttonClass = 1;
+ dmxCommonMouGetMap(pDev, info->map, &info->numButtons);
+ info->valuatorClass = 1;
+ info->numRelAxes = 2;
+ info->minval[0] = 0;
+ info->minval[1] = 0;
+ info->maxval[0] = dmxScreen->beWidth;
+ info->maxval[1] = dmxScreen->beHeight;
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
+ info->ptrFeedbackClass = 1;
+}
+
+/** Get information about the backend keyboard (for initialization). */
+void
+dmxBackendKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ dmxCommonKbdGetInfo(pDev, info);
+ info->keyboard = 1;
+ info->keyClass = 1;
+ dmxCommonKbdGetMap(pDev, &info->keySyms, info->modMap);
+ info->freemap = 1;
+ info->focusClass = 1;
+ info->kbdFeedbackClass = 1;
+}
+
+/** Process #DMXFunctionType functions. The only function handled here
+ * is to acknowledge a pending server shutdown. */
+int
+dmxBackendFunctions(pointer private, DMXFunctionType function)
+{
+ switch (function) {
+ case DMX_FUNCTION_TERMINATE:
+ return 1;
+ default:
+ return 0;
+ }
+}
diff --git a/xorg-server/hw/dmx/input/dmxcommon.c b/xorg-server/hw/dmx/input/dmxcommon.c
index 29c1958ad..5f25e8832 100644
--- a/xorg-server/hw/dmx/input/dmxcommon.c
+++ b/xorg-server/hw/dmx/input/dmxcommon.c
@@ -1,669 +1,698 @@
-/*
- * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * David H. Dawes <dawes@xfree86.org>
- * Kevin E. Martin <kem@redhat.com>
- * Rickard E. (Rik) Faith <faith@redhat.com>
- */
-
-/** \file
- *
- * This file implements common routines used by the backend and console
- * input devices.
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#define DMX_STATE_DEBUG 0
-
-#include "dmxinputinit.h"
-#include "dmxcommon.h"
-#include "dmxconsole.h"
-#include "dmxprop.h"
-#include "dmxsync.h"
-#include "dmxmap.h"
-
-#include "inputstr.h"
-#include "input.h"
-#include <X11/keysym.h>
-#include "mipointer.h"
-#include "scrnintstr.h"
-
-#include <unistd.h> /* For usleep() */
-
-#if DMX_STATE_DEBUG
-#define DMXDBG0(f) dmxLog(dmxDebug,f)
-#else
-#define DMXDBG0(f)
-#endif
-
-/** Each device has a private area that is visible only from inside the
- * driver code. */
-typedef struct _myPrivate {
- DMX_COMMON_PRIVATE;
-} myPrivate;
-
-static void dmxCommonKbdSetAR(Display *display,
- unsigned char *old, unsigned char *new)
-{
- XKeyboardControl kc;
- XKeyboardState ks;
- unsigned long mask = KBKey | KBAutoRepeatMode;
- int i, j;
- int minKeycode, maxKeycode;
-
- if (!old) {
- XGetKeyboardControl(display, &ks);
- old = (unsigned char *)ks.auto_repeats;
- }
-
- XDisplayKeycodes(display, &minKeycode, &maxKeycode);
- for (i = 1; i < 32; i++) {
- if (!old || old[i] != new[i]) {
- for (j = 0; j < 8; j++) {
- if ((new[i] & (1 << j)) != (old[i] & (1 << j))) {
- kc.key = i * 8 + j;
- kc.auto_repeat_mode = ((new[i] & (1 << j))
- ? AutoRepeatModeOn
- : AutoRepeatModeOff);
- if (kc.key >= minKeycode && kc.key <= maxKeycode)
- XChangeKeyboardControl(display, mask, &kc);
- }
- }
- }
- }
-}
-
-static void dmxCommonKbdSetLeds(Display *display, unsigned long new)
-{
- int i;
- XKeyboardControl kc;
-
- for (i = 0; i < 32; i++) {
- kc.led = i + 1;
- kc.led_mode = (new & (1 << i)) ? LedModeOn : LedModeOff;
- XChangeKeyboardControl(display, KBLed | KBLedMode, &kc);
- }
-}
-
-static void dmxCommonKbdSetCtrl(Display *display,
- KeybdCtrl *old, KeybdCtrl *new)
-{
- XKeyboardControl kc;
- unsigned long mask = KBKeyClickPercent | KBAutoRepeatMode;
-
- if (!old
- || old->click != new->click
- || old->autoRepeat != new->autoRepeat) {
-
- kc.key_click_percent = new->click;
- kc.auto_repeat_mode = new->autoRepeat;
-
- XChangeKeyboardControl(display, mask, &kc);
- }
-
- dmxCommonKbdSetLeds(display, new->leds);
- dmxCommonKbdSetAR(display, old ? old->autoRepeats : NULL,
- new->autoRepeats);
-}
-
-static void dmxCommonMouSetCtrl(Display *display, PtrCtrl *old, PtrCtrl *new)
-{
- Bool do_accel, do_threshold;
-
- if (!old
- || old->num != new->num
- || old->den != new->den
- || old->threshold != new->threshold) {
- do_accel = (new->num > 0 && new->den > 0);
- do_threshold = (new->threshold > 0);
- if (do_accel || do_threshold) {
- XChangePointerControl(display, do_accel, do_threshold,
- new->num, new->den, new->threshold);
- }
- }
-}
-
-/** Update the keyboard control. */
-void dmxCommonKbdCtrl(DevicePtr pDev, KeybdCtrl *ctrl)
-{
- GETPRIVFROMPDEV;
-
- if (!priv->stateSaved && priv->be) dmxCommonSaveState(priv);
- if (!priv->display || !priv->stateSaved) return;
- dmxCommonKbdSetCtrl(priv->display,
- priv->kctrlset ? &priv->kctrl : NULL,
- ctrl);
- priv->kctrl = *ctrl;
- priv->kctrlset = 1;
-}
-
-/** Update the mouse control. */
-void dmxCommonMouCtrl(DevicePtr pDev, PtrCtrl *ctrl)
-{
- GETPRIVFROMPDEV;
-
- /* Don't set the acceleration for the
- * console, because that should be
- * controlled by the X server that the
- * console is running on. Otherwise,
- * the acceleration for the console
- * window would be unexpected for the
- * scale of the window. */
- if (priv->be) {
- dmxCommonMouSetCtrl(priv->display,
- priv->mctrlset ? &priv->mctrl : NULL,
- ctrl);
- priv->mctrl = *ctrl;
- priv->mctrlset = 1;
- }
-}
-
-/** Sound they keyboard bell. */
-void dmxCommonKbdBell(DevicePtr pDev, int percent,
- int volume, int pitch, int duration)
-{
- GETPRIVFROMPDEV;
- XKeyboardControl kc;
- XKeyboardState ks;
- unsigned long mask = KBBellPercent | KBBellPitch | KBBellDuration;
-
- if (!priv->be) XGetKeyboardControl(priv->display, &ks);
- kc.bell_percent = volume;
- kc.bell_pitch = pitch;
- kc.bell_duration = duration;
- XChangeKeyboardControl(priv->display, mask, &kc);
- XBell(priv->display, percent);
- if (!priv->be) {
- kc.bell_percent = ks.bell_percent;
- kc.bell_pitch = ks.bell_pitch;
- kc.bell_duration = ks.bell_duration;
- XChangeKeyboardControl(priv->display, mask, &kc);
- }
-}
-
-/** Get the keyboard mapping. */
-void dmxCommonKbdGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- GETPRIVFROMPDEV;
- int min_keycode;
- int max_keycode;
- int map_width;
- KeySym *keyboard_mapping;
- XModifierKeymap *modifier_mapping;
- int i, j;
-
- /* Compute pKeySyms. Cast
- * XGetKeyboardMapping because of
- * compiler warning on 64-bit machines.
- * We assume pointers to 32-bit and
- * 64-bit ints are the same. */
- XDisplayKeycodes(priv->display, &min_keycode, &max_keycode);
- keyboard_mapping = (KeySym *)XGetKeyboardMapping(priv->display,
- min_keycode,
- max_keycode
- - min_keycode + 1,
- &map_width);
- pKeySyms->minKeyCode = min_keycode;
- pKeySyms->maxKeyCode = max_keycode;
- pKeySyms->mapWidth = map_width;
- pKeySyms->map = keyboard_mapping;
-
-
- /* Compute pModMap */
- modifier_mapping = XGetModifierMapping(priv->display);
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = 0;
- for (j = 0; j < 8; j++) {
- int max_keypermod = modifier_mapping->max_keypermod;
-
- for (i = 0; i < max_keypermod; i++) {
- CARD8 keycode = modifier_mapping->modifiermap[j*max_keypermod + i];
- if (keycode)
- pModMap[keycode] |= 1 << j;
- }
- }
- XFreeModifiermap(modifier_mapping);
-}
-
-/** Fill in the XKEYBOARD parts of the \a info structure for the
- * specified \a pDev. */
-void dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
-{
- GETPRIVFROMPDEV;
- GETDMXINPUTFROMPRIV;
- char *pt;
-
- dmxCommonSaveState(priv);
- if (priv->xkb) {
-#define NAME(x) \
- priv->xkb->names->x ? XGetAtomName(priv->display,priv->xkb->names->x) : NULL
- info->names.keycodes = NAME(keycodes);
- info->names.types = NAME(types);
- info->names.compat = NAME(compat);
- info->names.symbols = NAME(symbols);
- info->names.geometry = NAME(geometry);
- info->freenames = 1;
-#undef NAME
- dmxLogInput(dmxInput,
- "XKEYBOARD: keycodes = %s\n", info->names.keycodes);
- dmxLogInput(dmxInput,
- "XKEYBOARD: symbols = %s\n", info->names.symbols);
- dmxLogInput(dmxInput,
- "XKEYBOARD: geometry = %s\n", info->names.geometry);
- if ((pt = strchr(info->names.keycodes, '+'))) *pt = '\0';
- }
- dmxCommonRestoreState(priv);
-}
-
-/** Turn \a pDev on (i.e., take input from \a pDev). */
-int dmxCommonKbdOn(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- if (priv->be) dmxCommonSaveState(priv);
- priv->eventMask |= DMX_KEYBOARD_EVENT_MASK;
- XSelectInput(priv->display, priv->window, priv->eventMask);
- if (priv->be)
- XSetInputFocus(priv->display, priv->window, RevertToPointerRoot,
- CurrentTime);
- return -1;
-}
-
-/** Turn \a pDev off. */
-void dmxCommonKbdOff(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- priv->eventMask &= ~DMX_KEYBOARD_EVENT_MASK;
- XSelectInput(priv->display, priv->window, priv->eventMask);
- dmxCommonRestoreState(priv);
-}
-
-/** Turn \a pDev on (i.e., take input from \a pDev). */
-int dmxCommonOthOn(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- GETDMXINPUTFROMPRIV;
- XEventClass event_list[DMX_MAX_XINPUT_EVENT_TYPES];
- int event_type[DMX_MAX_XINPUT_EVENT_TYPES];
- int count = 0;
-
-#define ADD(type) \
- if (count < DMX_MAX_XINPUT_EVENT_TYPES) { \
- type(priv->xi, event_type[count], event_list[count]); \
- if (event_type[count]) { \
- dmxMapInsert(dmxLocal, event_type[count], XI_##type); \
- ++count; \
- } \
- } else { \
- dmxLog(dmxWarning, "More than %d event types for %s\n", \
- DMX_MAX_XINPUT_EVENT_TYPES, dmxInput->name); \
- }
-
- if (!(priv->xi = XOpenDevice(priv->display, dmxLocal->deviceId))) {
- dmxLog(dmxWarning, "Cannot open %s device (id=%d) on %s\n",
- dmxLocal->deviceName ? dmxLocal->deviceName : "(unknown)",
- dmxLocal->deviceId, dmxInput->name);
- return -1;
- }
- ADD(DeviceKeyPress);
- ADD(DeviceKeyRelease);
- ADD(DeviceButtonPress);
- ADD(DeviceButtonRelease);
- ADD(DeviceMotionNotify);
- ADD(DeviceFocusIn);
- ADD(DeviceFocusOut);
- ADD(ProximityIn);
- ADD(ProximityOut);
- ADD(DeviceStateNotify);
- ADD(DeviceMappingNotify);
- ADD(ChangeDeviceNotify);
- XSelectExtensionEvent(priv->display, priv->window, event_list, count);
-
- return -1;
-}
-
-/** Turn \a pDev off. */
-void dmxCommonOthOff(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
-
- if (priv->xi) XCloseDevice(priv->display, priv->xi);
- priv->xi = NULL;
-}
-
-/** Fill the \a info structure with information needed to initialize \a
- * pDev. */
-void dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
-{
- GETPRIVFROMPDEV;
- GETDMXINPUTFROMPRIV;
- XExtensionVersion *ext;
- XDeviceInfo *devices;
- Display *display = priv->display;
- int num;
- int i, j, k;
- XextErrorHandler handler;
-
- if (!display && !(display = XOpenDisplay(dmxInput->name)))
- return;
-
- /* Print out information about the XInput Extension. */
- handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler);
- ext = XGetExtensionVersion(display, INAME);
- XSetExtensionErrorHandler(handler);
-
- if (ext && ext != (XExtensionVersion *)NoSuchExtension) {
- XFree(ext);
- devices = XListInputDevices(display, &num);
- for (i = 0; i < num; i++) {
- if (devices[i].id == (XID)dmxLocal->deviceId) {
- XAnyClassPtr any;
- XKeyInfoPtr ki;
- XButtonInfoPtr bi;
- XValuatorInfoPtr vi;
- for (j = 0, any = devices[i].inputclassinfo;
- j < devices[i].num_classes;
- any = (XAnyClassPtr)((char *)any + any->length), j++) {
- switch (any->class) {
- case KeyClass:
- ki = (XKeyInfoPtr)any;
- info->keyboard = 1;
- info->keyClass = 1;
- info->keySyms.minKeyCode = ki->min_keycode;
- info->keySyms.maxKeyCode = ki->max_keycode;
- info->kbdFeedbackClass = 1;
- break;
- case ButtonClass:
- bi = (XButtonInfoPtr)any;
- info->buttonClass = 1;
- info->numButtons = bi->num_buttons;
- info->ptrFeedbackClass = 1;
- break;
- case ValuatorClass:
- /* This assume all axes are either
- * Absolute or Relative. */
- vi = (XValuatorInfoPtr)any;
- info->valuatorClass = 1;
- if (vi->mode == Absolute)
- info->numAbsAxes = vi->num_axes;
- else
- info->numRelAxes = vi->num_axes;
- for (k = 0; k < vi->num_axes; k++) {
- info->res[k] = vi->axes[k].resolution;
- info->minres[k] = vi->axes[k].resolution;
- info->maxres[k] = vi->axes[k].resolution;
- info->minval[k] = vi->axes[k].min_value;
- info->maxval[k] = vi->axes[k].max_value;
- }
- break;
- case FeedbackClass:
- /* Only keyboard and pointer feedback
- * are handled at this time. */
- break;
- case ProximityClass:
- info->proximityClass = 1;
- break;
- case FocusClass:
- info->focusClass = 1;
- break;
- case OtherClass:
- break;
- }
- }
- }
- }
- XFreeDeviceList(devices);
- }
- if (display != priv->display) XCloseDisplay(display);
-}
-
-/** Obtain the mouse button mapping. */
-void dmxCommonMouGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
-{
- GETPRIVFROMPDEV;
- int i;
-
- *nButtons = XGetPointerMapping(priv->display, map, DMX_MAX_BUTTONS);
- for (i = 0; i <= *nButtons; i++) map[i] = i;
-}
-
-static void *dmxCommonXSelect(DMXScreenInfo *dmxScreen, void *closure)
-{
- myPrivate *priv = closure;
- XSelectInput(dmxScreen->beDisplay, dmxScreen->scrnWin, priv->eventMask);
- return NULL;
-}
-
-static void *dmxCommonAddEnabledDevice(DMXScreenInfo *dmxScreen, void *closure)
-{
- AddEnabledDevice(XConnectionNumber(dmxScreen->beDisplay));
- return NULL;
-}
-
-static void *dmxCommonRemoveEnabledDevice(DMXScreenInfo *dmxScreen,
- void *closure)
-{
- RemoveEnabledDevice(XConnectionNumber(dmxScreen->beDisplay));
- return NULL;
-}
-
-/** Turn \a pDev on (i.e., take input from \a pDev). */
-int dmxCommonMouOn(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- GETDMXINPUTFROMPRIV;
-
- priv->eventMask |= DMX_POINTER_EVENT_MASK;
- if (dmxShadowFB) {
- XWarpPointer(priv->display, priv->window, priv->window,
- 0, 0, 0, 0,
- priv->initPointerX,
- priv->initPointerY);
- dmxSync(&dmxScreens[dmxInput->scrnIdx], TRUE);
- }
- if (!priv->be) {
- XSelectInput(priv->display, priv->window, priv->eventMask);
- AddEnabledDevice(XConnectionNumber(priv->display));
- } else {
- dmxPropertyIterate(priv->be, dmxCommonXSelect, priv);
- dmxPropertyIterate(priv->be, dmxCommonAddEnabledDevice, dmxInput);
- }
-
- return -1;
-}
-
-/** Turn \a pDev off. */
-void dmxCommonMouOff(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- GETDMXINPUTFROMPRIV;
-
- priv->eventMask &= ~DMX_POINTER_EVENT_MASK;
- if (!priv->be) {
- RemoveEnabledDevice(XConnectionNumber(priv->display));
- XSelectInput(priv->display, priv->window, priv->eventMask);
- } else {
- dmxPropertyIterate(priv->be, dmxCommonRemoveEnabledDevice, dmxInput);
- dmxPropertyIterate(priv->be, dmxCommonXSelect, priv);
- }
-}
-
-/** Given the global coordinates \a x and \a y, determine the screen
- * with the lowest number on which those coordinates lie. If they are
- * not on any screen, return -1. The number returned is an index into
- * \a dmxScreenInfo and is between -1 and \a dmxNumScreens - 1,
- * inclusive. */
-int dmxFindPointerScreen(int x, int y)
-{
- int i;
-
- for (i = 0; i < dmxNumScreens; i++) {
- ScreenPtr pScreen = screenInfo.screens[i];
- if (x >= pScreen->x && x < pScreen->x + pScreen->width &&
- y >= pScreen->y && y < pScreen->y + pScreen->height)
- return i;
- }
- return -1;
-}
-
-/** Returns a pointer to the private area for the device that comes just
- * prior to \a pDevice in the current \a dmxInput device list. This is
- * used as the private area for the current device in some situations
- * (e.g., when a keyboard and mouse form a pair that should share the
- * same private area). If the requested private area cannot be located,
- * then NULL is returned. */
-pointer dmxCommonCopyPrivate(DeviceIntPtr pDevice)
-{
- GETDMXLOCALFROMPDEVICE;
- DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
- int i;
-
- for (i = 0; i < dmxInput->numDevs; i++)
- if (dmxInput->devs[i] == dmxLocal && i)
- return dmxInput->devs[i-1]->private;
- return NULL;
-}
-
-/** This routine saves and resets some important state for the backend
- * and console device drivers:
- * - the modifier map is saved and set to 0 (so DMX controls the LEDs)
- * - the key click, bell, led, and repeat masks are saved and set to the
- * values that DMX claims to be using
- *
- * This routine and #dmxCommonRestoreState are used when the pointer
- * enters and leaves the console window, or when the backend window is
- * active or not active (for a full-screen window, this only happens at
- * server startup and server shutdown).
- */
-void dmxCommonSaveState(pointer private)
-{
- GETPRIVFROMPRIVATE;
- XKeyboardState ks;
- unsigned long i;
- XModifierKeymap *modmap;
-
- if (dmxInput->console) priv = dmxInput->devs[0]->private;
- if (!priv->display || priv->stateSaved) return;
- DMXDBG0("dmxCommonSaveState\n");
- if (dmxUseXKB && (priv->xkb = XkbAllocKeyboard())) {
- if (XkbGetIndicatorMap(priv->display, XkbAllIndicatorsMask, priv->xkb)
- || XkbGetNames(priv->display, XkbAllNamesMask, priv->xkb)) {
- dmxLogInput(dmxInput, "Could not get XKB information\n");
- XkbFreeKeyboard(priv->xkb, 0, True);
- priv->xkb = NULL;
- } else {
- if (priv->xkb->indicators) {
- priv->savedIndicators = *priv->xkb->indicators;
- for (i = 0; i < XkbNumIndicators; i++)
- if (priv->xkb->indicators->phys_indicators & (1 << i)) {
- priv->xkb->indicators->maps[i].flags
- = XkbIM_NoAutomatic;
- }
- XkbSetIndicatorMap(priv->display, ~0, priv->xkb);
- }
- }
- }
-
- XGetKeyboardControl(priv->display, &ks);
- priv->savedKctrl.click = ks.key_click_percent;
- priv->savedKctrl.bell = ks.bell_percent;
- priv->savedKctrl.bell_pitch = ks.bell_pitch;
- priv->savedKctrl.bell_duration = ks.bell_duration;
- priv->savedKctrl.leds = ks.led_mask;
- priv->savedKctrl.autoRepeat = ks.global_auto_repeat;
- for (i = 0; i < 32; i++)
- priv->savedKctrl.autoRepeats[i] = ks.auto_repeats[i];
-
- dmxCommonKbdSetCtrl(priv->display, &priv->savedKctrl,
- &priv->dmxLocal->kctrl);
-
- priv->savedModMap = XGetModifierMapping(priv->display);
-
- modmap = XNewModifiermap(0);
- XSetModifierMapping(priv->display, modmap);
- if (dmxInput->scrnIdx != -1)
- dmxSync(&dmxScreens[dmxInput->scrnIdx], TRUE);
- XFreeModifiermap(modmap);
-
- priv->stateSaved = 1;
-}
-
-/** This routine restores all the information saved by #dmxCommonSaveState. */
-void dmxCommonRestoreState(pointer private)
-{
- GETPRIVFROMPRIVATE;
- int retcode = -1;
- CARD32 start;
-
- if (dmxInput->console)
- priv = dmxInput->devs[0]->private;
- if (!priv->stateSaved)
- return;
- priv->stateSaved = 0;
-
- DMXDBG0("dmxCommonRestoreState\n");
- if (priv->xkb) {
- *priv->xkb->indicators = priv->savedIndicators;
- XkbSetIndicatorMap(priv->display, ~0, priv->xkb);
- XkbFreeKeyboard(priv->xkb, 0, True);
- priv->xkb = 0;
- }
-
- for (start = GetTimeInMillis(); GetTimeInMillis() - start < 5000;) {
- CARD32 tmp;
-
- retcode = XSetModifierMapping(priv->display, priv->savedModMap);
- if (retcode == MappingSuccess)
- break;
- if (retcode == MappingBusy)
- dmxLogInput(dmxInput, "Keyboard busy, waiting\n");
- else
- dmxLogInput(dmxInput, "Keyboard error, waiting\n");
-
- /* Don't generate X11 protocol for a bit */
- for (tmp = GetTimeInMillis(); GetTimeInMillis() - tmp < 250;) {
- usleep(250); /* This ends up sleeping only until
- * the next key press generates an
- * interruption. We make the delay
- * relatively short in case the user
- * pressed they keys quickly. */
- }
-
- }
- if (retcode != MappingSuccess)
- dmxLog(dmxWarning, "Unable to restore keyboard modifier state!\n");
-
- XFreeModifiermap(priv->savedModMap);
- priv->savedModMap = NULL;
-
- dmxCommonKbdSetCtrl(priv->display, NULL, &priv->savedKctrl);
- priv->kctrlset = 0; /* Invalidate copy */
-}
+/*
+ * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * David H. Dawes <dawes@xfree86.org>
+ * Kevin E. Martin <kem@redhat.com>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ */
+
+/** \file
+ *
+ * This file implements common routines used by the backend and console
+ * input devices.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_STATE_DEBUG 0
+
+#include "dmxinputinit.h"
+#include "dmxcommon.h"
+#include "dmxconsole.h"
+#include "dmxprop.h"
+#include "dmxsync.h"
+#include "dmxmap.h"
+
+#include "inputstr.h"
+#include "input.h"
+#include <X11/keysym.h>
+#include "mipointer.h"
+#include "scrnintstr.h"
+
+#include <unistd.h> /* For usleep() */
+
+#if DMX_STATE_DEBUG
+#define DMXDBG0(f) dmxLog(dmxDebug,f)
+#else
+#define DMXDBG0(f)
+#endif
+
+/** Each device has a private area that is visible only from inside the
+ * driver code. */
+typedef struct _myPrivate {
+ DMX_COMMON_PRIVATE;
+} myPrivate;
+
+static void
+dmxCommonKbdSetAR(Display * display, unsigned char *old, unsigned char *new)
+{
+ XKeyboardControl kc;
+ XKeyboardState ks;
+ unsigned long mask = KBKey | KBAutoRepeatMode;
+ int i, j;
+ int minKeycode, maxKeycode;
+
+ if (!old) {
+ XGetKeyboardControl(display, &ks);
+ old = (unsigned char *) ks.auto_repeats;
+ }
+
+ XDisplayKeycodes(display, &minKeycode, &maxKeycode);
+ for (i = 1; i < 32; i++) {
+ if (!old || old[i] != new[i]) {
+ for (j = 0; j < 8; j++) {
+ if ((new[i] & (1 << j)) != (old[i] & (1 << j))) {
+ kc.key = i * 8 + j;
+ kc.auto_repeat_mode = ((new[i] & (1 << j))
+ ? AutoRepeatModeOn
+ : AutoRepeatModeOff);
+ if (kc.key >= minKeycode && kc.key <= maxKeycode)
+ XChangeKeyboardControl(display, mask, &kc);
+ }
+ }
+ }
+ }
+}
+
+static void
+dmxCommonKbdSetLeds(Display * display, unsigned long new)
+{
+ int i;
+ XKeyboardControl kc;
+
+ for (i = 0; i < 32; i++) {
+ kc.led = i + 1;
+ kc.led_mode = (new & (1 << i)) ? LedModeOn : LedModeOff;
+ XChangeKeyboardControl(display, KBLed | KBLedMode, &kc);
+ }
+}
+
+static void
+dmxCommonKbdSetCtrl(Display * display, KeybdCtrl * old, KeybdCtrl * new)
+{
+ XKeyboardControl kc;
+ unsigned long mask = KBKeyClickPercent | KBAutoRepeatMode;
+
+ if (!old || old->click != new->click || old->autoRepeat != new->autoRepeat) {
+
+ kc.key_click_percent = new->click;
+ kc.auto_repeat_mode = new->autoRepeat;
+
+ XChangeKeyboardControl(display, mask, &kc);
+ }
+
+ dmxCommonKbdSetLeds(display, new->leds);
+ dmxCommonKbdSetAR(display, old ? old->autoRepeats : NULL, new->autoRepeats);
+}
+
+static void
+dmxCommonMouSetCtrl(Display * display, PtrCtrl * old, PtrCtrl * new)
+{
+ Bool do_accel, do_threshold;
+
+ if (!old
+ || old->num != new->num
+ || old->den != new->den || old->threshold != new->threshold) {
+ do_accel = (new->num > 0 && new->den > 0);
+ do_threshold = (new->threshold > 0);
+ if (do_accel || do_threshold) {
+ XChangePointerControl(display, do_accel, do_threshold,
+ new->num, new->den, new->threshold);
+ }
+ }
+}
+
+/** Update the keyboard control. */
+void
+dmxCommonKbdCtrl(DevicePtr pDev, KeybdCtrl * ctrl)
+{
+ GETPRIVFROMPDEV;
+
+ if (!priv->stateSaved && priv->be)
+ dmxCommonSaveState(priv);
+ if (!priv->display || !priv->stateSaved)
+ return;
+ dmxCommonKbdSetCtrl(priv->display,
+ priv->kctrlset ? &priv->kctrl : NULL, ctrl);
+ priv->kctrl = *ctrl;
+ priv->kctrlset = 1;
+}
+
+/** Update the mouse control. */
+void
+dmxCommonMouCtrl(DevicePtr pDev, PtrCtrl * ctrl)
+{
+ GETPRIVFROMPDEV;
+
+ /* Don't set the acceleration for the
+ * console, because that should be
+ * controlled by the X server that the
+ * console is running on. Otherwise,
+ * the acceleration for the console
+ * window would be unexpected for the
+ * scale of the window. */
+ if (priv->be) {
+ dmxCommonMouSetCtrl(priv->display,
+ priv->mctrlset ? &priv->mctrl : NULL, ctrl);
+ priv->mctrl = *ctrl;
+ priv->mctrlset = 1;
+ }
+}
+
+/** Sound they keyboard bell. */
+void
+dmxCommonKbdBell(DevicePtr pDev, int percent,
+ int volume, int pitch, int duration)
+{
+ GETPRIVFROMPDEV;
+ XKeyboardControl kc;
+ XKeyboardState ks;
+ unsigned long mask = KBBellPercent | KBBellPitch | KBBellDuration;
+
+ if (!priv->be)
+ XGetKeyboardControl(priv->display, &ks);
+ kc.bell_percent = volume;
+ kc.bell_pitch = pitch;
+ kc.bell_duration = duration;
+ XChangeKeyboardControl(priv->display, mask, &kc);
+ XBell(priv->display, percent);
+ if (!priv->be) {
+ kc.bell_percent = ks.bell_percent;
+ kc.bell_pitch = ks.bell_pitch;
+ kc.bell_duration = ks.bell_duration;
+ XChangeKeyboardControl(priv->display, mask, &kc);
+ }
+}
+
+/** Get the keyboard mapping. */
+void
+dmxCommonKbdGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
+{
+ GETPRIVFROMPDEV;
+ int min_keycode;
+ int max_keycode;
+ int map_width;
+ KeySym *keyboard_mapping;
+ XModifierKeymap *modifier_mapping;
+ int i, j;
+
+ /* Compute pKeySyms. Cast
+ * XGetKeyboardMapping because of
+ * compiler warning on 64-bit machines.
+ * We assume pointers to 32-bit and
+ * 64-bit ints are the same. */
+ XDisplayKeycodes(priv->display, &min_keycode, &max_keycode);
+ keyboard_mapping = (KeySym *) XGetKeyboardMapping(priv->display,
+ min_keycode,
+ max_keycode
+ - min_keycode + 1,
+ &map_width);
+ pKeySyms->minKeyCode = min_keycode;
+ pKeySyms->maxKeyCode = max_keycode;
+ pKeySyms->mapWidth = map_width;
+ pKeySyms->map = keyboard_mapping;
+
+ /* Compute pModMap */
+ modifier_mapping = XGetModifierMapping(priv->display);
+ for (i = 0; i < MAP_LENGTH; i++)
+ pModMap[i] = 0;
+ for (j = 0; j < 8; j++) {
+ int max_keypermod = modifier_mapping->max_keypermod;
+
+ for (i = 0; i < max_keypermod; i++) {
+ CARD8 keycode =
+ modifier_mapping->modifiermap[j * max_keypermod + i];
+ if (keycode)
+ pModMap[keycode] |= 1 << j;
+ }
+ }
+ XFreeModifiermap(modifier_mapping);
+}
+
+/** Fill in the XKEYBOARD parts of the \a info structure for the
+ * specified \a pDev. */
+void
+dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+ char *pt;
+
+ dmxCommonSaveState(priv);
+ if (priv->xkb) {
+#define NAME(x) \
+ priv->xkb->names->x ? XGetAtomName(priv->display,priv->xkb->names->x) : NULL
+ info->names.keycodes = NAME(keycodes);
+ info->names.types = NAME(types);
+ info->names.compat = NAME(compat);
+ info->names.symbols = NAME(symbols);
+ info->names.geometry = NAME(geometry);
+ info->freenames = 1;
+#undef NAME
+ dmxLogInput(dmxInput,
+ "XKEYBOARD: keycodes = %s\n", info->names.keycodes);
+ dmxLogInput(dmxInput,
+ "XKEYBOARD: symbols = %s\n", info->names.symbols);
+ dmxLogInput(dmxInput,
+ "XKEYBOARD: geometry = %s\n", info->names.geometry);
+ if ((pt = strchr(info->names.keycodes, '+')))
+ *pt = '\0';
+ }
+ dmxCommonRestoreState(priv);
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int
+dmxCommonKbdOn(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ if (priv->be)
+ dmxCommonSaveState(priv);
+ priv->eventMask |= DMX_KEYBOARD_EVENT_MASK;
+ XSelectInput(priv->display, priv->window, priv->eventMask);
+ if (priv->be)
+ XSetInputFocus(priv->display, priv->window, RevertToPointerRoot,
+ CurrentTime);
+ return -1;
+}
+
+/** Turn \a pDev off. */
+void
+dmxCommonKbdOff(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ priv->eventMask &= ~DMX_KEYBOARD_EVENT_MASK;
+ XSelectInput(priv->display, priv->window, priv->eventMask);
+ dmxCommonRestoreState(priv);
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int
+dmxCommonOthOn(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+ XEventClass event_list[DMX_MAX_XINPUT_EVENT_TYPES];
+ int event_type[DMX_MAX_XINPUT_EVENT_TYPES];
+ int count = 0;
+
+#define ADD(type) \
+ if (count < DMX_MAX_XINPUT_EVENT_TYPES) { \
+ type(priv->xi, event_type[count], event_list[count]); \
+ if (event_type[count]) { \
+ dmxMapInsert(dmxLocal, event_type[count], XI_##type); \
+ ++count; \
+ } \
+ } else { \
+ dmxLog(dmxWarning, "More than %d event types for %s\n", \
+ DMX_MAX_XINPUT_EVENT_TYPES, dmxInput->name); \
+ }
+
+ if (!(priv->xi = XOpenDevice(priv->display, dmxLocal->deviceId))) {
+ dmxLog(dmxWarning, "Cannot open %s device (id=%d) on %s\n",
+ dmxLocal->deviceName ? dmxLocal->deviceName : "(unknown)",
+ dmxLocal->deviceId, dmxInput->name);
+ return -1;
+ }
+ ADD(DeviceKeyPress);
+ ADD(DeviceKeyRelease);
+ ADD(DeviceButtonPress);
+ ADD(DeviceButtonRelease);
+ ADD(DeviceMotionNotify);
+ ADD(DeviceFocusIn);
+ ADD(DeviceFocusOut);
+ ADD(ProximityIn);
+ ADD(ProximityOut);
+ ADD(DeviceStateNotify);
+ ADD(DeviceMappingNotify);
+ ADD(ChangeDeviceNotify);
+ XSelectExtensionEvent(priv->display, priv->window, event_list, count);
+
+ return -1;
+}
+
+/** Turn \a pDev off. */
+void
+dmxCommonOthOff(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+
+ if (priv->xi)
+ XCloseDevice(priv->display, priv->xi);
+ priv->xi = NULL;
+}
+
+/** Fill the \a info structure with information needed to initialize \a
+ * pDev. */
+void
+dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+ XExtensionVersion *ext;
+ XDeviceInfo *devices;
+ Display *display = priv->display;
+ int num;
+ int i, j, k;
+ XextErrorHandler handler;
+
+ if (!display && !(display = XOpenDisplay(dmxInput->name)))
+ return;
+
+ /* Print out information about the XInput Extension. */
+ handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler);
+ ext = XGetExtensionVersion(display, INAME);
+ XSetExtensionErrorHandler(handler);
+
+ if (ext && ext != (XExtensionVersion *) NoSuchExtension) {
+ XFree(ext);
+ devices = XListInputDevices(display, &num);
+ for (i = 0; i < num; i++) {
+ if (devices[i].id == (XID) dmxLocal->deviceId) {
+ XAnyClassPtr any;
+ XKeyInfoPtr ki;
+ XButtonInfoPtr bi;
+ XValuatorInfoPtr vi;
+
+ for (j = 0, any = devices[i].inputclassinfo;
+ j < devices[i].num_classes;
+ any = (XAnyClassPtr) ((char *) any + any->length), j++) {
+ switch (any->class) {
+ case KeyClass:
+ ki = (XKeyInfoPtr) any;
+ info->keyboard = 1;
+ info->keyClass = 1;
+ info->keySyms.minKeyCode = ki->min_keycode;
+ info->keySyms.maxKeyCode = ki->max_keycode;
+ info->kbdFeedbackClass = 1;
+ break;
+ case ButtonClass:
+ bi = (XButtonInfoPtr) any;
+ info->buttonClass = 1;
+ info->numButtons = bi->num_buttons;
+ info->ptrFeedbackClass = 1;
+ break;
+ case ValuatorClass:
+ /* This assume all axes are either
+ * Absolute or Relative. */
+ vi = (XValuatorInfoPtr) any;
+ info->valuatorClass = 1;
+ if (vi->mode == Absolute)
+ info->numAbsAxes = vi->num_axes;
+ else
+ info->numRelAxes = vi->num_axes;
+ for (k = 0; k < vi->num_axes; k++) {
+ info->res[k] = vi->axes[k].resolution;
+ info->minres[k] = vi->axes[k].resolution;
+ info->maxres[k] = vi->axes[k].resolution;
+ info->minval[k] = vi->axes[k].min_value;
+ info->maxval[k] = vi->axes[k].max_value;
+ }
+ break;
+ case FeedbackClass:
+ /* Only keyboard and pointer feedback
+ * are handled at this time. */
+ break;
+ case ProximityClass:
+ info->proximityClass = 1;
+ break;
+ case FocusClass:
+ info->focusClass = 1;
+ break;
+ case OtherClass:
+ break;
+ }
+ }
+ }
+ }
+ XFreeDeviceList(devices);
+ }
+ if (display != priv->display)
+ XCloseDisplay(display);
+}
+
+/** Obtain the mouse button mapping. */
+void
+dmxCommonMouGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
+{
+ GETPRIVFROMPDEV;
+ int i;
+
+ *nButtons = XGetPointerMapping(priv->display, map, DMX_MAX_BUTTONS);
+ for (i = 0; i <= *nButtons; i++)
+ map[i] = i;
+}
+
+static void *
+dmxCommonXSelect(DMXScreenInfo * dmxScreen, void *closure)
+{
+ myPrivate *priv = closure;
+
+ XSelectInput(dmxScreen->beDisplay, dmxScreen->scrnWin, priv->eventMask);
+ return NULL;
+}
+
+static void *
+dmxCommonAddEnabledDevice(DMXScreenInfo * dmxScreen, void *closure)
+{
+ AddEnabledDevice(XConnectionNumber(dmxScreen->beDisplay));
+ return NULL;
+}
+
+static void *
+dmxCommonRemoveEnabledDevice(DMXScreenInfo * dmxScreen, void *closure)
+{
+ RemoveEnabledDevice(XConnectionNumber(dmxScreen->beDisplay));
+ return NULL;
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int
+dmxCommonMouOn(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+
+ priv->eventMask |= DMX_POINTER_EVENT_MASK;
+ if (dmxShadowFB) {
+ XWarpPointer(priv->display, priv->window, priv->window,
+ 0, 0, 0, 0, priv->initPointerX, priv->initPointerY);
+ dmxSync(&dmxScreens[dmxInput->scrnIdx], TRUE);
+ }
+ if (!priv->be) {
+ XSelectInput(priv->display, priv->window, priv->eventMask);
+ AddEnabledDevice(XConnectionNumber(priv->display));
+ }
+ else {
+ dmxPropertyIterate(priv->be, dmxCommonXSelect, priv);
+ dmxPropertyIterate(priv->be, dmxCommonAddEnabledDevice, dmxInput);
+ }
+
+ return -1;
+}
+
+/** Turn \a pDev off. */
+void
+dmxCommonMouOff(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+
+ priv->eventMask &= ~DMX_POINTER_EVENT_MASK;
+ if (!priv->be) {
+ RemoveEnabledDevice(XConnectionNumber(priv->display));
+ XSelectInput(priv->display, priv->window, priv->eventMask);
+ }
+ else {
+ dmxPropertyIterate(priv->be, dmxCommonRemoveEnabledDevice, dmxInput);
+ dmxPropertyIterate(priv->be, dmxCommonXSelect, priv);
+ }
+}
+
+/** Given the global coordinates \a x and \a y, determine the screen
+ * with the lowest number on which those coordinates lie. If they are
+ * not on any screen, return -1. The number returned is an index into
+ * \a dmxScreenInfo and is between -1 and \a dmxNumScreens - 1,
+ * inclusive. */
+int
+dmxFindPointerScreen(int x, int y)
+{
+ int i;
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+
+ if (x >= pScreen->x && x < pScreen->x + pScreen->width &&
+ y >= pScreen->y && y < pScreen->y + pScreen->height)
+ return i;
+ }
+ return -1;
+}
+
+/** Returns a pointer to the private area for the device that comes just
+ * prior to \a pDevice in the current \a dmxInput device list. This is
+ * used as the private area for the current device in some situations
+ * (e.g., when a keyboard and mouse form a pair that should share the
+ * same private area). If the requested private area cannot be located,
+ * then NULL is returned. */
+pointer
+dmxCommonCopyPrivate(DeviceIntPtr pDevice)
+{
+ GETDMXLOCALFROMPDEVICE;
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+ int i;
+
+ for (i = 0; i < dmxInput->numDevs; i++)
+ if (dmxInput->devs[i] == dmxLocal && i)
+ return dmxInput->devs[i - 1]->private;
+ return NULL;
+}
+
+/** This routine saves and resets some important state for the backend
+ * and console device drivers:
+ * - the modifier map is saved and set to 0 (so DMX controls the LEDs)
+ * - the key click, bell, led, and repeat masks are saved and set to the
+ * values that DMX claims to be using
+ *
+ * This routine and #dmxCommonRestoreState are used when the pointer
+ * enters and leaves the console window, or when the backend window is
+ * active or not active (for a full-screen window, this only happens at
+ * server startup and server shutdown).
+ */
+void
+dmxCommonSaveState(pointer private)
+{
+ GETPRIVFROMPRIVATE;
+ XKeyboardState ks;
+ unsigned long i;
+ XModifierKeymap *modmap;
+
+ if (dmxInput->console)
+ priv = dmxInput->devs[0]->private;
+ if (!priv->display || priv->stateSaved)
+ return;
+ DMXDBG0("dmxCommonSaveState\n");
+ if (dmxUseXKB && (priv->xkb = XkbAllocKeyboard())) {
+ if (XkbGetIndicatorMap(priv->display, XkbAllIndicatorsMask, priv->xkb)
+ || XkbGetNames(priv->display, XkbAllNamesMask, priv->xkb)) {
+ dmxLogInput(dmxInput, "Could not get XKB information\n");
+ XkbFreeKeyboard(priv->xkb, 0, True);
+ priv->xkb = NULL;
+ }
+ else {
+ if (priv->xkb->indicators) {
+ priv->savedIndicators = *priv->xkb->indicators;
+ for (i = 0; i < XkbNumIndicators; i++)
+ if (priv->xkb->indicators->phys_indicators & (1 << i)) {
+ priv->xkb->indicators->maps[i].flags
+ = XkbIM_NoAutomatic;
+ }
+ XkbSetIndicatorMap(priv->display, ~0, priv->xkb);
+ }
+ }
+ }
+
+ XGetKeyboardControl(priv->display, &ks);
+ priv->savedKctrl.click = ks.key_click_percent;
+ priv->savedKctrl.bell = ks.bell_percent;
+ priv->savedKctrl.bell_pitch = ks.bell_pitch;
+ priv->savedKctrl.bell_duration = ks.bell_duration;
+ priv->savedKctrl.leds = ks.led_mask;
+ priv->savedKctrl.autoRepeat = ks.global_auto_repeat;
+ for (i = 0; i < 32; i++)
+ priv->savedKctrl.autoRepeats[i] = ks.auto_repeats[i];
+
+ dmxCommonKbdSetCtrl(priv->display, &priv->savedKctrl,
+ &priv->dmxLocal->kctrl);
+
+ priv->savedModMap = XGetModifierMapping(priv->display);
+
+ modmap = XNewModifiermap(0);
+ XSetModifierMapping(priv->display, modmap);
+ if (dmxInput->scrnIdx != -1)
+ dmxSync(&dmxScreens[dmxInput->scrnIdx], TRUE);
+ XFreeModifiermap(modmap);
+
+ priv->stateSaved = 1;
+}
+
+/** This routine restores all the information saved by #dmxCommonSaveState. */
+void
+dmxCommonRestoreState(pointer private)
+{
+ GETPRIVFROMPRIVATE;
+ int retcode = -1;
+ CARD32 start;
+
+ if (dmxInput->console)
+ priv = dmxInput->devs[0]->private;
+ if (!priv->stateSaved)
+ return;
+ priv->stateSaved = 0;
+
+ DMXDBG0("dmxCommonRestoreState\n");
+ if (priv->xkb) {
+ *priv->xkb->indicators = priv->savedIndicators;
+ XkbSetIndicatorMap(priv->display, ~0, priv->xkb);
+ XkbFreeKeyboard(priv->xkb, 0, True);
+ priv->xkb = 0;
+ }
+
+ for (start = GetTimeInMillis(); GetTimeInMillis() - start < 5000;) {
+ CARD32 tmp;
+
+ retcode = XSetModifierMapping(priv->display, priv->savedModMap);
+ if (retcode == MappingSuccess)
+ break;
+ if (retcode == MappingBusy)
+ dmxLogInput(dmxInput, "Keyboard busy, waiting\n");
+ else
+ dmxLogInput(dmxInput, "Keyboard error, waiting\n");
+
+ /* Don't generate X11 protocol for a bit */
+ for (tmp = GetTimeInMillis(); GetTimeInMillis() - tmp < 250;) {
+ usleep(250); /* This ends up sleeping only until
+ * the next key press generates an
+ * interruption. We make the delay
+ * relatively short in case the user
+ * pressed they keys quickly. */
+ }
+
+ }
+ if (retcode != MappingSuccess)
+ dmxLog(dmxWarning, "Unable to restore keyboard modifier state!\n");
+
+ XFreeModifiermap(priv->savedModMap);
+ priv->savedModMap = NULL;
+
+ dmxCommonKbdSetCtrl(priv->display, NULL, &priv->savedKctrl);
+ priv->kctrlset = 0; /* Invalidate copy */
+}
diff --git a/xorg-server/hw/dmx/input/dmxconsole.c b/xorg-server/hw/dmx/input/dmxconsole.c
index d4d73f2e8..f63772b17 100644
--- a/xorg-server/hw/dmx/input/dmxconsole.c
+++ b/xorg-server/hw/dmx/input/dmxconsole.c
@@ -1,1029 +1,1090 @@
-/*
- * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * David H. Dawes <dawes@xfree86.org>
- * Kevin E. Martin <kem@redhat.com>
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- *
- * This file implements the console input devices.
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#define DMX_CONSOLE_DEBUG 0
-#define DMX_WINDOW_DEBUG 0
-
-#include "dmxinputinit.h"
-#include "dmxevents.h"
-#include "dmxconsole.h"
-#include "dmxcommon.h"
-#include "dmxscrinit.h"
-#include "dmxcb.h"
-#include "dmxsync.h"
-
-#include "inputstr.h"
-#include "input.h"
-#include "mipointer.h"
-#include "windowstr.h"
-
-#define CONSOLE_NUM 3
-#define CONSOLE_DEN 4
-#define DMX_CONSOLE_NAME "DMX Console"
-#define DMX_RES_NAME "Xdmx"
-#define DMX_RES_CLASS "XDmx"
-#define CONSOLE_BG_COLOR "gray75"
-#define CONSOLE_FG_COLOR "black"
-#define CONSOLE_SCREEN_BG_COLOR "white"
-#define CONSOLE_SCREEN_FG_COLOR "black"
-#define CONSOLE_SCREEN_DET_COLOR "gray75"
-#define CONSOLE_SCREEN_CUR_COLOR "red"
-
-#if DMX_CONSOLE_DEBUG
-#define DMXDBG0(f) dmxLog(dmxDebug,f)
-#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a)
-#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
-#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
-#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d)
-#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
-#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g)
-#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
-#else
-#define DMXDBG0(f)
-#define DMXDBG1(f,a)
-#define DMXDBG2(f,a,b)
-#define DMXDBG3(f,a,b,c)
-#define DMXDBG4(f,a,b,c,d)
-#define DMXDBG5(f,a,b,c,d,e)
-#define DMXDBG6(f,a,b,c,d,e,g)
-#define DMXDBG7(f,a,b,c,d,e,g,h)
-#endif
-
-/* Private area for consoles. */
-typedef struct _myPrivate {
- DMX_COMMON_PRIVATE;
- int lastX;
- int lastY;
- int globalX;
- int globalY;
- int curX;
- int curY;
- int width;
- int height;
- int consWidth;
- int consHeight;
- double xScale;
- double yScale;
- XlibGC gc, gcDet, gcRev, gcCur;
- int grabbed, fine, captured;
- Cursor cursorNormal, cursorGrabbed, cursorEmpty;
- Pixmap pixmap;
-
- CloseScreenProcPtr CloseScreen;
- struct _myPrivate *next; /* for closing multiple consoles */
- int initialized;
- DevicePtr mou, kbd;
-} myPrivate;
-
-static int scalex(myPrivate *priv, int x)
-{
- return (int)((x * priv->xScale) + .5);
-}
-
-static int scaley(myPrivate *priv, int y)
-{
- return (int)((y * priv->yScale) + .5);
-}
-
-static int unscalex(myPrivate *priv, int x)
-{
- return (int)((x / priv->xScale) + .5);
-}
-
-static int unscaley(myPrivate *priv, int y)
-{
- return (int)((y / priv->yScale) + .5);
-}
-
-/** Create the private area for \a pDevice. */
-pointer dmxConsoleCreatePrivate(DeviceIntPtr pDevice)
-{
- GETDMXLOCALFROMPDEVICE;
- myPrivate *priv = calloc(1, sizeof(*priv));
- priv->dmxLocal = dmxLocal;
- return priv;
-}
-
-/** If \a private is non-NULL, free its associated memory. */
-void dmxConsoleDestroyPrivate(pointer private)
-{
- free(private);
-}
-
-static void dmxConsoleDrawFineCursor(myPrivate *priv, XRectangle *rect)
-{
- int size = 6;
- int x, y;
-
- XDrawLine(priv->display, priv->pixmap, priv->gcCur,
- x = scalex(priv, priv->globalX) - size,
- scaley(priv, priv->globalY),
- scalex(priv, priv->globalX) + size,
- scaley(priv, priv->globalY));
- XDrawLine(priv->display, priv->pixmap, priv->gcCur,
- scalex(priv, priv->globalX),
- y = scaley(priv, priv->globalY) - size,
- scalex(priv, priv->globalX),
- scaley(priv, priv->globalY) + size);
- if (priv->grabbed) {
- XDrawLine(priv->display, priv->pixmap, priv->gcCur,
- scalex(priv, priv->globalX) - (int)(size / 1.4),
- scaley(priv, priv->globalY) - (int)(size / 1.4),
- scalex(priv, priv->globalX) + (int)(size / 1.4),
- scaley(priv, priv->globalY) + (int)(size / 1.4));
- XDrawLine(priv->display, priv->pixmap, priv->gcCur,
- scalex(priv, priv->globalX) - (int)(size / 1.4),
- scaley(priv, priv->globalY) + (int)(size / 1.4),
- scalex(priv, priv->globalX) + (int)(size / 1.4),
- scaley(priv, priv->globalY) - (int)(size / 1.4));
- }
- if (rect) {
- rect->x = x;
- rect->y = y;
- rect->width = 2 * size;
- rect->height = 2 * size;
- }
-}
-
-static void dmxConsoleDrawWindows(pointer private)
-{
- GETONLYPRIVFROMPRIVATE;
- Display *dpy = priv->display;
- int i;
- Region whole, used, avail;
- XRectangle rect;
-
- whole = XCreateRegion();
- used = XCreateRegion();
- avail = XCreateRegion();
- rect.x = 0;
- rect.y = 0;
- rect.width = priv->consWidth;
- rect.height = priv->consHeight;
- XUnionRectWithRegion(&rect, whole, whole);
-
- for (i = 0; i < dmxNumScreens; i++) {
- ScreenPtr pScreen = screenInfo.screens[i];
- WindowPtr pRoot = pScreen->root;
- WindowPtr pChild;
-
-#if DMX_WINDOW_DEBUG
- dmxLog(dmxDebug, "%lu %p %p %p 2\n",
- pRoot->drawable.id,
- pRoot->parent, pRoot->firstChild, pRoot->lastChild);
-#endif
-
- for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib) {
- if (pChild->mapped
- && pChild->realized) {
-#if DMX_WINDOW_DEBUG
- dmxLog(dmxDebug, " %p %d,%d %dx%d %d %d %d RECTS\n",
- pChild,
- pChild->drawable.x,
- pChild->drawable.y,
- pChild->drawable.width,
- pChild->drawable.height,
- pChild->visibility,
- pChild->overrideRedirect,
- RegionNumRects(&pChild->clipList));
-#endif
- rect.x = scalex(priv, pChild->drawable.x + pScreen->x);
- rect.y = scaley(priv, pChild->drawable.y + pScreen->y);
- rect.width = scalex(priv, pChild->drawable.width);
- rect.height = scaley(priv, pChild->drawable.height);
- XDrawRectangle(dpy, priv->pixmap, priv->gc,
- rect.x, rect.y, rect.width, rect.height);
- XUnionRectWithRegion(&rect, used, used);
- XSubtractRegion(whole, used, avail);
- XSetRegion(dpy, priv->gc, avail);
- }
- }
-#ifdef PANORAMIX
- if (!noPanoramiXExtension) break; /* Screen 0 valid with Xinerama */
-#endif
- }
- XDestroyRegion(avail);
- XDestroyRegion(used);
- XDestroyRegion(whole);
- XSetClipMask(dpy, priv->gc, None);
-}
-
-static void dmxConsoleDraw(myPrivate *priv, int updateCursor, int update)
-{
- GETDMXINPUTFROMPRIV;
- Display *dpy = priv->display;
- int i;
-
- XFillRectangle(dpy, priv->pixmap, priv->gc, 0, 0,
- priv->consWidth, priv->consHeight);
-
- for (i = 0; i < dmxNumScreens; i++) {
- DMXScreenInfo *dmxScreen = &dmxScreens[i];
- XFillRectangle(dpy, priv->pixmap,
- dmxScreen->beDisplay ? priv->gcRev : priv->gcDet,
- scalex(priv, screenInfo.screens[i]->x),
- scaley(priv, screenInfo.screens[i]->y),
- scalex(priv, screenInfo.screens[i]->width),
- scaley(priv, screenInfo.screens[i]->height));
- }
- for (i = 0; i < dmxNumScreens; i++) {
- XDrawRectangle(dpy, priv->pixmap, priv->gc,
- scalex(priv, screenInfo.screens[i]->x),
- scaley(priv, screenInfo.screens[i]->y),
- scalex(priv, screenInfo.screens[i]->width),
- scaley(priv, screenInfo.screens[i]->height));
- }
- if (dmxInput->windows) dmxConsoleDrawWindows(priv);
- if (priv->fine && updateCursor) dmxConsoleDrawFineCursor(priv, 0);
- if (update) {
- XCopyArea(priv->display, priv->pixmap, priv->window, priv->gc,
- 0, 0, priv->consWidth, priv->consHeight, 0, 0);
- XSync(priv->display, False); /* Not a backend display */
- }
-}
-
-static void dmxConsoleClearCursor(myPrivate *priv, int x, int y,
- XRectangle *rect)
-{
- int cw = 14, ch = 14; /* Clear width and height */
-
- rect->x = scalex(priv, x) - cw/2;
- rect->y = scaley(priv, y) - ch/2;
- rect->width = cw;
- rect->height = ch;
- XSetClipRectangles(priv->display, priv->gc, 0, 0, rect, 1, Unsorted);
- XSetClipRectangles(priv->display, priv->gcDet, 0, 0, rect, 1, Unsorted);
- XSetClipRectangles(priv->display, priv->gcRev, 0, 0, rect, 1, Unsorted);
- dmxConsoleDraw(priv, 0, 0);
- XSetClipMask(priv->display, priv->gc, None);
- XSetClipMask(priv->display, priv->gcDet, None);
- XSetClipMask(priv->display, priv->gcRev, None);
-}
-
-
-static void dmxConsoleUpdateFineCursor(myPrivate *priv)
-{
- int leave = 0;
- XRectangle rects[2];
-
- dmxConsoleClearCursor(priv, priv->globalX, priv->globalY, &rects[0]);
- if (priv->dmxLocal->sendsCore) {
- dmxGetGlobalPosition(&priv->globalX, &priv->globalY);
- } else {
- priv->globalX = priv->dmxLocal->lastX;
- priv->globalY = priv->dmxLocal->lastY;
- }
-
- priv->lastX = scalex(priv, priv->width / 2);
- priv->lastY = scaley(priv, priv->height / 2);
-
- /* Compute new warp position, which may be
- outside the window */
- if (priv->globalX < 1 || priv->globalX >= priv->width) {
- if (priv->globalX < 1) priv->lastX = 0;
- else priv->lastX = scalex(priv, priv->width);
- priv->lastY = scaley(priv, priv->globalY);
- ++leave;
- }
- if (priv->globalY < 1 || priv->globalY >= priv->height) {
- if (priv->globalY < 1) priv->lastY = 0;
- else priv->lastY = scaley(priv, priv->height);
- priv->lastX = scalex(priv, priv->globalX);
- ++leave;
- }
-
- /* Draw pseudo cursor in window */
- dmxConsoleDrawFineCursor(priv, &rects[1]);
-
- XSetClipRectangles(priv->display, priv->gc, 0, 0, rects, 2, Unsorted);
- XCopyArea(priv->display, priv->pixmap, priv->window, priv->gc,
- 0, 0, priv->consWidth, priv->consHeight, 0, 0);
- XSetClipMask(priv->display, priv->gc, None);
-
- DMXDBG2("dmxConsoleUpdateFineCursor: WARP %d %d\n",
- priv->lastX, priv->lastY);
- XWarpPointer(priv->display, priv->window, priv->window,
- 0, 0, 0, 0, priv->lastX, priv->lastY);
- XSync(priv->display, False); /* Not a backend display */
-
- if (leave) {
- XEvent X;
- while (XCheckMaskEvent(priv->display, PointerMotionMask, &X)) {
- if (X.type == MotionNotify) {
- if (X.xmotion.x != priv->lastX || X.xmotion.y != priv->lastY) {
- DMXDBG4("Ignoring motion to %d %d after leave frm %d %d\n",
- X.xmotion.x, X.xmotion.y,
- priv->lastX, priv->lastY);
- }
- } else {
- dmxLog(dmxInfo, "Ignoring event (%d): %s ****************\n",
- X.type, dmxEventName(X.type));
- }
- }
- }
- DMXDBG6("dmxConsoleUpdateFineCursor: Warp %d %d on %d %d [%d %d]\n",
- priv->lastX, priv->lastY,
- scalex(priv, priv->width),
- scaley(priv, priv->height),
- priv->globalX, priv->globalY);
-}
-
-/** Whenever the window layout (size, position, stacking order) might be
- * changed, this routine is called with the \a pWindow that changed and
- * the \a type of change. This routine is called in a conservative
- * fashion: the actual layout of the windows of the screen might not
- * have had any human-visible changes. */
-void dmxConsoleUpdateInfo(pointer private, DMXUpdateType type,
- WindowPtr pWindow)
-{
- GETONLYPRIVFROMPRIVATE;
- dmxConsoleDraw(priv, 1, 1);
-}
-
-static void dmxConsoleMoveAbsolute(myPrivate *priv, int x, int y,
- DevicePtr pDev, dmxMotionProcPtr motion,
- DMXBlockType block)
-{
- int tmpX, tmpY, v[2];
-
- tmpX = unscalex(priv, x);
- tmpY = unscalex(priv, y);
- DMXDBG6("dmxConsoleMoveAbsolute(,%d,%d) %d %d =? %d %d\n",
- x, y, tmpX, tmpY, priv->curX, priv->curY);
- if (tmpX == priv->curX && tmpY == priv->curY) return;
- v[0] = unscalex(priv, x);
- v[1] = unscaley(priv, y);
- motion(pDev, v, 0, 2, DMX_ABSOLUTE_CONFINED, block);
- /* dmxConsoleUpdatePosition gets called here by dmxCoreMotion */
-}
-
-static void dmxConsoleMoveRelative(myPrivate *priv, int x, int y,
- DevicePtr pDev, dmxMotionProcPtr motion,
- DMXBlockType block)
-{
- int v[2];
- /* Ignore the event generated from * warping back to middle */
- if (x == priv->lastX && y == priv->lastY) return;
- v[0] = priv->lastX - x;
- v[1] = priv->lastY - y;
- motion(pDev, v, 0, 2, DMX_RELATIVE, block);
- /* dmxConsoleUpdatePosition gets called here by dmxCoreMotion */
-}
-
-/** This routine gets called from #dmxCoreMotion for each motion. This
- * allows the console's notion of the cursor postion to change when
- * another input device actually caused the change. */
-void dmxConsoleUpdatePosition(pointer private, int x, int y)
-{
- GETONLYPRIVFROMPRIVATE;
- int tmpX, tmpY;
- Display *dpy = priv->display;
- static unsigned long dmxGeneration = 0;
-
-
- tmpX = scalex(priv, x);
- tmpY = scaley(priv, y);
- DMXDBG6("dmxConsoleUpdatePosition(,%d,%d) new=%d,%d dims=%d,%d\n",
- x, y, tmpX, tmpY, priv->consWidth, priv->consHeight);
-
- if (priv->fine) dmxConsoleUpdateFineCursor(priv);
- if (tmpX != priv->curX || tmpY != priv->curY) {
- if (tmpX < 0) tmpX = 0;
- if (tmpY < 0) tmpY = 0;
- if (tmpX >= priv->consWidth) tmpX = priv->consWidth - 1;
- if (tmpY >= priv->consHeight) tmpY = priv->consHeight - 1;
- priv->curX = tmpX;
- priv->curY = tmpY;
- if (!priv->fine) {
- DMXDBG2(" WARP B %d %d\n", priv->curX, priv->curY);
- XWarpPointer(dpy, priv->window,
- priv->window, 0, 0, 0, 0, tmpX, tmpY);
- XSync(dpy, False); /* Not a backend display */
- }
- }
-
- if (dmxGeneration != serverGeneration) {
- dmxGeneration = serverGeneration;
- dmxConsoleDraw(priv, 1, 1);
- }
-}
-
-/** Collect all pending events from the console's display. Plase these
- * events on the server event queue using the \a motion and \a enqueue
- * routines. The \a checkspecial routine is used to check for special
- * keys that need handling. \a block tells if signals should be blocked
- * when updating the event queue. */
-void dmxConsoleCollectEvents(DevicePtr pDev,
- dmxMotionProcPtr motion,
- dmxEnqueueProcPtr enqueue,
- dmxCheckSpecialProcPtr checkspecial,
- DMXBlockType block)
-{
- GETPRIVFROMPDEV;
- GETDMXINPUTFROMPRIV;
- Display *dpy = priv->display;
- Window win = priv->window;
- int width = priv->width;
- int height = priv->height;
- XEvent X, N;
- XSetWindowAttributes attribs;
- static int rInitialized = 0;
- static Region r;
- XRectangle rect;
- static int raising = 0, raiseX, raiseY; /* FIXME */
-
- while (XPending(dpy)) {
- XNextEvent(dpy, &X);
- switch(X.type) {
- case VisibilityNotify:
- break;
- case Expose:
- DMXDBG5("dmxConsoleCollectEvents: Expose #%d %d %d %d %d\n",
- X.xexpose.count,
- X.xexpose.x, X.xexpose.y,
- X.xexpose.width, X.xexpose.height);
- if (!rInitialized++) r = XCreateRegion();
- rect.x = X.xexpose.x;
- rect.y = X.xexpose.y;
- rect.width = X.xexpose.width;
- rect.height = X.xexpose.height;
- XUnionRectWithRegion(&rect, r, r);
- if (X.xexpose.count == 0) {
- XSetRegion(dpy, priv->gc, r);
- XSetRegion(dpy, priv->gcDet, r);
- XSetRegion(dpy, priv->gcRev, r);
- dmxConsoleDraw(priv, 1, 1);
- XSetClipMask(dpy, priv->gc, None);
- XSetClipMask(dpy, priv->gcDet, None);
- XSetClipMask(dpy, priv->gcRev, None);
- XDestroyRegion(r);
- rInitialized = 0;
- }
- break;
- case ResizeRequest:
- DMXDBG2("dmxConsoleCollectEvents: Resize %d %d\n",
- X.xresizerequest.width, X.xresizerequest.height);
- priv->consWidth = X.xresizerequest.width;
- priv->consHeight = X.xresizerequest.height;
- priv->xScale = (double)priv->consWidth / width;
- priv->yScale = (double)priv->consHeight / height;
- attribs.override_redirect = True;
- XChangeWindowAttributes(dpy, win, CWOverrideRedirect, &attribs);
- XResizeWindow(dpy, win, priv->consWidth, priv->consHeight);
- XFreePixmap(dpy, priv->pixmap);
- priv->pixmap = XCreatePixmap(dpy,
- RootWindow(dpy, DefaultScreen(dpy)),
- priv->consWidth,
- priv->consHeight,
- DefaultDepth(dpy,DefaultScreen(dpy)));
- dmxConsoleDraw(priv, 1, 1);
- attribs.override_redirect = False;
- XChangeWindowAttributes(dpy, win, CWOverrideRedirect, &attribs);
- break;
- case LeaveNotify:
- DMXDBG4("dmxConsoleCollectEvents: Leave @ %d,%d; r=%d f=%d\n",
- X.xcrossing.x, X.xcrossing.y, raising, priv->fine);
- if (!priv->captured) dmxCommonRestoreState(priv);
- else {
- dmxConsoleUncapture(dmxInput);
- dmxCommonRestoreState(priv);
- }
- break;
- case EnterNotify:
- DMXDBG6("dmxConsoleCollectEvents: Enter %d,%d r=%d f=%d (%d,%d)\n",
- X.xcrossing.x, X.xcrossing.y, raising, priv->fine,
- priv->curX, priv->curY);
- dmxCommonSaveState(priv);
- if (raising) {
- raising = 0;
- dmxConsoleMoveAbsolute(priv, raiseX, raiseY,
- priv->mou, motion, block);
- } else {
- if (priv->fine) {
- /* The raise will generate an event near the center,
- * which is not where the cursor should be. So we
- * save the real position, do the raise, and move
- * the cursor here again after the raise generates
- * the event. */
- raising = 1;
- raiseX = X.xcrossing.x;
- raiseY = X.xcrossing.y;
- XRaiseWindow(dpy, priv->window);
- }
- XSync(dpy, False); /* Not a backend display */
- if (!X.xcrossing.x && !X.xcrossing.y)
- dmxConsoleMoveAbsolute(priv, priv->curX, priv->curY,
- priv->mou, motion, block);
- }
- break;
- case MotionNotify:
- if (priv->curX == X.xmotion.x && priv->curY == X.xmotion.y)
- continue;
- if (XPending(dpy)) { /* do motion compression */
- XPeekEvent(dpy, &N);
- if (N.type == MotionNotify) continue;
- }
- DMXDBG2("dmxConsoleCollectEvents: Motion %d %d\n",
- X.xmotion.x, X.xmotion.y);
- if (raising) {
- raising = 0;
- dmxConsoleMoveAbsolute(priv, raiseX, raiseY,
- priv->mou, motion, block);
- } else {
- if (priv->fine)
- dmxConsoleMoveRelative(priv, X.xmotion.x, X.xmotion.y,
- priv->mou, motion, block);
- else
- dmxConsoleMoveAbsolute(priv, X.xmotion.x, X.xmotion.y,
- priv->mou, motion, block);
- }
- break;
- case KeyPress:
- case KeyRelease:
- enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block);
- break;
- default:
- /* Pass the whole event here, because
- * this may be an extension event. */
- enqueue(priv->mou, X.type, X.xbutton.button, 0, &X, block);
- break;
- }
- }
-}
-
-static void dmxCloseConsole(myPrivate *priv)
-{
- GETDMXINPUTFROMPRIV;
- dmxCommonRestoreState(priv);
- if (priv->display) {
- XFreeGC(priv->display, priv->gc);
- XFreeGC(priv->display, priv->gcDet);
- XFreeGC(priv->display, priv->gcRev);
- XFreeGC(priv->display, priv->gcCur);
- if (!dmxInput->console) XCloseDisplay(priv->display);
- }
- priv->display = NULL;
-}
-
-static Bool dmxCloseConsoleScreen(int idx, ScreenPtr pScreen)
-{
- myPrivate *priv, *last;
-
- for (last = priv = (myPrivate *)dixLookupPrivate(&pScreen->devPrivates,
- dmxScreenPrivateKey);
- priv;
- priv = priv->next) dmxCloseConsole(last = priv);
-
- DMX_UNWRAP(CloseScreen, last, pScreen);
- return pScreen->CloseScreen(idx, pScreen);
-}
-
-static Cursor dmxConsoleCreateEmptyCursor(myPrivate *priv)
-{
- char noCursorData[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- Pixmap pixmap;
- Cursor cursor;
- XColor color, tmpColor;
- Display *dpy = priv->display;
-
- /* Create empty cursor for window */
- pixmap = XCreateBitmapFromData(priv->display, priv->window,
- noCursorData, 8, 8);
- if (!XAllocNamedColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)),
- "black",
- &color,
- &tmpColor))
- dmxLog(dmxFatal, "Cannot allocate color for cursor\n");
- cursor = XCreatePixmapCursor(dpy, pixmap, pixmap, &color, &color, 0, 0);
- XFreePixmap(dpy, pixmap);
- return cursor;
-}
-
-static void dmxConsoleComputeWidthHeight(myPrivate *priv,
- int *width, int *height,
- double *xScale, double *yScale,
- int *consWidth, int *consHeight)
-{
- int screen;
- Display *dpy = priv->display;
-
- *width = 0;
- *height = 0;
- *xScale = 1.0;
- *yScale = 1.0;
-
- screen = DefaultScreen(dpy);
- *consWidth = DisplayWidth(dpy, screen) * CONSOLE_NUM / CONSOLE_DEN;
- *consHeight = DisplayHeight(dpy, screen) * CONSOLE_NUM / CONSOLE_DEN;
-
- if (*consWidth < 1) *consWidth = 1;
- if (*consHeight < 1) *consHeight = 1;
-
-#if 1
- /* Always keep the console size similar
- * to the global bounding box. */
- *width = dmxGlobalWidth;
- *height = dmxGlobalHeight;
-#else
- /* Make the console window as big as
- * possible by computing the visible
- * bounding box. */
- for (i = 0; i < dmxNumScreens; i++) {
- if (screenInfo.screens[i]->x+screenInfo.screens[i]->width > *width)
- *width = screenInfo.screens[i]->x+screenInfo.screens[i]->width;
-
- if (screenInfo.screens[i]->y+screenInfo.screens[i]->height > *height)
- *height = screenInfo.screens[i]->y+screenInfo.screens[i]->height;
- }
-#endif
-
- if ((double)*consWidth / *width < (double)*consHeight / *height)
- *xScale = *yScale = (double)*consWidth / *width;
- else
- *xScale = *yScale = (double)*consHeight / *height;
-
- *consWidth = scalex(priv, *width);
- *consHeight = scaley(priv, *height);
- if (*consWidth < 1) *consWidth = 1;
- if (*consHeight < 1) *consHeight = 1;
-}
-
-/** Re-initialized the console device described by \a pDev (after a
- * reconfig). */
-void dmxConsoleReInit(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- Display *dpy;
-
- if (!priv || !priv->initialized) return;
- dpy = priv->display;
-
- dmxConsoleComputeWidthHeight(priv,
- &priv->width, &priv->height,
- &priv->xScale, &priv->yScale,
- &priv->consWidth, &priv->consHeight);
- XResizeWindow(dpy, priv->window, priv->consWidth, priv->consHeight);
- XFreePixmap(dpy, priv->pixmap);
- priv->pixmap = XCreatePixmap(dpy,
- RootWindow(dpy, DefaultScreen(dpy)),
- priv->consWidth,
- priv->consHeight,
- DefaultDepth(dpy,DefaultScreen(dpy)));
- dmxConsoleDraw(priv, 1, 1);
-}
-
-/** Initialized the console device described by \a pDev. */
-void dmxConsoleInit(DevicePtr pDev)
-{
- GETPRIVFROMPDEV;
- DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
- int screen;
- unsigned long mask;
- XSetWindowAttributes attribs;
- Display *dpy;
- Window win;
- XGCValues gcvals;
- XColor color;
- XClassHint class_hints;
- unsigned long tmp;
-
- if (dmxLocal->type == DMX_LOCAL_MOUSE) priv->mou = pDev;
- if (dmxLocal->type == DMX_LOCAL_KEYBOARD) priv->kbd = pDev;
- if (priv->initialized++) return; /* Only do once for mouse/keyboard pair */
-
- if (!(dpy = priv->display = XOpenDisplay(dmxInput->name)))
- dmxLog(dmxFatal,
- "dmxOpenConsole: cannot open console display %s\n",
- dmxInput->name);
-
- /* Set up defaults */
- dmxConsoleComputeWidthHeight(priv,
- &priv->width, &priv->height,
- &priv->xScale, &priv->yScale,
- &priv->consWidth, &priv->consHeight);
-
- /* Private initialization using computed values or constants. */
- screen = DefaultScreen(dpy);
- priv->initPointerX = scalex(priv, priv->width / 2);
- priv->initPointerY = scaley(priv, priv->height / 2);
- priv->eventMask = (ButtonPressMask
- | ButtonReleaseMask
- | PointerMotionMask
- | EnterWindowMask
- | LeaveWindowMask
- | KeyPressMask
- | KeyReleaseMask
- | ExposureMask
- | ResizeRedirectMask);
-
- mask = CWBackPixel | CWEventMask | CWColormap | CWOverrideRedirect;
- attribs.colormap = DefaultColormap(dpy, screen);
- if (XParseColor(dpy, attribs.colormap, CONSOLE_BG_COLOR, &color)
- && XAllocColor(dpy, attribs.colormap, &color)) {
- attribs.background_pixel = color.pixel;
- } else
- attribs.background_pixel = WhitePixel(dpy, screen);
-
- attribs.event_mask = priv->eventMask;
- attribs.override_redirect = False;
-
- win = priv->window = XCreateWindow(dpy,
- RootWindow(dpy, screen),
- 0, 0, priv->consWidth, priv->consHeight,
- 0,
- DefaultDepth(dpy, screen),
- InputOutput,
- DefaultVisual(dpy, screen),
- mask, &attribs);
- priv->pixmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
- priv->consWidth, priv->consHeight,
- DefaultDepth(dpy, screen));
-
- /* Set up properties */
- XStoreName(dpy, win, DMX_CONSOLE_NAME);
- class_hints.res_name = DMX_RES_NAME;
- class_hints.res_class = DMX_RES_CLASS;
- XSetClassHint(dpy, win, &class_hints);
-
-
- /* Map the window */
- XMapWindow(dpy, win);
-
- /* Create cursors */
- priv->cursorNormal = XCreateFontCursor(dpy, XC_circle);
- priv->cursorGrabbed = XCreateFontCursor(dpy, XC_spider);
- priv->cursorEmpty = dmxConsoleCreateEmptyCursor(priv);
- XDefineCursor(dpy, priv->window, priv->cursorNormal);
-
- /* Create GC */
- mask = (GCFunction | GCPlaneMask | GCClipMask | GCForeground |
- GCBackground | GCLineWidth | GCLineStyle | GCCapStyle |
- GCFillStyle | GCGraphicsExposures);
- gcvals.function = GXcopy;
- gcvals.plane_mask = AllPlanes;
- gcvals.clip_mask = None;
- if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_FG_COLOR, &color)
- && XAllocColor(dpy, attribs.colormap, &color)) {
- gcvals.foreground = color.pixel;
- } else
- gcvals.foreground = BlackPixel(dpy, screen);
- if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_BG_COLOR, &color)
- && XAllocColor(dpy, attribs.colormap, &color)) {
- gcvals.background = color.pixel;
- } else
- gcvals.background = WhitePixel(dpy, screen);
- gcvals.line_width = 0;
- gcvals.line_style = LineSolid;
- gcvals.cap_style = CapNotLast;
- gcvals.fill_style = FillSolid;
- gcvals.graphics_exposures = False;
-
- priv->gc = XCreateGC(dpy, win, mask, &gcvals);
-
- tmp = gcvals.foreground;
- if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_DET_COLOR, &color)
- && XAllocColor(dpy, attribs.colormap, &color)) {
- gcvals.foreground = color.pixel;
- } else
- gcvals.foreground = BlackPixel(dpy, screen);
- priv->gcDet = XCreateGC(dpy, win, mask, &gcvals);
- gcvals.foreground = tmp;
-
- tmp = gcvals.background;
- gcvals.background = gcvals.foreground;
- gcvals.foreground = tmp;
- priv->gcRev = XCreateGC(dpy, win, mask, &gcvals);
-
- gcvals.background = gcvals.foreground;
- if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_CUR_COLOR, &color)
- && XAllocColor(dpy, attribs.colormap, &color)) {
- gcvals.foreground = color.pixel;
- } else
- gcvals.foreground = BlackPixel(dpy, screen);
- priv->gcCur = XCreateGC(dpy, win, mask, &gcvals);
-
- dmxConsoleDraw(priv, 1, 1);
-
- if (dixLookupPrivate(&screenInfo.screens[0]->devPrivates,
- dmxScreenPrivateKey))
- priv->next = dixLookupPrivate(&screenInfo.screens[0]->devPrivates,
- dmxScreenPrivateKey);
- else
- DMX_WRAP(CloseScreen, dmxCloseConsoleScreen,
- priv, screenInfo.screens[0]);
- dixSetPrivate(&screenInfo.screens[0]->devPrivates, dmxScreenPrivateKey,
- priv);
-}
-
-/** Fill in the \a info structure for the specified \a pDev. Only used
- * for pointers. */
-void dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
-{
- GETPRIVFROMPDEV;
-
- info->buttonClass = 1;
- dmxCommonMouGetMap(pDev, info->map, &info->numButtons);
- info->valuatorClass = 1;
- info->numRelAxes = 2;
- info->minval[0] = 0;
- info->minval[1] = 0;
- /* max possible console window size: */
- info->maxval[0] = DisplayWidth(priv->display, DefaultScreen(priv->display));
- info->maxval[1] = DisplayHeight(priv->display, DefaultScreen(priv->display));
- info->res[0] = 1;
- info->minres[0] = 0;
- info->maxres[0] = 1;
- info->ptrFeedbackClass = 1;
-}
-
-/** Fill in the \a info structure for the specified \a pDev. Only used
- * for keyboard. */
-void dmxConsoleKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
-{
- dmxCommonKbdGetInfo(pDev, info);
- info->keyboard = 1;
- info->keyClass = 1;
- dmxCommonKbdGetMap(pDev, &info->keySyms, info->modMap);
- info->freemap = 1;
- info->focusClass = 1;
- info->kbdFeedbackClass = 1;
-}
-
-/** Handle special console-only keys. */
-int dmxConsoleFunctions(pointer private, DMXFunctionType function)
-{
- GETONLYPRIVFROMPRIVATE;
- XRectangle rect;
- Display *dpy = priv->display;
-
- switch (function) {
- case DMX_FUNCTION_FINE:
- if (priv->fine) {
- priv->fine = 0;
- dmxConsoleClearCursor(priv, priv->globalX, priv->globalY, &rect);
- XSetClipRectangles(dpy, priv->gc, 0, 0, &rect, 1, Unsorted);
- XCopyArea(dpy, priv->pixmap, priv->window, priv->gc,
- 0, 0, priv->consWidth, priv->consHeight, 0, 0);
- XSetClipMask(dpy, priv->gc, None);
-
- XDefineCursor(dpy, priv->window,
- priv->grabbed
- ? priv->cursorGrabbed
- : priv->cursorNormal);
- XWarpPointer(dpy, priv->window, priv->window,
- 0, 0, 0, 0,
- scalex(priv, priv->globalX),
- scaley(priv, priv->globalY));
- XSync(dpy, False); /* Not a backend display */
- } else {
- priv->fine = 1;
- XRaiseWindow(dpy, priv->window);
- XDefineCursor(dpy, priv->window, priv->cursorEmpty);
- dmxConsoleUpdateFineCursor(priv);
- }
- return 1;
- case DMX_FUNCTION_GRAB:
- if (priv->grabbed) {
- XUngrabKeyboard(dpy, CurrentTime);
- XUngrabPointer(dpy, CurrentTime);
- XDefineCursor(dpy, priv->window,
- priv->fine
- ? priv->cursorEmpty
- : priv->cursorNormal);
- } else {
- if (XGrabPointer(dpy, priv->window, True,
- 0, GrabModeAsync, GrabModeAsync, priv->window,
- None, CurrentTime)) {
- dmxLog(dmxError, "XGrabPointer failed\n");
- return 0;
- }
- if (XGrabKeyboard(dpy, priv->window, True,
- GrabModeAsync, GrabModeAsync, CurrentTime)) {
- dmxLog(dmxError, "XGrabKeyboard failed\n");
- XUngrabPointer(dpy, CurrentTime);
- return 0;
- }
- XDefineCursor(dpy, priv->window,
- priv->fine
- ? priv->cursorEmpty
- : priv->cursorGrabbed);
- }
- priv->grabbed = !priv->grabbed;
- if (priv->fine) dmxConsoleUpdateFineCursor(priv);
- return 1;
- case DMX_FUNCTION_TERMINATE:
- return 1;
- default:
- return 0;
- }
-}
-
-static void dmxDump(void)
-{
- int i, j;
- DMXInputInfo *dmxInput;
- XEvent X;
-
- for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) {
- for (j = 0; j < dmxInput->numDevs; j++) {
- DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j];
- myPrivate *priv = dmxLocal->private;
- while (priv
- && priv->display
- && XCheckTypedEvent(priv->display, MotionNotify, &X)) {
- DMXDBG4("dmxDump: %s/%d threw event away %d %s\n",
- dmxInput->name, j, X.type, dmxEventName(X.type));
- }
- }
- }
-}
-
-/** This routine is used to warp the pointer into the console window
- * from anywhere on the screen. It is used when backend and console
- * input are both being taken from the same X display. */
-void dmxConsoleCapture(DMXInputInfo *dmxInput)
-{
- int i;
- XEvent X;
-
- DMXDBG0("dmxConsoleCapture\n");
- dmxSync(NULL, TRUE);
- for (i = 0; i < dmxInput->numDevs; i++) {
- DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
- myPrivate *priv = dmxLocal->private;
- if (dmxLocal->extType != DMX_LOCAL_TYPE_CONSOLE) continue;
- if (dmxLocal->type != DMX_LOCAL_MOUSE) continue;
- if (priv->captured) continue;
- priv->captured = 2; /* Ungrab only after proximal events. */
- XRaiseWindow(priv->display, priv->window);
- XSync(priv->display, False); /* Not a backend display */
- while (XCheckTypedEvent(priv->display, MotionNotify, &X)) {
- DMXDBG3(" Ignoring motion to %d %d after capture on %s\n",
- X.xmotion.x, X.xmotion.y, dmxInput->name);
- }
- XWarpPointer(priv->display, None,
- priv->window, 0, 0, 0, 0, priv->curX, priv->curY);
- XSync(priv->display, False); /* Not a backend display */
- dmxDump();
- if (priv->fine) dmxConsoleUpdateFineCursor(priv);
- }
-}
-
-/** Undo the capture that was done by #dmxConsoleCapture. */
-void dmxConsoleUncapture(DMXInputInfo *dmxInput)
-{
- int i;
-
- DMXDBG0("dmxConsoleUncapture\n");
- dmxSync(NULL, TRUE);
- for (i = 0; i < dmxInput->numDevs; i++) {
- DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
- myPrivate *priv = dmxLocal->private;
- if (dmxLocal->extType != DMX_LOCAL_TYPE_CONSOLE) continue;
- if (dmxLocal->type != DMX_LOCAL_MOUSE) continue;
- if (!priv->captured) continue;
- priv->captured = 0;
- XSync(priv->display, False); /* Not a backend display */
- }
-}
+/*
+ * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * David H. Dawes <dawes@xfree86.org>
+ * Kevin E. Martin <kem@redhat.com>
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This file implements the console input devices.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#define DMX_CONSOLE_DEBUG 0
+#define DMX_WINDOW_DEBUG 0
+
+#include "dmxinputinit.h"
+#include "dmxevents.h"
+#include "dmxconsole.h"
+#include "dmxcommon.h"
+#include "dmxscrinit.h"
+#include "dmxcb.h"
+#include "dmxsync.h"
+
+#include "inputstr.h"
+#include "input.h"
+#include "mipointer.h"
+#include "windowstr.h"
+
+#define CONSOLE_NUM 3
+#define CONSOLE_DEN 4
+#define DMX_CONSOLE_NAME "DMX Console"
+#define DMX_RES_NAME "Xdmx"
+#define DMX_RES_CLASS "XDmx"
+#define CONSOLE_BG_COLOR "gray75"
+#define CONSOLE_FG_COLOR "black"
+#define CONSOLE_SCREEN_BG_COLOR "white"
+#define CONSOLE_SCREEN_FG_COLOR "black"
+#define CONSOLE_SCREEN_DET_COLOR "gray75"
+#define CONSOLE_SCREEN_CUR_COLOR "red"
+
+#if DMX_CONSOLE_DEBUG
+#define DMXDBG0(f) dmxLog(dmxDebug,f)
+#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a)
+#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h)
+#else
+#define DMXDBG0(f)
+#define DMXDBG1(f,a)
+#define DMXDBG2(f,a,b)
+#define DMXDBG3(f,a,b,c)
+#define DMXDBG4(f,a,b,c,d)
+#define DMXDBG5(f,a,b,c,d,e)
+#define DMXDBG6(f,a,b,c,d,e,g)
+#define DMXDBG7(f,a,b,c,d,e,g,h)
+#endif
+
+/* Private area for consoles. */
+typedef struct _myPrivate {
+ DMX_COMMON_PRIVATE;
+ int lastX;
+ int lastY;
+ int globalX;
+ int globalY;
+ int curX;
+ int curY;
+ int width;
+ int height;
+ int consWidth;
+ int consHeight;
+ double xScale;
+ double yScale;
+ XlibGC gc, gcDet, gcRev, gcCur;
+ int grabbed, fine, captured;
+ Cursor cursorNormal, cursorGrabbed, cursorEmpty;
+ Pixmap pixmap;
+
+ CloseScreenProcPtr CloseScreen;
+ struct _myPrivate *next; /* for closing multiple consoles */
+ int initialized;
+ DevicePtr mou, kbd;
+} myPrivate;
+
+static int
+scalex(myPrivate * priv, int x)
+{
+ return (int) ((x * priv->xScale) + .5);
+}
+
+static int
+scaley(myPrivate * priv, int y)
+{
+ return (int) ((y * priv->yScale) + .5);
+}
+
+static int
+unscalex(myPrivate * priv, int x)
+{
+ return (int) ((x / priv->xScale) + .5);
+}
+
+static int
+unscaley(myPrivate * priv, int y)
+{
+ return (int) ((y / priv->yScale) + .5);
+}
+
+/** Create the private area for \a pDevice. */
+pointer
+dmxConsoleCreatePrivate(DeviceIntPtr pDevice)
+{
+ GETDMXLOCALFROMPDEVICE;
+ myPrivate *priv = calloc(1, sizeof(*priv));
+
+ priv->dmxLocal = dmxLocal;
+ return priv;
+}
+
+/** If \a private is non-NULL, free its associated memory. */
+void
+dmxConsoleDestroyPrivate(pointer private)
+{
+ free(private);
+}
+
+static void
+dmxConsoleDrawFineCursor(myPrivate * priv, XRectangle * rect)
+{
+ int size = 6;
+ int x, y;
+
+ XDrawLine(priv->display, priv->pixmap, priv->gcCur,
+ x = scalex(priv, priv->globalX) - size,
+ scaley(priv, priv->globalY),
+ scalex(priv, priv->globalX) + size, scaley(priv, priv->globalY));
+ XDrawLine(priv->display, priv->pixmap, priv->gcCur,
+ scalex(priv, priv->globalX),
+ y = scaley(priv, priv->globalY) - size,
+ scalex(priv, priv->globalX), scaley(priv, priv->globalY) + size);
+ if (priv->grabbed) {
+ XDrawLine(priv->display, priv->pixmap, priv->gcCur,
+ scalex(priv, priv->globalX) - (int) (size / 1.4),
+ scaley(priv, priv->globalY) - (int) (size / 1.4),
+ scalex(priv, priv->globalX) + (int) (size / 1.4),
+ scaley(priv, priv->globalY) + (int) (size / 1.4));
+ XDrawLine(priv->display, priv->pixmap, priv->gcCur,
+ scalex(priv, priv->globalX) - (int) (size / 1.4),
+ scaley(priv, priv->globalY) + (int) (size / 1.4),
+ scalex(priv, priv->globalX) + (int) (size / 1.4),
+ scaley(priv, priv->globalY) - (int) (size / 1.4));
+ }
+ if (rect) {
+ rect->x = x;
+ rect->y = y;
+ rect->width = 2 * size;
+ rect->height = 2 * size;
+ }
+}
+
+static void
+dmxConsoleDrawWindows(pointer private)
+{
+ GETONLYPRIVFROMPRIVATE;
+ Display *dpy = priv->display;
+ int i;
+ Region whole, used, avail;
+ XRectangle rect;
+
+ whole = XCreateRegion();
+ used = XCreateRegion();
+ avail = XCreateRegion();
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = priv->consWidth;
+ rect.height = priv->consHeight;
+ XUnionRectWithRegion(&rect, whole, whole);
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ ScreenPtr pScreen = screenInfo.screens[i];
+ WindowPtr pRoot = pScreen->root;
+ WindowPtr pChild;
+
+#if DMX_WINDOW_DEBUG
+ dmxLog(dmxDebug, "%lu %p %p %p 2\n",
+ pRoot->drawable.id,
+ pRoot->parent, pRoot->firstChild, pRoot->lastChild);
+#endif
+
+ for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib) {
+ if (pChild->mapped && pChild->realized) {
+#if DMX_WINDOW_DEBUG
+ dmxLog(dmxDebug, " %p %d,%d %dx%d %d %d %d RECTS\n",
+ pChild,
+ pChild->drawable.x,
+ pChild->drawable.y,
+ pChild->drawable.width,
+ pChild->drawable.height,
+ pChild->visibility,
+ pChild->overrideRedirect,
+ RegionNumRects(&pChild->clipList));
+#endif
+ rect.x = scalex(priv, pChild->drawable.x + pScreen->x);
+ rect.y = scaley(priv, pChild->drawable.y + pScreen->y);
+ rect.width = scalex(priv, pChild->drawable.width);
+ rect.height = scaley(priv, pChild->drawable.height);
+ XDrawRectangle(dpy, priv->pixmap, priv->gc,
+ rect.x, rect.y, rect.width, rect.height);
+ XUnionRectWithRegion(&rect, used, used);
+ XSubtractRegion(whole, used, avail);
+ XSetRegion(dpy, priv->gc, avail);
+ }
+ }
+#ifdef PANORAMIX
+ if (!noPanoramiXExtension)
+ break; /* Screen 0 valid with Xinerama */
+#endif
+ }
+ XDestroyRegion(avail);
+ XDestroyRegion(used);
+ XDestroyRegion(whole);
+ XSetClipMask(dpy, priv->gc, None);
+}
+
+static void
+dmxConsoleDraw(myPrivate * priv, int updateCursor, int update)
+{
+ GETDMXINPUTFROMPRIV;
+ Display *dpy = priv->display;
+ int i;
+
+ XFillRectangle(dpy, priv->pixmap, priv->gc, 0, 0,
+ priv->consWidth, priv->consHeight);
+
+ for (i = 0; i < dmxNumScreens; i++) {
+ DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
+ XFillRectangle(dpy, priv->pixmap,
+ dmxScreen->beDisplay ? priv->gcRev : priv->gcDet,
+ scalex(priv, screenInfo.screens[i]->x),
+ scaley(priv, screenInfo.screens[i]->y),
+ scalex(priv, screenInfo.screens[i]->width),
+ scaley(priv, screenInfo.screens[i]->height));
+ }
+ for (i = 0; i < dmxNumScreens; i++) {
+ XDrawRectangle(dpy, priv->pixmap, priv->gc,
+ scalex(priv, screenInfo.screens[i]->x),
+ scaley(priv, screenInfo.screens[i]->y),
+ scalex(priv, screenInfo.screens[i]->width),
+ scaley(priv, screenInfo.screens[i]->height));
+ }
+ if (dmxInput->windows)
+ dmxConsoleDrawWindows(priv);
+ if (priv->fine && updateCursor)
+ dmxConsoleDrawFineCursor(priv, 0);
+ if (update) {
+ XCopyArea(priv->display, priv->pixmap, priv->window, priv->gc,
+ 0, 0, priv->consWidth, priv->consHeight, 0, 0);
+ XSync(priv->display, False); /* Not a backend display */
+ }
+}
+
+static void
+dmxConsoleClearCursor(myPrivate * priv, int x, int y, XRectangle * rect)
+{
+ int cw = 14, ch = 14; /* Clear width and height */
+
+ rect->x = scalex(priv, x) - cw / 2;
+ rect->y = scaley(priv, y) - ch / 2;
+ rect->width = cw;
+ rect->height = ch;
+ XSetClipRectangles(priv->display, priv->gc, 0, 0, rect, 1, Unsorted);
+ XSetClipRectangles(priv->display, priv->gcDet, 0, 0, rect, 1, Unsorted);
+ XSetClipRectangles(priv->display, priv->gcRev, 0, 0, rect, 1, Unsorted);
+ dmxConsoleDraw(priv, 0, 0);
+ XSetClipMask(priv->display, priv->gc, None);
+ XSetClipMask(priv->display, priv->gcDet, None);
+ XSetClipMask(priv->display, priv->gcRev, None);
+}
+
+static void
+dmxConsoleUpdateFineCursor(myPrivate * priv)
+{
+ int leave = 0;
+ XRectangle rects[2];
+
+ dmxConsoleClearCursor(priv, priv->globalX, priv->globalY, &rects[0]);
+ if (priv->dmxLocal->sendsCore) {
+ dmxGetGlobalPosition(&priv->globalX, &priv->globalY);
+ }
+ else {
+ priv->globalX = priv->dmxLocal->lastX;
+ priv->globalY = priv->dmxLocal->lastY;
+ }
+
+ priv->lastX = scalex(priv, priv->width / 2);
+ priv->lastY = scaley(priv, priv->height / 2);
+
+ /* Compute new warp position, which may be
+ outside the window */
+ if (priv->globalX < 1 || priv->globalX >= priv->width) {
+ if (priv->globalX < 1)
+ priv->lastX = 0;
+ else
+ priv->lastX = scalex(priv, priv->width);
+ priv->lastY = scaley(priv, priv->globalY);
+ ++leave;
+ }
+ if (priv->globalY < 1 || priv->globalY >= priv->height) {
+ if (priv->globalY < 1)
+ priv->lastY = 0;
+ else
+ priv->lastY = scaley(priv, priv->height);
+ priv->lastX = scalex(priv, priv->globalX);
+ ++leave;
+ }
+
+ /* Draw pseudo cursor in window */
+ dmxConsoleDrawFineCursor(priv, &rects[1]);
+
+ XSetClipRectangles(priv->display, priv->gc, 0, 0, rects, 2, Unsorted);
+ XCopyArea(priv->display, priv->pixmap, priv->window, priv->gc,
+ 0, 0, priv->consWidth, priv->consHeight, 0, 0);
+ XSetClipMask(priv->display, priv->gc, None);
+
+ DMXDBG2("dmxConsoleUpdateFineCursor: WARP %d %d\n",
+ priv->lastX, priv->lastY);
+ XWarpPointer(priv->display, priv->window, priv->window,
+ 0, 0, 0, 0, priv->lastX, priv->lastY);
+ XSync(priv->display, False); /* Not a backend display */
+
+ if (leave) {
+ XEvent X;
+
+ while (XCheckMaskEvent(priv->display, PointerMotionMask, &X)) {
+ if (X.type == MotionNotify) {
+ if (X.xmotion.x != priv->lastX || X.xmotion.y != priv->lastY) {
+ DMXDBG4("Ignoring motion to %d %d after leave frm %d %d\n",
+ X.xmotion.x, X.xmotion.y, priv->lastX, priv->lastY);
+ }
+ }
+ else {
+ dmxLog(dmxInfo, "Ignoring event (%d): %s ****************\n",
+ X.type, dmxEventName(X.type));
+ }
+ }
+ }
+ DMXDBG6("dmxConsoleUpdateFineCursor: Warp %d %d on %d %d [%d %d]\n",
+ priv->lastX, priv->lastY,
+ scalex(priv, priv->width),
+ scaley(priv, priv->height), priv->globalX, priv->globalY);
+}
+
+/** Whenever the window layout (size, position, stacking order) might be
+ * changed, this routine is called with the \a pWindow that changed and
+ * the \a type of change. This routine is called in a conservative
+ * fashion: the actual layout of the windows of the screen might not
+ * have had any human-visible changes. */
+void
+dmxConsoleUpdateInfo(pointer private, DMXUpdateType type, WindowPtr pWindow)
+{
+ GETONLYPRIVFROMPRIVATE;
+ dmxConsoleDraw(priv, 1, 1);
+}
+
+static void
+dmxConsoleMoveAbsolute(myPrivate * priv, int x, int y,
+ DevicePtr pDev, dmxMotionProcPtr motion,
+ DMXBlockType block)
+{
+ int tmpX, tmpY, v[2];
+
+ tmpX = unscalex(priv, x);
+ tmpY = unscalex(priv, y);
+ DMXDBG6("dmxConsoleMoveAbsolute(,%d,%d) %d %d =? %d %d\n",
+ x, y, tmpX, tmpY, priv->curX, priv->curY);
+ if (tmpX == priv->curX && tmpY == priv->curY)
+ return;
+ v[0] = unscalex(priv, x);
+ v[1] = unscaley(priv, y);
+ motion(pDev, v, 0, 2, DMX_ABSOLUTE_CONFINED, block);
+ /* dmxConsoleUpdatePosition gets called here by dmxCoreMotion */
+}
+
+static void
+dmxConsoleMoveRelative(myPrivate * priv, int x, int y,
+ DevicePtr pDev, dmxMotionProcPtr motion,
+ DMXBlockType block)
+{
+ int v[2];
+
+ /* Ignore the event generated from * warping back to middle */
+ if (x == priv->lastX && y == priv->lastY)
+ return;
+ v[0] = priv->lastX - x;
+ v[1] = priv->lastY - y;
+ motion(pDev, v, 0, 2, DMX_RELATIVE, block);
+ /* dmxConsoleUpdatePosition gets called here by dmxCoreMotion */
+}
+
+/** This routine gets called from #dmxCoreMotion for each motion. This
+ * allows the console's notion of the cursor postion to change when
+ * another input device actually caused the change. */
+void
+dmxConsoleUpdatePosition(pointer private, int x, int y)
+{
+ GETONLYPRIVFROMPRIVATE;
+ int tmpX, tmpY;
+ Display *dpy = priv->display;
+ static unsigned long dmxGeneration = 0;
+
+ tmpX = scalex(priv, x);
+ tmpY = scaley(priv, y);
+ DMXDBG6("dmxConsoleUpdatePosition(,%d,%d) new=%d,%d dims=%d,%d\n",
+ x, y, tmpX, tmpY, priv->consWidth, priv->consHeight);
+
+ if (priv->fine)
+ dmxConsoleUpdateFineCursor(priv);
+ if (tmpX != priv->curX || tmpY != priv->curY) {
+ if (tmpX < 0)
+ tmpX = 0;
+ if (tmpY < 0)
+ tmpY = 0;
+ if (tmpX >= priv->consWidth)
+ tmpX = priv->consWidth - 1;
+ if (tmpY >= priv->consHeight)
+ tmpY = priv->consHeight - 1;
+ priv->curX = tmpX;
+ priv->curY = tmpY;
+ if (!priv->fine) {
+ DMXDBG2(" WARP B %d %d\n", priv->curX, priv->curY);
+ XWarpPointer(dpy, priv->window,
+ priv->window, 0, 0, 0, 0, tmpX, tmpY);
+ XSync(dpy, False); /* Not a backend display */
+ }
+ }
+
+ if (dmxGeneration != serverGeneration) {
+ dmxGeneration = serverGeneration;
+ dmxConsoleDraw(priv, 1, 1);
+ }
+}
+
+/** Collect all pending events from the console's display. Plase these
+ * events on the server event queue using the \a motion and \a enqueue
+ * routines. The \a checkspecial routine is used to check for special
+ * keys that need handling. \a block tells if signals should be blocked
+ * when updating the event queue. */
+void
+dmxConsoleCollectEvents(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial, DMXBlockType block)
+{
+ GETPRIVFROMPDEV;
+ GETDMXINPUTFROMPRIV;
+ Display *dpy = priv->display;
+ Window win = priv->window;
+ int width = priv->width;
+ int height = priv->height;
+ XEvent X, N;
+ XSetWindowAttributes attribs;
+ static int rInitialized = 0;
+ static Region r;
+ XRectangle rect;
+ static int raising = 0, raiseX, raiseY; /* FIXME */
+
+ while (XPending(dpy)) {
+ XNextEvent(dpy, &X);
+ switch (X.type) {
+ case VisibilityNotify:
+ break;
+ case Expose:
+ DMXDBG5("dmxConsoleCollectEvents: Expose #%d %d %d %d %d\n",
+ X.xexpose.count,
+ X.xexpose.x, X.xexpose.y,
+ X.xexpose.width, X.xexpose.height);
+ if (!rInitialized++)
+ r = XCreateRegion();
+ rect.x = X.xexpose.x;
+ rect.y = X.xexpose.y;
+ rect.width = X.xexpose.width;
+ rect.height = X.xexpose.height;
+ XUnionRectWithRegion(&rect, r, r);
+ if (X.xexpose.count == 0) {
+ XSetRegion(dpy, priv->gc, r);
+ XSetRegion(dpy, priv->gcDet, r);
+ XSetRegion(dpy, priv->gcRev, r);
+ dmxConsoleDraw(priv, 1, 1);
+ XSetClipMask(dpy, priv->gc, None);
+ XSetClipMask(dpy, priv->gcDet, None);
+ XSetClipMask(dpy, priv->gcRev, None);
+ XDestroyRegion(r);
+ rInitialized = 0;
+ }
+ break;
+ case ResizeRequest:
+ DMXDBG2("dmxConsoleCollectEvents: Resize %d %d\n",
+ X.xresizerequest.width, X.xresizerequest.height);
+ priv->consWidth = X.xresizerequest.width;
+ priv->consHeight = X.xresizerequest.height;
+ priv->xScale = (double) priv->consWidth / width;
+ priv->yScale = (double) priv->consHeight / height;
+ attribs.override_redirect = True;
+ XChangeWindowAttributes(dpy, win, CWOverrideRedirect, &attribs);
+ XResizeWindow(dpy, win, priv->consWidth, priv->consHeight);
+ XFreePixmap(dpy, priv->pixmap);
+ priv->pixmap = XCreatePixmap(dpy,
+ RootWindow(dpy, DefaultScreen(dpy)),
+ priv->consWidth,
+ priv->consHeight,
+ DefaultDepth(dpy, DefaultScreen(dpy)));
+ dmxConsoleDraw(priv, 1, 1);
+ attribs.override_redirect = False;
+ XChangeWindowAttributes(dpy, win, CWOverrideRedirect, &attribs);
+ break;
+ case LeaveNotify:
+ DMXDBG4("dmxConsoleCollectEvents: Leave @ %d,%d; r=%d f=%d\n",
+ X.xcrossing.x, X.xcrossing.y, raising, priv->fine);
+ if (!priv->captured)
+ dmxCommonRestoreState(priv);
+ else {
+ dmxConsoleUncapture(dmxInput);
+ dmxCommonRestoreState(priv);
+ }
+ break;
+ case EnterNotify:
+ DMXDBG6("dmxConsoleCollectEvents: Enter %d,%d r=%d f=%d (%d,%d)\n",
+ X.xcrossing.x, X.xcrossing.y, raising, priv->fine,
+ priv->curX, priv->curY);
+ dmxCommonSaveState(priv);
+ if (raising) {
+ raising = 0;
+ dmxConsoleMoveAbsolute(priv, raiseX, raiseY,
+ priv->mou, motion, block);
+ }
+ else {
+ if (priv->fine) {
+ /* The raise will generate an event near the center,
+ * which is not where the cursor should be. So we
+ * save the real position, do the raise, and move
+ * the cursor here again after the raise generates
+ * the event. */
+ raising = 1;
+ raiseX = X.xcrossing.x;
+ raiseY = X.xcrossing.y;
+ XRaiseWindow(dpy, priv->window);
+ }
+ XSync(dpy, False); /* Not a backend display */
+ if (!X.xcrossing.x && !X.xcrossing.y)
+ dmxConsoleMoveAbsolute(priv, priv->curX, priv->curY,
+ priv->mou, motion, block);
+ }
+ break;
+ case MotionNotify:
+ if (priv->curX == X.xmotion.x && priv->curY == X.xmotion.y)
+ continue;
+ if (XPending(dpy)) { /* do motion compression */
+ XPeekEvent(dpy, &N);
+ if (N.type == MotionNotify)
+ continue;
+ }
+ DMXDBG2("dmxConsoleCollectEvents: Motion %d %d\n",
+ X.xmotion.x, X.xmotion.y);
+ if (raising) {
+ raising = 0;
+ dmxConsoleMoveAbsolute(priv, raiseX, raiseY,
+ priv->mou, motion, block);
+ }
+ else {
+ if (priv->fine)
+ dmxConsoleMoveRelative(priv, X.xmotion.x, X.xmotion.y,
+ priv->mou, motion, block);
+ else
+ dmxConsoleMoveAbsolute(priv, X.xmotion.x, X.xmotion.y,
+ priv->mou, motion, block);
+ }
+ break;
+ case KeyPress:
+ case KeyRelease:
+ enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block);
+ break;
+ default:
+ /* Pass the whole event here, because
+ * this may be an extension event. */
+ enqueue(priv->mou, X.type, X.xbutton.button, 0, &X, block);
+ break;
+ }
+ }
+}
+
+static void
+dmxCloseConsole(myPrivate * priv)
+{
+ GETDMXINPUTFROMPRIV;
+ dmxCommonRestoreState(priv);
+ if (priv->display) {
+ XFreeGC(priv->display, priv->gc);
+ XFreeGC(priv->display, priv->gcDet);
+ XFreeGC(priv->display, priv->gcRev);
+ XFreeGC(priv->display, priv->gcCur);
+ if (!dmxInput->console)
+ XCloseDisplay(priv->display);
+ }
+ priv->display = NULL;
+}
+
+static Bool
+dmxCloseConsoleScreen(int idx, ScreenPtr pScreen)
+{
+ myPrivate *priv, *last;
+
+ for (last = priv = (myPrivate *) dixLookupPrivate(&pScreen->devPrivates,
+ dmxScreenPrivateKey);
+ priv; priv = priv->next)
+ dmxCloseConsole(last = priv);
+
+ DMX_UNWRAP(CloseScreen, last, pScreen);
+ return pScreen->CloseScreen(idx, pScreen);
+}
+
+static Cursor
+dmxConsoleCreateEmptyCursor(myPrivate * priv)
+{
+ char noCursorData[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ Pixmap pixmap;
+ Cursor cursor;
+ XColor color, tmpColor;
+ Display *dpy = priv->display;
+
+ /* Create empty cursor for window */
+ pixmap = XCreateBitmapFromData(priv->display, priv->window,
+ noCursorData, 8, 8);
+ if (!XAllocNamedColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)),
+ "black", &color, &tmpColor))
+ dmxLog(dmxFatal, "Cannot allocate color for cursor\n");
+ cursor = XCreatePixmapCursor(dpy, pixmap, pixmap, &color, &color, 0, 0);
+ XFreePixmap(dpy, pixmap);
+ return cursor;
+}
+
+static void
+dmxConsoleComputeWidthHeight(myPrivate * priv,
+ int *width, int *height,
+ double *xScale, double *yScale,
+ int *consWidth, int *consHeight)
+{
+ int screen;
+ Display *dpy = priv->display;
+
+ *width = 0;
+ *height = 0;
+ *xScale = 1.0;
+ *yScale = 1.0;
+
+ screen = DefaultScreen(dpy);
+ *consWidth = DisplayWidth(dpy, screen) * CONSOLE_NUM / CONSOLE_DEN;
+ *consHeight = DisplayHeight(dpy, screen) * CONSOLE_NUM / CONSOLE_DEN;
+
+ if (*consWidth < 1)
+ *consWidth = 1;
+ if (*consHeight < 1)
+ *consHeight = 1;
+
+#if 1
+ /* Always keep the console size similar
+ * to the global bounding box. */
+ *width = dmxGlobalWidth;
+ *height = dmxGlobalHeight;
+#else
+ /* Make the console window as big as
+ * possible by computing the visible
+ * bounding box. */
+ for (i = 0; i < dmxNumScreens; i++) {
+ if (screenInfo.screens[i]->x + screenInfo.screens[i]->width > *width)
+ *width = screenInfo.screens[i]->x + screenInfo.screens[i]->width;
+
+ if (screenInfo.screens[i]->y + screenInfo.screens[i]->height > *height)
+ *height = screenInfo.screens[i]->y + screenInfo.screens[i]->height;
+ }
+#endif
+
+ if ((double) *consWidth / *width < (double) *consHeight / *height)
+ *xScale = *yScale = (double) *consWidth / *width;
+ else
+ *xScale = *yScale = (double) *consHeight / *height;
+
+ *consWidth = scalex(priv, *width);
+ *consHeight = scaley(priv, *height);
+ if (*consWidth < 1)
+ *consWidth = 1;
+ if (*consHeight < 1)
+ *consHeight = 1;
+}
+
+/** Re-initialized the console device described by \a pDev (after a
+ * reconfig). */
+void
+dmxConsoleReInit(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ Display *dpy;
+
+ if (!priv || !priv->initialized)
+ return;
+ dpy = priv->display;
+
+ dmxConsoleComputeWidthHeight(priv,
+ &priv->width, &priv->height,
+ &priv->xScale, &priv->yScale,
+ &priv->consWidth, &priv->consHeight);
+ XResizeWindow(dpy, priv->window, priv->consWidth, priv->consHeight);
+ XFreePixmap(dpy, priv->pixmap);
+ priv->pixmap = XCreatePixmap(dpy,
+ RootWindow(dpy, DefaultScreen(dpy)),
+ priv->consWidth,
+ priv->consHeight,
+ DefaultDepth(dpy, DefaultScreen(dpy)));
+ dmxConsoleDraw(priv, 1, 1);
+}
+
+/** Initialized the console device described by \a pDev. */
+void
+dmxConsoleInit(DevicePtr pDev)
+{
+ GETPRIVFROMPDEV;
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+ int screen;
+ unsigned long mask;
+ XSetWindowAttributes attribs;
+ Display *dpy;
+ Window win;
+ XGCValues gcvals;
+ XColor color;
+ XClassHint class_hints;
+ unsigned long tmp;
+
+ if (dmxLocal->type == DMX_LOCAL_MOUSE)
+ priv->mou = pDev;
+ if (dmxLocal->type == DMX_LOCAL_KEYBOARD)
+ priv->kbd = pDev;
+ if (priv->initialized++)
+ return; /* Only do once for mouse/keyboard pair */
+
+ if (!(dpy = priv->display = XOpenDisplay(dmxInput->name)))
+ dmxLog(dmxFatal,
+ "dmxOpenConsole: cannot open console display %s\n",
+ dmxInput->name);
+
+ /* Set up defaults */
+ dmxConsoleComputeWidthHeight(priv,
+ &priv->width, &priv->height,
+ &priv->xScale, &priv->yScale,
+ &priv->consWidth, &priv->consHeight);
+
+ /* Private initialization using computed values or constants. */
+ screen = DefaultScreen(dpy);
+ priv->initPointerX = scalex(priv, priv->width / 2);
+ priv->initPointerY = scaley(priv, priv->height / 2);
+ priv->eventMask = (ButtonPressMask
+ | ButtonReleaseMask
+ | PointerMotionMask
+ | EnterWindowMask
+ | LeaveWindowMask
+ | KeyPressMask
+ | KeyReleaseMask | ExposureMask | ResizeRedirectMask);
+
+ mask = CWBackPixel | CWEventMask | CWColormap | CWOverrideRedirect;
+ attribs.colormap = DefaultColormap(dpy, screen);
+ if (XParseColor(dpy, attribs.colormap, CONSOLE_BG_COLOR, &color)
+ && XAllocColor(dpy, attribs.colormap, &color)) {
+ attribs.background_pixel = color.pixel;
+ }
+ else
+ attribs.background_pixel = WhitePixel(dpy, screen);
+
+ attribs.event_mask = priv->eventMask;
+ attribs.override_redirect = False;
+
+ win = priv->window = XCreateWindow(dpy,
+ RootWindow(dpy, screen),
+ 0, 0, priv->consWidth, priv->consHeight,
+ 0,
+ DefaultDepth(dpy, screen),
+ InputOutput,
+ DefaultVisual(dpy, screen),
+ mask, &attribs);
+ priv->pixmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
+ priv->consWidth, priv->consHeight,
+ DefaultDepth(dpy, screen));
+
+ /* Set up properties */
+ XStoreName(dpy, win, DMX_CONSOLE_NAME);
+ class_hints.res_name = DMX_RES_NAME;
+ class_hints.res_class = DMX_RES_CLASS;
+ XSetClassHint(dpy, win, &class_hints);
+
+ /* Map the window */
+ XMapWindow(dpy, win);
+
+ /* Create cursors */
+ priv->cursorNormal = XCreateFontCursor(dpy, XC_circle);
+ priv->cursorGrabbed = XCreateFontCursor(dpy, XC_spider);
+ priv->cursorEmpty = dmxConsoleCreateEmptyCursor(priv);
+ XDefineCursor(dpy, priv->window, priv->cursorNormal);
+
+ /* Create GC */
+ mask = (GCFunction | GCPlaneMask | GCClipMask | GCForeground |
+ GCBackground | GCLineWidth | GCLineStyle | GCCapStyle |
+ GCFillStyle | GCGraphicsExposures);
+ gcvals.function = GXcopy;
+ gcvals.plane_mask = AllPlanes;
+ gcvals.clip_mask = None;
+ if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_FG_COLOR, &color)
+ && XAllocColor(dpy, attribs.colormap, &color)) {
+ gcvals.foreground = color.pixel;
+ }
+ else
+ gcvals.foreground = BlackPixel(dpy, screen);
+ if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_BG_COLOR, &color)
+ && XAllocColor(dpy, attribs.colormap, &color)) {
+ gcvals.background = color.pixel;
+ }
+ else
+ gcvals.background = WhitePixel(dpy, screen);
+ gcvals.line_width = 0;
+ gcvals.line_style = LineSolid;
+ gcvals.cap_style = CapNotLast;
+ gcvals.fill_style = FillSolid;
+ gcvals.graphics_exposures = False;
+
+ priv->gc = XCreateGC(dpy, win, mask, &gcvals);
+
+ tmp = gcvals.foreground;
+ if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_DET_COLOR, &color)
+ && XAllocColor(dpy, attribs.colormap, &color)) {
+ gcvals.foreground = color.pixel;
+ }
+ else
+ gcvals.foreground = BlackPixel(dpy, screen);
+ priv->gcDet = XCreateGC(dpy, win, mask, &gcvals);
+ gcvals.foreground = tmp;
+
+ tmp = gcvals.background;
+ gcvals.background = gcvals.foreground;
+ gcvals.foreground = tmp;
+ priv->gcRev = XCreateGC(dpy, win, mask, &gcvals);
+
+ gcvals.background = gcvals.foreground;
+ if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_CUR_COLOR, &color)
+ && XAllocColor(dpy, attribs.colormap, &color)) {
+ gcvals.foreground = color.pixel;
+ }
+ else
+ gcvals.foreground = BlackPixel(dpy, screen);
+ priv->gcCur = XCreateGC(dpy, win, mask, &gcvals);
+
+ dmxConsoleDraw(priv, 1, 1);
+
+ if (dixLookupPrivate(&screenInfo.screens[0]->devPrivates,
+ dmxScreenPrivateKey))
+ priv->next = dixLookupPrivate(&screenInfo.screens[0]->devPrivates,
+ dmxScreenPrivateKey);
+ else
+ DMX_WRAP(CloseScreen, dmxCloseConsoleScreen,
+ priv, screenInfo.screens[0]);
+ dixSetPrivate(&screenInfo.screens[0]->devPrivates, dmxScreenPrivateKey,
+ priv);
+}
+
+/** Fill in the \a info structure for the specified \a pDev. Only used
+ * for pointers. */
+void
+dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ GETPRIVFROMPDEV;
+
+ info->buttonClass = 1;
+ dmxCommonMouGetMap(pDev, info->map, &info->numButtons);
+ info->valuatorClass = 1;
+ info->numRelAxes = 2;
+ info->minval[0] = 0;
+ info->minval[1] = 0;
+ /* max possible console window size: */
+ info->maxval[0] = DisplayWidth(priv->display, DefaultScreen(priv->display));
+ info->maxval[1] =
+ DisplayHeight(priv->display, DefaultScreen(priv->display));
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
+ info->ptrFeedbackClass = 1;
+}
+
+/** Fill in the \a info structure for the specified \a pDev. Only used
+ * for keyboard. */
+void
+dmxConsoleKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ dmxCommonKbdGetInfo(pDev, info);
+ info->keyboard = 1;
+ info->keyClass = 1;
+ dmxCommonKbdGetMap(pDev, &info->keySyms, info->modMap);
+ info->freemap = 1;
+ info->focusClass = 1;
+ info->kbdFeedbackClass = 1;
+}
+
+/** Handle special console-only keys. */
+int
+dmxConsoleFunctions(pointer private, DMXFunctionType function)
+{
+ GETONLYPRIVFROMPRIVATE;
+ XRectangle rect;
+ Display *dpy = priv->display;
+
+ switch (function) {
+ case DMX_FUNCTION_FINE:
+ if (priv->fine) {
+ priv->fine = 0;
+ dmxConsoleClearCursor(priv, priv->globalX, priv->globalY, &rect);
+ XSetClipRectangles(dpy, priv->gc, 0, 0, &rect, 1, Unsorted);
+ XCopyArea(dpy, priv->pixmap, priv->window, priv->gc,
+ 0, 0, priv->consWidth, priv->consHeight, 0, 0);
+ XSetClipMask(dpy, priv->gc, None);
+
+ XDefineCursor(dpy, priv->window,
+ priv->grabbed
+ ? priv->cursorGrabbed : priv->cursorNormal);
+ XWarpPointer(dpy, priv->window, priv->window,
+ 0, 0, 0, 0,
+ scalex(priv, priv->globalX),
+ scaley(priv, priv->globalY));
+ XSync(dpy, False); /* Not a backend display */
+ }
+ else {
+ priv->fine = 1;
+ XRaiseWindow(dpy, priv->window);
+ XDefineCursor(dpy, priv->window, priv->cursorEmpty);
+ dmxConsoleUpdateFineCursor(priv);
+ }
+ return 1;
+ case DMX_FUNCTION_GRAB:
+ if (priv->grabbed) {
+ XUngrabKeyboard(dpy, CurrentTime);
+ XUngrabPointer(dpy, CurrentTime);
+ XDefineCursor(dpy, priv->window,
+ priv->fine ? priv->cursorEmpty : priv->cursorNormal);
+ }
+ else {
+ if (XGrabPointer(dpy, priv->window, True,
+ 0, GrabModeAsync, GrabModeAsync, priv->window,
+ None, CurrentTime)) {
+ dmxLog(dmxError, "XGrabPointer failed\n");
+ return 0;
+ }
+ if (XGrabKeyboard(dpy, priv->window, True,
+ GrabModeAsync, GrabModeAsync, CurrentTime)) {
+ dmxLog(dmxError, "XGrabKeyboard failed\n");
+ XUngrabPointer(dpy, CurrentTime);
+ return 0;
+ }
+ XDefineCursor(dpy, priv->window,
+ priv->fine ? priv->cursorEmpty : priv->cursorGrabbed);
+ }
+ priv->grabbed = !priv->grabbed;
+ if (priv->fine)
+ dmxConsoleUpdateFineCursor(priv);
+ return 1;
+ case DMX_FUNCTION_TERMINATE:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+static void
+dmxDump(void)
+{
+ int i, j;
+ DMXInputInfo *dmxInput;
+ XEvent X;
+
+ for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) {
+ for (j = 0; j < dmxInput->numDevs; j++) {
+ DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j];
+ myPrivate *priv = dmxLocal->private;
+
+ while (priv
+ && priv->display
+ && XCheckTypedEvent(priv->display, MotionNotify, &X)) {
+ DMXDBG4("dmxDump: %s/%d threw event away %d %s\n",
+ dmxInput->name, j, X.type, dmxEventName(X.type));
+ }
+ }
+ }
+}
+
+/** This routine is used to warp the pointer into the console window
+ * from anywhere on the screen. It is used when backend and console
+ * input are both being taken from the same X display. */
+void
+dmxConsoleCapture(DMXInputInfo * dmxInput)
+{
+ int i;
+ XEvent X;
+
+ DMXDBG0("dmxConsoleCapture\n");
+ dmxSync(NULL, TRUE);
+ for (i = 0; i < dmxInput->numDevs; i++) {
+ DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+ myPrivate *priv = dmxLocal->private;
+
+ if (dmxLocal->extType != DMX_LOCAL_TYPE_CONSOLE)
+ continue;
+ if (dmxLocal->type != DMX_LOCAL_MOUSE)
+ continue;
+ if (priv->captured)
+ continue;
+ priv->captured = 2; /* Ungrab only after proximal events. */
+ XRaiseWindow(priv->display, priv->window);
+ XSync(priv->display, False); /* Not a backend display */
+ while (XCheckTypedEvent(priv->display, MotionNotify, &X)) {
+ DMXDBG3(" Ignoring motion to %d %d after capture on %s\n",
+ X.xmotion.x, X.xmotion.y, dmxInput->name);
+ }
+ XWarpPointer(priv->display, None,
+ priv->window, 0, 0, 0, 0, priv->curX, priv->curY);
+ XSync(priv->display, False); /* Not a backend display */
+ dmxDump();
+ if (priv->fine)
+ dmxConsoleUpdateFineCursor(priv);
+ }
+}
+
+/** Undo the capture that was done by #dmxConsoleCapture. */
+void
+dmxConsoleUncapture(DMXInputInfo * dmxInput)
+{
+ int i;
+
+ DMXDBG0("dmxConsoleUncapture\n");
+ dmxSync(NULL, TRUE);
+ for (i = 0; i < dmxInput->numDevs; i++) {
+ DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+ myPrivate *priv = dmxLocal->private;
+
+ if (dmxLocal->extType != DMX_LOCAL_TYPE_CONSOLE)
+ continue;
+ if (dmxLocal->type != DMX_LOCAL_MOUSE)
+ continue;
+ if (!priv->captured)
+ continue;
+ priv->captured = 0;
+ XSync(priv->display, False); /* Not a backend display */
+ }
+}
diff --git a/xorg-server/hw/dmx/input/dmxdetach.c b/xorg-server/hw/dmx/input/dmxdetach.c
index cc2250683..469f9c8d0 100644
--- a/xorg-server/hw/dmx/input/dmxdetach.c
+++ b/xorg-server/hw/dmx/input/dmxdetach.c
@@ -42,12 +42,14 @@
#include "dmxextension.h" /* For dmxInputCount */
/** Search for input associated with \a dmxScreen, and detach. */
-void dmxInputDetach(DMXScreenInfo *dmxScreen, Bool reserveId)
+void
+dmxInputDetach(DMXScreenInfo * dmxScreen, Bool reserveId)
{
int i;
for (i = 0; i < dmxNumInputs; i++) {
DMXInputInfo *dmxInput = &dmxInputs[i];
+
if (dmxInput->scrnIdx == dmxScreen->index) {
dmxLogInput(dmxInput, "Detaching (%sreserved)\n",
reserveId ? "" : "not ");
diff --git a/xorg-server/hw/dmx/input/dmxdummy.c b/xorg-server/hw/dmx/input/dmxdummy.c
index 971892b9f..0690177f8 100644
--- a/xorg-server/hw/dmx/input/dmxdummy.c
+++ b/xorg-server/hw/dmx/input/dmxdummy.c
@@ -47,40 +47,42 @@
/** Return information about the dummy keyboard device specified in \a pDev
* into the structure pointed to by \a info. The keyboard is set up to
* have 1 valid key code that is \a NoSymbol */
-void dmxDummyKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+void
+dmxDummyKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
{
static KeySym keyboard_mapping = NoSymbol;
- info->keyboard = 1;
- info->keyClass = 1;
+ info->keyboard = 1;
+ info->keyClass = 1;
info->keySyms.minKeyCode = 8;
info->keySyms.maxKeyCode = 8;
- info->keySyms.mapWidth = 1;
- info->keySyms.map = &keyboard_mapping;
- info->freemap = 0;
- info->focusClass = 1;
- info->kbdFeedbackClass = 1;
- info->force = 1;
+ info->keySyms.mapWidth = 1;
+ info->keySyms.map = &keyboard_mapping;
+ info->freemap = 0;
+ info->focusClass = 1;
+ info->kbdFeedbackClass = 1;
+ info->force = 1;
}
/** Return information about the dummy mouse device specified in \a pDev
* into the structure pointed to by \a info. They mouse has 3 buttons
* and two axes. */
-void dmxDummyMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+void
+dmxDummyMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
{
- info->buttonClass = 1;
- info->numButtons = 3;
- info->map[0] = 1;
- info->map[1] = 2;
- info->map[2] = 3;
- info->valuatorClass = 1;
- info->numRelAxes = 2;
- info->minval[0] = 0;
- info->minval[1] = 0;
- info->maxval[0] = 0;
- info->maxval[1] = 0;
- info->res[0] = 1;
- info->minres[0] = 0;
- info->maxres[0] = 1;
+ info->buttonClass = 1;
+ info->numButtons = 3;
+ info->map[0] = 1;
+ info->map[1] = 2;
+ info->map[2] = 3;
+ info->valuatorClass = 1;
+ info->numRelAxes = 2;
+ info->minval[0] = 0;
+ info->minval[1] = 0;
+ info->maxval[0] = 0;
+ info->maxval[1] = 0;
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
info->ptrFeedbackClass = 1;
}
diff --git a/xorg-server/hw/dmx/input/dmxevents.c b/xorg-server/hw/dmx/input/dmxevents.c
index 41bc4bf2d..f73480824 100644
--- a/xorg-server/hw/dmx/input/dmxevents.c
+++ b/xorg-server/hw/dmx/input/dmxevents.c
@@ -61,9 +61,9 @@
#include "xkbsrv.h"
#include "XIstubs.h"
-static int dmxGlobalX, dmxGlobalY; /* Global cursor position */
-static int dmxGlobalInvalid; /* Flag indicating dmxCoreMotion
- * should move the mouse anyway. */
+static int dmxGlobalX, dmxGlobalY; /* Global cursor position */
+static int dmxGlobalInvalid; /* Flag indicating dmxCoreMotion
+ * should move the mouse anyway. */
#if DMX_EVENTS_DEBUG
#define DMXDBG0(f) dmxLog(dmxDebug,f)
@@ -85,25 +85,26 @@ static int dmxGlobalInvalid; /* Flag indicating dmxCoreMotion
#define DMXDBG7(f,a,b,c,d,e,g,h)
#endif
-static int dmxApplyFunctions(DMXInputInfo *dmxInput, DMXFunctionType f)
+static int
+dmxApplyFunctions(DMXInputInfo * dmxInput, DMXFunctionType f)
{
int i;
int rc = 0;
- for (i = 0; i < dmxInput->numDevs; i+= dmxInput->devs[i]->binding)
+ for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding)
if (dmxInput->devs[i]->functions)
rc += dmxInput->devs[i]->functions(dmxInput->devs[i]->private, f);
return rc;
}
-static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal,
- int type,
- KeySym keySym)
+static int
+dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal, int type, KeySym keySym)
{
- DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+ DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
-#if 1 /* hack to detect ctrl-alt-q, etc */
+#if 1 /* hack to detect ctrl-alt-q, etc */
static int ctrl = 0, alt = 0;
+
/* keep track of ctrl/alt key status */
if (type == KeyPress && keySym == 0xffe3) {
ctrl = 1;
@@ -126,11 +127,11 @@ static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal,
state = dmxLocalCoreKeyboard->pDevice->key->state;
else if (dmxLocal->pDevice->key)
state = dmxLocal->pDevice->key->state;
-
+
DMXDBG3("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n",
keySym, type == KeyPress ? "press" : "release", state);
- if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask))
+ if ((state & (ControlMask | Mod1Mask)) != (ControlMask | Mod1Mask))
return 0;
#endif
@@ -151,34 +152,36 @@ static int dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal,
}
return 1;
}
-
+
return 0;
}
-
-DMXScreenInfo *dmxFindFirstScreen(int x, int y)
+DMXScreenInfo *
+dmxFindFirstScreen(int x, int y)
{
int i;
for (i = 0; i < dmxNumScreens; i++) {
DMXScreenInfo *dmxScreen = &dmxScreens[i];
+
if (dmxOnScreen(x, y, dmxScreen))
return dmxScreen;
}
return NULL;
}
-
/**
* Enqueue a motion event.
*/
-static void enqueueMotion(DevicePtr pDev, int x, int y)
+static void
+enqueueMotion(DevicePtr pDev, int x, int y)
{
GETDMXLOCALFROMPDEV;
DeviceIntPtr p = dmxLocal->pDevice;
int valuators[3];
- int detail = 0; /* XXX should this be mask of pressed buttons? */
+ int detail = 0; /* XXX should this be mask of pressed buttons? */
ValuatorMask mask;
+
valuators[0] = x;
valuators[1] = y;
@@ -188,50 +191,50 @@ static void enqueueMotion(DevicePtr pDev, int x, int y)
return;
}
-
void
dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
{
DMXScreenInfo *dmxScreen;
- DMXInputInfo *dmxInput;
- ScreenPtr pScreen;
- int localX;
- int localY;
- int i;
+ DMXInputInfo *dmxInput;
+ ScreenPtr pScreen;
+ int localX;
+ int localY;
+ int i;
if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y)
return;
-
+
DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n",
x, y, delta, dmxGlobalX, dmxGlobalY);
dmxGlobalInvalid = 0;
- dmxGlobalX = x;
- dmxGlobalY = y;
+ dmxGlobalX = x;
+ dmxGlobalY = y;
if (dmxGlobalX < 0)
dmxGlobalX = 0;
if (dmxGlobalY < 0)
dmxGlobalY = 0;
if (dmxGlobalX >= dmxGlobalWidth)
- dmxGlobalX = dmxGlobalWidth + delta -1;
+ dmxGlobalX = dmxGlobalWidth + delta - 1;
if (dmxGlobalY >= dmxGlobalHeight)
- dmxGlobalY = dmxGlobalHeight + delta -1;
-
+ dmxGlobalY = dmxGlobalHeight + delta - 1;
+
if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) {
localX = dmxGlobalX - dmxScreen->rootXOrigin;
localY = dmxGlobalY - dmxScreen->rootYOrigin;
if ((pScreen = miPointerGetScreen(inputInfo.pointer))
&& pScreen->myNum == dmxScreen->index) {
- /* Screen is old screen */
+ /* Screen is old screen */
if (block)
dmxSigioBlock();
if (pDev)
- enqueueMotion(pDev, localX, localY);
+ enqueueMotion(pDev, localX, localY);
if (block)
dmxSigioUnblock();
- } else {
- /* Screen is new */
+ }
+ else {
+ /* Screen is new */
DMXDBG4(" New screen: old=%d new=%d localX=%d localY=%d\n",
pScreen->myNum, dmxScreen->index, localX, localY);
if (block)
@@ -240,7 +243,7 @@ dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
miPointerSetScreen(inputInfo.pointer, dmxScreen->index,
localX, localY);
if (pDev)
- enqueueMotion(pDev, localX, localY);
+ enqueueMotion(pDev, localX, localY);
if (block)
dmxSigioUnblock();
}
@@ -260,10 +263,11 @@ dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
}
#endif
}
- /* Send updates down to all core input
- * drivers */
+ /* Send updates down to all core input
+ * drivers */
for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) {
int j;
+
for (j = 0; j < dmxInput->numDevs; j += dmxInput->devs[j]->binding)
if (!dmxInput->detached
&& dmxInput->devs[j]->sendsCore
@@ -271,34 +275,35 @@ dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block)
dmxInput->devs[j]->update_position(dmxInput->devs[j]->private,
dmxGlobalX, dmxGlobalY);
}
- if (!dmxScreen) ProcessInputEvents();
+ if (!dmxScreen)
+ ProcessInputEvents();
}
-
-
#define DMX_MAX_AXES 32 /* Max axes reported by this routine */
-static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
- int *v, int firstAxis, int axesCount,
- DMXMotionType type, DMXBlockType block)
+static void
+dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
+ int *v, int firstAxis, int axesCount,
+ DMXMotionType type, DMXBlockType block)
{
- DeviceIntPtr pDevice = dmxLocal->pDevice;
- xEvent xE[2 * DMX_MAX_AXES/6];
- deviceKeyButtonPointer *xev = (deviceKeyButtonPointer *)xE;
- deviceValuator *xv = (deviceValuator *)xev+1;
- int thisX = 0;
- int thisY = 0;
- int count;
- ValuatorMask mask;
+ DeviceIntPtr pDevice = dmxLocal->pDevice;
+ xEvent xE[2 * DMX_MAX_AXES / 6];
+ deviceKeyButtonPointer *xev = (deviceKeyButtonPointer *) xE;
+ deviceValuator *xv = (deviceValuator *) xev + 1;
+ int thisX = 0;
+ int thisY = 0;
+ int count;
+ ValuatorMask mask;
memset(xE, 0, sizeof(xE));
- if (axesCount > DMX_MAX_AXES) axesCount = DMX_MAX_AXES;
+ if (axesCount > DMX_MAX_AXES)
+ axesCount = DMX_MAX_AXES;
- if ((valuator_get_mode(pDevice,0) == Relative) && axesCount == 2) {
- /* The dmx console is a relative mode
- * device that sometimes reports
- * absolute motion. It only has two
- * axes. */
+ if ((valuator_get_mode(pDevice, 0) == Relative) && axesCount == 2) {
+ /* The dmx console is a relative mode
+ * device that sometimes reports
+ * absolute motion. It only has two
+ * axes. */
if (type == DMX_RELATIVE) {
thisX = -v[0];
thisY = -v[1];
@@ -307,7 +312,8 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
if (dmxLocal->update_position)
dmxLocal->update_position(dmxLocal->private,
dmxLocal->lastX, dmxLocal->lastY);
- } else { /* Convert to relative */
+ }
+ else { /* Convert to relative */
if (dmxLocal->lastX || dmxLocal->lastY) {
thisX = v[0] - dmxLocal->lastX;
thisY = v[1] - dmxLocal->lastY;
@@ -320,110 +326,155 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal,
}
if (axesCount <= 6) {
- /* Optimize for the common case when
- * only 1 or 2 axes change. */
- xev->time = GetTimeInMillis();
- xev->type = DeviceMotionNotify;
- xev->detail = 0;
- xev->deviceid = pDevice->id | MORE_EVENTS;
-
- xv->type = DeviceValuator;
- xv->deviceid = pDevice->id;
- xv->num_valuators = axesCount;
- xv->first_valuator = firstAxis;
- switch (xv->num_valuators) {
- case 6: xv->valuator5 = v[5];
- case 5: xv->valuator4 = v[4];
- case 4: xv->valuator3 = v[3];
- case 3: xv->valuator2 = v[2];
- case 2: xv->valuator1 = v[1];
- case 1: xv->valuator0 = v[0];
- }
- count = 2;
- } else {
+ /* Optimize for the common case when
+ * only 1 or 2 axes change. */
+ xev->time = GetTimeInMillis();
+ xev->type = DeviceMotionNotify;
+ xev->detail = 0;
+ xev->deviceid = pDevice->id | MORE_EVENTS;
+
+ xv->type = DeviceValuator;
+ xv->deviceid = pDevice->id;
+ xv->num_valuators = axesCount;
+ xv->first_valuator = firstAxis;
+ switch (xv->num_valuators) {
+ case 6:
+ xv->valuator5 = v[5];
+ case 5:
+ xv->valuator4 = v[4];
+ case 4:
+ xv->valuator3 = v[3];
+ case 3:
+ xv->valuator2 = v[2];
+ case 2:
+ xv->valuator1 = v[1];
+ case 1:
+ xv->valuator0 = v[0];
+ }
+ count = 2;
+ }
+ else {
int i;
+
for (i = 0, count = 0; i < axesCount; i += 6) {
- xev->time = GetTimeInMillis();
- xev->type = DeviceMotionNotify;
- xev->detail = 0;
- xev->deviceid = pDevice->id | MORE_EVENTS;
- xev += 2;
-
- xv->type = DeviceValuator;
- xv->deviceid = pDevice->id;
- xv->num_valuators = (i+6 >= axesCount ? axesCount - i : 6);
+ xev->time = GetTimeInMillis();
+ xev->type = DeviceMotionNotify;
+ xev->detail = 0;
+ xev->deviceid = pDevice->id | MORE_EVENTS;
+ xev += 2;
+
+ xv->type = DeviceValuator;
+ xv->deviceid = pDevice->id;
+ xv->num_valuators = (i + 6 >= axesCount ? axesCount - i : 6);
xv->first_valuator = firstAxis + i;
switch (xv->num_valuators) {
- case 6: xv->valuator5 = v[i+5];
- case 5: xv->valuator4 = v[i+4];
- case 4: xv->valuator3 = v[i+3];
- case 3: xv->valuator2 = v[i+2];
- case 2: xv->valuator1 = v[i+1];
- case 1: xv->valuator0 = v[i+0];
+ case 6:
+ xv->valuator5 = v[i + 5];
+ case 5:
+ xv->valuator4 = v[i + 4];
+ case 4:
+ xv->valuator3 = v[i + 3];
+ case 3:
+ xv->valuator2 = v[i + 2];
+ case 2:
+ xv->valuator1 = v[i + 1];
+ case 1:
+ xv->valuator0 = v[i + 0];
}
- xv += 2;
- count += 2;
+ xv += 2;
+ count += 2;
}
}
if (block)
dmxSigioBlock();
valuator_mask_set_range(&mask, firstAxis, axesCount, v);
- QueuePointerEvents(pDevice, MotionNotify, 0,
- POINTER_ABSOLUTE, &mask);
+ QueuePointerEvents(pDevice, MotionNotify, 0, POINTER_ABSOLUTE, &mask);
if (block)
dmxSigioUnblock();
}
-static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
- XEvent *e, DMXBlockType block)
+static int
+dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
+ XEvent * e, DMXBlockType block)
{
- int type;
- int event = -1;
- XDeviceKeyEvent *ke = (XDeviceKeyEvent *)e;
- XDeviceMotionEvent *me = (XDeviceMotionEvent *)e;
- DeviceIntPtr pDevice = dmxLocal->pDevice;
- int valuators[MAX_VALUATORS];
- ValuatorMask mask;
+ int type;
+ int event = -1;
+ XDeviceKeyEvent *ke = (XDeviceKeyEvent *) e;
+ XDeviceMotionEvent *me = (XDeviceMotionEvent *) e;
+ DeviceIntPtr pDevice = dmxLocal->pDevice;
+ int valuators[MAX_VALUATORS];
+ ValuatorMask mask;
if (!e)
- return -1; /* No extended event passed, cannot handle */
+ return -1; /* No extended event passed, cannot handle */
- if ((XID)dmxLocal->deviceId != ke->deviceid) {
- /* Search for the correct dmxLocal,
- * since backend and console events are
- * picked up for the first device on
- * that X server. */
+ if ((XID) dmxLocal->deviceId != ke->deviceid) {
+ /* Search for the correct dmxLocal,
+ * since backend and console events are
+ * picked up for the first device on
+ * that X server. */
int i;
DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx];
+
for (i = 0; i < dmxInput->numDevs; i++) {
dmxLocal = dmxInput->devs[i];
- if ((XID)dmxLocal->deviceId == ke->deviceid)
+ if ((XID) dmxLocal->deviceId == ke->deviceid)
break;
}
}
- if ((XID)dmxLocal->deviceId != ke->deviceid
+ if ((XID) dmxLocal->deviceId != ke->deviceid
|| (type = dmxMapLookup(dmxLocal, e->type)) < 0)
- return -1; /* No mapping, so this event is unhandled */
+ return -1; /* No mapping, so this event is unhandled */
switch (type) {
- case XI_DeviceValuator: event = DeviceValuator; break;
- case XI_DeviceKeyPress: event = KeyPress; break;
- case XI_DeviceKeyRelease: event = KeyRelease; break;
- case XI_DeviceButtonPress: event = ButtonPress; break;
- case XI_DeviceButtonRelease: event = ButtonRelease; break;
- case XI_DeviceMotionNotify: event = MotionNotify; break;
- case XI_DeviceFocusIn: event = DeviceFocusIn; break;
- case XI_DeviceFocusOut: event = DeviceFocusOut; break;
- case XI_ProximityIn: event = ProximityIn; break;
- case XI_ProximityOut: event = ProximityOut; break;
- case XI_DeviceStateNotify: event = DeviceStateNotify; break;
- case XI_DeviceMappingNotify: event = DeviceMappingNotify; break;
- case XI_ChangeDeviceNotify: event = ChangeDeviceNotify; break;
- case XI_DeviceKeystateNotify: event = DeviceStateNotify; break;
- case XI_DeviceButtonstateNotify: event = DeviceStateNotify; break;
+ case XI_DeviceValuator:
+ event = DeviceValuator;
+ break;
+ case XI_DeviceKeyPress:
+ event = KeyPress;
+ break;
+ case XI_DeviceKeyRelease:
+ event = KeyRelease;
+ break;
+ case XI_DeviceButtonPress:
+ event = ButtonPress;
+ break;
+ case XI_DeviceButtonRelease:
+ event = ButtonRelease;
+ break;
+ case XI_DeviceMotionNotify:
+ event = MotionNotify;
+ break;
+ case XI_DeviceFocusIn:
+ event = DeviceFocusIn;
+ break;
+ case XI_DeviceFocusOut:
+ event = DeviceFocusOut;
+ break;
+ case XI_ProximityIn:
+ event = ProximityIn;
+ break;
+ case XI_ProximityOut:
+ event = ProximityOut;
+ break;
+ case XI_DeviceStateNotify:
+ event = DeviceStateNotify;
+ break;
+ case XI_DeviceMappingNotify:
+ event = DeviceMappingNotify;
+ break;
+ case XI_ChangeDeviceNotify:
+ event = ChangeDeviceNotify;
+ break;
+ case XI_DeviceKeystateNotify:
+ event = DeviceStateNotify;
+ break;
+ case XI_DeviceButtonstateNotify:
+ event = DeviceStateNotify;
+ break;
}
#define EXTRACT_VALUATORS(ke, valuators) \
@@ -438,7 +489,8 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
case XI_DeviceKeyPress:
case XI_DeviceKeyRelease:
EXTRACT_VALUATORS(ke, valuators);
- valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators);
+ valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count,
+ valuators);
if (block)
dmxSigioBlock();
QueueKeyboardEvents(pDevice, event, ke->keycode, &mask);
@@ -448,7 +500,8 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
case XI_DeviceButtonPress:
case XI_DeviceButtonRelease:
EXTRACT_VALUATORS(ke, valuators);
- valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators);
+ valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count,
+ valuators);
if (block)
dmxSigioBlock();
QueuePointerEvents(pDevice, event, ke->keycode,
@@ -459,7 +512,8 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
case XI_ProximityIn:
case XI_ProximityOut:
EXTRACT_VALUATORS(ke, valuators);
- valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators);
+ valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count,
+ valuators);
if (block)
dmxSigioBlock();
QueueProximityEvents(pDevice, event, &mask);
@@ -480,13 +534,13 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
case XI_ChangeDeviceNotify:
case XI_DeviceKeystateNotify:
case XI_DeviceButtonstateNotify:
- /* These are ignored, since DMX will
- * generate its own events of these
- * types, as necessary.
+ /* These are ignored, since DMX will
+ * generate its own events of these
+ * types, as necessary.
- * Perhaps ChangeDeviceNotify should
- * generate an error, because it is
- * unexpected? */
+ * Perhaps ChangeDeviceNotify should
+ * generate an error, because it is
+ * unexpected? */
break;
case XI_DeviceValuator:
default:
@@ -498,11 +552,12 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal,
return 0;
}
-static int dmxGetButtonMapping(DMXLocalInputInfoPtr dmxLocal, int button)
+static int
+dmxGetButtonMapping(DMXLocalInputInfoPtr dmxLocal, int button)
{
ButtonClassPtr b = dmxLocal->pDevice->button;
- if (button > b->numButtons) { /* This shouldn't happen. */
+ if (button > b->numButtons) { /* This shouldn't happen. */
dmxLog(dmxWarning, "Button %d pressed, but only %d buttons?!?\n",
button, b->numButtons);
return button;
@@ -512,14 +567,16 @@ static int dmxGetButtonMapping(DMXLocalInputInfoPtr dmxLocal, int button)
/** Return DMX's notion of the pointer position in the global coordinate
* space. */
-void dmxGetGlobalPosition(int *x, int *y)
+void
+dmxGetGlobalPosition(int *x, int *y)
{
*x = dmxGlobalX;
*y = dmxGlobalY;
}
/** Invalidate the global position for #dmxCoreMotion. */
-void dmxInvalidateGlobalPosition(void)
+void
+dmxInvalidateGlobalPosition(void)
{
dmxGlobalInvalid = 1;
}
@@ -534,8 +591,9 @@ void dmxInvalidateGlobalPosition(void)
*
* If \a block is set to \a DMX_BLOCK, then the SIGIO handler will be
* blocked around calls to \a enqueueMotion(). */
-void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount,
- DMXMotionType type, DMXBlockType block)
+void
+dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount,
+ DMXMotionType type, DMXBlockType block)
{
GETDMXLOCALFROMPDEV;
@@ -558,8 +616,8 @@ void dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount,
}
}
-static KeySym dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal,
- KeyCode keyCode)
+static KeySym
+dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal, KeyCode keyCode)
{
KeySym keysym = NoSymbol;
int effectiveGroup;
@@ -578,21 +636,21 @@ static KeySym dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal,
DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n",
keyCode, keysym);
-out:
+ out:
return keysym;
}
-static KeyCode dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym,
- int tryFirst)
+static KeyCode
+dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym, int tryFirst)
{
/* FIXME: this is quite ineffective, converting to a core map first and
* then extracting the info from there. It'd be better to run the actual
* xkb map */
XkbSrvInfoPtr xkbi = dmxLocal->pDevice->key->xkbInfo;
KeySymsPtr pKeySyms = XkbGetCoreMap(dmxLocal->pDevice);
- int i;
+ int i;
- /* Optimize for similar maps */
+ /* Optimize for similar maps */
if (XkbKeycodeInRange(xkbi->desc, tryFirst)
&& pKeySyms->map[(tryFirst - xkbi->desc->min_key_code)
* pKeySyms->mapWidth] == keySym)
@@ -603,18 +661,19 @@ static KeyCode dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym,
* pKeySyms->mapWidth] == keySym) {
DMXDBG3("dmxKeySymToKeyCode: Translated keySym=0x%04x to"
" keyCode=%d (reverses to core keySym=0x%04x)\n",
- keySym, i, dmxKeyCodeToKeySym(dmxLocalCoreKeyboard,i));
+ keySym, i, dmxKeyCodeToKeySym(dmxLocalCoreKeyboard, i));
return i;
}
}
return 0;
}
-static int dmxFixup(DevicePtr pDev, int detail, KeySym keySym)
+static int
+dmxFixup(DevicePtr pDev, int detail, KeySym keySym)
{
GETDMXLOCALFROMPDEV;
int keyCode;
-
+
if (!dmxLocal->pDevice->key) {
dmxLog(dmxWarning, "dmxFixup: not a keyboard device (%s)\n",
dmxLocal->pDevice->name);
@@ -636,9 +695,10 @@ static int dmxFixup(DevicePtr pDev, int detail, KeySym keySym)
* FIXME: make the code do what the comment says, or remove this comment.
* If \a block is set to \a DMX_BLOCK, then the SIGIO handler will be
* blocked around calls to dmxeqEnqueue(). */
-
-void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
- XEvent *e, DMXBlockType block)
+
+void
+dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
+ XEvent * e, DMXBlockType block)
{
GETDMXINPUTFROMPDEV;
xEvent xE;
@@ -658,7 +718,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard)
xE.u.u.detail = dmxFixup(pDev, detail, keySym);
- /*ErrorF("KEY %d sym %d\n", detail, (int) keySym);*/
+ /*ErrorF("KEY %d sym %d\n", detail, (int) keySym); */
QueueKeyboardEvents(p, type, detail, NULL);
return;
@@ -673,7 +733,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
case MotionNotify:
valuators[0] = e->xmotion.x;
valuators[1] = e->xmotion.y;
- valuators[2] = e->xmotion.state; /* FIXME: WTF?? */
+ valuators[2] = e->xmotion.state; /* FIXME: WTF?? */
valuator_mask_set_range(&mask, 0, 3, valuators);
QueuePointerEvents(p, type, detail,
POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
@@ -682,7 +742,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
case EnterNotify:
case LeaveNotify:
case KeymapNotify:
- case MappingNotify: /* This is sent because we change the
+ case MappingNotify: /* This is sent because we change the
* modifier map on the backend/console
* input device so that we have complete
* control of the input device LEDs. */
@@ -690,13 +750,14 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
default:
if (type == ProximityIn || type == ProximityOut) {
if (dmxLocal->sendsCore)
- return; /* Not a core event */
+ return; /* Not a core event */
break;
}
if (type >= LASTEvent) {
if (dmxTranslateAndEnqueueExtEvent(dmxLocal, e, block))
dmxLogInput(dmxInput, "Unhandled extension event: %d\n", type);
- } else {
+ }
+ else {
dmxLogInput(dmxInput, "Unhandled event: %d (%s)\n",
type, dmxEventName(type));
}
@@ -711,23 +772,28 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym,
* requested termination of the DMX server, -1 is returned. If the user
* has requested a switch to a VT, then the (1-based) number of that VT
* is returned. */
-int dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym)
+int
+dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym)
{
GETDMXINPUTFROMPDEV;
- int vt = 0;
+ int vt = 0;
unsigned short state = 0;
if (dmxLocal->sendsCore)
- state = XkbStateFieldFromRec(&dmxLocalCoreKeyboard->pDevice->key->xkbInfo->state);
+ state =
+ XkbStateFieldFromRec(&dmxLocalCoreKeyboard->pDevice->key->xkbInfo->
+ state);
else if (dmxLocal->pDevice->key)
state = XkbStateFieldFromRec(&dmxLocal->pDevice->key->xkbInfo->state);
- if (!dmxLocal->sendsCore) return 0; /* Only for core devices */
+ if (!dmxLocal->sendsCore)
+ return 0; /* Only for core devices */
+
+ DMXDBG2("dmxCheckSpecialKeys: keySym=0x%04x state=0x%04x\n", keySym, state);
+
+ if ((state & (ControlMask | Mod1Mask)) != (ControlMask | Mod1Mask))
+ return 0;
- DMXDBG2("dmxCheckSpecialKeys: keySym=0x%04x state=0x%04x\n", keySym,state);
-
- if ((state & (ControlMask|Mod1Mask)) != (ControlMask|Mod1Mask)) return 0;
-
switch (keySym) {
case XK_F1:
case XK_F2:
@@ -747,7 +813,7 @@ int dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym)
vt = keySym - XK_F11 + 11;
break;
- case XK_q: /* To avoid confusion */
+ case XK_q: /* To avoid confusion */
case XK_BackSpace:
case XK_Delete:
case XK_KP_Delete:
diff --git a/xorg-server/hw/dmx/input/dmxinputinit.c b/xorg-server/hw/dmx/input/dmxinputinit.c
index 16ecae38d..b22a41f56 100644
--- a/xorg-server/hw/dmx/input/dmxinputinit.c
+++ b/xorg-server/hw/dmx/input/dmxinputinit.c
@@ -102,7 +102,7 @@ static DMXLocalInputInfoRec DMXBackendMou = {
static DMXLocalInputInfoRec DMXBackendKbd = {
"backend-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_BACKEND,
- 1, /* With backend-mou or console-mou */
+ 1, /* With backend-mou or console-mou */
dmxCommonCopyPrivate, NULL,
dmxBackendInit, NULL, NULL, dmxBackendKbdGetInfo,
dmxCommonKbdOn, dmxCommonKbdOff, NULL,
@@ -123,7 +123,7 @@ static DMXLocalInputInfoRec DMXConsoleMou = {
static DMXLocalInputInfoRec DMXConsoleKbd = {
"console-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_CONSOLE,
- 1, /* With backend-mou or console-mou */
+ 1, /* With backend-mou or console-mou */
dmxCommonCopyPrivate, NULL,
dmxConsoleInit, dmxConsoleReInit, NULL, dmxConsoleKbdGetInfo,
dmxCommonKbdOn, dmxCommonKbdOff, NULL,
@@ -133,87 +133,78 @@ static DMXLocalInputInfoRec DMXConsoleKbd = {
};
static DMXLocalInputInfoRec DMXLocalDevices[] = {
- /* Dummy drivers that can compile on any OS */
+ /* Dummy drivers that can compile on any OS */
#ifdef __linux__
- /* Linux-specific drivers */
+ /* Linux-specific drivers */
{
- "kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1,
- kbdLinuxCreatePrivate, kbdLinuxDestroyPrivate,
- kbdLinuxInit, NULL, NULL, kbdLinuxGetInfo,
- kbdLinuxOn, kbdLinuxOff, NULL,
- kbdLinuxVTPreSwitch, kbdLinuxVTPostSwitch, kbdLinuxVTSwitch,
- kbdLinuxRead, NULL, NULL, NULL,
- NULL, kbdLinuxCtrl, kbdLinuxBell
- },
+ "kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1,
+ kbdLinuxCreatePrivate, kbdLinuxDestroyPrivate,
+ kbdLinuxInit, NULL, NULL, kbdLinuxGetInfo,
+ kbdLinuxOn, kbdLinuxOff, NULL,
+ kbdLinuxVTPreSwitch, kbdLinuxVTPostSwitch, kbdLinuxVTSwitch,
+ kbdLinuxRead, NULL, NULL, NULL,
+ NULL, kbdLinuxCtrl, kbdLinuxBell},
{
- "ms", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
- msLinuxCreatePrivate, msLinuxDestroyPrivate,
- msLinuxInit, NULL, NULL, msLinuxGetInfo,
- msLinuxOn, msLinuxOff, NULL,
- msLinuxVTPreSwitch, msLinuxVTPostSwitch, NULL,
- msLinuxRead
- },
+ "ms", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
+ msLinuxCreatePrivate, msLinuxDestroyPrivate,
+ msLinuxInit, NULL, NULL, msLinuxGetInfo,
+ msLinuxOn, msLinuxOff, NULL,
+ msLinuxVTPreSwitch, msLinuxVTPostSwitch, NULL,
+ msLinuxRead},
{
- "ps2", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
- ps2LinuxCreatePrivate, ps2LinuxDestroyPrivate,
- ps2LinuxInit, NULL, NULL, ps2LinuxGetInfo,
- ps2LinuxOn, ps2LinuxOff, NULL,
- ps2LinuxVTPreSwitch, ps2LinuxVTPostSwitch, NULL,
- ps2LinuxRead
- },
+ "ps2", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
+ ps2LinuxCreatePrivate, ps2LinuxDestroyPrivate,
+ ps2LinuxInit, NULL, NULL, ps2LinuxGetInfo,
+ ps2LinuxOn, ps2LinuxOff, NULL,
+ ps2LinuxVTPreSwitch, ps2LinuxVTPostSwitch, NULL,
+ ps2LinuxRead},
#endif
#ifdef __linux__
- /* USB drivers, currently only for
- Linux, but relatively easy to port to
- other OSs */
+ /* USB drivers, currently only for
+ Linux, but relatively easy to port to
+ other OSs */
{
- "usb-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1,
- usbCreatePrivate, usbDestroyPrivate,
- kbdUSBInit, NULL, NULL, kbdUSBGetInfo,
- kbdUSBOn, usbOff, NULL,
- NULL, NULL, NULL,
- kbdUSBRead, NULL, NULL, NULL,
- NULL, kbdUSBCtrl
- },
+ "usb-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1,
+ usbCreatePrivate, usbDestroyPrivate,
+ kbdUSBInit, NULL, NULL, kbdUSBGetInfo,
+ kbdUSBOn, usbOff, NULL,
+ NULL, NULL, NULL,
+ kbdUSBRead, NULL, NULL, NULL,
+ NULL, kbdUSBCtrl},
{
- "usb-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
- usbCreatePrivate, usbDestroyPrivate,
- mouUSBInit, NULL, NULL, mouUSBGetInfo,
- mouUSBOn, usbOff, NULL,
- NULL, NULL, NULL,
- mouUSBRead
- },
+ "usb-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
+ usbCreatePrivate, usbDestroyPrivate,
+ mouUSBInit, NULL, NULL, mouUSBGetInfo,
+ mouUSBOn, usbOff, NULL,
+ NULL, NULL, NULL,
+ mouUSBRead},
{
- "usb-oth", DMX_LOCAL_OTHER, DMX_LOCAL_TYPE_LOCAL, 1,
- usbCreatePrivate, usbDestroyPrivate,
- othUSBInit, NULL, NULL, othUSBGetInfo,
- othUSBOn, usbOff, NULL,
- NULL, NULL, NULL,
- othUSBRead
- },
+ "usb-oth", DMX_LOCAL_OTHER, DMX_LOCAL_TYPE_LOCAL, 1,
+ usbCreatePrivate, usbDestroyPrivate,
+ othUSBInit, NULL, NULL, othUSBGetInfo,
+ othUSBOn, usbOff, NULL,
+ NULL, NULL, NULL,
+ othUSBRead},
#endif
{
- "dummy-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
- NULL, NULL, NULL, NULL, NULL, dmxDummyMouGetInfo
- },
+ "dummy-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1,
+ NULL, NULL, NULL, NULL, NULL, dmxDummyMouGetInfo},
{
- "dummy-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1,
- NULL, NULL, NULL, NULL, NULL, dmxDummyKbdGetInfo
- },
- { NULL } /* Must be last */
+ "dummy-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1,
+ NULL, NULL, NULL, NULL, NULL, dmxDummyKbdGetInfo},
+ {NULL} /* Must be last */
};
-
#if 11 /*BP*/
-void
+ void
DDXRingBell(int volume, int pitch, int duration)
{
- /* NO-OP */
+ /* NO-OP */
}
/* taken from kdrive/src/kinput.c: */
static void
-dmxKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
+dmxKbdCtrl(DeviceIntPtr pDevice, KeybdCtrl * ctrl)
{
#if 0
KdKeyboardInfo *ki;
@@ -228,7 +219,7 @@ dmxKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl)
KdSetLeds(ki, ctrl->leds);
ki->bellPitch = ctrl->bell_pitch;
- ki->bellDuration = ctrl->bell_duration;
+ ki->bellDuration = ctrl->bell_duration;
#endif
}
@@ -239,7 +230,7 @@ dmxBell(int volume, DeviceIntPtr pDev, pointer arg, int something)
#if 0
KeybdCtrl *ctrl = arg;
KdKeyboardInfo *ki = NULL;
-
+
for (ki = kdKeyboards; ki; ki = ki->next) {
if (ki->dixdev && ki->dixdev->id == pDev->id)
break;
@@ -247,50 +238,56 @@ dmxBell(int volume, DeviceIntPtr pDev, pointer arg, int something)
if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver)
return;
-
+
KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration);
#endif
}
#endif /*BP*/
-
-static void _dmxChangePointerControl(DMXLocalInputInfoPtr dmxLocal,
- PtrCtrl *ctrl)
+ static void
+_dmxChangePointerControl(DMXLocalInputInfoPtr dmxLocal, PtrCtrl * ctrl)
{
- if (!dmxLocal) return;
+ if (!dmxLocal)
+ return;
dmxLocal->mctrl = *ctrl;
- if (dmxLocal->mCtrl) dmxLocal->mCtrl(&dmxLocal->pDevice->public, ctrl);
+ if (dmxLocal->mCtrl)
+ dmxLocal->mCtrl(&dmxLocal->pDevice->public, ctrl);
}
/** Change the pointer control information for the \a pDevice. If the
* device sends core events, then also change the control information
* for all of the pointer devices that send core events. */
-void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl *ctrl)
+void
+dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl * ctrl)
{
GETDMXLOCALFROMPDEVICE;
int i, j;
- if (dmxLocal->sendsCore) { /* Do for all core devices */
+ if (dmxLocal->sendsCore) { /* Do for all core devices */
for (i = 0; i < dmxNumInputs; i++) {
DMXInputInfo *dmxInput = &dmxInputs[i];
- if (dmxInput->detached) continue;
+
+ if (dmxInput->detached)
+ continue;
for (j = 0; j < dmxInput->numDevs; j++)
if (dmxInput->devs[j]->sendsCore)
_dmxChangePointerControl(dmxInput->devs[j], ctrl);
}
- } else { /* Do for this device only */
+ }
+ else { /* Do for this device only */
_dmxChangePointerControl(dmxLocal, ctrl);
}
}
-static void _dmxKeyboardKbdCtrlProc(DMXLocalInputInfoPtr dmxLocal,
- KeybdCtrl *ctrl)
+static void
+_dmxKeyboardKbdCtrlProc(DMXLocalInputInfoPtr dmxLocal, KeybdCtrl * ctrl)
{
dmxLocal->kctrl = *ctrl;
if (dmxLocal->kCtrl) {
dmxLocal->kCtrl(&dmxLocal->pDevice->public, ctrl);
if (dmxLocal->pDevice->kbdfeed) {
XkbEventCauseRec cause;
+
XkbSetCauseUnknown(&cause);
/* Generate XKB events, as necessary */
XkbUpdateIndicators(dmxLocal->pDevice, XkbAllIndicatorsMask, False,
@@ -299,69 +296,84 @@ static void _dmxKeyboardKbdCtrlProc(DMXLocalInputInfoPtr dmxLocal,
}
}
-
/** Change the keyboard control information for the \a pDevice. If the
* device sends core events, then also change the control information
* for all of the keyboard devices that send core events. */
-void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl *ctrl)
+void
+dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl * ctrl)
{
GETDMXLOCALFROMPDEVICE;
int i, j;
- if (dmxLocal->sendsCore) { /* Do for all core devices */
+ if (dmxLocal->sendsCore) { /* Do for all core devices */
for (i = 0; i < dmxNumInputs; i++) {
DMXInputInfo *dmxInput = &dmxInputs[i];
- if (dmxInput->detached) continue;
+
+ if (dmxInput->detached)
+ continue;
for (j = 0; j < dmxInput->numDevs; j++)
if (dmxInput->devs[j]->sendsCore)
_dmxKeyboardKbdCtrlProc(dmxInput->devs[j], ctrl);
}
- } else { /* Do for this device only */
+ }
+ else { /* Do for this device only */
_dmxKeyboardKbdCtrlProc(dmxLocal, ctrl);
}
}
-static void _dmxKeyboardBellProc(DMXLocalInputInfoPtr dmxLocal, int percent)
+static void
+_dmxKeyboardBellProc(DMXLocalInputInfoPtr dmxLocal, int percent)
{
- if (dmxLocal->kBell) dmxLocal->kBell(&dmxLocal->pDevice->public,
- percent,
- dmxLocal->kctrl.bell,
- dmxLocal->kctrl.bell_pitch,
- dmxLocal->kctrl.bell_duration);
+ if (dmxLocal->kBell)
+ dmxLocal->kBell(&dmxLocal->pDevice->public,
+ percent,
+ dmxLocal->kctrl.bell,
+ dmxLocal->kctrl.bell_pitch,
+ dmxLocal->kctrl.bell_duration);
}
/** Sound the bell on the device. If the device send core events, then
* sound the bell on all of the devices that send core events. */
-void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice,
- pointer ctrl, int unknown)
+void
+dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice,
+ pointer ctrl, int unknown)
{
GETDMXLOCALFROMPDEVICE;
int i, j;
- if (dmxLocal->sendsCore) { /* Do for all core devices */
+ if (dmxLocal->sendsCore) { /* Do for all core devices */
for (i = 0; i < dmxNumInputs; i++) {
DMXInputInfo *dmxInput = &dmxInputs[i];
- if (dmxInput->detached) continue;
+
+ if (dmxInput->detached)
+ continue;
for (j = 0; j < dmxInput->numDevs; j++)
if (dmxInput->devs[j]->sendsCore)
_dmxKeyboardBellProc(dmxInput->devs[j], percent);
}
- } else { /* Do for this device only */
+ }
+ else { /* Do for this device only */
_dmxKeyboardBellProc(dmxLocal, percent);
}
}
-static void dmxKeyboardFreeNames(XkbComponentNamesPtr names)
+static void
+dmxKeyboardFreeNames(XkbComponentNamesPtr names)
{
- if (names->keycodes) XFree(names->keycodes);
- if (names->types) XFree(names->types);
- if (names->compat) XFree(names->compat);
- if (names->symbols) XFree(names->symbols);
- if (names->geometry) XFree(names->geometry);
+ if (names->keycodes)
+ XFree(names->keycodes);
+ if (names->types)
+ XFree(names->types);
+ if (names->compat)
+ XFree(names->compat);
+ if (names->symbols)
+ XFree(names->symbols);
+ if (names->geometry)
+ XFree(names->geometry);
}
-
-static int dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo *info)
+static int
+dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo * info)
{
GETDMXINPUTFROMPDEVICE;
XkbRMLVOSet rmlvo;
@@ -374,14 +386,14 @@ static int dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo *info)
XkbSetRulesDflts(&rmlvo);
if (!info->force && (dmxInput->keycodes
- || dmxInput->symbols
- || dmxInput->geometry)) {
- if (info->freenames) dmxKeyboardFreeNames(&info->names);
- info->freenames = 0;
+ || dmxInput->symbols || dmxInput->geometry)) {
+ if (info->freenames)
+ dmxKeyboardFreeNames(&info->names);
+ info->freenames = 0;
info->names.keycodes = dmxInput->keycodes;
- info->names.types = NULL;
- info->names.compat = NULL;
- info->names.symbols = dmxInput->symbols;
+ info->names.types = NULL;
+ info->names.compat = NULL;
+ info->names.symbols = dmxInput->symbols;
info->names.geometry = dmxInput->geometry;
dmxLogInput(dmxInput, "XKEYBOARD: From command line: %s",
@@ -391,7 +403,8 @@ static int dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo *info)
if (info->names.geometry && *info->names.geometry)
dmxLogInputCont(dmxInput, " %s", info->names.geometry);
dmxLogInputCont(dmxInput, "\n");
- } else if (info->names.keycodes) {
+ }
+ else if (info->names.keycodes) {
dmxLogInput(dmxInput, "XKEYBOARD: From device: %s",
info->names.keycodes);
if (info->names.symbols && *info->names.symbols)
@@ -399,36 +412,36 @@ static int dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo *info)
if (info->names.geometry && *info->names.geometry)
dmxLogInputCont(dmxInput, " %s", info->names.geometry);
dmxLogInputCont(dmxInput, "\n");
- } else {
+ }
+ else {
dmxLogInput(dmxInput, "XKEYBOARD: Defaults: %s %s %s %s %s\n",
dmxConfigGetXkbRules(),
dmxConfigGetXkbLayout(),
- dmxConfigGetXkbModel(),
- dmxConfigGetXkbVariant()
- ? dmxConfigGetXkbVariant() : "",
- dmxConfigGetXkbOptions()
+ dmxConfigGetXkbModel(), dmxConfigGetXkbVariant()
+ ? dmxConfigGetXkbVariant() : "", dmxConfigGetXkbOptions()
? dmxConfigGetXkbOptions() : "");
}
InitKeyboardDeviceStruct(pDevice, &rmlvo,
- dmxKeyboardBellProc,
- dmxKeyboardKbdCtrlProc);
+ dmxKeyboardBellProc, dmxKeyboardKbdCtrlProc);
- if (info->freenames) dmxKeyboardFreeNames(&info->names);
+ if (info->freenames)
+ dmxKeyboardFreeNames(&info->names);
return Success;
}
-
-static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
+static int
+dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
{
GETDMXINPUTFROMPDEVICE;
- int fd;
+ int fd;
DMXLocalInitInfo info;
- int i;
- Atom btn_labels[MAX_BUTTONS] = {0}; /* FIXME */
- Atom axis_labels[MAX_VALUATORS] = {0}; /* FIXME */
+ int i;
+ Atom btn_labels[MAX_BUTTONS] = { 0 }; /* FIXME */
+ Atom axis_labels[MAX_VALUATORS] = { 0 }; /* FIXME */
- if (dmxInput->detached) return Success;
+ if (dmxInput->detached)
+ return Success;
memset(&info, 0, sizeof(info));
switch (what) {
@@ -450,9 +463,7 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
rmlvo.variant = dmxConfigGetXkbVariant();
rmlvo.options = dmxConfigGetXkbOptions();
- InitKeyboardDeviceStruct(pDevice,
- &rmlvo,
- dmxBell, dmxKbdCtrl);
+ InitKeyboardDeviceStruct(pDevice, &rmlvo, dmxBell, dmxKbdCtrl);
}
if (info.buttonClass) {
InitButtonClassDeviceStruct(pDevice, info.numButtons,
@@ -462,15 +473,15 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
if (info.numRelAxes && dmxLocal->sendsCore) {
InitValuatorClassDeviceStruct(pDevice, info.numRelAxes,
axis_labels,
- GetMaximumEventsNum(),
- Relative);
+ GetMaximumEventsNum(), Relative);
for (i = 0; i < info.numRelAxes; i++)
InitValuatorAxisStruct(pDevice, i, axis_labels[i],
info.minval[i], info.maxval[i],
info.res[i],
info.minres[i], info.maxres[i],
Relative);
- } else if (info.numRelAxes) {
+ }
+ else if (info.numRelAxes) {
InitValuatorClassDeviceStruct(pDevice, info.numRelAxes,
axis_labels,
dmxPointerGetMotionBufferSize(),
@@ -481,7 +492,8 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
info.maxval[i], info.res[i],
info.minres[i], info.maxres[i],
Relative);
- } else if (info.numAbsAxes) {
+ }
+ else if (info.numAbsAxes) {
InitValuatorClassDeviceStruct(pDevice, info.numAbsAxes,
axis_labels,
dmxPointerGetMotionBufferSize(),
@@ -494,8 +506,10 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
info.maxres[i], Absolute);
}
}
- if (info.focusClass) InitFocusClassDeviceStruct(pDevice);
- if (info.proximityClass) InitProximityClassDeviceStruct(pDevice);
+ if (info.focusClass)
+ InitFocusClassDeviceStruct(pDevice);
+ if (info.proximityClass)
+ InitProximityClassDeviceStruct(pDevice);
if (info.ptrFeedbackClass)
InitPtrFeedbackClassDeviceStruct(pDevice, dmxChangePointerControl);
if (info.intFeedbackClass || info.strFeedbackClass)
@@ -516,12 +530,13 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
break;
case DEVICE_OFF:
case DEVICE_CLOSE:
- /* This can get called twice consecutively: once for a
- * detached screen (DEVICE_OFF), and then again at server
- * generation time (DEVICE_CLOSE). */
+ /* This can get called twice consecutively: once for a
+ * detached screen (DEVICE_OFF), and then again at server
+ * generation time (DEVICE_CLOSE). */
if (pDev->on) {
dmxSigioUnregister(dmxInput);
- if (dmxLocal->off) dmxLocal->off(pDev);
+ if (dmxLocal->off)
+ dmxLocal->off(pDev);
pDev->on = FALSE;
}
break;
@@ -530,17 +545,19 @@ static int dmxDeviceOnOff(DeviceIntPtr pDevice, int what)
XFree(info.keySyms.map);
info.keySyms.map = NULL;
}
- if (info.xkb) XkbFreeKeyboard(info.xkb, 0, True);
+ if (info.xkb)
+ XkbFreeKeyboard(info.xkb, 0, True);
return Success;
}
-static void dmxProcessInputEvents(DMXInputInfo *dmxInput)
+static void
+dmxProcessInputEvents(DMXInputInfo * dmxInput)
{
int i;
mieqProcessInputEvents();
#if 00 /*BP*/
- miPointerUpdate();
+ miPointerUpdate();
#endif
if (dmxInput->detached)
return;
@@ -550,30 +567,44 @@ static void dmxProcessInputEvents(DMXInputInfo *dmxInput)
}
#if 11 /*BP*/
- mieqProcessInputEvents();
+ mieqProcessInputEvents();
#endif
}
-static void dmxUpdateWindowInformation(DMXInputInfo *dmxInput,
- DMXUpdateType type,
- WindowPtr pWindow)
+static void
+dmxUpdateWindowInformation(DMXInputInfo * dmxInput,
+ DMXUpdateType type, WindowPtr pWindow)
{
int i;
#ifdef PANORAMIX
- if (!noPanoramiXExtension && pWindow && pWindow->parent != screenInfo.screens[0]->root)
+ if (!noPanoramiXExtension && pWindow &&
+ pWindow->parent != screenInfo.screens[0]->root)
return;
#endif
#if DMX_WINDOW_DEBUG
{
const char *name = "Unknown";
+
switch (type) {
- case DMX_UPDATE_REALIZE: name = "Realize"; break;
- case DMX_UPDATE_UNREALIZE: name = "Unrealize"; break;
- case DMX_UPDATE_RESTACK: name = "Restack"; break;
- case DMX_UPDATE_COPY: name = "Copy"; break;
- case DMX_UPDATE_RESIZE: name = "Resize"; break;
- case DMX_UPDATE_REPARENT: name = "Repaint"; break;
+ case DMX_UPDATE_REALIZE:
+ name = "Realize";
+ break;
+ case DMX_UPDATE_UNREALIZE:
+ name = "Unrealize";
+ break;
+ case DMX_UPDATE_RESTACK:
+ name = "Restack";
+ break;
+ case DMX_UPDATE_COPY:
+ name = "Copy";
+ break;
+ case DMX_UPDATE_RESIZE:
+ name = "Resize";
+ break;
+ case DMX_UPDATE_REPARENT:
+ name = "Repaint";
+ break;
}
dmxLog(dmxDebug, "Window %p changed: %s\n", pWindow, name);
}
@@ -587,7 +618,8 @@ static void dmxUpdateWindowInformation(DMXInputInfo *dmxInput,
type, pWindow);
}
-static void dmxCollectAll(DMXInputInfo *dmxInput)
+static void
+dmxCollectAll(DMXInputInfo * dmxInput)
{
int i;
@@ -595,29 +627,29 @@ static void dmxCollectAll(DMXInputInfo *dmxInput)
return;
for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding)
if (dmxInput->devs[i]->collect_events)
- dmxInput->devs[i]->collect_events(&dmxInput->devs[i]->pDevice->public,
- dmxMotion,
- dmxEnqueue,
+ dmxInput->devs[i]->collect_events(&dmxInput->devs[i]->pDevice->
+ public, dmxMotion, dmxEnqueue,
dmxCheckSpecialKeys, DMX_BLOCK);
}
-static void dmxBlockHandler(pointer blockData, OSTimePtr pTimeout,
- pointer pReadMask)
+static void
+dmxBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask)
{
- DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t)blockData];
+ DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t) blockData];
static unsigned long generation = 0;
-
+
if (generation != serverGeneration) {
generation = serverGeneration;
dmxCollectAll(dmxInput);
}
}
-static void dmxSwitchReturn(pointer p)
+static void
+dmxSwitchReturn(pointer p)
{
DMXInputInfo *dmxInput = p;
- int i;
-
+ int i;
+
dmxLog(dmxInfo, "Returning from VT %d\n", dmxInput->vt_switched);
if (!dmxInput->vt_switched)
@@ -629,25 +661,25 @@ static void dmxSwitchReturn(pointer p)
dmxInput->vt_switched = 0;
}
-static void dmxWakeupHandler(pointer blockData, int result, pointer pReadMask)
+static void
+dmxWakeupHandler(pointer blockData, int result, pointer pReadMask)
{
- DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t)blockData];
- int i;
+ DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t) blockData];
+ int i;
if (dmxInput->vt_switch_pending) {
dmxLog(dmxInfo, "Switching to VT %d\n", dmxInput->vt_switch_pending);
for (i = 0; i < dmxInput->numDevs; i++)
if (dmxInput->devs[i]->vt_pre_switch)
dmxInput->devs[i]->vt_pre_switch(dmxInput->devs[i]->private);
- dmxInput->vt_switched = dmxInput->vt_switch_pending;
+ dmxInput->vt_switched = dmxInput->vt_switch_pending;
dmxInput->vt_switch_pending = 0;
for (i = 0; i < dmxInput->numDevs; i++) {
if (dmxInput->devs[i]->vt_switch) {
dmxSigioDisableInput();
if (!dmxInput->devs[i]->vt_switch(dmxInput->devs[i]->private,
dmxInput->vt_switched,
- dmxSwitchReturn,
- dmxInput))
+ dmxSwitchReturn, dmxInput))
dmxSwitchReturn(dmxInput);
break; /* Only call one vt_switch routine */
}
@@ -656,35 +688,44 @@ static void dmxWakeupHandler(pointer blockData, int result, pointer pReadMask)
dmxCollectAll(dmxInput);
}
-static char *dmxMakeUniqueDeviceName(DMXLocalInputInfoPtr dmxLocal)
+static char *
+dmxMakeUniqueDeviceName(DMXLocalInputInfoPtr dmxLocal)
{
- static int k = 0;
- static int m = 0;
- static int o = 0;
+ static int k = 0;
+ static int m = 0;
+ static int o = 0;
static unsigned long dmxGeneration = 0;
+
#define LEN 32
- char * buf = malloc(LEN);
+ char *buf = malloc(LEN);
if (dmxGeneration != serverGeneration) {
- k = m = o = 0;
+ k = m = o = 0;
dmxGeneration = serverGeneration;
}
switch (dmxLocal->type) {
- case DMX_LOCAL_KEYBOARD: snprintf(buf, LEN, "Keyboard%d", k++); break;
- case DMX_LOCAL_MOUSE: snprintf(buf, LEN, "Mouse%d", m++); break;
- default: snprintf(buf, LEN, "Other%d", o++); break;
+ case DMX_LOCAL_KEYBOARD:
+ snprintf(buf, LEN, "Keyboard%d", k++);
+ break;
+ case DMX_LOCAL_MOUSE:
+ snprintf(buf, LEN, "Mouse%d", m++);
+ break;
+ default:
+ snprintf(buf, LEN, "Other%d", o++);
+ break;
}
return buf;
}
-static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal)
+static DeviceIntPtr
+dmxAddDevice(DMXLocalInputInfoPtr dmxLocal)
{
DeviceIntPtr pDevice;
- Atom atom;
- const char *name = NULL;
- char *devname;
+ Atom atom;
+ const char *name = NULL;
+ char *devname;
DMXInputInfo *dmxInput;
if (!dmxLocal)
@@ -693,41 +734,41 @@ static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal)
if (dmxLocal->sendsCore) {
if (dmxLocal->type == DMX_LOCAL_KEYBOARD && !dmxLocalCoreKeyboard) {
- dmxLocal->isCore = 1;
+ dmxLocal->isCore = 1;
dmxLocalCoreKeyboard = dmxLocal;
- name = "keyboard";
+ name = "keyboard";
}
if (dmxLocal->type == DMX_LOCAL_MOUSE && !dmxLocalCorePointer) {
- dmxLocal->isCore = 1;
- dmxLocalCorePointer = dmxLocal;
- name = "pointer";
+ dmxLocal->isCore = 1;
+ dmxLocalCorePointer = dmxLocal;
+ name = "pointer";
}
}
if (!name) {
- name = "extension";
+ name = "extension";
}
if (!name)
dmxLog(dmxFatal, "Cannot add device %s\n", dmxLocal->name);
- pDevice = AddInputDevice(serverClient, dmxDeviceOnOff, TRUE);
+ pDevice = AddInputDevice(serverClient, dmxDeviceOnOff, TRUE);
if (!pDevice) {
dmxLog(dmxError, "Too many devices -- cannot add device %s\n",
dmxLocal->name);
return NULL;
}
pDevice->public.devicePrivate = dmxLocal;
- dmxLocal->pDevice = pDevice;
+ dmxLocal->pDevice = pDevice;
- devname = dmxMakeUniqueDeviceName(dmxLocal);
- atom = MakeAtom((char *)devname, strlen(devname), TRUE);
+ devname = dmxMakeUniqueDeviceName(dmxLocal);
+ atom = MakeAtom((char *) devname, strlen(devname), TRUE);
pDevice->type = atom;
pDevice->name = devname;
if (dmxLocal->isCore && dmxLocal->type == DMX_LOCAL_MOUSE) {
-#if 00 /*BP*/
- miRegisterPointerDevice(screenInfo.screens[0], pDevice);
+#if 00 /*BP*/
+ miRegisterPointerDevice(screenInfo.screens[0], pDevice);
#else
/* Nothing? dmxDeviceOnOff() should get called to init, right? */
#endif
@@ -740,60 +781,62 @@ static DeviceIntPtr dmxAddDevice(DMXLocalInputInfoPtr dmxLocal)
dmxLocal->name, name, devname,
dmxLocal->isCore
? " [core]"
- : (dmxLocal->sendsCore
- ? " [sends core events]"
- : ""));
+ : (dmxLocal->sendsCore ? " [sends core events]" : ""));
return pDevice;
}
-static DMXLocalInputInfoPtr dmxLookupLocal(const char *name)
+static DMXLocalInputInfoPtr
+dmxLookupLocal(const char *name)
{
DMXLocalInputInfoPtr pt;
-
+
for (pt = &DMXLocalDevices[0]; pt->name; ++pt)
- if (!strcmp(pt->name, name)) return pt; /* search for device name */
+ if (!strcmp(pt->name, name))
+ return pt; /* search for device name */
return NULL;
}
/** Copy the local input information from \a s into a new \a devs slot
* in \a dmxInput. */
-DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo *dmxInput,
- DMXLocalInputInfoPtr s)
+DMXLocalInputInfoPtr
+dmxInputCopyLocal(DMXInputInfo * dmxInput, DMXLocalInputInfoPtr s)
{
DMXLocalInputInfoPtr dmxLocal = malloc(sizeof(*dmxLocal));
-
+
if (!dmxLocal)
dmxLog(dmxFatal, "DMXLocalInputInfoPtr: out of memory\n");
memcpy(dmxLocal, s, sizeof(*dmxLocal));
- dmxLocal->inputIdx = dmxInput->inputIdx;
- dmxLocal->sendsCore = dmxInput->core;
+ dmxLocal->inputIdx = dmxInput->inputIdx;
+ dmxLocal->sendsCore = dmxInput->core;
dmxLocal->savedSendsCore = dmxInput->core;
- dmxLocal->deviceId = -1;
+ dmxLocal->deviceId = -1;
++dmxInput->numDevs;
dmxInput->devs = realloc(dmxInput->devs,
- dmxInput->numDevs * sizeof(*dmxInput->devs));
- dmxInput->devs[dmxInput->numDevs-1] = dmxLocal;
-
+ dmxInput->numDevs * sizeof(*dmxInput->devs));
+ dmxInput->devs[dmxInput->numDevs - 1] = dmxLocal;
+
return dmxLocal;
}
-static void dmxPopulateLocal(DMXInputInfo *dmxInput, dmxArg a)
+static void
+dmxPopulateLocal(DMXInputInfo * dmxInput, dmxArg a)
{
- int i;
- int help = 0;
+ int i;
+ int help = 0;
DMXLocalInputInfoRec *pt;
for (i = 1; i < dmxArgC(a); i++) {
const char *name = dmxArgV(a, i);
+
if ((pt = dmxLookupLocal(name))) {
dmxInputCopyLocal(dmxInput, pt);
- } else {
+ }
+ else {
if (strlen(name))
- dmxLog(dmxWarning,
- "Could not find a driver called %s\n", name);
+ dmxLog(dmxWarning, "Could not find a driver called %s\n", name);
++help;
}
}
@@ -801,10 +844,17 @@ static void dmxPopulateLocal(DMXInputInfo *dmxInput, dmxArg a)
dmxLog(dmxInfo, "Available local device drivers:\n");
for (pt = &DMXLocalDevices[0]; pt->name; ++pt) {
const char *type;
+
switch (pt->type) {
- case DMX_LOCAL_KEYBOARD: type = "keyboard"; break;
- case DMX_LOCAL_MOUSE: type = "pointer"; break;
- default: type = "unknown"; break;
+ case DMX_LOCAL_KEYBOARD:
+ type = "keyboard";
+ break;
+ case DMX_LOCAL_MOUSE:
+ type = "pointer";
+ break;
+ default:
+ type = "unknown";
+ break;
}
dmxLog(dmxInfo, " %s (%s)\n", pt->name, type);
}
@@ -812,30 +862,35 @@ static void dmxPopulateLocal(DMXInputInfo *dmxInput, dmxArg a)
}
}
-int dmxInputExtensionErrorHandler(Display *dsp, _Xconst char *name, _Xconst char *reason)
+int
+dmxInputExtensionErrorHandler(Display * dsp, _Xconst char *name,
+ _Xconst char *reason)
{
return 0;
}
-static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
+static void
+dmxInputScanForExtensions(DMXInputInfo * dmxInput, int doXI)
{
- XExtensionVersion *ext;
- XDeviceInfo *devices;
- Display *display;
- int num;
- int i, j;
- XextErrorHandler handler;
-
- if (!(display = XOpenDisplay(dmxInput->name))) return;
-
+ XExtensionVersion *ext;
+ XDeviceInfo *devices;
+ Display *display;
+ int num;
+ int i, j;
+ XextErrorHandler handler;
+
+ if (!(display = XOpenDisplay(dmxInput->name)))
+ return;
+
/* Print out information about the XInput Extension. */
handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler);
- ext = XGetExtensionVersion(display, INAME);
+ ext = XGetExtensionVersion(display, INAME);
XSetExtensionErrorHandler(handler);
-
- if (!ext || ext == (XExtensionVersion *)NoSuchExtension) {
+
+ if (!ext || ext == (XExtensionVersion *) NoSuchExtension) {
dmxLogInput(dmxInput, "%s is not available\n", INAME);
- } else {
+ }
+ else {
dmxLogInput(dmxInput, "Locating devices on %s (%s version %d.%d)\n",
dmxInput->name, INAME,
ext->major_version, ext->minor_version);
@@ -844,31 +899,41 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
XFree(ext);
ext = NULL;
- /* Print a list of all devices */
+ /* Print a list of all devices */
for (i = 0; i < num; i++) {
const char *use = "Unknown";
+
switch (devices[i].use) {
- case IsXPointer: use = "XPointer"; break;
- case IsXKeyboard: use = "XKeyboard"; break;
- case IsXExtensionDevice: use = "XExtensionDevice"; break;
- case IsXExtensionPointer: use = "XExtensionPointer"; break;
- case IsXExtensionKeyboard: use = "XExtensionKeyboard"; break;
+ case IsXPointer:
+ use = "XPointer";
+ break;
+ case IsXKeyboard:
+ use = "XKeyboard";
+ break;
+ case IsXExtensionDevice:
+ use = "XExtensionDevice";
+ break;
+ case IsXExtensionPointer:
+ use = "XExtensionPointer";
+ break;
+ case IsXExtensionKeyboard:
+ use = "XExtensionKeyboard";
+ break;
}
dmxLogInput(dmxInput, " %2d %-10.10s %-16.16s\n",
devices[i].id,
- devices[i].name ? devices[i].name : "",
- use);
+ devices[i].name ? devices[i].name : "", use);
}
- /* Search for extensions */
+ /* Search for extensions */
for (i = 0; i < num; i++) {
switch (devices[i].use) {
case IsXKeyboard:
for (j = 0; j < dmxInput->numDevs; j++) {
DMXLocalInputInfoPtr dmxL = dmxInput->devs[j];
- if (dmxL->type == DMX_LOCAL_KEYBOARD
- && dmxL->deviceId < 0) {
- dmxL->deviceId = devices[i].id;
+
+ if (dmxL->type == DMX_LOCAL_KEYBOARD && dmxL->deviceId < 0) {
+ dmxL->deviceId = devices[i].id;
dmxL->deviceName = (devices[i].name
? strdup(devices[i].name)
: NULL);
@@ -878,8 +943,9 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
case IsXPointer:
for (j = 0; j < dmxInput->numDevs; j++) {
DMXLocalInputInfoPtr dmxL = dmxInput->devs[j];
+
if (dmxL->type == DMX_LOCAL_MOUSE && dmxL->deviceId < 0) {
- dmxL->deviceId = devices[i].id;
+ dmxL->deviceId = devices[i].id;
dmxL->deviceName = (devices[i].name
? xstrdup(devices[i].name)
: NULL);
@@ -895,12 +961,14 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI)
/** Re-initialize all the devices described in \a dmxInput. Called from
#dmxAdjustCursorBoundaries before the cursor is redisplayed. */
-void dmxInputReInit(DMXInputInfo *dmxInput)
+void
+dmxInputReInit(DMXInputInfo * dmxInput)
{
int i;
for (i = 0; i < dmxInput->numDevs; i++) {
DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+
if (dmxLocal->reinit)
dmxLocal->reinit(&dmxLocal->pDevice->public);
}
@@ -908,28 +976,31 @@ void dmxInputReInit(DMXInputInfo *dmxInput)
/** Re-initialize all the devices described in \a dmxInput. Called from
#dmxAdjustCursorBoundaries after the cursor is redisplayed. */
-void dmxInputLateReInit(DMXInputInfo *dmxInput)
+void
+dmxInputLateReInit(DMXInputInfo * dmxInput)
{
int i;
for (i = 0; i < dmxInput->numDevs; i++) {
DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+
if (dmxLocal->latereinit)
dmxLocal->latereinit(&dmxLocal->pDevice->public);
}
}
/** Initialize all of the devices described in \a dmxInput. */
-void dmxInputInit(DMXInputInfo *dmxInput)
+void
+dmxInputInit(DMXInputInfo * dmxInput)
{
- DeviceIntPtr pPointer = NULL, pKeyboard = NULL;
- dmxArg a;
- const char *name;
- int i;
- int doXI = 1; /* Include by default */
- int forceConsole = 0;
- int doWindows = 1; /* On by default */
- int hasXkb = 0;
+ DeviceIntPtr pPointer = NULL, pKeyboard = NULL;
+ dmxArg a;
+ const char *name;
+ int i;
+ int doXI = 1; /* Include by default */
+ int forceConsole = 0;
+ int doWindows = 1; /* On by default */
+ int hasXkb = 0;
a = dmxArgParse(dmxInput->name);
@@ -940,7 +1011,7 @@ void dmxInputInit(DMXInputInfo *dmxInput)
++hasXkb;
break;
case 2:
- dmxInput->symbols = xstrdup(dmxArgV(a, i));
+ dmxInput->symbols = xstrdup(dmxArgV(a, i));
++hasXkb;
break;
case 3:
@@ -948,16 +1019,22 @@ void dmxInputInit(DMXInputInfo *dmxInput)
hasXkb = 0;
break;
case 0:
- if (!strcmp(dmxArgV(a, i), "noxi")) doXI = 0;
- else if (!strcmp(dmxArgV(a, i), "xi")) doXI = 1;
- else if (!strcmp(dmxArgV(a, i), "console")) forceConsole = 1;
- else if (!strcmp(dmxArgV(a, i), "noconsole")) forceConsole = 0;
- else if (!strcmp(dmxArgV(a, i), "windows")) doWindows = 1;
- else if (!strcmp(dmxArgV(a, i), "nowindows")) doWindows = 0;
- else if (!strcmp(dmxArgV(a, i), "xkb")) hasXkb = 1;
+ if (!strcmp(dmxArgV(a, i), "noxi"))
+ doXI = 0;
+ else if (!strcmp(dmxArgV(a, i), "xi"))
+ doXI = 1;
+ else if (!strcmp(dmxArgV(a, i), "console"))
+ forceConsole = 1;
+ else if (!strcmp(dmxArgV(a, i), "noconsole"))
+ forceConsole = 0;
+ else if (!strcmp(dmxArgV(a, i), "windows"))
+ doWindows = 1;
+ else if (!strcmp(dmxArgV(a, i), "nowindows"))
+ doWindows = 0;
+ else if (!strcmp(dmxArgV(a, i), "xkb"))
+ hasXkb = 1;
else {
- dmxLog(dmxFatal,
- "Unknown input argument: %s\n", dmxArgV(a, i));
+ dmxLog(dmxFatal, "Unknown input argument: %s\n", dmxArgV(a, i));
}
}
}
@@ -966,11 +1043,13 @@ void dmxInputInit(DMXInputInfo *dmxInput)
if (!strcmp(name, "local")) {
dmxPopulateLocal(dmxInput, a);
- } else if (!strcmp(name, "dummy")) {
+ }
+ else if (!strcmp(name, "dummy")) {
dmxInputCopyLocal(dmxInput, &DMXDummyMou);
dmxInputCopyLocal(dmxInput, &DMXDummyKbd);
dmxLogInput(dmxInput, "Using dummy input\n");
- } else {
+ }
+ else {
int found;
for (found = 0, i = 0; i < dmxNumScreens; i++) {
@@ -983,10 +1062,13 @@ void dmxInputInit(DMXInputInfo *dmxInput)
dmxLog(dmxWarning,
"Cannot use core devices on a backend (%s)"
" as XInput devices\n", name);
- } else {
+ }
+ else {
char *pt;
- for (pt = (char *)dmxInput->name; pt && *pt; pt++)
- if (*pt == ',') *pt = '\0';
+
+ for (pt = (char *) dmxInput->name; pt && *pt; pt++)
+ if (*pt == ',')
+ *pt = '\0';
dmxInputCopyLocal(dmxInput, &DMXBackendMou);
dmxInputCopyLocal(dmxInput, &DMXBackendKbd);
dmxInput->scrnIdx = i;
@@ -999,13 +1081,16 @@ void dmxInputInit(DMXInputInfo *dmxInput)
}
if (!found || forceConsole) {
char *pt;
- if (found) dmxInput->console = TRUE;
- for (pt = (char *)dmxInput->name; pt && *pt; pt++)
- if (*pt == ',') *pt = '\0';
+
+ if (found)
+ dmxInput->console = TRUE;
+ for (pt = (char *) dmxInput->name; pt && *pt; pt++)
+ if (*pt == ',')
+ *pt = '\0';
dmxInputCopyLocal(dmxInput, &DMXConsoleMou);
dmxInputCopyLocal(dmxInput, &DMXConsoleKbd);
if (doWindows) {
- dmxInput->windows = TRUE;
+ dmxInput->windows = TRUE;
dmxInput->updateWindowInfo = dmxUpdateWindowInformation;
}
dmxLogInput(dmxInput,
@@ -1016,50 +1101,56 @@ void dmxInputInit(DMXInputInfo *dmxInput)
dmxArgFree(a);
- /* Locate extensions we may be interested in */
+ /* Locate extensions we may be interested in */
dmxInputScanForExtensions(dmxInput, doXI);
-
+
for (i = 0; i < dmxInput->numDevs; i++) {
DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+
dmxLocal->pDevice = dmxAddDevice(dmxLocal);
if (dmxLocal->isCore) {
if (dmxLocal->type == DMX_LOCAL_MOUSE)
- pPointer = dmxLocal->pDevice;
+ pPointer = dmxLocal->pDevice;
if (dmxLocal->type == DMX_LOCAL_KEYBOARD)
pKeyboard = dmxLocal->pDevice;
}
}
-
- dmxInput->processInputEvents = dmxProcessInputEvents;
- dmxInput->detached = False;
-
+
+ dmxInput->processInputEvents = dmxProcessInputEvents;
+ dmxInput->detached = False;
+
RegisterBlockAndWakeupHandlers(dmxBlockHandler, dmxWakeupHandler,
- (void *)(uintptr_t)dmxInput->inputIdx);
+ (void *) (uintptr_t) dmxInput->inputIdx);
}
-static void dmxInputFreeLocal(DMXLocalInputInfoRec *local)
+static void
+dmxInputFreeLocal(DMXLocalInputInfoRec * local)
{
- if (!local) return;
+ if (!local)
+ return;
if (local->isCore && local->type == DMX_LOCAL_MOUSE)
- dmxLocalCorePointer = NULL;
+ dmxLocalCorePointer = NULL;
if (local->isCore && local->type == DMX_LOCAL_KEYBOARD)
dmxLocalCoreKeyboard = NULL;
- if (local->destroy_private) local->destroy_private(local->private);
+ if (local->destroy_private)
+ local->destroy_private(local->private);
free(local->history);
free(local->valuators);
free(local->deviceName);
- local->private = NULL;
- local->history = NULL;
+ local->private = NULL;
+ local->history = NULL;
local->deviceName = NULL;
free(local);
}
/** Free all of the memory associated with \a dmxInput */
-void dmxInputFree(DMXInputInfo *dmxInput)
+void
+dmxInputFree(DMXInputInfo * dmxInput)
{
int i;
-
- if (!dmxInput) return;
+
+ if (!dmxInput)
+ return;
free(dmxInput->keycodes);
free(dmxInput->symbols);
@@ -1070,14 +1161,16 @@ void dmxInputFree(DMXInputInfo *dmxInput)
dmxInput->devs[i] = NULL;
}
free(dmxInput->devs);
- dmxInput->devs = NULL;
+ dmxInput->devs = NULL;
dmxInput->numDevs = 0;
- if (dmxInput->freename) free(dmxInput->name);
- dmxInput->name = NULL;
+ if (dmxInput->freename)
+ free(dmxInput->name);
+ dmxInput->name = NULL;
}
/** Log information about all of the known devices using #dmxLog(). */
-void dmxInputLogDevices(void)
+void
+dmxInputLogDevices(void)
{
int i, j;
@@ -1085,34 +1178,43 @@ void dmxInputLogDevices(void)
dmxLog(dmxInfo, " Id Name Classes\n");
for (j = 0; j < dmxNumInputs; j++) {
DMXInputInfo *dmxInput = &dmxInputs[j];
- const char *pt = strchr(dmxInput->name, ',');
- int len = (pt
- ? (size_t)(pt-dmxInput->name)
- : strlen(dmxInput->name));
+ const char *pt = strchr(dmxInput->name, ',');
+ int len = (pt ? (size_t) (pt - dmxInput->name)
+ : strlen(dmxInput->name));
for (i = 0; i < dmxInput->numDevs; i++) {
DeviceIntPtr pDevice = dmxInput->devs[i]->pDevice;
+
if (pDevice) {
dmxLog(dmxInfo, " %2d%c %-20.20s",
pDevice->id,
- dmxInput->detached ? 'D' : ' ',
- pDevice->name);
- if (pDevice->key) dmxLogCont(dmxInfo, " key");
- if (pDevice->valuator) dmxLogCont(dmxInfo, " val");
- if (pDevice->button) dmxLogCont(dmxInfo, " btn");
- if (pDevice->focus) dmxLogCont(dmxInfo, " foc");
- if (pDevice->kbdfeed) dmxLogCont(dmxInfo, " fb/kbd");
- if (pDevice->ptrfeed) dmxLogCont(dmxInfo, " fb/ptr");
- if (pDevice->intfeed) dmxLogCont(dmxInfo, " fb/int");
- if (pDevice->stringfeed) dmxLogCont(dmxInfo, " fb/str");
- if (pDevice->bell) dmxLogCont(dmxInfo, " fb/bel");
- if (pDevice->leds) dmxLogCont(dmxInfo, " fb/led");
+ dmxInput->detached ? 'D' : ' ', pDevice->name);
+ if (pDevice->key)
+ dmxLogCont(dmxInfo, " key");
+ if (pDevice->valuator)
+ dmxLogCont(dmxInfo, " val");
+ if (pDevice->button)
+ dmxLogCont(dmxInfo, " btn");
+ if (pDevice->focus)
+ dmxLogCont(dmxInfo, " foc");
+ if (pDevice->kbdfeed)
+ dmxLogCont(dmxInfo, " fb/kbd");
+ if (pDevice->ptrfeed)
+ dmxLogCont(dmxInfo, " fb/ptr");
+ if (pDevice->intfeed)
+ dmxLogCont(dmxInfo, " fb/int");
+ if (pDevice->stringfeed)
+ dmxLogCont(dmxInfo, " fb/str");
+ if (pDevice->bell)
+ dmxLogCont(dmxInfo, " fb/bel");
+ if (pDevice->leds)
+ dmxLogCont(dmxInfo, " fb/led");
if (!pDevice->key && !pDevice->valuator && !pDevice->button
&& !pDevice->focus && !pDevice->kbdfeed
&& !pDevice->ptrfeed && !pDevice->intfeed
- && !pDevice->stringfeed && !pDevice->bell
- && !pDevice->leds) dmxLogCont(dmxInfo, " (none)");
-
+ && !pDevice->stringfeed && !pDevice->bell && !pDevice->leds)
+ dmxLogCont(dmxInfo, " (none)");
+
dmxLogCont(dmxInfo, "\t[i%d/%*.*s",
dmxInput->inputIdx, len, len, dmxInput->name);
if (dmxInput->devs[i]->deviceId >= 0)
@@ -1123,30 +1225,30 @@ void dmxInputLogDevices(void)
dmxInput->devs[i]->isCore
? "core"
: (dmxInput->devs[i]->sendsCore
- ? "extension (sends core events)"
- : "extension"));
+ ? "extension (sends core events)" : "extension"));
}
}
}
}
/** Detach an input */
-int dmxInputDetach(DMXInputInfo *dmxInput)
+int
+dmxInputDetach(DMXInputInfo * dmxInput)
{
int i;
- if (dmxInput->detached) return BadAccess;
-
+ if (dmxInput->detached)
+ return BadAccess;
+
for (i = 0; i < dmxInput->numDevs; i++) {
DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
+
dmxLogInput(dmxInput, "Detaching device id %d: %s%s\n",
dmxLocal->pDevice->id,
dmxLocal->pDevice->name,
dmxLocal->isCore
? " [core]"
- : (dmxLocal->sendsCore
- ? " [sends core events]"
- : ""));
+ : (dmxLocal->sendsCore ? " [sends core events]" : ""));
DisableDevice(dmxLocal->pDevice, TRUE);
}
dmxInput->detached = True;
@@ -1155,116 +1257,133 @@ int dmxInputDetach(DMXInputInfo *dmxInput)
}
/** Search for input associated with \a dmxScreen, and detach. */
-void dmxInputDetachAll(DMXScreenInfo *dmxScreen)
+void
+dmxInputDetachAll(DMXScreenInfo * dmxScreen)
{
int i;
for (i = 0; i < dmxNumInputs; i++) {
DMXInputInfo *dmxInput = &dmxInputs[i];
- if (dmxInput->scrnIdx == dmxScreen->index) dmxInputDetach(dmxInput);
+
+ if (dmxInput->scrnIdx == dmxScreen->index)
+ dmxInputDetach(dmxInput);
}
}
/** Search for input associated with \a deviceId, and detach. */
-int dmxInputDetachId(int id)
+int
+dmxInputDetachId(int id)
{
DMXInputInfo *dmxInput = dmxInputLocateId(id);
- if (!dmxInput) return BadValue;
-
+ if (!dmxInput)
+ return BadValue;
+
return dmxInputDetach(dmxInput);
}
-DMXInputInfo *dmxInputLocateId(int id)
+DMXInputInfo *
+dmxInputLocateId(int id)
{
int i, j;
-
+
for (i = 0; i < dmxNumInputs; i++) {
DMXInputInfo *dmxInput = &dmxInputs[i];
+
for (j = 0; j < dmxInput->numDevs; j++) {
DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j];
- if (dmxLocal->pDevice->id == id) return dmxInput;
+
+ if (dmxLocal->pDevice->id == id)
+ return dmxInput;
}
}
return NULL;
}
-static int dmxInputAttachNew(DMXInputInfo *dmxInput, int *id)
+static int
+dmxInputAttachNew(DMXInputInfo * dmxInput, int *id)
{
dmxInputInit(dmxInput);
InitAndStartDevices();
- if (id && dmxInput->devs) *id = dmxInput->devs[0]->pDevice->id;
+ if (id && dmxInput->devs)
+ *id = dmxInput->devs[0]->pDevice->id;
dmxInputLogDevices();
return 0;
}
-static int dmxInputAttachOld(DMXInputInfo *dmxInput, int *id)
+static int
+dmxInputAttachOld(DMXInputInfo * dmxInput, int *id)
{
int i;
-
+
dmxInput->detached = False;
for (i = 0; i < dmxInput->numDevs; i++) {
DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i];
- if (id) *id = dmxLocal->pDevice->id;
+
+ if (id)
+ *id = dmxLocal->pDevice->id;
dmxLogInput(dmxInput,
"Attaching device id %d: %s%s\n",
dmxLocal->pDevice->id,
dmxLocal->pDevice->name,
dmxLocal->isCore
? " [core]"
- : (dmxLocal->sendsCore
- ? " [sends core events]"
- : ""));
+ : (dmxLocal->sendsCore ? " [sends core events]" : ""));
EnableDevice(dmxLocal->pDevice, TRUE);
}
dmxInputLogDevices();
return 0;
}
-int dmxInputAttachConsole(const char *name, int isCore, int *id)
+int
+dmxInputAttachConsole(const char *name, int isCore, int *id)
{
- DMXInputInfo *dmxInput;
- int i;
+ DMXInputInfo *dmxInput;
+ int i;
for (i = 0; i < dmxNumInputs; i++) {
dmxInput = &dmxInputs[i];
if (dmxInput->scrnIdx == -1
- && dmxInput->detached
- && !strcmp(dmxInput->name, name)) {
- /* Found match */
+ && dmxInput->detached && !strcmp(dmxInput->name, name)) {
+ /* Found match */
dmxLogInput(dmxInput, "Reattaching detached console input\n");
return dmxInputAttachOld(dmxInput, id);
}
}
- /* No match found */
+ /* No match found */
dmxInput = dmxConfigAddInput(xstrdup(name), isCore);
dmxInput->freename = TRUE;
dmxLogInput(dmxInput, "Attaching new console input\n");
return dmxInputAttachNew(dmxInput, id);
}
-int dmxInputAttachBackend(int physicalScreen, int isCore, int *id)
+int
+dmxInputAttachBackend(int physicalScreen, int isCore, int *id)
{
- DMXInputInfo *dmxInput;
+ DMXInputInfo *dmxInput;
DMXScreenInfo *dmxScreen;
- int i;
-
- if (physicalScreen < 0 || physicalScreen >= dmxNumScreens) return BadValue;
+ int i;
+
+ if (physicalScreen < 0 || physicalScreen >= dmxNumScreens)
+ return BadValue;
for (i = 0; i < dmxNumInputs; i++) {
dmxInput = &dmxInputs[i];
if (dmxInput->scrnIdx != -1 && dmxInput->scrnIdx == physicalScreen) {
- /* Found match */
- if (!dmxInput->detached) return BadAccess; /* Already attached */
+ /* Found match */
+ if (!dmxInput->detached)
+ return BadAccess; /* Already attached */
dmxScreen = &dmxScreens[physicalScreen];
- if (!dmxScreen->beDisplay) return BadAccess; /* Screen detached */
+ if (!dmxScreen->beDisplay)
+ return BadAccess; /* Screen detached */
dmxLogInput(dmxInput, "Reattaching detached backend input\n");
return dmxInputAttachOld(dmxInput, id);
}
}
- /* No match found */
+ /* No match found */
dmxScreen = &dmxScreens[physicalScreen];
- if (!dmxScreen->beDisplay) return BadAccess; /* Screen detached */
+ if (!dmxScreen->beDisplay)
+ return BadAccess; /* Screen detached */
dmxInput = dmxConfigAddInput(dmxScreen->name, isCore);
dmxLogInput(dmxInput, "Attaching new backend input\n");
return dmxInputAttachNew(dmxInput, id);
diff --git a/xorg-server/hw/dmx/input/dmxinputinit.h b/xorg-server/hw/dmx/input/dmxinputinit.h
index d23ad7a38..94ec1019b 100644
--- a/xorg-server/hw/dmx/input/dmxinputinit.h
+++ b/xorg-server/hw/dmx/input/dmxinputinit.h
@@ -1,291 +1,284 @@
-/*
- * Copyright 2002 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- * Interface for low-level input support. \see dmxinputinit.c */
-
-#ifndef _DMXINPUTINIT_H_
-#define _DMXINPUTINIT_H_
-
-#include "dmx.h"
-#include "dmxinput.h"
-#include "dmxlog.h"
-
-
-#define DMX_LOCAL_DEFAULT_KEYBOARD "kbd"
-#define DMX_LOCAL_DEFAULT_POINTER "ps2"
-#define DMX_MAX_BUTTONS 256
-#define DMX_MOTION_SIZE 256
-#define DMX_MAX_VALUATORS 32
-#define DMX_MAX_AXES 32
-#define DMX_MAX_XINPUT_EVENT_TYPES 100
-#define DMX_MAP_ENTRIES 16 /* Must be a power of 2 */
-#define DMX_MAP_MASK (DMX_MAP_ENTRIES - 1)
-
-typedef enum {
- DMX_FUNCTION_GRAB,
- DMX_FUNCTION_TERMINATE,
- DMX_FUNCTION_FINE
-} DMXFunctionType;
-
-typedef enum {
- DMX_LOCAL_HIGHLEVEL,
- DMX_LOCAL_KEYBOARD,
- DMX_LOCAL_MOUSE,
- DMX_LOCAL_OTHER
-} DMXLocalInputType;
-
-typedef enum {
- DMX_LOCAL_TYPE_LOCAL,
- DMX_LOCAL_TYPE_CONSOLE,
- DMX_LOCAL_TYPE_BACKEND,
- DMX_LOCAL_TYPE_COMMON
-} DMXLocalInputExtType;
-
-typedef enum {
- DMX_RELATIVE,
- DMX_ABSOLUTE,
- DMX_ABSOLUTE_CONFINED
-} DMXMotionType;
-
-/** Stores information from low-level device that is used to initialize
- * the device at the dix level. */
-typedef struct _DMXLocalInitInfo {
- int keyboard; /**< Non-zero if the device is a keyboard */
-
- int keyClass; /**< Non-zero if keys are present */
- KeySymsRec keySyms; /**< Key symbols */
- int freemap; /**< If non-zero, free keySyms.map */
- CARD8 modMap[MAP_LENGTH]; /**< Modifier map */
- XkbDescPtr xkb; /**< XKB description */
- XkbComponentNamesRec names; /**< XKB component names */
- int freenames; /**< Non-zero if names should be free'd */
- int force; /**< Do not allow command line override */
-
- int buttonClass; /**< Non-zero if buttons are present */
- int numButtons; /**< Number of buttons */
- unsigned char map[DMX_MAX_BUTTONS]; /**< Button map */
-
- int valuatorClass; /**< Non-zero if valuators are
- * present */
- int numRelAxes; /**< Number of relative axes */
- int numAbsAxes; /**< Number of absolute axes */
- int minval[DMX_MAX_AXES]; /**< Minimum values */
- int maxval[DMX_MAX_AXES]; /**< Maximum values */
- int res[DMX_MAX_AXES]; /**< Resolution */
- int minres[DMX_MAX_AXES]; /**< Minimum resolutions */
- int maxres[DMX_MAX_AXES]; /**< Maximum resolutions */
-
- int focusClass; /**< Non-zero if device can
- * cause focus */
- int proximityClass; /**< Non-zero if device
- * causes proximity events */
- int kbdFeedbackClass; /**< Non-zero if device has
- * keyboard feedback */
- int ptrFeedbackClass; /**< Non-zero if device has
- * pointer feedback */
- int ledFeedbackClass; /**< Non-zero if device has
- * LED indicators */
- int belFeedbackClass; /**< Non-zero if device has a
- * bell */
- int intFeedbackClass; /**< Non-zero if device has
- * integer feedback */
- int strFeedbackClass; /**< Non-zero if device has
- * string feedback */
-
- int maxSymbols; /**< Maximum symbols */
- int maxSymbolsSupported; /**< Maximum symbols supported */
- KeySym *symbols; /**< Key symbols */
-} DMXLocalInitInfo, *DMXLocalInitInfoPtr;
-
-typedef pointer (*dmxCreatePrivateProcPtr)(DeviceIntPtr);
-typedef void (*dmxDestroyPrivateProcPtr)(pointer);
-
-typedef void (*dmxInitProcPtr)(DevicePtr);
-typedef void (*dmxReInitProcPtr)(DevicePtr);
-typedef void (*dmxLateReInitProcPtr)(DevicePtr);
-typedef void (*dmxGetInfoProcPtr)(DevicePtr, DMXLocalInitInfoPtr);
-typedef int (*dmxOnProcPtr)(DevicePtr);
-typedef void (*dmxOffProcPtr)(DevicePtr);
-typedef void (*dmxUpdatePositionProcPtr)(pointer, int x, int y);
-
-typedef void (*dmxVTPreSwitchProcPtr)(pointer); /* Turn I/O Off */
-typedef void (*dmxVTPostSwitchProcPtr)(pointer); /* Turn I/O On */
-typedef void (*dmxVTSwitchReturnProcPtr)(pointer);
-typedef int (*dmxVTSwitchProcPtr)(pointer, int vt,
- dmxVTSwitchReturnProcPtr, pointer);
-
-typedef void (*dmxMotionProcPtr)(DevicePtr,
- int *valuators,
- int firstAxis,
- int axesCount,
- DMXMotionType type,
- DMXBlockType block);
-typedef void (*dmxEnqueueProcPtr)(DevicePtr, int type, int detail,
- KeySym keySym, XEvent *e,
- DMXBlockType block);
-typedef int (*dmxCheckSpecialProcPtr)(DevicePtr, KeySym keySym);
-typedef void (*dmxCollectEventsProcPtr)(DevicePtr,
- dmxMotionProcPtr,
- dmxEnqueueProcPtr,
- dmxCheckSpecialProcPtr,
- DMXBlockType);
-typedef void (*dmxProcessInputProcPtr)(pointer);
-typedef void (*dmxUpdateInfoProcPtr)(pointer, DMXUpdateType, WindowPtr);
-typedef int (*dmxFunctionsProcPtr)(pointer, DMXFunctionType);
-
-typedef void (*dmxKBCtrlProcPtr)(DevicePtr, KeybdCtrl *ctrl);
-typedef void (*dmxMCtrlProcPtr)(DevicePtr, PtrCtrl *ctrl);
-typedef void (*dmxKBBellProcPtr)(DevicePtr, int percent,
- int volume, int pitch, int duration);
-
-/** Stores a mapping between the device id on the remote X server and
- * the id on the DMX server */
-typedef struct _DMXEventMap {
- int remote; /**< Event number on remote X server */
- int server; /**< Event number (unbiased) on DMX server */
-} DMXEventMap;
-
-/** This is the device-independent structure used by the low-level input
- * routines. The contents are not exposed to top-level .c files (except
- * dmxextensions.c). \see dmxinput.h \see dmxextensions.c */
-typedef struct _DMXLocalInputInfo {
- const char *name; /**< Device name */
- DMXLocalInputType type; /**< Device type */
- DMXLocalInputExtType extType; /**< Extended device type */
- int binding; /**< Count of how many consecutive
- * structs are bound to the same
- * device */
-
- /* Low-level (e.g., keyboard/mouse drivers) */
-
- dmxCreatePrivateProcPtr create_private; /**< Create
- * device-dependent
- * private */
- dmxDestroyPrivateProcPtr destroy_private; /**< Destroy
- * device-dependent
- * private */
- dmxInitProcPtr init; /**< Initialize device */
- dmxReInitProcPtr reinit; /**< Reinitialize device
- * (during a
- * reconfiguration) */
- dmxLateReInitProcPtr latereinit; /**< Reinitialize a device
- * (called very late
- * during a
- * reconfiguration) */
- dmxGetInfoProcPtr get_info; /**< Get device information */
- dmxOnProcPtr on; /**< Turn device on */
- dmxOffProcPtr off; /**< Turn device off */
- dmxUpdatePositionProcPtr update_position; /**< Called when another
- * device updates the
- * cursor position */
- dmxVTPreSwitchProcPtr vt_pre_switch; /**< Called before a VT switch */
- dmxVTPostSwitchProcPtr vt_post_switch; /**< Called after a VT switch */
- dmxVTSwitchProcPtr vt_switch; /**< Causes a VT switch */
-
- dmxCollectEventsProcPtr collect_events; /**< Collect and enqueue
- * events from the
- * device*/
- dmxProcessInputProcPtr process_input; /**< Process event (from
- * queue) */
- dmxFunctionsProcPtr functions;
- dmxUpdateInfoProcPtr update_info; /**< Update window layout
- * information */
-
- dmxMCtrlProcPtr mCtrl; /**< Pointer control */
- dmxKBCtrlProcPtr kCtrl; /**< Keyboard control */
- dmxKBBellProcPtr kBell; /**< Bell control */
-
- pointer private; /**< Device-dependent private */
- int isCore; /**< Is a DMX core device */
- int sendsCore; /**< Sends DMX core events */
- KeybdCtrl kctrl; /**< Keyboard control */
- PtrCtrl mctrl; /**< Pointer control */
-
- DeviceIntPtr pDevice; /**< X-level device */
- int inputIdx; /**< High-level index */
- int lastX, lastY; /**< Last known position;
- * for XInput in
- * dmxevents.c */
-
- int head; /**< XInput motion history
- * head */
- int tail; /**< XInput motion history
- * tail */
- unsigned long *history; /**< XInput motion history */
- int *valuators; /**< Cache of previous values */
-
- /* for XInput ChangePointerDevice */
- int (*savedMotionProc)(DeviceIntPtr,
- xTimecoord *,
- unsigned long,
- unsigned long,
- ScreenPtr);
- int savedMotionEvents; /**< Saved motion events */
- int savedSendsCore; /**< Saved sends-core flag */
-
- DMXEventMap map[DMX_MAP_ENTRIES]; /**< XInput device id map */
- int mapOptimize; /**< XInput device id
- * map
- * optimization */
-
- long deviceId; /**< device id on remote side,
- * if any */
- const char *deviceName; /**< devive name on remote
- * side, if any */
-} DMXLocalInputInfoRec;
-
-extern DMXLocalInputInfoPtr dmxLocalCorePointer, dmxLocalCoreKeyboard;
-
-extern void dmxLocalInitInput(DMXInputInfo *dmxInput);
-extern DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo *dmxInput,
- DMXLocalInputInfoPtr s);
-
-extern void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl *ctrl);
-extern void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl *ctrl);
-extern void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice,
- pointer ctrl, int unknown);
-
-extern int dmxInputExtensionErrorHandler(Display *dsp, _Xconst char *name,
- _Xconst char *reason);
-
-extern int dmxInputDetach(DMXInputInfo *dmxInput);
-extern void dmxInputDetachAll(DMXScreenInfo *dmxScreen);
-extern int dmxInputDetachId(int id);
-extern DMXInputInfo *dmxInputLocateId(int id);
-extern int dmxInputAttachConsole(const char *name, int isCore,
- int *id);
-extern int dmxInputAttachBackend(int physicalScreen, int isCore,
- int *id);
-
-#endif
+/*
+ * Copyright 2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * Interface for low-level input support. \see dmxinputinit.c */
+
+#ifndef _DMXINPUTINIT_H_
+#define _DMXINPUTINIT_H_
+
+#include "dmx.h"
+#include "dmxinput.h"
+#include "dmxlog.h"
+
+#define DMX_LOCAL_DEFAULT_KEYBOARD "kbd"
+#define DMX_LOCAL_DEFAULT_POINTER "ps2"
+#define DMX_MAX_BUTTONS 256
+#define DMX_MOTION_SIZE 256
+#define DMX_MAX_VALUATORS 32
+#define DMX_MAX_AXES 32
+#define DMX_MAX_XINPUT_EVENT_TYPES 100
+#define DMX_MAP_ENTRIES 16 /* Must be a power of 2 */
+#define DMX_MAP_MASK (DMX_MAP_ENTRIES - 1)
+
+typedef enum {
+ DMX_FUNCTION_GRAB,
+ DMX_FUNCTION_TERMINATE,
+ DMX_FUNCTION_FINE
+} DMXFunctionType;
+
+typedef enum {
+ DMX_LOCAL_HIGHLEVEL,
+ DMX_LOCAL_KEYBOARD,
+ DMX_LOCAL_MOUSE,
+ DMX_LOCAL_OTHER
+} DMXLocalInputType;
+
+typedef enum {
+ DMX_LOCAL_TYPE_LOCAL,
+ DMX_LOCAL_TYPE_CONSOLE,
+ DMX_LOCAL_TYPE_BACKEND,
+ DMX_LOCAL_TYPE_COMMON
+} DMXLocalInputExtType;
+
+typedef enum {
+ DMX_RELATIVE,
+ DMX_ABSOLUTE,
+ DMX_ABSOLUTE_CONFINED
+} DMXMotionType;
+
+/** Stores information from low-level device that is used to initialize
+ * the device at the dix level. */
+typedef struct _DMXLocalInitInfo {
+ int keyboard; /**< Non-zero if the device is a keyboard */
+
+ int keyClass; /**< Non-zero if keys are present */
+ KeySymsRec keySyms; /**< Key symbols */
+ int freemap; /**< If non-zero, free keySyms.map */
+ CARD8 modMap[MAP_LENGTH]; /**< Modifier map */
+ XkbDescPtr xkb; /**< XKB description */
+ XkbComponentNamesRec names; /**< XKB component names */
+ int freenames; /**< Non-zero if names should be free'd */
+ int force; /**< Do not allow command line override */
+
+ int buttonClass; /**< Non-zero if buttons are present */
+ int numButtons; /**< Number of buttons */
+ unsigned char map[DMX_MAX_BUTTONS]; /**< Button map */
+
+ int valuatorClass; /**< Non-zero if valuators are
+ * present */
+ int numRelAxes; /**< Number of relative axes */
+ int numAbsAxes; /**< Number of absolute axes */
+ int minval[DMX_MAX_AXES]; /**< Minimum values */
+ int maxval[DMX_MAX_AXES]; /**< Maximum values */
+ int res[DMX_MAX_AXES]; /**< Resolution */
+ int minres[DMX_MAX_AXES]; /**< Minimum resolutions */
+ int maxres[DMX_MAX_AXES]; /**< Maximum resolutions */
+
+ int focusClass; /**< Non-zero if device can
+ * cause focus */
+ int proximityClass; /**< Non-zero if device
+ * causes proximity events */
+ int kbdFeedbackClass; /**< Non-zero if device has
+ * keyboard feedback */
+ int ptrFeedbackClass; /**< Non-zero if device has
+ * pointer feedback */
+ int ledFeedbackClass; /**< Non-zero if device has
+ * LED indicators */
+ int belFeedbackClass; /**< Non-zero if device has a
+ * bell */
+ int intFeedbackClass; /**< Non-zero if device has
+ * integer feedback */
+ int strFeedbackClass; /**< Non-zero if device has
+ * string feedback */
+
+ int maxSymbols; /**< Maximum symbols */
+ int maxSymbolsSupported; /**< Maximum symbols supported */
+ KeySym *symbols; /**< Key symbols */
+} DMXLocalInitInfo, *DMXLocalInitInfoPtr;
+
+typedef pointer (*dmxCreatePrivateProcPtr) (DeviceIntPtr);
+typedef void (*dmxDestroyPrivateProcPtr) (pointer);
+
+typedef void (*dmxInitProcPtr) (DevicePtr);
+typedef void (*dmxReInitProcPtr) (DevicePtr);
+typedef void (*dmxLateReInitProcPtr) (DevicePtr);
+typedef void (*dmxGetInfoProcPtr) (DevicePtr, DMXLocalInitInfoPtr);
+typedef int (*dmxOnProcPtr) (DevicePtr);
+typedef void (*dmxOffProcPtr) (DevicePtr);
+typedef void (*dmxUpdatePositionProcPtr) (pointer, int x, int y);
+
+typedef void (*dmxVTPreSwitchProcPtr) (pointer); /* Turn I/O Off */
+typedef void (*dmxVTPostSwitchProcPtr) (pointer); /* Turn I/O On */
+typedef void (*dmxVTSwitchReturnProcPtr) (pointer);
+typedef int (*dmxVTSwitchProcPtr) (pointer, int vt,
+ dmxVTSwitchReturnProcPtr, pointer);
+
+typedef void (*dmxMotionProcPtr) (DevicePtr,
+ int *valuators,
+ int firstAxis,
+ int axesCount,
+ DMXMotionType type, DMXBlockType block);
+typedef void (*dmxEnqueueProcPtr) (DevicePtr, int type, int detail,
+ KeySym keySym, XEvent * e,
+ DMXBlockType block);
+typedef int (*dmxCheckSpecialProcPtr) (DevicePtr, KeySym keySym);
+typedef void (*dmxCollectEventsProcPtr) (DevicePtr,
+ dmxMotionProcPtr,
+ dmxEnqueueProcPtr,
+ dmxCheckSpecialProcPtr, DMXBlockType);
+typedef void (*dmxProcessInputProcPtr) (pointer);
+typedef void (*dmxUpdateInfoProcPtr) (pointer, DMXUpdateType, WindowPtr);
+typedef int (*dmxFunctionsProcPtr) (pointer, DMXFunctionType);
+
+typedef void (*dmxKBCtrlProcPtr) (DevicePtr, KeybdCtrl * ctrl);
+typedef void (*dmxMCtrlProcPtr) (DevicePtr, PtrCtrl * ctrl);
+typedef void (*dmxKBBellProcPtr) (DevicePtr, int percent,
+ int volume, int pitch, int duration);
+
+/** Stores a mapping between the device id on the remote X server and
+ * the id on the DMX server */
+typedef struct _DMXEventMap {
+ int remote; /**< Event number on remote X server */
+ int server; /**< Event number (unbiased) on DMX server */
+} DMXEventMap;
+
+/** This is the device-independent structure used by the low-level input
+ * routines. The contents are not exposed to top-level .c files (except
+ * dmxextensions.c). \see dmxinput.h \see dmxextensions.c */
+typedef struct _DMXLocalInputInfo {
+ const char *name; /**< Device name */
+ DMXLocalInputType type; /**< Device type */
+ DMXLocalInputExtType extType; /**< Extended device type */
+ int binding; /**< Count of how many consecutive
+ * structs are bound to the same
+ * device */
+
+ /* Low-level (e.g., keyboard/mouse drivers) */
+
+ dmxCreatePrivateProcPtr create_private; /**< Create
+ * device-dependent
+ * private */
+ dmxDestroyPrivateProcPtr destroy_private; /**< Destroy
+ * device-dependent
+ * private */
+ dmxInitProcPtr init; /**< Initialize device */
+ dmxReInitProcPtr reinit; /**< Reinitialize device
+ * (during a
+ * reconfiguration) */
+ dmxLateReInitProcPtr latereinit; /**< Reinitialize a device
+ * (called very late
+ * during a
+ * reconfiguration) */
+ dmxGetInfoProcPtr get_info; /**< Get device information */
+ dmxOnProcPtr on; /**< Turn device on */
+ dmxOffProcPtr off; /**< Turn device off */
+ dmxUpdatePositionProcPtr update_position; /**< Called when another
+ * device updates the
+ * cursor position */
+ dmxVTPreSwitchProcPtr vt_pre_switch; /**< Called before a VT switch */
+ dmxVTPostSwitchProcPtr vt_post_switch; /**< Called after a VT switch */
+ dmxVTSwitchProcPtr vt_switch; /**< Causes a VT switch */
+
+ dmxCollectEventsProcPtr collect_events; /**< Collect and enqueue
+ * events from the
+ * device*/
+ dmxProcessInputProcPtr process_input; /**< Process event (from
+ * queue) */
+ dmxFunctionsProcPtr functions;
+ dmxUpdateInfoProcPtr update_info; /**< Update window layout
+ * information */
+
+ dmxMCtrlProcPtr mCtrl; /**< Pointer control */
+ dmxKBCtrlProcPtr kCtrl; /**< Keyboard control */
+ dmxKBBellProcPtr kBell; /**< Bell control */
+
+ pointer private; /**< Device-dependent private */
+ int isCore; /**< Is a DMX core device */
+ int sendsCore; /**< Sends DMX core events */
+ KeybdCtrl kctrl; /**< Keyboard control */
+ PtrCtrl mctrl; /**< Pointer control */
+
+ DeviceIntPtr pDevice; /**< X-level device */
+ int inputIdx; /**< High-level index */
+ int lastX, lastY; /**< Last known position;
+ * for XInput in
+ * dmxevents.c */
+
+ int head; /**< XInput motion history
+ * head */
+ int tail; /**< XInput motion history
+ * tail */
+ unsigned long *history; /**< XInput motion history */
+ int *valuators; /**< Cache of previous values */
+
+ /* for XInput ChangePointerDevice */
+ int (*savedMotionProc) (DeviceIntPtr,
+ xTimecoord *,
+ unsigned long, unsigned long, ScreenPtr);
+ int savedMotionEvents; /**< Saved motion events */
+ int savedSendsCore; /**< Saved sends-core flag */
+
+ DMXEventMap map[DMX_MAP_ENTRIES]; /**< XInput device id map */
+ int mapOptimize; /**< XInput device id
+ * map
+ * optimization */
+
+ long deviceId; /**< device id on remote side,
+ * if any */
+ const char *deviceName; /**< devive name on remote
+ * side, if any */
+} DMXLocalInputInfoRec;
+
+extern DMXLocalInputInfoPtr dmxLocalCorePointer, dmxLocalCoreKeyboard;
+
+extern void dmxLocalInitInput(DMXInputInfo * dmxInput);
+extern DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo * dmxInput,
+ DMXLocalInputInfoPtr s);
+
+extern void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl * ctrl);
+extern void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl * ctrl);
+extern void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice,
+ pointer ctrl, int unknown);
+
+extern int dmxInputExtensionErrorHandler(Display * dsp, _Xconst char *name,
+ _Xconst char *reason);
+
+extern int dmxInputDetach(DMXInputInfo * dmxInput);
+extern void dmxInputDetachAll(DMXScreenInfo * dmxScreen);
+extern int dmxInputDetachId(int id);
+extern DMXInputInfo *dmxInputLocateId(int id);
+extern int dmxInputAttachConsole(const char *name, int isCore, int *id);
+extern int dmxInputAttachBackend(int physicalScreen, int isCore, int *id);
+
+#endif
diff --git a/xorg-server/hw/dmx/input/dmxmap.c b/xorg-server/hw/dmx/input/dmxmap.c
index 1eccd3d28..1a8d4c937 100644
--- a/xorg-server/hw/dmx/input/dmxmap.c
+++ b/xorg-server/hw/dmx/input/dmxmap.c
@@ -59,15 +59,16 @@
* remoteEvent is the type returned from the remote server. The \a
* serverEvent is from the XI_* list of events in
* include/extensions/XIproto.h. */
-void dmxMapInsert(DMXLocalInputInfoPtr dmxLocal,
- int remoteEvent, int serverEvent)
+void
+dmxMapInsert(DMXLocalInputInfoPtr dmxLocal, int remoteEvent, int serverEvent)
{
int hash = remoteEvent & DMX_MAP_MASK;
int i;
- /* Return if this has already been mapped */
+ /* Return if this has already been mapped */
if (dmxLocal->map[hash].remote == remoteEvent
- && dmxLocal->map[hash].server == serverEvent) return;
+ && dmxLocal->map[hash].server == serverEvent)
+ return;
if (dmxLocal->map[hash].remote) {
dmxLocal->mapOptimize = 0;
@@ -81,18 +82,21 @@ void dmxMapInsert(DMXLocalInputInfoPtr dmxLocal,
dmxLog(dmxWarning,
"Out of map entries, cannot map remove event type %d\n",
remoteEvent);
- } else {
+ }
+ else {
dmxLocal->map[hash].remote = remoteEvent;
dmxLocal->map[hash].server = serverEvent;
}
}
/** Remove all mappings there were inserted with #dmxMapInsert. */
-void dmxMapClear(DMXLocalInputInfoPtr dmxLocal)
+void
+dmxMapClear(DMXLocalInputInfoPtr dmxLocal)
{
int i;
- for (i = 0; i < DMX_MAP_ENTRIES; i++) dmxLocal->map[i].remote = 0;
+ for (i = 0; i < DMX_MAP_ENTRIES; i++)
+ dmxLocal->map[i].remote = 0;
dmxLocal->mapOptimize = 1;
}
@@ -100,16 +104,18 @@ void dmxMapClear(DMXLocalInputInfoPtr dmxLocal)
* returned from the remote server. The return value is that which was
* passed into #dmxMapInsert (i.e., a value from the XI_* list in
* include/extensions/XIproto.h). If a mapping is not available, -1 is
- * returned. */
-int dmxMapLookup(DMXLocalInputInfoPtr dmxLocal, int remoteEvent)
+ * returned. */
+int
+dmxMapLookup(DMXLocalInputInfoPtr dmxLocal, int remoteEvent)
{
- int hash = remoteEvent & DMX_MAP_MASK;
+ int hash = remoteEvent & DMX_MAP_MASK;
int serverEvent = -1;
int i;
if (dmxLocal->mapOptimize && dmxLocal->map[hash].remote == remoteEvent) {
serverEvent = dmxLocal->map[hash].server;
- } else {
+ }
+ else {
for (i = 0; i < DMX_MAP_ENTRIES; i++)
if (dmxLocal->map[i].remote == remoteEvent) {
serverEvent = dmxLocal->map[hash].server;
diff --git a/xorg-server/hw/dmx/input/dmxmotion.c b/xorg-server/hw/dmx/input/dmxmotion.c
index 7a4b8a0dc..1642894a2 100644
--- a/xorg-server/hw/dmx/input/dmxmotion.c
+++ b/xorg-server/hw/dmx/input/dmxmotion.c
@@ -1,141 +1,149 @@
-/*
- * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- * This file provides functions similar to miPointerGetMotionEvents and
- * miPointerPutMotionEvents, with the exception that devices with more
- * than two axes are fully supported. These routines may be used only
- * for motion buffers for extension devices, and are \a not compatible
- * replacements for the mi routines. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "inputstr.h"
-#include "dmxinputinit.h"
-#include "dmxcommon.h"
-#include "dmxmotion.h"
-
-#define OFFSET(offset,element) ((offset) * (numAxes + 1) + (element))
-
-/** Return size of motion buffer. \see DMX_MOTION_SIZE */
-int dmxPointerGetMotionBufferSize(void)
-{
- return DMX_MOTION_SIZE;
-}
-
-/** This routine performs the same function as \a miPointerGetMotionEvents:
- * the events in the motion history that are between the start and stop
- * times (in mS) are placed in the coords vector, and the count of the
- * number of items so placed is returned. This routine is called from
- * dix/devices.c so that coords can hold valuator->numMotionEvents
- * events. This routine is called from \a Xi/gtmotion.c with coords large
- * enough to hold the same number of events in a variable-length
- * extended \a xTimecoord structure. This provides sufficient data for the
- * \a XGetDeviceMotionEvents library call, and would be identical to
- * \a miPointerGetMotionEvents for devices with only 2 axes (i.e., core
- * pointers) if \a xTimecoord used 32bit integers.
- *
- * Because DMX uses the mi* routines for all core devices, this routine
- * only has to support extension devices using the polymorphic coords.
- * Because compatibility with miPointerGetMotionEvents is not possible,
- * it is not provided. */
-int dmxPointerGetMotionEvents(DeviceIntPtr pDevice,
- xTimecoord *coords,
- unsigned long start,
- unsigned long stop,
- ScreenPtr pScreen)
-{
- GETDMXLOCALFROMPDEVICE;
- int numAxes = pDevice->valuator->numAxes;
- unsigned long *c = (unsigned long *)coords;
- int count = 0;
- int i, j;
-
- if (!dmxLocal->history) return 0;
- for (i = dmxLocal->head; i != dmxLocal->tail;) {
- if (dmxLocal->history[OFFSET(i,0)] >= stop) break;
- if (dmxLocal->history[OFFSET(i,0)] >= start) {
- for (j = 0; j < numAxes + 1; j++)
- c[OFFSET(count,j)] = dmxLocal->history[OFFSET(i,j)];
- ++count;
- }
- if (++i >= DMX_MOTION_SIZE) i = 0;
- }
- return count;
-}
-
-/** This routine adds an event to the motion history. A similar
- * function is performed by miPointerMove for the mi versions of these
- * routines. */
-void dmxPointerPutMotionEvent(DeviceIntPtr pDevice,
- int firstAxis, int axesCount, int *v,
- unsigned long time)
-{
- GETDMXLOCALFROMPDEVICE;
- int numAxes = pDevice->valuator->numAxes;
- int i;
-
- if (!dmxLocal->history) {
- dmxLocal->history = malloc(sizeof(*dmxLocal->history)
- * (numAxes + 1)
- * DMX_MOTION_SIZE);
- dmxLocal->head = 0;
- dmxLocal->tail = 0;
- dmxLocal->valuators = calloc(sizeof(*dmxLocal->valuators), numAxes);
- } else {
- if (++dmxLocal->tail >= DMX_MOTION_SIZE) dmxLocal->tail = 0;
- if (dmxLocal->head == dmxLocal->tail)
- if (++dmxLocal->head >= DMX_MOTION_SIZE) dmxLocal->head = 0;
- }
-
- dmxLocal->history[OFFSET(dmxLocal->tail,0)] = time;
-
- /* Initialize the data from the known
- * values (if Absolute) or to zero (if
- * Relative) */
- for (i = 0; i < numAxes; i++) {
- if (pDevice->valuator->axes[i].mode == Absolute)
- dmxLocal->history[OFFSET(dmxLocal->tail,i+1)]
- = dmxLocal->valuators[i];
- else
- dmxLocal->history[OFFSET(dmxLocal->tail,i+1)] = 0;
- }
-
- for (i = firstAxis; i < axesCount; i++) {
- dmxLocal->history[OFFSET(dmxLocal->tail,i+i)]
- = (unsigned long)v[i-firstAxis];
- dmxLocal->valuators[i] = v[i-firstAxis];
- }
-}
+/*
+ * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ * This file provides functions similar to miPointerGetMotionEvents and
+ * miPointerPutMotionEvents, with the exception that devices with more
+ * than two axes are fully supported. These routines may be used only
+ * for motion buffers for extension devices, and are \a not compatible
+ * replacements for the mi routines. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "inputstr.h"
+#include "dmxinputinit.h"
+#include "dmxcommon.h"
+#include "dmxmotion.h"
+
+#define OFFSET(offset,element) ((offset) * (numAxes + 1) + (element))
+
+/** Return size of motion buffer. \see DMX_MOTION_SIZE */
+int
+dmxPointerGetMotionBufferSize(void)
+{
+ return DMX_MOTION_SIZE;
+}
+
+/** This routine performs the same function as \a miPointerGetMotionEvents:
+ * the events in the motion history that are between the start and stop
+ * times (in mS) are placed in the coords vector, and the count of the
+ * number of items so placed is returned. This routine is called from
+ * dix/devices.c so that coords can hold valuator->numMotionEvents
+ * events. This routine is called from \a Xi/gtmotion.c with coords large
+ * enough to hold the same number of events in a variable-length
+ * extended \a xTimecoord structure. This provides sufficient data for the
+ * \a XGetDeviceMotionEvents library call, and would be identical to
+ * \a miPointerGetMotionEvents for devices with only 2 axes (i.e., core
+ * pointers) if \a xTimecoord used 32bit integers.
+ *
+ * Because DMX uses the mi* routines for all core devices, this routine
+ * only has to support extension devices using the polymorphic coords.
+ * Because compatibility with miPointerGetMotionEvents is not possible,
+ * it is not provided. */
+int
+dmxPointerGetMotionEvents(DeviceIntPtr pDevice,
+ xTimecoord * coords,
+ unsigned long start,
+ unsigned long stop, ScreenPtr pScreen)
+{
+ GETDMXLOCALFROMPDEVICE;
+ int numAxes = pDevice->valuator->numAxes;
+ unsigned long *c = (unsigned long *) coords;
+ int count = 0;
+ int i, j;
+
+ if (!dmxLocal->history)
+ return 0;
+ for (i = dmxLocal->head; i != dmxLocal->tail;) {
+ if (dmxLocal->history[OFFSET(i, 0)] >= stop)
+ break;
+ if (dmxLocal->history[OFFSET(i, 0)] >= start) {
+ for (j = 0; j < numAxes + 1; j++)
+ c[OFFSET(count, j)] = dmxLocal->history[OFFSET(i, j)];
+ ++count;
+ }
+ if (++i >= DMX_MOTION_SIZE)
+ i = 0;
+ }
+ return count;
+}
+
+/** This routine adds an event to the motion history. A similar
+ * function is performed by miPointerMove for the mi versions of these
+ * routines. */
+void
+dmxPointerPutMotionEvent(DeviceIntPtr pDevice,
+ int firstAxis, int axesCount, int *v,
+ unsigned long time)
+{
+ GETDMXLOCALFROMPDEVICE;
+ int numAxes = pDevice->valuator->numAxes;
+ int i;
+
+ if (!dmxLocal->history) {
+ dmxLocal->history = malloc(sizeof(*dmxLocal->history)
+ * (numAxes + 1)
+ * DMX_MOTION_SIZE);
+ dmxLocal->head = 0;
+ dmxLocal->tail = 0;
+ dmxLocal->valuators = calloc(sizeof(*dmxLocal->valuators), numAxes);
+ }
+ else {
+ if (++dmxLocal->tail >= DMX_MOTION_SIZE)
+ dmxLocal->tail = 0;
+ if (dmxLocal->head == dmxLocal->tail)
+ if (++dmxLocal->head >= DMX_MOTION_SIZE)
+ dmxLocal->head = 0;
+ }
+
+ dmxLocal->history[OFFSET(dmxLocal->tail, 0)] = time;
+
+ /* Initialize the data from the known
+ * values (if Absolute) or to zero (if
+ * Relative) */
+ for (i = 0; i < numAxes; i++) {
+ if (pDevice->valuator->axes[i].mode == Absolute)
+ dmxLocal->history[OFFSET(dmxLocal->tail, i + 1)]
+ = dmxLocal->valuators[i];
+ else
+ dmxLocal->history[OFFSET(dmxLocal->tail, i + 1)] = 0;
+ }
+
+ for (i = firstAxis; i < axesCount; i++) {
+ dmxLocal->history[OFFSET(dmxLocal->tail, i + i)]
+ = (unsigned long) v[i - firstAxis];
+ dmxLocal->valuators[i] = v[i - firstAxis];
+ }
+}
diff --git a/xorg-server/hw/dmx/input/dmxmotion.h b/xorg-server/hw/dmx/input/dmxmotion.h
index 88aeb3d09..5ccdbe4ad 100644
--- a/xorg-server/hw/dmx/input/dmxmotion.h
+++ b/xorg-server/hw/dmx/input/dmxmotion.h
@@ -37,12 +37,11 @@
#ifndef _DMXMOTION_H_
#define _DMXMOTION_H_
-extern int dmxPointerGetMotionBufferSize(void);
-extern int dmxPointerGetMotionEvents(DeviceIntPtr pDevice,
- xTimecoord *coords,
- unsigned long start,
- unsigned long stop,
- ScreenPtr pScreen);
+extern int dmxPointerGetMotionBufferSize(void);
+extern int dmxPointerGetMotionEvents(DeviceIntPtr pDevice,
+ xTimecoord * coords,
+ unsigned long start,
+ unsigned long stop, ScreenPtr pScreen);
extern void dmxPointerPutMotionEvent(DeviceIntPtr pDevice,
int firstAxis, int axesCount, int *v,
unsigned long time);
diff --git a/xorg-server/hw/dmx/input/dmxsigio.c b/xorg-server/hw/dmx/input/dmxsigio.c
index 03c3070d7..9b1b493b8 100644
--- a/xorg-server/hw/dmx/input/dmxsigio.c
+++ b/xorg-server/hw/dmx/input/dmxsigio.c
@@ -47,36 +47,37 @@
#include <unistd.h>
#include <fcntl.h>
-static int dmxFdCount = 0;
+static int dmxFdCount = 0;
static Bool dmxInputEnabled = TRUE;
/* Define equivalents for non-POSIX systems (e.g., SGI IRIX, Solaris) */
#ifndef O_ASYNC
-# ifdef FASYNC
-# define O_ASYNC FASYNC
-# else
-# define O_ASYNC 0
-# endif
+#ifdef FASYNC
+#define O_ASYNC FASYNC
+#else
+#define O_ASYNC 0
+#endif
#endif
#ifndef O_NONBLOCK
#define O_NONBLOCK FNONBLK
#endif
-static void dmxSigioHandler(int sig)
+static void
+dmxSigioHandler(int sig)
{
- int i, j;
+ int i, j;
DMXInputInfo *dmxInput;
for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) {
if (dmxInput->sigioState == DMX_ACTIVESIGIO) {
for (j = 0; j < dmxInput->numDevs; j++) {
DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j];
+
if (dmxLocal->collect_events) {
dmxLocal->collect_events(&dmxLocal->pDevice->public,
dmxMotion,
dmxEnqueue,
- dmxCheckSpecialKeys,
- DMX_NO_BLOCK);
+ dmxCheckSpecialKeys, DMX_NO_BLOCK);
}
}
}
@@ -84,7 +85,8 @@ static void dmxSigioHandler(int sig)
}
/** Block SIGIO handling. */
-void dmxSigioBlock(void)
+void
+dmxSigioBlock(void)
{
sigset_t s;
@@ -94,7 +96,8 @@ void dmxSigioBlock(void)
}
/** Unblock SIGIO handling. */
-void dmxSigioUnblock(void)
+void
+dmxSigioUnblock(void)
{
sigset_t s;
@@ -103,10 +106,11 @@ void dmxSigioUnblock(void)
sigprocmask(SIG_UNBLOCK, &s, 0);
}
-static void dmxSigioHook(void)
+static void
+dmxSigioHook(void)
{
struct sigaction a;
- sigset_t s;
+ sigset_t s;
memset(&a, 0, sizeof(a));
a.sa_handler = dmxSigioHandler;
@@ -115,81 +119,95 @@ static void dmxSigioHook(void)
sigaddset(&a.sa_mask, SIGALRM);
sigaddset(&a.sa_mask, SIGVTALRM);
sigaction(SIGIO, &a, 0);
-
+
sigemptyset(&s);
sigprocmask(SIG_SETMASK, &s, 0);
}
-static void dmxSigioUnhook(void)
+static void
+dmxSigioUnhook(void)
{
struct sigaction a;
- memset (&a, 0, sizeof(a));
+ memset(&a, 0, sizeof(a));
a.sa_handler = SIG_IGN;
sigemptyset(&a.sa_mask);
sigaction(SIGIO, &a, 0);
}
-static void dmxSigioAdd(DMXInputInfo *dmxInput)
+static void
+dmxSigioAdd(DMXInputInfo * dmxInput)
{
int flags;
int i;
switch (dmxInput->sigioState) {
- case DMX_NOSIGIO: return;
- case DMX_USESIGIO: dmxInput->sigioState = DMX_ACTIVESIGIO; break;
- case DMX_ACTIVESIGIO: return;
+ case DMX_NOSIGIO:
+ return;
+ case DMX_USESIGIO:
+ dmxInput->sigioState = DMX_ACTIVESIGIO;
+ break;
+ case DMX_ACTIVESIGIO:
+ return;
}
for (i = 0; i < dmxInput->sigioFdCount; i++) {
if (!dmxInput->sigioAdded[i]) {
int fd = dmxInput->sigioFd[i];
-
+
fcntl(fd, F_SETOWN, getpid());
flags = fcntl(fd, F_GETFL);
- flags |= O_ASYNC|O_NONBLOCK;
+ flags |= O_ASYNC | O_NONBLOCK;
fcntl(fd, F_SETFL, flags);
-
+
AddEnabledDevice(fd);
dmxInput->sigioAdded[i] = TRUE;
- if (++dmxFdCount == 1) dmxSigioHook();
+ if (++dmxFdCount == 1)
+ dmxSigioHook();
}
}
}
-static void dmxSigioRemove(DMXInputInfo *dmxInput)
+static void
+dmxSigioRemove(DMXInputInfo * dmxInput)
{
int flags;
int i;
-
+
switch (dmxInput->sigioState) {
- case DMX_NOSIGIO: return;
- case DMX_USESIGIO: return;
- case DMX_ACTIVESIGIO: dmxInput->sigioState = DMX_USESIGIO; break;
+ case DMX_NOSIGIO:
+ return;
+ case DMX_USESIGIO:
+ return;
+ case DMX_ACTIVESIGIO:
+ dmxInput->sigioState = DMX_USESIGIO;
+ break;
}
for (i = 0; i < dmxInput->sigioFdCount; i++) {
if (dmxInput->sigioAdded[i]) {
int fd = dmxInput->sigioFd[i];
-
+
dmxInput->sigioAdded[i] = FALSE;
RemoveEnabledDevice(fd);
-
+
flags = fcntl(fd, F_GETFL);
- flags &= ~(O_ASYNC|O_NONBLOCK);
+ flags &= ~(O_ASYNC | O_NONBLOCK);
fcntl(fd, F_SETFL, flags);
- if (!--dmxFdCount) dmxSigioUnhook();
+ if (!--dmxFdCount)
+ dmxSigioUnhook();
}
}
}
/** Enable SIGIO handling. This instantiates the handler with the OS. */
-void dmxSigioEnableInput(void)
+void
+dmxSigioEnableInput(void)
{
- int i;
- DMXInputInfo *dmxInput;
+ int i;
+ DMXInputInfo *dmxInput;
dmxInputEnabled = TRUE;
for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
@@ -197,10 +215,11 @@ void dmxSigioEnableInput(void)
}
/** Disable SIGIO handling. This removes the hanlder from the OS. */
-void dmxSigioDisableInput(void)
+void
+dmxSigioDisableInput(void)
{
- int i;
- DMXInputInfo *dmxInput;
+ int i;
+ DMXInputInfo *dmxInput;
dmxInputEnabled = FALSE;
for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
@@ -211,23 +230,27 @@ void dmxSigioDisableInput(void)
* using the file descriptor \a fd for SIGIO signals. Calls
* AddEnabledDevice ifi SIGIO handling has been enabled with
* #dmxSigioEnableInput(). */
-void dmxSigioRegister(DMXInputInfo *dmxInput, int fd)
+void
+dmxSigioRegister(DMXInputInfo * dmxInput, int fd)
{
dmxInput->sigioState = DMX_USESIGIO;
if (dmxInput->sigioFdCount >= DMX_MAX_SIGIO_FDS)
dmxLog(dmxFatal, "Too many SIGIO file descriptors (%d >= %d)\n",
dmxInput->sigioFdCount, DMX_MAX_SIGIO_FDS);
-
+
dmxInput->sigioFd[dmxInput->sigioFdCount++] = fd;
- if (dmxInputEnabled) dmxSigioAdd(dmxInput);
+ if (dmxInputEnabled)
+ dmxSigioAdd(dmxInput);
}
/** Remove the notes that \a dmxInput is using any file descriptors for
* SIGIO signals. Calls RemoveEnabledDevice. */
-void dmxSigioUnregister(DMXInputInfo *dmxInput)
+void
+dmxSigioUnregister(DMXInputInfo * dmxInput)
{
- if (dmxInput->sigioState == DMX_NOSIGIO) return;
+ if (dmxInput->sigioState == DMX_NOSIGIO)
+ return;
dmxSigioRemove(dmxInput);
- dmxInput->sigioState = DMX_NOSIGIO;
+ dmxInput->sigioState = DMX_NOSIGIO;
dmxInput->sigioFdCount = 0;
}
diff --git a/xorg-server/hw/dmx/input/dmxxinput.c b/xorg-server/hw/dmx/input/dmxxinput.c
index b28a80d4d..fccab5ff1 100644
--- a/xorg-server/hw/dmx/input/dmxxinput.c
+++ b/xorg-server/hw/dmx/input/dmxxinput.c
@@ -1,76 +1,75 @@
-/*
- * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- *
- * This file implements support required by the XINPUT extension.
- */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "inputstr.h"
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "XIstubs.h"
-
-#include "mipointer.h"
-#include "dmxinputinit.h"
-#include "exevents.h"
-
-/** Set device mode to \a mode. This is not implemented. */
-int SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode)
-{
- return BadMatch;
-}
-
-/** Set device valuators. This is not implemented. */
-int SetDeviceValuators (ClientPtr client,
- DeviceIntPtr dev,
- int *valuators,
- int first_valuator,
- int num_valuators)
-{
- return BadMatch;
-}
-
-/** Change device control. This is not implemented. */
-int ChangeDeviceControl(ClientPtr client,
- DeviceIntPtr dev,
- xDeviceCtl *control)
-{
- return BadMatch;
-}
+/*
+ * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This file implements support required by the XINPUT extension.
+ */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "inputstr.h"
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include "XIstubs.h"
+
+#include "mipointer.h"
+#include "dmxinputinit.h"
+#include "exevents.h"
+
+/** Set device mode to \a mode. This is not implemented. */
+int
+SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode)
+{
+ return BadMatch;
+}
+
+/** Set device valuators. This is not implemented. */
+int
+SetDeviceValuators(ClientPtr client,
+ DeviceIntPtr dev,
+ int *valuators, int first_valuator, int num_valuators)
+{
+ return BadMatch;
+}
+
+/** Change device control. This is not implemented. */
+int
+ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, xDeviceCtl * control)
+{
+ return BadMatch;
+}
diff --git a/xorg-server/hw/dmx/input/lnx-keyboard.c b/xorg-server/hw/dmx/input/lnx-keyboard.c
index 06e9ec722..ecf4f591c 100644
--- a/xorg-server/hw/dmx/input/lnx-keyboard.c
+++ b/xorg-server/hw/dmx/input/lnx-keyboard.c
@@ -172,26 +172,25 @@
#define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0]))
#define NUM_STATE_ENTRIES (256/32)
-
/* Private area for Linux-style keyboards. */
typedef struct _myPrivate {
- int fd;
- int vtno;
- int vtcurrent;
- int kbdtrans;
+ int fd;
+ int vtno;
+ int vtcurrent;
+ int kbdtrans;
struct termios kbdtty;
- int kbdType;
- CARD32 kbdState[NUM_STATE_ENTRIES];
- DeviceIntPtr pKeyboard;
- unsigned char prefix;
-
- int switched;
- SWITCHRETPROC switch_return;
- void *switch_return_data;
-
- /* For bell */
- int pitch;
- unsigned long duration;
+ int kbdType;
+ CARD32 kbdState[NUM_STATE_ENTRIES];
+ DeviceIntPtr pKeyboard;
+ unsigned char prefix;
+
+ int switched;
+ SWITCHRETPROC switch_return;
+ void *switch_return_data;
+
+ /* For bell */
+ int pitch;
+ unsigned long duration;
} myPrivate;
static myPrivate *PRIV = NULL;
@@ -199,174 +198,182 @@ static myPrivate *PRIV = NULL;
#undef SYSCALL
#define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
-static int kbdLinuxKeyDown(myPrivate *priv, int keyCode)
+static int
+kbdLinuxKeyDown(myPrivate * priv, int keyCode)
{
- CARD8 byte = keyCode >> 5;
- CARD32 bit = 1 << (keyCode & 0x1f);
+ CARD8 byte = keyCode >> 5;
+ CARD32 bit = 1 << (keyCode & 0x1f);
- if (byte > NUM_STATE_ENTRIES) return 0;
+ if (byte > NUM_STATE_ENTRIES)
+ return 0;
return priv->kbdState[byte] & bit;
}
-static void kbdLinuxKeyState(myPrivate *priv, int type, int keyCode)
+static void
+kbdLinuxKeyState(myPrivate * priv, int type, int keyCode)
{
- CARD8 byte = keyCode >> 5;
- CARD32 bit = 1 << (keyCode & 0x1f);
-
- if (byte > NUM_STATE_ENTRIES) return;
- if (type == KeyPress) priv->kbdState[byte] |= bit;
- else priv->kbdState[byte] &= ~bit;
+ CARD8 byte = keyCode >> 5;
+ CARD32 bit = 1 << (keyCode & 0x1f);
+
+ if (byte > NUM_STATE_ENTRIES)
+ return;
+ if (type == KeyPress)
+ priv->kbdState[byte] |= bit;
+ else
+ priv->kbdState[byte] &= ~bit;
}
static KeySym linux_to_x[256] = {
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, XK_Escape,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
- XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
- XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
- XK_comma, XK_minus, XK_period, XK_slash,
- XK_0, XK_1, XK_2, XK_3,
- XK_4, XK_5, XK_6, XK_7,
- XK_8, XK_9, XK_colon, XK_semicolon,
- XK_less, XK_equal, XK_greater, XK_question,
- XK_at, XK_A, XK_B, XK_C,
- XK_D, XK_E, XK_F, XK_G,
- XK_H, XK_I, XK_J, XK_K,
- XK_L, XK_M, XK_N, XK_O,
- XK_P, XK_Q, XK_R, XK_S,
- XK_T, XK_U, XK_V, XK_W,
- XK_X, XK_Y, XK_Z, XK_bracketleft,
- XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
- XK_grave, XK_a, XK_b, XK_c,
- XK_d, XK_e, XK_f, XK_g,
- XK_h, XK_i, XK_j, XK_k,
- XK_l, XK_m, XK_n, XK_o,
- XK_p, XK_q, XK_r, XK_s,
- XK_t, XK_u, XK_v, XK_w,
- XK_x, XK_y, XK_z, XK_braceleft,
- XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling,
- XK_currency, XK_yen, XK_brokenbar, XK_section,
- XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
- XK_notsign, XK_hyphen, XK_registered, XK_macron,
- XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
- XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
- XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
- XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown,
- XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
- XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
- XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
- XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
- XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
- XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
- XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
- XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
- XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
- XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
- XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
- XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
- XK_eth, XK_ntilde, XK_ograve, XK_oacute,
- XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
- XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
- XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, XK_Escape,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
+ XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
+ XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
+ XK_comma, XK_minus, XK_period, XK_slash,
+ XK_0, XK_1, XK_2, XK_3,
+ XK_4, XK_5, XK_6, XK_7,
+ XK_8, XK_9, XK_colon, XK_semicolon,
+ XK_less, XK_equal, XK_greater, XK_question,
+ XK_at, XK_A, XK_B, XK_C,
+ XK_D, XK_E, XK_F, XK_G,
+ XK_H, XK_I, XK_J, XK_K,
+ XK_L, XK_M, XK_N, XK_O,
+ XK_P, XK_Q, XK_R, XK_S,
+ XK_T, XK_U, XK_V, XK_W,
+ XK_X, XK_Y, XK_Z, XK_bracketleft,
+ XK_backslash, XK_bracketright, XK_asciicircum, XK_underscore,
+ XK_grave, XK_a, XK_b, XK_c,
+ XK_d, XK_e, XK_f, XK_g,
+ XK_h, XK_i, XK_j, XK_k,
+ XK_l, XK_m, XK_n, XK_o,
+ XK_p, XK_q, XK_r, XK_s,
+ XK_t, XK_u, XK_v, XK_w,
+ XK_x, XK_y, XK_z, XK_braceleft,
+ XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ XK_nobreakspace, XK_exclamdown, XK_cent, XK_sterling,
+ XK_currency, XK_yen, XK_brokenbar, XK_section,
+ XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
+ XK_notsign, XK_hyphen, XK_registered, XK_macron,
+ XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
+ XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
+ XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
+ XK_onequarter, XK_onehalf, XK_threequarters, XK_questiondown,
+ XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
+ XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
+ XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
+ XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
+ XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
+ XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
+ XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
+ XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
+ XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
+ XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
+ XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
+ XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
+ XK_eth, XK_ntilde, XK_ograve, XK_oacute,
+ XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
+ XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
+ XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
};
/*
* Maps the AT keycodes to Linux keycodes
*/
-static unsigned char at2lnx[NUM_KEYCODES] =
-{
- 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
- 0x03, /* KEY_2 */ 0x04, /* KEY_3 */
- 0x05, /* KEY_4 */ 0x06, /* KEY_5 */
- 0x07, /* KEY_6 */ 0x08, /* KEY_7 */
- 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */
- 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */
- 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */
- 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */
- 0x11, /* KEY_W */ 0x12, /* KEY_E */
- 0x13, /* KEY_R */ 0x14, /* KEY_T */
- 0x15, /* KEY_Y */ 0x16, /* KEY_U */
- 0x17, /* KEY_I */ 0x18, /* KEY_O */
- 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */
- 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */
- 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */
- 0x1f, /* KEY_S */ 0x20, /* KEY_D */
- 0x21, /* KEY_F */ 0x22, /* KEY_G */
- 0x23, /* KEY_H */ 0x24, /* KEY_J */
- 0x25, /* KEY_K */ 0x26, /* KEY_L */
- 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */
- 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */
- 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */
- 0x2d, /* KEY_X */ 0x2e, /* KEY_C */
- 0x2f, /* KEY_V */ 0x30, /* KEY_B */
- 0x31, /* KEY_N */ 0x32, /* KEY_M */
- 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */
- 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */
- 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */
- 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */
- 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */
- 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */
- 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */
- 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */
- 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */
- 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */
- 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */
- 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */
- 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */
- 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */
- 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */
- 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */
- 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */
- 0x00, /* 0x55 */ 0x56, /* KEY_Less */
- 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */
- 0x66, /* KEY_Home */ 0x67, /* KEY_Up */
- 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */
- 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */
- 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */
- 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */
- 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */
- 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */
- 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */
- 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */
- 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */
- 0x7A, /* KEY_Menu/FOCUS_PF11*/0x00, /* 0x6e */
- 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */
- 0x00, /* 0x71 */ 0x00, /* 0x72 */
- 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */
- 0x00, /* 0x75 */ 0x00, /* 0x76 */
- 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */
- 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */
- 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
- 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
- 0x00, /* 0x7f */
+static unsigned char at2lnx[NUM_KEYCODES] = {
+ 0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
+ 0x03, /* KEY_2 */ 0x04, /* KEY_3 */
+ 0x05, /* KEY_4 */ 0x06, /* KEY_5 */
+ 0x07, /* KEY_6 */ 0x08, /* KEY_7 */
+ 0x09, /* KEY_8 */ 0x0a, /* KEY_9 */
+ 0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */
+ 0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */
+ 0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */
+ 0x11, /* KEY_W */ 0x12, /* KEY_E */
+ 0x13, /* KEY_R */ 0x14, /* KEY_T */
+ 0x15, /* KEY_Y */ 0x16, /* KEY_U */
+ 0x17, /* KEY_I */ 0x18, /* KEY_O */
+ 0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */
+ 0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */
+ 0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */
+ 0x1f, /* KEY_S */ 0x20, /* KEY_D */
+ 0x21, /* KEY_F */ 0x22, /* KEY_G */
+ 0x23, /* KEY_H */ 0x24, /* KEY_J */
+ 0x25, /* KEY_K */ 0x26, /* KEY_L */
+ 0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */
+ 0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */
+ 0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */
+ 0x2d, /* KEY_X */ 0x2e, /* KEY_C */
+ 0x2f, /* KEY_V */ 0x30, /* KEY_B */
+ 0x31, /* KEY_N */ 0x32, /* KEY_M */
+ 0x33, /* KEY_Comma */ 0x34, /* KEY_Period */
+ 0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */
+ 0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */
+ 0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */
+ 0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */
+ 0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */
+ 0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */
+ 0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */
+ 0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */
+ 0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */
+ 0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */
+ 0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */
+ 0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */
+ 0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */
+ 0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */
+ 0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */
+ 0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */
+ 0x00, /* 0x55 */ 0x56, /* KEY_Less */
+ 0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */
+ 0x66, /* KEY_Home */ 0x67, /* KEY_Up */
+ 0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */
+ 0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */
+ 0x6b, /* KEY_End */ 0x6c, /* KEY_Down */
+ 0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */
+ 0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */
+ 0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */
+ 0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */
+ 0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */
+ 0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */
+ 0x7A, /* KEY_Menu/FOCUS_PF11 */ 0x00, /* 0x6e */
+ 0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */
+ 0x00, /* 0x71 */ 0x00, /* 0x72 */
+ 0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */
+ 0x00, /* 0x75 */ 0x00, /* 0x76 */
+ 0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */
+ 0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */
+ 0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
+ 0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
+ 0x00, /* 0x7f */
};
/** Create a private structure for use within this file. */
-pointer kbdLinuxCreatePrivate(DeviceIntPtr pKeyboard)
+pointer
+kbdLinuxCreatePrivate(DeviceIntPtr pKeyboard)
{
myPrivate *priv = calloc(1, sizeof(*priv));
- priv->fd = -1;
+
+ priv->fd = -1;
priv->pKeyboard = pKeyboard;
return priv;
}
/** Destroy a private structure. */
-void kbdLinuxDestroyPrivate(pointer priv)
+void
+kbdLinuxDestroyPrivate(pointer priv)
{
free(priv);
}
@@ -387,36 +394,37 @@ void kbdLinuxDestroyPrivate(pointer priv)
* if we ignore the volume and set the duration correctly, then we'll
* get one parameter "wrong" -- but if we use the volume to scale the
* duration, then we'll get both parameters "wrong"). */
-void kbdLinuxBell(DevicePtr pDev, int percent,
- int volume, int pitch, int duration)
+void
+kbdLinuxBell(DevicePtr pDev, int percent, int volume, int pitch, int duration)
{
GETPRIV;
if (duration && pitch) {
- ioctl(priv->fd,
- KDMKTONE,
- ((1193190 / pitch) & 0xffff) /* Low bits specify cycle time */
- | (duration << 16)); /* High bits are duration in msec */
+ ioctl(priv->fd, KDMKTONE, ((1193190 / pitch) & 0xffff) /* Low bits specify cycle time */
+ |(duration << 16)); /* High bits are duration in msec */
}
}
/** Set the LEDs. */
-void kbdLinuxCtrl(DevicePtr pDev, KeybdCtrl *ctrl)
+void
+kbdLinuxCtrl(DevicePtr pDev, KeybdCtrl * ctrl)
{
GETPRIV;
ioctl(priv->fd, KDSETLED, ctrl->leds & 0x07);
}
-static int kbdLinuxGetFreeVTNumber(void)
+static int
+kbdLinuxGetFreeVTNumber(void)
{
- int fd = -1;
- int vtno;
- int i;
+ int fd = -1;
+ int vtno;
+ int i;
const char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL };
-
+
for (i = 0; tty0[i]; i++)
- if ((fd = open(tty0[i], O_WRONLY, 0)) >= 0) break;
+ if ((fd = open(tty0[i], O_WRONLY, 0)) >= 0)
+ break;
if (fd < 0)
FATAL1("kbdLinuxGetFreeVTNumber: Cannot open tty0 (%s)\n",
strerror(errno));
@@ -425,16 +433,18 @@ static int kbdLinuxGetFreeVTNumber(void)
return vtno;
}
-static int kbdLinuxOpenVT(int vtno)
+static int
+kbdLinuxOpenVT(int vtno)
{
- int fd = -1;
- int i;
+ int fd = -1;
+ int i;
const char *vcs[] = { "/dev/vc/", "/dev/tty", NULL };
- char name[64]; /* RATS: Only used in snprintf */
+ char name[64]; /* RATS: Only used in snprintf */
for (i = 0; vcs[i]; i++) {
snprintf(name, sizeof(name), "%s%d", vcs[i], vtno);
- if ((fd = open(name, O_RDWR | O_NONBLOCK, 0)) >= 0) break;
+ if ((fd = open(name, O_RDWR | O_NONBLOCK, 0)) >= 0)
+ break;
}
if (fd < 0)
FATAL2("kbdLinuxOpenVT: Cannot open VT %d (%s)\n",
@@ -442,23 +452,27 @@ static int kbdLinuxOpenVT(int vtno)
return fd;
}
-static int kbdLinuxGetCurrentVTNumber(int fd)
+static int
+kbdLinuxGetCurrentVTNumber(int fd)
{
struct vt_stat vts;
-
- if (!ioctl(fd, VT_GETSTATE, &vts)) return vts.v_active;
+
+ if (!ioctl(fd, VT_GETSTATE, &vts))
+ return vts.v_active;
return -1;
}
static int kbdLinuxActivate(int fd, int vtno, int setSig);
/** Currently unused hook called prior to an VT switch. */
-void kbdLinuxVTPreSwitch(pointer p)
+void
+kbdLinuxVTPreSwitch(pointer p)
{
}
/** Currently unused hook called after returning from a VT switch. */
-void kbdLinuxVTPostSwitch(pointer p)
+void
+kbdLinuxVTPostSwitch(pointer p)
{
}
@@ -466,28 +480,31 @@ void kbdLinuxVTPostSwitch(pointer p)
* function is called with the \a switch_return_data when the VT is
* switched back to the pre-switch VT (i.e., the user returns to the DMX
* session). */
-int kbdLinuxVTSwitch(pointer p, int vt,
- void (*switch_return)(pointer),
- pointer switch_return_data)
+int
+kbdLinuxVTSwitch(pointer p, int vt,
+ void (*switch_return) (pointer), pointer switch_return_data)
{
myPrivate *priv = p;
- if (priv->switched) FATAL0("kbdLinuxVTSwitch: already switched...\n");
- if (priv->vtno == vt) return 0;
+ if (priv->switched)
+ FATAL0("kbdLinuxVTSwitch: already switched...\n");
+ if (priv->vtno == vt)
+ return 0;
- PRIV = priv;
- priv->switched = 0; /* Will switch to 1 in handler */
- priv->switch_return = switch_return;
+ PRIV = priv;
+ priv->switched = 0; /* Will switch to 1 in handler */
+ priv->switch_return = switch_return;
priv->switch_return_data = switch_return_data;
kbdLinuxActivate(priv->fd, vt, 0);
return 1;
}
/* RATS: This function is only ever used to handle SIGUSR1. */
-static void kbdLinuxVTSignalHandler(int sig)
+static void
+kbdLinuxVTSignalHandler(int sig)
{
myPrivate *priv = PRIV;
-
+
signal(sig, kbdLinuxVTSignalHandler);
if (priv) {
ioctl(priv->fd, VT_RELDISP, VT_ACKACQ);
@@ -499,19 +516,23 @@ static void kbdLinuxVTSignalHandler(int sig)
}
}
-static int kbdLinuxActivate(int fd, int vtno, int setSig)
+static int
+kbdLinuxActivate(int fd, int vtno, int setSig)
{
- int result;
+ int result;
struct vt_mode VT;
SYSCALL(result = ioctl(fd, VT_ACTIVATE, vtno));
- if (result) FATAL0("kbdLinuxActivate: VT_ACTIVATE failed\n");
+ if (result)
+ FATAL0("kbdLinuxActivate: VT_ACTIVATE failed\n");
SYSCALL(result = ioctl(fd, VT_WAITACTIVE, vtno));
- if (result) FATAL0("kbdLinuxActivate: VT_WAITACTIVE failed\n");
+ if (result)
+ FATAL0("kbdLinuxActivate: VT_WAITACTIVE failed\n");
if (setSig) {
SYSCALL(result = ioctl(fd, VT_GETMODE, &VT));
- if (result < 0) FATAL0("kbdLinuxActivate: VT_GETMODE failed\n");
- VT.mode = VT_PROCESS;
+ if (result < 0)
+ FATAL0("kbdLinuxActivate: VT_GETMODE failed\n");
+ VT.mode = VT_PROCESS;
VT.relsig = SIGUSR1;
VT.acqsig = SIGUSR1;
if (ioctl(fd, VT_SETMODE, &VT))
@@ -521,86 +542,148 @@ static int kbdLinuxActivate(int fd, int vtno, int setSig)
return Success;
}
-static void kbdLinuxOpenConsole(DevicePtr pDev)
+static void
+kbdLinuxOpenConsole(DevicePtr pDev)
{
GETPRIV;
const char *msg = MESSAGE;
- if (priv->fd >= 0) return;
- priv->vtno = kbdLinuxGetFreeVTNumber();
- priv->fd = kbdLinuxOpenVT(priv->vtno);
+ if (priv->fd >= 0)
+ return;
+ priv->vtno = kbdLinuxGetFreeVTNumber();
+ priv->fd = kbdLinuxOpenVT(priv->vtno);
priv->vtcurrent = kbdLinuxGetCurrentVTNumber(priv->fd);
LOG2("kbdLinuxOpenConsole: current VT %d; using free VT %d\n",
priv->vtcurrent, priv->vtno);
kbdLinuxActivate(priv->fd, priv->vtno, 1);
- ioctl(priv->fd, KDSETMODE, KD_GRAPHICS); /* To turn off gpm */
- if (msg) write(priv->fd, msg, strlen(msg));
+ ioctl(priv->fd, KDSETMODE, KD_GRAPHICS); /* To turn off gpm */
+ if (msg)
+ write(priv->fd, msg, strlen(msg));
}
-static void kbdLinuxCloseConsole(DevicePtr pDev)
+static void
+kbdLinuxCloseConsole(DevicePtr pDev)
{
GETPRIV;
struct vt_mode VT;
- const char *msg = FINALMESSAGE;
+ const char *msg = FINALMESSAGE;
- if (priv->fd < 0) return;
+ if (priv->fd < 0)
+ return;
ioctl(priv->fd, KDSETMODE, KD_TEXT);
- if (msg) write(priv->fd, msg, strlen(msg));
+ if (msg)
+ write(priv->fd, msg, strlen(msg));
if (ioctl(priv->fd, VT_GETMODE, &VT) != -1) {
VT.mode = VT_AUTO;
ioctl(priv->fd, VT_SETMODE, &VT);
}
LOG1("kbdLinuxCloseConsole: switching to VT %d\n", priv->vtcurrent);
- if (priv->vtcurrent >= 0) kbdLinuxActivate(priv->fd, priv->vtcurrent, 0);
-
+ if (priv->vtcurrent >= 0)
+ kbdLinuxActivate(priv->fd, priv->vtcurrent, 0);
+
close(priv->fd);
priv->fd = -1;
}
/** Initialize the \a pDev as a Linux keyboard. */
-void kbdLinuxInit(DevicePtr pDev)
+void
+kbdLinuxInit(DevicePtr pDev)
{
GETPRIV;
- if (priv->fd <= 0) kbdLinuxOpenConsole(pDev);
-
+ if (priv->fd <= 0)
+ kbdLinuxOpenConsole(pDev);
+
ioctl(priv->fd, KDGKBMODE, &priv->kbdtrans);
if (tcgetattr(priv->fd, &priv->kbdtty) < 0)
FATAL1("kbdLinuxInit: tcgetattr failed (%s)\n", strerror(errno));
}
-static int kbdLinuxPrefix0Mapping(unsigned char *scanCode)
+static int
+kbdLinuxPrefix0Mapping(unsigned char *scanCode)
{
- /* Table from xfree86/common/xf86Events.c */
+ /* Table from xfree86/common/xf86Events.c */
switch (*scanCode) {
- case KEY_KP_7: *scanCode = KEY_Home; break; /* curs home */
- case KEY_KP_8: *scanCode = KEY_Up; break; /* curs up */
- case KEY_KP_9: *scanCode = KEY_PgUp; break; /* curs pgup */
- case KEY_KP_4: *scanCode = KEY_Left; break; /* curs left */
- case KEY_KP_5: *scanCode = KEY_Begin; break; /* curs begin */
- case KEY_KP_6: *scanCode = KEY_Right; break; /* curs right */
- case KEY_KP_1: *scanCode = KEY_End; break; /* curs end */
- case KEY_KP_2: *scanCode = KEY_Down; break; /* curs down */
- case KEY_KP_3: *scanCode = KEY_PgDown; break; /* curs pgdown */
- case KEY_KP_0: *scanCode = KEY_Insert; break; /* curs insert */
- case KEY_KP_Decimal: *scanCode = KEY_Delete; break; /* curs delete */
- case KEY_Enter: *scanCode = KEY_KP_Enter; break; /* keypad enter */
- case KEY_LCtrl: *scanCode = KEY_RCtrl; break; /* right ctrl */
- case KEY_KP_Multiply: *scanCode = KEY_Print; break; /* print */
- case KEY_Slash: *scanCode = KEY_KP_Divide; break; /* keyp divide */
- case KEY_Alt: *scanCode = KEY_AltLang; break; /* right alt */
- case KEY_ScrollLock: *scanCode = KEY_Break; break; /* curs break */
- case 0x5b: *scanCode = KEY_LMeta; break;
- case 0x5c: *scanCode = KEY_RMeta; break;
- case 0x5d: *scanCode = KEY_Menu; break;
- case KEY_F3: *scanCode = KEY_F13; break;
- case KEY_F4: *scanCode = KEY_F14; break;
- case KEY_F5: *scanCode = KEY_F15; break;
- case KEY_F6: *scanCode = KEY_F16; break;
- case KEY_F7: *scanCode = KEY_F17; break;
- case KEY_KP_Plus: *scanCode = KEY_KP_DEC; break;
+ case KEY_KP_7:
+ *scanCode = KEY_Home;
+ break; /* curs home */
+ case KEY_KP_8:
+ *scanCode = KEY_Up;
+ break; /* curs up */
+ case KEY_KP_9:
+ *scanCode = KEY_PgUp;
+ break; /* curs pgup */
+ case KEY_KP_4:
+ *scanCode = KEY_Left;
+ break; /* curs left */
+ case KEY_KP_5:
+ *scanCode = KEY_Begin;
+ break; /* curs begin */
+ case KEY_KP_6:
+ *scanCode = KEY_Right;
+ break; /* curs right */
+ case KEY_KP_1:
+ *scanCode = KEY_End;
+ break; /* curs end */
+ case KEY_KP_2:
+ *scanCode = KEY_Down;
+ break; /* curs down */
+ case KEY_KP_3:
+ *scanCode = KEY_PgDown;
+ break; /* curs pgdown */
+ case KEY_KP_0:
+ *scanCode = KEY_Insert;
+ break; /* curs insert */
+ case KEY_KP_Decimal:
+ *scanCode = KEY_Delete;
+ break; /* curs delete */
+ case KEY_Enter:
+ *scanCode = KEY_KP_Enter;
+ break; /* keypad enter */
+ case KEY_LCtrl:
+ *scanCode = KEY_RCtrl;
+ break; /* right ctrl */
+ case KEY_KP_Multiply:
+ *scanCode = KEY_Print;
+ break; /* print */
+ case KEY_Slash:
+ *scanCode = KEY_KP_Divide;
+ break; /* keyp divide */
+ case KEY_Alt:
+ *scanCode = KEY_AltLang;
+ break; /* right alt */
+ case KEY_ScrollLock:
+ *scanCode = KEY_Break;
+ break; /* curs break */
+ case 0x5b:
+ *scanCode = KEY_LMeta;
+ break;
+ case 0x5c:
+ *scanCode = KEY_RMeta;
+ break;
+ case 0x5d:
+ *scanCode = KEY_Menu;
+ break;
+ case KEY_F3:
+ *scanCode = KEY_F13;
+ break;
+ case KEY_F4:
+ *scanCode = KEY_F14;
+ break;
+ case KEY_F5:
+ *scanCode = KEY_F15;
+ break;
+ case KEY_F6:
+ *scanCode = KEY_F16;
+ break;
+ case KEY_F7:
+ *scanCode = KEY_F17;
+ break;
+ case KEY_KP_Plus:
+ *scanCode = KEY_KP_DEC;
+ break;
/*
* Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6)
*/
@@ -618,12 +701,13 @@ static int kbdLinuxPrefix0Mapping(unsigned char *scanCode)
return 0;
}
-static int kbdLinuxPrefixMapping(myPrivate *priv, unsigned char *scanCode)
+static int
+kbdLinuxPrefixMapping(myPrivate * priv, unsigned char *scanCode)
{
- int pressed = *scanCode & 0x80;
- unsigned char code = *scanCode & 0x7f;
+ int pressed = *scanCode & 0x80;
+ unsigned char code = *scanCode & 0x7f;
- /* If we don't have a prefix, check for one */
+ /* If we don't have a prefix, check for one */
if (!priv->prefix) {
switch (code) {
case KEY_Prefix0:
@@ -634,43 +718,45 @@ static int kbdLinuxPrefixMapping(myPrivate *priv, unsigned char *scanCode)
return 0; /* No change */
}
- /* We have a prefix from the last scanCode */
+ /* We have a prefix from the last scanCode */
switch (priv->prefix) {
case KEY_Prefix0:
priv->prefix = 0;
- if (kbdLinuxPrefix0Mapping(&code)) return 1; /* Skip sequence */
+ if (kbdLinuxPrefix0Mapping(&code))
+ return 1; /* Skip sequence */
break;
case KEY_Prefix1:
priv->prefix = (code = KEY_LCtrl) ? KEY_LCtrl : 0;
- return 1; /* Use new prefix */
+ return 1; /* Use new prefix */
case KEY_LCtrl:
priv->prefix = 0;
- if (code != KEY_NumLock) return 1; /* Skip sequence*/
+ if (code != KEY_NumLock)
+ return 1; /* Skip sequence */
code = KEY_Pause;
break;
}
*scanCode = code | (pressed ? 0x80 : 0x00);
- return 0; /* Use old scanCode */
+ return 0; /* Use old scanCode */
}
-static void kbdLinuxConvert(DevicePtr pDev,
- unsigned char scanCode,
- ENQUEUEPROC enqueue,
- CHECKPROC checkspecial,
- BLOCK block)
+static void
+kbdLinuxConvert(DevicePtr pDev,
+ unsigned char scanCode,
+ ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
{
GETPRIV;
- XkbSrvInfoPtr xkbi = priv->pKeyboard->key->xkbInfo;
- int type;
- KeySym keySym = NoSymbol;
- int keyCode;
- int switching;
+ XkbSrvInfoPtr xkbi = priv->pKeyboard->key->xkbInfo;
+ int type;
+ KeySym keySym = NoSymbol;
+ int keyCode;
+ int switching;
/* Do special PC/AT prefix mapping -- may change scanCode! */
- if (kbdLinuxPrefixMapping(priv, &scanCode)) return;
+ if (kbdLinuxPrefixMapping(priv, &scanCode))
+ return;
- type = (scanCode & 0x80) ? KeyRelease : KeyPress;
+ type = (scanCode & 0x80) ? KeyRelease : KeyPress;
keyCode = (scanCode & 0x7f) + MIN_KEYCODE;
/* Handle repeats */
@@ -681,6 +767,7 @@ static void kbdLinuxConvert(DevicePtr pDev,
int effectiveGroup = XkbGetEffectiveGroup(xkbi,
&xkbi->state,
scanCode);
+
keySym = XkbKeySym(xkbi->desc, scanCode, effectiveGroup);
#if 0
switch (keySym) {
@@ -689,9 +776,12 @@ static void kbdLinuxConvert(DevicePtr pDev,
case XK_Shift_Lock:
case XK_Caps_Lock:
/* Ignore releases and all but first press */
- if (kbdLinuxModIgnore(priv, &xE, keySym)) return;
- if (kbdLinuxKeyDown(priv, &xE)) xE.u.u.type = KeyRelease;
- else xE.u.u.type = KeyPress;
+ if (kbdLinuxModIgnore(priv, &xE, keySym))
+ return;
+ if (kbdLinuxKeyDown(priv, &xE))
+ xE.u.u.type = KeyRelease;
+ else
+ xE.u.u.type = KeyPress;
break;
}
#endif
@@ -703,17 +793,18 @@ static void kbdLinuxConvert(DevicePtr pDev,
/* No auto-repeat? */
if ((feed && !feed->ctrl.autoRepeat)
|| priv->pKeyboard->key->xkbInfo->desc->map->modmap[keyCode]
- || (feed
- && !(feed->ctrl.autoRepeats[keyCode >> 3]
- & (1 << (keyCode & 7))))) return; /* Ignore */
-
+ || (feed && !(feed->ctrl.autoRepeats[keyCode >> 3]
+ & (1 << (keyCode & 7)))))
+ return; /* Ignore */
+
/* Do auto-repeat */
enqueue(pDev, KeyRelease, keyCode, keySym, NULL, block);
type = KeyPress;
}
-
+
/* If key is already up, ignore */
- if (type == KeyRelease && !kbdLinuxKeyDown(priv, keyCode)) return;
+ if (type == KeyRelease && !kbdLinuxKeyDown(priv, keyCode))
+ return;
}
switching = 0;
@@ -722,7 +813,7 @@ static void kbdLinuxConvert(DevicePtr pDev,
if (!switching) {
if (enqueue)
enqueue(pDev, type, keyCode, keySym, NULL, block);
- kbdLinuxKeyState(priv, type, keyCode); /* Update our state bitmap */
+ kbdLinuxKeyState(priv, type, keyCode); /* Update our state bitmap */
}
}
@@ -732,16 +823,15 @@ static void kbdLinuxConvert(DevicePtr pDev,
* with the \a enqueue function. The \a block type is passed to the
* functions so that they may block SIGIO handling as appropriate to the
* caller of this function. */
-void kbdLinuxRead(DevicePtr pDev,
- MOTIONPROC motion,
- ENQUEUEPROC enqueue,
- CHECKPROC checkspecial,
- BLOCK block)
+void
+kbdLinuxRead(DevicePtr pDev,
+ MOTIONPROC motion,
+ ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
{
GETPRIV;
unsigned char buf[256]; /* RATS: Only used in length-limited call */
unsigned char *pt;
- int n;
+ int n;
while ((n = read(priv->fd, buf, sizeof(buf))) > 0)
for (pt = buf; n; --n, ++pt)
@@ -749,20 +839,21 @@ void kbdLinuxRead(DevicePtr pDev,
}
/** Turn \a pDev on (i.e., take input from \a pDev). */
-int kbdLinuxOn(DevicePtr pDev)
+int
+kbdLinuxOn(DevicePtr pDev)
{
GETPRIV;
struct termios nTty;
ioctl(priv->fd, KDSKBMODE, K_RAW);
- nTty = priv->kbdtty;
- nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
- nTty.c_oflag = 0;
- nTty.c_cflag = CREAD | CS8;
- nTty.c_lflag = 0;
+ nTty = priv->kbdtty;
+ nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
+ nTty.c_oflag = 0;
+ nTty.c_cflag = CREAD | CS8;
+ nTty.c_lflag = 0;
nTty.c_cc[VTIME] = 0;
- nTty.c_cc[VMIN] = 1;
+ nTty.c_cc[VMIN] = 1;
cfsetispeed(&nTty, B9600);
cfsetospeed(&nTty, B9600);
if (tcsetattr(priv->fd, TCSANOW, &nTty) < 0)
@@ -771,7 +862,8 @@ int kbdLinuxOn(DevicePtr pDev)
}
/** Turn \a pDev off (i.e., stop taking input from \a pDev). */
-void kbdLinuxOff(DevicePtr pDev)
+void
+kbdLinuxOff(DevicePtr pDev)
{
GETPRIV;
@@ -780,165 +872,261 @@ void kbdLinuxOff(DevicePtr pDev)
kbdLinuxCloseConsole(pDev);
}
-
-static void kbdLinuxReadKernelMapping(int fd, KeySymsPtr pKeySyms)
+static void
+kbdLinuxReadKernelMapping(int fd, KeySymsPtr pKeySyms)
{
- KeySym *k;
- int i;
- int maxkey;
- static unsigned char tbl[GLYPHS_PER_KEY] = { /* RATS: Use ok */
- 0, /* unshifted */
- 1, /* shifted */
- 0, /* modeswitch unshifted */
- 0 /* modeswitch shifted */
+ KeySym *k;
+ int i;
+ int maxkey;
+
+ static unsigned char tbl[GLYPHS_PER_KEY] = { /* RATS: Use ok */
+ 0, /* unshifted */
+ 1, /* shifted */
+ 0, /* modeswitch unshifted */
+ 0 /* modeswitch shifted */
};
- /*
- * Read the mapping from the kernel.
- * Since we're still using the XFree86 scancode->AT keycode mapping
- * routines, we need to convert the AT keycodes to Linux keycodes,
- * then translate the Linux keysyms into X keysyms.
- *
- * First, figure out which tables to use for the modeswitch columns
- * above, from the XF86Config fields.
- */
- tbl[2] = 8; /* alt */
- tbl[3] = tbl[2] | 1;
-
-#if 00/*BP*/
- k = map+GLYPHS_PER_KEY;
+ /*
+ * Read the mapping from the kernel.
+ * Since we're still using the XFree86 scancode->AT keycode mapping
+ * routines, we need to convert the AT keycodes to Linux keycodes,
+ * then translate the Linux keysyms into X keysyms.
+ *
+ * First, figure out which tables to use for the modeswitch columns
+ * above, from the XF86Config fields.
+ */
+ tbl[2] = 8; /* alt */
+ tbl[3] = tbl[2] | 1;
+
+#if 00 /*BP*/
+ k = map + GLYPHS_PER_KEY;
#else
- ErrorF("kbdLinuxReadKernelMapping() is broken/no-op'd\n");
- return;
+ ErrorF("kbdLinuxReadKernelMapping() is broken/no-op'd\n");
+ return;
#endif
- maxkey = NUM_AT2LNX;
-
- for (i = 0; i < maxkey; ++i) {
- struct kbentry kbe;
- int j;
-
- kbe.kb_index = at2lnx[i];
-
- for (j = 0; j < GLYPHS_PER_KEY; ++j, ++k) {
- unsigned short kval;
-
- *k = NoSymbol;
-
- kbe.kb_table = tbl[j];
- if (kbe.kb_index == 0 || ioctl(fd, KDGKBENT, &kbe)) continue;
-
- kval = KVAL(kbe.kb_value);
- switch (KTYP(kbe.kb_value)) {
- case KT_LATIN:
- case KT_LETTER: *k = linux_to_x[kval]; break;
- case KT_FN:
- if (kval <= 19) *k = XK_F1 + kval;
- else switch (kbe.kb_value) {
- case K_FIND: *k = XK_Home; /* or XK_Find */ break;
- case K_INSERT: *k = XK_Insert; break;
- case K_REMOVE: *k = XK_Delete; break;
- case K_SELECT: *k = XK_End; /* or XK_Select */ break;
- case K_PGUP: *k = XK_Prior; break;
- case K_PGDN: *k = XK_Next; break;
- case K_HELP: *k = XK_Help; break;
- case K_DO: *k = XK_Execute; break;
- case K_PAUSE: *k = XK_Pause; break;
- case K_MACRO: *k = XK_Menu; break;
- default: break;
- }
- break;
- case KT_SPEC:
- switch (kbe.kb_value) {
- case K_ENTER: *k = XK_Return; break;
- case K_BREAK: *k = XK_Break; break;
- case K_CAPS: *k = XK_Caps_Lock; break;
- case K_NUM: *k = XK_Num_Lock; break;
- case K_HOLD: *k = XK_Scroll_Lock; break;
- case K_COMPOSE: *k = XK_Multi_key; break;
- default: break;
- }
- break;
- case KT_PAD:
- switch (kbe.kb_value) {
- case K_PPLUS: *k = XK_KP_Add; break;
- case K_PMINUS: *k = XK_KP_Subtract; break;
- case K_PSTAR: *k = XK_KP_Multiply; break;
- case K_PSLASH: *k = XK_KP_Divide; break;
- case K_PENTER: *k = XK_KP_Enter; break;
- case K_PCOMMA: *k = XK_KP_Separator; break;
- case K_PDOT: *k = XK_KP_Decimal; break;
- case K_PPLUSMINUS: *k = XK_KP_Subtract; break;
- default: if (kval <= 9) *k = XK_KP_0 + kval; break;
- }
- break;
- case KT_DEAD:
- /* KT_DEAD keys are for accelerated diacritical creation. */
- switch (kbe.kb_value) {
- case K_DGRAVE: *k = XK_dead_grave; break;
- case K_DACUTE: *k = XK_dead_acute; break;
- case K_DCIRCM: *k = XK_dead_circumflex; break;
- case K_DTILDE: *k = XK_dead_tilde; break;
- case K_DDIERE: *k = XK_dead_diaeresis; break;
- }
- break;
- case KT_CUR:
- switch (kbe.kb_value) {
- case K_DOWN: *k = XK_Down; break;
- case K_LEFT: *k = XK_Left; break;
- case K_RIGHT: *k = XK_Right; break;
- case K_UP: *k = XK_Up; break;
- }
- break;
- case KT_SHIFT:
- switch (kbe.kb_value) {
- case K_ALTGR: *k = XK_Alt_R; break;
- case K_ALT:
- *k = (kbe.kb_index == 0x64 ? XK_Alt_R : XK_Alt_L);
- break;
- case K_CTRL:
- *k = (kbe.kb_index == 0x61 ? XK_Control_R : XK_Control_L);
- break;
- case K_CTRLL: *k = XK_Control_L; break;
- case K_CTRLR: *k = XK_Control_R; break;
- case K_SHIFT:
- *k = (kbe.kb_index == 0x36 ? XK_Shift_R : XK_Shift_L);
- break;
- case K_SHIFTL: *k = XK_Shift_L; break;
- case K_SHIFTR: *k = XK_Shift_R; break;
- default: break;
- }
- break;
- case KT_ASCII:
- /* KT_ASCII keys accumulate a 3 digit decimal number that
- * gets emitted when the shift state changes. We can't
- * emulate that.
- */
- break;
- case KT_LOCK:
- if (kbe.kb_value == K_SHIFTLOCK) *k = XK_Shift_Lock;
- break;
- default: break;
- }
- }
-
- if (k[-1] == k[-2]) k[-1] = NoSymbol;
- if (k[-2] == k[-3]) k[-2] = NoSymbol;
- if (k[-3] == k[-4]) k[-3] = NoSymbol;
- if (k[-4] == k[-2] && k[-3] == k[-1]) k[-2] = k[-1] = NoSymbol;
- if (k[-1] == k[-4] && k[-2] == k[-3]
- && k[-2] == NoSymbol) k[-1] = NoSymbol;
- }
+ maxkey = NUM_AT2LNX;
+
+ for (i = 0; i < maxkey; ++i) {
+ struct kbentry kbe;
+ int j;
+
+ kbe.kb_index = at2lnx[i];
+
+ for (j = 0; j < GLYPHS_PER_KEY; ++j, ++k) {
+ unsigned short kval;
+
+ *k = NoSymbol;
+
+ kbe.kb_table = tbl[j];
+ if (kbe.kb_index == 0 || ioctl(fd, KDGKBENT, &kbe))
+ continue;
+
+ kval = KVAL(kbe.kb_value);
+ switch (KTYP(kbe.kb_value)) {
+ case KT_LATIN:
+ case KT_LETTER:
+ *k = linux_to_x[kval];
+ break;
+ case KT_FN:
+ if (kval <= 19)
+ *k = XK_F1 + kval;
+ else
+ switch (kbe.kb_value) {
+ case K_FIND:
+ *k = XK_Home; /* or XK_Find */
+ break;
+ case K_INSERT:
+ *k = XK_Insert;
+ break;
+ case K_REMOVE:
+ *k = XK_Delete;
+ break;
+ case K_SELECT:
+ *k = XK_End; /* or XK_Select */
+ break;
+ case K_PGUP:
+ *k = XK_Prior;
+ break;
+ case K_PGDN:
+ *k = XK_Next;
+ break;
+ case K_HELP:
+ *k = XK_Help;
+ break;
+ case K_DO:
+ *k = XK_Execute;
+ break;
+ case K_PAUSE:
+ *k = XK_Pause;
+ break;
+ case K_MACRO:
+ *k = XK_Menu;
+ break;
+ default:
+ break;
+ }
+ break;
+ case KT_SPEC:
+ switch (kbe.kb_value) {
+ case K_ENTER:
+ *k = XK_Return;
+ break;
+ case K_BREAK:
+ *k = XK_Break;
+ break;
+ case K_CAPS:
+ *k = XK_Caps_Lock;
+ break;
+ case K_NUM:
+ *k = XK_Num_Lock;
+ break;
+ case K_HOLD:
+ *k = XK_Scroll_Lock;
+ break;
+ case K_COMPOSE:
+ *k = XK_Multi_key;
+ break;
+ default:
+ break;
+ }
+ break;
+ case KT_PAD:
+ switch (kbe.kb_value) {
+ case K_PPLUS:
+ *k = XK_KP_Add;
+ break;
+ case K_PMINUS:
+ *k = XK_KP_Subtract;
+ break;
+ case K_PSTAR:
+ *k = XK_KP_Multiply;
+ break;
+ case K_PSLASH:
+ *k = XK_KP_Divide;
+ break;
+ case K_PENTER:
+ *k = XK_KP_Enter;
+ break;
+ case K_PCOMMA:
+ *k = XK_KP_Separator;
+ break;
+ case K_PDOT:
+ *k = XK_KP_Decimal;
+ break;
+ case K_PPLUSMINUS:
+ *k = XK_KP_Subtract;
+ break;
+ default:
+ if (kval <= 9)
+ *k = XK_KP_0 + kval;
+ break;
+ }
+ break;
+ case KT_DEAD:
+ /* KT_DEAD keys are for accelerated diacritical creation. */
+ switch (kbe.kb_value) {
+ case K_DGRAVE:
+ *k = XK_dead_grave;
+ break;
+ case K_DACUTE:
+ *k = XK_dead_acute;
+ break;
+ case K_DCIRCM:
+ *k = XK_dead_circumflex;
+ break;
+ case K_DTILDE:
+ *k = XK_dead_tilde;
+ break;
+ case K_DDIERE:
+ *k = XK_dead_diaeresis;
+ break;
+ }
+ break;
+ case KT_CUR:
+ switch (kbe.kb_value) {
+ case K_DOWN:
+ *k = XK_Down;
+ break;
+ case K_LEFT:
+ *k = XK_Left;
+ break;
+ case K_RIGHT:
+ *k = XK_Right;
+ break;
+ case K_UP:
+ *k = XK_Up;
+ break;
+ }
+ break;
+ case KT_SHIFT:
+ switch (kbe.kb_value) {
+ case K_ALTGR:
+ *k = XK_Alt_R;
+ break;
+ case K_ALT:
+ *k = (kbe.kb_index == 0x64 ? XK_Alt_R : XK_Alt_L);
+ break;
+ case K_CTRL:
+ *k = (kbe.kb_index == 0x61 ? XK_Control_R : XK_Control_L);
+ break;
+ case K_CTRLL:
+ *k = XK_Control_L;
+ break;
+ case K_CTRLR:
+ *k = XK_Control_R;
+ break;
+ case K_SHIFT:
+ *k = (kbe.kb_index == 0x36 ? XK_Shift_R : XK_Shift_L);
+ break;
+ case K_SHIFTL:
+ *k = XK_Shift_L;
+ break;
+ case K_SHIFTR:
+ *k = XK_Shift_R;
+ break;
+ default:
+ break;
+ }
+ break;
+ case KT_ASCII:
+ /* KT_ASCII keys accumulate a 3 digit decimal number that
+ * gets emitted when the shift state changes. We can't
+ * emulate that.
+ */
+ break;
+ case KT_LOCK:
+ if (kbe.kb_value == K_SHIFTLOCK)
+ *k = XK_Shift_Lock;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (k[-1] == k[-2])
+ k[-1] = NoSymbol;
+ if (k[-2] == k[-3])
+ k[-2] = NoSymbol;
+ if (k[-3] == k[-4])
+ k[-3] = NoSymbol;
+ if (k[-4] == k[-2] && k[-3] == k[-1])
+ k[-2] = k[-1] = NoSymbol;
+ if (k[-1] == k[-4] && k[-2] == k[-3]
+ && k[-2] == NoSymbol)
+ k[-1] = NoSymbol;
+ }
}
-static void kbdLinuxGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
+static void
+kbdLinuxGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
{
GETPRIV;
- KeySym *k, *mapCopy;
- char type;
- int i;
+ KeySym *k, *mapCopy;
+ char type;
+ int i;
-#if 00/*BP*/
- mapCopy = malloc(sizeof(map));
+#if 00 /*BP*/
+ mapCopy = malloc(sizeof(map));
memcpy(mapCopy, map, sizeof(map));
#else
ErrorF("kbdLinuxGetMap() is broken/no-op'd\n");
@@ -950,41 +1138,57 @@ static void kbdLinuxGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
/* compute the modifier map */
for (i = 0; i < MAP_LENGTH; i++)
pModMap[i] = NoSymbol; /* make sure it is restored */
-
+
for (k = mapCopy, i = MIN_KEYCODE;
- i < NUM_KEYCODES + MIN_KEYCODE;
- i++, k += 4) {
- switch(*k) {
+ i < NUM_KEYCODES + MIN_KEYCODE; i++, k += 4) {
+ switch (*k) {
case XK_Shift_L:
- case XK_Shift_R: pModMap[i] = ShiftMask; break;
+ case XK_Shift_R:
+ pModMap[i] = ShiftMask;
+ break;
case XK_Control_L:
- case XK_Control_R: pModMap[i] = ControlMask; break;
- case XK_Caps_Lock: pModMap[i] = LockMask; break;
+ case XK_Control_R:
+ pModMap[i] = ControlMask;
+ break;
+ case XK_Caps_Lock:
+ pModMap[i] = LockMask;
+ break;
case XK_Alt_L:
- case XK_Alt_R: pModMap[i] = AltMask; break;
- case XK_Num_Lock: pModMap[i] = NumLockMask; break;
- case XK_Scroll_Lock: pModMap[i] = ScrollLockMask; break;
+ case XK_Alt_R:
+ pModMap[i] = AltMask;
+ break;
+ case XK_Num_Lock:
+ pModMap[i] = NumLockMask;
+ break;
+ case XK_Scroll_Lock:
+ pModMap[i] = ScrollLockMask;
+ break;
case XK_Kana_Lock:
- case XK_Kana_Shift: pModMap[i] = KanaMask; break;
- case XK_Mode_switch: pModMap[i] = AltLangMask; break;
+ case XK_Kana_Shift:
+ pModMap[i] = KanaMask;
+ break;
+ case XK_Mode_switch:
+ pModMap[i] = AltLangMask;
+ break;
}
}
priv->kbdType = (ioctl(priv->fd, KDGKBTYPE, &type) < 0) ? KB_101 : type;
- pKeySyms->map = mapCopy; /* Must be XFree'able */
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
+ pKeySyms->map = mapCopy; /* Must be XFree'able */
+ pKeySyms->mapWidth = GLYPHS_PER_KEY;
pKeySyms->minKeyCode = MIN_KEYCODE;
pKeySyms->maxKeyCode = MAX_KEYCODE;
}
/** Fill the \a info structure with information needed to initialize \a
- * pDev. */
-void kbdLinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+ * pDev. */
+void
+kbdLinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
{
- info->keyboard = 1;
- info->keyClass = 1;
+ info->keyboard = 1;
+ info->keyClass = 1;
kbdLinuxGetMap(pDev, &info->keySyms, info->modMap);
- info->focusClass = 1;
+ info->focusClass = 1;
info->kbdFeedbackClass = 1;
}
diff --git a/xorg-server/hw/dmx/input/lnx-ms.c b/xorg-server/hw/dmx/input/lnx-ms.c
index e6d203c4b..7e1acf450 100644
--- a/xorg-server/hw/dmx/input/lnx-ms.c
+++ b/xorg-server/hw/dmx/input/lnx-ms.c
@@ -1,321 +1,348 @@
-/* Portions of this file were derived from the following files:
- *
- **********************************************************************
- *
- * Xserver/hw/kdrive/linux/ms.c
- *
- * Copyright (c) 2001 by Juliusz Chroboczek
- * Copyright (c) 1999 by Keith Packard
- *
- * 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 AUTHORS OR COPYRIGHT HOLDERS
- * 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.
- *
- */
-
-/*
- * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- *
- * This code implements a low-level device driver for a serial MS mouse.
- * The code is derived from code by Juliusz Chroboczek and Keith Packard
- * (see the source code for complete references). */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "inputstr.h"
-#include <X11/Xos.h>
-#include <errno.h>
-#include <termios.h>
-
-/*****************************************************************************/
-/* Define some macros to make it easier to move this file to another
- * part of the Xserver tree. All calls to the dmx* layer are #defined
- * here for the .c file. The .h file will also have to be edited. */
-#include "dmxinputinit.h"
-#include "lnx-ms.h"
-
-#define GETPRIV myPrivate *priv \
- = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
-
-#define LOG0(f) dmxLog(dmxDebug,f)
-#define LOG1(f,a) dmxLog(dmxDebug,f,a)
-#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
-#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
-#define FATAL0(f) dmxLog(dmxFatal,f)
-#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
-#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
-#define MOTIONPROC dmxMotionProcPtr
-#define ENQUEUEPROC dmxEnqueueProcPtr
-#define CHECKPROC dmxCheckSpecialProcPtr
-#define BLOCK DMXBlockType
-
-/* End of interface definitions. */
-/*****************************************************************************/
-
-/* Private area for MS mouse devices. */
-typedef struct _myPrivate {
- DeviceIntPtr pMouse;
- int fd;
- struct termios tty;
- enum {
- button1 = 0x0001,
- button2 = 0x0002,
- button3 = 0x0004,
- button4 = 0x0008,
- button5 = 0x0010
- } buttons;
-} myPrivate;
-
-static int msLinuxReadBytes(int fd, unsigned char *buf, int len, int min)
-{
- int n, tot;
- fd_set set;
- struct timeval tv;
-
- tot = 0;
- while (len) {
- n = read(fd, buf, len);
- if (n > 0) {
- tot += n;
- buf += n;
- len -= n;
- }
- if (tot % min == 0) break;
- FD_ZERO(&set);
- FD_SET(fd, &set);
- tv.tv_sec = 0;
- tv.tv_usec = 100 * 1000;
- n = select(fd + 1, &set, 0, 0, &tv);
- if (n <= 0) break;
- }
- return tot;
-}
-
-static void msLinuxButton(DevicePtr pDev, ENQUEUEPROC enqueue, int buttons,
- BLOCK block)
-{
- GETPRIV;
-
-#define PRESS(b) \
- do { \
- enqueue(pDev, ButtonPress, 0, 0, NULL, block); \
- } while (0)
-
-#define RELEASE(b) \
- do { \
- enqueue(pDev, ButtonRelease, 0, 0, NULL, block); \
- } while (0)
-
- if ((buttons & button1) && !(priv->buttons & button1)) PRESS(1);
- if (!(buttons & button1) && (priv->buttons & button1)) RELEASE(1);
-
- if ((buttons & button2) && !(priv->buttons & button2)) PRESS(2);
- if (!(buttons & button2) && (priv->buttons & button2)) RELEASE(2);
-
- if ((buttons & button3) && !(priv->buttons & button3)) PRESS(3);
- if (!(buttons & button3) && (priv->buttons & button3)) RELEASE(3);
-
- if ((buttons & button4) && !(priv->buttons & button4)) PRESS(4);
- if (!(buttons & button4) && (priv->buttons & button4)) RELEASE(4);
-
- if ((buttons & button5) && !(priv->buttons & button5)) PRESS(5);
- if (!(buttons & button5) && (priv->buttons & button5)) RELEASE(5);
-
- priv->buttons = buttons;
-}
-
-/** Read an event from the \a pDev device. If the event is a motion
- * event, enqueue it with the \a motion function. Otherwise, check for
- * special keys with the \a checkspecial function and enqueue the event
- * with the \a enqueue function. The \a block type is passed to the
- * functions so that they may block SIGIO handling as appropriate to the
- * caller of this function. */
-void msLinuxRead(DevicePtr pDev,
- MOTIONPROC motion,
- ENQUEUEPROC enqueue,
- CHECKPROC checkspecial,
- BLOCK block)
-{
- GETPRIV;
- unsigned char buf[3 * 200]; /* RATS: Use ok */
- unsigned char *b;
- int n;
- int dx, dy, v[2];
-
- while ((n = msLinuxReadBytes(priv->fd, buf, sizeof(buf), 3)) > 0) {
- b = buf;
- while (n >= 3) {
- dx = (char)(((b[0] & 0x03) << 6) | (b[1] & 0x3f));
- dy = (char)(((b[0] & 0x0c) << 4) | (b[2] & 0x3f));
- v[0] = -dx;
- v[1] = -dy;
-
- motion(pDev, v, 0, 2, 1, block);
- msLinuxButton(pDev, enqueue, (((b[0] & 0x10) ? button3 : 0)
- | ((b[0] & 0x20) ? button1 : 0)),
- block);
- n -= 3;
- b += 3;
- }
- }
-}
-
-/** Initialize \a pDev. */
-void msLinuxInit(DevicePtr pDev)
-{
- GETPRIV;
- const char *names[] = { "/dev/serialmouse", "/dev/mouse", NULL };
- int i;
-
- if (priv->fd >=0) return;
-
- for (i = 0; names[i]; i++) {
- if ((priv->fd = open(names[i], O_RDWR | O_NONBLOCK, 0)) >= 0) break;
- }
- if (priv->fd < 0)
- FATAL1("msLinuxInit: Cannot open mouse port (%s)\n",
- strerror(errno));
-
- if (!isatty(priv->fd))
- FATAL1("msLinuxInit: Mouse port %s is not a tty\n", names[i]);
-
- if (tcgetattr(priv->fd, &priv->tty) < 0)
- FATAL1("msLinuxInit: tcgetattr failed (%s)\n", strerror(errno));
-
- write(priv->fd, "*n", 2); /* 1200 baud */
- usleep(100000);
-}
-
-/** Turn \a pDev on (i.e., take input from \a pDev). */
-int msLinuxOn(DevicePtr pDev)
-{
- GETPRIV;
- struct termios nTty;
-
- if (priv->fd < 0) msLinuxInit(pDev);
-
- nTty = priv->tty;
- nTty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR
- | IGNCR | ICRNL | IXON | IXOFF);
- nTty.c_oflag &= ~OPOST;
- nTty.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
- nTty.c_cflag &= ~(CSIZE | PARENB);
- nTty.c_cflag |= CS8 | CLOCAL | CSTOPB;
- nTty.c_cc[VTIME] = 0;
- nTty.c_cc[VMIN] = 1;
- cfsetispeed (&nTty, B1200);
- cfsetospeed (&nTty, B1200);
- if (tcsetattr(priv->fd, TCSANOW, &nTty) < 0)
- FATAL1("msLinuxInit: tcsetattr failed (%s)\n", strerror(errno));
- write(priv->fd, "*V", 2); /* 2 button 3 byte protocol */
- return priv->fd;
-}
-
-/** Turn \a pDev off (i.e., stop taking input from \a pDev). */
-void msLinuxOff(DevicePtr pDev)
-{
- GETPRIV;
-
- tcsetattr(priv->fd, TCSANOW, &priv->tty);
- close(priv->fd);
- priv->fd = -1;
-}
-
-static void msLinuxGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
-{
- int i;
-
- if (nButtons) *nButtons = 3;
- if (map) for (i = 0; i <= *nButtons; i++) map[i] = i;
-}
-
-/** Currently unused hook called prior to an VT switch. */
-void msLinuxVTPreSwitch(pointer p)
-{
-}
-
-/** Currently unused hook called after returning from a VT switch. */
-void msLinuxVTPostSwitch(pointer p)
-{
-}
-
-/** Create a private structure for use within this file. */
-pointer msLinuxCreatePrivate(DeviceIntPtr pMouse)
-{
- myPrivate *priv = calloc(1, sizeof(*priv));
- priv->fd = -1;
- priv->pMouse = pMouse;
- return priv;
-}
-
-/** Destroy a private structure. */
-void msLinuxDestroyPrivate(pointer priv)
-{
- free(priv);
-}
-
-/** Fill the \a info structure with information needed to initialize \a
- * pDev. */
-void msLinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
-{
- info->buttonClass = 1;
- msLinuxGetMap(pDev, info->map, &info->numButtons);
- info->valuatorClass = 1;
- info->numRelAxes = 2;
- info->minval[0] = 0;
- info->maxval[0] = 0;
- info->res[0] = 1;
- info->minres[0] = 0;
- info->maxres[0] = 1;
- info->ptrFeedbackClass = 1;
-}
+/* Portions of this file were derived from the following files:
+ *
+ **********************************************************************
+ *
+ * Xserver/hw/kdrive/linux/ms.c
+ *
+ * Copyright (c) 2001 by Juliusz Chroboczek
+ * Copyright (c) 1999 by Keith Packard
+ *
+ * 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 AUTHORS OR COPYRIGHT HOLDERS
+ * 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.
+ *
+ */
+
+/*
+ * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This code implements a low-level device driver for a serial MS mouse.
+ * The code is derived from code by Juliusz Chroboczek and Keith Packard
+ * (see the source code for complete references). */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "inputstr.h"
+#include <X11/Xos.h>
+#include <errno.h>
+#include <termios.h>
+
+/*****************************************************************************/
+/* Define some macros to make it easier to move this file to another
+ * part of the Xserver tree. All calls to the dmx* layer are #defined
+ * here for the .c file. The .h file will also have to be edited. */
+#include "dmxinputinit.h"
+#include "lnx-ms.h"
+
+#define GETPRIV myPrivate *priv \
+ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
+
+#define LOG0(f) dmxLog(dmxDebug,f)
+#define LOG1(f,a) dmxLog(dmxDebug,f,a)
+#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define FATAL0(f) dmxLog(dmxFatal,f)
+#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
+#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
+#define MOTIONPROC dmxMotionProcPtr
+#define ENQUEUEPROC dmxEnqueueProcPtr
+#define CHECKPROC dmxCheckSpecialProcPtr
+#define BLOCK DMXBlockType
+
+/* End of interface definitions. */
+/*****************************************************************************/
+
+/* Private area for MS mouse devices. */
+typedef struct _myPrivate {
+ DeviceIntPtr pMouse;
+ int fd;
+ struct termios tty;
+ enum {
+ button1 = 0x0001,
+ button2 = 0x0002,
+ button3 = 0x0004,
+ button4 = 0x0008,
+ button5 = 0x0010
+ } buttons;
+} myPrivate;
+
+static int
+msLinuxReadBytes(int fd, unsigned char *buf, int len, int min)
+{
+ int n, tot;
+ fd_set set;
+ struct timeval tv;
+
+ tot = 0;
+ while (len) {
+ n = read(fd, buf, len);
+ if (n > 0) {
+ tot += n;
+ buf += n;
+ len -= n;
+ }
+ if (tot % min == 0)
+ break;
+ FD_ZERO(&set);
+ FD_SET(fd, &set);
+ tv.tv_sec = 0;
+ tv.tv_usec = 100 * 1000;
+ n = select(fd + 1, &set, 0, 0, &tv);
+ if (n <= 0)
+ break;
+ }
+ return tot;
+}
+
+static void
+msLinuxButton(DevicePtr pDev, ENQUEUEPROC enqueue, int buttons, BLOCK block)
+{
+ GETPRIV;
+
+#define PRESS(b) \
+ do { \
+ enqueue(pDev, ButtonPress, 0, 0, NULL, block); \
+ } while (0)
+
+#define RELEASE(b) \
+ do { \
+ enqueue(pDev, ButtonRelease, 0, 0, NULL, block); \
+ } while (0)
+
+ if ((buttons & button1) && !(priv->buttons & button1))
+ PRESS(1);
+ if (!(buttons & button1) && (priv->buttons & button1))
+ RELEASE(1);
+
+ if ((buttons & button2) && !(priv->buttons & button2))
+ PRESS(2);
+ if (!(buttons & button2) && (priv->buttons & button2))
+ RELEASE(2);
+
+ if ((buttons & button3) && !(priv->buttons & button3))
+ PRESS(3);
+ if (!(buttons & button3) && (priv->buttons & button3))
+ RELEASE(3);
+
+ if ((buttons & button4) && !(priv->buttons & button4))
+ PRESS(4);
+ if (!(buttons & button4) && (priv->buttons & button4))
+ RELEASE(4);
+
+ if ((buttons & button5) && !(priv->buttons & button5))
+ PRESS(5);
+ if (!(buttons & button5) && (priv->buttons & button5))
+ RELEASE(5);
+
+ priv->buttons = buttons;
+}
+
+/** Read an event from the \a pDev device. If the event is a motion
+ * event, enqueue it with the \a motion function. Otherwise, check for
+ * special keys with the \a checkspecial function and enqueue the event
+ * with the \a enqueue function. The \a block type is passed to the
+ * functions so that they may block SIGIO handling as appropriate to the
+ * caller of this function. */
+void
+msLinuxRead(DevicePtr pDev,
+ MOTIONPROC motion,
+ ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
+{
+ GETPRIV;
+ unsigned char buf[3 * 200]; /* RATS: Use ok */
+ unsigned char *b;
+ int n;
+ int dx, dy, v[2];
+
+ while ((n = msLinuxReadBytes(priv->fd, buf, sizeof(buf), 3)) > 0) {
+ b = buf;
+ while (n >= 3) {
+ dx = (char) (((b[0] & 0x03) << 6) | (b[1] & 0x3f));
+ dy = (char) (((b[0] & 0x0c) << 4) | (b[2] & 0x3f));
+ v[0] = -dx;
+ v[1] = -dy;
+
+ motion(pDev, v, 0, 2, 1, block);
+ msLinuxButton(pDev, enqueue, (((b[0] & 0x10) ? button3 : 0)
+ | ((b[0] & 0x20) ? button1 : 0)),
+ block);
+ n -= 3;
+ b += 3;
+ }
+ }
+}
+
+/** Initialize \a pDev. */
+void
+msLinuxInit(DevicePtr pDev)
+{
+ GETPRIV;
+ const char *names[] = { "/dev/serialmouse", "/dev/mouse", NULL };
+ int i;
+
+ if (priv->fd >= 0)
+ return;
+
+ for (i = 0; names[i]; i++) {
+ if ((priv->fd = open(names[i], O_RDWR | O_NONBLOCK, 0)) >= 0)
+ break;
+ }
+ if (priv->fd < 0)
+ FATAL1("msLinuxInit: Cannot open mouse port (%s)\n", strerror(errno));
+
+ if (!isatty(priv->fd))
+ FATAL1("msLinuxInit: Mouse port %s is not a tty\n", names[i]);
+
+ if (tcgetattr(priv->fd, &priv->tty) < 0)
+ FATAL1("msLinuxInit: tcgetattr failed (%s)\n", strerror(errno));
+
+ write(priv->fd, "*n", 2); /* 1200 baud */
+ usleep(100000);
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int
+msLinuxOn(DevicePtr pDev)
+{
+ GETPRIV;
+ struct termios nTty;
+
+ if (priv->fd < 0)
+ msLinuxInit(pDev);
+
+ nTty = priv->tty;
+ nTty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR
+ | IGNCR | ICRNL | IXON | IXOFF);
+ nTty.c_oflag &= ~OPOST;
+ nTty.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
+ nTty.c_cflag &= ~(CSIZE | PARENB);
+ nTty.c_cflag |= CS8 | CLOCAL | CSTOPB;
+ nTty.c_cc[VTIME] = 0;
+ nTty.c_cc[VMIN] = 1;
+ cfsetispeed(&nTty, B1200);
+ cfsetospeed(&nTty, B1200);
+ if (tcsetattr(priv->fd, TCSANOW, &nTty) < 0)
+ FATAL1("msLinuxInit: tcsetattr failed (%s)\n", strerror(errno));
+ write(priv->fd, "*V", 2); /* 2 button 3 byte protocol */
+ return priv->fd;
+}
+
+/** Turn \a pDev off (i.e., stop taking input from \a pDev). */
+void
+msLinuxOff(DevicePtr pDev)
+{
+ GETPRIV;
+
+ tcsetattr(priv->fd, TCSANOW, &priv->tty);
+ close(priv->fd);
+ priv->fd = -1;
+}
+
+static void
+msLinuxGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
+{
+ int i;
+
+ if (nButtons)
+ *nButtons = 3;
+ if (map)
+ for (i = 0; i <= *nButtons; i++)
+ map[i] = i;
+}
+
+/** Currently unused hook called prior to an VT switch. */
+void
+msLinuxVTPreSwitch(pointer p)
+{
+}
+
+/** Currently unused hook called after returning from a VT switch. */
+void
+msLinuxVTPostSwitch(pointer p)
+{
+}
+
+/** Create a private structure for use within this file. */
+pointer
+msLinuxCreatePrivate(DeviceIntPtr pMouse)
+{
+ myPrivate *priv = calloc(1, sizeof(*priv));
+
+ priv->fd = -1;
+ priv->pMouse = pMouse;
+ return priv;
+}
+
+/** Destroy a private structure. */
+void
+msLinuxDestroyPrivate(pointer priv)
+{
+ free(priv);
+}
+
+/** Fill the \a info structure with information needed to initialize \a
+ * pDev. */
+void
+msLinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ info->buttonClass = 1;
+ msLinuxGetMap(pDev, info->map, &info->numButtons);
+ info->valuatorClass = 1;
+ info->numRelAxes = 2;
+ info->minval[0] = 0;
+ info->maxval[0] = 0;
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
+ info->ptrFeedbackClass = 1;
+}
diff --git a/xorg-server/hw/dmx/input/lnx-ps2.c b/xorg-server/hw/dmx/input/lnx-ps2.c
index f40441fe7..67c73a0c5 100644
--- a/xorg-server/hw/dmx/input/lnx-ps2.c
+++ b/xorg-server/hw/dmx/input/lnx-ps2.c
@@ -1,289 +1,318 @@
-/* Portions of this file were derived from the following files:
- *
- **********************************************************************
- *
- * Xserver/hw/kdrive/linux/ps2.c
- *
- * Copyright (c) 1999 by Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-/*
- * Copyright 2001,2003 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- *
- * This code implements a low-level device driver for a serial MS mouse.
- * The code is derived from code by Keith Packard (see the source code
- * for complete references). */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "inputstr.h"
-#include <X11/Xos.h>
-#include <errno.h>
-#include <termios.h>
-
-/*****************************************************************************/
-/* Define some macros to make it easier to move this file to another
- * part of the Xserver tree. All calls to the dmx* layer are #defined
- * here for the .c file. The .h file will also have to be edited. */
-#include "dmxinputinit.h"
-#include "lnx-ps2.h"
-
-#define GETPRIV myPrivate *priv \
- = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
-
-#define LOG0(f) dmxLog(dmxDebug,f)
-#define LOG1(f,a) dmxLog(dmxDebug,f,a)
-#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
-#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
-#define FATAL0(f) dmxLog(dmxFatal,f)
-#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
-#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
-#define MOTIONPROC dmxMotionProcPtr
-#define ENQUEUEPROC dmxEnqueueProcPtr
-#define CHECKPROC dmxCheckSpecialProcPtr
-#define BLOCK DMXBlockType
-
-/* End of interface definitions. */
-/*****************************************************************************/
-
-/* Private area for PS/2 devices. */
-typedef struct _myPrivate {
- DeviceIntPtr pMouse;
- int fd;
- enum {
- button1 = 0x0001,
- button2 = 0x0002,
- button3 = 0x0004,
- button4 = 0x0008,
- button5 = 0x0010
- } buttons;
-} myPrivate;
-
-static int ps2LinuxReadBytes(int fd, unsigned char *buf, int len, int min)
-{
- int n, tot;
- fd_set set;
- struct timeval tv;
-
- tot = 0;
- while (len) {
- n = read(fd, buf, len);
- if (n > 0) {
- tot += n;
- buf += n;
- len -= n;
- }
- if (tot % min == 0) break;
- FD_ZERO(&set);
- FD_SET(fd, &set);
- tv.tv_sec = 0;
- tv.tv_usec = 100 * 1000;
- n = select(fd + 1, &set, 0, 0, &tv);
- if (n <= 0) break;
- }
- return tot;
-}
-
-static void ps2LinuxButton(DevicePtr pDev, ENQUEUEPROC enqueue,
- int buttons, BLOCK block)
-{
- GETPRIV;
-
-#define PRESS(b) \
- do { \
- enqueue(pDev, ButtonPress, 0, 0, NULL, block); \
- } while (0)
-
-#define RELEASE(b) \
- do { \
- enqueue(pDev, ButtonRelease, 0, 0, NULL, block); \
- } while (0)
-
- if ((buttons & button1) && !(priv->buttons & button1)) PRESS(1);
- if (!(buttons & button1) && (priv->buttons & button1)) RELEASE(1);
-
- if ((buttons & button2) && !(priv->buttons & button2)) PRESS(2);
- if (!(buttons & button2) && (priv->buttons & button2)) RELEASE(2);
-
- if ((buttons & button3) && !(priv->buttons & button3)) PRESS(3);
- if (!(buttons & button3) && (priv->buttons & button3)) RELEASE(3);
-
- if ((buttons & button4) && !(priv->buttons & button4)) PRESS(4);
- if (!(buttons & button4) && (priv->buttons & button4)) RELEASE(4);
-
- if ((buttons & button5) && !(priv->buttons & button5)) PRESS(5);
- if (!(buttons & button5) && (priv->buttons & button5)) RELEASE(5);
-
- priv->buttons = buttons;
-}
-
-/** Read an event from the \a pDev device. If the event is a motion
- * event, enqueue it with the \a motion function. Otherwise, check for
- * special keys with the \a checkspecial function and enqueue the event
- * with the \a enqueue function. The \a block type is passed to the
- * functions so that they may block SIGIO handling as appropriate to the
- * caller of this function. */
-void ps2LinuxRead(DevicePtr pDev, MOTIONPROC motion,
- ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
-{
- GETPRIV;
- unsigned char buf[3 * 200]; /* RATS: Use ok */
- unsigned char *b;
- int n;
- int dx, dy, v[2];
-
- while ((n = ps2LinuxReadBytes(priv->fd, buf, sizeof(buf), 3)) > 0) {
- b = buf;
- while (n >= 3) {
- dx = b[1] - ((b[0] & 0x10) ? 256 : 0);
- dy = -b[2] + ((b[0] & 0x20) ? 256 : 0);
- v[0] = -dx;
- v[1] = -dy;
-
- motion(pDev, v, 0, 2, 1, block);
- ps2LinuxButton(pDev, enqueue, (((b[0] & 4) ? button2 : 0)
- | ((b[0] & 2) ? button3 : 0)
- | ((b[0] & 1) ? button1 : 0)),
- block);
- n -= 3;
- b += 3;
- }
- }
-}
-
-/** Initialize \a pDev. */
-void ps2LinuxInit(DevicePtr pDev)
-{
- GETPRIV;
- const char *names[] = { "/dev/mouse", "/dev/psaux", NULL };
- int i;
-
- if (priv->fd >=0) return;
-
- for (i = 0; names[i]; i++) {
- if ((priv->fd = open(names[i], O_RDWR | O_NONBLOCK, 0)) >= 0) break;
- }
- if (priv->fd < 0)
- FATAL1("ps2LinuxInit: Cannot open mouse port (%s)\n",
- strerror(errno));
-}
-
-/** Turn \a pDev on (i.e., take input from \a pDev). */
-int ps2LinuxOn(DevicePtr pDev)
-{
- GETPRIV;
-
- if (priv->fd < 0) ps2LinuxInit(pDev);
- return priv->fd;
-}
-
-/** Turn \a pDev off (i.e., stop taking input from \a pDev). */
-void ps2LinuxOff(DevicePtr pDev)
-{
- GETPRIV;
-
- close(priv->fd);
- priv->fd = -1;
-}
-
-static void ps2LinuxGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
-{
- int i;
-
- if (nButtons) *nButtons = 3;
- if (map) for (i = 0; i <= *nButtons; i++) map[i] = i;
-}
-
-/** Currently unused hook called prior to an VT switch. */
-void ps2LinuxVTPreSwitch(pointer p)
-{
-}
-
-/** Currently unused hook called after returning from a VT switch. */
-void ps2LinuxVTPostSwitch(pointer p)
-{
-}
-
-/** Create a private structure for use within this file. */
-pointer ps2LinuxCreatePrivate(DeviceIntPtr pMouse)
-{
- myPrivate *priv = calloc(1, sizeof(*priv));
- priv->fd = -1;
- priv->pMouse = pMouse;
- return priv;
-}
-
-/** Destroy a private structure. */
-void ps2LinuxDestroyPrivate(pointer priv)
-{
- free(priv);
-}
-
-/** Fill the \a info structure with information needed to initialize \a
- * pDev. */
-void ps2LinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
-{
- info->buttonClass = 1;
- ps2LinuxGetMap(pDev, info->map, &info->numButtons);
- info->valuatorClass = 1;
- info->numRelAxes = 2;
- info->minval[0] = 0;
- info->maxval[0] = 0;
- info->res[0] = 1;
- info->minres[0] = 0;
- info->maxres[0] = 1;
- info->ptrFeedbackClass = 1;
-}
+/* Portions of this file were derived from the following files:
+ *
+ **********************************************************************
+ *
+ * Xserver/hw/kdrive/linux/ps2.c
+ *
+ * Copyright (c) 1999 by Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*
+ * Copyright 2001,2003 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This code implements a low-level device driver for a serial MS mouse.
+ * The code is derived from code by Keith Packard (see the source code
+ * for complete references). */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "inputstr.h"
+#include <X11/Xos.h>
+#include <errno.h>
+#include <termios.h>
+
+/*****************************************************************************/
+/* Define some macros to make it easier to move this file to another
+ * part of the Xserver tree. All calls to the dmx* layer are #defined
+ * here for the .c file. The .h file will also have to be edited. */
+#include "dmxinputinit.h"
+#include "lnx-ps2.h"
+
+#define GETPRIV myPrivate *priv \
+ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
+
+#define LOG0(f) dmxLog(dmxDebug,f)
+#define LOG1(f,a) dmxLog(dmxDebug,f,a)
+#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define FATAL0(f) dmxLog(dmxFatal,f)
+#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
+#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
+#define MOTIONPROC dmxMotionProcPtr
+#define ENQUEUEPROC dmxEnqueueProcPtr
+#define CHECKPROC dmxCheckSpecialProcPtr
+#define BLOCK DMXBlockType
+
+/* End of interface definitions. */
+/*****************************************************************************/
+
+/* Private area for PS/2 devices. */
+typedef struct _myPrivate {
+ DeviceIntPtr pMouse;
+ int fd;
+ enum {
+ button1 = 0x0001,
+ button2 = 0x0002,
+ button3 = 0x0004,
+ button4 = 0x0008,
+ button5 = 0x0010
+ } buttons;
+} myPrivate;
+
+static int
+ps2LinuxReadBytes(int fd, unsigned char *buf, int len, int min)
+{
+ int n, tot;
+ fd_set set;
+ struct timeval tv;
+
+ tot = 0;
+ while (len) {
+ n = read(fd, buf, len);
+ if (n > 0) {
+ tot += n;
+ buf += n;
+ len -= n;
+ }
+ if (tot % min == 0)
+ break;
+ FD_ZERO(&set);
+ FD_SET(fd, &set);
+ tv.tv_sec = 0;
+ tv.tv_usec = 100 * 1000;
+ n = select(fd + 1, &set, 0, 0, &tv);
+ if (n <= 0)
+ break;
+ }
+ return tot;
+}
+
+static void
+ps2LinuxButton(DevicePtr pDev, ENQUEUEPROC enqueue, int buttons, BLOCK block)
+{
+ GETPRIV;
+
+#define PRESS(b) \
+ do { \
+ enqueue(pDev, ButtonPress, 0, 0, NULL, block); \
+ } while (0)
+
+#define RELEASE(b) \
+ do { \
+ enqueue(pDev, ButtonRelease, 0, 0, NULL, block); \
+ } while (0)
+
+ if ((buttons & button1) && !(priv->buttons & button1))
+ PRESS(1);
+ if (!(buttons & button1) && (priv->buttons & button1))
+ RELEASE(1);
+
+ if ((buttons & button2) && !(priv->buttons & button2))
+ PRESS(2);
+ if (!(buttons & button2) && (priv->buttons & button2))
+ RELEASE(2);
+
+ if ((buttons & button3) && !(priv->buttons & button3))
+ PRESS(3);
+ if (!(buttons & button3) && (priv->buttons & button3))
+ RELEASE(3);
+
+ if ((buttons & button4) && !(priv->buttons & button4))
+ PRESS(4);
+ if (!(buttons & button4) && (priv->buttons & button4))
+ RELEASE(4);
+
+ if ((buttons & button5) && !(priv->buttons & button5))
+ PRESS(5);
+ if (!(buttons & button5) && (priv->buttons & button5))
+ RELEASE(5);
+
+ priv->buttons = buttons;
+}
+
+/** Read an event from the \a pDev device. If the event is a motion
+ * event, enqueue it with the \a motion function. Otherwise, check for
+ * special keys with the \a checkspecial function and enqueue the event
+ * with the \a enqueue function. The \a block type is passed to the
+ * functions so that they may block SIGIO handling as appropriate to the
+ * caller of this function. */
+void
+ps2LinuxRead(DevicePtr pDev, MOTIONPROC motion,
+ ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
+{
+ GETPRIV;
+ unsigned char buf[3 * 200]; /* RATS: Use ok */
+ unsigned char *b;
+ int n;
+ int dx, dy, v[2];
+
+ while ((n = ps2LinuxReadBytes(priv->fd, buf, sizeof(buf), 3)) > 0) {
+ b = buf;
+ while (n >= 3) {
+ dx = b[1] - ((b[0] & 0x10) ? 256 : 0);
+ dy = -b[2] + ((b[0] & 0x20) ? 256 : 0);
+ v[0] = -dx;
+ v[1] = -dy;
+
+ motion(pDev, v, 0, 2, 1, block);
+ ps2LinuxButton(pDev, enqueue, (((b[0] & 4) ? button2 : 0)
+ | ((b[0] & 2) ? button3 : 0)
+ | ((b[0] & 1) ? button1 : 0)),
+ block);
+ n -= 3;
+ b += 3;
+ }
+ }
+}
+
+/** Initialize \a pDev. */
+void
+ps2LinuxInit(DevicePtr pDev)
+{
+ GETPRIV;
+ const char *names[] = { "/dev/mouse", "/dev/psaux", NULL };
+ int i;
+
+ if (priv->fd >= 0)
+ return;
+
+ for (i = 0; names[i]; i++) {
+ if ((priv->fd = open(names[i], O_RDWR | O_NONBLOCK, 0)) >= 0)
+ break;
+ }
+ if (priv->fd < 0)
+ FATAL1("ps2LinuxInit: Cannot open mouse port (%s)\n", strerror(errno));
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int
+ps2LinuxOn(DevicePtr pDev)
+{
+ GETPRIV;
+
+ if (priv->fd < 0)
+ ps2LinuxInit(pDev);
+ return priv->fd;
+}
+
+/** Turn \a pDev off (i.e., stop taking input from \a pDev). */
+void
+ps2LinuxOff(DevicePtr pDev)
+{
+ GETPRIV;
+
+ close(priv->fd);
+ priv->fd = -1;
+}
+
+static void
+ps2LinuxGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
+{
+ int i;
+
+ if (nButtons)
+ *nButtons = 3;
+ if (map)
+ for (i = 0; i <= *nButtons; i++)
+ map[i] = i;
+}
+
+/** Currently unused hook called prior to an VT switch. */
+void
+ps2LinuxVTPreSwitch(pointer p)
+{
+}
+
+/** Currently unused hook called after returning from a VT switch. */
+void
+ps2LinuxVTPostSwitch(pointer p)
+{
+}
+
+/** Create a private structure for use within this file. */
+pointer
+ps2LinuxCreatePrivate(DeviceIntPtr pMouse)
+{
+ myPrivate *priv = calloc(1, sizeof(*priv));
+
+ priv->fd = -1;
+ priv->pMouse = pMouse;
+ return priv;
+}
+
+/** Destroy a private structure. */
+void
+ps2LinuxDestroyPrivate(pointer priv)
+{
+ free(priv);
+}
+
+/** Fill the \a info structure with information needed to initialize \a
+ * pDev. */
+void
+ps2LinuxGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ info->buttonClass = 1;
+ ps2LinuxGetMap(pDev, info->map, &info->numButtons);
+ info->valuatorClass = 1;
+ info->numRelAxes = 2;
+ info->minval[0] = 0;
+ info->maxval[0] = 0;
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
+ info->ptrFeedbackClass = 1;
+}
diff --git a/xorg-server/hw/dmx/input/usb-common.c b/xorg-server/hw/dmx/input/usb-common.c
index 944033eba..c7c166cce 100644
--- a/xorg-server/hw/dmx/input/usb-common.c
+++ b/xorg-server/hw/dmx/input/usb-common.c
@@ -74,7 +74,6 @@
/* End of interface definitions. */
/*****************************************************************************/
-
/** Read an event from the \a pDev device. If the event is a motion
* event, enqueue it with the \a motion function. Otherwise, enqueue
* the event with the \a enqueue function. The \a block type is passed
@@ -84,16 +83,14 @@
* Since USB devices return EV_KEY events for buttons and keys, \a
* minButton is used to decide if a Button or Key event should be
* queued.*/
-void usbRead(DevicePtr pDev,
- MOTIONPROC motion,
- ENQUEUEPROC enqueue,
- int minButton,
- BLOCK block)
+void
+usbRead(DevicePtr pDev,
+ MOTIONPROC motion, ENQUEUEPROC enqueue, int minButton, BLOCK block)
{
GETPRIV;
struct input_event raw;
- int v[DMX_MAX_AXES];
- int axis;
+ int v[DMX_MAX_AXES];
+ int axis;
#define PRESS(b) \
do { \
@@ -112,11 +109,14 @@ void usbRead(DevicePtr pDev,
#endif
switch (raw.type) {
case EV_KEY:
- /* raw.value = 1 for first, 2 for repeat */
+ /* raw.value = 1 for first, 2 for repeat */
if (raw.code > minButton) {
- if (raw.value) PRESS((raw.code & 0x0f) + 1);
- else RELEASE((raw.code & 0x0f) + 1);
- } else {
+ if (raw.value)
+ PRESS((raw.code & 0x0f) + 1);
+ else
+ RELEASE((raw.code & 0x0f) + 1);
+ }
+ else {
enqueue(pDev, raw.value ? KeyPress : KeyRelease,
0, 0, NULL, block);
}
@@ -134,10 +134,11 @@ void usbRead(DevicePtr pDev,
motion(pDev, v, 0, 2, DMX_RELATIVE, block);
break;
case REL_WHEEL:
- if ((int)raw.value > 0) {
+ if ((int) raw.value > 0) {
PRESS(4);
RELEASE(4);
- } else if ((int)raw.value < 0) {
+ }
+ else if ((int) raw.value < 0) {
PRESS(5);
RELEASE(5);
}
@@ -162,126 +163,228 @@ void usbRead(DevicePtr pDev,
#define test_bit(bit) (priv->mask[(bit)/8] & (1 << ((bit)%8)))
#define test_bits(bit) (bits[(bit)/8] & (1 << ((bit)%8)))
-static void usbPrint(myPrivate *priv,
- const char *filename, const char *devname, int fd)
+static void
+usbPrint(myPrivate * priv, const char *filename, const char *devname, int fd)
{
- int j, k;
- DeviceIntPtr pDevice = priv->pDevice;
- unsigned char bits[KEY_MAX/8 + 1]; /* RATS: Use ok assuming that
- * KEY_MAX is greater than
- * REL_MAX, ABS_MAX, SND_MAX, and
- * LED_MAX. */
+ int j, k;
+ DeviceIntPtr pDevice = priv->pDevice;
+ unsigned char bits[KEY_MAX / 8 + 1]; /* RATS: Use ok assuming that
+ * KEY_MAX is greater than
+ * REL_MAX, ABS_MAX, SND_MAX, and
+ * LED_MAX. */
LOG3INPUT(priv, "%s (%s) using %s\n", pDevice->name, GETNAME, filename);
LOG1INPUT(priv, " %s\n", devname);
for (j = 0; j < EV_MAX; j++) {
if (test_bit(j)) {
- const char *type = "unknown";
- char extra[256]; /* FIXME: may cause buffer overflow */
+ const char *type = "unknown";
+ char extra[256]; /* FIXME: may cause buffer overflow */
+
extra[0] = '\0';
- switch(j) {
- case EV_KEY: type = "keys/buttons"; break;
- case EV_REL: type = "relative";
+ switch (j) {
+ case EV_KEY:
+ type = "keys/buttons";
+ break;
+ case EV_REL:
+ type = "relative";
memset(bits, 0, sizeof(bits));
ioctl(priv->fd, EVIOCGBIT(EV_REL, sizeof(bits)), bits);
for (k = 0; k < REL_MAX; k++) {
- if (test_bits(k)) switch (k) {
- case REL_X: strcat(extra, " X"); break;
- case REL_Y: strcat(extra, " Y"); break;
- case REL_Z: strcat(extra, " Z"); break;
- case REL_HWHEEL: strcat(extra, " HWheel"); break;
- case REL_DIAL: strcat(extra, " Dial"); break;
- case REL_WHEEL: strcat(extra, " Wheel"); break;
- case REL_MISC: strcat(extra, " Misc"); break;
- }
+ if (test_bits(k))
+ switch (k) {
+ case REL_X:
+ strcat(extra, " X");
+ break;
+ case REL_Y:
+ strcat(extra, " Y");
+ break;
+ case REL_Z:
+ strcat(extra, " Z");
+ break;
+ case REL_HWHEEL:
+ strcat(extra, " HWheel");
+ break;
+ case REL_DIAL:
+ strcat(extra, " Dial");
+ break;
+ case REL_WHEEL:
+ strcat(extra, " Wheel");
+ break;
+ case REL_MISC:
+ strcat(extra, " Misc");
+ break;
+ }
}
break;
- case EV_ABS: type = "absolute";
+ case EV_ABS:
+ type = "absolute";
memset(bits, 0, sizeof(bits));
ioctl(priv->fd, EVIOCGBIT(EV_ABS, sizeof(bits)), bits);
for (k = 0; k < ABS_MAX; k++) {
- if (test_bits(k)) switch (k) {
- case ABS_X: strcat(extra," X"); break;
- case ABS_Y: strcat(extra," Y"); break;
- case ABS_Z: strcat(extra," Z"); break;
- case ABS_RX: strcat(extra," RX"); break;
- case ABS_RY: strcat(extra," RY"); break;
- case ABS_RZ: strcat(extra," RZ"); break;
- case ABS_THROTTLE: strcat(extra," Throttle");break;
- case ABS_RUDDER: strcat(extra," Rudder"); break;
- case ABS_WHEEL: strcat(extra," Wheel"); break;
- case ABS_GAS: strcat(extra," Gas"); break;
- case ABS_BRAKE: strcat(extra," Break"); break;
- case ABS_HAT0X: strcat(extra," Hat0X"); break;
- case ABS_HAT0Y: strcat(extra," Hat0Y"); break;
- case ABS_HAT1X: strcat(extra," Hat1X"); break;
- case ABS_HAT1Y: strcat(extra," Hat1Y"); break;
- case ABS_HAT2X: strcat(extra," Hat2X"); break;
- case ABS_HAT2Y: strcat(extra," Hat2Y"); break;
- case ABS_HAT3X: strcat(extra," Hat3X"); break;
- case ABS_HAT3Y: strcat(extra," Hat3Y"); break;
- case ABS_PRESSURE: strcat(extra," Pressure");break;
- case ABS_DISTANCE: strcat(extra," Distance");break;
- case ABS_TILT_X: strcat(extra," TiltX"); break;
- case ABS_TILT_Y: strcat(extra," TiltY"); break;
- case ABS_MISC: strcat(extra," Misc"); break;
- }
+ if (test_bits(k))
+ switch (k) {
+ case ABS_X:
+ strcat(extra, " X");
+ break;
+ case ABS_Y:
+ strcat(extra, " Y");
+ break;
+ case ABS_Z:
+ strcat(extra, " Z");
+ break;
+ case ABS_RX:
+ strcat(extra, " RX");
+ break;
+ case ABS_RY:
+ strcat(extra, " RY");
+ break;
+ case ABS_RZ:
+ strcat(extra, " RZ");
+ break;
+ case ABS_THROTTLE:
+ strcat(extra, " Throttle");
+ break;
+ case ABS_RUDDER:
+ strcat(extra, " Rudder");
+ break;
+ case ABS_WHEEL:
+ strcat(extra, " Wheel");
+ break;
+ case ABS_GAS:
+ strcat(extra, " Gas");
+ break;
+ case ABS_BRAKE:
+ strcat(extra, " Break");
+ break;
+ case ABS_HAT0X:
+ strcat(extra, " Hat0X");
+ break;
+ case ABS_HAT0Y:
+ strcat(extra, " Hat0Y");
+ break;
+ case ABS_HAT1X:
+ strcat(extra, " Hat1X");
+ break;
+ case ABS_HAT1Y:
+ strcat(extra, " Hat1Y");
+ break;
+ case ABS_HAT2X:
+ strcat(extra, " Hat2X");
+ break;
+ case ABS_HAT2Y:
+ strcat(extra, " Hat2Y");
+ break;
+ case ABS_HAT3X:
+ strcat(extra, " Hat3X");
+ break;
+ case ABS_HAT3Y:
+ strcat(extra, " Hat3Y");
+ break;
+ case ABS_PRESSURE:
+ strcat(extra, " Pressure");
+ break;
+ case ABS_DISTANCE:
+ strcat(extra, " Distance");
+ break;
+ case ABS_TILT_X:
+ strcat(extra, " TiltX");
+ break;
+ case ABS_TILT_Y:
+ strcat(extra, " TiltY");
+ break;
+ case ABS_MISC:
+ strcat(extra, " Misc");
+ break;
+ }
}
break;
- case EV_MSC: type = "reserved"; break;
- case EV_LED: type = "leds";
+ case EV_MSC:
+ type = "reserved";
+ break;
+ case EV_LED:
+ type = "leds";
memset(bits, 0, sizeof(bits));
ioctl(priv->fd, EVIOCGBIT(EV_LED, sizeof(bits)), bits);
for (k = 0; k < LED_MAX; k++) {
- if (test_bits(k)) switch (k) {
- case LED_NUML: strcat(extra," NumLock"); break;
- case LED_CAPSL: strcat(extra," CapsLock"); break;
- case LED_SCROLLL: strcat(extra," ScrlLock"); break;
- case LED_COMPOSE: strcat(extra," Compose"); break;
- case LED_KANA: strcat(extra," Kana"); break;
- case LED_SLEEP: strcat(extra," Sleep"); break;
- case LED_SUSPEND: strcat(extra," Suspend"); break;
- case LED_MUTE: strcat(extra," Mute"); break;
- case LED_MISC: strcat(extra," Misc"); break;
- }
+ if (test_bits(k))
+ switch (k) {
+ case LED_NUML:
+ strcat(extra, " NumLock");
+ break;
+ case LED_CAPSL:
+ strcat(extra, " CapsLock");
+ break;
+ case LED_SCROLLL:
+ strcat(extra, " ScrlLock");
+ break;
+ case LED_COMPOSE:
+ strcat(extra, " Compose");
+ break;
+ case LED_KANA:
+ strcat(extra, " Kana");
+ break;
+ case LED_SLEEP:
+ strcat(extra, " Sleep");
+ break;
+ case LED_SUSPEND:
+ strcat(extra, " Suspend");
+ break;
+ case LED_MUTE:
+ strcat(extra, " Mute");
+ break;
+ case LED_MISC:
+ strcat(extra, " Misc");
+ break;
+ }
}
break;
- case EV_SND: type = "sound";
+ case EV_SND:
+ type = "sound";
memset(bits, 0, sizeof(bits));
ioctl(priv->fd, EVIOCGBIT(EV_SND, sizeof(bits)), bits);
for (k = 0; k < SND_MAX; k++) {
- if (test_bits(k)) switch (k) {
- case SND_CLICK: strcat(extra," Click"); break;
- case SND_BELL: strcat(extra," Bell"); break;
- }
+ if (test_bits(k))
+ switch (k) {
+ case SND_CLICK:
+ strcat(extra, " Click");
+ break;
+ case SND_BELL:
+ strcat(extra, " Bell");
+ break;
+ }
}
break;
- case EV_REP: type = "repeat"; break;
- case EV_FF: type = "feedback"; break;
+ case EV_REP:
+ type = "repeat";
+ break;
+ case EV_FF:
+ type = "feedback";
+ break;
}
LOG5INPUT(priv, " Feature 0x%02x = %s%s%s%s\n", j, type,
extra[0] ? " [" : "",
- extra[0] ? extra+1 : "",
- extra[0] ? "]" : "");
+ extra[0] ? extra + 1 : "", extra[0] ? "]" : "");
}
}
}
/** Initialized \a pDev as a \a usbMouse, \a usbKeyboard, or \a usbOther
-device. */
-void usbInit(DevicePtr pDev, usbType type)
+device. */
+void
+usbInit(DevicePtr pDev, usbType type)
{
GETPRIV;
- char name[64]; /* RATS: Only used in snprintf */
- int i, j, k;
- char buf[256] = { 0, }; /* RATS: Use ok */
- int version;
- unsigned char bits[KEY_MAX/8 + 1]; /* RATS: Use ok assuming that
- * KEY_MAX is greater than
- * REL_MAX, ABS_MAX, SND_MAX, and
- * LED_MAX. */
+ char name[64]; /* RATS: Only used in snprintf */
+ int i, j, k;
+ char buf[256] = { 0, }; /* RATS: Use ok */
+ int version;
+ unsigned char bits[KEY_MAX / 8 + 1]; /* RATS: Use ok assuming that
+ * KEY_MAX is greater than
+ * REL_MAX, ABS_MAX, SND_MAX, and
+ * LED_MAX. */
- if (priv->fd >=0) return;
+ if (priv->fd >= 0)
+ return;
for (i = 0; i < 32; i++) {
snprintf(name, sizeof(name), "/dev/input/event%d", i);
@@ -293,15 +396,18 @@ void usbInit(DevicePtr pDev, usbType type)
for (j = 0; j < EV_MAX; j++) {
if (test_bit(j)) {
- switch(j) {
+ switch (j) {
case EV_REL:
memset(bits, 0, sizeof(bits));
ioctl(priv->fd, EVIOCGBIT(EV_REL, sizeof(bits)), bits);
for (k = 0; k < REL_MAX; k++) {
if (test_bits(k)) {
- if (k == REL_X) priv->relmap[k] = 0;
- else if (k == REL_Y) priv->relmap[k] = 1;
- else priv->relmap[k] = 2 + priv->numAbs;
+ if (k == REL_X)
+ priv->relmap[k] = 0;
+ else if (k == REL_Y)
+ priv->relmap[k] = 1;
+ else
+ priv->relmap[k] = 2 + priv->numAbs;
++priv->numRel;
}
}
@@ -320,7 +426,8 @@ void usbInit(DevicePtr pDev, usbType type)
memset(bits, 0, sizeof(bits));
ioctl(priv->fd, EVIOCGBIT(EV_LED, sizeof(bits)), bits);
for (k = 0; k < LED_MAX; k++) {
- if (test_bits(k)) ++priv->numLeds;
+ if (test_bits(k))
+ ++priv->numLeds;
}
break;
}
@@ -350,32 +457,36 @@ void usbInit(DevicePtr pDev, usbType type)
FATAL1("usbInit: Cannot open /dev/input/event* port (%s)\n"
" If you have not done so, you may need to:\n"
" rmmod mousedev; rmmod keybdev\n"
- " modprobe evdev\n",
- strerror(errno));
- found:
+ " modprobe evdev\n", strerror(errno));
+ found:
usbPrint(priv, name, buf, priv->fd);
}
/** Turn \a pDev off (i.e., stop taking input from \a pDev). */
-void usbOff(DevicePtr pDev)
+void
+usbOff(DevicePtr pDev)
{
GETPRIV;
- if (priv->fd >= 0) close(priv->fd);
+ if (priv->fd >= 0)
+ close(priv->fd);
priv->fd = -1;
}
/** Create a private structure for use within this file. */
-pointer usbCreatePrivate(DeviceIntPtr pDevice)
+pointer
+usbCreatePrivate(DeviceIntPtr pDevice)
{
myPrivate *priv = calloc(1, sizeof(*priv));
- priv->fd = -1;
- priv->pDevice = pDevice;
+
+ priv->fd = -1;
+ priv->pDevice = pDevice;
return priv;
}
/** Destroy a private structure. */
-void usbDestroyPrivate(pointer priv)
+void
+usbDestroyPrivate(pointer priv)
{
free(priv);
}
diff --git a/xorg-server/hw/dmx/input/usb-common.h b/xorg-server/hw/dmx/input/usb-common.h
index 5ebfd1e78..eea98afbe 100644
--- a/xorg-server/hw/dmx/input/usb-common.h
+++ b/xorg-server/hw/dmx/input/usb-common.h
@@ -44,12 +44,11 @@ typedef enum {
} usbType;
extern pointer usbCreatePrivate(DeviceIntPtr pDevice);
-extern void usbDestroyPrivate(pointer priv);
-extern void usbRead(DevicePtr pDev,
- dmxMotionProcPtr motion,
- dmxEnqueueProcPtr enqueue,
- int minButton,
- DMXBlockType block);
-extern void usbInit(DevicePtr pDev, usbType type);
-extern void usbOff(DevicePtr pDev);
+extern void usbDestroyPrivate(pointer priv);
+extern void usbRead(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ int minButton, DMXBlockType block);
+extern void usbInit(DevicePtr pDev, usbType type);
+extern void usbOff(DevicePtr pDev);
#endif
diff --git a/xorg-server/hw/dmx/input/usb-keyboard.c b/xorg-server/hw/dmx/input/usb-keyboard.c
index c2b49039f..65bfcd00d 100644
--- a/xorg-server/hw/dmx/input/usb-keyboard.c
+++ b/xorg-server/hw/dmx/input/usb-keyboard.c
@@ -1,444 +1,477 @@
-/* Portions of this file were derived from the following files:
- *
- **********************************************************************
- *
- * xfree86/common/xf86KbdLnx.c
- *
- * Linux version of keymapping setup. The kernel (since 0.99.14) has support
- * for fully remapping the keyboard, but there are some differences between
- * the Linux map and the SVR4 map (esp. in the extended keycodes). We also
- * remove the restriction on what keycodes can be remapped.
- * Orest Zborowski.
- *
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-/*
- * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.
- *
- * All Rights Reserved.
- *
- * 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 on 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 (including the
- * next paragraph) 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
- * 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.
- */
-
-/*
- * Authors:
- * Rickard E. (Rik) Faith <faith@redhat.com>
- *
- */
-
-/** \file
- *
- * This code implements a low-level device driver for a USB keyboard
- * under Linux. The keymap description is derived from code by Thomas
- * Roell, Orest Zborowski. */
-
-#ifdef HAVE_DMX_CONFIG_H
-#include <dmx-config.h>
-#endif
-
-#include "atKeynames.h"
-#include "usb-private.h"
-
-#define USB_KEYBOARD_DEBUG 0
-
-/*****************************************************************************/
-/* Define some macros to make it easier to move this file to another
- * part of the Xserver tree. All calls to the dmx* layer are #defined
- * here for the .c file. The .h file will also have to be edited. */
-#include "usb-keyboard.h"
-#include <xkbsrv.h>
-
-#define GETPRIV myPrivate *priv \
- = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
-
-#define LOG0(f) dmxLog(dmxDebug,f)
-#define LOG1(f,a) dmxLog(dmxDebug,f,a)
-#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
-#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
-#define FATAL0(f) dmxLog(dmxFatal,f)
-#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
-#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
-#define MOTIONPROC dmxMotionProcPtr
-#define ENQUEUEPROC dmxEnqueueProcPtr
-#define CHECKPROC dmxCheckSpecialProcPtr
-#define BLOCK DMXBlockType
-
-/* End of interface definitions. */
-/*****************************************************************************/
-
-#define GLYPHS_PER_KEY 4
-#define NUM_KEYCODES 248
-#define MIN_KEYCODE 8
-#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1)
-
-static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = {
-/* Table modified from xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h */
- /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol,
- /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol,
- /* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol,
- /* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol,
- /* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol,
- /* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol,
- /* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol,
- /* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol,
- /* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol,
- /* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol,
- /* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol,
- /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol,
- /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol,
- /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol,
- /* 0x0f */ XK_Tab, XK_ISO_Left_Tab,NoSymbol, NoSymbol,
- /* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol,
- /* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol,
- /* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol,
- /* 0x13 */ XK_R, NoSymbol, NoSymbol, NoSymbol,
- /* 0x14 */ XK_T, NoSymbol, NoSymbol, NoSymbol,
- /* 0x15 */ XK_Y, NoSymbol, NoSymbol, NoSymbol,
- /* 0x16 */ XK_U, NoSymbol, NoSymbol, NoSymbol,
- /* 0x17 */ XK_I, NoSymbol, NoSymbol, NoSymbol,
- /* 0x18 */ XK_O, NoSymbol, NoSymbol, NoSymbol,
- /* 0x19 */ XK_P, NoSymbol, NoSymbol, NoSymbol,
- /* 0x1a */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol,
- /* 0x1b */ XK_bracketright,XK_braceright, NoSymbol, NoSymbol,
- /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol,
- /* 0x1d */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol,
- /* 0x1e */ XK_A, NoSymbol, NoSymbol, NoSymbol,
- /* 0x1f */ XK_S, NoSymbol, NoSymbol, NoSymbol,
- /* 0x20 */ XK_D, NoSymbol, NoSymbol, NoSymbol,
- /* 0x21 */ XK_F, NoSymbol, NoSymbol, NoSymbol,
- /* 0x22 */ XK_G, NoSymbol, NoSymbol, NoSymbol,
- /* 0x23 */ XK_H, NoSymbol, NoSymbol, NoSymbol,
- /* 0x24 */ XK_J, NoSymbol, NoSymbol, NoSymbol,
- /* 0x25 */ XK_K, NoSymbol, NoSymbol, NoSymbol,
- /* 0x26 */ XK_L, NoSymbol, NoSymbol, NoSymbol,
- /* 0x27 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol,
- /* 0x28 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol,
- /* 0x29 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol,
- /* 0x2a */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol,
- /* 0x2b */ XK_backslash, XK_bar, NoSymbol, NoSymbol,
- /* 0x2c */ XK_Z, NoSymbol, NoSymbol, NoSymbol,
- /* 0x2d */ XK_X, NoSymbol, NoSymbol, NoSymbol,
- /* 0x2e */ XK_C, NoSymbol, NoSymbol, NoSymbol,
- /* 0x2f */ XK_V, NoSymbol, NoSymbol, NoSymbol,
- /* 0x30 */ XK_B, NoSymbol, NoSymbol, NoSymbol,
- /* 0x31 */ XK_N, NoSymbol, NoSymbol, NoSymbol,
- /* 0x32 */ XK_M, NoSymbol, NoSymbol, NoSymbol,
- /* 0x33 */ XK_comma, XK_less, NoSymbol, NoSymbol,
- /* 0x34 */ XK_period, XK_greater, NoSymbol, NoSymbol,
- /* 0x35 */ XK_slash, XK_question, NoSymbol, NoSymbol,
- /* 0x36 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol,
- /* 0x37 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol,
- /* 0x38 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol,
- /* 0x39 */ XK_space, NoSymbol, NoSymbol, NoSymbol,
- /* 0x3a */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol,
- /* 0x3b */ XK_F1, NoSymbol, NoSymbol, NoSymbol,
- /* 0x3c */ XK_F2, NoSymbol, NoSymbol, NoSymbol,
- /* 0x3d */ XK_F3, NoSymbol, NoSymbol, NoSymbol,
- /* 0x3e */ XK_F4, NoSymbol, NoSymbol, NoSymbol,
- /* 0x3f */ XK_F5, NoSymbol, NoSymbol, NoSymbol,
- /* 0x40 */ XK_F6, NoSymbol, NoSymbol, NoSymbol,
- /* 0x41 */ XK_F7, NoSymbol, NoSymbol, NoSymbol,
- /* 0x42 */ XK_F8, NoSymbol, NoSymbol, NoSymbol,
- /* 0x43 */ XK_F9, NoSymbol, NoSymbol, NoSymbol,
- /* 0x44 */ XK_F10, NoSymbol, NoSymbol, NoSymbol,
- /* 0x45 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol,
- /* 0x46 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol,
- /* 0x47 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol,
- /* 0x48 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol,
- /* 0x49 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol,
- /* 0x4a */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol,
- /* 0x4b */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol,
- /* 0x4c */ XK_KP_Begin, XK_KP_5, NoSymbol, NoSymbol,
- /* 0x4d */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol,
- /* 0x4e */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol,
- /* 0x4f */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol,
- /* 0x50 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol,
- /* 0x51 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol,
- /* 0x52 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol,
- /* 0x53 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol,
- /* 0x54 */ XK_Sys_Req, NoSymbol, NoSymbol, NoSymbol,
- /* 0x55 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol,
- /* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol,
- /* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol,
- /* 0x59 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x5a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x5b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x5c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x5d */ XK_Begin, NoSymbol, NoSymbol, NoSymbol,
- /* 0x5e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x5f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x60 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol,
- /* 0x61 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol,
- /* 0x62 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol,
- /* 0x63 */ XK_Print, NoSymbol, NoSymbol, NoSymbol,
- /* 0x64 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol,
- /* 0x65 */ XK_Break, NoSymbol, NoSymbol, NoSymbol,
- /* 0x66 */ XK_Home, NoSymbol, NoSymbol, NoSymbol,
- /* 0x67 */ XK_Up, NoSymbol, NoSymbol, NoSymbol,
- /* 0x68 */ XK_Prior, NoSymbol, NoSymbol, NoSymbol,
- /* 0x69 */ XK_Left, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6a */ XK_Right, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6b */ XK_End, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6c */ XK_Down, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6d */ XK_Next, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6e */ XK_Insert, NoSymbol, NoSymbol, NoSymbol,
- /* 0x6f */ XK_Delete, NoSymbol, NoSymbol, NoSymbol,
- /* 0x70 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x71 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x72 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x73 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x77 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol,
- /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x79 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7a */ XK_Menu, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7d */ XK_Super_L, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7e */ XK_Super_R, NoSymbol, NoSymbol, NoSymbol,
- /* 0x7f */ XK_Menu, NoSymbol, NoSymbol, NoSymbol,
-};
-
-static int kbdUSBKeyDown(myPrivate *priv, int keyCode)
-{
- CARD8 byte = keyCode >> 5;
- CARD32 bit = 1 << (keyCode & 0x1f);
-
- if (byte > NUM_STATE_ENTRIES) return 0;
- return priv->kbdState[byte] & bit;
-}
-
-static void kbdUSBKeyState(myPrivate *priv, int type, int keyCode)
-{
- CARD8 byte = keyCode >> 5;
- CARD32 bit = 1 << (keyCode & 0x1f);
-
- if (byte > NUM_STATE_ENTRIES) return;
- if (type == KeyPress) priv->kbdState[byte] |= bit;
- else priv->kbdState[byte] &= ~bit;
-}
-
-/** Set the LEDs. */
-void kbdUSBCtrl(DevicePtr pDev, KeybdCtrl *ctrl)
-{
- GETPRIV;
- struct timeval tv;
- struct input_event event;
- int i, led;
-
- gettimeofday(&tv, NULL);
- for (i = 0; i < 5; i++) {
- event.time.tv_sec = tv.tv_sec;
- event.time.tv_usec = tv.tv_usec;
- event.type = EV_LED;
- if (i == 0) led = 1; /* LED_CAPSL == 0x01 */
- else if (i == 1) led = 0; /* LED_NUML == 0x00 */
- else led = i;
- event.code = led;
- event.value = !!(ctrl->leds & (1 << led));
- write(priv->fd, &event, sizeof(event));
- }
-}
-
-/** Initialize \a pDev using #usbInit. */
-void kbdUSBInit(DevicePtr pDev)
-{
- usbInit(pDev, usbKeyboard);
-}
-
-static void kbdUSBConvert(DevicePtr pDev,
- unsigned int scanCode,
- int value,
- ENQUEUEPROC enqueue,
- CHECKPROC checkspecial,
- BLOCK block)
-{
- GETPRIV;
- XkbSrvInfoPtr xkbi = priv->pKeyboard->key->xkbInfo;
- int type;
- int keyCode;
- KeySym keySym = NoSymbol;
- int switching;
-
- /* Set up xEvent information */
- type = value ? KeyPress : KeyRelease;
- keyCode = (scanCode & 0xff) + MIN_KEYCODE;
-
- /* Handle repeats */
-
- if (keyCode >= xkbi->desc->min_key_code &&
- keyCode <= xkbi->desc->max_key_code) {
-
- int effectiveGroup = XkbGetEffectiveGroup(xkbi,
- &xkbi->state,
- scanCode);
- keySym = XkbKeySym(xkbi->desc, scanCode, effectiveGroup);
-#if 0
- switch (keySym) {
- case XK_Num_Lock:
- case XK_Scroll_Lock:
- case XK_Shift_Lock:
- case XK_Caps_Lock:
- /* Ignore releases and all but first press */
- if (kbdLinuxModIgnore(priv, &xE, keySym)) return;
- if (kbdLinuxKeyDown(priv, &xE)) xE.u.u.type = KeyRelease;
- else xE.u.u.type = KeyPress;
- break;
- }
-#endif
-
- /* If key is already down, ignore or autorepeat */
- if (type == KeyPress && kbdUSBKeyDown(priv, keyCode)) {
- KbdFeedbackClassRec *feed = priv->pDevice->kbdfeed;
-
- /* No auto-repeat? */
- if ((feed && !feed->ctrl.autoRepeat)
- || priv->pDevice->key->xkbInfo->desc->map->modmap[keyCode]
- || (feed
- && !(feed->ctrl.autoRepeats[keyCode >> 3]
- & (1 << (keyCode & 7))))) return; /* Ignore */
-
- /* Do auto-repeat */
- enqueue(pDev, KeyRelease, keyCode, keySym, NULL, block);
- type = KeyPress;
- }
-
- /* If key is already up, ignore */
- if (type == KeyRelease && !kbdUSBKeyDown(priv, keyCode)) return;
- }
-
- switching = 0;
- if (checkspecial && type == KeyPress)
- switching = checkspecial(pDev, keySym);
- if (!switching) {
- if (enqueue)
- enqueue(pDev, type, keyCode, keySym, NULL, block);
- kbdUSBKeyState(priv, type, keyCode); /* Update our state bitmap */
- }
-}
-
-/** Read an event from the \a pDev device. If the event is a motion
- * event, enqueue it with the \a motion function. Otherwise, check for
- * special keys with the \a checkspecial function and enqueue the event
- * with the \a enqueue function. The \a block type is passed to the
- * functions so that they may block SIGIO handling as appropriate to the
- * caller of this function. */
-void kbdUSBRead(DevicePtr pDev,
- MOTIONPROC motion,
- ENQUEUEPROC enqueue,
- CHECKPROC checkspecial,
- BLOCK block)
-{
- GETPRIV;
- struct input_event raw;
-
- while (read(priv->fd, &raw, sizeof(raw)) > 0) {
-#if USB_KEYBOARD_DEBUG
- LOG3("KBD: type = %d, code = 0x%02x, value = %d\n",
- raw.type, raw.code, raw.value);
-#endif
- kbdUSBConvert(pDev, raw.code, raw.value, enqueue, checkspecial, block);
- }
-}
-
-/** Turn \a pDev on (i.e., take input from \a pDev). */
-int kbdUSBOn(DevicePtr pDev)
-{
- GETPRIV;
-
- if (priv->fd < 0) kbdUSBInit(pDev);
- return priv->fd;
-}
-
-static void kbdUSBGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
-{
- KeySym *k, *mapCopy;
- int i;
-
- mapCopy = malloc(sizeof(map));
- memcpy(mapCopy, map, sizeof(map));
-
- /* compute the modifier map */
- for (i = 0; i < MAP_LENGTH; i++)
- pModMap[i] = NoSymbol; /* make sure it is restored */
-
- for (k = mapCopy, i = MIN_KEYCODE;
- i < NUM_KEYCODES + MIN_KEYCODE;
- i++, k += 4) {
- switch(*k) {
- case XK_Shift_L:
- case XK_Shift_R: pModMap[i] = ShiftMask; break;
- case XK_Control_L:
- case XK_Control_R: pModMap[i] = ControlMask; break;
- case XK_Caps_Lock: pModMap[i] = LockMask; break;
- case XK_Alt_L:
- case XK_Alt_R: pModMap[i] = AltMask; break;
- case XK_Num_Lock: pModMap[i] = NumLockMask; break;
- case XK_Scroll_Lock: pModMap[i] = ScrollLockMask; break;
- case XK_Kana_Lock:
- case XK_Kana_Shift: pModMap[i] = KanaMask; break;
- case XK_Mode_switch: pModMap[i] = AltLangMask; break;
- }
- }
-
- pKeySyms->map = mapCopy; /* Must be XFree'able */
- pKeySyms->mapWidth = GLYPHS_PER_KEY;
- pKeySyms->minKeyCode = MIN_KEYCODE;
- pKeySyms->maxKeyCode = MAX_KEYCODE;
-}
-
-/** Fill the \a info structure with information needed to initialize \a
- * pDev. */
-void kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
-{
- info->keyboard = 1;
- info->keyClass = 1;
- kbdUSBGetMap(pDev, &info->keySyms, info->modMap);
- info->focusClass = 1;
- info->kbdFeedbackClass = 1;
- info->names.keycodes = strdup("powerpcps2");
- info->force = 1;
-}
+/* Portions of this file were derived from the following files:
+ *
+ **********************************************************************
+ *
+ * xfree86/common/xf86KbdLnx.c
+ *
+ * Linux version of keymapping setup. The kernel (since 0.99.14) has support
+ * for fully remapping the keyboard, but there are some differences between
+ * the Linux map and the SVR4 map (esp. in the extended keycodes). We also
+ * remove the restriction on what keycodes can be remapped.
+ * Orest Zborowski.
+ *
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*
+ * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.
+ *
+ * All Rights Reserved.
+ *
+ * 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 on 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 (including the
+ * next paragraph) 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
+ * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
+ * 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.
+ */
+
+/*
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@redhat.com>
+ *
+ */
+
+/** \file
+ *
+ * This code implements a low-level device driver for a USB keyboard
+ * under Linux. The keymap description is derived from code by Thomas
+ * Roell, Orest Zborowski. */
+
+#ifdef HAVE_DMX_CONFIG_H
+#include <dmx-config.h>
+#endif
+
+#include "atKeynames.h"
+#include "usb-private.h"
+
+#define USB_KEYBOARD_DEBUG 0
+
+/*****************************************************************************/
+/* Define some macros to make it easier to move this file to another
+ * part of the Xserver tree. All calls to the dmx* layer are #defined
+ * here for the .c file. The .h file will also have to be edited. */
+#include "usb-keyboard.h"
+#include <xkbsrv.h>
+
+#define GETPRIV myPrivate *priv \
+ = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private
+
+#define LOG0(f) dmxLog(dmxDebug,f)
+#define LOG1(f,a) dmxLog(dmxDebug,f,a)
+#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b)
+#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c)
+#define FATAL0(f) dmxLog(dmxFatal,f)
+#define FATAL1(f,a) dmxLog(dmxFatal,f,a)
+#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b)
+#define MOTIONPROC dmxMotionProcPtr
+#define ENQUEUEPROC dmxEnqueueProcPtr
+#define CHECKPROC dmxCheckSpecialProcPtr
+#define BLOCK DMXBlockType
+
+/* End of interface definitions. */
+/*****************************************************************************/
+
+#define GLYPHS_PER_KEY 4
+#define NUM_KEYCODES 248
+#define MIN_KEYCODE 8
+#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1)
+
+static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = {
+/* Table modified from xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h */
+ /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol,
+ /* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol,
+ /* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol,
+ /* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol,
+ /* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol,
+ /* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol,
+ /* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol,
+ /* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol,
+ /* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol,
+ /* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol,
+ /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol,
+ /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol,
+ /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x0f */ XK_Tab, XK_ISO_Left_Tab, NoSymbol, NoSymbol,
+ /* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x13 */ XK_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x14 */ XK_T, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x15 */ XK_Y, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x16 */ XK_U, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x17 */ XK_I, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x18 */ XK_O, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x19 */ XK_P, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1a */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol,
+ /* 0x1b */ XK_bracketright, XK_braceright, NoSymbol, NoSymbol,
+ /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1d */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1e */ XK_A, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x1f */ XK_S, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x20 */ XK_D, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x21 */ XK_F, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x22 */ XK_G, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x23 */ XK_H, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x24 */ XK_J, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x25 */ XK_K, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x26 */ XK_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x27 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol,
+ /* 0x28 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol,
+ /* 0x29 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol,
+ /* 0x2a */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2b */ XK_backslash, XK_bar, NoSymbol, NoSymbol,
+ /* 0x2c */ XK_Z, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2d */ XK_X, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2e */ XK_C, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x2f */ XK_V, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x30 */ XK_B, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x31 */ XK_N, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x32 */ XK_M, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x33 */ XK_comma, XK_less, NoSymbol, NoSymbol,
+ /* 0x34 */ XK_period, XK_greater, NoSymbol, NoSymbol,
+ /* 0x35 */ XK_slash, XK_question, NoSymbol, NoSymbol,
+ /* 0x36 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x37 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x38 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol,
+ /* 0x39 */ XK_space, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3a */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3b */ XK_F1, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3c */ XK_F2, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3d */ XK_F3, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3e */ XK_F4, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x3f */ XK_F5, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x40 */ XK_F6, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x41 */ XK_F7, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x42 */ XK_F8, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x43 */ XK_F9, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x44 */ XK_F10, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x45 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x46 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x47 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol,
+ /* 0x48 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol,
+ /* 0x49 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol,
+ /* 0x4a */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4b */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol,
+ /* 0x4c */ XK_KP_Begin, XK_KP_5, NoSymbol, NoSymbol,
+ /* 0x4d */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol,
+ /* 0x4e */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x4f */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol,
+ /* 0x50 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol,
+ /* 0x51 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol,
+ /* 0x52 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol,
+ /* 0x53 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol,
+ /* 0x54 */ XK_Sys_Req, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x55 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol,
+ /* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x59 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5d */ XK_Begin, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x5f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x60 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x61 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x62 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x63 */ XK_Print, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x64 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol,
+ /* 0x65 */ XK_Break, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x66 */ XK_Home, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x67 */ XK_Up, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x68 */ XK_Prior, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x69 */ XK_Left, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6a */ XK_Right, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6b */ XK_End, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6c */ XK_Down, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6d */ XK_Next, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6e */ XK_Insert, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x6f */ XK_Delete, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x70 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x71 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x72 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x73 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x77 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x79 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7a */ XK_Menu, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7d */ XK_Super_L, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7e */ XK_Super_R, NoSymbol, NoSymbol, NoSymbol,
+ /* 0x7f */ XK_Menu, NoSymbol, NoSymbol, NoSymbol,
+};
+
+static int
+kbdUSBKeyDown(myPrivate * priv, int keyCode)
+{
+ CARD8 byte = keyCode >> 5;
+ CARD32 bit = 1 << (keyCode & 0x1f);
+
+ if (byte > NUM_STATE_ENTRIES)
+ return 0;
+ return priv->kbdState[byte] & bit;
+}
+
+static void
+kbdUSBKeyState(myPrivate * priv, int type, int keyCode)
+{
+ CARD8 byte = keyCode >> 5;
+ CARD32 bit = 1 << (keyCode & 0x1f);
+
+ if (byte > NUM_STATE_ENTRIES)
+ return;
+ if (type == KeyPress)
+ priv->kbdState[byte] |= bit;
+ else
+ priv->kbdState[byte] &= ~bit;
+}
+
+/** Set the LEDs. */
+void
+kbdUSBCtrl(DevicePtr pDev, KeybdCtrl * ctrl)
+{
+ GETPRIV;
+ struct timeval tv;
+ struct input_event event;
+ int i, led;
+
+ gettimeofday(&tv, NULL);
+ for (i = 0; i < 5; i++) {
+ event.time.tv_sec = tv.tv_sec;
+ event.time.tv_usec = tv.tv_usec;
+ event.type = EV_LED;
+ if (i == 0)
+ led = 1; /* LED_CAPSL == 0x01 */
+ else if (i == 1)
+ led = 0; /* LED_NUML == 0x00 */
+ else
+ led = i;
+ event.code = led;
+ event.value = ! !(ctrl->leds & (1 << led));
+ write(priv->fd, &event, sizeof(event));
+ }
+}
+
+/** Initialize \a pDev using #usbInit. */
+void
+kbdUSBInit(DevicePtr pDev)
+{
+ usbInit(pDev, usbKeyboard);
+}
+
+static void
+kbdUSBConvert(DevicePtr pDev,
+ unsigned int scanCode,
+ int value,
+ ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
+{
+ GETPRIV;
+ XkbSrvInfoPtr xkbi = priv->pKeyboard->key->xkbInfo;
+ int type;
+ int keyCode;
+ KeySym keySym = NoSymbol;
+ int switching;
+
+ /* Set up xEvent information */
+ type = value ? KeyPress : KeyRelease;
+ keyCode = (scanCode & 0xff) + MIN_KEYCODE;
+
+ /* Handle repeats */
+
+ if (keyCode >= xkbi->desc->min_key_code &&
+ keyCode <= xkbi->desc->max_key_code) {
+
+ int effectiveGroup = XkbGetEffectiveGroup(xkbi,
+ &xkbi->state,
+ scanCode);
+
+ keySym = XkbKeySym(xkbi->desc, scanCode, effectiveGroup);
+#if 0
+ switch (keySym) {
+ case XK_Num_Lock:
+ case XK_Scroll_Lock:
+ case XK_Shift_Lock:
+ case XK_Caps_Lock:
+ /* Ignore releases and all but first press */
+ if (kbdLinuxModIgnore(priv, &xE, keySym))
+ return;
+ if (kbdLinuxKeyDown(priv, &xE))
+ xE.u.u.type = KeyRelease;
+ else
+ xE.u.u.type = KeyPress;
+ break;
+ }
+#endif
+
+ /* If key is already down, ignore or autorepeat */
+ if (type == KeyPress && kbdUSBKeyDown(priv, keyCode)) {
+ KbdFeedbackClassRec *feed = priv->pDevice->kbdfeed;
+
+ /* No auto-repeat? */
+ if ((feed && !feed->ctrl.autoRepeat)
+ || priv->pDevice->key->xkbInfo->desc->map->modmap[keyCode]
+ || (feed && !(feed->ctrl.autoRepeats[keyCode >> 3]
+ & (1 << (keyCode & 7)))))
+ return; /* Ignore */
+
+ /* Do auto-repeat */
+ enqueue(pDev, KeyRelease, keyCode, keySym, NULL, block);
+ type = KeyPress;
+ }
+
+ /* If key is already up, ignore */
+ if (type == KeyRelease && !kbdUSBKeyDown(priv, keyCode))
+ return;
+ }
+
+ switching = 0;
+ if (checkspecial && type == KeyPress)
+ switching = checkspecial(pDev, keySym);
+ if (!switching) {
+ if (enqueue)
+ enqueue(pDev, type, keyCode, keySym, NULL, block);
+ kbdUSBKeyState(priv, type, keyCode); /* Update our state bitmap */
+ }
+}
+
+/** Read an event from the \a pDev device. If the event is a motion
+ * event, enqueue it with the \a motion function. Otherwise, check for
+ * special keys with the \a checkspecial function and enqueue the event
+ * with the \a enqueue function. The \a block type is passed to the
+ * functions so that they may block SIGIO handling as appropriate to the
+ * caller of this function. */
+void
+kbdUSBRead(DevicePtr pDev,
+ MOTIONPROC motion,
+ ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
+{
+ GETPRIV;
+ struct input_event raw;
+
+ while (read(priv->fd, &raw, sizeof(raw)) > 0) {
+#if USB_KEYBOARD_DEBUG
+ LOG3("KBD: type = %d, code = 0x%02x, value = %d\n",
+ raw.type, raw.code, raw.value);
+#endif
+ kbdUSBConvert(pDev, raw.code, raw.value, enqueue, checkspecial, block);
+ }
+}
+
+/** Turn \a pDev on (i.e., take input from \a pDev). */
+int
+kbdUSBOn(DevicePtr pDev)
+{
+ GETPRIV;
+
+ if (priv->fd < 0)
+ kbdUSBInit(pDev);
+ return priv->fd;
+}
+
+static void
+kbdUSBGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap)
+{
+ KeySym *k, *mapCopy;
+ int i;
+
+ mapCopy = malloc(sizeof(map));
+ memcpy(mapCopy, map, sizeof(map));
+
+ /* compute the modifier map */
+ for (i = 0; i < MAP_LENGTH; i++)
+ pModMap[i] = NoSymbol; /* make sure it is restored */
+
+ for (k = mapCopy, i = MIN_KEYCODE;
+ i < NUM_KEYCODES + MIN_KEYCODE; i++, k += 4) {
+ switch (*k) {
+ case XK_Shift_L:
+ case XK_Shift_R:
+ pModMap[i] = ShiftMask;
+ break;
+ case XK_Control_L:
+ case XK_Control_R:
+ pModMap[i] = ControlMask;
+ break;
+ case XK_Caps_Lock:
+ pModMap[i] = LockMask;
+ break;
+ case XK_Alt_L:
+ case XK_Alt_R:
+ pModMap[i] = AltMask;
+ break;
+ case XK_Num_Lock:
+ pModMap[i] = NumLockMask;
+ break;
+ case XK_Scroll_Lock:
+ pModMap[i] = ScrollLockMask;
+ break;
+ case XK_Kana_Lock:
+ case XK_Kana_Shift:
+ pModMap[i] = KanaMask;
+ break;
+ case XK_Mode_switch:
+ pModMap[i] = AltLangMask;
+ break;
+ }
+ }
+
+ pKeySyms->map = mapCopy; /* Must be XFree'able */
+ pKeySyms->mapWidth = GLYPHS_PER_KEY;
+ pKeySyms->minKeyCode = MIN_KEYCODE;
+ pKeySyms->maxKeyCode = MAX_KEYCODE;
+}
+
+/** Fill the \a info structure with information needed to initialize \a
+ * pDev. */
+void
+kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+{
+ info->keyboard = 1;
+ info->keyClass = 1;
+ kbdUSBGetMap(pDev, &info->keySyms, info->modMap);
+ info->focusClass = 1;
+ info->kbdFeedbackClass = 1;
+ info->names.keycodes = strdup("powerpcps2");
+ info->force = 1;
+}
diff --git a/xorg-server/hw/dmx/input/usb-keyboard.h b/xorg-server/hw/dmx/input/usb-keyboard.h
index 1f9614eef..e14cca1c2 100644
--- a/xorg-server/hw/dmx/input/usb-keyboard.h
+++ b/xorg-server/hw/dmx/input/usb-keyboard.h
@@ -36,13 +36,12 @@
#ifndef _USB_KEYBOARD_H_
#define _USB_KEYBOARD_H_
-extern void kbdUSBInit(DevicePtr pDev);
-extern void kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
-extern int kbdUSBOn(DevicePtr pDev);
-extern void kbdUSBRead(DevicePtr pDev,
- dmxMotionProcPtr motion,
- dmxEnqueueProcPtr enqueue,
- dmxCheckSpecialProcPtr checkspecial,
- DMXBlockType block);
-extern void kbdUSBCtrl(DevicePtr pDev, KeybdCtrl *ctrl);
+extern void kbdUSBInit(DevicePtr pDev);
+extern void kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+extern int kbdUSBOn(DevicePtr pDev);
+extern void kbdUSBRead(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial, DMXBlockType block);
+extern void kbdUSBCtrl(DevicePtr pDev, KeybdCtrl * ctrl);
#endif
diff --git a/xorg-server/hw/dmx/input/usb-mouse.c b/xorg-server/hw/dmx/input/usb-mouse.c
index efa9d00ec..644342ee3 100644
--- a/xorg-server/hw/dmx/input/usb-mouse.c
+++ b/xorg-server/hw/dmx/input/usb-mouse.c
@@ -66,61 +66,68 @@
/*****************************************************************************/
/** Read the USB device using #usbRead. */
-void mouUSBRead(DevicePtr pDev,
- MOTIONPROC motion,
- ENQUEUEPROC enqueue,
- CHECKPROC checkspecial,
- BLOCK block)
+void
+mouUSBRead(DevicePtr pDev,
+ MOTIONPROC motion,
+ ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
{
usbRead(pDev, motion, enqueue, BTN_MISC, block);
}
/** Initialize \a pDev using #usbInit. */
-void mouUSBInit(DevicePtr pDev)
+void
+mouUSBInit(DevicePtr pDev)
{
usbInit(pDev, usbMouse);
}
/** Turn \a pDev on (i.e., take input from \a pDev). */
-int mouUSBOn(DevicePtr pDev)
+int
+mouUSBOn(DevicePtr pDev)
{
GETPRIV;
- if (priv->fd < 0) mouUSBInit(pDev);
+ if (priv->fd < 0)
+ mouUSBInit(pDev);
return priv->fd;
}
-static void mouUSBGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
+static void
+mouUSBGetMap(DevicePtr pDev, unsigned char *map, int *nButtons)
{
int i;
-
- if (nButtons) *nButtons = 5;
- if (map) for (i = 0; i <= *nButtons; i++) map[i] = i;
+
+ if (nButtons)
+ *nButtons = 5;
+ if (map)
+ for (i = 0; i <= *nButtons; i++)
+ map[i] = i;
}
/** Fill the \a info structure with information needed to initialize \a
- * pDev. */
-void mouUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+ * pDev. */
+void
+mouUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
{
static KeySym keyboard_mapping = NoSymbol;
- info->buttonClass = 1;
+ info->buttonClass = 1;
mouUSBGetMap(pDev, info->map, &info->numButtons);
- info->valuatorClass = 1;
- info->numRelAxes = 2;
- info->minval[0] = 0;
- info->maxval[0] = 0;
- info->res[0] = 1;
- info->minres[0] = 0;
- info->maxres[0] = 1;
- info->ptrFeedbackClass = 1;
-
- /* Some USB mice devices return key
- * events from their pair'd
- * keyboard... */
- info->keyClass = 1;
+ info->valuatorClass = 1;
+ info->numRelAxes = 2;
+ info->minval[0] = 0;
+ info->maxval[0] = 0;
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
+ info->ptrFeedbackClass = 1;
+
+ /* Some USB mice devices return key
+ * events from their pair'd
+ * keyboard... */
+ info->keyClass = 1;
info->keySyms.minKeyCode = 8;
info->keySyms.maxKeyCode = 8;
- info->keySyms.mapWidth = 1;
- info->keySyms.map = &keyboard_mapping;
+ info->keySyms.mapWidth = 1;
+ info->keySyms.map = &keyboard_mapping;
}
diff --git a/xorg-server/hw/dmx/input/usb-mouse.h b/xorg-server/hw/dmx/input/usb-mouse.h
index 918bf6481..91f6fcf86 100644
--- a/xorg-server/hw/dmx/input/usb-mouse.h
+++ b/xorg-server/hw/dmx/input/usb-mouse.h
@@ -36,13 +36,12 @@
#ifndef _USB_MOU_H_
#define _USB_MOU_H_
-extern void mouUSBRead(DevicePtr pDev,
- dmxMotionProcPtr motion,
- dmxEnqueueProcPtr enqueue,
- dmxCheckSpecialProcPtr checkspecial,
- DMXBlockType block);
-extern void mouUSBInit(DevicePtr pDev);
-extern void mouUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
-extern int mouUSBOn(DevicePtr pDev);
-extern void mouUSBCtrl(DevicePtr pDev, PtrCtrl *ctrl);
+extern void mouUSBRead(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial, DMXBlockType block);
+extern void mouUSBInit(DevicePtr pDev);
+extern void mouUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+extern int mouUSBOn(DevicePtr pDev);
+extern void mouUSBCtrl(DevicePtr pDev, PtrCtrl * ctrl);
#endif
diff --git a/xorg-server/hw/dmx/input/usb-other.c b/xorg-server/hw/dmx/input/usb-other.c
index d1074b8e1..f24f259c1 100644
--- a/xorg-server/hw/dmx/input/usb-other.c
+++ b/xorg-server/hw/dmx/input/usb-other.c
@@ -68,92 +68,97 @@
/*****************************************************************************/
/** Read the USB device using #usbRead. */
-void othUSBRead(DevicePtr pDev,
- MOTIONPROC motion,
- ENQUEUEPROC enqueue,
- CHECKPROC checkspecial,
- BLOCK block)
+void
+othUSBRead(DevicePtr pDev,
+ MOTIONPROC motion,
+ ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block)
{
usbRead(pDev, motion, enqueue, 0xffff, block);
}
/** Initialize \a pDev using #usbInit. */
-void othUSBInit(DevicePtr pDev)
+void
+othUSBInit(DevicePtr pDev)
{
usbInit(pDev, usbOther);
}
/** Turn \a pDev on (i.e., take input from \a pDev). */
-int othUSBOn(DevicePtr pDev)
+int
+othUSBOn(DevicePtr pDev)
{
GETPRIV;
- if (priv->fd < 0) othUSBInit(pDev);
+ if (priv->fd < 0)
+ othUSBInit(pDev);
return priv->fd;
}
/** Fill the \a info structure with information needed to initialize \a
- * pDev. */
-void othUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
+ * pDev. */
+void
+othUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info)
{
GETPRIV;
- int i, j;
+ int i, j;
static KeySym keyboard_mapping = NoSymbol;
- int absolute[5];
-
+ int absolute[5];
+
#define test_bit(bit) (priv->mask[(bit)/8] & (1 << ((bit)%8)))
- /* Some USB mice devices return key
- * events from their pair'd
- * keyboard... */
- info->keyClass = 1;
+ /* Some USB mice devices return key
+ * events from their pair'd
+ * keyboard... */
+ info->keyClass = 1;
info->keySyms.minKeyCode = 8;
info->keySyms.maxKeyCode = 8;
- info->keySyms.mapWidth = 1;
- info->keySyms.map = &keyboard_mapping;
+ info->keySyms.mapWidth = 1;
+ info->keySyms.map = &keyboard_mapping;
for (i = 0; i < EV_MAX; i++) {
if (test_bit(i)) {
switch (i) {
case EV_KEY:
- /* See above */
+ /* See above */
break;
case EV_REL:
- info->valuatorClass = 1;
+ info->valuatorClass = 1;
if (info->numRelAxes + info->numAbsAxes > DMX_MAX_AXES - 1) {
- info->numRelAxes = DMX_MAX_AXES - info->numAbsAxes - 1;
+ info->numRelAxes = DMX_MAX_AXES - info->numAbsAxes - 1;
dmxLog(dmxWarning, "Can only use %d relative axes\n",
info->numRelAxes);
- } else
- info->numRelAxes = priv->numRel;
- info->minval[0] = 0;
- info->maxval[0] = 0;
- info->res[0] = 1;
- info->minres[0] = 0;
- info->maxres[0] = 1;
+ }
+ else
+ info->numRelAxes = priv->numRel;
+ info->minval[0] = 0;
+ info->maxval[0] = 0;
+ info->res[0] = 1;
+ info->minres[0] = 0;
+ info->maxres[0] = 1;
break;
case EV_ABS:
- info->valuatorClass = 1;
+ info->valuatorClass = 1;
if (info->numRelAxes + info->numAbsAxes > DMX_MAX_AXES - 1) {
- info->numAbsAxes = DMX_MAX_AXES - info->numRelAxes - 1;
+ info->numAbsAxes = DMX_MAX_AXES - info->numRelAxes - 1;
dmxLog(dmxWarning, "Can only use %d absolute axes\n",
info->numAbsAxes);
- } else
- info->numAbsAxes = priv->numAbs;
+ }
+ else
+ info->numAbsAxes = priv->numAbs;
for (j = 0; j < info->numAbsAxes; j++) {
ioctl(priv->fd, EVIOCGABS(j), absolute);
- info->minval[1+j] = absolute[1];
- info->maxval[1+j] = absolute[2];
- info->res[1+j] = absolute[3];
- info->minres[1+j] = absolute[3];
- info->maxres[1+j] = absolute[3];
+ info->minval[1 + j] = absolute[1];
+ info->maxval[1 + j] = absolute[2];
+ info->res[1 + j] = absolute[3];
+ info->minres[1 + j] = absolute[3];
+ info->maxres[1 + j] = absolute[3];
}
break;
case EV_LED:
- info->ledFeedbackClass = 0; /* Not supported at this time */
+ info->ledFeedbackClass = 0; /* Not supported at this time */
break;
case EV_SND:
- info->belFeedbackClass = 0; /* Not supported at this time */
+ info->belFeedbackClass = 0; /* Not supported at this time */
break;
}
}
diff --git a/xorg-server/hw/dmx/input/usb-other.h b/xorg-server/hw/dmx/input/usb-other.h
index b69e65933..89939a0a2 100644
--- a/xorg-server/hw/dmx/input/usb-other.h
+++ b/xorg-server/hw/dmx/input/usb-other.h
@@ -36,13 +36,12 @@
#ifndef _USB_OTHER_H_
#define _USB_OTHER_H_
-extern void othUSBRead(DevicePtr pDev,
- dmxMotionProcPtr motion,
- dmxEnqueueProcPtr enqueue,
- dmxCheckSpecialProcPtr checkspecial,
- DMXBlockType block);
-extern void othUSBInit(DevicePtr pDev);
-extern void othUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
-extern int othUSBOn(DevicePtr pDev);
-extern void othUSBCtrl(DevicePtr pDev, PtrCtrl *ctrl);
+extern void othUSBRead(DevicePtr pDev,
+ dmxMotionProcPtr motion,
+ dmxEnqueueProcPtr enqueue,
+ dmxCheckSpecialProcPtr checkspecial, DMXBlockType block);
+extern void othUSBInit(DevicePtr pDev);
+extern void othUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
+extern int othUSBOn(DevicePtr pDev);
+extern void othUSBCtrl(DevicePtr pDev, PtrCtrl * ctrl);
#endif