summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin E Martin <kem@kem.org>2004-06-30 20:06:53 +0000
committerKevin E Martin <kem@kem.org>2004-06-30 20:06:53 +0000
commit90b1782cf132d4d3a753e4643fe8c398cecbb07b (patch)
treee4d22384522e6276fc5a5a2235ace7ebc8434954
-rw-r--r--man/DMX.man79
-rw-r--r--man/DMXAddInput.man162
-rw-r--r--man/DMXAddScreen.man104
-rw-r--r--man/DMXChangeDesktopAttributes.man102
-rw-r--r--man/DMXChangeScreensAttributes.man123
-rw-r--r--man/DMXForceWindowCreation.man51
-rw-r--r--man/DMXGetDesktopAttributes.man67
-rw-r--r--man/DMXGetInputAttributes.man135
-rw-r--r--man/DMXGetInputCount.man53
-rw-r--r--man/DMXGetScreenAttributes.man112
-rw-r--r--man/DMXGetScreenCount.man68
-rw-r--r--man/DMXGetWindowAttributes.man154
-rw-r--r--man/DMXQueryExtension.man55
-rw-r--r--man/DMXQueryVersion.man80
-rw-r--r--man/DMXRemoveInput.man59
-rw-r--r--man/DMXRemoveScreen.man60
-rw-r--r--man/DMXSync.man50
-rw-r--r--src/dmx.c802
18 files changed, 2316 insertions, 0 deletions
diff --git a/man/DMX.man b/man/DMX.man
new file mode 100644
index 0000000..41cae1a
--- /dev/null
+++ b/man/DMX.man
@@ -0,0 +1,79 @@
+.\" $XFree86$
+.\"
+.\" Copyright 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:
+.\"
+.\" he 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.
+.TH DMX 3X __vendorversion__
+.SH NAME
+DMX \- X Window System DMX (Distributed Multihead X) extension
+.SH DESCRIPTION
+The DMX extension provides support for communication with and control of
+.BR Xdmx (1)
+server. Attributes of the
+.BR Xdmx (1)
+server and of the back-end screens attached to the server can be queried
+and modified via this protocol.
+.SH "SUMMARY OF LIBRARY FUNCTIONS"
+The following is a summary of DMX library functions:
+.sp
+DMXQueryExtension(3X) \- determine if DMX is available
+.sp
+DMXQueryVersion(3X) \- determine DMX extension version
+.sp
+DMXSync(3X) \- flush protocol requests between
+.BR Xdmx (1)
+and back-end X servers
+.sp
+DMXForceWindowCreation(3X) \- force immediate back-end window creation
+.sp
+DMXGetScreenCount(3X) \- determine number of back-end screens
+.sp
+DMXGetScreenAttributes(3X) \- determine back-end screen attributes
+.sp
+DMXChangeScreensAttributes(3X) \- change back-end screen attributes
+.sp
+DMXAddScreen(3X) \- attach a new back-end screen
+.sp
+DMXRemoveScreen(3X) \- detach a back-end screen
+.sp
+DMXGetWindowAttributes(3X) \- determine back-end window attributes
+.sp
+DMXGetDesktopAttributes(3X) \- determine global bounding box
+.sp
+DMXChangeDesktopAttributes(3X) \- change global bounding box
+.sp
+DMXGetInputCount(3X) \- determine number of input devices
+.sp
+DMXGetInputAttributes(3X) \- determine input device attributes
+.sp
+DMXAddInput(3X) \- attach a new backend or console input
+.sp
+DMXRemoveInput(3X) \- detach an input
+.sp
+DMXAddBackendInput(3X) \- attach a new back-end input
+.sp
+DMXAddConsoleInput(3X) \- attach a new console input
+.PP
+Each of these functions is described in its own man page.
+.SH "SEE ALSO"
+.BR Xdmx "(1), " xdmxconfig "(1), " vdltodmx (1)
diff --git a/man/DMXAddInput.man b/man/DMXAddInput.man
new file mode 100644
index 0000000..c3e9ced
--- /dev/null
+++ b/man/DMXAddInput.man
@@ -0,0 +1,162 @@
+.\" $XFree86$
+.\"
+.\" Copyright 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:
+.\"
+.\" he 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.
+.TH DMXAddInput 3X __vendorversion__
+.SH NAME
+DMXAddInput, DMXAddBackendInput, DMXAddConsoleInput \- attach a new input
+.SH SYNOPSIS
+.B #include <X11/extensions/dmxext.h>
+.sp
+.nf
+.BI "Bool DMXAddInput(Display " *dpy ,
+.BI " unsigned int " mask ,
+.BI " DMXInputAttributes " *attr ,
+.BI " int " *id );
+.br
+.BI "Bool DMXAddBackendInput(Display " *dpy ,
+.BI " int " screen ,
+.BI " int " sendsCore ,
+.BI " int " *newId );
+.br
+.BI "Bool DMXAddConsoleInput(Display " *dpy ,
+.BI " const char " *name ,
+.BI " int " sendsCore ,
+.BI " int " *newId );
+.fi
+.SH DESCRIPTION
+.B DMXAddInput()
+is used to attach a new input (or a previously detached input) to the
+.BR Xdmx (1)
+server.
+.I mask
+specifies the fields in
+.I attr
+that are active, and
+.I id
+returns the device if of the first device in the series that is added.
+.PP
+The value of
+.I mask
+is computed from the following values:
+.sp
+.nf
+DMXInputType
+DMXInputPhysicalScreen
+DMXInputSendsCore
+.fi
+.PP
+The
+.B DMXInputAttributes
+structure is:
+.sp
+.nf
+typedef struct {
+ DMXInputEnum inputType;
+ int physicalScreen;
+ int physicalId;
+ Bool isCore;
+ Bool sendsCore;
+ const char *name;
+ Bool detached;
+} DMXInputAttributes;
+.fi
+.PP
+.I inputType
+may bave the value
+.B DmxConsoleInputType " or " DmxBackendInputType .
+.PP
+For console devices,
+.I name
+will specify the display to be used.
+.PP
+For back-end devices,
+.I physicalScreen
+will specify the
+.BR Xdmx (1)
+screen number.
+.PP
+If
+.I sendsCore
+is
+.BR True ,
+the new device will be added as a true core device.
+.PP
+If a device was removed with
+.BR DMXRemoveInput (3X)
+an attempt will be made to reconnect the previous devices
+.RI ( sendsCore
+is ignored in this case).
+.PP
+.B DMXAddBackendInput()
+is a helper function that is used to add input from a back-end server.
+With this function,
+.I screen
+refers to the back-end screen,
+.I sendsCore
+is
+.B True
+if the new input should send core events (and it ignored if the input
+has been detached), and
+.I newId
+will hold the device id of the first device in the series added.
+.PP
+.B DMXAddConsoleInput()
+is a helper function that is used to add input from a console. With
+this function,
+.I name
+is the name of the console display,
+.I sendsCore
+is
+.B True
+if the new input should send core events (and it ignored if the input
+has been detached), and
+.I newId
+will hold the device id of the first device in the series added.
+.SH "RETURN VALUE"
+.B DMXAddInput()
+returns
+.B True
+on success and
+.B False
+otherwise.
+.PP
+.B DMXAddInput()
+can generate
+.B BadValue
+(if
+.I inputType
+is invalid or
+.I physicalScreen
+is out of range),
+.B BadAccess
+(if the input has already been attached or if the backend screen is
+currently detached).
+.SH NOTES
+Local devices cannot be attached or detached.
+.PP
+Attributes that are not specified will default to 0. This may lead to
+unintended results.
+.SH "SEE ALSO"
+.BR DMXRemoveInput "(3X), " DMX "(3X), " Xdmx (1)
diff --git a/man/DMXAddScreen.man b/man/DMXAddScreen.man
new file mode 100644
index 0000000..3878577
--- /dev/null
+++ b/man/DMXAddScreen.man
@@ -0,0 +1,104 @@
+.\" $XFree86$
+.\"
+.\" Copyright 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:
+.\"
+.\" he 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.
+.TH DMXAddScreen 3X __vendorversion__
+.SH NAME
+DMXAddScreen \- attach a new back-end screen
+.SH SYNOPSIS
+.B #include <X11/extensions/dmxext.h>
+.sp
+.nf
+.BI "Bool DMXAddScreen(Display " *dpy ,
+.BI " const char " *displayName ,
+.BI " unsigned int " mask ,
+.BI " DMXScreenAttributes " *attr ,
+.BI " int " *screen );
+.fi
+.SH DESCRIPTION
+.B DMXAddScreen()
+attaches a back-end screen to the
+.BR Xdmx (1)
+server, in place of the previously detached back-end server specified by
+.IR screen .
+.PP
+.I displayName
+is the name of the new back-end display,
+.I mask
+specifies the field in
+.I attr
+that are active, and
+.I screen
+returns the new
+.BR Xdmx (1)
+screen number for the attached screen.
+.PP
+The information stored in
+.I mask " and " attr
+is identical to that used by the
+.BR DMXChangeScreenAttributes (3X)
+and
+.BR DMXGetScreenAttribues (3X)
+functions.
+.SH "RETURN VALUE"
+.B DMXAddScreen()
+will return
+.B True
+if the screen was successfully attached, and
+.B False
+otherwise.
+.B False
+will be returned if the
+.I \-addremovescreens
+command line option was not specified on the
+.BR Xdmx (1)
+command line, the input value of
+.I screen
+is out of range,
+.I screen
+is not currently detached,
+.I displayName
+cannot be opened, has unexpected visuals, or has characteristics that do
+not match the previously detached screen.
+.PP
+.B DMXAddScreen()
+can generate
+.BR BadLength ,
+.BR BadAlloc ,
+and
+.B BadValue
+errors.
+.SH NOTES
+Attributes that are not specified will default to 0. This may lead to
+unintended results.
+.PP
+Unlike other functions in the
+.BR DMX (3X)
+API, this function uses
+.I screen
+for both input and output.
+.SH "SEE ALSO"
+.BR DMXRemoveScreen "(3X), "
+.BR DMXChangeScreenAttributes "(3X), " DMXGetScreenAttributes "(3X), "
+.BR DMX "(3X), " Xdmx (1)
diff --git a/man/DMXChangeDesktopAttributes.man b/man/DMXChangeDesktopAttributes.man
new file mode 100644
index 0000000..cde4ae9
--- /dev/null
+++ b/man/DMXChangeDesktopAttributes.man
@@ -0,0 +1,102 @@
+.\" $XFree86$
+.\"
+.\" Copyright 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:
+.\"
+.\" he 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.
+.TH DMXChangeDesktopAttributes 3X __vendorversion__
+.SH NAME
+DMXChangeDesktopAttributes \- change global bounding box
+.SH SYNOPSIS
+.B #include <X11/extensions/dmxext.h>
+.sp
+.nf
+.BI "int DMXChangeDesktopAttributes(Display " *dpy ,
+.BI " unsigned int " mask ,
+.BI " DMXDesktopAttributes " *attr );
+.fi
+.SH DESCRIPTION
+.B DMXChangeDesktopAttributes()
+resizes the bounding box of the whole screen when using the Xinerama
+extension. Otherwise, it has no effect on the screen layout.
+An attribute mask is placed in
+.I mask
+and the attributes to change are placed in
+.IR attr .
+.PP
+The values that are used to compute
+.I mask
+are as follows:
+.sp
+.nf
+DMXDesktopWidth
+DMXDesktopHeight
+DMXDesktopShiftX
+DMXDesktopShiftY
+.fi
+.PP
+The
+.B DMXDesktopAttributes
+structure is:
+.sp
+.nf
+typedef struct {
+ unsigned int width;
+ unsigned int height;
+ int shiftX;
+ int shiftY;
+} DMXDesktopAttributes;
+.fi
+.PP
+.I width " and " height
+specify the new width and height for the bounding box.
+.I shiftX " and " shiftY
+specify where the Xinerama origin will be placed with respect to the
+origin of the new bounding box. This allows the left and upper edges of
+the bounding box to be changed without changing the visual position of
+the windows on the desktop. If
+.I width " or " height
+is not specified, the current values will be used. If
+.I shiftX " or " shiftY
+is not specified, 0 will be used.
+.PP
+All coordinants are in the global DMX coordinant system. If Xinerama is
+not active, an error will be generated.
+.SH "RETURN VALUE"
+.B DMXChangeDesktopAttributes()
+will return 0 on success,
+.B DmxBadXinerama
+if Xinerama is not active,
+.B DmxBadValue
+if the size of the bounding box is too large, and
+.B DmxBadReply
+if there was a protocol error.
+.PP
+.B DMXChangeDesktopAttributes()
+can generate
+.B BadLength
+(if the request is malformed, which should never happen when using this
+library interface), and
+.B BadValue
+(if any values are out of range).
+.SH "SEE ALSO"
+.BR DMXGetDesktopAttributes "(3X), " DMX "(3X), " Xdmx (1)
diff --git a/man/DMXChangeScreensAttributes.man b/man/DMXChangeScreensAttributes.man
new file mode 100644
index 0000000..59ba8eb
--- /dev/null
+++ b/man/DMXChangeScreensAttributes.man
@@ -0,0 +1,123 @@
+.\" $XFree86$
+.\"
+.\" Copyright 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:
+.\"
+.\" he 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.
+.TH DMXChangeScreensAttributes 3X __vendorversion__
+.SH NAME
+DMXChangeScreensAttributes \- change back-end screen attributes
+.SH SYNOPSIS
+.B #include <X11/extensions/dmxext.h>
+.sp
+.nf
+.BI "int DMXChangeScreensAttributes(Display " *dpy ,
+.BI " int " screen_count ,
+.BI " int " *screens ,
+.BI " int " mask_count ,
+.BI " unsigned int " *masks ,
+.BI " DMXScreenAttributes " *attr ,
+.BI " int *" error_screen );
+.fi
+.SH DESCRIPTION
+.B DMXChangeScreensAttributes()
+changes the geometries and positions of the DMX screen and DMX root
+windows on the back-end X servers.
+.I screen_count
+specifies the number of screens to be changed. For each screen, the
+screen number is placed in
+.IR screens ,
+an attribute mask is placed in
+.IR masks ,
+and a
+.I DMXScreenAttributes
+structure is included in
+.IR attr .
+.PP
+An explanation of the
+.I DMXScreenAttributes
+structure is given in
+.BR DMXGetScreenAttributes (3X).
+.PP
+The values that are used to compute each value in
+.I masks
+are as follows
+.sp
+.nf
+DMXScreenWindowWidth
+DMXScreenWindowHeight
+DMXScreenWindowXoffset
+DMXScreenWindowYoffset
+DMXRootWindowWidth
+DMXRootWindowHeight
+DMXRootWindowXoffset
+DMXRootWindowYoffset
+DMXRootWindowXorigin
+DMXRootWindowYorigin
+.fi
+.PP
+In general,
+.I mask_count
+should be equal to
+.IR screen_count .
+However, as a convenience,
+.I mask_count
+may be less than
+.IR screen_count ,
+and the last entry in
+.I masks
+will then be used for all of the remaining screens. For example, this
+allows identical changes to be made to several screens using only one
+mask.
+.SH "RETURN VALUE"
+On success, 0 is returned. Otherwise,
+.I error_screen
+is set to the value of the first screen in the list that caused the
+error and a non-zero value is returned. If
+.I screen_count
+or
+.I mask_count
+is less than 1, or if any of the attribute values are not within the
+appropriate bounding boxes,
+.B DmxBadValue
+is returned. If a protocol error occurs,
+.B DmxBadReply
+is returned.
+.PP
+.B DMXChangeScreensAttributes()
+can generate
+.B BadLength
+(if the data provided does not match the data implicitly required by the
+.I screen_count
+and
+.I mask_count
+values),
+.B BadValue
+(if the values in
+.I screens
+are not valid), and
+.B BadAlloc
+errors.
+.SH "SEE ALSO"
+.BR DMXGetScreenCount "(3X), "
+.BR DMXGetScreenAttributes "(3X), "
+.BR DMX "(3X), " Xdmx (1)
diff --git a/man/DMXForceWindowCreation.man b/man/DMXForceWindowCreation.man
new file mode 100644
index 0000000..6c256a0
--- /dev/null
+++ b/man/DMXForceWindowCreation.man
@@ -0,0 +1,51 @@
+.\" $XFree86$
+.\"
+.\" Copyright 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:
+.\"
+.\" he 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.
+.TH DMXForceWindowCreation 3X __vendorversion__
+.SH NAME
+DMXForceWindowCreation \- force immediate back-end window creation
+.SH SYNOPSIS
+.B #include <X11/extensions/dmxext.h>
+.sp
+.nf
+.BI "Bool DMXForceWindowCreation(Display " *dpy ,
+.BI " Window " window );
+.fi
+.SH DESCRIPTION
+When using the lazy window creation optimization, windows are not
+created on the back-end X servers until they are required.
+.B DMXForceWindowCreation()
+forces the immediate creation of the window requested.
+.SH "RETURN VALUE"
+.B DMXForceWindowCreation()
+returns
+.B True
+unless there is a protocol error.
+.B DMXForceWindwoCreation()
+can generate
+.B BadWindow
+errors.
+.SH "SEE ALSO"
+.BR DMX "(3X), " Xdmx (1)
diff --git a/man/DMXGetDesktopAttributes.man b/man/DMXGetDesktopAttributes.man
new file mode 100644
index 0000000..a45b307
--- /dev/null
+++ b/man/DMXGetDesktopAttributes.man
@@ -0,0 +1,67 @@
+.\" $XFree86$
+.\"
+.\" Copyright 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:
+.\"
+.\" he 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.
+.TH DMXDesktopAttributes 3X __vendorversion__
+.SH NAME
+DMXGetDesktopAttributes \- determine global bounding box
+.SH SYNOPSIS
+.B #include <X11/extensions/dmxext.h>
+.sp
+.nf
+.BI "Bool DMXGetDesktopAttributes(Display " *dpy ,
+.BI " DMXDesktopAttributes " *attr );
+.fi
+.SH DESCRIPTION
+.B DMXGetDesktopAttributes()
+returns information about the desktop in
+.BR DMXDesktopAttributes :
+.sp
+.nf
+typedef struct {
+ unsigned int width;
+ unsigned int height;
+ int shiftX;
+ int shiftY;
+} DMXDesktopAttributes;
+.fi
+.PP
+The size of the global bounding box is given in
+.IR width ", and " height .
+The
+.IR shiftX " and " shiftY
+values will always be 0. The global bounding box is computed whether or
+not Xinerama is active, but it is only useful when using Xinerama.
+.PP
+The global bounding box used by
+.BR Xdmx (1)
+may be larger than the Xinerama screen size because of information in
+the configuration file.
+.SH "RETURN VALUE"
+.B DMXGetDesktopAttributes()
+returns
+.B True
+unless there is a protocol error.
+.SH "SEE ALSO"
+.BR DMXChangeDesktopAttributes "(3X), " DMX "(3X), " Xdmx (1)
diff --git a/man/DMXGetInputAttributes.man b/man/DMXGetInputAttributes.man
new file mode 100644
index 0000000..a88fad5
--- /dev/null
+++ b/man/DMXGetInputAttributes.man
@@ -0,0 +1,135 @@
+.\" $XFree86$
+.\"
+.\" Copyright 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:
+.\"
+.\" he 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.
+.TH DMXGetInputAttributes 3X __vendorversion__
+.SH NAME
+DMXGetInputAttributes \- determine input device attributes
+.SH SYNOPSIS
+.B #include <X11/extensions/dmxext.h>
+.sp
+.nf
+.BI "Bool DMXGetInputAttributes(Display " *dpy ,
+.BI " int " id ,
+.BI " DMXInputAttributes " *attr );
+.fi
+.SH DESCRIPTION
+.B DMXGetInputAttributes()
+returns information about the input device specified with
+.IR id .
+This information cannot be
+obtained from the
+.BR XListInputDeivices (3X)
+call.
+.I id
+is the same as that used by the
+.BR XListInputDevices (3X)
+call, and must be in
+the range 0 to one less than the value returned by
+.BR DMXGetInputCount(3X) ,
+inclusive.
+.PP
+The
+.B DMXInputAttributes
+structure is:
+.sp
+.nf
+typedef struct {
+ DMXInputEnum inputType;
+ int physicalScreen;
+ int physicalId;
+ Bool isCore;
+ Bool sendsCore;
+ const char *name;
+ Bool detached;
+} DMXInputAttributes;
+.fi
+.PP
+The value of
+.I inputType
+will always be valid, and will have one of the following values,
+depending on the type of input:
+.B DMXLocalInputType ", " DMXConsoleInputType ", or" DMXBackendInputType .
+.PP
+For local devices, all other fields returned, except
+.I isCore " and " sendsCore ,
+are invalid.
+.PP
+For console devices,
+.I physicalScreen " and " physicalID
+will be invalid, and
+.I name
+will return the name of the X server on which the console window is
+displayed.
+.PP
+For back-end devices,
+.I physicalScreen
+will identify the back-end display and can be used as an argument to
+.BR DMXGetScreenAttributes (3X)
+to obtain more information;
+.I physicalId
+will be the XInput device id on the back-end X server; and
+.I name
+will be invalid (since it does not provide any additional information
+that cannot be obtained with
+.BR DMXGetScreenAttributes (3X)).
+.PP
+If
+.I isCore
+is
+.BR True ,
+then this device is active as a true core input device and will send
+core events. If
+.B sendsCore
+is True, then this device is an XInput extension device, but sends core
+events
+.I instead
+of extension events. This behavior is different from that of XFree86 or
+Xorg, where XInput extension devices may send
+.I both
+extension events and core events.
+.PP
+If
+.I detached
+is True, then this device has been detached and is no longer producing
+input events. The device may be reattached using
+.BR DMXAddInput (3X).
+.SH "RETURN VALUE"
+.B DMXGetInputAttributes()
+returns
+.B True
+unless there is a protocol error.
+.PP
+.B DMXGetInputAttributes()
+can generate
+.B BadValue
+(if the value of
+.I id
+is out of range).
+.SH "SEE ALSO"
+.BR DMXGetInputCount "(3X), "
+.BR XListInputDevices "(3X), "
+.BR DMXGetScreenAttributes "(3X), "
+.BR DMXAddInput "(3X), "
+.BR DMX "(3X), " Xdmx (1)
diff --git a/man/DMXGetInputCount.man b/man/DMXGetInputCount.man
new file mode 100644
index 0000000..8660288
--- /dev/null
+++ b/man/DMXGetInputCount.man
@@ -0,0 +1,53 @@
+.\" $XFree86$
+.\"
+.\" Copyright 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:
+.\"
+.\" he 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.
+.TH DMXGetInputCount 3X __vendorversion__
+.SH NAME
+DMXGetInputCount \- determine number of input devices
+.SH SYNOPSIS
+.B #include <X11/extensions/dmxext.h>
+.sp
+.nf
+.BI "Bool DMXGetInputCount(Display " *dpy ,
+.BI " int " *input_count );
+.fi
+.SH DESCRIPTION
+.B DMXGetInputCount()
+returns the number of input devices connected to the
+.BR Xdmx (1)
+server in
+.IR input_count .
+This number is the same as that returned by
+.BR XListInputDevices (3X),
+but is available even when the XInput extension is not supported.
+.SH "RETURN VALUE"
+.B DMXGetInputCount()
+returns
+.B True
+unless there is a protocol error.
+.SH "SEE ALSO"
+.BR DMXGetInputAttributes "(3X), "
+.BR XListInputDevices "(3X), "
+.BR DMX "(3X), " Xdmx (1)
diff --git a/man/DMXGetScreenAttributes.man b/man/DMXGetScreenAttributes.man
new file mode 100644
index 0000000..ebb6b0d
--- /dev/null
+++ b/man/DMXGetScreenAttributes.man
@@ -0,0 +1,112 @@
+.\" $XFree86$
+.\"
+.\" Copyright 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:
+.\"
+.\" he 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.
+.TH DMXGetScreenAttributes 3X __vendorversion__
+.SH NAME
+DMXGetScreenAttributes \- determine back-end screen attributes
+.SH SYNOPSIS
+.B #include <X11/extensions/dmxext.h>
+.sp
+.nf
+.BI "Bool DMXGetScreenAttributes(Display " *dpy ,
+.BI " int " screen ,
+.BI " DMXScreenAttributes " *attr );
+.fi
+.SH DESCRIPTION
+.B DMXGetScreenAttributes()
+returns the attributes for the single DMX screen specified in
+.IR screen .
+.PP
+The
+.I DMXScreenAttributes
+structure is:
+.sp
+.nf
+typedef struct {
+ char *displayName;
+ int logicalScreen;
+
+ unsigned int screenWindowWidth;
+ unsigned int screenWindowHeight;
+ int screenWindowXoffset;
+ int screenWindowYoffset;
+
+ unsigned int rootWindowWidth;
+ unsigned int rootWindowHeight;
+ int rootWindowXoffset;
+ int rootWindowYoffset;
+
+ int rootWindowXorigin;
+ int rootWindowYorigin;
+} DMXScreenAttributes;
+.fi
+.PP
+.I displayName
+is the name used to open the display, either from the
+.BR Xdmx (1)
+command-line or from the configuration file.
+.PP
+.I logicalScreen
+is the value of the screen that that
+.BR Xdmx (1)
+server exports to clients. When Xinerama is in use, this value is
+typically 0 for all values of physicalScreen. If Xinerama is in
+use,
+.I rootWindowXorigin
+and
+.I rootWindowYorigin
+specify where the physical screen is positioned in the global Xinerama
+coordinate system. Otherwise, these values are set to 0.
+.PP
+.IR screenWindowWidth ", " screenWindowHeight ", "
+.IR screenWindowXoffset ", and " screenWindowYoffset
+are a geometry specification (see
+.BR X (7x))
+for the location of the DMX screen on the back-end screen. The
+coordinant system of the back-end display is used for these values.
+.PP
+.IR rootWindowWidth ", " rootWindowHeight ", "
+.IR rootWindowXoffset ", and " rootWindowYoffset
+are a geometry specification (see
+.BR X (7x))
+for the location of the root window on the screen window. The
+coordinant system of the screen window is used. In most cases, the root
+window will have the same geometry as the DMX screen window, and will
+occupy the same area of the back-end display. (This would not be the
+case, for example, if automatic projector alignment is used.)
+.SH "RETURN VALUE"
+.B DMXGetScreenAttributes()
+returns
+.B True
+unless there is a protocol error.
+.PP
+.B DMXGetScreenAttributes()
+can generate
+.B BadValue
+errors.
+.SH "SEE ALSO"
+.BR DMXGetScreenCount "(3X), "
+.BR DMXChangeScreenAttributes "(3X), "
+.BR DMX "(3X), " Xdmx (1)
diff --git a/man/DMXGetScreenCount.man b/man/DMXGetScreenCount.man
new file mode 100644
index 0000000..421f2e3
--- /dev/null
+++ b/man/DMXGetScreenCount.man
@@ -0,0 +1,68 @@
+.\" $XFree86$
+.\"
+.\" Copyright 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:
+.\"
+.\" he 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.
+.TH DMXGetScreenCount 3X __vendorversion__
+.SH NAME
+DMXGetScreenCount \- determine number of back-end screens
+.SH SYNOPSIS
+.B #include <X11/extensions/dmxext.h>
+.sp
+.nf
+.BI "Bool DMXGetScreenCount(Display " *dpy ,
+.BI " int " *screen_count );
+.fi
+.SH DESCRIPTION
+.B DMXGetScreenCount()
+returns the number of back-end screens that a
+.BR Xdmx (1)
+server controls. Since a DMX screen usually fills all of the available
+area on a back-end server, there is usually a one-to-one correspondence
+between DMX screens and backend servers. However, it is also possible
+for a DMX screen to cover only part of the available area on a back-end
+server, and for more than one DMX screens to occupy different parts of
+the visible area on the same back-end server.
+.PP
+A DMX screen may be managed as a regular X screen in the
+.BR Xdmx (1)
+server or may be joined with other DMX screens using Xinerama.
+.SH "RETURN VALUE"
+.B DMXGetScreenCount()
+sets
+.I screen_count
+and returns
+.B True
+unless there is a protocol error.
+.SH NOTES
+If Xinerama is active, only one logical screen will be available to
+clients of the
+.BR Xdmx (1)
+server. However, this call will accurately reflect the number of
+composite back-end screens that the
+.BR Xdmx (1)
+server is using.
+.SH "SEE ALSO"
+.BR DMXGetScreenAttribtues "(3X), "
+.BR DMXChangeScreenAttributes "(3X), "
+.BR DMX "(3X), " Xdmx (1)
diff --git a/man/DMXGetWindowAttributes.man b/man/DMXGetWindowAttributes.man
new file mode 100644
index 0000000..034e3ed
--- /dev/null
+++ b/man/DMXGetWindowAttributes.man
@@ -0,0 +1,154 @@
+.\" $XFree86$
+.\"
+.\" Copyright 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:
+.\"
+.\" he 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.
+.TH DMXGetWindowAttributes 3X __vendorversion__
+.SH NAME
+DMXGetWindowAttributes \- determine back-end window attributes
+.SH SYNOPSIS
+.B #include <X11/extensions/dmxext.h>
+.sp
+.nf
+.BI "Bool DMXGetWindowAttributes(Display " *dpy ,
+.BI " Window " window ,
+.BI " int " *screen_count ,
+.BI " int " available_count ,
+.BI " DMXWindowAttributes " *attr );
+.fi
+.SH DESCRIPTION
+When calling
+.BR DMXGetWindowAttributes() ,
+.I window
+specifies the window ID of a window on the
+.BR Xdmx (1)
+server and
+.I available_count
+specifies the length of
+.I attr.
+.PP
+The number of screens for which information is available will be
+returned in
+.I screen_count
+and information about those screen will be returned in
+.IR attr .
+If
+.I screen_count
+is less than
+.IR available_count ,
+then information for all of the screens will be returned. Otherwise,
+information for the first
+.I available_count
+screens will be returned.
+.PP
+The
+.I DMXWindowAttributes
+structure is:
+.sp
+.nf
+typedef struct {
+ int screen;
+ Window window;
+ XRectangle pos, vis;
+} DMXWindowAttributes;
+.fi
+.PP
+For each back-end X server that displays a portion of
+.IR window ,
+this structure contains the physical
+.I screen
+containing that portion, the
+.I window
+ID on the back-end X server of the window containing that portion, the
+position and dimensions of the window on the back-end
+.RI ( pos ,
+in screen coordinates), and the visible area of the window on the
+back-end
+.RI ( vis ,
+in window-relative coordinates -- all zeros if the window is not visible
+on the backend).
+.PP
+To obtain more information about the physical screen use the
+.BR DMXGetScreenAttributes (3X)
+call.
+.PP
+Note that DMX allows multiple back-end windows to overlap in their
+view of the DMX logical window. Further, a logical window does not
+have to be completely covered by back-end windows -- there may be
+gaps.
+.PP
+As an example, consider a 500x500 window that spans the top two
+1024x768 back-end displays (A and B) of a 2048x1536 DMX display
+composed of 4 1024x768 back-end displays arranged in a cube:
+.sp
+.nf
+ A B
+ C D
+.fi
+.sp
+In this case, the DMXGetWindowAttributes call would return the
+following information for the 500x500 window:
+.sp
+.nf
+display A: 500x500 window at 1024-250,0 (relative to back end)
+ with 250x500 visible at 0,0 (relative to window origin)
+
+display B: 500x500 window at -250,0 (relative to back end)
+ with 250x500 visible at 250,0 (relative to window origin)
+
+display C: 500x500 window at 1024-250,-768 with 0x0 visible at 0,0
+
+display D: 500x500 window at -250,-768 with 0x0 visible at 0,0
+.fi
+.SH "RETURN VALUE"
+.B DMXGetWindowAttributes()
+returns
+.B True
+unless there is a protocol error.
+.PP
+.B DMXGetWindowAttributes()
+can generate
+.B BadWindow
+and
+.B BadAlloc
+errors.
+.SH NOTES
+Because this call transports a great deal of information over the wire,
+please call
+.BR DMXGetScreenCount (3X)
+first, and make sure
+.I attr
+is sufficiently large.
+.PP
+On a particular back-end server, it is possible that the associated
+window has not yet been mapped because the
+.BR XMapWindow (3X)
+call that will eventually map the window had been buffered by Xlib's
+normal buffering system. To avoid this race condition, please call
+.BR DMXSync (3X)
+before communicating directly with the back-end X server.
+.SH "SEE ALSO"
+.BR DMXGetScreenCount "(3X), "
+.BR DMXSync "(3X), "
+.BR DMXGetScreenAttributes "(3X), "
+.BR DMX "(3X), " Xdmx (1)
diff --git a/man/DMXQueryExtension.man b/man/DMXQueryExtension.man
new file mode 100644
index 0000000..87f31f8
--- /dev/null
+++ b/man/DMXQueryExtension.man
@@ -0,0 +1,55 @@
+.\" $XFree86$
+.\"
+.\" Copyright 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:
+.\"
+.\" he 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.
+.TH DMXQueryExtension 3X __vendorversion__
+.SH NAME
+DMXQueryExtension \- determine if DMX is available
+.SH SYNOPSIS
+.B #include <X11/extensions/dmxext.h>
+.sp
+.nf
+.BI "Bool DMXQueryExtension(Display " *dpy ,
+.BI " int " *event_basep ,
+.BI " int " *error_basep );
+.fi
+.SH DESCRIPTION
+.B DMXQueryExtension()
+determines if the DMX protocol extension is available. It will be
+available if the server is an
+.BR Xdmx (1)
+server.
+.SH "RETURN VALUE"
+If the DMX protocol extension is available,
+.I event_basep
+and
+.I error_basep
+will be set to the event and error bases, respectively, and
+.B True
+will be returned. Otherwise,
+.B False
+will be returned.
+.SH "SEE ALSO"
+.BR DMXQueryVersion "(3X), "
+.BR DMX "(3X), " Xdmx (1)
diff --git a/man/DMXQueryVersion.man b/man/DMXQueryVersion.man
new file mode 100644
index 0000000..6da9222
--- /dev/null
+++ b/man/DMXQueryVersion.man
@@ -0,0 +1,80 @@
+.\" $XFree86$
+.\"
+.\" Copyright 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:
+.\"
+.\" he 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.
+.TH DMXQueryVersion 3X __vendorversion__
+.SH NAME
+DMXQueryVersion \- determine DMX extension version
+.SH SYNOPSIS
+.B #include <X11/extensions/dmxext.h>
+.sp
+.nf
+.BI "Bool DMXQueryVersion(Display " *dpy ,
+.BI " int " *major_version ,
+.BI " int " *minor_version ,
+.BI " int " *patch_version );
+.fi
+.SH DESCRIPTION
+.B DMXQueryVersion()
+returns version information about the DMX protocol extension.
+.PP
+Any incompatible changes to the protocol will be indicated by
+a change in
+.IR major_version .
+Small, upward-compatible changes will be indicated by a change in
+.IR minor_version .
+In general,
+.I patch_version
+is for informational purposes and will encode the date of the last
+protocol revision (e.g., 20040604).
+.SH "RETURN VALUE"
+If the DMX protocol extension is available,
+.IR major_version ,
+.IR minor_version ,
+and
+.I patch_version
+will be set, and
+.B True
+will be returned. Otherwise,
+.B False
+will be returned.
+.SH NOTES
+At the time of this writing, the DMX protocol is at version 2.2.
+.PP
+Version 2.2 was the final development version, and code supporting this
+version was submitted to upstream X server repositories in the summer of
+2004.
+.PP
+Version 1.5 was the last of the 1.x series, which was used for
+development before screen and input addition and removal were supported.
+Version 2.0 and 2.1 were development versions that partially supported
+screen and input addition and removal.
+.PP
+Since we do not expect development versions to be widely used, we
+recommend that any software that uses the DMX protocol extension to
+support only versions 2.2 and above (although they should detect earlier
+versions and either reduce functionality or fail gracefully).
+.SH "SEE ALSO"
+.BR DMXQueryExtension "(3X), "
+.BR DMX "(3X), " Xdmx (1)
diff --git a/man/DMXRemoveInput.man b/man/DMXRemoveInput.man
new file mode 100644
index 0000000..e380223
--- /dev/null
+++ b/man/DMXRemoveInput.man
@@ -0,0 +1,59 @@
+.\" $XFree86$
+.\"
+.\" Copyright 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:
+.\"
+.\" he 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.
+.TH DMXRemoveInput 3X __vendorversion__
+.SH NAME
+DMXRemoveInput \- detach an input
+.SH SYNOPSIS
+.B #include <X11/extensions/dmxext.h>
+.sp
+.nf
+.BI "Bool DMXRemoveInput(Display " *dpy ,
+.BI " int " id );
+.fi
+.SH DESCRIPTION
+.B DMXRemoveInput()
+detaches the input device with
+.IR id ,
+and all associated inputs (e.g., if the
+.I id
+is a backend mouse, and a keyboard is also attached to the backend, then
+both devices will be detached).
+.SH "RETURN VALUE"
+.B DMXRemoveInput()
+returns
+.B True
+unless there is a protocol error.
+.PP
+.B DMXRemoveInput()
+can generate
+.B BadValue
+(if the
+.I id
+is not valid) and
+.B BadAccess
+(if the input has already been detached).
+.SH "SEE ALSO"
+.BR DMXAddInput "(3X), " DMX "(3X), " Xdmx (1)
diff --git a/man/DMXRemoveScreen.man b/man/DMXRemoveScreen.man
new file mode 100644
index 0000000..fff3be9
--- /dev/null
+++ b/man/DMXRemoveScreen.man
@@ -0,0 +1,60 @@
+.\" $XFree86$
+.\"
+.\" Copyright 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:
+.\"
+.\" he 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.
+.TH DMXRemoveScreen 3X __vendorversion__
+.SH NAME
+DMXRemoveScreen \- detach a back-end screen
+.SH SYNOPSIS
+.B #include <X11/extensions/dmxext.h>
+.sp
+.nf
+.BI "Bool DMXRemoveScreen(Display " *dpy ,
+.BI " int " screen );
+.fi
+.SH DESCRIPTION
+.B DMXRemoveScreen()
+detaches the back-end
+.I screen
+from the
+.BR Xdmx (1)
+server.
+.SH "RETURN VALUE"
+.B DMXRemoveScreen()
+returns
+.B True
+on success, and
+.B False
+if there were protocol errors, if the
+.I \-addremovescreens
+command-line option was not specified on the
+.BR Xdmx (1)
+command line, if the value of
+.I screen
+is out of range, or if the back-end screen specified by
+.I screen
+has already been detached.
+.SH "SEE ALSO"
+.BR DMXAddScreen "(3X), "
+.BR DMX "(3X), " Xdmx (1)
diff --git a/man/DMXSync.man b/man/DMXSync.man
new file mode 100644
index 0000000..e0ab6e7
--- /dev/null
+++ b/man/DMXSync.man
@@ -0,0 +1,50 @@
+.\" $XFree86$
+.\"
+.\" Copyright 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:
+.\"
+.\" he 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.
+.TH DMXSync 3X __vendorversion__
+.SH NAME
+DMXSync \- flush protocol requests between Xdmx and back-end X servers
+.SH SYNOPSIS
+.B #include <X11/extensions/dmxext.h>
+.sp
+.nf
+.BI "Bool DMXSync(Display " *dpy );
+.fi
+.SH DESCRIPTION
+.B DMXSync()
+flushes all pending protocol requests between the
+.BR Xdmx (1)
+server and each back-end X server. It is used by clients that talk
+directly to back-end X servers to ensure that all pending
+.BR Xdmx (1)
+requests have reached all back-end servers and have been processed by
+those servers.
+.SH "RETURN VALUE"
+.B DMXSync()
+returns
+.BR True
+unless there is a protocol error.
+.SH "SEE ALSO"
+.BR DMX "(3X), " Xdmx (1)
diff --git a/src/dmx.c b/src/dmx.c
new file mode 100644
index 0000000..0f9c099
--- /dev/null
+++ b/src/dmx.c
@@ -0,0 +1,802 @@
+/* $XFree86$ */
+/*
+ * 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>
+ *
+ */
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD */
+
+/** \file
+ * This file implements the client-side part of the DMX protocol. It
+ * can be included in client applications by linking with the libdmx.a
+ * library. */
+
+#define NEED_REPLIES
+#include <X11/Xlibint.h>
+#include "Xext.h"
+#define EXTENSION_PROC_ARGS void *
+#include "extutil.h"
+#include "dmxproto.h"
+#include "dmxext.h"
+
+static XExtensionInfo dmx_extension_info_data;
+static XExtensionInfo *dmx_extension_info = &dmx_extension_info_data;
+static const char *dmx_extension_name = DMX_EXTENSION_NAME;
+
+#define DMXCheckExtension(dpy,i,val) \
+ XextCheckExtension(dpy, i, dmx_extension_name, val)
+#define DMXSimpleCheckExtension(dpy,i) \
+ XextSimpleCheckExtension(dpy, i, dmx_extension_name)
+
+/*****************************************************************************
+ * *
+ * private utility routines *
+ * *
+ *****************************************************************************/
+
+static int close_display(Display *dpy, XExtCodes *extCodes);
+static /* const */ XExtensionHooks dmx_extension_hooks = {
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ close_display, /* close_display */
+ NULL, /* wire_to_event */
+ NULL, /* event_to_wire */
+ NULL, /* error */
+ NULL, /* error_string */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY(find_display, dmx_extension_info,
+ (char *)dmx_extension_name,
+ &dmx_extension_hooks,
+ 0, NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY(close_display, dmx_extension_info)
+
+
+/*****************************************************************************
+ * *
+ * public DMX Extension routines *
+ * *
+ *****************************************************************************/
+
+/** If the server has the DMX extension, the event and error bases will
+ * be placed in \a event_basep and \a error_basep, and True will be
+ * returned. Otherwise, False will be returned.
+ *
+ * Available in DMX Protocol Version 1.0 */
+Bool DMXQueryExtension(Display *dpy, int *event_basep, int *error_basep)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+
+ if (XextHasExtension(info)) {
+ *event_basep = info->codes->first_event;
+ *error_basep = info->codes->first_error;
+ return True;
+ } else {
+ return False;
+ }
+}
+
+/** If the DMXQueryVersion protocol request returns version information
+ * from the server, \a majorVersion, \a minorVersion, and \a
+ * patchVersion are filled in with the appropriate information and True
+ * is returned. Otherwise, False will be returned.
+ *
+ * Available in DMX Protocol Version 1.0 */
+Bool DMXQueryVersion(Display *dpy,
+ int *majorVersion, int *minorVersion, int *patchVersion)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xDMXQueryVersionReply rep;
+ xDMXQueryVersionReq *req;
+
+ DMXCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(DMXQueryVersion, req);
+ req->reqType = info->codes->major_opcode;
+ req->dmxReqType = X_DMXQueryVersion;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ *majorVersion = rep.majorVersion;
+ *minorVersion = rep.minorVersion;
+ *patchVersion = rep.patchVersion;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+/** Flush all pending dmxSync requests in DMX server.
+ *
+ * Available in DMX Protocol Version 1.5 */
+Bool DMXSync(Display *dpy)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xDMXSyncReply rep;
+ xDMXSyncReq *req;
+
+ DMXCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(DMXSync, req);
+ req->reqType = info->codes->major_opcode;
+ req->dmxReqType = X_DMXSync;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return rep.status == Success ? True : False;
+}
+
+/** The creation of the specified \a window will be forced.
+ *
+ * Available in DMX Protocol Version 1.2
+ * Reply added in DMX Protocol Version 2.0 */
+Bool DMXForceWindowCreation(Display *dpy, Window window)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xDMXForceWindowCreationReq *req;
+ xDMXForceWindowCreationReply rep;
+
+ DMXCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(DMXForceWindowCreation, req);
+ req->reqType = info->codes->major_opcode;
+ req->dmxReqType = X_DMXForceWindowCreation;
+ req->window = window;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return rep.status == Success ? True : False;
+}
+
+/** If the DMXGetScreenCount protocol request returns the screen count,
+ * the value will be placed in \a screen_count, and True will be
+ * returned. Otherwise, False will be returned.
+ *
+ * Available in DMX Protocol Version 1.0 */
+Bool DMXGetScreenCount(Display *dpy, int *screen_count)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xDMXGetScreenCountReply rep;
+ xDMXGetScreenCountReq *req;
+
+ DMXCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(DMXGetScreenCount, req);
+ req->reqType = info->codes->major_opcode;
+ req->dmxReqType = X_DMXGetScreenCount;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ *screen_count = rep.screenCount;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+/** If the DMXGetScreenAttributes protocol request returns information
+ * for the specified \a physical_screen, information about the screen
+ * will be placed in \a attr, and True will be returned. Otherwise,
+ * False will be returned.
+ *
+ * Available in DMX Protocol Version 1.0; Modified in Version 2.0 */
+Bool DMXGetScreenAttributes(Display *dpy, int physical_screen,
+ DMXScreenAttributes *attr)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xDMXGetScreenAttributesReply rep;
+ xDMXGetScreenAttributesReq *req;
+
+ DMXCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(DMXGetScreenAttributes, req);
+ req->reqType = info->codes->major_opcode;
+ req->dmxReqType = X_DMXGetScreenAttributes;
+ req->physicalScreen = physical_screen;
+ if (!_XReply(dpy, (xReply *)&rep,
+ (SIZEOF(xDMXGetScreenAttributesReply) - 32) >> 2, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ attr->displayName = Xmalloc(rep.displayNameLength + 1 + 4 /* for pad */);
+ _XReadPad(dpy, attr->displayName, rep.displayNameLength);
+ attr->displayName[rep.displayNameLength] = '\0';
+ attr->logicalScreen = rep.logicalScreen;
+
+ attr->screenWindowWidth = rep.screenWindowWidth;
+ attr->screenWindowHeight = rep.screenWindowHeight;
+ attr->screenWindowXoffset = rep.screenWindowXoffset;
+ attr->screenWindowYoffset = rep.screenWindowYoffset;
+
+ attr->rootWindowWidth = rep.rootWindowWidth;
+ attr->rootWindowHeight = rep.rootWindowHeight;
+ attr->rootWindowXoffset = rep.rootWindowXoffset;
+ attr->rootWindowYoffset = rep.rootWindowYoffset;
+ attr->rootWindowXorigin = rep.rootWindowXorigin;
+ attr->rootWindowYorigin = rep.rootWindowYorigin;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+static CARD32 _DMXGetScreenAttribute(int bit, DMXScreenAttributes *attr)
+{
+ switch (1 << bit) {
+ case DMXScreenWindowWidth: return attr->screenWindowWidth;
+ case DMXScreenWindowHeight: return attr->screenWindowHeight;
+ case DMXScreenWindowXoffset: return attr->screenWindowXoffset;
+ case DMXScreenWindowYoffset: return attr->screenWindowYoffset;
+ case DMXRootWindowWidth: return attr->rootWindowWidth;
+ case DMXRootWindowHeight: return attr->rootWindowHeight;
+ case DMXRootWindowXoffset: return attr->rootWindowXoffset;
+ case DMXRootWindowYoffset: return attr->rootWindowYoffset;
+ case DMXRootWindowXorigin: return attr->rootWindowXorigin;
+ case DMXRootWindowYorigin: return attr->rootWindowYorigin;
+ default: return 0;
+ }
+}
+
+static int _DMXDumpScreenAttributes(Display *dpy,
+ unsigned long mask,
+ DMXScreenAttributes *attr)
+{
+ int i;
+ unsigned long value_list[32];
+ unsigned long *value = value_list;
+ int count = 0;
+
+ for (i = 0; i < 32; i++) {
+ if (mask & (1 << i)) {
+ *value++ = _DMXGetScreenAttribute(i, attr);
+ ++count;
+ }
+ }
+ Data32(dpy, value_list, count * sizeof(CARD32));
+ return count;
+}
+
+static CARD32 _DMXGetInputAttribute(int bit, DMXInputAttributes *attr)
+{
+ switch (1 << bit) {
+ case DMXInputType:
+ switch (attr->inputType) {
+ case DMXLocalInputType: return 0;
+ case DMXConsoleInputType: return 1;
+ case DMXBackendInputType: return 2;
+ }
+ return attr->inputType;
+ case DMXInputPhysicalScreen: return attr->physicalScreen;
+ case DMXInputSendsCore: return attr->sendsCore;
+ default: return 0;
+ }
+}
+
+static int _DMXDumpInputAttributes(Display *dpy,
+ unsigned long mask,
+ DMXInputAttributes *attr)
+{
+ int i;
+ unsigned long value_list[32];
+ unsigned long *value = value_list;
+ int count = 0;
+
+ for (i = 0; i < 32; i++) {
+ if (mask & (1 << i)) {
+ *value++ = _DMXGetInputAttribute(i, attr);
+ ++count;
+ }
+ }
+ Data32(dpy, value_list, count * sizeof(CARD32));
+ return count;
+}
+
+/** Change geometries and positions of the DMX screen and root windows
+ * on the back-end X server. */
+int DMXChangeScreensAttributes(Display *dpy,
+ int screen_count,
+ int *screens,
+ int mask_count,
+ unsigned int *masks,
+ DMXScreenAttributes *attrs, /* vector */
+ int *error_screen)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xDMXChangeScreensAttributesReply rep;
+ xDMXChangeScreensAttributesReq *req;
+ int i;
+ unsigned int mask = 0;
+ CARD32 *screen_list;
+ CARD32 *mask_list;
+
+ DMXCheckExtension(dpy, info, False);
+
+ if (screen_count < 1 || mask_count < 1) return DmxBadValue;
+
+ LockDisplay(dpy);
+ GetReq(DMXChangeScreensAttributes, req);
+ req->reqType = info->codes->major_opcode;
+ req->dmxReqType = X_DMXChangeScreensAttributes;
+ req->screenCount = screen_count;
+ req->maskCount = mask_count;
+ req->length += screen_count + mask_count;
+
+ screen_list = (CARD32 *)Xmalloc(sizeof(*screen_list) * screen_count);
+ for (i = 0; i < screen_count; i++) screen_list[i] = screens[i];
+ Data32(dpy, screen_list, screen_count * sizeof(CARD32));
+ Xfree(screen_list);
+
+ mask_list = (CARD32 *)Xmalloc(sizeof(*mask_list) * mask_count);
+ for (i = 0; i < mask_count; i++) mask_list[i] = masks[i];
+ Data32(dpy, mask_list, mask_count * sizeof(CARD32));
+ Xfree(mask_list);
+
+ for (i = 0; i < screen_count; i++) {
+ if (i < mask_count) mask = masks[i];
+ req->length += _DMXDumpScreenAttributes(dpy, mask, attrs + i);
+ }
+
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return DmxBadReply;
+ }
+ if (error_screen) *error_screen = rep.errorScreen;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return rep.status;
+}
+
+/** Add a screen. */
+Bool DMXAddScreen(Display *dpy, const char *displayName, unsigned int mask,
+ DMXScreenAttributes *attr, int *screen)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xDMXAddScreenReply rep;
+ xDMXAddScreenReq *req;
+ int length;
+ int paddedLength;
+
+ DMXCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(DMXAddScreen, req);
+ length = displayName ? strlen(displayName) : 0;
+ paddedLength = (length + 3) & ~3;
+ req->reqType = info->codes->major_opcode;
+ req->dmxReqType = X_DMXAddScreen;
+ req->displayNameLength = length;
+ req->physicalScreen = *screen;
+ req->valueMask = mask;
+ req->length += paddedLength/4;
+ req->length += _DMXDumpScreenAttributes(dpy, mask, attr);
+
+ if (length) {
+ char *buffer = Xmalloc(paddedLength);
+ memset(buffer, 0, paddedLength);
+ strcpy(buffer, displayName);
+ Data32(dpy, buffer, paddedLength);
+ Xfree(buffer);
+ }
+
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ if (screen) *screen = rep.physicalScreen;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return rep.status == Success ? True : False;
+}
+
+/** Remove a screen. */
+Bool DMXRemoveScreen(Display *dpy, int screen)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xDMXRemoveScreenReply rep;
+ xDMXRemoveScreenReq *req;
+
+ DMXCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(DMXRemoveScreen, req);
+ req->reqType = info->codes->major_opcode;
+ req->dmxReqType = X_DMXRemoveScreen;
+ req->physicalScreen = screen;
+
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return rep.status == Success ? True : False;
+}
+
+/** If the DMXGetWindowAttributes protocol request returns information
+ * about the specified \a window, the number of screens for which
+ * information is available will be returned in \a screen_count and
+ * information about the first \a available_count of those screens will
+ * be placed in \a inf. Because this call transports a great deal of
+ * information over the wire, please call #DMXGetScreenCount first, and
+ * make sure \a inf is that large.
+ *
+ * Note that if the specified \a window has not yet been mapped when
+ * #DMXGetWindowAttributes is called, then a subsequent XMapWindow call
+ * might be buffered in xlib while requests directly to the back-end X
+ * servers are processed. This race condition can be solved by calling
+ * #DMXSync before talking directly to the back-end X servers.
+ *
+ * Available in DMX Protocol Version 1.0, but not working correctly
+ * until DMX Protocol Version 1.4 */
+Bool DMXGetWindowAttributes(Display *dpy, Window window,
+ int *screen_count, int available_count,
+ DMXWindowAttributes *inf)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xDMXGetWindowAttributesReply rep;
+ xDMXGetWindowAttributesReq *req;
+ unsigned long current;
+ CARD32 *screens; /* Must match protocol size */
+ CARD32 *windows; /* Must match protocol size */
+ XRectangle *pos; /* Must match protocol size */
+ XRectangle *vis; /* Must match protocol size */
+
+ DMXCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(DMXGetWindowAttributes, req);
+ req->reqType = info->codes->major_opcode;
+ req->dmxReqType = X_DMXGetWindowAttributes;
+ req->window = window;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+
+ /* FIXME: check for NULL? */
+ screens = Xmalloc(rep.screenCount * sizeof(*screens));
+ windows = Xmalloc(rep.screenCount * sizeof(*windows));
+ pos = Xmalloc(rep.screenCount * sizeof(*pos));
+ vis = Xmalloc(rep.screenCount * sizeof(*vis));
+
+ _XRead(dpy, (char *)screens, rep.screenCount * sizeof(*screens));
+ _XRead(dpy, (char *)windows, rep.screenCount * sizeof(*windows));
+ _XRead(dpy, (char *)pos, rep.screenCount * sizeof(*pos));
+ _XRead(dpy, (char *)vis, rep.screenCount * sizeof(*vis));
+
+ *screen_count = rep.screenCount;
+ for (current = 0;
+ current < rep.screenCount && current < (unsigned)available_count;
+ current++, inf++) {
+ inf->screen = screens[current];
+ inf->window = windows[current];
+ inf->pos = pos[current];
+ inf->vis = vis[current];
+ }
+
+ Xfree(vis);
+ Xfree(pos);
+ Xfree(windows);
+ Xfree(screens);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+/** If the DMXGetDesktopAttributes protocol request returns information
+ * correctly, the information will be placed in \a attr, and True will
+ * be returned. Otherwise, False will be returned.
+ *
+ * Available in DMX Protocol Version 2.0 */
+Bool DMXGetDesktopAttributes(Display *dpy, DMXDesktopAttributes *attr)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xDMXGetDesktopAttributesReply rep;
+ xDMXGetDesktopAttributesReq *req;
+
+ DMXCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(DMXGetDesktopAttributes, req);
+ req->reqType = info->codes->major_opcode;
+ req->dmxReqType = X_DMXGetDesktopAttributes;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ attr->width = rep.width;
+ attr->height = rep.height;
+ attr->shiftX = rep.shiftX;
+ attr->shiftY = rep.shiftY;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+static CARD32 _DMXGetDesktopAttribute(int bit, DMXDesktopAttributes *attr)
+{
+ switch (1 << bit) {
+ case DMXDesktopWidth: return attr->width;
+ case DMXDesktopHeight: return attr->height;
+ case DMXDesktopShiftX: return attr->shiftX;
+ case DMXDesktopShiftY: return attr->shiftY;
+ default: return 0;
+ }
+}
+
+static int _DMXDumpDesktopAttributes(Display *dpy,
+ unsigned long mask,
+ DMXDesktopAttributes *attr)
+{
+ int i;
+ unsigned long value_list[32];
+ unsigned long *value = value_list;
+ int count = 0;
+
+ for (i = 0; i < 32; i++) {
+ if (mask & (1 << i)) {
+ *value++ = _DMXGetDesktopAttribute(i, attr);
+ ++count;
+ }
+ }
+ Data32(dpy, value_list, count * sizeof(CARD32));
+ return count;
+}
+
+/** Change the global bounding box and origin offset.
+ *
+ * Available in DMX Protocol Version 2.0 */
+int DMXChangeDesktopAttributes(Display *dpy,
+ unsigned int mask,
+ DMXDesktopAttributes *attr)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xDMXChangeDesktopAttributesReply rep;
+ xDMXChangeDesktopAttributesReq *req;
+
+ DMXCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(DMXChangeDesktopAttributes, req);
+ req->reqType = info->codes->major_opcode;
+ req->dmxReqType = X_DMXChangeDesktopAttributes;
+ req->valueMask = mask;
+ req->length +=_DMXDumpDesktopAttributes(dpy, mask, attr);
+
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return DmxBadReply;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return rep.status;
+}
+
+/** If the DMXGetInputCount protocol request returns the input count,
+ * the value will be placed in \a input_count, and True will be
+ * returned. Otherwise, False will be returned.
+ *
+ * Available in DMX Protocol Version 1.1 */
+Bool DMXGetInputCount(Display *dpy, int *input_count)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xDMXGetInputCountReply rep;
+ xDMXGetInputCountReq *req;
+
+ DMXCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(DMXGetInputCount, req);
+ req->reqType = info->codes->major_opcode;
+ req->dmxReqType = X_DMXGetInputCount;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ *input_count = rep.inputCount;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+/** If the DMXGetInputAttributes protocol request returns information
+ * about the input device with the specified \a id, information about
+ * the input device will be placed in \a inf, and True will be returned.
+ * Otherwise, False will be returned.
+ *
+ * Available in DMX Protocol Version 1.1 */
+Bool DMXGetInputAttributes(Display *dpy, int id, DMXInputAttributes *inf)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xDMXGetInputAttributesReply rep;
+ xDMXGetInputAttributesReq *req;
+ char *buffer;
+
+ DMXCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(DMXGetInputAttributes, req);
+ req->reqType = info->codes->major_opcode;
+ req->dmxReqType = X_DMXGetInputAttributes;
+ req->deviceId = id;
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+
+ switch (rep.inputType) {
+ case 0: inf->inputType = DMXLocalInputType; break;
+ case 1: inf->inputType = DMXConsoleInputType; break;
+ case 2: inf->inputType = DMXBackendInputType; break;
+ }
+
+ inf->physicalScreen = rep.physicalScreen;
+ inf->physicalId = rep.physicalId;
+ inf->isCore = rep.isCore;
+ inf->sendsCore = rep.sendsCore;
+ inf->detached = rep.detached;
+ buffer = Xmalloc(rep.nameLength + 1 + 4 /* for pad */);
+ _XReadPad(dpy, buffer, rep.nameLength);
+ buffer[rep.nameLength] = '\0';
+ inf->name = buffer;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return True;
+}
+
+/** Add input. */
+Bool DMXAddInput(Display *dpy, unsigned int mask, DMXInputAttributes *attr,
+ int *id)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xDMXAddInputReply rep;
+ xDMXAddInputReq *req;
+ int length;
+ int paddedLength;
+
+ DMXCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(DMXAddInput, req);
+ length = attr->name ? strlen(attr->name) : 0;
+ paddedLength = (length + 3) & ~3;
+ req->reqType = info->codes->major_opcode;
+ req->dmxReqType = X_DMXAddInput;
+ req->displayNameLength = length;
+ req->valueMask = mask;
+ req->length += paddedLength/4;
+ req->length += _DMXDumpInputAttributes(dpy, mask, attr);
+
+ if (length) {
+ char *buffer = Xmalloc(paddedLength);
+ memset(buffer, 0, paddedLength);
+ strcpy(buffer, attr->name);
+ Data32(dpy, buffer, paddedLength);
+ Xfree(buffer);
+ }
+
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ if (id) *id = rep.physicalId;
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return rep.status == Success ? True : False;
+}
+
+/** Add backend input (a helper function that calls #DMXAddInput). */
+Bool DMXAddBackendInput(Display *dpy, int screen, int sendsCore, int *newId)
+{
+ DMXInputAttributes attr;
+ unsigned int mask = (DMXInputType
+ | DMXInputPhysicalScreen
+ | DMXInputSendsCore);
+
+ attr.inputType = DMXBackendInputType;
+ attr.physicalScreen = screen;
+ attr.sendsCore = sendsCore;
+ attr.name = NULL;
+ return DMXAddInput(dpy, mask, &attr, newId);
+}
+
+/** Add console input (a helper function that calls #DMXAddInput). */
+Bool DMXAddConsoleInput(Display *dpy, const char *name, int sendsCore,
+ int *newId)
+{
+ DMXInputAttributes attr;
+ unsigned int mask = (DMXInputType
+ | DMXInputSendsCore);
+
+ attr.inputType = DMXConsoleInputType;
+ attr.physicalScreen = 0;
+ attr.sendsCore = sendsCore;
+ attr.name = name;
+ return DMXAddInput(dpy, mask, &attr, newId);
+}
+
+/** Remove an input. */
+Bool DMXRemoveInput(Display *dpy, int id)
+{
+ XExtDisplayInfo *info = find_display(dpy);
+ xDMXRemoveInputReply rep;
+ xDMXRemoveInputReq *req;
+
+ DMXCheckExtension(dpy, info, False);
+
+ LockDisplay(dpy);
+ GetReq(DMXRemoveInput, req);
+ req->reqType = info->codes->major_opcode;
+ req->dmxReqType = X_DMXRemoveInput;
+ req->physicalId = id;
+
+ if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return rep.status == Success ? True : False;
+}