diff options
Diffstat (limited to 'libXinerama')
-rw-r--r-- | libXinerama/Makefile.am | 84 | ||||
-rw-r--r-- | libXinerama/configure.ac | 2 | ||||
-rw-r--r-- | libXinerama/include/X11/extensions/Xinerama.h | 6 | ||||
-rw-r--r-- | libXinerama/include/X11/extensions/panoramiXext.h | 170 | ||||
-rw-r--r-- | libXinerama/man/Xinerama.man | 246 | ||||
-rw-r--r-- | libXinerama/src/Xinerama.c | 626 |
6 files changed, 567 insertions, 567 deletions
diff --git a/libXinerama/Makefile.am b/libXinerama/Makefile.am index 86f6e7fd8..d744d0f91 100644 --- a/libXinerama/Makefile.am +++ b/libXinerama/Makefile.am @@ -1,42 +1,42 @@ -#
-# Copyright 2005 Red Hat, Inc.
-#
-# 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 Red Hat not be used in
-# advertising or publicity pertaining to distribution of the software without
-# specific, written prior permission. Red Hat makes no
-# representations about the suitability of this software for any purpose. It
-# is provided "as is" without express or implied warranty.
-#
-# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
-# EVENT SHALL RED HAT 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.
-
-SUBDIRS = src man
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = xinerama.pc
-
-MAINTAINERCLEANFILES = ChangeLog INSTALL
-
-.PHONY: ChangeLog INSTALL
-
-INSTALL:
- $(INSTALL_CMD)
-
-ChangeLog:
- $(CHANGELOG_CMD)
-
-dist-hook: ChangeLog INSTALL
-
-if LINT
-lint:
- (cd src && $(MAKE) $(MFLAGS) lint)
-endif LINT
+# +# Copyright 2005 Red Hat, Inc. +# +# 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 Red Hat not be used in +# advertising or publicity pertaining to distribution of the software without +# specific, written prior permission. Red Hat makes no +# representations about the suitability of this software for any purpose. It +# is provided "as is" without express or implied warranty. +# +# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +# EVENT SHALL RED HAT 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. + +SUBDIRS = src man + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = xinerama.pc + +MAINTAINERCLEANFILES = ChangeLog INSTALL + +.PHONY: ChangeLog INSTALL + +INSTALL: + $(INSTALL_CMD) + +ChangeLog: + $(CHANGELOG_CMD) + +dist-hook: ChangeLog INSTALL + +if LINT +lint: + (cd src && $(MAKE) $(MFLAGS) lint) +endif LINT diff --git a/libXinerama/configure.ac b/libXinerama/configure.ac index 04dfc9d1b..872771969 100644 --- a/libXinerama/configure.ac +++ b/libXinerama/configure.ac @@ -46,7 +46,7 @@ PKG_CHECK_MODULES(XINERAMA, x11 xext xextproto [xineramaproto >= 1.1.99.1]) # Allow checking code with lint, sparse, etc. XORG_WITH_LINT LINT_FLAGS="${LINT_FLAGS} ${XINERAMA_CFLAGS}" - + AC_CONFIG_FILES([Makefile src/Makefile man/Makefile diff --git a/libXinerama/include/X11/extensions/Xinerama.h b/libXinerama/include/X11/extensions/Xinerama.h index 666f52a78..8c0f8296a 100644 --- a/libXinerama/include/X11/extensions/Xinerama.h +++ b/libXinerama/include/X11/extensions/Xinerama.h @@ -54,15 +54,15 @@ Status XineramaQueryVersion( Bool XineramaIsActive(Display *dpy); -/* +/* Returns the number of heads and a pointer to an array of structures describing the position and size of the individual heads. Returns NULL and number = 0 if Xinerama is not active. - + Returned array should be freed with XFree(). */ -XineramaScreenInfo * +XineramaScreenInfo * XineramaQueryScreens( Display *dpy, int *number diff --git a/libXinerama/include/X11/extensions/panoramiXext.h b/libXinerama/include/X11/extensions/panoramiXext.h index aacc4fc43..8312a173b 100644 --- a/libXinerama/include/X11/extensions/panoramiXext.h +++ b/libXinerama/include/X11/extensions/panoramiXext.h @@ -1,85 +1,85 @@ -/*****************************************************************
-Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
-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.
-
-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
-DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
-BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
-shall not be used in advertising or otherwise to promote the sale, use or other
-dealings in this Software without prior written authorization from Digital
-Equipment Corporation.
-******************************************************************/
-/*
- * PanoramiX definitions
- */
-
-/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
-
-#ifndef _panoramiXext_h
-#define _panoramiXext_h
-
-#include <X11/Xfuncproto.h>
-
-typedef struct {
- Window window; /* PanoramiX window - may not exist */
- int screen;
- int State; /* PanoramiXOff, PanoramiXOn */
- int width; /* width of this screen */
- int height; /* height of this screen */
- int ScreenCount; /* real physical number of screens */
- XID eventMask; /* selected events for this client */
-} XPanoramiXInfo;
-
-_XFUNCPROTOBEGIN
-
-extern Bool XPanoramiXQueryExtension (
- Display * /* dpy */,
- int * /* event_base_return */,
- int * /* error_base_return */
-);
-
-extern Status XPanoramiXQueryVersion(
- Display * /* dpy */,
- int * /* major_version_return */,
- int * /* minor_version_return */
-);
-
-extern XPanoramiXInfo *XPanoramiXAllocInfo (
- void
-);
-
-extern Status XPanoramiXGetState (
- Display * /* dpy */,
- Drawable /* drawable */,
- XPanoramiXInfo * /* panoramiX_info */
-);
-
-extern Status XPanoramiXGetScreenCount (
- Display * /* dpy */,
- Drawable /* drawable */,
- XPanoramiXInfo * /* panoramiX_info */
-);
-
-extern Status XPanoramiXGetScreenSize (
- Display * /* dpy */,
- Drawable /* drawable */,
- int /* screen_num */,
- XPanoramiXInfo * /* panoramiX_info */
-);
-
-_XFUNCPROTOEND
-
-#endif /* _panoramiXext_h */
+/***************************************************************** +Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. +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. + +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 +DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, +BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation +shall not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization from Digital +Equipment Corporation. +******************************************************************/ +/* + * PanoramiX definitions + */ + +/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */ + +#ifndef _panoramiXext_h +#define _panoramiXext_h + +#include <X11/Xfuncproto.h> + +typedef struct { + Window window; /* PanoramiX window - may not exist */ + int screen; + int State; /* PanoramiXOff, PanoramiXOn */ + int width; /* width of this screen */ + int height; /* height of this screen */ + int ScreenCount; /* real physical number of screens */ + XID eventMask; /* selected events for this client */ +} XPanoramiXInfo; + +_XFUNCPROTOBEGIN + +extern Bool XPanoramiXQueryExtension ( + Display * /* dpy */, + int * /* event_base_return */, + int * /* error_base_return */ +); + +extern Status XPanoramiXQueryVersion( + Display * /* dpy */, + int * /* major_version_return */, + int * /* minor_version_return */ +); + +extern XPanoramiXInfo *XPanoramiXAllocInfo ( + void +); + +extern Status XPanoramiXGetState ( + Display * /* dpy */, + Drawable /* drawable */, + XPanoramiXInfo * /* panoramiX_info */ +); + +extern Status XPanoramiXGetScreenCount ( + Display * /* dpy */, + Drawable /* drawable */, + XPanoramiXInfo * /* panoramiX_info */ +); + +extern Status XPanoramiXGetScreenSize ( + Display * /* dpy */, + Drawable /* drawable */, + int /* screen_num */, + XPanoramiXInfo * /* panoramiX_info */ +); + +_XFUNCPROTOEND + +#endif /* _panoramiXext_h */ diff --git a/libXinerama/man/Xinerama.man b/libXinerama/man/Xinerama.man index a68fd943f..37741310d 100644 --- a/libXinerama/man/Xinerama.man +++ b/libXinerama/man/Xinerama.man @@ -1,123 +1,123 @@ -.\"
-.\" Copyright (c) 2007, Oracle and/or its affiliates. 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 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 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.
-.\"
-.de TQ
-.br
-.ns
-.TP \\$1
-..
-.TH XINERAMA __libmansuffix__ __vendorversion__
-.SH NAME
-Xinerama \- API for Xinerama extension to X11 Protocol
-.SH SYNOPSIS
-\&#include <X11/extensions/Xinerama.h>
-.nf
-.sp
-Bool XineramaQueryExtension \^(\^Display *\fIdpy\fP,
- int *\fIevent_base_return\fP, int *\fIerror_base_return\fP\^);
-.sp
-Status XineramaQueryVersion \^(\^Display *\fIdpy\fP,
- int *\fImajor_version_return\fP,
- int *\fIminor_version_return\fP\^);
-.sp
-Bool XineramaIsActive \^(\^Display *\fIdpy\fP\^);
-.sp
-XineramaScreenInfo * XineramaQueryScreens \^(\^Display *\fIdpy\fP,
- int *\fInumber\fP\^);
-.fi
-.SH ARGUMENTS
-.IP \fIdisplay\fP 1i
-Specifies the connection to the X server.
-.IP \fIevent_base_return\fP 1i
-Specifies the return location for the assigned base event code
-.IP \fIerror_base_return\fP 1i
-Specifies the return location for the assigned base error code
-.IP \fImajor_version_return\fP 1i
-Returns the major version supported by the server
-.IP \fIminor_version_return\fP 1i
-Returns the minor version supported by the server
-.IP \fInumber\fP 1i
-Returns the number of entries in the returned XineramaScreenInfo array.
-.SH DESCRIPTION
-.B Xinerama
-is a simple library designed to interface the Xinerama Extension for
-retrieving information about physical output devices which may be combined
-into a single logical X screen.
-
-.SH FUNCTIONS
-
-.SS \fBXineramaQueryExtension()\fR
-
-.LP
-The XineramaQueryExtension function queries the Xserver to determine the
-availability of the Xinerama Extension. If the extension is available, the
-return value is True, and event_base_return and error_base_return are set to
-the base event number and base error number for the extension, respectively.
-Otherwise, the return value is False, and the values of event_base_return and
-error_base_return are undefined.
-.sp
-
-.SS \fBXineramaQueryVersion()\fR
-
-.LP
-The XineramaQueryVersion function returns the version of the Xinerama extension
-implemented by the Xserver. The version is returned in major_version_return
-and minor_version_return. The major version will be incremented for protocol
-incompatible changes, and the minor version will be incremented for small,
-upwardly compatible changes.
-.LP
-If the Xinerama library is compatible with the version returned by the
-server, it returns nonzero. If the server does not support the
-XINERAMA extension, or if there was an error during communications
-with the server, or if the server and library protocol versions are
-incompatible, it returns zero.
-.sp
-
-.SS \fBXineramaIsActive()\fR
-
-.LP
-The XineramaIsActive function returns a Boolean operator used to determine if
-Xinerama is activated on the screen. Returns True for active and False for
-not active.
-.sp
-
-.SS \fBXineramaQueryScreens()\fR
-
-.LP
-The \fBXineramaQueryScreens()\fR function returns info about each
-individual output device within the Xinerama Screen. The integer
-pointed to by the \fInumber\fR argument is updated to the number of
-output devices listed in the returned array of \fIXineramaScreenInfo\fR
-structures. \fBXineramaQueryScreens()\fR returns NULL and sets \fInumber\fR
-to 0 if Xinerama is not active.
-
-The pointer returned should be released with XFree(__libmansuffix__)
-when no longer needed.
-.sp
-
-.SH NOTE
-The original API provided for interacting with the XINERAMA extension used
-function names beginning with \fIXPanoramiX\fR. That API is now deprecated
-and this API should be used instead in new software.
-
-
-
+.\" +.\" Copyright (c) 2007, Oracle and/or its affiliates. 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 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 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. +.\" +.de TQ +.br +.ns +.TP \\$1 +.. +.TH XINERAMA __libmansuffix__ __vendorversion__ +.SH NAME +Xinerama \- API for Xinerama extension to X11 Protocol +.SH SYNOPSIS +\&#include <X11/extensions/Xinerama.h> +.nf +.sp +Bool XineramaQueryExtension \^(\^Display *\fIdpy\fP, + int *\fIevent_base_return\fP, int *\fIerror_base_return\fP\^); +.sp +Status XineramaQueryVersion \^(\^Display *\fIdpy\fP, + int *\fImajor_version_return\fP, + int *\fIminor_version_return\fP\^); +.sp +Bool XineramaIsActive \^(\^Display *\fIdpy\fP\^); +.sp +XineramaScreenInfo * XineramaQueryScreens \^(\^Display *\fIdpy\fP, + int *\fInumber\fP\^); +.fi +.SH ARGUMENTS +.IP \fIdisplay\fP 1i +Specifies the connection to the X server. +.IP \fIevent_base_return\fP 1i +Specifies the return location for the assigned base event code +.IP \fIerror_base_return\fP 1i +Specifies the return location for the assigned base error code +.IP \fImajor_version_return\fP 1i +Returns the major version supported by the server +.IP \fIminor_version_return\fP 1i +Returns the minor version supported by the server +.IP \fInumber\fP 1i +Returns the number of entries in the returned XineramaScreenInfo array. +.SH DESCRIPTION +.B Xinerama +is a simple library designed to interface the Xinerama Extension for +retrieving information about physical output devices which may be combined +into a single logical X screen. + +.SH FUNCTIONS + +.SS \fBXineramaQueryExtension()\fR + +.LP +The XineramaQueryExtension function queries the Xserver to determine the +availability of the Xinerama Extension. If the extension is available, the +return value is True, and event_base_return and error_base_return are set to +the base event number and base error number for the extension, respectively. +Otherwise, the return value is False, and the values of event_base_return and +error_base_return are undefined. +.sp + +.SS \fBXineramaQueryVersion()\fR + +.LP +The XineramaQueryVersion function returns the version of the Xinerama extension +implemented by the Xserver. The version is returned in major_version_return +and minor_version_return. The major version will be incremented for protocol +incompatible changes, and the minor version will be incremented for small, +upwardly compatible changes. +.LP +If the Xinerama library is compatible with the version returned by the +server, it returns nonzero. If the server does not support the +XINERAMA extension, or if there was an error during communications +with the server, or if the server and library protocol versions are +incompatible, it returns zero. +.sp + +.SS \fBXineramaIsActive()\fR + +.LP +The XineramaIsActive function returns a Boolean operator used to determine if +Xinerama is activated on the screen. Returns True for active and False for +not active. +.sp + +.SS \fBXineramaQueryScreens()\fR + +.LP +The \fBXineramaQueryScreens()\fR function returns info about each +individual output device within the Xinerama Screen. The integer +pointed to by the \fInumber\fR argument is updated to the number of +output devices listed in the returned array of \fIXineramaScreenInfo\fR +structures. \fBXineramaQueryScreens()\fR returns NULL and sets \fInumber\fR +to 0 if Xinerama is not active. + +The pointer returned should be released with XFree(__libmansuffix__) +when no longer needed. +.sp + +.SH NOTE +The original API provided for interacting with the XINERAMA extension used +function names beginning with \fIXPanoramiX\fR. That API is now deprecated +and this API should be used instead in new software. + + + diff --git a/libXinerama/src/Xinerama.c b/libXinerama/src/Xinerama.c index ac5ecb7af..93b1a9f21 100644 --- a/libXinerama/src/Xinerama.c +++ b/libXinerama/src/Xinerama.c @@ -1,313 +1,313 @@ -/*****************************************************************
-Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
-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.
-
-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
-DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
-BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
-shall not be used in advertising or otherwise to promote the sale, use or other
-dealings in this Software without prior written authorization from Digital
-Equipment Corporation.
-******************************************************************/
-
-#include <X11/Xlibint.h>
-#include <X11/Xutil.h>
-#include <X11/extensions/Xext.h>
-#include <X11/extensions/extutil.h>
-#include <X11/extensions/panoramiXext.h>
-#include <X11/extensions/panoramiXproto.h>
-#include <X11/extensions/Xinerama.h>
-
-
-static XExtensionInfo _panoramiX_ext_info_data;
-static XExtensionInfo *panoramiX_ext_info = &_panoramiX_ext_info_data;
-static /* const */ char *panoramiX_extension_name = PANORAMIX_PROTOCOL_NAME;
-
-#define PanoramiXCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, panoramiX_extension_name, val)
-#define PanoramiXSimpleCheckExtension(dpy,i) \
- XextSimpleCheckExtension (dpy, i, panoramiX_extension_name)
-
-static int close_display(Display *dpy, XExtCodes *codes);
-
-static /* const */ XExtensionHooks panoramiX_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, panoramiX_ext_info,
- panoramiX_extension_name,
- &panoramiX_extension_hooks,
- 0, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, panoramiX_ext_info)
-
-
-
-/****************************************************************************
- * *
- * PanoramiX public interfaces *
- * *
- ****************************************************************************/
-
-Bool XPanoramiXQueryExtension (
- Display *dpy,
- int *event_base_return,
- int *error_base_return
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- if (XextHasExtension(info)) {
- *event_base_return = info->codes->first_event;
- *error_base_return = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-
-Status XPanoramiXQueryVersion(
- Display *dpy,
- int *major_version_return,
- int *minor_version_return
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xPanoramiXQueryVersionReply rep;
- register xPanoramiXQueryVersionReq *req;
-
- PanoramiXCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (PanoramiXQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_PanoramiXQueryVersion;
- req->clientMajor = PANORAMIX_MAJOR_VERSION;
- req->clientMinor = PANORAMIX_MINOR_VERSION;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- *major_version_return = rep.majorVersion;
- *minor_version_return = rep.minorVersion;
- UnlockDisplay (dpy);
- SyncHandle ();
- return 1;
-}
-
-XPanoramiXInfo *XPanoramiXAllocInfo(void)
-{
- return (XPanoramiXInfo *) Xmalloc (sizeof (XPanoramiXInfo));
-}
-
-Status XPanoramiXGetState (
- Display *dpy,
- Drawable drawable,
- XPanoramiXInfo *panoramiX_info
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xPanoramiXGetStateReply rep;
- register xPanoramiXGetStateReq *req;
-
- PanoramiXCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (PanoramiXGetState, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_PanoramiXGetState;
- req->window = drawable;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- UnlockDisplay (dpy);
- SyncHandle ();
- panoramiX_info->window = rep.window;
- panoramiX_info->State = rep.state;
- return 1;
-}
-
-Status XPanoramiXGetScreenCount (
- Display *dpy,
- Drawable drawable,
- XPanoramiXInfo *panoramiX_info
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xPanoramiXGetScreenCountReply rep;
- register xPanoramiXGetScreenCountReq *req;
-
- PanoramiXCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (PanoramiXGetScreenCount, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_PanoramiXGetScreenCount;
- req->window = drawable;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- UnlockDisplay (dpy);
- SyncHandle ();
- panoramiX_info->window = rep.window;
- panoramiX_info->ScreenCount = rep.ScreenCount;
- return 1;
-}
-
-Status XPanoramiXGetScreenSize (
- Display *dpy,
- Drawable drawable,
- int screen_num,
- XPanoramiXInfo *panoramiX_info
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xPanoramiXGetScreenSizeReply rep;
- register xPanoramiXGetScreenSizeReq *req;
-
- PanoramiXCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (PanoramiXGetScreenSize, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_PanoramiXGetScreenSize;
- req->window = drawable;
- req->screen = screen_num; /* need to define */
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- UnlockDisplay (dpy);
- SyncHandle ();
- panoramiX_info->window = rep.window;
- panoramiX_info->screen = rep.screen;
- panoramiX_info->width = rep.width;
- panoramiX_info->height = rep.height;
- return 1;
-}
-
-/*******************************************************************\
- Alternate interface to make up for shortcomings in the original,
- namely, the omission of the screen origin. The new interface is
- in the "Xinerama" namespace instead of "PanoramiX".
-\*******************************************************************/
-
-Bool XineramaQueryExtension (
- Display *dpy,
- int *event_base_return,
- int *error_base_return
-)
-{
- return XPanoramiXQueryExtension(dpy, event_base_return, error_base_return);
-}
-
-Status XineramaQueryVersion(
- Display *dpy,
- int *major,
- int *minor
-)
-{
- return XPanoramiXQueryVersion(dpy, major, minor);
-}
-
-Bool XineramaIsActive(Display *dpy)
-{
- xXineramaIsActiveReply rep;
- xXineramaIsActiveReq *req;
- XExtDisplayInfo *info = find_display (dpy);
-
- if(!XextHasExtension(info))
- return False; /* server doesn't even have the extension */
-
- LockDisplay (dpy);
- GetReq (XineramaIsActive, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_XineramaIsActive;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
- UnlockDisplay (dpy);
- SyncHandle ();
- return rep.state;
-}
-
-XineramaScreenInfo *
-XineramaQueryScreens(
- Display *dpy,
- int *number
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXineramaQueryScreensReply rep;
- xXineramaQueryScreensReq *req;
- XineramaScreenInfo *scrnInfo = NULL;
-
- PanoramiXCheckExtension (dpy, info, NULL);
-
- LockDisplay (dpy);
- GetReq (XineramaQueryScreens, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_XineramaQueryScreens;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return NULL;
- }
-
- if(rep.number) {
- if((scrnInfo = Xmalloc(sizeof(XineramaScreenInfo) * rep.number))) {
- xXineramaScreenInfo scratch;
- int i;
-
- for(i = 0; i < rep.number; i++) {
- _XRead(dpy, (char*)(&scratch), sz_XineramaScreenInfo);
- scrnInfo[i].screen_number = i;
- scrnInfo[i].x_org = scratch.x_org;
- scrnInfo[i].y_org = scratch.y_org;
- scrnInfo[i].width = scratch.width;
- scrnInfo[i].height = scratch.height;
- }
-
- *number = rep.number;
- } else
- _XEatData(dpy, rep.length << 2);
- } else {
- *number = 0;
- }
-
- UnlockDisplay (dpy);
- SyncHandle ();
- return scrnInfo;
-}
+/***************************************************************** +Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. +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. + +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 +DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, +BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation +shall not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization from Digital +Equipment Corporation. +******************************************************************/ + +#include <X11/Xlibint.h> +#include <X11/Xutil.h> +#include <X11/extensions/Xext.h> +#include <X11/extensions/extutil.h> +#include <X11/extensions/panoramiXext.h> +#include <X11/extensions/panoramiXproto.h> +#include <X11/extensions/Xinerama.h> + + +static XExtensionInfo _panoramiX_ext_info_data; +static XExtensionInfo *panoramiX_ext_info = &_panoramiX_ext_info_data; +static /* const */ char *panoramiX_extension_name = PANORAMIX_PROTOCOL_NAME; + +#define PanoramiXCheckExtension(dpy,i,val) \ + XextCheckExtension (dpy, i, panoramiX_extension_name, val) +#define PanoramiXSimpleCheckExtension(dpy,i) \ + XextSimpleCheckExtension (dpy, i, panoramiX_extension_name) + +static int close_display(Display *dpy, XExtCodes *codes); + +static /* const */ XExtensionHooks panoramiX_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, panoramiX_ext_info, + panoramiX_extension_name, + &panoramiX_extension_hooks, + 0, NULL) + +static XEXT_GENERATE_CLOSE_DISPLAY (close_display, panoramiX_ext_info) + + + +/**************************************************************************** + * * + * PanoramiX public interfaces * + * * + ****************************************************************************/ + +Bool XPanoramiXQueryExtension ( + Display *dpy, + int *event_base_return, + int *error_base_return +) +{ + XExtDisplayInfo *info = find_display (dpy); + + if (XextHasExtension(info)) { + *event_base_return = info->codes->first_event; + *error_base_return = info->codes->first_error; + return True; + } else { + return False; + } +} + + +Status XPanoramiXQueryVersion( + Display *dpy, + int *major_version_return, + int *minor_version_return +) +{ + XExtDisplayInfo *info = find_display (dpy); + xPanoramiXQueryVersionReply rep; + register xPanoramiXQueryVersionReq *req; + + PanoramiXCheckExtension (dpy, info, 0); + + LockDisplay (dpy); + GetReq (PanoramiXQueryVersion, req); + req->reqType = info->codes->major_opcode; + req->panoramiXReqType = X_PanoramiXQueryVersion; + req->clientMajor = PANORAMIX_MAJOR_VERSION; + req->clientMinor = PANORAMIX_MINOR_VERSION; + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return 0; + } + *major_version_return = rep.majorVersion; + *minor_version_return = rep.minorVersion; + UnlockDisplay (dpy); + SyncHandle (); + return 1; +} + +XPanoramiXInfo *XPanoramiXAllocInfo(void) +{ + return (XPanoramiXInfo *) Xmalloc (sizeof (XPanoramiXInfo)); +} + +Status XPanoramiXGetState ( + Display *dpy, + Drawable drawable, + XPanoramiXInfo *panoramiX_info +) +{ + XExtDisplayInfo *info = find_display (dpy); + xPanoramiXGetStateReply rep; + register xPanoramiXGetStateReq *req; + + PanoramiXCheckExtension (dpy, info, 0); + + LockDisplay (dpy); + GetReq (PanoramiXGetState, req); + req->reqType = info->codes->major_opcode; + req->panoramiXReqType = X_PanoramiXGetState; + req->window = drawable; + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return 0; + } + UnlockDisplay (dpy); + SyncHandle (); + panoramiX_info->window = rep.window; + panoramiX_info->State = rep.state; + return 1; +} + +Status XPanoramiXGetScreenCount ( + Display *dpy, + Drawable drawable, + XPanoramiXInfo *panoramiX_info +) +{ + XExtDisplayInfo *info = find_display (dpy); + xPanoramiXGetScreenCountReply rep; + register xPanoramiXGetScreenCountReq *req; + + PanoramiXCheckExtension (dpy, info, 0); + + LockDisplay (dpy); + GetReq (PanoramiXGetScreenCount, req); + req->reqType = info->codes->major_opcode; + req->panoramiXReqType = X_PanoramiXGetScreenCount; + req->window = drawable; + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return 0; + } + UnlockDisplay (dpy); + SyncHandle (); + panoramiX_info->window = rep.window; + panoramiX_info->ScreenCount = rep.ScreenCount; + return 1; +} + +Status XPanoramiXGetScreenSize ( + Display *dpy, + Drawable drawable, + int screen_num, + XPanoramiXInfo *panoramiX_info +) +{ + XExtDisplayInfo *info = find_display (dpy); + xPanoramiXGetScreenSizeReply rep; + register xPanoramiXGetScreenSizeReq *req; + + PanoramiXCheckExtension (dpy, info, 0); + + LockDisplay (dpy); + GetReq (PanoramiXGetScreenSize, req); + req->reqType = info->codes->major_opcode; + req->panoramiXReqType = X_PanoramiXGetScreenSize; + req->window = drawable; + req->screen = screen_num; /* need to define */ + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return 0; + } + UnlockDisplay (dpy); + SyncHandle (); + panoramiX_info->window = rep.window; + panoramiX_info->screen = rep.screen; + panoramiX_info->width = rep.width; + panoramiX_info->height = rep.height; + return 1; +} + +/*******************************************************************\ + Alternate interface to make up for shortcomings in the original, + namely, the omission of the screen origin. The new interface is + in the "Xinerama" namespace instead of "PanoramiX". +\*******************************************************************/ + +Bool XineramaQueryExtension ( + Display *dpy, + int *event_base_return, + int *error_base_return +) +{ + return XPanoramiXQueryExtension(dpy, event_base_return, error_base_return); +} + +Status XineramaQueryVersion( + Display *dpy, + int *major, + int *minor +) +{ + return XPanoramiXQueryVersion(dpy, major, minor); +} + +Bool XineramaIsActive(Display *dpy) +{ + xXineramaIsActiveReply rep; + xXineramaIsActiveReq *req; + XExtDisplayInfo *info = find_display (dpy); + + if(!XextHasExtension(info)) + return False; /* server doesn't even have the extension */ + + LockDisplay (dpy); + GetReq (XineramaIsActive, req); + req->reqType = info->codes->major_opcode; + req->panoramiXReqType = X_XineramaIsActive; + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return False; + } + UnlockDisplay (dpy); + SyncHandle (); + return rep.state; +} + +XineramaScreenInfo * +XineramaQueryScreens( + Display *dpy, + int *number +) +{ + XExtDisplayInfo *info = find_display (dpy); + xXineramaQueryScreensReply rep; + xXineramaQueryScreensReq *req; + XineramaScreenInfo *scrnInfo = NULL; + + PanoramiXCheckExtension (dpy, info, NULL); + + LockDisplay (dpy); + GetReq (XineramaQueryScreens, req); + req->reqType = info->codes->major_opcode; + req->panoramiXReqType = X_XineramaQueryScreens; + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return NULL; + } + + if(rep.number) { + if((scrnInfo = Xmalloc(sizeof(XineramaScreenInfo) * rep.number))) { + xXineramaScreenInfo scratch; + int i; + + for(i = 0; i < rep.number; i++) { + _XRead(dpy, (char*)(&scratch), sz_XineramaScreenInfo); + scrnInfo[i].screen_number = i; + scrnInfo[i].x_org = scratch.x_org; + scrnInfo[i].y_org = scratch.y_org; + scrnInfo[i].width = scratch.width; + scrnInfo[i].height = scratch.height; + } + + *number = rep.number; + } else + _XEatData(dpy, rep.length << 2); + } else { + *number = 0; + } + + UnlockDisplay (dpy); + SyncHandle (); + return scrnInfo; +} |