From b2c925e360e2c366526de15b44603f855f94139c Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 19 Sep 2011 13:23:24 +0200 Subject: xtrans libX11 libXext libXdmcp libXau libXft libXinerama libXmu libfontenc mesa git update 19 sept 2011 --- libXext/AUTHORS | 6 +- libXext/COPYING | 392 ++-- libXext/configure.ac | 2 +- libXext/include/X11/extensions/XLbx.h | 100 +- libXext/include/X11/extensions/Xdbe.h | 276 +-- libXext/include/X11/extensions/Xge.h | 2 +- libXext/include/X11/extensions/dpms.h | 106 +- libXext/include/X11/extensions/extutil.h | 380 ++-- libXext/include/X11/extensions/sync.h | 750 +++---- libXext/include/X11/extensions/xtestext1.h | 4 +- libXext/man/DBE.man | 626 +++--- libXext/man/DPMSCapable.man | 130 +- libXext/man/DPMSDisable.man | 130 +- libXext/man/DPMSEnable.man | 154 +- libXext/man/DPMSForceLevel.man | 166 +- libXext/man/DPMSGetTimeouts.man | 204 +- libXext/man/DPMSGetVersion.man | 174 +- libXext/man/DPMSInfo.man | 172 +- libXext/man/DPMSQueryExtension.man | 208 +- libXext/man/DPMSSetTimeouts.man | 256 +-- libXext/man/XShape.man | 348 ++-- libXext/man/XShm.man | 30 +- libXext/man/XcupGetReservedColormapEntries.man | 146 +- libXext/man/XcupQueryVersion.man | 148 +- libXext/man/XcupStoreColors.man | 158 +- libXext/man/XdbeAllocateBackBufferName.man | 134 +- libXext/man/XdbeBeginIdiom.man | 92 +- libXext/man/XdbeDeallocateBackBufferName.man | 106 +- libXext/man/XdbeEndIdiom.man | 92 +- libXext/man/XdbeFreeVisualInfo.man | 96 +- libXext/man/XdbeGetBackBufferAttributes.man | 130 +- libXext/man/XdbeGetVisualInfo.man | 250 +-- libXext/man/XdbeQueryExtension.man | 122 +- libXext/man/XdbeSwapBuffers.man | 192 +- libXext/man/Xevi.man | 322 +-- libXext/man/Xmbuf.man | 686 +++--- libXext/specs/dbelib.xml | 21 +- libXext/src/DPMS.c | 580 +++--- libXext/src/MITMisc.c | 260 +-- libXext/src/Makefile.am | 130 +- libXext/src/XAppgroup.c | 776 +++---- libXext/src/XLbx.c | 248 +-- libXext/src/XMultibuf.c | 1422 ++++++------- libXext/src/XShape.c | 976 ++++----- libXext/src/XShm.c | 2 +- libXext/src/XSync.c | 1998 +++++++++--------- libXext/src/XTestExt1.c | 2634 ++++++++++++------------ libXext/src/Xcup.c | 524 ++--- libXext/src/Xdbe.c | 936 ++++----- libXext/src/extutil.c | 560 ++--- libXext/src/globals.c | 174 +- 51 files changed, 9271 insertions(+), 9260 deletions(-) (limited to 'libXext') diff --git a/libXext/AUTHORS b/libXext/AUTHORS index 00e1f42cf..6e545c006 100644 --- a/libXext/AUTHORS +++ b/libXext/AUTHORS @@ -6,14 +6,14 @@ XAppgroup: Kaleb S. Keithley, X Consortium Xcup: Kaleb S, Keithley, The Open Group Xdbe: Ian Elliot, Hewlett-Packard, David Wiggens, X Consortium XEVI: Peter Daifuku, Silicon Graphics -XLbx: D. Converse, J Fulton, C. Kantarjiev, D. Lemke, R. Mor, - Keith Packard, NCD (who now believes lbx should be nuked), +XLbx: D. Converse, J Fulton, C. Kantarjiev, D. Lemke, R. Mor, + Keith Packard, NCD (who now believes lbx should be nuked), R. Tice, D. Tonogai XMultibuf: Jeffrey Friedberg, Larry Seiler, Jeff Vroom, Digital Equipment XSecurity: Dave Wiggens, X Consortium XShape: Jonathan Corbet, NCAR, Keith Packard, MIT X Consortium Xshm: Bob Scheifler and Keith Packard, MIT X Consortium -XSync: Tim Glauert, Olivetti Research, DAve Carver, Jim Gettys, +XSync: Tim Glauert, Olivetti Research, DAve Carver, Jim Gettys, Digital Equipment, Dave Wiggens, X Consortium XTestExt: Kieron Drake, UniSoft, Ltd. diff --git a/libXext/COPYING b/libXext/COPYING index e8ba287bb..80622a057 100644 --- a/libXext/COPYING +++ b/libXext/COPYING @@ -1,196 +1,196 @@ -Copyright 1986, 1987, 1988, 1989, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -Copyright (c) 1996 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. - -Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc. -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, 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 Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH -THE USE OR PERFORMANCE OF THIS SOFTWARE. - -Copyright 1992 Network Computing Devices - -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 NCD. not be used in advertising or -publicity pertaining to distribution of the software without specific, -written prior permission. NCD. makes no representations about the -suitability of this software for any purpose. It is provided "as is" -without express or implied warranty. - -NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD. -BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION -OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN -CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts, -and Olivetti Research Limited, Cambridge, England. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -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 names of Digital or Olivetti -not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. - -Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, 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 Hewlett-Packard not be used in -advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -Hewlett-Packard makes no representations about the -suitability of this software for any purpose. It is provided -"as is" without express or implied warranty. - -This software is not subject to any license of the American -Telephone and Telegraph Company or of the Regents of the -University of California. - -Copyright (c) 1994, 1995 Hewlett-Packard Company - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the Hewlett-Packard -Company shall not be used in advertising or otherwise to promote the -sale, use or other dealings in this Software without prior written -authorization from the Hewlett-Packard Company. - -Copyright Digital Equipment Corporation, 1996 - -Permission to use, copy, modify, distribute, and sell this -documentation for any purpose is hereby granted without fee, -provided that the above copyright notice and this permission -notice appear in all copies. Digital Equipment Corporation -makes no representations about the suitability for any purpose -of the information in this document. This documentation is -provided ``as is'' without express or implied warranty. - -Copyright (c) 1999, 2005, 2006, 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. - -Copyright (c) 1989 X Consortium, Inc. and Digital Equipment Corporation. -Copyright (c) 1992 X Consortium, Inc. and Intergraph Corporation. -Copyright (c) 1993 X Consortium, Inc. and Silicon Graphics, Inc. -Copyright (c) 1994, 1995 X Consortium, Inc. and Hewlett-Packard Company. - -Permission to use, copy, modify, and distribute this documentation for -any purpose and without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. -Digital Equipment Corporation, Intergraph Corporation, Silicon -Graphics, Hewlett-Packard, and the X Consortium make no -representations about the suitability for any purpose of the -information in this document. This documentation is provided ``as is'' -without express or implied warranty. +Copyright 1986, 1987, 1988, 1989, 1994, 1998 The Open Group + +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +Copyright (c) 1996 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. + +Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc. +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, 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 Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH +THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Copyright 1992 Network Computing Devices + +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 NCD. not be used in advertising or +publicity pertaining to distribution of the software without specific, +written prior permission. NCD. makes no representations about the +suitability of this software for any purpose. It is provided "as is" +without express or implied warranty. + +NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD. +BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION +OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts, +and Olivetti Research Limited, Cambridge, England. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +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 names of Digital or Olivetti +not be used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, 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 Hewlett-Packard not be used in +advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +Hewlett-Packard makes no representations about the +suitability of this software for any purpose. It is provided +"as is" without express or implied warranty. + +This software is not subject to any license of the American +Telephone and Telegraph Company or of the Regents of the +University of California. + +Copyright (c) 1994, 1995 Hewlett-Packard Company + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR +THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the Hewlett-Packard +Company shall not be used in advertising or otherwise to promote the +sale, use or other dealings in this Software without prior written +authorization from the Hewlett-Packard Company. + +Copyright Digital Equipment Corporation, 1996 + +Permission to use, copy, modify, distribute, and sell this +documentation for any purpose is hereby granted without fee, +provided that the above copyright notice and this permission +notice appear in all copies. Digital Equipment Corporation +makes no representations about the suitability for any purpose +of the information in this document. This documentation is +provided ``as is'' without express or implied warranty. + +Copyright (c) 1999, 2005, 2006, 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. + +Copyright (c) 1989 X Consortium, Inc. and Digital Equipment Corporation. +Copyright (c) 1992 X Consortium, Inc. and Intergraph Corporation. +Copyright (c) 1993 X Consortium, Inc. and Silicon Graphics, Inc. +Copyright (c) 1994, 1995 X Consortium, Inc. and Hewlett-Packard Company. + +Permission to use, copy, modify, and distribute this documentation for +any purpose and without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. +Digital Equipment Corporation, Intergraph Corporation, Silicon +Graphics, Hewlett-Packard, and the X Consortium make no +representations about the suitability for any purpose of the +information in this document. This documentation is provided ``as is'' +without express or implied warranty. diff --git a/libXext/configure.ac b/libXext/configure.ac index 6e6cc8b13..dd9788abe 100644 --- a/libXext/configure.ac +++ b/libXext/configure.ac @@ -25,7 +25,7 @@ XORG_WITH_XSLTPROC XORG_CHECK_SGML_DOCTOOLS(1.8) XORG_CHECK_MALLOC_ZERO -# Determine .so library version per platform +# Determine .so library version per platform # based on SharedXextRev in monolith xc/config/cf/*Lib.tmpl if test "x$XEXT_SOREV" = "x" ; then case $host_os in diff --git a/libXext/include/X11/extensions/XLbx.h b/libXext/include/X11/extensions/XLbx.h index 94153343a..1af4f9ce2 100644 --- a/libXext/include/X11/extensions/XLbx.h +++ b/libXext/include/X11/extensions/XLbx.h @@ -1,50 +1,50 @@ -/* - * Copyright 1992 Network Computing Devices - * - * 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 NCD. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. NCD. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD. - * 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. - * - */ - -#ifndef _XLBX_H_ -#define _XLBX_H_ - -#include -#include -#include -#include - -_XFUNCPROTOBEGIN - -Bool XLbxQueryExtension( - Display* /* dpy */, - int* /* requestp */, - int* /* event_basep */, - int* /* error_basep */ -); - -Bool XLbxQueryVersion( - Display* /* dpy */, - int* /* majorVersion */, - int* /* minorVersion */ -); - -int XLbxGetEventBase(Display *dpy); - -_XFUNCPROTOEND - -#endif +/* + * Copyright 1992 Network Computing Devices + * + * 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 NCD. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. NCD. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD. + * 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. + * + */ + +#ifndef _XLBX_H_ +#define _XLBX_H_ + +#include +#include +#include +#include + +_XFUNCPROTOBEGIN + +Bool XLbxQueryExtension( + Display* /* dpy */, + int* /* requestp */, + int* /* event_basep */, + int* /* error_basep */ +); + +Bool XLbxQueryVersion( + Display* /* dpy */, + int* /* majorVersion */, + int* /* minorVersion */ +); + +int XLbxGetEventBase(Display *dpy); + +_XFUNCPROTOEND + +#endif diff --git a/libXext/include/X11/extensions/Xdbe.h b/libXext/include/X11/extensions/Xdbe.h index 5ac72aa82..5c842a445 100644 --- a/libXext/include/X11/extensions/Xdbe.h +++ b/libXext/include/X11/extensions/Xdbe.h @@ -1,138 +1,138 @@ -/****************************************************************************** - * - * Copyright (c) 1994, 1995 Hewlett-Packard Company - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR - * THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the Hewlett-Packard - * Company shall not be used in advertising or otherwise to promote the - * sale, use or other dealings in this Software without prior written - * authorization from the Hewlett-Packard Company. - * - * Header file for Xlib-related DBE - * - *****************************************************************************/ - -#ifndef XDBE_H -#define XDBE_H - -#include -#include - -typedef struct -{ - VisualID visual; /* one visual ID that supports double-buffering */ - int depth; /* depth of visual in bits */ - int perflevel; /* performance level of visual */ -} -XdbeVisualInfo; - -typedef struct -{ - int count; /* number of items in visual_depth */ - XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */ -} -XdbeScreenVisualInfo; - - -typedef Drawable XdbeBackBuffer; - -typedef unsigned char XdbeSwapAction; - -typedef struct -{ - Window swap_window; /* window for which to swap buffers */ - XdbeSwapAction swap_action; /* swap action to use for swap_window */ -} -XdbeSwapInfo; - -typedef struct -{ - Window window; /* window that buffer belongs to */ -} -XdbeBackBufferAttributes; - -typedef struct -{ - int type; - Display *display; /* display the event was read from */ - XdbeBackBuffer buffer; /* resource id */ - unsigned long serial; /* serial number of failed request */ - unsigned char error_code; /* error base + XdbeBadBuffer */ - unsigned char request_code; /* major opcode of failed request */ - unsigned char minor_code; /* minor opcode of failed request */ -} -XdbeBufferError; - -/* _XFUNCPROTOBEGIN and _XFUNCPROTOEND are defined as noops - * (for non-C++ builds) in X11/Xfuncproto.h. - */ -_XFUNCPROTOBEGIN - -extern Status XdbeQueryExtension( - Display* /* dpy */, - int* /* major_version_return */, - int* /* minor_version_return */ -); - -extern XdbeBackBuffer XdbeAllocateBackBufferName( - Display* /* dpy */, - Window /* window */, - XdbeSwapAction /* swap_action */ -); - -extern Status XdbeDeallocateBackBufferName( - Display* /* dpy */, - XdbeBackBuffer /* buffer */ -); - -extern Status XdbeSwapBuffers( - Display* /* dpy */, - XdbeSwapInfo* /* swap_info */, - int /* num_windows */ -); - -extern Status XdbeBeginIdiom( - Display* /* dpy */ -); - -extern Status XdbeEndIdiom( - Display* /* dpy */ -); - -extern XdbeScreenVisualInfo *XdbeGetVisualInfo( - Display* /* dpy */, - Drawable* /* screen_specifiers */, - int* /* num_screens */ -); - -extern void XdbeFreeVisualInfo( - XdbeScreenVisualInfo* /* visual_info */ -); - -extern XdbeBackBufferAttributes *XdbeGetBackBufferAttributes( - Display* /* dpy */, - XdbeBackBuffer /* buffer */ -); - -_XFUNCPROTOEND - -#endif /* XDBE_H */ - +/****************************************************************************** + * + * Copyright (c) 1994, 1995 Hewlett-Packard Company + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the Hewlett-Packard + * Company shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the Hewlett-Packard Company. + * + * Header file for Xlib-related DBE + * + *****************************************************************************/ + +#ifndef XDBE_H +#define XDBE_H + +#include +#include + +typedef struct +{ + VisualID visual; /* one visual ID that supports double-buffering */ + int depth; /* depth of visual in bits */ + int perflevel; /* performance level of visual */ +} +XdbeVisualInfo; + +typedef struct +{ + int count; /* number of items in visual_depth */ + XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */ +} +XdbeScreenVisualInfo; + + +typedef Drawable XdbeBackBuffer; + +typedef unsigned char XdbeSwapAction; + +typedef struct +{ + Window swap_window; /* window for which to swap buffers */ + XdbeSwapAction swap_action; /* swap action to use for swap_window */ +} +XdbeSwapInfo; + +typedef struct +{ + Window window; /* window that buffer belongs to */ +} +XdbeBackBufferAttributes; + +typedef struct +{ + int type; + Display *display; /* display the event was read from */ + XdbeBackBuffer buffer; /* resource id */ + unsigned long serial; /* serial number of failed request */ + unsigned char error_code; /* error base + XdbeBadBuffer */ + unsigned char request_code; /* major opcode of failed request */ + unsigned char minor_code; /* minor opcode of failed request */ +} +XdbeBufferError; + +/* _XFUNCPROTOBEGIN and _XFUNCPROTOEND are defined as noops + * (for non-C++ builds) in X11/Xfuncproto.h. + */ +_XFUNCPROTOBEGIN + +extern Status XdbeQueryExtension( + Display* /* dpy */, + int* /* major_version_return */, + int* /* minor_version_return */ +); + +extern XdbeBackBuffer XdbeAllocateBackBufferName( + Display* /* dpy */, + Window /* window */, + XdbeSwapAction /* swap_action */ +); + +extern Status XdbeDeallocateBackBufferName( + Display* /* dpy */, + XdbeBackBuffer /* buffer */ +); + +extern Status XdbeSwapBuffers( + Display* /* dpy */, + XdbeSwapInfo* /* swap_info */, + int /* num_windows */ +); + +extern Status XdbeBeginIdiom( + Display* /* dpy */ +); + +extern Status XdbeEndIdiom( + Display* /* dpy */ +); + +extern XdbeScreenVisualInfo *XdbeGetVisualInfo( + Display* /* dpy */, + Drawable* /* screen_specifiers */, + int* /* num_screens */ +); + +extern void XdbeFreeVisualInfo( + XdbeScreenVisualInfo* /* visual_info */ +); + +extern XdbeBackBufferAttributes *XdbeGetBackBufferAttributes( + Display* /* dpy */, + XdbeBackBuffer /* buffer */ +); + +_XFUNCPROTOEND + +#endif /* XDBE_H */ + diff --git a/libXext/include/X11/extensions/Xge.h b/libXext/include/X11/extensions/Xge.h index 51382ffd0..76b5a6a01 100644 --- a/libXext/include/X11/extensions/Xge.h +++ b/libXext/include/X11/extensions/Xge.h @@ -36,7 +36,7 @@ _XFUNCPROTOBEGIN /** - * Generic Event mask. + * Generic Event mask. * To be used whenever a list of masks per extension has to be provided. * * But, don't actually use the CARD{8,16,32} types. We can't get them them diff --git a/libXext/include/X11/extensions/dpms.h b/libXext/include/X11/extensions/dpms.h index b57007bda..f85e6a725 100644 --- a/libXext/include/X11/extensions/dpms.h +++ b/libXext/include/X11/extensions/dpms.h @@ -1,53 +1,53 @@ -/***************************************************************** - -Copyright (c) 1996 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. - -******************************************************************/ - -#ifndef _X11_EXTENSIONS_DPMS_H -#define _X11_EXTENSIONS_DPMS_H 1 - -#include -#include -#include - -#ifndef DPMS_SERVER -_XFUNCPROTOBEGIN - -extern Bool DPMSQueryExtension(Display *, int *, int *); -extern Status DPMSGetVersion(Display *, int *, int *); -extern Bool DPMSCapable(Display *); -extern Status DPMSSetTimeouts(Display *, CARD16, CARD16, CARD16); -extern Bool DPMSGetTimeouts(Display *, CARD16 *, CARD16 *, CARD16 *); -extern Status DPMSEnable(Display *); -extern Status DPMSDisable(Display *); -extern Status DPMSForceLevel(Display *, CARD16); -extern Status DPMSInfo(Display *, CARD16 *, BOOL *); - -_XFUNCPROTOEND -#endif - -#endif /* !_X11_EXTENSIONS_DPMS_H */ - +/***************************************************************** + +Copyright (c) 1996 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. + +******************************************************************/ + +#ifndef _X11_EXTENSIONS_DPMS_H +#define _X11_EXTENSIONS_DPMS_H 1 + +#include +#include +#include + +#ifndef DPMS_SERVER +_XFUNCPROTOBEGIN + +extern Bool DPMSQueryExtension(Display *, int *, int *); +extern Status DPMSGetVersion(Display *, int *, int *); +extern Bool DPMSCapable(Display *); +extern Status DPMSSetTimeouts(Display *, CARD16, CARD16, CARD16); +extern Bool DPMSGetTimeouts(Display *, CARD16 *, CARD16 *, CARD16 *); +extern Status DPMSEnable(Display *); +extern Status DPMSDisable(Display *); +extern Status DPMSForceLevel(Display *, CARD16); +extern Status DPMSInfo(Display *, CARD16 *, BOOL *); + +_XFUNCPROTOEND +#endif + +#endif /* !_X11_EXTENSIONS_DPMS_H */ + diff --git a/libXext/include/X11/extensions/extutil.h b/libXext/include/X11/extensions/extutil.h index dd05a6580..7f05affd8 100644 --- a/libXext/include/X11/extensions/extutil.h +++ b/libXext/include/X11/extensions/extutil.h @@ -1,190 +1,190 @@ -/* - * -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Jim Fulton, MIT The Open Group - * - * Xlib Extension-Writing Utilities - * - * This package contains utilities for writing the client API for various - * protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND - * ARE SUBJECT TO CHANGE! - */ - -#ifndef _EXTUTIL_H_ -#define _EXTUTIL_H_ - -#include - -/* - * We need to keep a list of open displays since the Xlib display list isn't - * public. We also have to per-display info in a separate block since it isn't - * stored directly in the Display structure. - */ -typedef struct _XExtDisplayInfo { - struct _XExtDisplayInfo *next; /* keep a linked list */ - Display *display; /* which display this is */ - XExtCodes *codes; /* the extension protocol codes */ - XPointer data; /* extra data for extension to use */ -} XExtDisplayInfo; - -typedef struct _XExtensionInfo { - XExtDisplayInfo *head; /* start of list */ - XExtDisplayInfo *cur; /* most recently used */ - int ndisplays; /* number of displays */ -} XExtensionInfo; - -typedef struct _XExtensionHooks { - int (*create_gc)( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -); - int (*copy_gc)( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -); - int (*flush_gc)( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -); - int (*free_gc)( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -); - int (*create_font)( - Display* /* display */, - XFontStruct* /* fs */, - XExtCodes* /* codes */ -); - int (*free_font)( - Display* /* display */, - XFontStruct* /* fs */, - XExtCodes* /* codes */ -); - int (*close_display)( - Display* /* display */, - XExtCodes* /* codes */ -); - Bool (*wire_to_event)( - Display* /* display */, - XEvent* /* re */, - xEvent* /* event */ -); - Status (*event_to_wire)( - Display* /* display */, - XEvent* /* re */, - xEvent* /* event */ -); - int (*error)( - Display* /* display */, - xError* /* err */, - XExtCodes* /* codes */, - int* /* ret_code */ -); - char *(*error_string)( - Display* /* display */, - int /* code */, - XExtCodes* /* codes */, - char* /* buffer */, - int /* nbytes */ -); -} XExtensionHooks; - -extern XExtensionInfo *XextCreateExtension( - void -); -extern void XextDestroyExtension( - XExtensionInfo* /* info */ -); -extern XExtDisplayInfo *XextAddDisplay( - XExtensionInfo* /* extinfo */, - Display* /* dpy */, - char* /* ext_name */, - XExtensionHooks* /* hooks */, - int /* nevents */, - XPointer /* data */ -); -extern int XextRemoveDisplay( - XExtensionInfo* /* extinfo */, - Display* /* dpy */ -); -extern XExtDisplayInfo *XextFindDisplay( - XExtensionInfo* /* extinfo */, - Display* /* dpy */ -); - -#define XextHasExtension(i) ((i) && ((i)->codes)) -#define XextCheckExtension(dpy,i,name,val) \ - if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; } -#define XextSimpleCheckExtension(dpy,i,name) \ - if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; } - - -/* - * helper macros to generate code that is common to all extensions; caller - * should prefix it with static if extension source is in one file; this - * could be a utility function, but have to stack 6 unused arguments for - * something that is called many, many times would be bad. - */ -#define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \ -XExtDisplayInfo *proc (Display *dpy) \ -{ \ - XExtDisplayInfo *dpyinfo; \ - if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \ - if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \ - dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \ - return dpyinfo; \ -} - -#define XEXT_FIND_DISPLAY_PROTO(proc) \ - XExtDisplayInfo *proc(Display *dpy) - -#define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \ -int proc (Display *dpy, XExtCodes *codes) \ -{ \ - return XextRemoveDisplay (extinfo, dpy); \ -} - -#define XEXT_CLOSE_DISPLAY_PROTO(proc) \ - int proc(Display *dpy, XExtCodes *codes) - -#define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \ -char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \ -{ \ - code -= codes->first_error; \ - if (code >= 0 && code < nerr) { \ - char tmp[256]; \ - sprintf (tmp, "%s.%d", extname, code); \ - XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \ - return buf; \ - } \ - return (char *)0; \ -} - -#define XEXT_ERROR_STRING_PROTO(proc) \ - char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n) -#endif +/* + * +Copyright 1989, 1998 The Open Group + +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + * + * Author: Jim Fulton, MIT The Open Group + * + * Xlib Extension-Writing Utilities + * + * This package contains utilities for writing the client API for various + * protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND + * ARE SUBJECT TO CHANGE! + */ + +#ifndef _EXTUTIL_H_ +#define _EXTUTIL_H_ + +#include + +/* + * We need to keep a list of open displays since the Xlib display list isn't + * public. We also have to per-display info in a separate block since it isn't + * stored directly in the Display structure. + */ +typedef struct _XExtDisplayInfo { + struct _XExtDisplayInfo *next; /* keep a linked list */ + Display *display; /* which display this is */ + XExtCodes *codes; /* the extension protocol codes */ + XPointer data; /* extra data for extension to use */ +} XExtDisplayInfo; + +typedef struct _XExtensionInfo { + XExtDisplayInfo *head; /* start of list */ + XExtDisplayInfo *cur; /* most recently used */ + int ndisplays; /* number of displays */ +} XExtensionInfo; + +typedef struct _XExtensionHooks { + int (*create_gc)( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +); + int (*copy_gc)( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +); + int (*flush_gc)( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +); + int (*free_gc)( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +); + int (*create_font)( + Display* /* display */, + XFontStruct* /* fs */, + XExtCodes* /* codes */ +); + int (*free_font)( + Display* /* display */, + XFontStruct* /* fs */, + XExtCodes* /* codes */ +); + int (*close_display)( + Display* /* display */, + XExtCodes* /* codes */ +); + Bool (*wire_to_event)( + Display* /* display */, + XEvent* /* re */, + xEvent* /* event */ +); + Status (*event_to_wire)( + Display* /* display */, + XEvent* /* re */, + xEvent* /* event */ +); + int (*error)( + Display* /* display */, + xError* /* err */, + XExtCodes* /* codes */, + int* /* ret_code */ +); + char *(*error_string)( + Display* /* display */, + int /* code */, + XExtCodes* /* codes */, + char* /* buffer */, + int /* nbytes */ +); +} XExtensionHooks; + +extern XExtensionInfo *XextCreateExtension( + void +); +extern void XextDestroyExtension( + XExtensionInfo* /* info */ +); +extern XExtDisplayInfo *XextAddDisplay( + XExtensionInfo* /* extinfo */, + Display* /* dpy */, + char* /* ext_name */, + XExtensionHooks* /* hooks */, + int /* nevents */, + XPointer /* data */ +); +extern int XextRemoveDisplay( + XExtensionInfo* /* extinfo */, + Display* /* dpy */ +); +extern XExtDisplayInfo *XextFindDisplay( + XExtensionInfo* /* extinfo */, + Display* /* dpy */ +); + +#define XextHasExtension(i) ((i) && ((i)->codes)) +#define XextCheckExtension(dpy,i,name,val) \ + if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; } +#define XextSimpleCheckExtension(dpy,i,name) \ + if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; } + + +/* + * helper macros to generate code that is common to all extensions; caller + * should prefix it with static if extension source is in one file; this + * could be a utility function, but have to stack 6 unused arguments for + * something that is called many, many times would be bad. + */ +#define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \ +XExtDisplayInfo *proc (Display *dpy) \ +{ \ + XExtDisplayInfo *dpyinfo; \ + if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \ + if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \ + dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \ + return dpyinfo; \ +} + +#define XEXT_FIND_DISPLAY_PROTO(proc) \ + XExtDisplayInfo *proc(Display *dpy) + +#define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \ +int proc (Display *dpy, XExtCodes *codes) \ +{ \ + return XextRemoveDisplay (extinfo, dpy); \ +} + +#define XEXT_CLOSE_DISPLAY_PROTO(proc) \ + int proc(Display *dpy, XExtCodes *codes) + +#define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \ +char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \ +{ \ + code -= codes->first_error; \ + if (code >= 0 && code < nerr) { \ + char tmp[256]; \ + sprintf (tmp, "%s.%d", extname, code); \ + XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \ + return buf; \ + } \ + return (char *)0; \ +} + +#define XEXT_ERROR_STRING_PROTO(proc) \ + char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n) +#endif diff --git a/libXext/include/X11/extensions/sync.h b/libXext/include/X11/extensions/sync.h index 0ed5b728d..d3a239f66 100644 --- a/libXext/include/X11/extensions/sync.h +++ b/libXext/include/X11/extensions/sync.h @@ -1,375 +1,375 @@ -/* - -Copyright 1991, 1993, 1994, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -/*********************************************************** -Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts, -and Olivetti Research Limited, Cambridge, England. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -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 names of Digital or Olivetti -not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS, IN NO EVENT SHALL THEY 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. - -******************************************************************/ - -#ifndef _SYNC_H_ -#define _SYNC_H_ - -#include -#include - -#ifdef _SYNC_SERVER -#include -#else - -_XFUNCPROTOBEGIN -/* get rid of macros so we can define corresponding functions */ -#undef XSyncIntToValue -#undef XSyncIntsToValue -#undef XSyncValueGreaterThan -#undef XSyncValueLessThan -#undef XSyncValueGreaterOrEqual -#undef XSyncValueLessOrEqual -#undef XSyncValueEqual -#undef XSyncValueIsNegative -#undef XSyncValueIsZero -#undef XSyncValueIsPositive -#undef XSyncValueLow32 -#undef XSyncValueHigh32 -#undef XSyncValueAdd -#undef XSyncValueSubtract -#undef XSyncMaxValue -#undef XSyncMinValue - -extern void XSyncIntToValue( - XSyncValue* /*pv*/, - int /*i*/ -); - -extern void XSyncIntsToValue( - XSyncValue* /*pv*/, - unsigned int /*l*/, - int /*h*/ -); - -extern Bool XSyncValueGreaterThan( - XSyncValue /*a*/, - XSyncValue /*b*/ -); - -extern Bool XSyncValueLessThan( - XSyncValue /*a*/, - XSyncValue /*b*/ -); - -extern Bool XSyncValueGreaterOrEqual( - XSyncValue /*a*/, - XSyncValue /*b*/ -); - -extern Bool XSyncValueLessOrEqual( - XSyncValue /*a*/, - XSyncValue /*b*/ -); - -extern Bool XSyncValueEqual( - XSyncValue /*a*/, - XSyncValue /*b*/ -); - -extern Bool XSyncValueIsNegative( - XSyncValue /*v*/ -); - -extern Bool XSyncValueIsZero( - XSyncValue /*a*/ -); - -extern Bool XSyncValueIsPositive( - XSyncValue /*v*/ -); - -extern unsigned int XSyncValueLow32( - XSyncValue /*v*/ -); - -extern int XSyncValueHigh32( - XSyncValue /*v*/ -); - -extern void XSyncValueAdd( - XSyncValue* /*presult*/, - XSyncValue /*a*/, - XSyncValue /*b*/, - int* /*poverflow*/ -); - -extern void XSyncValueSubtract( - XSyncValue* /*presult*/, - XSyncValue /*a*/, - XSyncValue /*b*/, - int* /*poverflow*/ -); - -extern void XSyncMaxValue( - XSyncValue* /*pv*/ -); - -extern void XSyncMinValue( - XSyncValue* /*pv*/ -); - -_XFUNCPROTOEND - - -typedef struct _XSyncSystemCounter { - char *name; /* null-terminated name of system counter */ - XSyncCounter counter; /* counter id of this system counter */ - XSyncValue resolution; /* resolution of this system counter */ -} XSyncSystemCounter; - - -typedef struct { - XSyncCounter counter; /* counter to trigger on */ - XSyncValueType value_type; /* absolute/relative */ - XSyncValue wait_value; /* value to compare counter to */ - XSyncTestType test_type; /* pos/neg comparison/transtion */ -} XSyncTrigger; - -typedef struct { - XSyncTrigger trigger; /* trigger for await */ - XSyncValue event_threshold; /* send event if past threshold */ -} XSyncWaitCondition; - - -typedef struct { - XSyncTrigger trigger; - XSyncValue delta; - Bool events; - XSyncAlarmState state; -} XSyncAlarmAttributes; - -/* - * Events - */ - -typedef struct { - int type; /* event base + XSyncCounterNotify */ - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - XSyncCounter counter; /* counter involved in await */ - XSyncValue wait_value; /* value being waited for */ - XSyncValue counter_value; /* counter value when this event was sent */ - Time time; /* milliseconds */ - int count; /* how many more events to come */ - Bool destroyed; /* True if counter was destroyed */ -} XSyncCounterNotifyEvent; - -typedef struct { - int type; /* event base + XSyncCounterNotify */ - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - XSyncAlarm alarm; /* alarm that triggered */ - XSyncValue counter_value; /* value that triggered the alarm */ - XSyncValue alarm_value; /* test value of trigger in alarm */ - Time time; /* milliseconds */ - XSyncAlarmState state; /* new state of alarm */ -} XSyncAlarmNotifyEvent; - -/* - * Errors - */ - -typedef struct { - int type; - Display *display; /* Display the event was read from */ - XSyncAlarm alarm; /* resource id */ - unsigned long serial; /* serial number of failed request */ - unsigned char error_code; /* error base + XSyncBadAlarm */ - unsigned char request_code; /* Major op-code of failed request */ - unsigned char minor_code; /* Minor op-code of failed request */ -} XSyncAlarmError; - -typedef struct { - int type; - Display *display; /* Display the event was read from */ - XSyncCounter counter; /* resource id */ - unsigned long serial; /* serial number of failed request */ - unsigned char error_code; /* error base + XSyncBadCounter */ - unsigned char request_code; /* Major op-code of failed request */ - unsigned char minor_code; /* Minor op-code of failed request */ -} XSyncCounterError; - -/* - * Prototypes - */ - -_XFUNCPROTOBEGIN - -extern Status XSyncQueryExtension( - Display* /*dpy*/, - int* /*event_base_return*/, - int* /*error_base_return*/ -); - -extern Status XSyncInitialize( - Display* /*dpy*/, - int* /*major_version_return*/, - int* /*minor_version_return*/ -); - -extern XSyncSystemCounter *XSyncListSystemCounters( - Display* /*dpy*/, - int* /*n_counters_return*/ -); - -extern void XSyncFreeSystemCounterList( - XSyncSystemCounter* /*list*/ -); - -extern XSyncCounter XSyncCreateCounter( - Display* /*dpy*/, - XSyncValue /*initial_value*/ -); - -extern Status XSyncSetCounter( - Display* /*dpy*/, - XSyncCounter /*counter*/, - XSyncValue /*value*/ -); - -extern Status XSyncChangeCounter( - Display* /*dpy*/, - XSyncCounter /*counter*/, - XSyncValue /*value*/ -); - -extern Status XSyncDestroyCounter( - Display* /*dpy*/, - XSyncCounter /*counter*/ -); - -extern Status XSyncQueryCounter( - Display* /*dpy*/, - XSyncCounter /*counter*/, - XSyncValue* /*value_return*/ -); - -extern Status XSyncAwait( - Display* /*dpy*/, - XSyncWaitCondition* /*wait_list*/, - int /*n_conditions*/ -); - -extern XSyncAlarm XSyncCreateAlarm( - Display* /*dpy*/, - unsigned long /*values_mask*/, - XSyncAlarmAttributes* /*values*/ -); - -extern Status XSyncDestroyAlarm( - Display* /*dpy*/, - XSyncAlarm /*alarm*/ -); - -extern Status XSyncQueryAlarm( - Display* /*dpy*/, - XSyncAlarm /*alarm*/, - XSyncAlarmAttributes* /*values_return*/ -); - -extern Status XSyncChangeAlarm( - Display* /*dpy*/, - XSyncAlarm /*alarm*/, - unsigned long /*values_mask*/, - XSyncAlarmAttributes* /*values*/ -); - -extern Status XSyncSetPriority( - Display* /*dpy*/, - XID /*client_resource_id*/, - int /*priority*/ -); - -extern Status XSyncGetPriority( - Display* /*dpy*/, - XID /*client_resource_id*/, - int* /*return_priority*/ -); - -extern XSyncFence XSyncCreateFence( - Display* /*dpy*/, - Drawable /*d*/, - Bool /*initially_triggered*/ -); - -extern Bool XSyncTriggerFence( - Display* /*dpy*/, - XSyncFence /*fence*/ -); - -extern Bool XSyncResetFence( - Display* /*dpy*/, - XSyncFence /*fence*/ -); - -extern Bool XSyncDestroyFence( - Display* /*dpy*/, - XSyncFence /*fence*/ -); - -extern Bool XSyncQueryFence( - Display* /*dpy*/, - XSyncFence /*fence*/, - Bool* /*triggered*/ -); - -extern Bool XSyncAwaitFence( - Display* /*dpy*/, - const XSyncFence* /*fence_list*/, - int /*n_fences*/ -); - -_XFUNCPROTOEND - -#endif /* _SYNC_SERVER */ - -#endif /* _SYNC_H_ */ +/* + +Copyright 1991, 1993, 1994, 1998 The Open Group + +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +/*********************************************************** +Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts, +and Olivetti Research Limited, Cambridge, England. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +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 names of Digital or Olivetti +not be used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL THEY 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. + +******************************************************************/ + +#ifndef _SYNC_H_ +#define _SYNC_H_ + +#include +#include + +#ifdef _SYNC_SERVER +#include +#else + +_XFUNCPROTOBEGIN +/* get rid of macros so we can define corresponding functions */ +#undef XSyncIntToValue +#undef XSyncIntsToValue +#undef XSyncValueGreaterThan +#undef XSyncValueLessThan +#undef XSyncValueGreaterOrEqual +#undef XSyncValueLessOrEqual +#undef XSyncValueEqual +#undef XSyncValueIsNegative +#undef XSyncValueIsZero +#undef XSyncValueIsPositive +#undef XSyncValueLow32 +#undef XSyncValueHigh32 +#undef XSyncValueAdd +#undef XSyncValueSubtract +#undef XSyncMaxValue +#undef XSyncMinValue + +extern void XSyncIntToValue( + XSyncValue* /*pv*/, + int /*i*/ +); + +extern void XSyncIntsToValue( + XSyncValue* /*pv*/, + unsigned int /*l*/, + int /*h*/ +); + +extern Bool XSyncValueGreaterThan( + XSyncValue /*a*/, + XSyncValue /*b*/ +); + +extern Bool XSyncValueLessThan( + XSyncValue /*a*/, + XSyncValue /*b*/ +); + +extern Bool XSyncValueGreaterOrEqual( + XSyncValue /*a*/, + XSyncValue /*b*/ +); + +extern Bool XSyncValueLessOrEqual( + XSyncValue /*a*/, + XSyncValue /*b*/ +); + +extern Bool XSyncValueEqual( + XSyncValue /*a*/, + XSyncValue /*b*/ +); + +extern Bool XSyncValueIsNegative( + XSyncValue /*v*/ +); + +extern Bool XSyncValueIsZero( + XSyncValue /*a*/ +); + +extern Bool XSyncValueIsPositive( + XSyncValue /*v*/ +); + +extern unsigned int XSyncValueLow32( + XSyncValue /*v*/ +); + +extern int XSyncValueHigh32( + XSyncValue /*v*/ +); + +extern void XSyncValueAdd( + XSyncValue* /*presult*/, + XSyncValue /*a*/, + XSyncValue /*b*/, + int* /*poverflow*/ +); + +extern void XSyncValueSubtract( + XSyncValue* /*presult*/, + XSyncValue /*a*/, + XSyncValue /*b*/, + int* /*poverflow*/ +); + +extern void XSyncMaxValue( + XSyncValue* /*pv*/ +); + +extern void XSyncMinValue( + XSyncValue* /*pv*/ +); + +_XFUNCPROTOEND + + +typedef struct _XSyncSystemCounter { + char *name; /* null-terminated name of system counter */ + XSyncCounter counter; /* counter id of this system counter */ + XSyncValue resolution; /* resolution of this system counter */ +} XSyncSystemCounter; + + +typedef struct { + XSyncCounter counter; /* counter to trigger on */ + XSyncValueType value_type; /* absolute/relative */ + XSyncValue wait_value; /* value to compare counter to */ + XSyncTestType test_type; /* pos/neg comparison/transtion */ +} XSyncTrigger; + +typedef struct { + XSyncTrigger trigger; /* trigger for await */ + XSyncValue event_threshold; /* send event if past threshold */ +} XSyncWaitCondition; + + +typedef struct { + XSyncTrigger trigger; + XSyncValue delta; + Bool events; + XSyncAlarmState state; +} XSyncAlarmAttributes; + +/* + * Events + */ + +typedef struct { + int type; /* event base + XSyncCounterNotify */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + XSyncCounter counter; /* counter involved in await */ + XSyncValue wait_value; /* value being waited for */ + XSyncValue counter_value; /* counter value when this event was sent */ + Time time; /* milliseconds */ + int count; /* how many more events to come */ + Bool destroyed; /* True if counter was destroyed */ +} XSyncCounterNotifyEvent; + +typedef struct { + int type; /* event base + XSyncCounterNotify */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + XSyncAlarm alarm; /* alarm that triggered */ + XSyncValue counter_value; /* value that triggered the alarm */ + XSyncValue alarm_value; /* test value of trigger in alarm */ + Time time; /* milliseconds */ + XSyncAlarmState state; /* new state of alarm */ +} XSyncAlarmNotifyEvent; + +/* + * Errors + */ + +typedef struct { + int type; + Display *display; /* Display the event was read from */ + XSyncAlarm alarm; /* resource id */ + unsigned long serial; /* serial number of failed request */ + unsigned char error_code; /* error base + XSyncBadAlarm */ + unsigned char request_code; /* Major op-code of failed request */ + unsigned char minor_code; /* Minor op-code of failed request */ +} XSyncAlarmError; + +typedef struct { + int type; + Display *display; /* Display the event was read from */ + XSyncCounter counter; /* resource id */ + unsigned long serial; /* serial number of failed request */ + unsigned char error_code; /* error base + XSyncBadCounter */ + unsigned char request_code; /* Major op-code of failed request */ + unsigned char minor_code; /* Minor op-code of failed request */ +} XSyncCounterError; + +/* + * Prototypes + */ + +_XFUNCPROTOBEGIN + +extern Status XSyncQueryExtension( + Display* /*dpy*/, + int* /*event_base_return*/, + int* /*error_base_return*/ +); + +extern Status XSyncInitialize( + Display* /*dpy*/, + int* /*major_version_return*/, + int* /*minor_version_return*/ +); + +extern XSyncSystemCounter *XSyncListSystemCounters( + Display* /*dpy*/, + int* /*n_counters_return*/ +); + +extern void XSyncFreeSystemCounterList( + XSyncSystemCounter* /*list*/ +); + +extern XSyncCounter XSyncCreateCounter( + Display* /*dpy*/, + XSyncValue /*initial_value*/ +); + +extern Status XSyncSetCounter( + Display* /*dpy*/, + XSyncCounter /*counter*/, + XSyncValue /*value*/ +); + +extern Status XSyncChangeCounter( + Display* /*dpy*/, + XSyncCounter /*counter*/, + XSyncValue /*value*/ +); + +extern Status XSyncDestroyCounter( + Display* /*dpy*/, + XSyncCounter /*counter*/ +); + +extern Status XSyncQueryCounter( + Display* /*dpy*/, + XSyncCounter /*counter*/, + XSyncValue* /*value_return*/ +); + +extern Status XSyncAwait( + Display* /*dpy*/, + XSyncWaitCondition* /*wait_list*/, + int /*n_conditions*/ +); + +extern XSyncAlarm XSyncCreateAlarm( + Display* /*dpy*/, + unsigned long /*values_mask*/, + XSyncAlarmAttributes* /*values*/ +); + +extern Status XSyncDestroyAlarm( + Display* /*dpy*/, + XSyncAlarm /*alarm*/ +); + +extern Status XSyncQueryAlarm( + Display* /*dpy*/, + XSyncAlarm /*alarm*/, + XSyncAlarmAttributes* /*values_return*/ +); + +extern Status XSyncChangeAlarm( + Display* /*dpy*/, + XSyncAlarm /*alarm*/, + unsigned long /*values_mask*/, + XSyncAlarmAttributes* /*values*/ +); + +extern Status XSyncSetPriority( + Display* /*dpy*/, + XID /*client_resource_id*/, + int /*priority*/ +); + +extern Status XSyncGetPriority( + Display* /*dpy*/, + XID /*client_resource_id*/, + int* /*return_priority*/ +); + +extern XSyncFence XSyncCreateFence( + Display* /*dpy*/, + Drawable /*d*/, + Bool /*initially_triggered*/ +); + +extern Bool XSyncTriggerFence( + Display* /*dpy*/, + XSyncFence /*fence*/ +); + +extern Bool XSyncResetFence( + Display* /*dpy*/, + XSyncFence /*fence*/ +); + +extern Bool XSyncDestroyFence( + Display* /*dpy*/, + XSyncFence /*fence*/ +); + +extern Bool XSyncQueryFence( + Display* /*dpy*/, + XSyncFence /*fence*/, + Bool* /*triggered*/ +); + +extern Bool XSyncAwaitFence( + Display* /*dpy*/, + const XSyncFence* /*fence_list*/, + int /*n_fences*/ +); + +_XFUNCPROTOEND + +#endif /* _SYNC_SERVER */ + +#endif /* _SYNC_H_ */ diff --git a/libXext/include/X11/extensions/xtestext1.h b/libXext/include/X11/extensions/xtestext1.h index 59cdd151d..67d015bb0 100644 --- a/libXext/include/X11/extensions/xtestext1.h +++ b/libXext/include/X11/extensions/xtestext1.h @@ -41,8 +41,8 @@ documentation, and that the name of Hewlett-Packard not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. -Hewlett-Packard makes no representations about the -suitability of this software for any purpose. It is provided +Hewlett-Packard makes no representations about the +suitability of this software for any purpose. It is provided "as is" without express or implied warranty. This software is not subject to any license of the American diff --git a/libXext/man/DBE.man b/libXext/man/DBE.man index 6199d4917..5ed34c236 100644 --- a/libXext/man/DBE.man +++ b/libXext/man/DBE.man @@ -1,313 +1,313 @@ -.\" Copyright (c) 1995 Hewlett-Packard Company -.\" -.\" 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 furnished to do so, subject to the following conditions: -.\" -.\" The above copyright notice and this permission notice shall be included in -.\" all copies or substantial portions of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -.\" SOFTWARE. -.\" -.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not -.\" be used in advertising or otherwise to promote the sale, use or other -.\" dealing in this Software without prior written authorization from the -.\" Hewlett-Packard Company. -.\" -.TH DBE __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -DBE - Double Buffer Extension -.SH SYNOPSIS -The Double Buffer Extension (DBE) provides a standard way to utilize -double-buffering within the framework of the X Window System. -Double-buffering uses two buffers, called front and back, which hold images. -The front buffer is visible to the user; the back buffer is not. Successive -frames of an animation are rendered into the back buffer while the previously -rendered frame is displayed in the front buffer. When a new frame is ready, -the back and front buffers swap roles, making the new frame visible. Ideally, -this exchange appears to happen instantaneously to the user, with no visual -artifacts. Thus, only completely rendered images are presented to the user, -and remain visible during the entire time it takes to render a new frame. The -result is a flicker-free animation. -.SH DESCRIPTION -.B Concepts -.RS -Normal windows are created using -.B XCreateWindow() -or -.B XCreateSimpleWindow(), -which allocate a set of window attributes and, for InputOutput windows, a front -buffer, into which an image can be drawn. The contents of this buffer will be -displayed when the window is visible. - -This extension enables applications to use double-buffering with a window. -This involves creating a second buffer, called a back buffer, and associating -one or more back buffer names -.I (XIDs) -with the window, for use when referring -to (i.e., drawing to or reading from) the window's back buffer. -The back buffer name is a drawable of type -.I XdbeBackBuffer. - -DBE provides a relative double-buffering model. One XID, the window, -always refers to the front buffer. One or more other XIDs, the back buffer -names, always refer to the back buffer. After a buffer swap, the window -continues to refer to the (new) front buffer, and the back buffer name -continues to refer to the (new) back buffer. Thus, applications and toolkits -that want to just render to the back buffer always use the back buffer name -for all drawing requests to the window. Portions of an application that want -to render to the front buffer always use the window XID for all drawing -requests to the window. - -Multiple clients and toolkits can all use double-buffering on the same window. -DBE does not provide a request for querying whether a window has -double-buffering support, and if so, what the back buffer name is. Given the -asynchronous nature of the X Window System, this would cause race -conditions. Instead, DBE allows multiple back buffer names to exist for the -same window; they all refer to the same physical back buffer. The first time a -back buffer name is allocated for a window, the window becomes -double-buffered and the back buffer name is associated with the window. -Subsequently, the window already is a double-buffered window, and nothing -about the window changes when a new back buffer name is allocated, except -that the new back buffer name is associated with the window. The window -remains double-buffered until either the window is destroyed, or until all of -the back buffer names for the window are deallocated. - -In general, both the front and back buffers ae treated the same. In -particular, here are some important characteristics: - -.RS -Only one buffer per window can be visible at a time (the front buffer). - -Both buffers associated with a window have the same visual type, depth, -width, height, and shape as the window. - -Both buffers associated with a window are "visible" (or "obscured") in -the same way. When an Expose event is generated for a window, this -event is considered to apply to both buffers equally. When a -double-buffered window is exposed, both buffers are tiled with the -window background. -Even though the back buffer is not visible, terms such as obscure apply to the -back buffer as well as to the front buffer. - -It is acceptable at any time to pass an -.I XdbeBackBuffer -in any function that expects a drawable. -This enables an application to draw directly into -.I XdbeBackBuffer -in the same fashion as it would draw into any other drawable. - -It is an error (Window) to pass an -.I XdbeBackBuffer -in a function that expects a Window. - -An -.I XdbeBackBuffer -will never be sent in a reply, event, or error where a Window is specified. - -If backing-store and save-under applies to a double-buffered -window, it applies to both buffers equally. - -If the -.B XClearArea() -or -.B XClearWindow() -function is executed on a -double-buffered window, the same area in both the front and back buffers -is cleared. -.RE - -The effect of passing a window to a function that accepts a drawable -is unchanged by this extension. The window and front buffer are synonymous -with each other. This includes obeying the -.B XGetImage() -and -.B XGetSubImage() -semantics and the subwindow-mode semantics if a graphics context is -involved. Regardless of whether the window was explicitly passed in an -.B XGetImage() -or -.B XGetSubImage() -call, or implicitly referenced (i.e., one of -the window's ancestors was passed in the function), the front (i.e. visible) -buffer is always referenced. -Thus, DBE-naive screen dump clients will always get the front buffer. -.B XGetImage() -and -.B XGetSubImage() -on a back -buffer return undefined image contents for any obscured regions of the back -buffer that fall within the image. - -Drawing to a back buffer always uses the clip region that would be used to -draw to the front buffer with a GC subwindow-mode of ClipByChildren. If an -ancestor of a double-buffered window is drawn to with a GC having a -subwindow-mode of IncludeInferiors, the effect on the double-buffered -window's back buffer depends on the depth of the double-buffered window -and the ancestor. If the depths are the same, the contents of the back buffer -of the double-buffered window are not changed. If the depths are different, -the contents of the back buffer of the double-buffered window are undefined -for the pixels that the IncludeInferiors drawing touched. - -DBE adds no new events. DBE does not extend the semantics of any existing -events with the exception of adding a new drawable type called -.I XdbeBackBuffer. - -If events, replies, or errors that contain a drawable -(e.g., GraphicsExpose) are generated in response to a request, the -drawable returned will be the one specified in the request. - -DBE advertises which visuals support double buffering. - -DBE does not include any timing or synchronization facilities. Applications -that need such facilities (e.g., to maintain a constant frame rate) should -investigate the Synchronization Extension, an X Consortium standard. -.RE - -.B Window Management Operations - -.RS -The basic philosophy of DBE is that both buffers are treated the same by -X window management operations. - -When a double-buffered window is destroyed, -both buffers associated with the window are destroyed, and all back buffer -names associated with the window are freed. - -If the size of a double-buffered window changes, both -buffers assume the new size. If the window's size increases, the effect on the -buffers depends on whether the implementation honors bit gravity for buffers. -If bit gravity is implemented, then the contents of both buffers are moved in -accordance with the window's bit gravity, -and the remaining areas are tiled with the window background. If -bit gravity is not implemented, then the entire unobscured region of both -buffers is tiled with the window background. In either case, Expose events are -generated for the region that is tiled with the window background. - -If the -.B XGetGeometry() -function is executed on an -.I XdbeBackBuffer, -the returned x, y, and border-width will be zero. - -If the Shape extension -.B ShapeRectangles, ShapeMask, ShapeCombine, -or -.B ShapeOffset -request is executed on a double-buffered window, both -buffers are reshaped to match the new window shape. The region difference -D = new shape - old shape is tiled with the window background in both -buffers, and Expose events are generated for D. -.RE - -.B Complex Swap Actions - -.RS -DBE has no explicit knowledge of ancillary buffers (e.g. depth buffers or -alpha buffers), and only has a limited set of defined swap actions. Some -applications may need a richer set of swap actions than DBE provides. Some -DBE implementations have knowledge of ancillary buffers, and/or can provide -a rich set of swap actions. Instead of continually extending DBE to increase -its set of swap actions, DBE provides a flexible "idiom" mechanism. If an -applications's needs are served by the defined swap actions, it should use -them; otherwise, it should use the following method of expressing a complex -swap action as an idiom. Following this policy will ensure the best possible -performance across a wide variety of implementations. - -As suggested by the term "idiom," a complex swap action should be expressed -as a group/series of requests. Taken together, this group of requests may be -combined into an atomic operation by the implementation, in order to -maximize performance. The set of idioms actually recognized for optimization -is implementation dependent. To help with idiom expression and -interpretation, an idiom must be surrounded by two function calls: -.B XdbeBeginIdiom() -and -.B XdbeEndIdiom(). -Unless this begin-end pair -surrounds the idiom, it may not be recognized by a given implementation, and -performance will suffer. - -For example, if an application wants to swap buffers for two windows, and use -X to clear only certain planes of the back buffers, the application would -make the following calls as a group, and in the following order: - -.RS -.B XdbeBeginIdiom(). - -.B XdbeSwapBuffers() -with XIDs for two windows, each of which uses a swap action of Untouched. - -.B XFillRectangle() -to the back buffer of one window. - -.B XFillRectangle() -to the back buffer of the other window. - -.B XdbeEndIdiom(). -.RE - -The -.B XdbeBeginIdiom() -and -.B XdbeEndIdiom() -functions do not perform any -actions themselves. They are treated as markers by implementations that can -combine certain groups/series of requests as idioms, and are ignored by other -implementations or for non-recognized groups/series of requests. If these -function calls are made out of order, or are mismatched, no errors are sent, -and the functions are executed as usual, though performance may suffer. - -.B XdbeSwapBuffers() -need not be included in an idiom. For -example, if a swap action of Copied is desired, but only some of the planes -should be copied, -.B XCopyArea() -may be used instead of -.B XdbeSwapBuffers(). -If -.B XdbeSwapBuffers() -is included in an idiom, it should immediately follow the -.B XdbeBeginIdiom() -call. Also, when the -.B XdbeSwapBuffers() -is included in an idiom, that request's swap action will -still be valid, and if the swap action might overlap with another request, then -the final result of the idiom must be as if the separate requests were executed -serially. For example, if the specified swap action is Untouched, and if a -.B XFillRectangle() -using a client clip rectangle is done to the window's back -buffer after the -.B XdbeSwapBuffers() -call, then the contents of the new -back buffer (after the idiom) will be the same as if the idiom was not -recognized by the implementation. - -It is highly recommended that API providers define, and application -developers use, "convenience" functions that allow client applications to call -one procedure that encapsulates common idioms. These functions will -generate the -.B XdbeBeginIdiom(), -idiom, and -.B XdbeEndIdiom() -calls. Usage of these functions will ensure best possible -performance across a wide variety of implementations. -.SH SEE ALSO -.I XdbeAllocateBackBufferName(), -.I XdbeBeginIdiom(), -.I XdbeDeallocateBackBufferName(), -.I XdbeEndIdiom(), -.I XdbeFreeVisualInfo(), -.I XdbeGetBackBufferAttributes(), -.I XdbeGetVisualInfo(), -.I XdbeQueryExtension(), -.I XdbeSwapBuffers(). - +.\" Copyright (c) 1995 Hewlett-Packard Company +.\" +.\" 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 furnished to do so, subject to the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be included in +.\" all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" SOFTWARE. +.\" +.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not +.\" be used in advertising or otherwise to promote the sale, use or other +.\" dealing in this Software without prior written authorization from the +.\" Hewlett-Packard Company. +.\" +.TH DBE __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +DBE - Double Buffer Extension +.SH SYNOPSIS +The Double Buffer Extension (DBE) provides a standard way to utilize +double-buffering within the framework of the X Window System. +Double-buffering uses two buffers, called front and back, which hold images. +The front buffer is visible to the user; the back buffer is not. Successive +frames of an animation are rendered into the back buffer while the previously +rendered frame is displayed in the front buffer. When a new frame is ready, +the back and front buffers swap roles, making the new frame visible. Ideally, +this exchange appears to happen instantaneously to the user, with no visual +artifacts. Thus, only completely rendered images are presented to the user, +and remain visible during the entire time it takes to render a new frame. The +result is a flicker-free animation. +.SH DESCRIPTION +.B Concepts +.RS +Normal windows are created using +.B XCreateWindow() +or +.B XCreateSimpleWindow(), +which allocate a set of window attributes and, for InputOutput windows, a front +buffer, into which an image can be drawn. The contents of this buffer will be +displayed when the window is visible. + +This extension enables applications to use double-buffering with a window. +This involves creating a second buffer, called a back buffer, and associating +one or more back buffer names +.I (XIDs) +with the window, for use when referring +to (i.e., drawing to or reading from) the window's back buffer. +The back buffer name is a drawable of type +.I XdbeBackBuffer. + +DBE provides a relative double-buffering model. One XID, the window, +always refers to the front buffer. One or more other XIDs, the back buffer +names, always refer to the back buffer. After a buffer swap, the window +continues to refer to the (new) front buffer, and the back buffer name +continues to refer to the (new) back buffer. Thus, applications and toolkits +that want to just render to the back buffer always use the back buffer name +for all drawing requests to the window. Portions of an application that want +to render to the front buffer always use the window XID for all drawing +requests to the window. + +Multiple clients and toolkits can all use double-buffering on the same window. +DBE does not provide a request for querying whether a window has +double-buffering support, and if so, what the back buffer name is. Given the +asynchronous nature of the X Window System, this would cause race +conditions. Instead, DBE allows multiple back buffer names to exist for the +same window; they all refer to the same physical back buffer. The first time a +back buffer name is allocated for a window, the window becomes +double-buffered and the back buffer name is associated with the window. +Subsequently, the window already is a double-buffered window, and nothing +about the window changes when a new back buffer name is allocated, except +that the new back buffer name is associated with the window. The window +remains double-buffered until either the window is destroyed, or until all of +the back buffer names for the window are deallocated. + +In general, both the front and back buffers ae treated the same. In +particular, here are some important characteristics: + +.RS +Only one buffer per window can be visible at a time (the front buffer). + +Both buffers associated with a window have the same visual type, depth, +width, height, and shape as the window. + +Both buffers associated with a window are "visible" (or "obscured") in +the same way. When an Expose event is generated for a window, this +event is considered to apply to both buffers equally. When a +double-buffered window is exposed, both buffers are tiled with the +window background. +Even though the back buffer is not visible, terms such as obscure apply to the +back buffer as well as to the front buffer. + +It is acceptable at any time to pass an +.I XdbeBackBuffer +in any function that expects a drawable. +This enables an application to draw directly into +.I XdbeBackBuffer +in the same fashion as it would draw into any other drawable. + +It is an error (Window) to pass an +.I XdbeBackBuffer +in a function that expects a Window. + +An +.I XdbeBackBuffer +will never be sent in a reply, event, or error where a Window is specified. + +If backing-store and save-under applies to a double-buffered +window, it applies to both buffers equally. + +If the +.B XClearArea() +or +.B XClearWindow() +function is executed on a +double-buffered window, the same area in both the front and back buffers +is cleared. +.RE + +The effect of passing a window to a function that accepts a drawable +is unchanged by this extension. The window and front buffer are synonymous +with each other. This includes obeying the +.B XGetImage() +and +.B XGetSubImage() +semantics and the subwindow-mode semantics if a graphics context is +involved. Regardless of whether the window was explicitly passed in an +.B XGetImage() +or +.B XGetSubImage() +call, or implicitly referenced (i.e., one of +the window's ancestors was passed in the function), the front (i.e. visible) +buffer is always referenced. +Thus, DBE-naive screen dump clients will always get the front buffer. +.B XGetImage() +and +.B XGetSubImage() +on a back +buffer return undefined image contents for any obscured regions of the back +buffer that fall within the image. + +Drawing to a back buffer always uses the clip region that would be used to +draw to the front buffer with a GC subwindow-mode of ClipByChildren. If an +ancestor of a double-buffered window is drawn to with a GC having a +subwindow-mode of IncludeInferiors, the effect on the double-buffered +window's back buffer depends on the depth of the double-buffered window +and the ancestor. If the depths are the same, the contents of the back buffer +of the double-buffered window are not changed. If the depths are different, +the contents of the back buffer of the double-buffered window are undefined +for the pixels that the IncludeInferiors drawing touched. + +DBE adds no new events. DBE does not extend the semantics of any existing +events with the exception of adding a new drawable type called +.I XdbeBackBuffer. + +If events, replies, or errors that contain a drawable +(e.g., GraphicsExpose) are generated in response to a request, the +drawable returned will be the one specified in the request. + +DBE advertises which visuals support double buffering. + +DBE does not include any timing or synchronization facilities. Applications +that need such facilities (e.g., to maintain a constant frame rate) should +investigate the Synchronization Extension, an X Consortium standard. +.RE + +.B Window Management Operations + +.RS +The basic philosophy of DBE is that both buffers are treated the same by +X window management operations. + +When a double-buffered window is destroyed, +both buffers associated with the window are destroyed, and all back buffer +names associated with the window are freed. + +If the size of a double-buffered window changes, both +buffers assume the new size. If the window's size increases, the effect on the +buffers depends on whether the implementation honors bit gravity for buffers. +If bit gravity is implemented, then the contents of both buffers are moved in +accordance with the window's bit gravity, +and the remaining areas are tiled with the window background. If +bit gravity is not implemented, then the entire unobscured region of both +buffers is tiled with the window background. In either case, Expose events are +generated for the region that is tiled with the window background. + +If the +.B XGetGeometry() +function is executed on an +.I XdbeBackBuffer, +the returned x, y, and border-width will be zero. + +If the Shape extension +.B ShapeRectangles, ShapeMask, ShapeCombine, +or +.B ShapeOffset +request is executed on a double-buffered window, both +buffers are reshaped to match the new window shape. The region difference +D = new shape - old shape is tiled with the window background in both +buffers, and Expose events are generated for D. +.RE + +.B Complex Swap Actions + +.RS +DBE has no explicit knowledge of ancillary buffers (e.g. depth buffers or +alpha buffers), and only has a limited set of defined swap actions. Some +applications may need a richer set of swap actions than DBE provides. Some +DBE implementations have knowledge of ancillary buffers, and/or can provide +a rich set of swap actions. Instead of continually extending DBE to increase +its set of swap actions, DBE provides a flexible "idiom" mechanism. If an +applications's needs are served by the defined swap actions, it should use +them; otherwise, it should use the following method of expressing a complex +swap action as an idiom. Following this policy will ensure the best possible +performance across a wide variety of implementations. + +As suggested by the term "idiom," a complex swap action should be expressed +as a group/series of requests. Taken together, this group of requests may be +combined into an atomic operation by the implementation, in order to +maximize performance. The set of idioms actually recognized for optimization +is implementation dependent. To help with idiom expression and +interpretation, an idiom must be surrounded by two function calls: +.B XdbeBeginIdiom() +and +.B XdbeEndIdiom(). +Unless this begin-end pair +surrounds the idiom, it may not be recognized by a given implementation, and +performance will suffer. + +For example, if an application wants to swap buffers for two windows, and use +X to clear only certain planes of the back buffers, the application would +make the following calls as a group, and in the following order: + +.RS +.B XdbeBeginIdiom(). + +.B XdbeSwapBuffers() +with XIDs for two windows, each of which uses a swap action of Untouched. + +.B XFillRectangle() +to the back buffer of one window. + +.B XFillRectangle() +to the back buffer of the other window. + +.B XdbeEndIdiom(). +.RE + +The +.B XdbeBeginIdiom() +and +.B XdbeEndIdiom() +functions do not perform any +actions themselves. They are treated as markers by implementations that can +combine certain groups/series of requests as idioms, and are ignored by other +implementations or for non-recognized groups/series of requests. If these +function calls are made out of order, or are mismatched, no errors are sent, +and the functions are executed as usual, though performance may suffer. + +.B XdbeSwapBuffers() +need not be included in an idiom. For +example, if a swap action of Copied is desired, but only some of the planes +should be copied, +.B XCopyArea() +may be used instead of +.B XdbeSwapBuffers(). +If +.B XdbeSwapBuffers() +is included in an idiom, it should immediately follow the +.B XdbeBeginIdiom() +call. Also, when the +.B XdbeSwapBuffers() +is included in an idiom, that request's swap action will +still be valid, and if the swap action might overlap with another request, then +the final result of the idiom must be as if the separate requests were executed +serially. For example, if the specified swap action is Untouched, and if a +.B XFillRectangle() +using a client clip rectangle is done to the window's back +buffer after the +.B XdbeSwapBuffers() +call, then the contents of the new +back buffer (after the idiom) will be the same as if the idiom was not +recognized by the implementation. + +It is highly recommended that API providers define, and application +developers use, "convenience" functions that allow client applications to call +one procedure that encapsulates common idioms. These functions will +generate the +.B XdbeBeginIdiom(), +idiom, and +.B XdbeEndIdiom() +calls. Usage of these functions will ensure best possible +performance across a wide variety of implementations. +.SH SEE ALSO +.I XdbeAllocateBackBufferName(), +.I XdbeBeginIdiom(), +.I XdbeDeallocateBackBufferName(), +.I XdbeEndIdiom(), +.I XdbeFreeVisualInfo(), +.I XdbeGetBackBufferAttributes(), +.I XdbeGetVisualInfo(), +.I XdbeQueryExtension(), +.I XdbeSwapBuffers(). + diff --git a/libXext/man/DPMSCapable.man b/libXext/man/DPMSCapable.man index 62861a6fd..d802ae0a2 100644 --- a/libXext/man/DPMSCapable.man +++ b/libXext/man/DPMSCapable.man @@ -1,65 +1,65 @@ -.\" Copyright \(co Digital Equipment Corporation, 1996 -.\" -.\" Permission to use, copy, modify, distribute, and sell this -.\" documentation for any purpose is hereby granted without fee, -.\" provided that the above copyright notice and this permission -.\" notice appear in all copies. Digital Equipment Corporation -.\" makes no representations about the suitability for any purpose -.\" of the information in this document. This documentation is -.\" provided ``as is'' without express or implied warranty. -.\" -.\" Copyright (c) 1999, 2005, 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. -.\" -.TH DPMSCapable __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -DPMSCapable \- returns the DPMS capability of the X server -.SH SYNOPSIS -.PP -.nf -\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] -\&#include -.HP -.BR "Bool DPMSCapable" " ( Display *\fIdisplay\fP\^ );" -.if n .ti +5n -.if t .ti +.5i -.SH ARGUMENTS -.TP -.I display -Specifies the connection to the X server -.SH DESCRIPTION -.LP -The -.I DPMSCapable -function returns the Display Power Management Signaling (DPMS) capability of -the X server, either TRUE \^(capable of DPMS\^) or FALSE \^(incapable of -DPMS\^). -.SH "RETURN VALUES" -.TP 15 -True -The -.I DPMSCapable -function returns True if the X server is capable of DPMS. -.TP 15 -False -The -.I DPMSCapable -function returns True if the X server is incapable of DPMS. +.\" Copyright \(co Digital Equipment Corporation, 1996 +.\" +.\" Permission to use, copy, modify, distribute, and sell this +.\" documentation for any purpose is hereby granted without fee, +.\" provided that the above copyright notice and this permission +.\" notice appear in all copies. Digital Equipment Corporation +.\" makes no representations about the suitability for any purpose +.\" of the information in this document. This documentation is +.\" provided ``as is'' without express or implied warranty. +.\" +.\" Copyright (c) 1999, 2005, 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. +.\" +.TH DPMSCapable __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +DPMSCapable \- returns the DPMS capability of the X server +.SH SYNOPSIS +.PP +.nf +\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] +\&#include +.HP +.BR "Bool DPMSCapable" " ( Display *\fIdisplay\fP\^ );" +.if n .ti +5n +.if t .ti +.5i +.SH ARGUMENTS +.TP +.I display +Specifies the connection to the X server +.SH DESCRIPTION +.LP +The +.I DPMSCapable +function returns the Display Power Management Signaling (DPMS) capability of +the X server, either TRUE \^(capable of DPMS\^) or FALSE \^(incapable of +DPMS\^). +.SH "RETURN VALUES" +.TP 15 +True +The +.I DPMSCapable +function returns True if the X server is capable of DPMS. +.TP 15 +False +The +.I DPMSCapable +function returns True if the X server is incapable of DPMS. diff --git a/libXext/man/DPMSDisable.man b/libXext/man/DPMSDisable.man index eeca6cbd2..efc1405f2 100644 --- a/libXext/man/DPMSDisable.man +++ b/libXext/man/DPMSDisable.man @@ -1,65 +1,65 @@ -.\" Copyright \(co Digital Equipment Corporation, 1996 -.\" -.\" Permission to use, copy, modify, distribute, and sell this -.\" documentation for any purpose is hereby granted without fee, -.\" provided that the above copyright notice and this permission -.\" notice appear in all copies. Digital Equipment Corporation -.\" makes no representations about the suitability for any purpose -.\" of the information in this document. This documentation is -.\" provided ``as is'' without express or implied warranty. -.\" -.\" Copyright (c) 1999, 2005, 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. -.\" -.TH DPMSDisable __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -DPMSDisable \- disables DPMS on the specified display -.SH SYNOPSIS -.PP -.nf -\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] -\&#include -.HP -.BR "Status DPMSDisable" " ( Display \fI*display\fP\^ );" -.if n .ti +5n -.if t .ti +.5i -.SH ARGUMENTS -.TP -.I display -Specifies the connection to the X server -.SH DESCRIPTION -.LP -The -.I DPMSDisable -function disables Display Power Management Signaling (DPMS) on the specified -display. When disabled, DPMS sets the display to DPMSModeOn. If -.I DPMSDisable -is invoked on a display with DPMS already disabled or on a display which does -not support DPMS, no change is made and no error is returned. -.SH "RETURN VALUES" -.TP 15 -TRUE -The -.I DPMSDisable -function always returns TRUE. -.SH "SEE ALSO" -.BR DPMSCapable (__libmansuffix__), -.BR DPMSEnable (__libmansuffix__) +.\" Copyright \(co Digital Equipment Corporation, 1996 +.\" +.\" Permission to use, copy, modify, distribute, and sell this +.\" documentation for any purpose is hereby granted without fee, +.\" provided that the above copyright notice and this permission +.\" notice appear in all copies. Digital Equipment Corporation +.\" makes no representations about the suitability for any purpose +.\" of the information in this document. This documentation is +.\" provided ``as is'' without express or implied warranty. +.\" +.\" Copyright (c) 1999, 2005, 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. +.\" +.TH DPMSDisable __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +DPMSDisable \- disables DPMS on the specified display +.SH SYNOPSIS +.PP +.nf +\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] +\&#include +.HP +.BR "Status DPMSDisable" " ( Display \fI*display\fP\^ );" +.if n .ti +5n +.if t .ti +.5i +.SH ARGUMENTS +.TP +.I display +Specifies the connection to the X server +.SH DESCRIPTION +.LP +The +.I DPMSDisable +function disables Display Power Management Signaling (DPMS) on the specified +display. When disabled, DPMS sets the display to DPMSModeOn. If +.I DPMSDisable +is invoked on a display with DPMS already disabled or on a display which does +not support DPMS, no change is made and no error is returned. +.SH "RETURN VALUES" +.TP 15 +TRUE +The +.I DPMSDisable +function always returns TRUE. +.SH "SEE ALSO" +.BR DPMSCapable (__libmansuffix__), +.BR DPMSEnable (__libmansuffix__) diff --git a/libXext/man/DPMSEnable.man b/libXext/man/DPMSEnable.man index 14f5f35af..a377dd201 100644 --- a/libXext/man/DPMSEnable.man +++ b/libXext/man/DPMSEnable.man @@ -1,77 +1,77 @@ -.\" Copyright \(co Digital Equipment Corporation, 1996 -.\" -.\" Permission to use, copy, modify, distribute, and sell this -.\" documentation for any purpose is hereby granted without fee, -.\" provided that the above copyright notice and this permission -.\" notice appear in all copies. Digital Equipment Corporation -.\" makes no representations about the suitability for any purpose -.\" of the information in this document. This documentation is -.\" provided ``as is'' without express or implied warranty. -.\" -.\" Copyright (c) 1999, 2005, 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. -.\" -.\" X Window System is a trademark of The Open Group. -.\" -.TH DPMSEnable __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -DPMSEnable \- enables DPMS on the specified display -.SH SYNOPSIS -.PP -.nf -\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] -\&#include -.HP -.BR "Status DPMSEnable" " ( Display *\fIdisplay\fP\^ );" -.if n .ti +5n -.if t .ti +.5i -.SH ARGUMENTS -.TP -.I display -Specifies the connection to the X server -.SH DESCRIPTION -.LP -The -.I DPMSEnable -function enables Display Power Management Signaling (DPMS) on the specified -.I display. -When DPMS is enabled, DPMS will use the currently saved timeout values. It will -trigger the appropriate DPMS power level based on the timeout values. Refer to -.I DPMSSetTimeouts. -All physical screens are affected by -.I DPMSEnable -at the same time. - -If -.I DPMSEnable -is invoked on a display which has DPMS already enabled, or on a display which -does not support DPMS, no change is made and no error is returned. -.SH "RETURN VALUES" -.TP 15 -TRUE -The -.I DPMSEnable -function always returns TRUE. -.SH "SEE ALSO" -.BR DPMSCapable (__libmansuffix__), -.BR DPMSDisable (__libmansuffix__), -.BR DPMSGetTimeouts (__libmansuffix__), -.BR DPMSSetTimeouts (__libmansuffix__) +.\" Copyright \(co Digital Equipment Corporation, 1996 +.\" +.\" Permission to use, copy, modify, distribute, and sell this +.\" documentation for any purpose is hereby granted without fee, +.\" provided that the above copyright notice and this permission +.\" notice appear in all copies. Digital Equipment Corporation +.\" makes no representations about the suitability for any purpose +.\" of the information in this document. This documentation is +.\" provided ``as is'' without express or implied warranty. +.\" +.\" Copyright (c) 1999, 2005, 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. +.\" +.\" X Window System is a trademark of The Open Group. +.\" +.TH DPMSEnable __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +DPMSEnable \- enables DPMS on the specified display +.SH SYNOPSIS +.PP +.nf +\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] +\&#include +.HP +.BR "Status DPMSEnable" " ( Display *\fIdisplay\fP\^ );" +.if n .ti +5n +.if t .ti +.5i +.SH ARGUMENTS +.TP +.I display +Specifies the connection to the X server +.SH DESCRIPTION +.LP +The +.I DPMSEnable +function enables Display Power Management Signaling (DPMS) on the specified +.I display. +When DPMS is enabled, DPMS will use the currently saved timeout values. It will +trigger the appropriate DPMS power level based on the timeout values. Refer to +.I DPMSSetTimeouts. +All physical screens are affected by +.I DPMSEnable +at the same time. + +If +.I DPMSEnable +is invoked on a display which has DPMS already enabled, or on a display which +does not support DPMS, no change is made and no error is returned. +.SH "RETURN VALUES" +.TP 15 +TRUE +The +.I DPMSEnable +function always returns TRUE. +.SH "SEE ALSO" +.BR DPMSCapable (__libmansuffix__), +.BR DPMSDisable (__libmansuffix__), +.BR DPMSGetTimeouts (__libmansuffix__), +.BR DPMSSetTimeouts (__libmansuffix__) diff --git a/libXext/man/DPMSForceLevel.man b/libXext/man/DPMSForceLevel.man index 62610be98..6517df8c9 100644 --- a/libXext/man/DPMSForceLevel.man +++ b/libXext/man/DPMSForceLevel.man @@ -1,83 +1,83 @@ -.\" Copyright \(co Digital Equipment Corporation, 1996 -.\" -.\" Permission to use, copy, modify, distribute, and sell this -.\" documentation for any purpose is hereby granted without fee, -.\" provided that the above copyright notice and this permission -.\" notice appear in all copies. Digital Equipment Corporation -.\" makes no representations about the suitability for any purpose -.\" of the information in this document. This documentation is -.\" provided ``as is'' without express or implied warranty. -.\" -.\" Copyright (c) 1999, 2005, 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. -.\" -.\" X Window System is a trademark of The Open Group. -.\" -.TH DPMSForceLevel __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -DPMSForceLevel \- forces a DPMS capable display into the -specified power level -.SH SYNOPSIS -.PP -.nf -\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] -\&#include -.HP -.BR "Status DPMSForceLevel" " ( Display \fI*display\fP\^, CARD16 \fIlevel\fP\^ );" -.if n .ti +5n -.if t .ti +.5i -.SH ARGUMENTS -.TP -.I display -Specifies the connection to the X server -.TP -.I level -Specifies the level to force power to -.SH DESCRIPTION -.LP -The -.I DPMSForceLevel -function forces a DPMS capable display into the specified power level. The -\fIlevel\fP must be one of following four states: DPMSModeOn, DPMSModeStandby, -DPMSModeSuspend, or DPMSModeOff. Values other than these will result in a -BadValue error. If DPMS -is disabled on the display, trying to set the power level on the display will -result in a BadMatch -protocol error. -.SH "RETURN VALUES" -.TP 15 -TRUE -The -.I DPMSForceLevel -function always returns TRUE. -.SH ERRORS -.TP 15 -BadValue -A level other than DPMSModeOn, DPMSModeStandby, DPMSModeSuspend, or DPMSModeOff -was specified. -.TP 15 -.SM BadMatch -DPMS is disabled on the specified display. -.SH "SEE ALSO" -.BR DPMSCapable (__libmansuffix__), -.BR DPMSInfo (__libmansuffix__), -.BR DPMSGetTimeouts (__libmansuffix__), -.BR DPMSSetTimeouts (__libmansuffix__) +.\" Copyright \(co Digital Equipment Corporation, 1996 +.\" +.\" Permission to use, copy, modify, distribute, and sell this +.\" documentation for any purpose is hereby granted without fee, +.\" provided that the above copyright notice and this permission +.\" notice appear in all copies. Digital Equipment Corporation +.\" makes no representations about the suitability for any purpose +.\" of the information in this document. This documentation is +.\" provided ``as is'' without express or implied warranty. +.\" +.\" Copyright (c) 1999, 2005, 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. +.\" +.\" X Window System is a trademark of The Open Group. +.\" +.TH DPMSForceLevel __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +DPMSForceLevel \- forces a DPMS capable display into the +specified power level +.SH SYNOPSIS +.PP +.nf +\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] +\&#include +.HP +.BR "Status DPMSForceLevel" " ( Display \fI*display\fP\^, CARD16 \fIlevel\fP\^ );" +.if n .ti +5n +.if t .ti +.5i +.SH ARGUMENTS +.TP +.I display +Specifies the connection to the X server +.TP +.I level +Specifies the level to force power to +.SH DESCRIPTION +.LP +The +.I DPMSForceLevel +function forces a DPMS capable display into the specified power level. The +\fIlevel\fP must be one of following four states: DPMSModeOn, DPMSModeStandby, +DPMSModeSuspend, or DPMSModeOff. Values other than these will result in a +BadValue error. If DPMS +is disabled on the display, trying to set the power level on the display will +result in a BadMatch +protocol error. +.SH "RETURN VALUES" +.TP 15 +TRUE +The +.I DPMSForceLevel +function always returns TRUE. +.SH ERRORS +.TP 15 +BadValue +A level other than DPMSModeOn, DPMSModeStandby, DPMSModeSuspend, or DPMSModeOff +was specified. +.TP 15 +.SM BadMatch +DPMS is disabled on the specified display. +.SH "SEE ALSO" +.BR DPMSCapable (__libmansuffix__), +.BR DPMSInfo (__libmansuffix__), +.BR DPMSGetTimeouts (__libmansuffix__), +.BR DPMSSetTimeouts (__libmansuffix__) diff --git a/libXext/man/DPMSGetTimeouts.man b/libXext/man/DPMSGetTimeouts.man index 3f64eccb4..0468cfda4 100644 --- a/libXext/man/DPMSGetTimeouts.man +++ b/libXext/man/DPMSGetTimeouts.man @@ -1,102 +1,102 @@ -.\" Copyright \(co Digital Equipment Corporation, 1996 -.\" -.\" Permission to use, copy, modify, distribute, and sell this -.\" documentation for any purpose is hereby granted without fee, -.\" provided that the above copyright notice and this permission -.\" notice appear in all copies. Digital Equipment Corporation -.\" makes no representations about the suitability for any purpose -.\" of the information in this document. This documentation is -.\" provided ``as is'' without express or implied warranty. -.\" -.\" Copyright (c) 1999, 2005, 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. -.\" -.\" X Window System is a trademark of The Open Group. -.\" -.TH DPMSGetTimeouts __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -DPMSGetTimeouts \- retrieves the timeout values used by the X server for DPMS -timings -.SH SYNOPSIS -.PP -.nf -\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] -\&#include -.HP -.B Bool DPMSGetTimeouts -( -.br - Display *\fIdisplay\fP\^, -.br - CARD16 *\fIstandby\fP\^, -.br - CARD16 *\fIsuspend\fP\^, -.br - CARD16 *\fIoff\fP\^ -); -.if n .ti +5n -.if t .ti +.5i -.SH ARGUMENTS -.TP -.I display -Specifies the connection to the X server -.TP -.I standby -Specifies the current standby timeout in seconds -.TP -.I suspend -Specifies the current suspend timeout in seconds -.TP -.I off -Specifies the current off timeout in seconds -.SH DESCRIPTION -.LP -The -.I DPMSGetTimeouts -function retrieves the timeout values used by the X server for DPMS timings. -.LP -The value -.I standby -is the amount of time of inactivity in seconds before standby mode is invoked. A -value of zero indicates that this mode has been disabled. -.LP -The value \fIsuspend\fP is the amount of time of inactivity in seconds before -the second level of power savings is invoked. A value of zero indicates that -this mode has been disabled. -.LP -The value \fIoff\fP is the amount of time of inactivity in seconds before the -third and final level of power savings is invoked. A value of zero indicates -that this mode has been disabled. -.SH "RETURN VALUES" -.TP 15 -TRUE -The -.I DPMSGetTimeouts -function returns TRUE when values are returned. -.TP 15 -FALSE -The -.I DPMSGetTimeouts -function returns FALSE when no values returned. -.SH "SEE ALSO" -.BR DPMSCapable (__libmansuffix__), -.BR DPMSInfo (__libmansuffix__), -.BR DPMSSetTimeouts (__libmansuffix__) +.\" Copyright \(co Digital Equipment Corporation, 1996 +.\" +.\" Permission to use, copy, modify, distribute, and sell this +.\" documentation for any purpose is hereby granted without fee, +.\" provided that the above copyright notice and this permission +.\" notice appear in all copies. Digital Equipment Corporation +.\" makes no representations about the suitability for any purpose +.\" of the information in this document. This documentation is +.\" provided ``as is'' without express or implied warranty. +.\" +.\" Copyright (c) 1999, 2005, 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. +.\" +.\" X Window System is a trademark of The Open Group. +.\" +.TH DPMSGetTimeouts __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +DPMSGetTimeouts \- retrieves the timeout values used by the X server for DPMS +timings +.SH SYNOPSIS +.PP +.nf +\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] +\&#include +.HP +.B Bool DPMSGetTimeouts +( +.br + Display *\fIdisplay\fP\^, +.br + CARD16 *\fIstandby\fP\^, +.br + CARD16 *\fIsuspend\fP\^, +.br + CARD16 *\fIoff\fP\^ +); +.if n .ti +5n +.if t .ti +.5i +.SH ARGUMENTS +.TP +.I display +Specifies the connection to the X server +.TP +.I standby +Specifies the current standby timeout in seconds +.TP +.I suspend +Specifies the current suspend timeout in seconds +.TP +.I off +Specifies the current off timeout in seconds +.SH DESCRIPTION +.LP +The +.I DPMSGetTimeouts +function retrieves the timeout values used by the X server for DPMS timings. +.LP +The value +.I standby +is the amount of time of inactivity in seconds before standby mode is invoked. A +value of zero indicates that this mode has been disabled. +.LP +The value \fIsuspend\fP is the amount of time of inactivity in seconds before +the second level of power savings is invoked. A value of zero indicates that +this mode has been disabled. +.LP +The value \fIoff\fP is the amount of time of inactivity in seconds before the +third and final level of power savings is invoked. A value of zero indicates +that this mode has been disabled. +.SH "RETURN VALUES" +.TP 15 +TRUE +The +.I DPMSGetTimeouts +function returns TRUE when values are returned. +.TP 15 +FALSE +The +.I DPMSGetTimeouts +function returns FALSE when no values returned. +.SH "SEE ALSO" +.BR DPMSCapable (__libmansuffix__), +.BR DPMSInfo (__libmansuffix__), +.BR DPMSSetTimeouts (__libmansuffix__) diff --git a/libXext/man/DPMSGetVersion.man b/libXext/man/DPMSGetVersion.man index c9db0e079..a3fcd387c 100644 --- a/libXext/man/DPMSGetVersion.man +++ b/libXext/man/DPMSGetVersion.man @@ -1,87 +1,87 @@ -.\" Copyright \(co Digital Equipment Corporation, 1996 -.\" -.\" Permission to use, copy, modify, distribute, and sell this -.\" documentation for any purpose is hereby granted without fee, -.\" provided that the above copyright notice and this permission -.\" notice appear in all copies. Digital Equipment Corporation -.\" makes no representations about the suitability for any purpose -.\" of the information in this document. This documentation is -.\" provided ``as is'' without express or implied warranty. -.\" -.\" Copyright (c) 1999, 2005, 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. -.\" -.\" X Window System is a trademark of The Open Group. -.\" -.TH DPMSGetVersion __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -DPMSGetVersion \- returns the version of the DPMS extension implemented by -the X server -.SH SYNOPSIS -.PP -.nf -\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] -\&#include -.HP -.B Status DPMSGetVersion -( -.br - Display *\fIdisplay\fP\^, -.br - int *\fImajor_version\fP\^, -.br - int *\fIminor_version\fP\^ -); -.if n .ti +5n -.if t .ti +.5i -.SH ARGUMENTS -.TP -.I display -Specifies the connection to the X server -.TP -.I major_version -Specifies the return location for the extension major version -.TP -.I minor_version -Specifies the return location for the extension minor version -.SH DESCRIPTION -.LP -The -.I DPMSGetVersion -function returns the version of the Display Power Management Signaling (DPMS) -extension implemented by the X server. It returns a major and minor version -number. The major version number will be incremented for protocol incompatible -changes, and the minor version number will be incremented for small, upward -compatible changes. -.SH "RETURN VALUES" -.TP 15 -TRUE -The -.I DPMSGetVersion -function returns TRUE when the extension is supported and values are returned. -.TP 15 -FALSE -The -.I DPMSGetVersion -function returns FALSE when the extension is not supported. -.SH "SEE ALSO" -.BR DPMSCapable (__libmansuffix__), -.BR DPMSQueryExtension (__libmansuffix__) +.\" Copyright \(co Digital Equipment Corporation, 1996 +.\" +.\" Permission to use, copy, modify, distribute, and sell this +.\" documentation for any purpose is hereby granted without fee, +.\" provided that the above copyright notice and this permission +.\" notice appear in all copies. Digital Equipment Corporation +.\" makes no representations about the suitability for any purpose +.\" of the information in this document. This documentation is +.\" provided ``as is'' without express or implied warranty. +.\" +.\" Copyright (c) 1999, 2005, 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. +.\" +.\" X Window System is a trademark of The Open Group. +.\" +.TH DPMSGetVersion __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +DPMSGetVersion \- returns the version of the DPMS extension implemented by +the X server +.SH SYNOPSIS +.PP +.nf +\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] +\&#include +.HP +.B Status DPMSGetVersion +( +.br + Display *\fIdisplay\fP\^, +.br + int *\fImajor_version\fP\^, +.br + int *\fIminor_version\fP\^ +); +.if n .ti +5n +.if t .ti +.5i +.SH ARGUMENTS +.TP +.I display +Specifies the connection to the X server +.TP +.I major_version +Specifies the return location for the extension major version +.TP +.I minor_version +Specifies the return location for the extension minor version +.SH DESCRIPTION +.LP +The +.I DPMSGetVersion +function returns the version of the Display Power Management Signaling (DPMS) +extension implemented by the X server. It returns a major and minor version +number. The major version number will be incremented for protocol incompatible +changes, and the minor version number will be incremented for small, upward +compatible changes. +.SH "RETURN VALUES" +.TP 15 +TRUE +The +.I DPMSGetVersion +function returns TRUE when the extension is supported and values are returned. +.TP 15 +FALSE +The +.I DPMSGetVersion +function returns FALSE when the extension is not supported. +.SH "SEE ALSO" +.BR DPMSCapable (__libmansuffix__), +.BR DPMSQueryExtension (__libmansuffix__) diff --git a/libXext/man/DPMSInfo.man b/libXext/man/DPMSInfo.man index b1272eaca..31ab29cfb 100644 --- a/libXext/man/DPMSInfo.man +++ b/libXext/man/DPMSInfo.man @@ -1,86 +1,86 @@ -.\" Copyright \(co Digital Equipment Corporation, 1996 -.\" -.\" Permission to use, copy, modify, distribute, and sell this -.\" documentation for any purpose is hereby granted without fee, -.\" provided that the above copyright notice and this permission -.\" notice appear in all copies. Digital Equipment Corporation -.\" makes no representations about the suitability for any purpose -.\" of the information in this document. This documentation is -.\" provided ``as is'' without express or implied warranty. -.\" -.\" Copyright (c) 1999, 2005, 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. -.\" -.\" X Window System is a trademark of The Open Group. -.\" -.TH DPMSInfo __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -DPMSInfo \- returns information about the current DPMS state -.SH SYNOPSIS -.PP -.nf -\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] -\&#include -.HP -.B Status DPMSInfo -( -.br - Display \fI*display\fP\^, -.br - CARD16 \fI*power_level\fP\^, -.br - BOOL \fI*state\fP\^ -); -.if n .ti +5n -.if t .ti +.5i -.SH ARGUMENTS -.TP -.I display -Specifies the connection to the X server -.TP -.I power_level -Specifies the current power level -.TP -.I state -Specifies the current DPMS state -.SH DESCRIPTION -.LP -The -.I DPMSInfo -function returns information about the current Display Power Management -Signaling (DPMS) state. The \fIstate\fP -return parameter indicates whether or not DPMS is enabled \^(TRUE\^) or -disabled \^(FALSE\^). The \fIpower_level\fP return parameter indicates the -current power level \^(one of DPMSModeOn, DPMSModeStandby, DPMSModeSuspend, or -DPMSModeOff.\^) -.SH "RETURN VALUES" -.TP 15 -TRUE -The -.I DPMSInfo -function returns TRUE, if values are returned. -.TP 15 -FALSE -The -.I DPMSInfo -function returns FALSE, if no values are returned. -.SH "SEE ALSO" -.BR DPMSEnable (__libmansuffix__) +.\" Copyright \(co Digital Equipment Corporation, 1996 +.\" +.\" Permission to use, copy, modify, distribute, and sell this +.\" documentation for any purpose is hereby granted without fee, +.\" provided that the above copyright notice and this permission +.\" notice appear in all copies. Digital Equipment Corporation +.\" makes no representations about the suitability for any purpose +.\" of the information in this document. This documentation is +.\" provided ``as is'' without express or implied warranty. +.\" +.\" Copyright (c) 1999, 2005, 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. +.\" +.\" X Window System is a trademark of The Open Group. +.\" +.TH DPMSInfo __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +DPMSInfo \- returns information about the current DPMS state +.SH SYNOPSIS +.PP +.nf +\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] +\&#include +.HP +.B Status DPMSInfo +( +.br + Display \fI*display\fP\^, +.br + CARD16 \fI*power_level\fP\^, +.br + BOOL \fI*state\fP\^ +); +.if n .ti +5n +.if t .ti +.5i +.SH ARGUMENTS +.TP +.I display +Specifies the connection to the X server +.TP +.I power_level +Specifies the current power level +.TP +.I state +Specifies the current DPMS state +.SH DESCRIPTION +.LP +The +.I DPMSInfo +function returns information about the current Display Power Management +Signaling (DPMS) state. The \fIstate\fP +return parameter indicates whether or not DPMS is enabled \^(TRUE\^) or +disabled \^(FALSE\^). The \fIpower_level\fP return parameter indicates the +current power level \^(one of DPMSModeOn, DPMSModeStandby, DPMSModeSuspend, or +DPMSModeOff.\^) +.SH "RETURN VALUES" +.TP 15 +TRUE +The +.I DPMSInfo +function returns TRUE, if values are returned. +.TP 15 +FALSE +The +.I DPMSInfo +function returns FALSE, if no values are returned. +.SH "SEE ALSO" +.BR DPMSEnable (__libmansuffix__) diff --git a/libXext/man/DPMSQueryExtension.man b/libXext/man/DPMSQueryExtension.man index ca8457757..ab05a7517 100644 --- a/libXext/man/DPMSQueryExtension.man +++ b/libXext/man/DPMSQueryExtension.man @@ -1,104 +1,104 @@ -.\" Copyright \(co Digital Equipment Corporation, 1996 -.\" -.\" Permission to use, copy, modify, distribute, and sell this -.\" documentation for any purpose is hereby granted without fee, -.\" provided that the above copyright notice and this permission -.\" notice appear in all copies. Digital Equipment Corporation -.\" makes no representations about the suitability for any purpose -.\" of the information in this document. This documentation is -.\" provided ``as is'' without express or implied warranty. -.\" -.\" Copyright (c) 1999, 2005, 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. -.\" -.\" X Window System is a trademark of The Open Group. -.\" -.TH DPMSQueryExtension __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -DPMSQueryExtension \- queries the X server to determine the availability -of the DPMS Extension -.SH SYNOPSIS -.PP -.nf -\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] -\&#include -.HP -.B Bool DPMSQueryExtension -( -.br - Display \fI*display\fP\^, -.br - int \fI*event_base\fP\^, -.br - int \fI*error_base\fP\^ -); -.if n .ti +5n -.if t .ti +.5i -.SH ARGUMENTS -.TP -.I display -Specifies the connection to the X server -.TP -.I event_base -Specifies the return location for the assigned base event -.TP -.I error_base -Specifies the return location for the assigned base error -.SH DESCRIPTION -.LP -The -.I DPMSQueryExtension -function queries the X server to determine the availability of the -Display Power Management Signaling (DPMS) -Extension. If the extension is available, it returns TRUE, and the -.I event_base -and -.I error_base -are set to the base event and error numbers, respectively. Otherwise, the -return value is FALSE, and the -values of -.I event_base -and -.I error_base -are undefined. -.SH "RETURN VALUES" -.TP 15 -TRUE -The -.I DPMSQueryExtension -function returns TRUE if the extension is available, -and -.I event_base -and -.I error_base -are set to the base event number and base error number for the extension, -respectively. -.TP 15 -FALSE -The -.I DPMSQueryExtension -function returns FALSE if extension is not available, and the values of -.I event_base -and -.I error_base -are undefined. -.SH "SEE ALSO" -.BR DPMSGetVersion (__libmansuffix__) +.\" Copyright \(co Digital Equipment Corporation, 1996 +.\" +.\" Permission to use, copy, modify, distribute, and sell this +.\" documentation for any purpose is hereby granted without fee, +.\" provided that the above copyright notice and this permission +.\" notice appear in all copies. Digital Equipment Corporation +.\" makes no representations about the suitability for any purpose +.\" of the information in this document. This documentation is +.\" provided ``as is'' without express or implied warranty. +.\" +.\" Copyright (c) 1999, 2005, 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. +.\" +.\" X Window System is a trademark of The Open Group. +.\" +.TH DPMSQueryExtension __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +DPMSQueryExtension \- queries the X server to determine the availability +of the DPMS Extension +.SH SYNOPSIS +.PP +.nf +\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] +\&#include +.HP +.B Bool DPMSQueryExtension +( +.br + Display \fI*display\fP\^, +.br + int \fI*event_base\fP\^, +.br + int \fI*error_base\fP\^ +); +.if n .ti +5n +.if t .ti +.5i +.SH ARGUMENTS +.TP +.I display +Specifies the connection to the X server +.TP +.I event_base +Specifies the return location for the assigned base event +.TP +.I error_base +Specifies the return location for the assigned base error +.SH DESCRIPTION +.LP +The +.I DPMSQueryExtension +function queries the X server to determine the availability of the +Display Power Management Signaling (DPMS) +Extension. If the extension is available, it returns TRUE, and the +.I event_base +and +.I error_base +are set to the base event and error numbers, respectively. Otherwise, the +return value is FALSE, and the +values of +.I event_base +and +.I error_base +are undefined. +.SH "RETURN VALUES" +.TP 15 +TRUE +The +.I DPMSQueryExtension +function returns TRUE if the extension is available, +and +.I event_base +and +.I error_base +are set to the base event number and base error number for the extension, +respectively. +.TP 15 +FALSE +The +.I DPMSQueryExtension +function returns FALSE if extension is not available, and the values of +.I event_base +and +.I error_base +are undefined. +.SH "SEE ALSO" +.BR DPMSGetVersion (__libmansuffix__) diff --git a/libXext/man/DPMSSetTimeouts.man b/libXext/man/DPMSSetTimeouts.man index 740b24761..bf8f17fb9 100644 --- a/libXext/man/DPMSSetTimeouts.man +++ b/libXext/man/DPMSSetTimeouts.man @@ -1,128 +1,128 @@ -.\" Copyright \(co Digital Equipment Corporation, 1996 -.\" -.\" Permission to use, copy, modify, distribute, and sell this -.\" documentation for any purpose is hereby granted without fee, -.\" provided that the above copyright notice and this permission -.\" notice appear in all copies. Digital Equipment Corporation -.\" makes no representations about the suitability for any purpose -.\" of the information in this document. This documentation is -.\" provided ``as is'' without express or implied warranty. -.\" -.\" Copyright (c) 1999, 2005, 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. -.\" -.\" X Window System is a trademark of The Open Group. -.\" -.TH DPMSSetTimeouts __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -DPMSSetTimeouts \- permits applications to set the timeout values -used by the X server for DPMS timings -.SH SYNOPSIS -.PP -.nf -\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] -\&#include -.HP -.B Status DPMSSetTimeouts -( -.br - Display *\fIdisplay\fP\^, -.br - CARD16 \fIstandby\fP\^, -.br - CARD16 \fIsuspend\fP\^, -.br - CARD16 \fIoff\fP\^ -); -.if n .ti +5n -.if t .ti +.5i -.SH ARGUMENTS -.TP -.I display -Specifies the connection to the X server -.TP -.I standby -Specifies the new standby timeout in seconds -.TP -.I suspend -Specifies the new suspend timeout in seconds -.TP -.I off -Specifies the new off timeout in seconds -.SH DESCRIPTION -.LP -The DPMSSetTimeouts function permits applications to set the timeout values -used by the X server for Display Power Management Signaling (DPMS) timings. -.LP -The value \fIstandby\fP is the amount of inactivity time, in seconds, before -standby mode is invoked. The actual -effects of this mode are dependent on the characteristics of the monitor and -frame buffer card. Standby mode is -implemented by shutting off the horizontal sync signal, and pulsing the vertical -sync signal. Standby mode -provides the quickest monitor recovery time. Note also that many monitors -implement this mode identical to -suspend mode. A value of zero disables the standby mode. -.LP -The value \fIsuspend\fP is the amount of time of inactivity, in seconds, before -the second level of power -savings is invoked. Suspend mode's physical and electrical characteristics are -implementation defined. For DPMS -compliant hardware, setting the suspend mode is implemented by pulsing the -horizontal sync signal and -shutting off the vertical sync signal. In general, suspend mode recovery is -considered to be slower than -standby mode, but faster than off mode. However it may vary from monitor to -monitor. As noted above, many -monitors implement this mode identical to the standby mode. A value of zero -disables this mode. -.LP -The value \fIoff\fP is the amount of time of inactivity,in seconds, before the -third and final level of power -savings is invoked. Off mode's physical and electrical characteristics are -implementation defined. In DPMS -compliant hardware, it is implemented by shutting off both horizontal and -vertical sync signals, resulting in -powering down of the monitor. Recovery time is implementation dependent. -Usually the recovery time is very -close to the power-up time of the monitor. A value of zero disables this mode. -.LP -Chronologically, \fIstandby\fP mode occurs before or simultaneously with -\fIsuspend\fP mode, and -\fIsuspend\fP mode must occur before or simultaneously with \fIoff\fP mode. -Therefore, non-zero mode timeout -values must be greater than or equal to the timeout values of earlier modes. If -inconsistent values are -supplied, a BadValue error will result. -.SH "RETURN VALUES" -.TP 15 -TRUE -The -.I DPMSSetTimeouts -function returns TRUE when the function has succeeded. -.SH ERRORS -.TP 15 -.SM BadValue -An argument is out of range. -.SH "SEE ALSO" -.BR DPMSCapable (__libmansuffix__), -.BR DPMSInfo (__libmansuffix__), -.BR DPMSGetTimeouts (__libmansuffix__) +.\" Copyright \(co Digital Equipment Corporation, 1996 +.\" +.\" Permission to use, copy, modify, distribute, and sell this +.\" documentation for any purpose is hereby granted without fee, +.\" provided that the above copyright notice and this permission +.\" notice appear in all copies. Digital Equipment Corporation +.\" makes no representations about the suitability for any purpose +.\" of the information in this document. This documentation is +.\" provided ``as is'' without express or implied warranty. +.\" +.\" Copyright (c) 1999, 2005, 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. +.\" +.\" X Window System is a trademark of The Open Group. +.\" +.TH DPMSSetTimeouts __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +DPMSSetTimeouts \- permits applications to set the timeout values +used by the X server for DPMS timings +.SH SYNOPSIS +.PP +.nf +\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] +\&#include +.HP +.B Status DPMSSetTimeouts +( +.br + Display *\fIdisplay\fP\^, +.br + CARD16 \fIstandby\fP\^, +.br + CARD16 \fIsuspend\fP\^, +.br + CARD16 \fIoff\fP\^ +); +.if n .ti +5n +.if t .ti +.5i +.SH ARGUMENTS +.TP +.I display +Specifies the connection to the X server +.TP +.I standby +Specifies the new standby timeout in seconds +.TP +.I suspend +Specifies the new suspend timeout in seconds +.TP +.I off +Specifies the new off timeout in seconds +.SH DESCRIPTION +.LP +The DPMSSetTimeouts function permits applications to set the timeout values +used by the X server for Display Power Management Signaling (DPMS) timings. +.LP +The value \fIstandby\fP is the amount of inactivity time, in seconds, before +standby mode is invoked. The actual +effects of this mode are dependent on the characteristics of the monitor and +frame buffer card. Standby mode is +implemented by shutting off the horizontal sync signal, and pulsing the vertical +sync signal. Standby mode +provides the quickest monitor recovery time. Note also that many monitors +implement this mode identical to +suspend mode. A value of zero disables the standby mode. +.LP +The value \fIsuspend\fP is the amount of time of inactivity, in seconds, before +the second level of power +savings is invoked. Suspend mode's physical and electrical characteristics are +implementation defined. For DPMS +compliant hardware, setting the suspend mode is implemented by pulsing the +horizontal sync signal and +shutting off the vertical sync signal. In general, suspend mode recovery is +considered to be slower than +standby mode, but faster than off mode. However it may vary from monitor to +monitor. As noted above, many +monitors implement this mode identical to the standby mode. A value of zero +disables this mode. +.LP +The value \fIoff\fP is the amount of time of inactivity,in seconds, before the +third and final level of power +savings is invoked. Off mode's physical and electrical characteristics are +implementation defined. In DPMS +compliant hardware, it is implemented by shutting off both horizontal and +vertical sync signals, resulting in +powering down of the monitor. Recovery time is implementation dependent. +Usually the recovery time is very +close to the power-up time of the monitor. A value of zero disables this mode. +.LP +Chronologically, \fIstandby\fP mode occurs before or simultaneously with +\fIsuspend\fP mode, and +\fIsuspend\fP mode must occur before or simultaneously with \fIoff\fP mode. +Therefore, non-zero mode timeout +values must be greater than or equal to the timeout values of earlier modes. If +inconsistent values are +supplied, a BadValue error will result. +.SH "RETURN VALUES" +.TP 15 +TRUE +The +.I DPMSSetTimeouts +function returns TRUE when the function has succeeded. +.SH ERRORS +.TP 15 +.SM BadValue +An argument is out of range. +.SH "SEE ALSO" +.BR DPMSCapable (__libmansuffix__), +.BR DPMSInfo (__libmansuffix__), +.BR DPMSGetTimeouts (__libmansuffix__) diff --git a/libXext/man/XShape.man b/libXext/man/XShape.man index e40369143..44fedfe78 100644 --- a/libXext/man/XShape.man +++ b/libXext/man/XShape.man @@ -1,174 +1,174 @@ -.\" Copyright (c) 1989, 1994 X Consortium -.\" -.\" 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 furnished to do so, subject to the following conditions: -.\" -.\" The above copyright notice and this permission notice shall be included in -.\" all copies or substantial portions of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -.\" THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -.\" SOFTWARE. -.\" -.\" Except as contained in this notice, the name of the X Consortium shall not -.\" be used in advertising or otherwise to promote the sale, use or other -.\" dealing in this Software without prior written authorization from the -.\" X Consortium. -.\" -.de ZN -.ie t \fB\^\\$1\^\fR\\$2 -.el \fI\^\\$1\^\fP\\$2 -.. -.TH XSHAPE __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -XShapeQueryExtension, XShapeQueryVersion, XShapeCombineRegion, XShapeCombineRectangles, XShapeCombineMask, XShapeCombineShape, XShapeOffsetShape, XShapeQueryExtents, XShapeSelectInput, XShapeInputSelected, XShapeGetRectangles \- X nonrectangular shape functions -.SH SYNTAX -.nf -.LP -\&#include -.LP -Bool XShapeQueryExtension ( - Display *dpy, - int *event_basep, - int *error_basep); -.LP -Status XShapeQueryVersion ( - Display *dpy, - int *major_versionp, - int *minor_versionp); -.LP -void XShapeCombineRegion ( - Display *dpy, - Window dest, - int destKind, - int xOff, - int yOff, - struct _XRegion *r, - int op); -.LP -void XShapeCombineRectangles ( - Display *dpy, - XID dest, - int destKind, - int xOff, - int yOff, - XRectangle *rects, - int n_rects, - int op, - int ordering); -.LP -void XShapeCombineMask ( - Display *dpy, - XID dest, - int destKind, - int xOff, - int yOff, - Pixmap src, - int op); -.LP -void XShapeCombineShape ( - Display *dpy, - XID dest, - int destKind, - int xOff, - int yOff, - Pixmap src, - int srcKind, - int op); -.LP -void XShapeOffsetShape ( - Display *dpy, - XID dest, - int destKind, - int xOff, - int yOff); -.LP -Status XShapeQueryExtents ( - Display *dpy, - Window window, - int *bShaped, - int *xbs, - int *ybs, - unsigned int *wbs, - unsigned int *hbs, - int *cShaped, - int *xcs, - int *ycs, - unsigned int *wcs, - unsigned int *hcs); -.LP -void XShapeSelectInput ( - Display *dpy, - Window window, - unsigned longmask); -.LP -unsigned long XShapeInputSelected ( - Display *dpy, - Window window); -.LP -XRectangle *XShapeGetRectangles ( - Display *dpy, - Window window, - int kind, - int *count, - int *ordering); -.fi -.SH STRUCTURES -.nf -.LP -.ta 3i -typedef struct { - int type; /\&* of event */ - unsigned long serial; /\&* # of last request processed by server */ - Bool send_event; /\&* true if this came from a SendEvent request */ - Display *display; /\&* Display the event was read from */ - Window window; /\&* window of event */ - int kind; /\&* ShapeBounding or ShapeClip */ - int x, y; /\&* extents of new region */ - unsigned width, height; - Time time; /\&* server timestamp when region changed */ - Bool shaped; /\&* true if the region exists */ -} XShapeEvent; -.fi -.SH DESCRIPTION -The \fIX11 Nonrectangular Window Shape Extension\fP adds nonrectangular -windows to the X Window System. -.SH PREDEFINED VALUES -Operations: -.in +.5i -.nf -.ZN ShapeSet -.ZN ShapeUnion -.ZN ShapeIntersect -.ZN ShapeSubtract -.ZN ShapeInvert -.in -.5i -.fi -.sp -Shape Kinds: -.in +.5i -.nf -.ZN ShapeBounding -.ZN ShapeClip -.in -.5i -.fi -.sp -Event defines: -.in +.5i -.nf -.ZN ShapeNotifyMask -.ZN ShapeNotify -.in -.5i -.fi -.SH BUGS -This manual pages needs a lot more work. -.SH SEE ALSO -\fIX11 Nonrectangular Window Shape Extension\fP +.\" Copyright (c) 1989, 1994 X Consortium +.\" +.\" 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 furnished to do so, subject to the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be included in +.\" all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +.\" THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" SOFTWARE. +.\" +.\" Except as contained in this notice, the name of the X Consortium shall not +.\" be used in advertising or otherwise to promote the sale, use or other +.\" dealing in this Software without prior written authorization from the +.\" X Consortium. +.\" +.de ZN +.ie t \fB\^\\$1\^\fR\\$2 +.el \fI\^\\$1\^\fP\\$2 +.. +.TH XSHAPE __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +XShapeQueryExtension, XShapeQueryVersion, XShapeCombineRegion, XShapeCombineRectangles, XShapeCombineMask, XShapeCombineShape, XShapeOffsetShape, XShapeQueryExtents, XShapeSelectInput, XShapeInputSelected, XShapeGetRectangles \- X nonrectangular shape functions +.SH SYNTAX +.nf +.LP +\&#include +.LP +Bool XShapeQueryExtension ( + Display *dpy, + int *event_basep, + int *error_basep); +.LP +Status XShapeQueryVersion ( + Display *dpy, + int *major_versionp, + int *minor_versionp); +.LP +void XShapeCombineRegion ( + Display *dpy, + Window dest, + int destKind, + int xOff, + int yOff, + struct _XRegion *r, + int op); +.LP +void XShapeCombineRectangles ( + Display *dpy, + XID dest, + int destKind, + int xOff, + int yOff, + XRectangle *rects, + int n_rects, + int op, + int ordering); +.LP +void XShapeCombineMask ( + Display *dpy, + XID dest, + int destKind, + int xOff, + int yOff, + Pixmap src, + int op); +.LP +void XShapeCombineShape ( + Display *dpy, + XID dest, + int destKind, + int xOff, + int yOff, + Pixmap src, + int srcKind, + int op); +.LP +void XShapeOffsetShape ( + Display *dpy, + XID dest, + int destKind, + int xOff, + int yOff); +.LP +Status XShapeQueryExtents ( + Display *dpy, + Window window, + int *bShaped, + int *xbs, + int *ybs, + unsigned int *wbs, + unsigned int *hbs, + int *cShaped, + int *xcs, + int *ycs, + unsigned int *wcs, + unsigned int *hcs); +.LP +void XShapeSelectInput ( + Display *dpy, + Window window, + unsigned longmask); +.LP +unsigned long XShapeInputSelected ( + Display *dpy, + Window window); +.LP +XRectangle *XShapeGetRectangles ( + Display *dpy, + Window window, + int kind, + int *count, + int *ordering); +.fi +.SH STRUCTURES +.nf +.LP +.ta 3i +typedef struct { + int type; /\&* of event */ + unsigned long serial; /\&* # of last request processed by server */ + Bool send_event; /\&* true if this came from a SendEvent request */ + Display *display; /\&* Display the event was read from */ + Window window; /\&* window of event */ + int kind; /\&* ShapeBounding or ShapeClip */ + int x, y; /\&* extents of new region */ + unsigned width, height; + Time time; /\&* server timestamp when region changed */ + Bool shaped; /\&* true if the region exists */ +} XShapeEvent; +.fi +.SH DESCRIPTION +The \fIX11 Nonrectangular Window Shape Extension\fP adds nonrectangular +windows to the X Window System. +.SH PREDEFINED VALUES +Operations: +.in +.5i +.nf +.ZN ShapeSet +.ZN ShapeUnion +.ZN ShapeIntersect +.ZN ShapeSubtract +.ZN ShapeInvert +.in -.5i +.fi +.sp +Shape Kinds: +.in +.5i +.nf +.ZN ShapeBounding +.ZN ShapeClip +.in -.5i +.fi +.sp +Event defines: +.in +.5i +.nf +.ZN ShapeNotifyMask +.ZN ShapeNotify +.in -.5i +.fi +.SH BUGS +This manual pages needs a lot more work. +.SH SEE ALSO +\fIX11 Nonrectangular Window Shape Extension\fP diff --git a/libXext/man/XShm.man b/libXext/man/XShm.man index 06284f022..7fe312514 100644 --- a/libXext/man/XShm.man +++ b/libXext/man/XShm.man @@ -1,26 +1,26 @@ .\" Copyright (c) 1991 X Consortium -.\" +.\" .\" 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 +.\" 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 furnished to do so, subject to the following conditions: -.\" +.\" .\" The above copyright notice and this permission notice shall be included in .\" all copies or substantial portions of the Software. -.\" +.\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR .\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -.\" THE X CONSORTIUM 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 +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +.\" THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE .\" SOFTWARE. -.\" -.\" Except as contained in this notice, the name of the X Consortium shall not -.\" be used in advertising or otherwise to promote the sale, use or other -.\" dealing in this Software without prior written authorization from the +.\" +.\" Except as contained in this notice, the name of the X Consortium shall not +.\" be used in advertising or otherwise to promote the sale, use or other +.\" dealing in this Software without prior written authorization from the .\" X Consortium. .\" .\" Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. diff --git a/libXext/man/XcupGetReservedColormapEntries.man b/libXext/man/XcupGetReservedColormapEntries.man index 7ba10d23c..6fb8b9f1f 100644 --- a/libXext/man/XcupGetReservedColormapEntries.man +++ b/libXext/man/XcupGetReservedColormapEntries.man @@ -1,73 +1,73 @@ -.\" Copyright \(co 1986-1997 The Open Group All Rights Reserved -.\" Copyright (c) 1999, 2005, 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. -.\" -.\" X Window System is a trademark of The Open Group. -.\" -.de ZN -.ie t \fB\^\\$1\^\fR\\$2 -.el \fI\^\\$1\^\fP\\$2 -.. -.TH XCUP __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -XcupGetReservedColormapEntries \- list colormap entries reserved by the system -.SH SYNOPSIS -.PP -.nf -\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] -\&#include -.HP -Status \fBXcupGetReservedColormapEntries\fP\^(\^Display *\fIdisplay\fP\^, -int \fIscreen\fP\^, XColor **\fIcolors_out\fP\^, int *\fIncolors\fP\^); -.if n .ti +5n -.if t .ti +.5i -.SH ARGUMENTS -.IP \fIdisplay\fP 1i -Specifies the connection to the X server. -.IP \fIscreen\fP 1i -Screen number on the host server. -.IP \fIcolors_out\fP 1i -Returns the values reserved by the server. -.IP \fIncolors\fP 1i -Returns the number of items in \fIcolors_out\fP. -.SH DESCRIPTION -.LP -The -.ZN XcupGetReservedColormapEntries -function returns a list of colormap entries (pixels) that are reserved -by the system. This list will, at a minimum, contain entries for the -BlackPixel and WhitePixel of the specified screen. Use -.ZN XFree -to free -.I colors_out. -.LP -To minimize colormap flash, an application which installs its own private -colormap should query the special colors by calling -.ZN XCupGetReservedColormapEntries , -and can then store those entries (in the -proper location) in its private colormap using -.ZN XCupStoreColors . -.SH "SEE ALSO" -.BR XcupQueryVersion (3Xext), -.BR XcupStoreColors (3Xext), -.BR XFree (3X11), -.br -\fIColormap Utilization Policy and Extension\fP +.\" Copyright \(co 1986-1997 The Open Group All Rights Reserved +.\" Copyright (c) 1999, 2005, 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. +.\" +.\" X Window System is a trademark of The Open Group. +.\" +.de ZN +.ie t \fB\^\\$1\^\fR\\$2 +.el \fI\^\\$1\^\fP\\$2 +.. +.TH XCUP __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +XcupGetReservedColormapEntries \- list colormap entries reserved by the system +.SH SYNOPSIS +.PP +.nf +\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] +\&#include +.HP +Status \fBXcupGetReservedColormapEntries\fP\^(\^Display *\fIdisplay\fP\^, +int \fIscreen\fP\^, XColor **\fIcolors_out\fP\^, int *\fIncolors\fP\^); +.if n .ti +5n +.if t .ti +.5i +.SH ARGUMENTS +.IP \fIdisplay\fP 1i +Specifies the connection to the X server. +.IP \fIscreen\fP 1i +Screen number on the host server. +.IP \fIcolors_out\fP 1i +Returns the values reserved by the server. +.IP \fIncolors\fP 1i +Returns the number of items in \fIcolors_out\fP. +.SH DESCRIPTION +.LP +The +.ZN XcupGetReservedColormapEntries +function returns a list of colormap entries (pixels) that are reserved +by the system. This list will, at a minimum, contain entries for the +BlackPixel and WhitePixel of the specified screen. Use +.ZN XFree +to free +.I colors_out. +.LP +To minimize colormap flash, an application which installs its own private +colormap should query the special colors by calling +.ZN XCupGetReservedColormapEntries , +and can then store those entries (in the +proper location) in its private colormap using +.ZN XCupStoreColors . +.SH "SEE ALSO" +.BR XcupQueryVersion (3Xext), +.BR XcupStoreColors (3Xext), +.BR XFree (3X11), +.br +\fIColormap Utilization Policy and Extension\fP diff --git a/libXext/man/XcupQueryVersion.man b/libXext/man/XcupQueryVersion.man index bbbbc945c..7bfa4aa0b 100644 --- a/libXext/man/XcupQueryVersion.man +++ b/libXext/man/XcupQueryVersion.man @@ -1,74 +1,74 @@ -.\" Copyright \(co 1986-1997 The Open Group All Rights Reserved -.\" Copyright (c) 1999, 2005, 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. -.\" -.\" X Window System is a trademark of The Open Group. -.\" -.de ZN -.ie t \fB\^\\$1\^\fR\\$2 -.el \fI\^\\$1\^\fP\\$2 -.. -.TH XcupQueryVersion __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -XcupQueryVersion \- Returns TOG-CUP protocol version supported by the X server -.SH SYNOPSIS -.PP -.nf -\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] -\&#include -.HP -Status \fBXcupQueryVersion\fP\^(\^Display *\fIdisplay\fP\^, -int *\fImajor_version_return\fP\^, int *\fIminor_version_return\fP\^); -.if n .ti +5n -.if t .ti +.5i -.SH ARGUMENTS -.IP \fIdisplay\fP 1i -Specifies the connection to the X server -.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 -.SH DESCRIPTION -.LP -.ZN XcupQueryVersion -sets -.I major_version_return -and -.I minor_version_return -to the major and minor TOG-CUP protocol version supported by the -server. If the TOG-CUP library is compatible with the version returned -by the server, it returns nonzero. If the server does not support the TOG-CUP -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. No other Xcup functions may be called -before this function. If a client violates this rule, the effects of -all subsequent Xcup calls that it makes are undefined. -.LP -To get the list of reserved colormap entries, use -.ZN XcupGetReservedColormapEntries. -.LP -To allocate one or more read-only color cells with RGB values, use -.ZN XcupStoreColors. -.SH "SEE ALSO" -.BR XcupGetReservedColormapEntries (3Xext), -.BR XcupStoreColors (3Xext), -.br -\fIColormap Utilization Policy and Extension\fP +.\" Copyright \(co 1986-1997 The Open Group All Rights Reserved +.\" Copyright (c) 1999, 2005, 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. +.\" +.\" X Window System is a trademark of The Open Group. +.\" +.de ZN +.ie t \fB\^\\$1\^\fR\\$2 +.el \fI\^\\$1\^\fP\\$2 +.. +.TH XcupQueryVersion __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +XcupQueryVersion \- Returns TOG-CUP protocol version supported by the X server +.SH SYNOPSIS +.PP +.nf +\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] +\&#include +.HP +Status \fBXcupQueryVersion\fP\^(\^Display *\fIdisplay\fP\^, +int *\fImajor_version_return\fP\^, int *\fIminor_version_return\fP\^); +.if n .ti +5n +.if t .ti +.5i +.SH ARGUMENTS +.IP \fIdisplay\fP 1i +Specifies the connection to the X server +.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 +.SH DESCRIPTION +.LP +.ZN XcupQueryVersion +sets +.I major_version_return +and +.I minor_version_return +to the major and minor TOG-CUP protocol version supported by the +server. If the TOG-CUP library is compatible with the version returned +by the server, it returns nonzero. If the server does not support the TOG-CUP +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. No other Xcup functions may be called +before this function. If a client violates this rule, the effects of +all subsequent Xcup calls that it makes are undefined. +.LP +To get the list of reserved colormap entries, use +.ZN XcupGetReservedColormapEntries. +.LP +To allocate one or more read-only color cells with RGB values, use +.ZN XcupStoreColors. +.SH "SEE ALSO" +.BR XcupGetReservedColormapEntries (3Xext), +.BR XcupStoreColors (3Xext), +.br +\fIColormap Utilization Policy and Extension\fP diff --git a/libXext/man/XcupStoreColors.man b/libXext/man/XcupStoreColors.man index 335afb858..255f856f5 100644 --- a/libXext/man/XcupStoreColors.man +++ b/libXext/man/XcupStoreColors.man @@ -1,79 +1,79 @@ -.\" Copyright \(co 1986-1997 The Open Group All Rights Reserved -.\" Copyright (c) 1999, 2005, 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. -.\" -.\" X Window System is a trademark of The Open Group. -.\" -.de ZN -.ie t \fB\^\\$1\^\fR\\$2 -.el \fI\^\\$1\^\fP\\$2 -.. -.TH XcupStoreColors __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -XcupStoreColors \- initialize shareable colormap entries at specific locations -.SH SYNOPSIS -.PP -.nf -\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] -\&#include -.HP -Status \fBXcupStoreColors\fP\^(\^Display *\fIdisplay\fP\^, Colormap \fIcolormap\fP\^, -XColor *\fIcolors_in_out\fP\^, int \fIncolors\fP\^); -.if n .ti +5n -.if t .ti +.5i -.SH ARGUMENTS -.IP \fIdisplay\fP 1i -Specifies the connection to the X server -.IP \fIcolormap\fP 1i -Specifies the colormap -.IP \fIcolors_in_out\fP 1i -Specifies and returns the values actually used in the colormap -.IP \fIncolors\fP 1i -Specifies the number of items in colors_in_out -.SH DESCRIPTION -.LP -The -.ZN XcupStoreColors -function changes the colormap entries of the pixel values in the pixel -members of the XColor structures. The colormap entries are allocated -as if an AllocColor has been used instead, i.e. the colors are -read-only (shareable). -.ZN XcupStoreColors -returns the number of colors that were successfully allocated in the colormap. -.LP -A -.ZN Value -error is generated if a pixel is not a valid index into the colormap. A -.ZN BadMatch -error is generated if the colormap does not belong to a GrayScale, -PseudoColor, or DirectColor visual. -.LP -Applications which allocate many colors in a screen's default colormap, e.g. -a color-cube or a gray-ramp, should allocate them with -.ZN XCupStoreColors . -By using XCupStoreColors the colors will be allocated sharable (read-only) -and any other application which allocates the same color will share that -color cell. -.SH "SEE ALSO" -.BR XcupQueryVersion (3Xext), -.BR XcupGetReservedColormapEntries (3Xext), -.br -\fIColormap Utilization Policy and Extension\fP +.\" Copyright \(co 1986-1997 The Open Group All Rights Reserved +.\" Copyright (c) 1999, 2005, 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. +.\" +.\" X Window System is a trademark of The Open Group. +.\" +.de ZN +.ie t \fB\^\\$1\^\fR\\$2 +.el \fI\^\\$1\^\fP\\$2 +.. +.TH XcupStoreColors __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +XcupStoreColors \- initialize shareable colormap entries at specific locations +.SH SYNOPSIS +.PP +.nf +\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ] +\&#include +.HP +Status \fBXcupStoreColors\fP\^(\^Display *\fIdisplay\fP\^, Colormap \fIcolormap\fP\^, +XColor *\fIcolors_in_out\fP\^, int \fIncolors\fP\^); +.if n .ti +5n +.if t .ti +.5i +.SH ARGUMENTS +.IP \fIdisplay\fP 1i +Specifies the connection to the X server +.IP \fIcolormap\fP 1i +Specifies the colormap +.IP \fIcolors_in_out\fP 1i +Specifies and returns the values actually used in the colormap +.IP \fIncolors\fP 1i +Specifies the number of items in colors_in_out +.SH DESCRIPTION +.LP +The +.ZN XcupStoreColors +function changes the colormap entries of the pixel values in the pixel +members of the XColor structures. The colormap entries are allocated +as if an AllocColor has been used instead, i.e. the colors are +read-only (shareable). +.ZN XcupStoreColors +returns the number of colors that were successfully allocated in the colormap. +.LP +A +.ZN Value +error is generated if a pixel is not a valid index into the colormap. A +.ZN BadMatch +error is generated if the colormap does not belong to a GrayScale, +PseudoColor, or DirectColor visual. +.LP +Applications which allocate many colors in a screen's default colormap, e.g. +a color-cube or a gray-ramp, should allocate them with +.ZN XCupStoreColors . +By using XCupStoreColors the colors will be allocated sharable (read-only) +and any other application which allocates the same color will share that +color cell. +.SH "SEE ALSO" +.BR XcupQueryVersion (3Xext), +.BR XcupGetReservedColormapEntries (3Xext), +.br +\fIColormap Utilization Policy and Extension\fP diff --git a/libXext/man/XdbeAllocateBackBufferName.man b/libXext/man/XdbeAllocateBackBufferName.man index 720491eaa..1a187a908 100644 --- a/libXext/man/XdbeAllocateBackBufferName.man +++ b/libXext/man/XdbeAllocateBackBufferName.man @@ -1,67 +1,67 @@ -.\" Copyright (c) 1995 Hewlett-Packard Company -.\" -.\" 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 furnished to do so, subject to the following conditions: -.\" -.\" The above copyright notice and this permission notice shall be included in -.\" all copies or substantial portions of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -.\" SOFTWARE. -.\" -.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not -.\" be used in advertising or otherwise to promote the sale, use or other -.\" dealing in this Software without prior written authorization from the -.\" Hewlett-Packard Company. -.\" -.TH XdbeAllocateBackBufferName __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -XdbeAllocateBackBufferName - allocates a DBE buffer. -.SH SYNOPSIS -\&#include - -XdbeBackBuffer XdbeAllocateBackBufferName( - Display *dpy, - Window window, - XdbeSwapAction swap_action) -.SH DESCRIPTION -This function returns a drawable ID used to refer to the back buffer of the -specified window. The swap_action is a hint to indicate the swap action that -will likely be used in subsequent calls to -.B XdbeSwapBuffers(). -The actual swap -action used in calls to -.B XdbeSwapBuffers() -does not have to be the same as the -swap_action passed to this function, though clients are encouraged to provide -accurate information whenever possible. -.SH ERRORS -.IP BadAlloc -.IP BadIDChoice -.IP BadMatch -The specified window is not an InputOutput window or its visual does not -support DBE. -.IP BadValue -An invalid swap action was specified. -.IP BadWindow -An invalid window was specified. -.SH SEE ALSO -DBE, -.I XdbeBeginIdiom(), -.I XdbeDeallocateBackBufferName(), -.I XdbeEndIdiom(), -.I XdbeFreeVisualInfo(), -.I XdbeGetBackBufferAttributes(), -.I XdbeGetVisualInfo(), -.I XdbeQueryExtension(), -.I XdbeSwapBuffers(). - +.\" Copyright (c) 1995 Hewlett-Packard Company +.\" +.\" 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 furnished to do so, subject to the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be included in +.\" all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" SOFTWARE. +.\" +.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not +.\" be used in advertising or otherwise to promote the sale, use or other +.\" dealing in this Software without prior written authorization from the +.\" Hewlett-Packard Company. +.\" +.TH XdbeAllocateBackBufferName __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +XdbeAllocateBackBufferName - allocates a DBE buffer. +.SH SYNOPSIS +\&#include + +XdbeBackBuffer XdbeAllocateBackBufferName( + Display *dpy, + Window window, + XdbeSwapAction swap_action) +.SH DESCRIPTION +This function returns a drawable ID used to refer to the back buffer of the +specified window. The swap_action is a hint to indicate the swap action that +will likely be used in subsequent calls to +.B XdbeSwapBuffers(). +The actual swap +action used in calls to +.B XdbeSwapBuffers() +does not have to be the same as the +swap_action passed to this function, though clients are encouraged to provide +accurate information whenever possible. +.SH ERRORS +.IP BadAlloc +.IP BadIDChoice +.IP BadMatch +The specified window is not an InputOutput window or its visual does not +support DBE. +.IP BadValue +An invalid swap action was specified. +.IP BadWindow +An invalid window was specified. +.SH SEE ALSO +DBE, +.I XdbeBeginIdiom(), +.I XdbeDeallocateBackBufferName(), +.I XdbeEndIdiom(), +.I XdbeFreeVisualInfo(), +.I XdbeGetBackBufferAttributes(), +.I XdbeGetVisualInfo(), +.I XdbeQueryExtension(), +.I XdbeSwapBuffers(). + diff --git a/libXext/man/XdbeBeginIdiom.man b/libXext/man/XdbeBeginIdiom.man index c58e7666c..18ee0704e 100644 --- a/libXext/man/XdbeBeginIdiom.man +++ b/libXext/man/XdbeBeginIdiom.man @@ -1,46 +1,46 @@ -.\" Copyright (c) 1995 Hewlett-Packard Company -.\" -.\" 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 furnished to do so, subject to the following conditions: -.\" -.\" The above copyright notice and this permission notice shall be included in -.\" all copies or substantial portions of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -.\" SOFTWARE. -.\" -.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not -.\" be used in advertising or otherwise to promote the sale, use or other -.\" dealing in this Software without prior written authorization from the -.\" Hewlett-Packard Company. -.\" -.TH DBE __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -XdbeBeginIdiom - marks the beginning of a DBE idiom sequence. -.SH SYNOPSIS -\&#include - -Status XdbeBeginIdiom( - Display *dpy) -.SH DESCRIPTION -This function marks the beginning of an idiom sequence. -.SH SEE ALSO -DBE, -.I XdbeAllocateBackBufferName(), -.I XdbeDeallocateBackBufferName(), -.I XdbeEndIdiom(), -.I XdbeFreeVisualInfo(), -.I XdbeGetBackBufferAttributes(), -.I XdbeGetVisualInfo(), -.I XdbeQueryExtension(), -.I XdbeSwapBuffers(). - +.\" Copyright (c) 1995 Hewlett-Packard Company +.\" +.\" 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 furnished to do so, subject to the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be included in +.\" all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" SOFTWARE. +.\" +.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not +.\" be used in advertising or otherwise to promote the sale, use or other +.\" dealing in this Software without prior written authorization from the +.\" Hewlett-Packard Company. +.\" +.TH DBE __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +XdbeBeginIdiom - marks the beginning of a DBE idiom sequence. +.SH SYNOPSIS +\&#include + +Status XdbeBeginIdiom( + Display *dpy) +.SH DESCRIPTION +This function marks the beginning of an idiom sequence. +.SH SEE ALSO +DBE, +.I XdbeAllocateBackBufferName(), +.I XdbeDeallocateBackBufferName(), +.I XdbeEndIdiom(), +.I XdbeFreeVisualInfo(), +.I XdbeGetBackBufferAttributes(), +.I XdbeGetVisualInfo(), +.I XdbeQueryExtension(), +.I XdbeSwapBuffers(). + diff --git a/libXext/man/XdbeDeallocateBackBufferName.man b/libXext/man/XdbeDeallocateBackBufferName.man index 0cd2b0291..a1286494d 100644 --- a/libXext/man/XdbeDeallocateBackBufferName.man +++ b/libXext/man/XdbeDeallocateBackBufferName.man @@ -1,53 +1,53 @@ -.\" Copyright (c) 1995 Hewlett-Packard Company -.\" -.\" 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 furnished to do so, subject to the following conditions: -.\" -.\" The above copyright notice and this permission notice shall be included in -.\" all copies or substantial portions of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -.\" SOFTWARE. -.\" -.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not -.\" be used in advertising or otherwise to promote the sale, use or other -.\" dealing in this Software without prior written authorization from the -.\" Hewlett-Packard Company. -.\" -.TH XdbeDeallocateBackBufferName __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -XdbeDeallocateBackBufferName - frees a DBE buffer. -.SH SYNOPSIS -\&#include - -Status XdbeDeallocateBackBufferName( - Display *dpy, - XdbeBackBuffer buffer) -.SH DESCRIPTION -This function frees a drawable ID, buffer, that was obtained via -.B XdbeAllocateBackBufferName(). -The buffer must be a valid name for the back -buffer of a window, or a protocol error results. -.SH ERRORS -.IP BadBuffer -The specified buffer is not associated with a window. -.SH SEE ALSO -DBE, -.I XdbeAllocateBackBufferName(), -.I XdbeBeginIdiom(), -.I XdbeEndIdiom(), -.I XdbeFreeVisualInfo(), -.I XdbeGetBackBufferAttributes(), -.I XdbeGetVisualInfo(), -.I XdbeQueryExtension(), -.I XdbeSwapBuffers(). - +.\" Copyright (c) 1995 Hewlett-Packard Company +.\" +.\" 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 furnished to do so, subject to the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be included in +.\" all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" SOFTWARE. +.\" +.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not +.\" be used in advertising or otherwise to promote the sale, use or other +.\" dealing in this Software without prior written authorization from the +.\" Hewlett-Packard Company. +.\" +.TH XdbeDeallocateBackBufferName __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +XdbeDeallocateBackBufferName - frees a DBE buffer. +.SH SYNOPSIS +\&#include + +Status XdbeDeallocateBackBufferName( + Display *dpy, + XdbeBackBuffer buffer) +.SH DESCRIPTION +This function frees a drawable ID, buffer, that was obtained via +.B XdbeAllocateBackBufferName(). +The buffer must be a valid name for the back +buffer of a window, or a protocol error results. +.SH ERRORS +.IP BadBuffer +The specified buffer is not associated with a window. +.SH SEE ALSO +DBE, +.I XdbeAllocateBackBufferName(), +.I XdbeBeginIdiom(), +.I XdbeEndIdiom(), +.I XdbeFreeVisualInfo(), +.I XdbeGetBackBufferAttributes(), +.I XdbeGetVisualInfo(), +.I XdbeQueryExtension(), +.I XdbeSwapBuffers(). + diff --git a/libXext/man/XdbeEndIdiom.man b/libXext/man/XdbeEndIdiom.man index ac651f5fe..9218ef598 100644 --- a/libXext/man/XdbeEndIdiom.man +++ b/libXext/man/XdbeEndIdiom.man @@ -1,46 +1,46 @@ -.\" Copyright (c) 1995 Hewlett-Packard Company -.\" -.\" 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 furnished to do so, subject to the following conditions: -.\" -.\" The above copyright notice and this permission notice shall be included in -.\" all copies or substantial portions of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -.\" SOFTWARE. -.\" -.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not -.\" be used in advertising or otherwise to promote the sale, use or other -.\" dealing in this Software without prior written authorization from the -.\" Hewlett-Packard Company. -.\" -.TH XdbeEndIdiom __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -XdbeEndIdiom - marks the end of a DBE idiom sequence. -.SH SYNOPSIS -\&#include - -Status XdbeEndIdiom( - Display *dpy) -.SH DESCRIPTION -This function marks the end of an idiom sequence. -.SH SEE ALSO -DBE, -.I XdbeAllocateBackBufferName(), -.I XdbeBeginIdiom(), -.I XdbeDeallocateBackBufferName(), -.I XdbeFreeVisualInfo(), -.I XdbeGetBackBufferAttributes(), -.I XdbeGetVisualInfo(), -.I XdbeQueryExtension(), -.I XdbeSwapBuffers(). - +.\" Copyright (c) 1995 Hewlett-Packard Company +.\" +.\" 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 furnished to do so, subject to the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be included in +.\" all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" SOFTWARE. +.\" +.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not +.\" be used in advertising or otherwise to promote the sale, use or other +.\" dealing in this Software without prior written authorization from the +.\" Hewlett-Packard Company. +.\" +.TH XdbeEndIdiom __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +XdbeEndIdiom - marks the end of a DBE idiom sequence. +.SH SYNOPSIS +\&#include + +Status XdbeEndIdiom( + Display *dpy) +.SH DESCRIPTION +This function marks the end of an idiom sequence. +.SH SEE ALSO +DBE, +.I XdbeAllocateBackBufferName(), +.I XdbeBeginIdiom(), +.I XdbeDeallocateBackBufferName(), +.I XdbeFreeVisualInfo(), +.I XdbeGetBackBufferAttributes(), +.I XdbeGetVisualInfo(), +.I XdbeQueryExtension(), +.I XdbeSwapBuffers(). + diff --git a/libXext/man/XdbeFreeVisualInfo.man b/libXext/man/XdbeFreeVisualInfo.man index 36a6effab..04f9083a3 100644 --- a/libXext/man/XdbeFreeVisualInfo.man +++ b/libXext/man/XdbeFreeVisualInfo.man @@ -1,48 +1,48 @@ -.\" Copyright (c) 1995 Hewlett-Packard Company -.\" -.\" 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 furnished to do so, subject to the following conditions: -.\" -.\" The above copyright notice and this permission notice shall be included in -.\" all copies or substantial portions of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -.\" SOFTWARE. -.\" -.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not -.\" be used in advertising or otherwise to promote the sale, use or other -.\" dealing in this Software without prior written authorization from the -.\" Hewlett-Packard Company. -.\" -.TH XdbeFreeVisualInfo __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -XdbeFreeVisualInfo - frees information returned by -.B XdbeGetVisualInfo(). -.SH SYNOPSIS -\&#include - -void XdbeFreeVisualInfo( - XdbeScreenVisualInfo *visual_info) -.SH DESCRIPTION -This function frees the list of XdbeScreenVisualInfo returned by the function -.B XdbeGetVisualInfo(). -.SH SEE ALSO -DBE, -.I XdbeAllocateBackBufferName(), -.I XdbeBeginIdiom(), -.I XdbeDeallocateBackBufferName(), -.I XdbeEndIdiom(), -.I XdbeGetBackBufferAttributes(), -.I XdbeGetVisualInfo(), -.I XdbeQueryExtension(), -.I XdbeSwapBuffers(). - +.\" Copyright (c) 1995 Hewlett-Packard Company +.\" +.\" 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 furnished to do so, subject to the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be included in +.\" all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" SOFTWARE. +.\" +.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not +.\" be used in advertising or otherwise to promote the sale, use or other +.\" dealing in this Software without prior written authorization from the +.\" Hewlett-Packard Company. +.\" +.TH XdbeFreeVisualInfo __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +XdbeFreeVisualInfo - frees information returned by +.B XdbeGetVisualInfo(). +.SH SYNOPSIS +\&#include + +void XdbeFreeVisualInfo( + XdbeScreenVisualInfo *visual_info) +.SH DESCRIPTION +This function frees the list of XdbeScreenVisualInfo returned by the function +.B XdbeGetVisualInfo(). +.SH SEE ALSO +DBE, +.I XdbeAllocateBackBufferName(), +.I XdbeBeginIdiom(), +.I XdbeDeallocateBackBufferName(), +.I XdbeEndIdiom(), +.I XdbeGetBackBufferAttributes(), +.I XdbeGetVisualInfo(), +.I XdbeQueryExtension(), +.I XdbeSwapBuffers(). + diff --git a/libXext/man/XdbeGetBackBufferAttributes.man b/libXext/man/XdbeGetBackBufferAttributes.man index c51c0de22..ac9d69209 100644 --- a/libXext/man/XdbeGetBackBufferAttributes.man +++ b/libXext/man/XdbeGetBackBufferAttributes.man @@ -1,65 +1,65 @@ -.\" Copyright (c) 1995 Hewlett-Packard Company -.\" -.\" 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 furnished to do so, subject to the following conditions: -.\" -.\" The above copyright notice and this permission notice shall be included in -.\" all copies or substantial portions of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -.\" SOFTWARE. -.\" -.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not -.\" be used in advertising or otherwise to promote the sale, use or other -.\" dealing in this Software without prior written authorization from the -.\" Hewlett-Packard Company. -.\" -.TH XdbeGetBackBufferAttributes __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -XdbeGetBackBufferAttributes - returns attributes of a DBE buffer. -.SH SYNOPSIS -\&#include - -XdbeBackBufferAttributes *XdbeGetBackBufferAttributes( - Display *dpy, - XdbeBackBuffer buffer) -.SH DESCRIPTION -This function returns the attributes associated with the specified buffer. - -The -.I XdbeBackBufferAttributes -structure has the following fields: - -.RS -Window window window that buffer belongs to -.RE - -If buffer is not a valid -.I XdbeBackBuffer, -window returns None. - -The returned -.I XdbeBackBufferAttributes -structure can be freed with the -Xlib function -.B Xfree(). -.SH SEE ALSO -DBE, -.I XdbeAllocateBackBufferName(), -.I XdbeBeginIdiom(), -.I XdbeDeallocateBackBufferName(), -.I XdbeEndIdiom(), -.I XdbeFreeVisualInfo(), -.I XdbeGetVisualInfo(), -.I XdbeQueryExtension(), -.I XdbeSwapBuffers(). - +.\" Copyright (c) 1995 Hewlett-Packard Company +.\" +.\" 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 furnished to do so, subject to the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be included in +.\" all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" SOFTWARE. +.\" +.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not +.\" be used in advertising or otherwise to promote the sale, use or other +.\" dealing in this Software without prior written authorization from the +.\" Hewlett-Packard Company. +.\" +.TH XdbeGetBackBufferAttributes __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +XdbeGetBackBufferAttributes - returns attributes of a DBE buffer. +.SH SYNOPSIS +\&#include + +XdbeBackBufferAttributes *XdbeGetBackBufferAttributes( + Display *dpy, + XdbeBackBuffer buffer) +.SH DESCRIPTION +This function returns the attributes associated with the specified buffer. + +The +.I XdbeBackBufferAttributes +structure has the following fields: + +.RS +Window window window that buffer belongs to +.RE + +If buffer is not a valid +.I XdbeBackBuffer, +window returns None. + +The returned +.I XdbeBackBufferAttributes +structure can be freed with the +Xlib function +.B Xfree(). +.SH SEE ALSO +DBE, +.I XdbeAllocateBackBufferName(), +.I XdbeBeginIdiom(), +.I XdbeDeallocateBackBufferName(), +.I XdbeEndIdiom(), +.I XdbeFreeVisualInfo(), +.I XdbeGetVisualInfo(), +.I XdbeQueryExtension(), +.I XdbeSwapBuffers(). + diff --git a/libXext/man/XdbeGetVisualInfo.man b/libXext/man/XdbeGetVisualInfo.man index 338805caa..a4204e6cf 100644 --- a/libXext/man/XdbeGetVisualInfo.man +++ b/libXext/man/XdbeGetVisualInfo.man @@ -1,125 +1,125 @@ -.\" Copyright (c) 1995 Hewlett-Packard Company -.\" -.\" 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 furnished to do so, subject to the following conditions: -.\" -.\" The above copyright notice and this permission notice shall be included in -.\" all copies or substantial portions of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -.\" SOFTWARE. -.\" -.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not -.\" be used in advertising or otherwise to promote the sale, use or other -.\" dealing in this Software without prior written authorization from the -.\" Hewlett-Packard Company. -.\" -.TH XdbeGetVisualInfo __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -XdbeGetVisualInfo - Get dbe Visual Informations -.SH SYNOPSIS -\&#include - -XdbeScreenVisualInfo *XdbeGetVisualInfo( - Display *dpy, - Drawable *screen_specifiers, - int *num_screens) -.SH DESCRIPTION -This function returns information about which visuals support double -buffering. The argument -.I num_screens -specifies how many elements there are -in the -.I screen_specifiers -list. Each drawable in -.I screen_specifiers -designates a -screen for which the supported visuals are being requested. If -.I num_screens -is zero, information for all screens is requested. In this case, upon return -from this function, -.I num_screens -will be set to the number of screens that were -found. If an error occurs, this function returns NULL, else it returns a -pointer to a list of -.I XdbeScreenVisualInfo -structures of length -.I num_screens. -The nth -element in the returned list corresponds to the nth drawable in the -.I screen_specifiers -list, unless -.I num_screens -was passed in with the value zero, -in which case the nth element in the returned list corresponds to the nth screen -of the server, starting with screen zero. The -.I XdbeScreenVisualInfo -structure has the following fields: - - int count - XdbeVisualInfo *visinfo - -.I count -specifies the number of items in -.I visinfo. -.I visinfo -specifies a list of visuals, depths, and performance hints for this screen. - -The -.I XdbeVisualInfo -structure has the following fields: - - VisualID visual - int depth - int perflevel - -.I visual -specifies one visual ID that supports double-buffering. -.I depth -specifies the depth of the visual. -.I perflevel -is a performance hint. - -The only operation defined on a -.I perflevel -is comparison to a -.I perflevel -of another visual on the same screen. The visual having the higher -.I perflevel -is likely to have better double-buffering graphics performance than the visual -having the lower -.I perflevel. -Nothing can be deduced from the following: the magnitude of the difference -of two -.I perflevels, -a -.I perflevel -value in isolation, or comparing -.I perflevels -from different servers. - -.SH ERRORS -.IP BadDrawable -One or more values passed in -.I screen_specifiers -is not a valid drawable. -.SH SEE ALSO -DBE, -.I XdbeAllocateBackBufferName(), -.I XdbeBeginIdiom(), -.I XdbeDeallocateBackBufferName(), -.I XdbeEndIdiom(), -.I XdbeFreeVisualInfo(), -.I XdbeGetBackBufferAttributes(), -.I XdbeQueryExtension(), -.I XdbeSwapBuffers(). - +.\" Copyright (c) 1995 Hewlett-Packard Company +.\" +.\" 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 furnished to do so, subject to the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be included in +.\" all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" SOFTWARE. +.\" +.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not +.\" be used in advertising or otherwise to promote the sale, use or other +.\" dealing in this Software without prior written authorization from the +.\" Hewlett-Packard Company. +.\" +.TH XdbeGetVisualInfo __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +XdbeGetVisualInfo - Get dbe Visual Informations +.SH SYNOPSIS +\&#include + +XdbeScreenVisualInfo *XdbeGetVisualInfo( + Display *dpy, + Drawable *screen_specifiers, + int *num_screens) +.SH DESCRIPTION +This function returns information about which visuals support double +buffering. The argument +.I num_screens +specifies how many elements there are +in the +.I screen_specifiers +list. Each drawable in +.I screen_specifiers +designates a +screen for which the supported visuals are being requested. If +.I num_screens +is zero, information for all screens is requested. In this case, upon return +from this function, +.I num_screens +will be set to the number of screens that were +found. If an error occurs, this function returns NULL, else it returns a +pointer to a list of +.I XdbeScreenVisualInfo +structures of length +.I num_screens. +The nth +element in the returned list corresponds to the nth drawable in the +.I screen_specifiers +list, unless +.I num_screens +was passed in with the value zero, +in which case the nth element in the returned list corresponds to the nth screen +of the server, starting with screen zero. The +.I XdbeScreenVisualInfo +structure has the following fields: + + int count + XdbeVisualInfo *visinfo + +.I count +specifies the number of items in +.I visinfo. +.I visinfo +specifies a list of visuals, depths, and performance hints for this screen. + +The +.I XdbeVisualInfo +structure has the following fields: + + VisualID visual + int depth + int perflevel + +.I visual +specifies one visual ID that supports double-buffering. +.I depth +specifies the depth of the visual. +.I perflevel +is a performance hint. + +The only operation defined on a +.I perflevel +is comparison to a +.I perflevel +of another visual on the same screen. The visual having the higher +.I perflevel +is likely to have better double-buffering graphics performance than the visual +having the lower +.I perflevel. +Nothing can be deduced from the following: the magnitude of the difference +of two +.I perflevels, +a +.I perflevel +value in isolation, or comparing +.I perflevels +from different servers. + +.SH ERRORS +.IP BadDrawable +One or more values passed in +.I screen_specifiers +is not a valid drawable. +.SH SEE ALSO +DBE, +.I XdbeAllocateBackBufferName(), +.I XdbeBeginIdiom(), +.I XdbeDeallocateBackBufferName(), +.I XdbeEndIdiom(), +.I XdbeFreeVisualInfo(), +.I XdbeGetBackBufferAttributes(), +.I XdbeQueryExtension(), +.I XdbeSwapBuffers(). + diff --git a/libXext/man/XdbeQueryExtension.man b/libXext/man/XdbeQueryExtension.man index 6065584e8..e46559560 100644 --- a/libXext/man/XdbeQueryExtension.man +++ b/libXext/man/XdbeQueryExtension.man @@ -1,61 +1,61 @@ -.\" Copyright (c) 1995 Hewlett-Packard Company -.\" -.\" 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 furnished to do so, subject to the following conditions: -.\" -.\" The above copyright notice and this permission notice shall be included in -.\" all copies or substantial portions of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -.\" SOFTWARE. -.\" -.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not -.\" be used in advertising or otherwise to promote the sale, use or other -.\" dealing in this Software without prior written authorization from the -.\" Hewlett-Packard Company. -.\" -.TH XdbeQueryExtension __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -XdbeQueryExtension - returns the version of DBE supported by the server. -.SH SYNOPSIS -\&#include - -Status XdbeQueryExtension( - Display *dpy, - int *major_version_return, - int *minor_version_return) -.SH DESCRIPTION -Sets -.I major_version_return -and -.I minor_version_return -to the major and minor -DBE protocol version supported by the server. If the DBE library is -compatible with the version returned by the server, this function returns -non-zero. If -.I dpy -does not support the DBE extension, or if there was an error -during communication with the server, or if the server and library protocol -versions are incompatible, this function returns zero. No other Xdbe functions -may be called before this function. If a client violates this rule, the -effects of all subsequent Xdbe calls that it makes are undefined. -.SH SEE ALSO -DBE, -.I XdbeAllocateBackBufferName(), -.I XdbeBeginIdiom(), -.I XdbeDeallocateBackBufferName(), -.I XdbeEndIdiom(), -.I XdbeFreeVisualInfo(), -.I XdbeGetBackBufferAttributes(), -.I XdbeGetVisualInfo(), -.I XdbeSwapBuffers(). - +.\" Copyright (c) 1995 Hewlett-Packard Company +.\" +.\" 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 furnished to do so, subject to the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be included in +.\" all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" SOFTWARE. +.\" +.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not +.\" be used in advertising or otherwise to promote the sale, use or other +.\" dealing in this Software without prior written authorization from the +.\" Hewlett-Packard Company. +.\" +.TH XdbeQueryExtension __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +XdbeQueryExtension - returns the version of DBE supported by the server. +.SH SYNOPSIS +\&#include + +Status XdbeQueryExtension( + Display *dpy, + int *major_version_return, + int *minor_version_return) +.SH DESCRIPTION +Sets +.I major_version_return +and +.I minor_version_return +to the major and minor +DBE protocol version supported by the server. If the DBE library is +compatible with the version returned by the server, this function returns +non-zero. If +.I dpy +does not support the DBE extension, or if there was an error +during communication with the server, or if the server and library protocol +versions are incompatible, this function returns zero. No other Xdbe functions +may be called before this function. If a client violates this rule, the +effects of all subsequent Xdbe calls that it makes are undefined. +.SH SEE ALSO +DBE, +.I XdbeAllocateBackBufferName(), +.I XdbeBeginIdiom(), +.I XdbeDeallocateBackBufferName(), +.I XdbeEndIdiom(), +.I XdbeFreeVisualInfo(), +.I XdbeGetBackBufferAttributes(), +.I XdbeGetVisualInfo(), +.I XdbeSwapBuffers(). + diff --git a/libXext/man/XdbeSwapBuffers.man b/libXext/man/XdbeSwapBuffers.man index b414add7f..79d8af77c 100644 --- a/libXext/man/XdbeSwapBuffers.man +++ b/libXext/man/XdbeSwapBuffers.man @@ -1,96 +1,96 @@ -.\" Copyright (c) 1995 Hewlett-Packard Company -.\" -.\" 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 furnished to do so, subject to the following conditions: -.\" -.\" The above copyright notice and this permission notice shall be included in -.\" all copies or substantial portions of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -.\" SOFTWARE. -.\" -.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not -.\" be used in advertising or otherwise to promote the sale, use or other -.\" dealing in this Software without prior written authorization from the -.\" Hewlett-Packard Company. -.\" -.TH XdbeSwapBuffers __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -XdbeSwapBuffers - swaps front and back DBE buffers. -.SH SYNOPSIS -\&#include - -Status XdbeSwapBuffers( - Display *dpy, - XdbeSwapInfo *swap_info, - int num_windows) -.SH DESCRIPTION -This function swaps the front and back buffers for a list of windows. The -argument -.I num_windows -specifies how many windows are to have their buffers -swapped; it is the number of elements in the -.I swap_info -array. The argument -.I swap_info -specifies the information needed per window to do the swap. - -The -.I XdbeSwapInfo -structure has the following fields: - - Window swap_window - XdbeSwapAction swap_action - -.I swap_window -specifies the window for which to swap buffers. -.I swap_action -specifies the swap action to use for this -.I swap_window. - -.I swap_action -determines what will happen to the new back buffer of the -.I swap_window -it is paired with in the list in addition to making the old back buffer -become visible. The defined actions are as follows: - -.IP XdbeUndefined -The contents of the new back buffer become undefined. This may be the most -efficient action since it allows the implementation to discard the contents of -the buffer if it needs to. -.IP XdbeBackground -The unobscured region of the new back buffer will be tiled with the -window background. The background action allows devices to use a fast clear -capability during a swap. -.IP XdbeUntouched -The unobscured region of the new back buffer will be unmodified by the swap. -.IP XdbeCopied -The unobscured region of the new back buffer will be the contents of the old -back buffer -.SH ERRORS -.IP BadMatch -A non-double-buffered window was specified or a window was specified twice. -.IP BadWindow -An invalid window was specified. -.IP BadValue -An invalid swap action was specified. -.SH SEE ALSO -DBE, -.I XdbeAllocateBackBufferName(), -.I XdbeBeginIdiom(), -.I XdbeDeallocateBackBufferName(), -.I XdbeEndIdiom(), -.I XdbeFreeVisualInfo(), -.I XdbeGetBackBufferAttributes(), -.I XdbeGetVisualInfo(), -.I XdbeQueryExtension(). - +.\" Copyright (c) 1995 Hewlett-Packard Company +.\" +.\" 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 furnished to do so, subject to the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be included in +.\" all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +.\" HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" SOFTWARE. +.\" +.\" Except as contained in this notice, the name of the Hewlett-Packard Company shall not +.\" be used in advertising or otherwise to promote the sale, use or other +.\" dealing in this Software without prior written authorization from the +.\" Hewlett-Packard Company. +.\" +.TH XdbeSwapBuffers __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +XdbeSwapBuffers - swaps front and back DBE buffers. +.SH SYNOPSIS +\&#include + +Status XdbeSwapBuffers( + Display *dpy, + XdbeSwapInfo *swap_info, + int num_windows) +.SH DESCRIPTION +This function swaps the front and back buffers for a list of windows. The +argument +.I num_windows +specifies how many windows are to have their buffers +swapped; it is the number of elements in the +.I swap_info +array. The argument +.I swap_info +specifies the information needed per window to do the swap. + +The +.I XdbeSwapInfo +structure has the following fields: + + Window swap_window + XdbeSwapAction swap_action + +.I swap_window +specifies the window for which to swap buffers. +.I swap_action +specifies the swap action to use for this +.I swap_window. + +.I swap_action +determines what will happen to the new back buffer of the +.I swap_window +it is paired with in the list in addition to making the old back buffer +become visible. The defined actions are as follows: + +.IP XdbeUndefined +The contents of the new back buffer become undefined. This may be the most +efficient action since it allows the implementation to discard the contents of +the buffer if it needs to. +.IP XdbeBackground +The unobscured region of the new back buffer will be tiled with the +window background. The background action allows devices to use a fast clear +capability during a swap. +.IP XdbeUntouched +The unobscured region of the new back buffer will be unmodified by the swap. +.IP XdbeCopied +The unobscured region of the new back buffer will be the contents of the old +back buffer +.SH ERRORS +.IP BadMatch +A non-double-buffered window was specified or a window was specified twice. +.IP BadWindow +An invalid window was specified. +.IP BadValue +An invalid swap action was specified. +.SH SEE ALSO +DBE, +.I XdbeAllocateBackBufferName(), +.I XdbeBeginIdiom(), +.I XdbeDeallocateBackBufferName(), +.I XdbeEndIdiom(), +.I XdbeFreeVisualInfo(), +.I XdbeGetBackBufferAttributes(), +.I XdbeGetVisualInfo(), +.I XdbeQueryExtension(). + diff --git a/libXext/man/Xevi.man b/libXext/man/Xevi.man index 86c8eca33..6f0d4b598 100644 --- a/libXext/man/Xevi.man +++ b/libXext/man/Xevi.man @@ -1,161 +1,161 @@ -.\" Copyright (c) 1997 Silicon Graphics, Inc. -.\" -.\" Permission is hereby granted, free of charge, to any person obtaining a -.\" copy of this software and associated documentation files (the "Software"), -.\" to deal in the Software without restriction, including without limitation -.\" the rights to use, copy, modify, merge, publish, distribute, sublicense, -.\" and/or sell copies of the Software, and to permit persons to whom the -.\" Software furnished to do so, subject to the following conditions: -.\" -.\" The above copyright notice and this permission notice shall be included in -.\" all copies or substantial portions of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -.\" SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -.\" SOFTWARE. -.\" -.\" Except as contained in this notice, the name of Silicon Graphics, Inc. shall not -.\" be used in advertising or otherwise to promote the sale, use or other -.\" dealing in this Software without prior written authorization from -.\" Silicon Graphics, Inc. -.\" -.TH XEVI __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -XeviQueryExtension, XeviQueryVersion, XeviGetVisualInfo - X Extended Visual Information functions -.SH SYNOPSIS -\&#include - -Bool -XeviQueryExtension (Display *dpy); -.LP -Bool -XeviQueryVersion (Display *dpy, - int *major_version_return, - int *minor_version_return); -.LP -int -XeviGetVisualInfo (Display *dpy, VisualID *visual, - int n_visual, ExtendedVisualInfo ** evi_return, - int * n_info_return); -.fi -.SH DESCRIPTION -The -X11 Extended Visual Information extension (EVI) allows a client to determine -information about core X visuals beyond what the core protocol provides. - -The EVI application programming library contains the interfaces described below. -With the exception of -.BR XeviQueryExtension, -if any of these routines are -called with a display that does not support the extension, the -ExtensionErrorHandler (which can be set with -.BR XSetExtensionErrorHandler -and functions the same way as -.BR XSetErrorHandler ) -will be called and the function will then return. -.PP -.BR XeviQueryExtension -returns -.BR True -if the Extended Visual Information extension is available on the given display. -A client must call -.BR XeviQueryExtension -before calling any other EVI -function in order to negotiate a compatible protocol version; otherwise -the client will get undefined behavior (EVI may or may not work). -.PP -.BR XeviQueryVersion -returns -.BR True -if the request succeeded; the values of the major and minor protocol -version supported by the server are returned in -.I major_version_return -and -.I minor_version_return. -.PP -.BR XeviGetVisualInfo -returns a list of ExtendedVisualInfo structures that describe -visual information beyond that supported by the core protocol. This includes -layer information relevant for systems supporting overlays and/or underlay -planes, and information that allows applications better to determine the level -of hardware support for multiple colormaps. XeviGetVisualInfo returns -.BR Success -if successful, or an X error otherwise. -If the argument -.I visual -is NULL, then information for all visuals of all -screens is returned. Otherwise, it's a pointer to a list of visuals for which -extended visual information is desired. -.I n_visual -is the number of elements in the array visual. -.I evi_return -returns a pointer to a list of ExtendedVisualInfo. When done, the client -should free the list using XFree\. -.I n_info_return -returns the number of elements in the array evi_return. -.LP -The -.BR ExtendedVisualInfo -structure has the following fields: -.in +.5i -.nf -.ta 1.6i -VisualID \fIcore_visual_id\fR -int \fIscreen\fR -int \fIlevel\fR -unsigned int \fItransparency_type\fR -unsigned int \fItransparency_value\fR -unsigned int \fImin_hw_colormaps\fR -unsigned int \fImax_hw_colormaps\fR -unsigned int \fInum_colormap_conflicts\fR -VisualID * \fIcolormap_conflicts\fR -.fi -.LP -The combination of -.I core_visual_id -and -.I screen -number uniquely specify the visual being described. -.LP -.I level -returns the level number for the visual, 0 for normal planes, > 0 for -overlays, < 0 for underlays. -.LP -.I -transparency_type -returns the type of transparency supported by the visual. XEVI_TRANSPARENCY_NONE if -there are no transparent pixels, XEVI_TRANSPARENCY_PIXEL if the visual supports -a transparent pixel, XEVI_TRANSPARENCY_MASK if the visual supports transparent -plane(s). -.LP -.I transparency_value -returns the pixel/plane value to set for transparency if transparency_type isn't -XEVI_TRANSPARENCY_NONE. -.LP -.I min_hw_colormaps -and -.I max_hw_colormaps -return the minimum and maximum number of hardware colormaps backing up the -visual. -.LP -.I num_colormap_conflicts -returns the number of elements in -.I colormap_conflicts. -This array returns a list of visuals that may cause conflicts in the use of the -hardware colormap. For example, if a 12-bit hardware colormap is overloaded to -support 8-bit colormaps, the corresponding 8-bit visuals would conflict with the -12-bit visuals. - -.SH ERRORS -.BR XeviGetVisualInfo -will return -.I BadValue -if passed an illegal visual ID, -.I BadAccess -if the X server does not respond, -.I BadAlloc -if there is a memory allocation failure. +.\" Copyright (c) 1997 Silicon Graphics, Inc. +.\" +.\" Permission is hereby granted, free of charge, to any person obtaining a +.\" copy of this software and associated documentation files (the "Software"), +.\" to deal in the Software without restriction, including without limitation +.\" the rights to use, copy, modify, merge, publish, distribute, sublicense, +.\" and/or sell copies of the Software, and to permit persons to whom the +.\" Software furnished to do so, subject to the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be included in +.\" all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +.\" SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" SOFTWARE. +.\" +.\" Except as contained in this notice, the name of Silicon Graphics, Inc. shall not +.\" be used in advertising or otherwise to promote the sale, use or other +.\" dealing in this Software without prior written authorization from +.\" Silicon Graphics, Inc. +.\" +.TH XEVI __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +XeviQueryExtension, XeviQueryVersion, XeviGetVisualInfo - X Extended Visual Information functions +.SH SYNOPSIS +\&#include + +Bool +XeviQueryExtension (Display *dpy); +.LP +Bool +XeviQueryVersion (Display *dpy, + int *major_version_return, + int *minor_version_return); +.LP +int +XeviGetVisualInfo (Display *dpy, VisualID *visual, + int n_visual, ExtendedVisualInfo ** evi_return, + int * n_info_return); +.fi +.SH DESCRIPTION +The +X11 Extended Visual Information extension (EVI) allows a client to determine +information about core X visuals beyond what the core protocol provides. + +The EVI application programming library contains the interfaces described below. +With the exception of +.BR XeviQueryExtension, +if any of these routines are +called with a display that does not support the extension, the +ExtensionErrorHandler (which can be set with +.BR XSetExtensionErrorHandler +and functions the same way as +.BR XSetErrorHandler ) +will be called and the function will then return. +.PP +.BR XeviQueryExtension +returns +.BR True +if the Extended Visual Information extension is available on the given display. +A client must call +.BR XeviQueryExtension +before calling any other EVI +function in order to negotiate a compatible protocol version; otherwise +the client will get undefined behavior (EVI may or may not work). +.PP +.BR XeviQueryVersion +returns +.BR True +if the request succeeded; the values of the major and minor protocol +version supported by the server are returned in +.I major_version_return +and +.I minor_version_return. +.PP +.BR XeviGetVisualInfo +returns a list of ExtendedVisualInfo structures that describe +visual information beyond that supported by the core protocol. This includes +layer information relevant for systems supporting overlays and/or underlay +planes, and information that allows applications better to determine the level +of hardware support for multiple colormaps. XeviGetVisualInfo returns +.BR Success +if successful, or an X error otherwise. +If the argument +.I visual +is NULL, then information for all visuals of all +screens is returned. Otherwise, it's a pointer to a list of visuals for which +extended visual information is desired. +.I n_visual +is the number of elements in the array visual. +.I evi_return +returns a pointer to a list of ExtendedVisualInfo. When done, the client +should free the list using XFree\. +.I n_info_return +returns the number of elements in the array evi_return. +.LP +The +.BR ExtendedVisualInfo +structure has the following fields: +.in +.5i +.nf +.ta 1.6i +VisualID \fIcore_visual_id\fR +int \fIscreen\fR +int \fIlevel\fR +unsigned int \fItransparency_type\fR +unsigned int \fItransparency_value\fR +unsigned int \fImin_hw_colormaps\fR +unsigned int \fImax_hw_colormaps\fR +unsigned int \fInum_colormap_conflicts\fR +VisualID * \fIcolormap_conflicts\fR +.fi +.LP +The combination of +.I core_visual_id +and +.I screen +number uniquely specify the visual being described. +.LP +.I level +returns the level number for the visual, 0 for normal planes, > 0 for +overlays, < 0 for underlays. +.LP +.I +transparency_type +returns the type of transparency supported by the visual. XEVI_TRANSPARENCY_NONE if +there are no transparent pixels, XEVI_TRANSPARENCY_PIXEL if the visual supports +a transparent pixel, XEVI_TRANSPARENCY_MASK if the visual supports transparent +plane(s). +.LP +.I transparency_value +returns the pixel/plane value to set for transparency if transparency_type isn't +XEVI_TRANSPARENCY_NONE. +.LP +.I min_hw_colormaps +and +.I max_hw_colormaps +return the minimum and maximum number of hardware colormaps backing up the +visual. +.LP +.I num_colormap_conflicts +returns the number of elements in +.I colormap_conflicts. +This array returns a list of visuals that may cause conflicts in the use of the +hardware colormap. For example, if a 12-bit hardware colormap is overloaded to +support 8-bit colormaps, the corresponding 8-bit visuals would conflict with the +12-bit visuals. + +.SH ERRORS +.BR XeviGetVisualInfo +will return +.I BadValue +if passed an illegal visual ID, +.I BadAccess +if the X server does not respond, +.I BadAlloc +if there is a memory allocation failure. diff --git a/libXext/man/Xmbuf.man b/libXext/man/Xmbuf.man index 2d399ef78..08e85b7e0 100644 --- a/libXext/man/Xmbuf.man +++ b/libXext/man/Xmbuf.man @@ -1,343 +1,343 @@ -.\" Copyright (c) 1989, 1994 X Consortium -.\" -.\" 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 furnished to do so, subject to the following conditions: -.\" -.\" The above copyright notice and this permission notice shall be included in -.\" all copies or substantial portions of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -.\" THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -.\" SOFTWARE. -.\" -.\" Except as contained in this notice, the name of the X Consortium shall not -.\" be used in advertising or otherwise to promote the sale, use or other -.\" dealing in this Software without prior written authorization from the -.\" X Consortium. -.\" -.\" Copyright 1989, Digital Equipment Corporation. -.\" Permission to use, copy, modify, distribute, and sell this documentation -.\" for any purpose and without fee is hereby granted, provided that the above -.\" copyright notice and this permission notice appear in all copies. -.\" Digital Equipment Corporation makes no representations -.\" about the suitability for any purpose of the information in -.\" this document. This documentation is provided "as is" -.\" without express or implied warranty. -.\" -.de ZN -.ie t \fB\^\\$1\^\fR\\$2 -.el \fI\^\\$1\^\fP\\$2 -.. -.TH XMBUF __libmansuffix__ __xorgversion__ "X FUNCTIONS" -.SH NAME -XmbufQueryExtension, XmbufGetVersion, XmbufCreateBuffers, XmbufDestroyBuffers, XmbufDisplayBuffers, XmbufGetWindowAttributes, XmbufChangeWindowAttributes, XmbufGetBufferAttributes, XmbufChangeBufferAttributes, XmbufGetScreenInfo, XmbufCreateStereoWindow - X multibuffering functions -.SH SYNTAX -.nf -.LP -\&#include -.LP -Bool XmbufQueryExtension( - Display *dpy, - Display *dpy, - int *event_base_return, - int *error_base_return); -.LP -Status XmbufGetVersion( - Display *dpy, - int *major_version_return, - int *minor_version_return); -.LP -int XmbufCreateBuffers( - Display *dpy, - Window window, - int count, - int update_action, - int update_hint, - Multibuffer *buffers_update); -.LP -void XmbufDestroyBuffers( - Display *dpy, - Window window); -.LP -void XmbufDisplayBuffers( - Display *dpy, - int count, - Multibuffer *buffers, - int min_delay, - int max_delay); -.LP -Status XmbufGetWindowAttributes( - Display *dpy, - Window window, - XmbufWindowAttributes *attributes); -.LP -void XmbufChangeWindowAttributes( - Display *dpy, - Window window, - unsigned long valuemask, - XmbufSetWindowAttributes *attributes); -.LP -Status XmbufGetBufferAttributes( - Display *dpy, - Multibuffer buffer, - XmbufBufferAttributes *attributes); -.LP -void XmbufChangeBufferAttributes( - Display *dpy, - Multibuffer buffer, - unsigned long valuemask, - XmbufSetBufferAttributes *attributes); -.LP -Status XmbufGetScreenInfo( - Display *dpy, - Drawable drawable, - int *nmono_return, - XmbufBufferInfo **mono_info_return, - int *nstereo_return, - XmbufBufferInfo **stereo_info_return); -.LP -Window XmbufCreateStereoWindow( - Display *dpy, - Window parent, - int x, - int y, - unsigned int width, - unsigned int height, - unsigned int border_width, - int depth, - unsigned int class, /\&* InputOutput, InputOnly*/ - Visual *visual, - unsigned long valuemask, - XSetWindowAttributes *attributes, - Multibuffer *left_return, - Multibuffer *right_return); -.fi -.SH STRUCTURES -.nf -.ta 3i -\fIEvents:\fP -typedef struct { - int type; /\&* of event */ - unsigned long serial; /\&* # of last request processed by server */ - int send_event; /\&* true if this came from a SendEvent request */ - Display *display; /\&* Display the event was read from */ - Multibuffer buffer; /\&* buffer of event */ - int state; /\&* see Clobbered constants above */ -} XmbufClobberNotifyEvent; -.LP -typedef struct { - int type; /\&* of event */ - unsigned long serial; /\&* # of last request processed by server */ - int send_event; /\&* true if this came from a SendEvent request */ - Display *display; /\&* Display the event was read from */ - Multibuffer buffer; /\&* buffer of event */ -} XmbufUpdateNotifyEvent; -.LP -\fIPer-window attributes that can be got:\fP -typedef struct { - int displayed_index; /\&* which buffer is being displayed */ - int update_action; /\&* Undefined, Background, Untouched, Copied */ - int update_hint; /\&* Frequent, Intermittent, Static */ - int window_mode; /\&* Mono, Stereo */ - int nbuffers; /\&* Number of buffers */ - Multibuffer *buffers; /\&* Buffers */ -} XmbufWindowAttributes; -.LP -\fIPer-window attributes that can be set:\fP -typedef struct { - int update_hint; /\&* Frequent, Intermittent, Static */ -} XmbufSetWindowAttributes; -.LP -\fIPer-buffer attributes that can be got:\fP -typedef struct { - Window window; /\&* which window this belongs to */ - unsigned long event_mask; /\&* events that have been selected */ - int buffer_index; /\&* which buffer is this */ - int side; /\&* Mono, Left, Right */ -} XmbufBufferAttributes; -.LP -\fIPer-buffer attributes that can be set:\fP -typedef struct { - unsigned long event_mask; /\&* events that have been selected */ -} XmbufSetBufferAttributes; -.LP -\fIPer-screen buffer info (there will be lists of them):\fP -typedef struct { - VisualID visualid; /\&* visual usable at this depth */ - int max_buffers; /\&* most buffers for this visual */ - int depth; /\&* depth of buffers to be created */ -} XmbufBufferInfo; -.fi -.SH DESCRIPTION -The application programming library for the -\fIX11 Double-Buffering, Multi-Buffering, and Stereo Extension\fP -contains the interfaces described below. -With the exception of -.ZN XmbufQueryExtension , -if any of these routines are -called with a display that does not support the extension, the -ExtensionErrorHandler (which can be set with -.ZN XSetExtensionErrorHandler -and functions the same way as -.ZN XSetErrorHandler ) -will be called and the function will then return. -.PP -.ZN XmbufQueryExtension -returns -.ZN True -if the multibuffering/stereo -extension is available on the -given display. If the extension exists, the value of the first event -code (which should be added to the event type constants -.ZN MultibufferClobberNotify -and -.ZN MultibufferUpdateNotify -to get the actual -values) is stored into event_base_return and the value of the first -error code (which should be added to the error type constant -.ZN MultibufferBadBuffer -to get the actual value) is stored into error_base_return. -.PP -.ZN XmbufGetVersion -gets the major and minor version numbers of the extension. -The return -value is zero if an error occurs or non-zero if no error happens. -.PP -.ZN XmbufCreateBuffers -requests that "count" buffers be -created with the given update_action -and update_hint and be associated with the indicated window. The -number of buffers created is returned (zero if an error occurred) -and buffers_update is filled in with that many Multibuffer identifiers. -.PP -.ZN XmbufDestroyBuffers -destroys the buffers associated -with the given window. -.PP -.ZN XmbufDisplayBuffers -displays the indicated buffers their -appropriate windows within -max_delay milliseconds after min_delay milliseconds have passed. -No two buffers may be associated with the same window or else a Match -error is generated. -.PP -.ZN XmbufGetWindowAttributes -gets the multibuffering attributes that apply -to all buffers associated -with the given window. -The list of buffers returns may be freed with -.ZN XFree . -Returns non-zero on success and zero if an error occurs. -.PP -.ZN XmbufChangeWindowAttributes -sets the multibuffering attributes -that apply to all buffers associated -with the given window. This is currently limited to the update_hint. -.PP -.ZN XmbufGetBufferAttributes -gets the attributes for the indicated buffer. -Returns non-zero on -success and zero if an error occurs. -.PP -.ZN XmbufChangeBufferAttributes -sets the attributes for the indicated buffer. -This is currently limited to the event_mask. -.PP -.ZN XmbufGetScreenInfo -gets the parameters controlling how -mono and stereo windows may be -created on the screen of the given drawable. The numbers of sets of -visual and depths are returned in nmono_return and nstereo_return. If -nmono_return is greater than zero, then mono_info_return is set to the -address of an array of -.ZN XmbufBufferInfo -structures describing the -various visuals and depths that may be used. Otherwise, -mono_info_return is set to NULL. Similarly, stereo_info_return is set -according to nstereo_return. The storage returned in mono_info_return -and stereo_info_return may be released by -.ZN XFree . -If no errors are -encounted, non-zero will be returned. -.PP -.ZN XmbufCreateStereoWindow -creates a stereo window in the same way that -.ZN XCreateWindow -creates a mono window. The buffer ids for the left and right buffers are -returned in left_return and right_return, respectively. If an -extension error handler that returns is installed, -.ZN None -will be returned if the extension is not available on this display. -.SH PREDEFINED VALUES -.sp -Update_action field: -.in +.5i -.nf -.ZN MultibufferUpdateActionUndefined -.ZN MultibufferUpdateActionBackground -.ZN MultibufferUpdateActionUntouched -.ZN MultibufferUpdateActionCopied -.in -.5i -.fi -.sp -Update_hint field: -.in +.5i -.nf -.ZN MultibufferUpdateHintFrequent -.ZN MultibufferUpdateHintIntermittent -.ZN MultibufferUpdateHintStatic -.in -.5i -.sp -.fi -Valuemask fields: -.in +.5i -.nf -.ZN MultibufferWindowUpdateHint -.ZN MultibufferBufferEventMask -.in -.5i -.fi -.sp -Mono vs. stereo and left vs. right: -.in +.5i -.nf -.ZN MultibufferModeMono -.ZN MultibufferModeStereo -.ZN MultibufferSideMono -.ZN MultibufferSideLeft -.ZN MultibufferSideRight -.in -.5i -.fi -.sp -Clobber state: -.in +.5i -.nf -.ZN MultibufferUnclobbered -.ZN MultibufferPartiallyClobbered -.ZN MultibufferFullyClobbered -.in -.5i -.fi -.sp -Event stuff: -.in +.5i -.nf -.ZN MultibufferClobberNotifyMask -.ZN MultibufferUpdateNotifyMask -.ZN MultibufferClobberNotify -.ZN MultibufferUpdateNotify -.ZN MultibufferNumberEvents -.ZN MultibufferBadBuffer -.ZN MultibufferNumberErrors -.in -.5i -.fi -.SH BUGS -This manual page needs more work. -.SH SEE ALSO -\fIExtending X for Double Buffering, Multi-Buffering, and Stereo\fP +.\" Copyright (c) 1989, 1994 X Consortium +.\" +.\" 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 furnished to do so, subject to the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be included in +.\" all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +.\" THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +.\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" SOFTWARE. +.\" +.\" Except as contained in this notice, the name of the X Consortium shall not +.\" be used in advertising or otherwise to promote the sale, use or other +.\" dealing in this Software without prior written authorization from the +.\" X Consortium. +.\" +.\" Copyright 1989, Digital Equipment Corporation. +.\" Permission to use, copy, modify, distribute, and sell this documentation +.\" for any purpose and without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" Digital Equipment Corporation makes no representations +.\" about the suitability for any purpose of the information in +.\" this document. This documentation is provided "as is" +.\" without express or implied warranty. +.\" +.de ZN +.ie t \fB\^\\$1\^\fR\\$2 +.el \fI\^\\$1\^\fP\\$2 +.. +.TH XMBUF __libmansuffix__ __xorgversion__ "X FUNCTIONS" +.SH NAME +XmbufQueryExtension, XmbufGetVersion, XmbufCreateBuffers, XmbufDestroyBuffers, XmbufDisplayBuffers, XmbufGetWindowAttributes, XmbufChangeWindowAttributes, XmbufGetBufferAttributes, XmbufChangeBufferAttributes, XmbufGetScreenInfo, XmbufCreateStereoWindow - X multibuffering functions +.SH SYNTAX +.nf +.LP +\&#include +.LP +Bool XmbufQueryExtension( + Display *dpy, + Display *dpy, + int *event_base_return, + int *error_base_return); +.LP +Status XmbufGetVersion( + Display *dpy, + int *major_version_return, + int *minor_version_return); +.LP +int XmbufCreateBuffers( + Display *dpy, + Window window, + int count, + int update_action, + int update_hint, + Multibuffer *buffers_update); +.LP +void XmbufDestroyBuffers( + Display *dpy, + Window window); +.LP +void XmbufDisplayBuffers( + Display *dpy, + int count, + Multibuffer *buffers, + int min_delay, + int max_delay); +.LP +Status XmbufGetWindowAttributes( + Display *dpy, + Window window, + XmbufWindowAttributes *attributes); +.LP +void XmbufChangeWindowAttributes( + Display *dpy, + Window window, + unsigned long valuemask, + XmbufSetWindowAttributes *attributes); +.LP +Status XmbufGetBufferAttributes( + Display *dpy, + Multibuffer buffer, + XmbufBufferAttributes *attributes); +.LP +void XmbufChangeBufferAttributes( + Display *dpy, + Multibuffer buffer, + unsigned long valuemask, + XmbufSetBufferAttributes *attributes); +.LP +Status XmbufGetScreenInfo( + Display *dpy, + Drawable drawable, + int *nmono_return, + XmbufBufferInfo **mono_info_return, + int *nstereo_return, + XmbufBufferInfo **stereo_info_return); +.LP +Window XmbufCreateStereoWindow( + Display *dpy, + Window parent, + int x, + int y, + unsigned int width, + unsigned int height, + unsigned int border_width, + int depth, + unsigned int class, /\&* InputOutput, InputOnly*/ + Visual *visual, + unsigned long valuemask, + XSetWindowAttributes *attributes, + Multibuffer *left_return, + Multibuffer *right_return); +.fi +.SH STRUCTURES +.nf +.ta 3i +\fIEvents:\fP +typedef struct { + int type; /\&* of event */ + unsigned long serial; /\&* # of last request processed by server */ + int send_event; /\&* true if this came from a SendEvent request */ + Display *display; /\&* Display the event was read from */ + Multibuffer buffer; /\&* buffer of event */ + int state; /\&* see Clobbered constants above */ +} XmbufClobberNotifyEvent; +.LP +typedef struct { + int type; /\&* of event */ + unsigned long serial; /\&* # of last request processed by server */ + int send_event; /\&* true if this came from a SendEvent request */ + Display *display; /\&* Display the event was read from */ + Multibuffer buffer; /\&* buffer of event */ +} XmbufUpdateNotifyEvent; +.LP +\fIPer-window attributes that can be got:\fP +typedef struct { + int displayed_index; /\&* which buffer is being displayed */ + int update_action; /\&* Undefined, Background, Untouched, Copied */ + int update_hint; /\&* Frequent, Intermittent, Static */ + int window_mode; /\&* Mono, Stereo */ + int nbuffers; /\&* Number of buffers */ + Multibuffer *buffers; /\&* Buffers */ +} XmbufWindowAttributes; +.LP +\fIPer-window attributes that can be set:\fP +typedef struct { + int update_hint; /\&* Frequent, Intermittent, Static */ +} XmbufSetWindowAttributes; +.LP +\fIPer-buffer attributes that can be got:\fP +typedef struct { + Window window; /\&* which window this belongs to */ + unsigned long event_mask; /\&* events that have been selected */ + int buffer_index; /\&* which buffer is this */ + int side; /\&* Mono, Left, Right */ +} XmbufBufferAttributes; +.LP +\fIPer-buffer attributes that can be set:\fP +typedef struct { + unsigned long event_mask; /\&* events that have been selected */ +} XmbufSetBufferAttributes; +.LP +\fIPer-screen buffer info (there will be lists of them):\fP +typedef struct { + VisualID visualid; /\&* visual usable at this depth */ + int max_buffers; /\&* most buffers for this visual */ + int depth; /\&* depth of buffers to be created */ +} XmbufBufferInfo; +.fi +.SH DESCRIPTION +The application programming library for the +\fIX11 Double-Buffering, Multi-Buffering, and Stereo Extension\fP +contains the interfaces described below. +With the exception of +.ZN XmbufQueryExtension , +if any of these routines are +called with a display that does not support the extension, the +ExtensionErrorHandler (which can be set with +.ZN XSetExtensionErrorHandler +and functions the same way as +.ZN XSetErrorHandler ) +will be called and the function will then return. +.PP +.ZN XmbufQueryExtension +returns +.ZN True +if the multibuffering/stereo +extension is available on the +given display. If the extension exists, the value of the first event +code (which should be added to the event type constants +.ZN MultibufferClobberNotify +and +.ZN MultibufferUpdateNotify +to get the actual +values) is stored into event_base_return and the value of the first +error code (which should be added to the error type constant +.ZN MultibufferBadBuffer +to get the actual value) is stored into error_base_return. +.PP +.ZN XmbufGetVersion +gets the major and minor version numbers of the extension. +The return +value is zero if an error occurs or non-zero if no error happens. +.PP +.ZN XmbufCreateBuffers +requests that "count" buffers be +created with the given update_action +and update_hint and be associated with the indicated window. The +number of buffers created is returned (zero if an error occurred) +and buffers_update is filled in with that many Multibuffer identifiers. +.PP +.ZN XmbufDestroyBuffers +destroys the buffers associated +with the given window. +.PP +.ZN XmbufDisplayBuffers +displays the indicated buffers their +appropriate windows within +max_delay milliseconds after min_delay milliseconds have passed. +No two buffers may be associated with the same window or else a Match +error is generated. +.PP +.ZN XmbufGetWindowAttributes +gets the multibuffering attributes that apply +to all buffers associated +with the given window. +The list of buffers returns may be freed with +.ZN XFree . +Returns non-zero on success and zero if an error occurs. +.PP +.ZN XmbufChangeWindowAttributes +sets the multibuffering attributes +that apply to all buffers associated +with the given window. This is currently limited to the update_hint. +.PP +.ZN XmbufGetBufferAttributes +gets the attributes for the indicated buffer. +Returns non-zero on +success and zero if an error occurs. +.PP +.ZN XmbufChangeBufferAttributes +sets the attributes for the indicated buffer. +This is currently limited to the event_mask. +.PP +.ZN XmbufGetScreenInfo +gets the parameters controlling how +mono and stereo windows may be +created on the screen of the given drawable. The numbers of sets of +visual and depths are returned in nmono_return and nstereo_return. If +nmono_return is greater than zero, then mono_info_return is set to the +address of an array of +.ZN XmbufBufferInfo +structures describing the +various visuals and depths that may be used. Otherwise, +mono_info_return is set to NULL. Similarly, stereo_info_return is set +according to nstereo_return. The storage returned in mono_info_return +and stereo_info_return may be released by +.ZN XFree . +If no errors are +encounted, non-zero will be returned. +.PP +.ZN XmbufCreateStereoWindow +creates a stereo window in the same way that +.ZN XCreateWindow +creates a mono window. The buffer ids for the left and right buffers are +returned in left_return and right_return, respectively. If an +extension error handler that returns is installed, +.ZN None +will be returned if the extension is not available on this display. +.SH PREDEFINED VALUES +.sp +Update_action field: +.in +.5i +.nf +.ZN MultibufferUpdateActionUndefined +.ZN MultibufferUpdateActionBackground +.ZN MultibufferUpdateActionUntouched +.ZN MultibufferUpdateActionCopied +.in -.5i +.fi +.sp +Update_hint field: +.in +.5i +.nf +.ZN MultibufferUpdateHintFrequent +.ZN MultibufferUpdateHintIntermittent +.ZN MultibufferUpdateHintStatic +.in -.5i +.sp +.fi +Valuemask fields: +.in +.5i +.nf +.ZN MultibufferWindowUpdateHint +.ZN MultibufferBufferEventMask +.in -.5i +.fi +.sp +Mono vs. stereo and left vs. right: +.in +.5i +.nf +.ZN MultibufferModeMono +.ZN MultibufferModeStereo +.ZN MultibufferSideMono +.ZN MultibufferSideLeft +.ZN MultibufferSideRight +.in -.5i +.fi +.sp +Clobber state: +.in +.5i +.nf +.ZN MultibufferUnclobbered +.ZN MultibufferPartiallyClobbered +.ZN MultibufferFullyClobbered +.in -.5i +.fi +.sp +Event stuff: +.in +.5i +.nf +.ZN MultibufferClobberNotifyMask +.ZN MultibufferUpdateNotifyMask +.ZN MultibufferClobberNotify +.ZN MultibufferUpdateNotify +.ZN MultibufferNumberEvents +.ZN MultibufferBadBuffer +.ZN MultibufferNumberErrors +.in -.5i +.fi +.SH BUGS +This manual page needs more work. +.SH SEE ALSO +\fIExtending X for Double Buffering, Multi-Buffering, and Stereo\fP diff --git a/libXext/specs/dbelib.xml b/libXext/specs/dbelib.xml index c642a511f..d3616fc36 100644 --- a/libXext/specs/dbelib.xml +++ b/libXext/specs/dbelib.xml @@ -24,11 +24,22 @@ DavidP.Wiggins X Consortium, Inc - 1989X Consortium, Inc and Digital Equipment Corporation - 1992X Consortium, Inc and Intergraph Corporation - 1993X Consortium, Inc and Silicon Graphics, Inc. - 1994X Consortium, Inc and Hewlett-Packard Company - 1995X Consortium, Inc and Hewlett-Packard Company + 1989 + X Consortium Inc + Digital Equipment Corporation + + 1992 + X Consortium Inc + Intergraph Corporation + + 1993 + X Consortium Inc + Silicon Graphics, Inc. + + 19941995 + X Consortium Inc + Hewlett-Packard Company + diff --git a/libXext/src/DPMS.c b/libXext/src/DPMS.c index c6d0adac6..07818a07e 100644 --- a/libXext/src/DPMS.c +++ b/libXext/src/DPMS.c @@ -1,290 +1,290 @@ -/***************************************************************** - -Copyright (c) 1996 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. - -******************************************************************/ - -/* - * HISTORY - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include - -static XExtensionInfo _dpms_info_data; -static XExtensionInfo *dpms_info = &_dpms_info_data; -static char *dpms_extension_name = DPMSExtensionName; - -#define DPMSCheckExtension(dpy,i,val) \ - XextCheckExtension (dpy, i, dpms_extension_name, val) - -/***************************************************************************** - * * - * private utility routines * - * * - *****************************************************************************/ - -static int close_display(Display *dpy, XExtCodes *codes); -static /* const */ XExtensionHooks dpms_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, dpms_info, - dpms_extension_name, - &dpms_extension_hooks, DPMSNumberEvents, - NULL) - -static XEXT_GENERATE_CLOSE_DISPLAY (close_display, dpms_info) - -/***************************************************************************** - * * - * public routines * - * * - *****************************************************************************/ - -Bool -DPMSQueryExtension (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; - } -} - -Status -DPMSGetVersion(Display *dpy, int *major_versionp, int *minor_versionp) -{ - XExtDisplayInfo *info = find_display (dpy); - xDPMSGetVersionReply rep; - register xDPMSGetVersionReq *req; - - DPMSCheckExtension (dpy, info, 0); - - LockDisplay (dpy); - GetReq (DPMSGetVersion, req); - req->reqType = info->codes->major_opcode; - req->dpmsReqType = X_DPMSGetVersion; - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay (dpy); - SyncHandle (); - return 0; - } - *major_versionp = rep.majorVersion; - *minor_versionp = rep.minorVersion; - UnlockDisplay (dpy); - SyncHandle (); - return 1; -} - -Bool -DPMSCapable(Display *dpy) -{ - XExtDisplayInfo *info = find_display (dpy); - register xDPMSCapableReq *req; - xDPMSCapableReply rep; - - DPMSCheckExtension (dpy, info, 0); - - LockDisplay(dpy); - GetReq(DPMSCapable, req); - req->reqType = info->codes->major_opcode; - req->dpmsReqType = X_DPMSCapable; - - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - UnlockDisplay(dpy); - SyncHandle(); - return rep.capable; -} - -Status -DPMSSetTimeouts(Display *dpy, CARD16 standby, CARD16 suspend, CARD16 off) -{ - XExtDisplayInfo *info = find_display (dpy); - register xDPMSSetTimeoutsReq *req; - - if ((off != 0)&&(off < suspend)) - { - return BadValue; - } - if ((suspend != 0)&&(suspend < standby)) - { - return BadValue; - } - - DPMSCheckExtension (dpy, info, 0); - LockDisplay(dpy); - GetReq(DPMSSetTimeouts, req); - req->reqType = info->codes->major_opcode; - req->dpmsReqType = X_DPMSSetTimeouts; - req->standby = standby; - req->suspend = suspend; - req->off = off; - - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - -Bool -DPMSGetTimeouts(Display *dpy, CARD16 *standby, CARD16 *suspend, CARD16 *off) -{ - XExtDisplayInfo *info = find_display (dpy); - register xDPMSGetTimeoutsReq *req; - xDPMSGetTimeoutsReply rep; - - DPMSCheckExtension (dpy, info, 0); - - LockDisplay(dpy); - GetReq(DPMSGetTimeouts, req); - req->reqType = info->codes->major_opcode; - req->dpmsReqType = X_DPMSGetTimeouts; - - if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - UnlockDisplay(dpy); - SyncHandle(); - *standby = rep.standby; - *suspend = rep.suspend; - *off = rep.off; - return 1; -} - -Status -DPMSEnable(Display *dpy) -{ - XExtDisplayInfo *info = find_display (dpy); - register xDPMSEnableReq *req; - - DPMSCheckExtension (dpy, info, 0); - LockDisplay(dpy); - GetReq(DPMSEnable, req); - req->reqType = info->codes->major_opcode; - req->dpmsReqType = X_DPMSEnable; - - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - -Status -DPMSDisable(Display *dpy) -{ - XExtDisplayInfo *info = find_display (dpy); - register xDPMSDisableReq *req; - - DPMSCheckExtension (dpy, info, 0); - LockDisplay(dpy); - GetReq(DPMSDisable, req); - req->reqType = info->codes->major_opcode; - req->dpmsReqType = X_DPMSDisable; - - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - - -Status -DPMSForceLevel(Display *dpy, CARD16 level) -{ - XExtDisplayInfo *info = find_display (dpy); - register xDPMSForceLevelReq *req; - - DPMSCheckExtension (dpy, info, 0); - - if ((level != DPMSModeOn) && - (level != DPMSModeStandby) && - (level != DPMSModeSuspend) && - (level != DPMSModeOff)) - return BadValue; - - LockDisplay(dpy); - GetReq(DPMSForceLevel, req); - req->reqType = info->codes->major_opcode; - req->dpmsReqType = X_DPMSForceLevel; - req->level = level; - - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - -Status -DPMSInfo(Display *dpy, CARD16 *power_level, BOOL *state) -{ - XExtDisplayInfo *info = find_display (dpy); - register xDPMSInfoReq *req; - xDPMSInfoReply rep; - - DPMSCheckExtension (dpy, info, 0); - - LockDisplay(dpy); - GetReq(DPMSInfo, req); - req->reqType = info->codes->major_opcode; - req->dpmsReqType = X_DPMSInfo; - - if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - UnlockDisplay(dpy); - SyncHandle(); - *power_level = rep.power_level; - *state = rep.state; - return 1; -} - - - +/***************************************************************** + +Copyright (c) 1996 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. + +******************************************************************/ + +/* + * HISTORY + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include +#include + +static XExtensionInfo _dpms_info_data; +static XExtensionInfo *dpms_info = &_dpms_info_data; +static char *dpms_extension_name = DPMSExtensionName; + +#define DPMSCheckExtension(dpy,i,val) \ + XextCheckExtension (dpy, i, dpms_extension_name, val) + +/***************************************************************************** + * * + * private utility routines * + * * + *****************************************************************************/ + +static int close_display(Display *dpy, XExtCodes *codes); +static /* const */ XExtensionHooks dpms_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, dpms_info, + dpms_extension_name, + &dpms_extension_hooks, DPMSNumberEvents, + NULL) + +static XEXT_GENERATE_CLOSE_DISPLAY (close_display, dpms_info) + +/***************************************************************************** + * * + * public routines * + * * + *****************************************************************************/ + +Bool +DPMSQueryExtension (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; + } +} + +Status +DPMSGetVersion(Display *dpy, int *major_versionp, int *minor_versionp) +{ + XExtDisplayInfo *info = find_display (dpy); + xDPMSGetVersionReply rep; + register xDPMSGetVersionReq *req; + + DPMSCheckExtension (dpy, info, 0); + + LockDisplay (dpy); + GetReq (DPMSGetVersion, req); + req->reqType = info->codes->major_opcode; + req->dpmsReqType = X_DPMSGetVersion; + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return 0; + } + *major_versionp = rep.majorVersion; + *minor_versionp = rep.minorVersion; + UnlockDisplay (dpy); + SyncHandle (); + return 1; +} + +Bool +DPMSCapable(Display *dpy) +{ + XExtDisplayInfo *info = find_display (dpy); + register xDPMSCapableReq *req; + xDPMSCapableReply rep; + + DPMSCheckExtension (dpy, info, 0); + + LockDisplay(dpy); + GetReq(DPMSCapable, req); + req->reqType = info->codes->major_opcode; + req->dpmsReqType = X_DPMSCapable; + + if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + UnlockDisplay(dpy); + SyncHandle(); + return rep.capable; +} + +Status +DPMSSetTimeouts(Display *dpy, CARD16 standby, CARD16 suspend, CARD16 off) +{ + XExtDisplayInfo *info = find_display (dpy); + register xDPMSSetTimeoutsReq *req; + + if ((off != 0)&&(off < suspend)) + { + return BadValue; + } + if ((suspend != 0)&&(suspend < standby)) + { + return BadValue; + } + + DPMSCheckExtension (dpy, info, 0); + LockDisplay(dpy); + GetReq(DPMSSetTimeouts, req); + req->reqType = info->codes->major_opcode; + req->dpmsReqType = X_DPMSSetTimeouts; + req->standby = standby; + req->suspend = suspend; + req->off = off; + + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + +Bool +DPMSGetTimeouts(Display *dpy, CARD16 *standby, CARD16 *suspend, CARD16 *off) +{ + XExtDisplayInfo *info = find_display (dpy); + register xDPMSGetTimeoutsReq *req; + xDPMSGetTimeoutsReply rep; + + DPMSCheckExtension (dpy, info, 0); + + LockDisplay(dpy); + GetReq(DPMSGetTimeouts, req); + req->reqType = info->codes->major_opcode; + req->dpmsReqType = X_DPMSGetTimeouts; + + if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + UnlockDisplay(dpy); + SyncHandle(); + *standby = rep.standby; + *suspend = rep.suspend; + *off = rep.off; + return 1; +} + +Status +DPMSEnable(Display *dpy) +{ + XExtDisplayInfo *info = find_display (dpy); + register xDPMSEnableReq *req; + + DPMSCheckExtension (dpy, info, 0); + LockDisplay(dpy); + GetReq(DPMSEnable, req); + req->reqType = info->codes->major_opcode; + req->dpmsReqType = X_DPMSEnable; + + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + +Status +DPMSDisable(Display *dpy) +{ + XExtDisplayInfo *info = find_display (dpy); + register xDPMSDisableReq *req; + + DPMSCheckExtension (dpy, info, 0); + LockDisplay(dpy); + GetReq(DPMSDisable, req); + req->reqType = info->codes->major_opcode; + req->dpmsReqType = X_DPMSDisable; + + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + + +Status +DPMSForceLevel(Display *dpy, CARD16 level) +{ + XExtDisplayInfo *info = find_display (dpy); + register xDPMSForceLevelReq *req; + + DPMSCheckExtension (dpy, info, 0); + + if ((level != DPMSModeOn) && + (level != DPMSModeStandby) && + (level != DPMSModeSuspend) && + (level != DPMSModeOff)) + return BadValue; + + LockDisplay(dpy); + GetReq(DPMSForceLevel, req); + req->reqType = info->codes->major_opcode; + req->dpmsReqType = X_DPMSForceLevel; + req->level = level; + + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + +Status +DPMSInfo(Display *dpy, CARD16 *power_level, BOOL *state) +{ + XExtDisplayInfo *info = find_display (dpy); + register xDPMSInfoReq *req; + xDPMSInfoReply rep; + + DPMSCheckExtension (dpy, info, 0); + + LockDisplay(dpy); + GetReq(DPMSInfo, req); + req->reqType = info->codes->major_opcode; + req->dpmsReqType = X_DPMSInfo; + + if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + UnlockDisplay(dpy); + SyncHandle(); + *power_level = rep.power_level; + *state = rep.state; + return 1; +} + + + diff --git a/libXext/src/MITMisc.c b/libXext/src/MITMisc.c index 20d1157cb..bc452dba7 100644 --- a/libXext/src/MITMisc.c +++ b/libXext/src/MITMisc.c @@ -1,130 +1,130 @@ -/* - * -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - */ - -/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM BLESSING */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include - -static XExtensionInfo _mit_info_data; -static XExtensionInfo *mit_info = &_mit_info_data; -static /* const */ char *mit_extension_name = MITMISCNAME; - -#define MITCheckExtension(dpy,i,val) \ - XextCheckExtension (dpy, i, mit_extension_name, val) - -/***************************************************************************** - * * - * private utility routines * - * * - *****************************************************************************/ - -static int close_display(Display *dpy, XExtCodes *codes); -static /* const */ XExtensionHooks mit_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, mit_info, mit_extension_name, - &mit_extension_hooks, MITMiscNumberEvents, - NULL) - -static XEXT_GENERATE_CLOSE_DISPLAY (close_display, mit_info) - - -/***************************************************************************** - * * - * public routines * - * * - *****************************************************************************/ - -Bool XMITMiscQueryExtension (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; - } -} - - -Status XMITMiscSetBugMode(Display *dpy, Bool onOff) -{ - XExtDisplayInfo *info = find_display (dpy); - register xMITSetBugModeReq *req; - - MITCheckExtension (dpy, info, 0); - - LockDisplay(dpy); - GetReq(MITSetBugMode, req); - req->reqType = info->codes->major_opcode; - req->mitReqType = X_MITSetBugMode; - req->onOff = onOff; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - -Bool XMITMiscGetBugMode(Display *dpy) -{ - XExtDisplayInfo *info = find_display (dpy); - register xMITGetBugModeReq *req; - xMITGetBugModeReply rep; - - MITCheckExtension (dpy, info, 0); - - LockDisplay(dpy); - GetReq(MITGetBugMode, req); - req->reqType = info->codes->major_opcode; - req->mitReqType = X_MITGetBugMode; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - UnlockDisplay(dpy); - SyncHandle(); - return rep.onOff; -} +/* + * +Copyright 1989, 1998 The Open Group + +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + * + */ + +/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM BLESSING */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include + +static XExtensionInfo _mit_info_data; +static XExtensionInfo *mit_info = &_mit_info_data; +static /* const */ char *mit_extension_name = MITMISCNAME; + +#define MITCheckExtension(dpy,i,val) \ + XextCheckExtension (dpy, i, mit_extension_name, val) + +/***************************************************************************** + * * + * private utility routines * + * * + *****************************************************************************/ + +static int close_display(Display *dpy, XExtCodes *codes); +static /* const */ XExtensionHooks mit_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, mit_info, mit_extension_name, + &mit_extension_hooks, MITMiscNumberEvents, + NULL) + +static XEXT_GENERATE_CLOSE_DISPLAY (close_display, mit_info) + + +/***************************************************************************** + * * + * public routines * + * * + *****************************************************************************/ + +Bool XMITMiscQueryExtension (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; + } +} + + +Status XMITMiscSetBugMode(Display *dpy, Bool onOff) +{ + XExtDisplayInfo *info = find_display (dpy); + register xMITSetBugModeReq *req; + + MITCheckExtension (dpy, info, 0); + + LockDisplay(dpy); + GetReq(MITSetBugMode, req); + req->reqType = info->codes->major_opcode; + req->mitReqType = X_MITSetBugMode; + req->onOff = onOff; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + +Bool XMITMiscGetBugMode(Display *dpy) +{ + XExtDisplayInfo *info = find_display (dpy); + register xMITGetBugModeReq *req; + xMITGetBugModeReply rep; + + MITCheckExtension (dpy, info, 0); + + LockDisplay(dpy); + GetReq(MITGetBugMode, req); + req->reqType = info->codes->major_opcode; + req->mitReqType = X_MITGetBugMode; + if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + UnlockDisplay(dpy); + SyncHandle(); + return rep.onOff; +} diff --git a/libXext/src/Makefile.am b/libXext/src/Makefile.am index 62a766263..e236c3345 100644 --- a/libXext/src/Makefile.am +++ b/libXext/src/Makefile.am @@ -1,65 +1,65 @@ -lib_LTLIBRARIES=libXext.la - -AM_CPPFLAGS=\ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/include/X11/extensions\ - $(XEXT_CFLAGS) $(MALLOC_ZERO_CFLAGS) - -AM_CFLAGS=$(CWARNFLAGS) - -libXext_la_LDFLAGS = -version-number $(XEXT_SOREV) -no-undefined - -libXext_la_LIBADD = $(XEXT_LIBS) - -libXext_la_SOURCES = \ - DPMS.c \ - MITMisc.c \ - XAppgroup.c \ - XEVI.c \ - XLbx.c \ - XMultibuf.c \ - XSecurity.c \ - XShape.c \ - XShm.c \ - XSync.c \ - XTestExt1.c \ - Xcup.c \ - Xdbe.c \ - Xge.c \ - extutil.c \ - globals.c - -libXextincludedir = $(includedir)/X11/extensions -libXextinclude_HEADERS = $(top_srcdir)/include/X11/extensions/dpms.h \ - $(top_srcdir)/include/X11/extensions/extutil.h \ - $(top_srcdir)/include/X11/extensions/MITMisc.h \ - $(top_srcdir)/include/X11/extensions/multibuf.h \ - $(top_srcdir)/include/X11/extensions/security.h \ - $(top_srcdir)/include/X11/extensions/shape.h \ - $(top_srcdir)/include/X11/extensions/sync.h \ - $(top_srcdir)/include/X11/extensions/Xag.h \ - $(top_srcdir)/include/X11/extensions/Xcup.h \ - $(top_srcdir)/include/X11/extensions/Xdbe.h \ - $(top_srcdir)/include/X11/extensions/XEVI.h \ - $(top_srcdir)/include/X11/extensions/Xext.h \ - $(top_srcdir)/include/X11/extensions/Xge.h \ - $(top_srcdir)/include/X11/extensions/XLbx.h \ - $(top_srcdir)/include/X11/extensions/XShm.h \ - $(top_srcdir)/include/X11/extensions/xtestext1.h - -if LINT -ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) - -lint: - $(LINT) $(ALL_LINT_FLAGS) $(libXext_la_SOURCES) $(XEXT_LIBS) -endif LINT - -if MAKE_LINT_LIB -lintlibdir = $(libdir) - -lintlib_DATA = $(LINTLIB) - -$(LINTLIB): $(libXext_la_SOURCES) - $(LINT) -y -oXext -x $(ALL_LINT_FLAGS) $(libXext_la_SOURCES) -endif MAKE_LINT_LIB +lib_LTLIBRARIES=libXext.la + +AM_CPPFLAGS=\ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/include/X11/extensions\ + $(XEXT_CFLAGS) $(MALLOC_ZERO_CFLAGS) + +AM_CFLAGS=$(CWARNFLAGS) + +libXext_la_LDFLAGS = -version-number $(XEXT_SOREV) -no-undefined + +libXext_la_LIBADD = $(XEXT_LIBS) + +libXext_la_SOURCES = \ + DPMS.c \ + MITMisc.c \ + XAppgroup.c \ + XEVI.c \ + XLbx.c \ + XMultibuf.c \ + XSecurity.c \ + XShape.c \ + XShm.c \ + XSync.c \ + XTestExt1.c \ + Xcup.c \ + Xdbe.c \ + Xge.c \ + extutil.c \ + globals.c + +libXextincludedir = $(includedir)/X11/extensions +libXextinclude_HEADERS = $(top_srcdir)/include/X11/extensions/dpms.h \ + $(top_srcdir)/include/X11/extensions/extutil.h \ + $(top_srcdir)/include/X11/extensions/MITMisc.h \ + $(top_srcdir)/include/X11/extensions/multibuf.h \ + $(top_srcdir)/include/X11/extensions/security.h \ + $(top_srcdir)/include/X11/extensions/shape.h \ + $(top_srcdir)/include/X11/extensions/sync.h \ + $(top_srcdir)/include/X11/extensions/Xag.h \ + $(top_srcdir)/include/X11/extensions/Xcup.h \ + $(top_srcdir)/include/X11/extensions/Xdbe.h \ + $(top_srcdir)/include/X11/extensions/XEVI.h \ + $(top_srcdir)/include/X11/extensions/Xext.h \ + $(top_srcdir)/include/X11/extensions/Xge.h \ + $(top_srcdir)/include/X11/extensions/XLbx.h \ + $(top_srcdir)/include/X11/extensions/XShm.h \ + $(top_srcdir)/include/X11/extensions/xtestext1.h + +if LINT +ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) + +lint: + $(LINT) $(ALL_LINT_FLAGS) $(libXext_la_SOURCES) $(XEXT_LIBS) +endif LINT + +if MAKE_LINT_LIB +lintlibdir = $(libdir) + +lintlib_DATA = $(LINTLIB) + +$(LINTLIB): $(libXext_la_SOURCES) + $(LINT) -y -oXext -x $(ALL_LINT_FLAGS) $(libXext_la_SOURCES) +endif MAKE_LINT_LIB diff --git a/libXext/src/XAppgroup.c b/libXext/src/XAppgroup.c index 2d3edf35f..16650b6a9 100644 --- a/libXext/src/XAppgroup.c +++ b/libXext/src/XAppgroup.c @@ -1,388 +1,388 @@ -/* - -Copyright 1996, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#ifdef WIN32 -#include -#endif - -#include -#include -#include -#include -#include - -#include - -struct xagstuff { - int attrib_mask; - Bool app_group_leader; - Bool single_screen; - Window default_root; - VisualID root_visual; - Colormap default_colormap; - unsigned long black_pixel; - unsigned long white_pixel; -}; - -static XExtensionInfo _xag_info_data; -static XExtensionInfo *xag_info = &_xag_info_data; -static char *xag_extension_name = XAGNAME; - -#define XagCheckExtension(dpy,i,val) \ - XextCheckExtension (dpy, i, xag_extension_name, val) - -/***************************************************************************** - * * - * private utility routines * - * * - *****************************************************************************/ - -static int close_display(Display *dpy, XExtCodes *codes); -static /* const */ XExtensionHooks xag_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, xag_info, - xag_extension_name, - &xag_extension_hooks, - 0, NULL) - -static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xag_info) - - -/***************************************************************************** - * * - * public Xag Extension routines * - * * - *****************************************************************************/ - -Bool -XagQueryVersion( - Display *dpy, - int *major_version_return, - int *minor_version_return) -{ - XExtDisplayInfo *info = find_display (dpy); - xXagQueryVersionReply rep; - xXagQueryVersionReq *req; - - XagCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(XagQueryVersion, req); - req->reqType = info->codes->major_opcode; - req->xagReqType = X_XagQueryVersion; - req->client_major_version = XAG_MAJOR_VERSION; - req->client_minor_version = XAG_MINOR_VERSION; - if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - *major_version_return = rep.server_major_version; - *minor_version_return = rep.server_minor_version; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -static void -StuffToWire (Display *dpy, struct xagstuff *stuff, xXagCreateReq *req) -{ - unsigned long values[8]; - unsigned long* value = values; - unsigned int nvalues; - - /* the order these are in is important */ - if (stuff->attrib_mask & XagSingleScreenMask) - *value++ = stuff->single_screen; - - if (stuff->attrib_mask & XagDefaultRootMask) - *value++ = stuff->default_root; - - if (stuff->attrib_mask & XagRootVisualMask) - *value++ = stuff->root_visual; - - if (stuff->attrib_mask & XagDefaultColormapMask) - *value++ = stuff->default_colormap; - - if (stuff->attrib_mask & XagBlackPixelMask) - *value++ = stuff->black_pixel; - - if (stuff->attrib_mask & XagWhitePixelMask) - *value++ = stuff->white_pixel; - - if (stuff->attrib_mask & XagAppGroupLeaderMask) - *value++ = stuff->app_group_leader; - - req->length += (nvalues = value - values); - - nvalues <<= 2; - Data32 (dpy, (long*) values, (long) nvalues); -} - -Bool -XagCreateEmbeddedApplicationGroup( - Display* dpy, - VisualID root_visual, - Colormap default_colormap, - unsigned long black_pixel, - unsigned long white_pixel, - XAppGroup* app_group_return) -{ - XExtDisplayInfo *info = find_display (dpy); - xXagCreateReq *req; - struct xagstuff stuff; - - XagCheckExtension (dpy, info, False); - - LockDisplay(dpy); - stuff.app_group_leader = True; - stuff.single_screen = True; - stuff.default_root = RootWindow (dpy, DefaultScreen(dpy)); - stuff.root_visual = root_visual; - stuff.default_colormap = default_colormap; - stuff.attrib_mask = - XagAppGroupLeaderMask | XagSingleScreenMask | XagDefaultRootMask | - XagRootVisualMask | XagDefaultColormapMask; - if (default_colormap != None) { - stuff.black_pixel = black_pixel; - stuff.white_pixel = white_pixel; - stuff.attrib_mask |= XagBlackPixelMask | XagWhitePixelMask; - } - /* might do some validation here */ - GetReq(XagCreate, req); - req->reqType = info->codes->major_opcode; - req->xagReqType = X_XagCreate; - *app_group_return = req->app_group = XAllocID(dpy); - req->attrib_mask = stuff.attrib_mask; - StuffToWire (dpy, &stuff, req); - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XagCreateNonembeddedApplicationGroup( - Display* dpy, - XAppGroup* app_group_return) -{ - XExtDisplayInfo *info = find_display (dpy); - xXagCreateReq *req; - struct xagstuff stuff; - - XagCheckExtension (dpy, info, False); - - LockDisplay(dpy); - stuff.app_group_leader = False; - stuff.single_screen = False; - stuff.attrib_mask = XagAppGroupLeaderMask | XagSingleScreenMask; - /* might do some validation here */ - GetReq(XagCreate, req); - req->reqType = info->codes->major_opcode; - req->xagReqType = X_XagCreate; - *app_group_return = req->app_group = XAllocID(dpy); - req->attrib_mask = stuff.attrib_mask; - StuffToWire (dpy, &stuff, req); - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool XagDestroyApplicationGroup(Display* dpy, XAppGroup app_group) -{ - XExtDisplayInfo *info = find_display (dpy); - xXagDestroyReq *req; - - XagCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(XagDestroy, req); - req->reqType = info->codes->major_opcode; - req->xagReqType = X_XagDestroy; - req->app_group = app_group; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XagGetApplicationGroupAttributes(Display* dpy, XAppGroup app_group, ...) -{ - va_list var; - XExtDisplayInfo *info = find_display (dpy); - xXagGetAttrReq *req; - xXagGetAttrReply rep; - int attr; - - XagCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(XagGetAttr, req); - req->reqType = info->codes->major_opcode; - req->xagReqType = X_XagGetAttr; - req->app_group = app_group; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - va_start (var, app_group); - for (attr = va_arg(var, int); attr != 0; attr = va_arg(var, int)) { - void* ptr; - - switch (attr) { - case XagNappGroupLeader: - ptr = va_arg(var, void*); - *(Bool*)ptr = rep.app_group_leader; - break; - case XagNsingleScreen: - ptr = va_arg(var, void*); - *(Bool*)ptr = rep.single_screen; - break; - case XagNdefaultRoot: - ptr = va_arg(var, void*); - *(Window*)ptr = rep.default_root; - break; - case XagNrootVisual: - ptr = va_arg(var, void*); - *(VisualID*)ptr = rep.root_visual; - break; - case XagNdefaultColormap: - ptr = va_arg(var, void*); - *(Colormap*)ptr = rep.default_colormap; - break; - case XagNblackPixel: - ptr = va_arg(var, void*); - *(unsigned long*)ptr = rep.black_pixel; - break; - case XagNwhitePixel: - ptr = va_arg(var, void*); - *(unsigned long*)ptr = rep.white_pixel; - break; - } - } - va_end (var); - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XagQueryApplicationGroup( - Display* dpy, - XID resource, - XAppGroup* app_group_return) -{ - XExtDisplayInfo *info = find_display (dpy); - xXagQueryReq *req; - xXagQueryReply rep; - - XagCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(XagQuery, req); - req->reqType = info->codes->major_opcode; - req->xagReqType = X_XagQuery; - req->resource = resource; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - *app_group_return = rep.app_group; - UnlockDisplay(dpy); - SyncHandle(); - return True; - -} - -Bool -XagCreateAssociation(Display* dpy, Window* window_return, void* system_window) -{ -#ifdef WIN32 - long tmp = *(HWND*) system_window; - XExtDisplayInfo *info = find_display (dpy); - xXagCreateAssocReq *req; - - XagCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(XagCreateAssoc, req); - req->reqType = info->codes->major_opcode; - req->xagReqType = X_XagCreateAssoc; - *window_return = req->window = XAllocID(dpy); - req->window_type = XagWindowTypeWin32; - req->system_window_len = sizeof(HWND); - Data32 (dpy, (long*) tmp, 1L); - req->length++; - UnlockDisplay(dpy); - SyncHandle(); -#else - /* other platforms go here */ - - /* this whole thing could be arranged better, but since X need - * only short-circuit the protocol and WIN32 is the only other - * platform the XC supports, it will suffice for now. - */ - *window_return = *(Window*)system_window; -#endif - return True; -} - -Bool -XagDestroyAssociation(Display* dpy, Window window) -{ -#ifdef WIN32 - XExtDisplayInfo *info = find_display (dpy); - xXagDestroyAssocReq *req; - - XagCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(XagDestroyAssoc, req); - req->reqType = info->codes->major_opcode; - req->xagReqType = X_XagDestroyAssoc; - req->window = window; - UnlockDisplay(dpy); - SyncHandle(); -#endif - return True; -} - +/* + +Copyright 1996, 1998 The Open Group + +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#ifdef WIN32 +#include +#endif + +#include +#include +#include +#include +#include + +#include + +struct xagstuff { + int attrib_mask; + Bool app_group_leader; + Bool single_screen; + Window default_root; + VisualID root_visual; + Colormap default_colormap; + unsigned long black_pixel; + unsigned long white_pixel; +}; + +static XExtensionInfo _xag_info_data; +static XExtensionInfo *xag_info = &_xag_info_data; +static char *xag_extension_name = XAGNAME; + +#define XagCheckExtension(dpy,i,val) \ + XextCheckExtension (dpy, i, xag_extension_name, val) + +/***************************************************************************** + * * + * private utility routines * + * * + *****************************************************************************/ + +static int close_display(Display *dpy, XExtCodes *codes); +static /* const */ XExtensionHooks xag_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, xag_info, + xag_extension_name, + &xag_extension_hooks, + 0, NULL) + +static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xag_info) + + +/***************************************************************************** + * * + * public Xag Extension routines * + * * + *****************************************************************************/ + +Bool +XagQueryVersion( + Display *dpy, + int *major_version_return, + int *minor_version_return) +{ + XExtDisplayInfo *info = find_display (dpy); + xXagQueryVersionReply rep; + xXagQueryVersionReq *req; + + XagCheckExtension (dpy, info, False); + + LockDisplay(dpy); + GetReq(XagQueryVersion, req); + req->reqType = info->codes->major_opcode; + req->xagReqType = X_XagQueryVersion; + req->client_major_version = XAG_MAJOR_VERSION; + req->client_minor_version = XAG_MINOR_VERSION; + if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + *major_version_return = rep.server_major_version; + *minor_version_return = rep.server_minor_version; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +static void +StuffToWire (Display *dpy, struct xagstuff *stuff, xXagCreateReq *req) +{ + unsigned long values[8]; + unsigned long* value = values; + unsigned int nvalues; + + /* the order these are in is important */ + if (stuff->attrib_mask & XagSingleScreenMask) + *value++ = stuff->single_screen; + + if (stuff->attrib_mask & XagDefaultRootMask) + *value++ = stuff->default_root; + + if (stuff->attrib_mask & XagRootVisualMask) + *value++ = stuff->root_visual; + + if (stuff->attrib_mask & XagDefaultColormapMask) + *value++ = stuff->default_colormap; + + if (stuff->attrib_mask & XagBlackPixelMask) + *value++ = stuff->black_pixel; + + if (stuff->attrib_mask & XagWhitePixelMask) + *value++ = stuff->white_pixel; + + if (stuff->attrib_mask & XagAppGroupLeaderMask) + *value++ = stuff->app_group_leader; + + req->length += (nvalues = value - values); + + nvalues <<= 2; + Data32 (dpy, (long*) values, (long) nvalues); +} + +Bool +XagCreateEmbeddedApplicationGroup( + Display* dpy, + VisualID root_visual, + Colormap default_colormap, + unsigned long black_pixel, + unsigned long white_pixel, + XAppGroup* app_group_return) +{ + XExtDisplayInfo *info = find_display (dpy); + xXagCreateReq *req; + struct xagstuff stuff; + + XagCheckExtension (dpy, info, False); + + LockDisplay(dpy); + stuff.app_group_leader = True; + stuff.single_screen = True; + stuff.default_root = RootWindow (dpy, DefaultScreen(dpy)); + stuff.root_visual = root_visual; + stuff.default_colormap = default_colormap; + stuff.attrib_mask = + XagAppGroupLeaderMask | XagSingleScreenMask | XagDefaultRootMask | + XagRootVisualMask | XagDefaultColormapMask; + if (default_colormap != None) { + stuff.black_pixel = black_pixel; + stuff.white_pixel = white_pixel; + stuff.attrib_mask |= XagBlackPixelMask | XagWhitePixelMask; + } + /* might do some validation here */ + GetReq(XagCreate, req); + req->reqType = info->codes->major_opcode; + req->xagReqType = X_XagCreate; + *app_group_return = req->app_group = XAllocID(dpy); + req->attrib_mask = stuff.attrib_mask; + StuffToWire (dpy, &stuff, req); + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XagCreateNonembeddedApplicationGroup( + Display* dpy, + XAppGroup* app_group_return) +{ + XExtDisplayInfo *info = find_display (dpy); + xXagCreateReq *req; + struct xagstuff stuff; + + XagCheckExtension (dpy, info, False); + + LockDisplay(dpy); + stuff.app_group_leader = False; + stuff.single_screen = False; + stuff.attrib_mask = XagAppGroupLeaderMask | XagSingleScreenMask; + /* might do some validation here */ + GetReq(XagCreate, req); + req->reqType = info->codes->major_opcode; + req->xagReqType = X_XagCreate; + *app_group_return = req->app_group = XAllocID(dpy); + req->attrib_mask = stuff.attrib_mask; + StuffToWire (dpy, &stuff, req); + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool XagDestroyApplicationGroup(Display* dpy, XAppGroup app_group) +{ + XExtDisplayInfo *info = find_display (dpy); + xXagDestroyReq *req; + + XagCheckExtension (dpy, info, False); + + LockDisplay(dpy); + GetReq(XagDestroy, req); + req->reqType = info->codes->major_opcode; + req->xagReqType = X_XagDestroy; + req->app_group = app_group; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XagGetApplicationGroupAttributes(Display* dpy, XAppGroup app_group, ...) +{ + va_list var; + XExtDisplayInfo *info = find_display (dpy); + xXagGetAttrReq *req; + xXagGetAttrReply rep; + int attr; + + XagCheckExtension (dpy, info, False); + + LockDisplay(dpy); + GetReq(XagGetAttr, req); + req->reqType = info->codes->major_opcode; + req->xagReqType = X_XagGetAttr; + req->app_group = app_group; + if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + va_start (var, app_group); + for (attr = va_arg(var, int); attr != 0; attr = va_arg(var, int)) { + void* ptr; + + switch (attr) { + case XagNappGroupLeader: + ptr = va_arg(var, void*); + *(Bool*)ptr = rep.app_group_leader; + break; + case XagNsingleScreen: + ptr = va_arg(var, void*); + *(Bool*)ptr = rep.single_screen; + break; + case XagNdefaultRoot: + ptr = va_arg(var, void*); + *(Window*)ptr = rep.default_root; + break; + case XagNrootVisual: + ptr = va_arg(var, void*); + *(VisualID*)ptr = rep.root_visual; + break; + case XagNdefaultColormap: + ptr = va_arg(var, void*); + *(Colormap*)ptr = rep.default_colormap; + break; + case XagNblackPixel: + ptr = va_arg(var, void*); + *(unsigned long*)ptr = rep.black_pixel; + break; + case XagNwhitePixel: + ptr = va_arg(var, void*); + *(unsigned long*)ptr = rep.white_pixel; + break; + } + } + va_end (var); + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XagQueryApplicationGroup( + Display* dpy, + XID resource, + XAppGroup* app_group_return) +{ + XExtDisplayInfo *info = find_display (dpy); + xXagQueryReq *req; + xXagQueryReply rep; + + XagCheckExtension (dpy, info, False); + + LockDisplay(dpy); + GetReq(XagQuery, req); + req->reqType = info->codes->major_opcode; + req->xagReqType = X_XagQuery; + req->resource = resource; + if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + *app_group_return = rep.app_group; + UnlockDisplay(dpy); + SyncHandle(); + return True; + +} + +Bool +XagCreateAssociation(Display* dpy, Window* window_return, void* system_window) +{ +#ifdef WIN32 + long tmp = *(HWND*) system_window; + XExtDisplayInfo *info = find_display (dpy); + xXagCreateAssocReq *req; + + XagCheckExtension (dpy, info, False); + + LockDisplay(dpy); + GetReq(XagCreateAssoc, req); + req->reqType = info->codes->major_opcode; + req->xagReqType = X_XagCreateAssoc; + *window_return = req->window = XAllocID(dpy); + req->window_type = XagWindowTypeWin32; + req->system_window_len = sizeof(HWND); + Data32 (dpy, (long*) tmp, 1L); + req->length++; + UnlockDisplay(dpy); + SyncHandle(); +#else + /* other platforms go here */ + + /* this whole thing could be arranged better, but since X need + * only short-circuit the protocol and WIN32 is the only other + * platform the XC supports, it will suffice for now. + */ + *window_return = *(Window*)system_window; +#endif + return True; +} + +Bool +XagDestroyAssociation(Display* dpy, Window window) +{ +#ifdef WIN32 + XExtDisplayInfo *info = find_display (dpy); + xXagDestroyAssocReq *req; + + XagCheckExtension (dpy, info, False); + + LockDisplay(dpy); + GetReq(XagDestroyAssoc, req); + req->reqType = info->codes->major_opcode; + req->xagReqType = X_XagDestroyAssoc; + req->window = window; + UnlockDisplay(dpy); + SyncHandle(); +#endif + return True; +} + diff --git a/libXext/src/XLbx.c b/libXext/src/XLbx.c index 0b7eb5827..b3ba1b2ea 100644 --- a/libXext/src/XLbx.c +++ b/libXext/src/XLbx.c @@ -1,124 +1,124 @@ -/* - * Copyright 1992 Network Computing Devices - * - * 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 NCD. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. NCD. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD. - * 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. - * - * Author: Keith Packard, Network Computing Devices - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include - -static XExtensionInfo _lbx_info_data; -static XExtensionInfo *lbx_info = &_lbx_info_data; -static /* const */ char *lbx_extension_name = LBXNAME; - -#define LbxCheckExtension(dpy,i,val) \ - XextCheckExtension (dpy, i, lbx_extension_name, val) - -static int close_display(Display *dpy, XExtCodes *codes); -static char *error_string(Display *dpy, int code, XExtCodes *codes, - char *buf, int n); -static /* const */ XExtensionHooks lbx_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 */ - error_string, /* error_string */ -}; - -static /* const */ char *lbx_error_list[] = { - "BadLbxClient", /* BadLbxClient */ -}; - -static XEXT_GENERATE_FIND_DISPLAY (find_display, lbx_info, lbx_extension_name, - &lbx_extension_hooks, LbxNumberEvents, NULL) - -static XEXT_GENERATE_CLOSE_DISPLAY (close_display, lbx_info) - -static XEXT_GENERATE_ERROR_STRING (error_string, lbx_extension_name, - LbxNumberErrors, lbx_error_list) - - -Bool XLbxQueryExtension ( - Display *dpy, - int *requestp, int *event_basep, int *error_basep) -{ - XExtDisplayInfo *info = find_display (dpy); - - if (XextHasExtension(info)) { - *requestp = info->codes->major_opcode; - *event_basep = info->codes->first_event; - *error_basep = info->codes->first_error; - return True; - } else { - return False; - } -} - - -int XLbxGetEventBase(Display *dpy) -{ - XExtDisplayInfo *info = find_display (dpy); - - if (XextHasExtension(info)) { - return info->codes->first_event; - } else { - return -1; - } -} - - -Bool XLbxQueryVersion(Display *dpy, int *majorVersion, int *minorVersion) -{ - XExtDisplayInfo *info = find_display (dpy); - xLbxQueryVersionReply rep; - register xLbxQueryVersionReq *req; - - LbxCheckExtension (dpy, info, False); - - LockDisplay(dpy); - GetReq(LbxQueryVersion, req); - req->reqType = info->codes->major_opcode; - req->lbxReqType = X_LbxQueryVersion; - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - *majorVersion = rep.majorVersion; - *minorVersion = rep.minorVersion; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -/* all other requests will run after Xlib has lost the wire ... */ +/* + * Copyright 1992 Network Computing Devices + * + * 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 NCD. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. NCD. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD. + * 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. + * + * Author: Keith Packard, Network Computing Devices + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include +#include + +static XExtensionInfo _lbx_info_data; +static XExtensionInfo *lbx_info = &_lbx_info_data; +static /* const */ char *lbx_extension_name = LBXNAME; + +#define LbxCheckExtension(dpy,i,val) \ + XextCheckExtension (dpy, i, lbx_extension_name, val) + +static int close_display(Display *dpy, XExtCodes *codes); +static char *error_string(Display *dpy, int code, XExtCodes *codes, + char *buf, int n); +static /* const */ XExtensionHooks lbx_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 */ + error_string, /* error_string */ +}; + +static /* const */ char *lbx_error_list[] = { + "BadLbxClient", /* BadLbxClient */ +}; + +static XEXT_GENERATE_FIND_DISPLAY (find_display, lbx_info, lbx_extension_name, + &lbx_extension_hooks, LbxNumberEvents, NULL) + +static XEXT_GENERATE_CLOSE_DISPLAY (close_display, lbx_info) + +static XEXT_GENERATE_ERROR_STRING (error_string, lbx_extension_name, + LbxNumberErrors, lbx_error_list) + + +Bool XLbxQueryExtension ( + Display *dpy, + int *requestp, int *event_basep, int *error_basep) +{ + XExtDisplayInfo *info = find_display (dpy); + + if (XextHasExtension(info)) { + *requestp = info->codes->major_opcode; + *event_basep = info->codes->first_event; + *error_basep = info->codes->first_error; + return True; + } else { + return False; + } +} + + +int XLbxGetEventBase(Display *dpy) +{ + XExtDisplayInfo *info = find_display (dpy); + + if (XextHasExtension(info)) { + return info->codes->first_event; + } else { + return -1; + } +} + + +Bool XLbxQueryVersion(Display *dpy, int *majorVersion, int *minorVersion) +{ + XExtDisplayInfo *info = find_display (dpy); + xLbxQueryVersionReply rep; + register xLbxQueryVersionReq *req; + + LbxCheckExtension (dpy, info, False); + + LockDisplay(dpy); + GetReq(LbxQueryVersion, req); + req->reqType = info->codes->major_opcode; + req->lbxReqType = X_LbxQueryVersion; + if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + *majorVersion = rep.majorVersion; + *minorVersion = rep.minorVersion; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +/* all other requests will run after Xlib has lost the wire ... */ diff --git a/libXext/src/XMultibuf.c b/libXext/src/XMultibuf.c index 67551443d..fb995f840 100644 --- a/libXext/src/XMultibuf.c +++ b/libXext/src/XMultibuf.c @@ -1,711 +1,711 @@ -/* - * -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Authors: Jim Fulton, MIT X Consortium - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include - -static XExtensionInfo _multibuf_info_data; -static XExtensionInfo *multibuf_info = &_multibuf_info_data; -static /* const */ char *multibuf_extension_name = MULTIBUFFER_PROTOCOL_NAME; - -#define MbufCheckExtension(dpy,i,val) \ - XextCheckExtension (dpy, i, multibuf_extension_name, val) -#define MbufSimpleCheckExtension(dpy,i) \ - XextSimpleCheckExtension (dpy, i, multibuf_extension_name) - - -/***************************************************************************** - * * - * private utility routines * - * * - *****************************************************************************/ - -/* - * find_display - locate the display info block - */ -static int close_display(Display *dpy, XExtCodes *codes); -static char *error_string(Display *dpy, int code, XExtCodes *codes, char *buf, int n); -static Bool wire_to_event(Display *dpy, XEvent *libevent, xEvent *netevent); -static Status event_to_wire(Display *dpy, XEvent *libevent, xEvent *netevent); -static /* const */ XExtensionHooks multibuf_extension_hooks = { - NULL, /* create_gc */ - NULL, /* copy_gc */ - NULL, /* flush_gc */ - NULL, /* free_gc */ - NULL, /* create_font */ - NULL, /* free_font */ - close_display, /* close_display */ - wire_to_event, /* wire_to_event */ - event_to_wire, /* event_to_wire */ - NULL, /* error */ - error_string, /* error_string */ -}; - -static /* const */ char *multibuf_error_list[] = { - "BadBuffer", /* MultibufferBadBuffer */ -}; - -static XEXT_GENERATE_FIND_DISPLAY (find_display, multibuf_info, - multibuf_extension_name, - &multibuf_extension_hooks, - MultibufferNumberEvents, NULL) - -static XEXT_GENERATE_CLOSE_DISPLAY (close_display, multibuf_info) - -static XEXT_GENERATE_ERROR_STRING (error_string, multibuf_extension_name, - MultibufferNumberErrors, - multibuf_error_list) - -/* - * wire_to_event - convert a wire event in network format to a C - * event structure - */ -static Bool wire_to_event (Display *dpy, XEvent *libevent, xEvent *netevent) -{ - XExtDisplayInfo *info = find_display (dpy); - - MbufCheckExtension (dpy, info, False); - - switch ((netevent->u.u.type & 0x7f) - info->codes->first_event) { - case MultibufferClobberNotify: - { - XmbufClobberNotifyEvent *ev; - xMbufClobberNotifyEvent *event; - - ev = (XmbufClobberNotifyEvent *) libevent; - event = (xMbufClobberNotifyEvent *) netevent; - ev->type = event->type & 0x7f; - ev->serial = _XSetLastRequestRead(dpy,(xGenericReply *) netevent); - ev->send_event = ((event->type & 0x80) != 0); - ev->display = dpy; - ev->buffer = event->buffer; - ev->state = event->state; - return True; - } - case MultibufferUpdateNotify: - { - XmbufUpdateNotifyEvent *ev; - xMbufUpdateNotifyEvent *event; - - ev = (XmbufUpdateNotifyEvent *) libevent; - event = (xMbufUpdateNotifyEvent *) netevent; - ev->type = event->type & 0x7f; - ev->serial = _XSetLastRequestRead(dpy,(xGenericReply *) netevent); - ev->send_event = ((event->type & 0x80) != 0); - ev->display = dpy; - ev->buffer = event->buffer; - return True; - } - } - return False; -} - - -/* - * event_to_wire - convert a C event structure to a wire event in - * network format - */ -static Status event_to_wire (Display *dpy, XEvent *libevent, xEvent *netevent) -{ - XExtDisplayInfo *info = find_display (dpy); - - MbufCheckExtension (dpy, info, 0); - - switch ((libevent->type & 0x7f) - info->codes->first_event) { - case MultibufferClobberNotify: - { - XmbufClobberNotifyEvent *ev; - xMbufClobberNotifyEvent *event; - - ev = (XmbufClobberNotifyEvent *) libevent; - event = (xMbufClobberNotifyEvent *) netevent; - event->type = ev->type; - event->sequenceNumber = (ev->serial & 0xffff); - event->buffer = ev->buffer; - event->state = ev->state; - return 1; - } - case MultibufferUpdateNotify: - { - XmbufUpdateNotifyEvent *ev; - xMbufUpdateNotifyEvent *event; - - ev = (XmbufUpdateNotifyEvent *) libevent; - event = (xMbufUpdateNotifyEvent *) netevent; - event->type = ev->type; - event->sequenceNumber = (ev->serial & 0xffff); - event->buffer = ev->buffer; - return 1; - } - } - return 0; -} - - -/* - * read_buffer_info - read Buffer Info descriptors from the net; if unable - * to allocate memory, read junk to make sure that stream is clear. - */ -#define TALLOC(type,count) ((type *) Xmalloc ((unsigned) count * sizeof(type))) - -static XmbufBufferInfo *read_buffer_info (Display *dpy, int nbufs) -{ - xMbufBufferInfo *netbuf = TALLOC (xMbufBufferInfo, nbufs); - XmbufBufferInfo *bufinfo = NULL; - long netbytes = nbufs * SIZEOF(xMbufBufferInfo); - - if (netbuf) { - _XRead (dpy, (char *) netbuf, netbytes); - - bufinfo = TALLOC (XmbufBufferInfo, nbufs); - if (bufinfo) { - register XmbufBufferInfo *c; - register xMbufBufferInfo *net; - register int i; - - for (i = 0, c = bufinfo, net = netbuf; i < nbufs; - i++, c++, net++) { - c->visualid = net->visualID; - c->max_buffers = net->maxBuffers; - c->depth = net->depth; - } - } - Xfree ((char *) netbuf); - } else { /* eat the data */ - while (netbytes > 0) { - char dummy[256]; /* stack size vs loops tradeoff */ - long nbytes = sizeof dummy; - - if (nbytes > netbytes) nbytes = netbytes; - _XRead (dpy, dummy, nbytes); - netbytes -= nbytes; - } - } - - return bufinfo; -} - -#undef TALLOC - - -/***************************************************************************** - * * - * Multibuffering/stereo public interfaces * - * * - *****************************************************************************/ - - -/* - * XmbufQueryExtension - - * Returns True if the multibuffering/stereo extension is available - * on the given display. If the extension exists, the value of the - * first event code (which should be added to the event type constants - * MultibufferClobberNotify and MultibufferUpdateNotify to get the - * actual values) is stored into event_base and the value of the first - * error code (which should be added to the error type constant - * MultibufferBadBuffer to get the actual value) is stored into - * error_base. - */ -Bool XmbufQueryExtension ( - 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; - } -} - - -/* - * XmbufGetVersion - - * Gets the major and minor version numbers of the extension. The return - * value is zero if an error occurs or non-zero if no error happens. - */ -Status XmbufGetVersion ( - Display *dpy, - int *major_version_return, int *minor_version_return) -{ - XExtDisplayInfo *info = find_display (dpy); - xMbufGetBufferVersionReply rep; - register xMbufGetBufferVersionReq *req; - - MbufCheckExtension (dpy, info, 0); - - LockDisplay (dpy); - MbufGetReq (MbufGetBufferVersion, req, info); - 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; -} - - -/* - * XmbufCreateBuffers - - * Requests that "count" buffers be created with the given update_action - * and update_hint and be associated with the indicated window. The - * number of buffers created is returned (zero if an error occurred) - * and buffers_return is filled in with that many Multibuffer identifiers. - */ -int XmbufCreateBuffers ( - Display *dpy, - Window w, - int count, - int update_action, int update_hint, - Multibuffer *buffers) -{ - XExtDisplayInfo *info = find_display (dpy); - xMbufCreateImageBuffersReply rep; - register xMbufCreateImageBuffersReq *req; - int result; - - MbufCheckExtension (dpy, info, 0); - - LockDisplay (dpy); - - XAllocIDs(dpy, buffers, count); - MbufGetReq (MbufCreateImageBuffers, req, info); - req->window = w; - req->updateAction = update_action; - req->updateHint = update_hint; - req->length += count; - count <<= 2; - PackData32 (dpy, buffers, count); - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay (dpy); - SyncHandle (); - return 0; - } - result = rep.numberBuffer; - UnlockDisplay (dpy); - - SyncHandle (); - return result; -} - - -/* - * XmbufDestroyBuffers - - * Destroys the buffers associated with the given window. - */ -void XmbufDestroyBuffers (Display *dpy, Window window) -{ - XExtDisplayInfo *info = find_display (dpy); - register xMbufDestroyImageBuffersReq *req; - - MbufSimpleCheckExtension (dpy, info); - - LockDisplay (dpy); - MbufGetReq (MbufDestroyImageBuffers, req, info); - req->window = window; - UnlockDisplay (dpy); - SyncHandle (); -} - - -/* - * XmbufDisplayBuffers - - * Displays the indicated buffers their appropriate windows within - * max_delay milliseconds after min_delay milliseconds have passed. - * No two buffers may be associated with the same window or else a Match - * error is generated. - */ -void XmbufDisplayBuffers ( - Display *dpy, - int count, - Multibuffer *buffers, - int min_delay, int max_delay) -{ - XExtDisplayInfo *info = find_display (dpy); - register xMbufDisplayImageBuffersReq *req; - - MbufSimpleCheckExtension (dpy, info); - - LockDisplay (dpy); - MbufGetReq (MbufDisplayImageBuffers, req, info); - req->minDelay = min_delay; - req->maxDelay = max_delay; - req->length += count; - count <<= 2; - PackData32 (dpy, buffers, count); - UnlockDisplay (dpy); - SyncHandle(); -} - - -/* - * XmbufGetWindowAttributes - - * Gets the multibuffering attributes that apply to all buffers associated - * with the given window. Returns non-zero on success and zero if an - * error occurs. - */ -Status XmbufGetWindowAttributes ( - Display *dpy, - Window w, - XmbufWindowAttributes *attr) -{ - XExtDisplayInfo *info = find_display (dpy); - register xMbufGetMBufferAttributesReq *req; - xMbufGetMBufferAttributesReply rep; - - MbufCheckExtension (dpy, info, 0); - - LockDisplay (dpy); - MbufGetReq (MbufGetMBufferAttributes, req, info); - req->window = w; - if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay (dpy); - SyncHandle (); - return 0; - } - attr->buffers = (Multibuffer *) NULL; - if ((attr->nbuffers = rep.length)) { - int nbytes = rep.length * sizeof(Multibuffer); - attr->buffers = (Multibuffer *) Xmalloc((unsigned) nbytes); - nbytes = rep.length << 2; - if (! attr->buffers) { - _XEatData(dpy, (unsigned long) nbytes); - UnlockDisplay(dpy); - SyncHandle(); - return (0); - } - _XRead32 (dpy, (long *) attr->buffers, nbytes); - } - attr->displayed_index = rep.displayedBuffer; - attr->update_action = rep.updateAction; - attr->update_hint = rep.updateHint; - attr->window_mode = rep.windowMode; - - UnlockDisplay (dpy); - SyncHandle(); - return 1; -} - - -/* - * XmbufChangeWindowAttributes - - * Sets the multibuffering attributes that apply to all buffers associated - * with the given window. This is currently limited to the update_hint. - */ -void XmbufChangeWindowAttributes ( - Display *dpy, - Window w, - unsigned long valuemask, - XmbufSetWindowAttributes *attr) -{ - XExtDisplayInfo *info = find_display (dpy); - register xMbufSetMBufferAttributesReq *req; - - MbufSimpleCheckExtension (dpy, info); - - LockDisplay (dpy); - MbufGetReq (MbufSetMBufferAttributes, req, info); - req->window = w; - if ((req->valueMask = valuemask)) { /* stolen from lib/X/XWindow.c */ - unsigned long values[1]; /* one per element in if stmts below */ - unsigned long *v = values; - unsigned int nvalues; - - if (valuemask & MultibufferWindowUpdateHint) - *v++ = attr->update_hint; - req->length += (nvalues = v - values); - nvalues <<= 2; /* watch out for macros... */ - Data32 (dpy, (long *) values, (long)nvalues); - } - UnlockDisplay (dpy); - SyncHandle(); -} - - -/* - * XmbufGetBufferAttributes - - * Gets the attributes for the indicated buffer. Returns non-zero on - * success and zero if an error occurs. - */ -Status XmbufGetBufferAttributes ( - Display *dpy, - Multibuffer b, - XmbufBufferAttributes *attr) -{ - XExtDisplayInfo *info = find_display (dpy); - register xMbufGetBufferAttributesReq *req; - xMbufGetBufferAttributesReply rep; - - MbufCheckExtension (dpy, info, 0); - - LockDisplay (dpy); - MbufGetReq (MbufGetBufferAttributes, req, info); - req->buffer = b; - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay (dpy); - SyncHandle (); - return 0; - } - attr->window = rep.window; - attr->event_mask = rep.eventMask; - attr->buffer_index = rep.bufferIndex; - attr->side = rep.side; - - UnlockDisplay (dpy); - SyncHandle(); - return 1; -} - - -/* - * XmbufChangeBufferAttributes - - * Sets the attributes for the indicated buffer. This is currently - * limited to the event_mask. - */ -void XmbufChangeBufferAttributes ( - Display *dpy, - Multibuffer b, - unsigned long valuemask, - XmbufSetBufferAttributes *attr) -{ - XExtDisplayInfo *info = find_display (dpy); - register xMbufSetBufferAttributesReq *req; - - MbufSimpleCheckExtension (dpy, info); - - LockDisplay (dpy); - MbufGetReq (MbufSetBufferAttributes, req, info); - req->buffer = b; - if ((req->valueMask = valuemask)) { /* stolen from lib/X/XWindow.c */ - unsigned long values[1]; /* one per element in if stmts below */ - unsigned long *v = values; - unsigned int nvalues; - - if (valuemask & MultibufferBufferEventMask) - *v++ = attr->event_mask; - req->length += (nvalues = v - values); - nvalues <<= 2; /* watch out for macros... */ - Data32 (dpy, (long *) values, (long)nvalues); - } - UnlockDisplay (dpy); - SyncHandle(); -} - - - -/* - * XmbufGetScreenInfo - - * Gets the parameters controlling how mono and stereo windows may be - * created on the indicated screen. The numbers of sets of visual and - * depths are returned in nmono_return and nstereo_return. If - * nmono_return is greater than zero, then mono_info_return is set to - * the address of an array of XmbufBufferInfo structures describing the - * various visuals and depths that may be used. Otherwise, - * mono_info_return is set to NULL. Similarly, stereo_info_return is - * set according to nstereo_return. The storage returned in - * mono_info_return and stereo_info_return may be released by XFree. - * If no errors are encounted, non-zero will be returned. - */ -Status XmbufGetScreenInfo ( - Display *dpy, - Drawable d, - int *nmono_return, - XmbufBufferInfo **mono_info_return, - int *nstereo_return, - XmbufBufferInfo **stereo_info_return) -{ - XExtDisplayInfo *info = find_display (dpy); - register xMbufGetBufferInfoReq *req; - xMbufGetBufferInfoReply rep; - int nmono, nstereo; - XmbufBufferInfo *minfo, *sinfo; - - MbufCheckExtension (dpy, info, 0); - - LockDisplay (dpy); - MbufGetReq (MbufGetBufferInfo, req, info); - req->drawable = d; - if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay (dpy); - SyncHandle (); - return 0; - } - nmono = rep.normalInfo; - nstereo = rep.stereoInfo; - minfo = ((nmono > 0) ? read_buffer_info (dpy, nmono) : NULL); - sinfo = ((nstereo > 0) ? read_buffer_info (dpy, nstereo) : NULL); - - /* check for bad reads indicating we need to return an error */ - if ((nmono > 0 && !minfo) || (nstereo > 0 && !sinfo)) { - if (minfo) Xfree ((char *) minfo); - if (sinfo) Xfree ((char *) sinfo); - UnlockDisplay (dpy); - SyncHandle(); - return 0; - } - - *nmono_return = nmono; - *mono_info_return = minfo; - *nstereo_return = nstereo; - *stereo_info_return = sinfo; - - UnlockDisplay (dpy); - SyncHandle(); - return 1; -} - - -/* - * XmbufCreateStereoWindow - - * Creates a stereo window in the same way that XCreateWindow creates - * a mono window (in fact, use the same code, except for the request) - * and returns the left and right buffers that may be - */ -Window XmbufCreateStereoWindow ( - Display *dpy, - Window parent, - int x, int y, - unsigned int width, unsigned int height, unsigned int border_width, - int depth, - unsigned int class, - Visual *visual, - unsigned long valuemask, - XSetWindowAttributes *attr, - Multibuffer *leftp, Multibuffer *rightp) -{ - XExtDisplayInfo *info = find_display (dpy); - Window wid; - register xMbufCreateStereoWindowReq *req; - - MbufCheckExtension (dpy, info, None); - - LockDisplay(dpy); - MbufGetReq(MbufCreateStereoWindow, req, info); - wid = req->wid = XAllocID(dpy); - req->parent = parent; - req->left = *leftp = XAllocID (dpy); - req->right = *rightp = XAllocID (dpy); - req->x = x; - req->y = y; - req->width = width; - req->height = height; - req->borderWidth = border_width; - req->depth = depth; - req->class = class; - if (visual == (Visual *)CopyFromParent) - req->visual = CopyFromParent; - else - req->visual = visual->visualid; - valuemask &= (CWBackPixmap|CWBackPixel|CWBorderPixmap| - CWBorderPixel|CWBitGravity|CWWinGravity| - CWBackingStore|CWBackingPlanes|CWBackingPixel| - CWOverrideRedirect|CWSaveUnder|CWEventMask| - CWDontPropagate|CWColormap|CWCursor); - if ((req->mask = valuemask)) { - unsigned long values[32]; - register unsigned long *value = values; - unsigned int nvalues; - - if (valuemask & CWBackPixmap) - *value++ = attr->background_pixmap; - if (valuemask & CWBackPixel) - *value++ = attr->background_pixel; - if (valuemask & CWBorderPixmap) - *value++ = attr->border_pixmap; - if (valuemask & CWBorderPixel) - *value++ = attr->border_pixel; - if (valuemask & CWBitGravity) - *value++ = attr->bit_gravity; - if (valuemask & CWWinGravity) - *value++ = attr->win_gravity; - if (valuemask & CWBackingStore) - *value++ = attr->backing_store; - if (valuemask & CWBackingPlanes) - *value++ = attr->backing_planes; - if (valuemask & CWBackingPixel) - *value++ = attr->backing_pixel; - if (valuemask & CWOverrideRedirect) - *value++ = attr->override_redirect; - if (valuemask & CWSaveUnder) - *value++ = attr->save_under; - if (valuemask & CWEventMask) - *value++ = attr->event_mask; - if (valuemask & CWDontPropagate) - *value++ = attr->do_not_propagate_mask; - if (valuemask & CWColormap) - *value++ = attr->colormap; - if (valuemask & CWCursor) - *value++ = attr->cursor; - req->length += (nvalues = value - values); - - nvalues <<= 2; /* watch out for macros... */ - Data32 (dpy, (long *) values, (long)nvalues); - } - UnlockDisplay(dpy); - SyncHandle(); - return wid; -} - -void XmbufClearBufferArea ( - Display *dpy, - Multibuffer buffer, - int x, int y, - unsigned int width, unsigned int height, - Bool exposures) -{ - XExtDisplayInfo *info = find_display (dpy); - register xMbufClearImageBufferAreaReq *req; - - MbufSimpleCheckExtension (dpy, info); - - LockDisplay (dpy); - MbufGetReq (MbufClearImageBufferArea, req, info); - req->buffer = buffer; - req->x = x; - req->y = y; - req->width = width; - req->height = height; - req->exposures = exposures; - UnlockDisplay (dpy); - SyncHandle(); -} - +/* + * +Copyright 1989, 1998 The Open Group + +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + * + * Authors: Jim Fulton, MIT X Consortium + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include +#include + +static XExtensionInfo _multibuf_info_data; +static XExtensionInfo *multibuf_info = &_multibuf_info_data; +static /* const */ char *multibuf_extension_name = MULTIBUFFER_PROTOCOL_NAME; + +#define MbufCheckExtension(dpy,i,val) \ + XextCheckExtension (dpy, i, multibuf_extension_name, val) +#define MbufSimpleCheckExtension(dpy,i) \ + XextSimpleCheckExtension (dpy, i, multibuf_extension_name) + + +/***************************************************************************** + * * + * private utility routines * + * * + *****************************************************************************/ + +/* + * find_display - locate the display info block + */ +static int close_display(Display *dpy, XExtCodes *codes); +static char *error_string(Display *dpy, int code, XExtCodes *codes, char *buf, int n); +static Bool wire_to_event(Display *dpy, XEvent *libevent, xEvent *netevent); +static Status event_to_wire(Display *dpy, XEvent *libevent, xEvent *netevent); +static /* const */ XExtensionHooks multibuf_extension_hooks = { + NULL, /* create_gc */ + NULL, /* copy_gc */ + NULL, /* flush_gc */ + NULL, /* free_gc */ + NULL, /* create_font */ + NULL, /* free_font */ + close_display, /* close_display */ + wire_to_event, /* wire_to_event */ + event_to_wire, /* event_to_wire */ + NULL, /* error */ + error_string, /* error_string */ +}; + +static /* const */ char *multibuf_error_list[] = { + "BadBuffer", /* MultibufferBadBuffer */ +}; + +static XEXT_GENERATE_FIND_DISPLAY (find_display, multibuf_info, + multibuf_extension_name, + &multibuf_extension_hooks, + MultibufferNumberEvents, NULL) + +static XEXT_GENERATE_CLOSE_DISPLAY (close_display, multibuf_info) + +static XEXT_GENERATE_ERROR_STRING (error_string, multibuf_extension_name, + MultibufferNumberErrors, + multibuf_error_list) + +/* + * wire_to_event - convert a wire event in network format to a C + * event structure + */ +static Bool wire_to_event (Display *dpy, XEvent *libevent, xEvent *netevent) +{ + XExtDisplayInfo *info = find_display (dpy); + + MbufCheckExtension (dpy, info, False); + + switch ((netevent->u.u.type & 0x7f) - info->codes->first_event) { + case MultibufferClobberNotify: + { + XmbufClobberNotifyEvent *ev; + xMbufClobberNotifyEvent *event; + + ev = (XmbufClobberNotifyEvent *) libevent; + event = (xMbufClobberNotifyEvent *) netevent; + ev->type = event->type & 0x7f; + ev->serial = _XSetLastRequestRead(dpy,(xGenericReply *) netevent); + ev->send_event = ((event->type & 0x80) != 0); + ev->display = dpy; + ev->buffer = event->buffer; + ev->state = event->state; + return True; + } + case MultibufferUpdateNotify: + { + XmbufUpdateNotifyEvent *ev; + xMbufUpdateNotifyEvent *event; + + ev = (XmbufUpdateNotifyEvent *) libevent; + event = (xMbufUpdateNotifyEvent *) netevent; + ev->type = event->type & 0x7f; + ev->serial = _XSetLastRequestRead(dpy,(xGenericReply *) netevent); + ev->send_event = ((event->type & 0x80) != 0); + ev->display = dpy; + ev->buffer = event->buffer; + return True; + } + } + return False; +} + + +/* + * event_to_wire - convert a C event structure to a wire event in + * network format + */ +static Status event_to_wire (Display *dpy, XEvent *libevent, xEvent *netevent) +{ + XExtDisplayInfo *info = find_display (dpy); + + MbufCheckExtension (dpy, info, 0); + + switch ((libevent->type & 0x7f) - info->codes->first_event) { + case MultibufferClobberNotify: + { + XmbufClobberNotifyEvent *ev; + xMbufClobberNotifyEvent *event; + + ev = (XmbufClobberNotifyEvent *) libevent; + event = (xMbufClobberNotifyEvent *) netevent; + event->type = ev->type; + event->sequenceNumber = (ev->serial & 0xffff); + event->buffer = ev->buffer; + event->state = ev->state; + return 1; + } + case MultibufferUpdateNotify: + { + XmbufUpdateNotifyEvent *ev; + xMbufUpdateNotifyEvent *event; + + ev = (XmbufUpdateNotifyEvent *) libevent; + event = (xMbufUpdateNotifyEvent *) netevent; + event->type = ev->type; + event->sequenceNumber = (ev->serial & 0xffff); + event->buffer = ev->buffer; + return 1; + } + } + return 0; +} + + +/* + * read_buffer_info - read Buffer Info descriptors from the net; if unable + * to allocate memory, read junk to make sure that stream is clear. + */ +#define TALLOC(type,count) ((type *) Xmalloc ((unsigned) count * sizeof(type))) + +static XmbufBufferInfo *read_buffer_info (Display *dpy, int nbufs) +{ + xMbufBufferInfo *netbuf = TALLOC (xMbufBufferInfo, nbufs); + XmbufBufferInfo *bufinfo = NULL; + long netbytes = nbufs * SIZEOF(xMbufBufferInfo); + + if (netbuf) { + _XRead (dpy, (char *) netbuf, netbytes); + + bufinfo = TALLOC (XmbufBufferInfo, nbufs); + if (bufinfo) { + register XmbufBufferInfo *c; + register xMbufBufferInfo *net; + register int i; + + for (i = 0, c = bufinfo, net = netbuf; i < nbufs; + i++, c++, net++) { + c->visualid = net->visualID; + c->max_buffers = net->maxBuffers; + c->depth = net->depth; + } + } + Xfree ((char *) netbuf); + } else { /* eat the data */ + while (netbytes > 0) { + char dummy[256]; /* stack size vs loops tradeoff */ + long nbytes = sizeof dummy; + + if (nbytes > netbytes) nbytes = netbytes; + _XRead (dpy, dummy, nbytes); + netbytes -= nbytes; + } + } + + return bufinfo; +} + +#undef TALLOC + + +/***************************************************************************** + * * + * Multibuffering/stereo public interfaces * + * * + *****************************************************************************/ + + +/* + * XmbufQueryExtension - + * Returns True if the multibuffering/stereo extension is available + * on the given display. If the extension exists, the value of the + * first event code (which should be added to the event type constants + * MultibufferClobberNotify and MultibufferUpdateNotify to get the + * actual values) is stored into event_base and the value of the first + * error code (which should be added to the error type constant + * MultibufferBadBuffer to get the actual value) is stored into + * error_base. + */ +Bool XmbufQueryExtension ( + 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; + } +} + + +/* + * XmbufGetVersion - + * Gets the major and minor version numbers of the extension. The return + * value is zero if an error occurs or non-zero if no error happens. + */ +Status XmbufGetVersion ( + Display *dpy, + int *major_version_return, int *minor_version_return) +{ + XExtDisplayInfo *info = find_display (dpy); + xMbufGetBufferVersionReply rep; + register xMbufGetBufferVersionReq *req; + + MbufCheckExtension (dpy, info, 0); + + LockDisplay (dpy); + MbufGetReq (MbufGetBufferVersion, req, info); + 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; +} + + +/* + * XmbufCreateBuffers - + * Requests that "count" buffers be created with the given update_action + * and update_hint and be associated with the indicated window. The + * number of buffers created is returned (zero if an error occurred) + * and buffers_return is filled in with that many Multibuffer identifiers. + */ +int XmbufCreateBuffers ( + Display *dpy, + Window w, + int count, + int update_action, int update_hint, + Multibuffer *buffers) +{ + XExtDisplayInfo *info = find_display (dpy); + xMbufCreateImageBuffersReply rep; + register xMbufCreateImageBuffersReq *req; + int result; + + MbufCheckExtension (dpy, info, 0); + + LockDisplay (dpy); + + XAllocIDs(dpy, buffers, count); + MbufGetReq (MbufCreateImageBuffers, req, info); + req->window = w; + req->updateAction = update_action; + req->updateHint = update_hint; + req->length += count; + count <<= 2; + PackData32 (dpy, buffers, count); + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return 0; + } + result = rep.numberBuffer; + UnlockDisplay (dpy); + + SyncHandle (); + return result; +} + + +/* + * XmbufDestroyBuffers - + * Destroys the buffers associated with the given window. + */ +void XmbufDestroyBuffers (Display *dpy, Window window) +{ + XExtDisplayInfo *info = find_display (dpy); + register xMbufDestroyImageBuffersReq *req; + + MbufSimpleCheckExtension (dpy, info); + + LockDisplay (dpy); + MbufGetReq (MbufDestroyImageBuffers, req, info); + req->window = window; + UnlockDisplay (dpy); + SyncHandle (); +} + + +/* + * XmbufDisplayBuffers - + * Displays the indicated buffers their appropriate windows within + * max_delay milliseconds after min_delay milliseconds have passed. + * No two buffers may be associated with the same window or else a Match + * error is generated. + */ +void XmbufDisplayBuffers ( + Display *dpy, + int count, + Multibuffer *buffers, + int min_delay, int max_delay) +{ + XExtDisplayInfo *info = find_display (dpy); + register xMbufDisplayImageBuffersReq *req; + + MbufSimpleCheckExtension (dpy, info); + + LockDisplay (dpy); + MbufGetReq (MbufDisplayImageBuffers, req, info); + req->minDelay = min_delay; + req->maxDelay = max_delay; + req->length += count; + count <<= 2; + PackData32 (dpy, buffers, count); + UnlockDisplay (dpy); + SyncHandle(); +} + + +/* + * XmbufGetWindowAttributes - + * Gets the multibuffering attributes that apply to all buffers associated + * with the given window. Returns non-zero on success and zero if an + * error occurs. + */ +Status XmbufGetWindowAttributes ( + Display *dpy, + Window w, + XmbufWindowAttributes *attr) +{ + XExtDisplayInfo *info = find_display (dpy); + register xMbufGetMBufferAttributesReq *req; + xMbufGetMBufferAttributesReply rep; + + MbufCheckExtension (dpy, info, 0); + + LockDisplay (dpy); + MbufGetReq (MbufGetMBufferAttributes, req, info); + req->window = w; + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return 0; + } + attr->buffers = (Multibuffer *) NULL; + if ((attr->nbuffers = rep.length)) { + int nbytes = rep.length * sizeof(Multibuffer); + attr->buffers = (Multibuffer *) Xmalloc((unsigned) nbytes); + nbytes = rep.length << 2; + if (! attr->buffers) { + _XEatData(dpy, (unsigned long) nbytes); + UnlockDisplay(dpy); + SyncHandle(); + return (0); + } + _XRead32 (dpy, (long *) attr->buffers, nbytes); + } + attr->displayed_index = rep.displayedBuffer; + attr->update_action = rep.updateAction; + attr->update_hint = rep.updateHint; + attr->window_mode = rep.windowMode; + + UnlockDisplay (dpy); + SyncHandle(); + return 1; +} + + +/* + * XmbufChangeWindowAttributes - + * Sets the multibuffering attributes that apply to all buffers associated + * with the given window. This is currently limited to the update_hint. + */ +void XmbufChangeWindowAttributes ( + Display *dpy, + Window w, + unsigned long valuemask, + XmbufSetWindowAttributes *attr) +{ + XExtDisplayInfo *info = find_display (dpy); + register xMbufSetMBufferAttributesReq *req; + + MbufSimpleCheckExtension (dpy, info); + + LockDisplay (dpy); + MbufGetReq (MbufSetMBufferAttributes, req, info); + req->window = w; + if ((req->valueMask = valuemask)) { /* stolen from lib/X/XWindow.c */ + unsigned long values[1]; /* one per element in if stmts below */ + unsigned long *v = values; + unsigned int nvalues; + + if (valuemask & MultibufferWindowUpdateHint) + *v++ = attr->update_hint; + req->length += (nvalues = v - values); + nvalues <<= 2; /* watch out for macros... */ + Data32 (dpy, (long *) values, (long)nvalues); + } + UnlockDisplay (dpy); + SyncHandle(); +} + + +/* + * XmbufGetBufferAttributes - + * Gets the attributes for the indicated buffer. Returns non-zero on + * success and zero if an error occurs. + */ +Status XmbufGetBufferAttributes ( + Display *dpy, + Multibuffer b, + XmbufBufferAttributes *attr) +{ + XExtDisplayInfo *info = find_display (dpy); + register xMbufGetBufferAttributesReq *req; + xMbufGetBufferAttributesReply rep; + + MbufCheckExtension (dpy, info, 0); + + LockDisplay (dpy); + MbufGetReq (MbufGetBufferAttributes, req, info); + req->buffer = b; + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return 0; + } + attr->window = rep.window; + attr->event_mask = rep.eventMask; + attr->buffer_index = rep.bufferIndex; + attr->side = rep.side; + + UnlockDisplay (dpy); + SyncHandle(); + return 1; +} + + +/* + * XmbufChangeBufferAttributes - + * Sets the attributes for the indicated buffer. This is currently + * limited to the event_mask. + */ +void XmbufChangeBufferAttributes ( + Display *dpy, + Multibuffer b, + unsigned long valuemask, + XmbufSetBufferAttributes *attr) +{ + XExtDisplayInfo *info = find_display (dpy); + register xMbufSetBufferAttributesReq *req; + + MbufSimpleCheckExtension (dpy, info); + + LockDisplay (dpy); + MbufGetReq (MbufSetBufferAttributes, req, info); + req->buffer = b; + if ((req->valueMask = valuemask)) { /* stolen from lib/X/XWindow.c */ + unsigned long values[1]; /* one per element in if stmts below */ + unsigned long *v = values; + unsigned int nvalues; + + if (valuemask & MultibufferBufferEventMask) + *v++ = attr->event_mask; + req->length += (nvalues = v - values); + nvalues <<= 2; /* watch out for macros... */ + Data32 (dpy, (long *) values, (long)nvalues); + } + UnlockDisplay (dpy); + SyncHandle(); +} + + + +/* + * XmbufGetScreenInfo - + * Gets the parameters controlling how mono and stereo windows may be + * created on the indicated screen. The numbers of sets of visual and + * depths are returned in nmono_return and nstereo_return. If + * nmono_return is greater than zero, then mono_info_return is set to + * the address of an array of XmbufBufferInfo structures describing the + * various visuals and depths that may be used. Otherwise, + * mono_info_return is set to NULL. Similarly, stereo_info_return is + * set according to nstereo_return. The storage returned in + * mono_info_return and stereo_info_return may be released by XFree. + * If no errors are encounted, non-zero will be returned. + */ +Status XmbufGetScreenInfo ( + Display *dpy, + Drawable d, + int *nmono_return, + XmbufBufferInfo **mono_info_return, + int *nstereo_return, + XmbufBufferInfo **stereo_info_return) +{ + XExtDisplayInfo *info = find_display (dpy); + register xMbufGetBufferInfoReq *req; + xMbufGetBufferInfoReply rep; + int nmono, nstereo; + XmbufBufferInfo *minfo, *sinfo; + + MbufCheckExtension (dpy, info, 0); + + LockDisplay (dpy); + MbufGetReq (MbufGetBufferInfo, req, info); + req->drawable = d; + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return 0; + } + nmono = rep.normalInfo; + nstereo = rep.stereoInfo; + minfo = ((nmono > 0) ? read_buffer_info (dpy, nmono) : NULL); + sinfo = ((nstereo > 0) ? read_buffer_info (dpy, nstereo) : NULL); + + /* check for bad reads indicating we need to return an error */ + if ((nmono > 0 && !minfo) || (nstereo > 0 && !sinfo)) { + if (minfo) Xfree ((char *) minfo); + if (sinfo) Xfree ((char *) sinfo); + UnlockDisplay (dpy); + SyncHandle(); + return 0; + } + + *nmono_return = nmono; + *mono_info_return = minfo; + *nstereo_return = nstereo; + *stereo_info_return = sinfo; + + UnlockDisplay (dpy); + SyncHandle(); + return 1; +} + + +/* + * XmbufCreateStereoWindow - + * Creates a stereo window in the same way that XCreateWindow creates + * a mono window (in fact, use the same code, except for the request) + * and returns the left and right buffers that may be + */ +Window XmbufCreateStereoWindow ( + Display *dpy, + Window parent, + int x, int y, + unsigned int width, unsigned int height, unsigned int border_width, + int depth, + unsigned int class, + Visual *visual, + unsigned long valuemask, + XSetWindowAttributes *attr, + Multibuffer *leftp, Multibuffer *rightp) +{ + XExtDisplayInfo *info = find_display (dpy); + Window wid; + register xMbufCreateStereoWindowReq *req; + + MbufCheckExtension (dpy, info, None); + + LockDisplay(dpy); + MbufGetReq(MbufCreateStereoWindow, req, info); + wid = req->wid = XAllocID(dpy); + req->parent = parent; + req->left = *leftp = XAllocID (dpy); + req->right = *rightp = XAllocID (dpy); + req->x = x; + req->y = y; + req->width = width; + req->height = height; + req->borderWidth = border_width; + req->depth = depth; + req->class = class; + if (visual == (Visual *)CopyFromParent) + req->visual = CopyFromParent; + else + req->visual = visual->visualid; + valuemask &= (CWBackPixmap|CWBackPixel|CWBorderPixmap| + CWBorderPixel|CWBitGravity|CWWinGravity| + CWBackingStore|CWBackingPlanes|CWBackingPixel| + CWOverrideRedirect|CWSaveUnder|CWEventMask| + CWDontPropagate|CWColormap|CWCursor); + if ((req->mask = valuemask)) { + unsigned long values[32]; + register unsigned long *value = values; + unsigned int nvalues; + + if (valuemask & CWBackPixmap) + *value++ = attr->background_pixmap; + if (valuemask & CWBackPixel) + *value++ = attr->background_pixel; + if (valuemask & CWBorderPixmap) + *value++ = attr->border_pixmap; + if (valuemask & CWBorderPixel) + *value++ = attr->border_pixel; + if (valuemask & CWBitGravity) + *value++ = attr->bit_gravity; + if (valuemask & CWWinGravity) + *value++ = attr->win_gravity; + if (valuemask & CWBackingStore) + *value++ = attr->backing_store; + if (valuemask & CWBackingPlanes) + *value++ = attr->backing_planes; + if (valuemask & CWBackingPixel) + *value++ = attr->backing_pixel; + if (valuemask & CWOverrideRedirect) + *value++ = attr->override_redirect; + if (valuemask & CWSaveUnder) + *value++ = attr->save_under; + if (valuemask & CWEventMask) + *value++ = attr->event_mask; + if (valuemask & CWDontPropagate) + *value++ = attr->do_not_propagate_mask; + if (valuemask & CWColormap) + *value++ = attr->colormap; + if (valuemask & CWCursor) + *value++ = attr->cursor; + req->length += (nvalues = value - values); + + nvalues <<= 2; /* watch out for macros... */ + Data32 (dpy, (long *) values, (long)nvalues); + } + UnlockDisplay(dpy); + SyncHandle(); + return wid; +} + +void XmbufClearBufferArea ( + Display *dpy, + Multibuffer buffer, + int x, int y, + unsigned int width, unsigned int height, + Bool exposures) +{ + XExtDisplayInfo *info = find_display (dpy); + register xMbufClearImageBufferAreaReq *req; + + MbufSimpleCheckExtension (dpy, info); + + LockDisplay (dpy); + MbufGetReq (MbufClearImageBufferArea, req, info); + req->buffer = buffer; + req->x = x; + req->y = y; + req->width = width; + req->height = height; + req->exposures = exposures; + UnlockDisplay (dpy); + SyncHandle(); +} + diff --git a/libXext/src/XShape.c b/libXext/src/XShape.c index f189a41b9..1e3a77f23 100644 --- a/libXext/src/XShape.c +++ b/libXext/src/XShape.c @@ -1,488 +1,488 @@ -/* - * -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Keith Packard, MIT X Consortium - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include - -static XExtensionInfo _shape_info_data; -static XExtensionInfo *shape_info = &_shape_info_data; -static /* const */ char *shape_extension_name = SHAPENAME; - -#define ShapeCheckExtension(dpy,i,val) \ - XextCheckExtension (dpy, i, shape_extension_name, val) -#define ShapeSimpleCheckExtension(dpy,i) \ - XextSimpleCheckExtension (dpy, i, shape_extension_name) - - -/***************************************************************************** - * * - * private utility routines * - * * - *****************************************************************************/ - -static int close_display(Display *dpy, XExtCodes *codes); -static Bool wire_to_event (Display *dpy, XEvent *re, xEvent *event); -static Status event_to_wire (Display *dpy, XEvent *re, xEvent *event); -static /* const */ XExtensionHooks shape_extension_hooks = { - NULL, /* create_gc */ - NULL, /* copy_gc */ - NULL, /* flush_gc */ - NULL, /* free_gc */ - NULL, /* create_font */ - NULL, /* free_font */ - close_display, /* close_display */ - wire_to_event, /* wire_to_event */ - event_to_wire, /* event_to_wire */ - NULL, /* error */ - NULL, /* error_string */ -}; - -static XEXT_GENERATE_FIND_DISPLAY (find_display, shape_info, - shape_extension_name, - &shape_extension_hooks, - ShapeNumberEvents, NULL) - -static XEXT_GENERATE_CLOSE_DISPLAY (close_display, shape_info) - - -static Bool -wire_to_event (Display *dpy, XEvent *re, xEvent *event) -{ - XExtDisplayInfo *info = find_display (dpy); - XShapeEvent *se; - xShapeNotifyEvent *sevent; - - ShapeCheckExtension (dpy, info, False); - - switch ((event->u.u.type & 0x7f) - info->codes->first_event) { - case ShapeNotify: - se = (XShapeEvent *) re; - sevent = (xShapeNotifyEvent *) event; - se->type = sevent->type & 0x7f; - se->serial = _XSetLastRequestRead(dpy,(xGenericReply *) event); - se->send_event = (sevent->type & 0x80) != 0; - se->display = dpy; - se->window = sevent->window; - se->kind = sevent->kind; - se->x = cvtINT16toInt (sevent->x); - se->y = cvtINT16toInt (sevent->y); - se->width = sevent->width; - se->height = sevent->height; - se->time = sevent->time; - se->shaped = True; - if (sevent->shaped == xFalse) - se->shaped = False; - return True; - } - return False; -} - -static Status -event_to_wire (Display *dpy, XEvent *re, xEvent *event) -{ - XExtDisplayInfo *info = find_display (dpy); - XShapeEvent *se; - xShapeNotifyEvent *sevent; - - ShapeCheckExtension (dpy, info, 0); - - switch ((re->type & 0x7f) - info->codes->first_event) { - case ShapeNotify: - se = (XShapeEvent *) re; - sevent = (xShapeNotifyEvent *) event; - sevent->type = se->type | (se->send_event ? 0x80 : 0); - sevent->sequenceNumber = se->serial & 0xffff; - sevent->window = se->window; - sevent->kind = se->kind; - sevent->x = se->x; - sevent->y = se->y; - sevent->width = se->width; - sevent->height = se->height; - sevent->time = se->time; - return 1; - } - return 0; -} - - -/**************************************************************************** - * * - * Shape public interfaces * - * * - ****************************************************************************/ - -Bool XShapeQueryExtension (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; - } -} - - -Status XShapeQueryVersion( - Display *dpy, - int *major_versionp, - int *minor_versionp) -{ - XExtDisplayInfo *info = find_display (dpy); - xShapeQueryVersionReply rep; - register xShapeQueryVersionReq *req; - - ShapeCheckExtension (dpy, info, 0); - - LockDisplay (dpy); - GetReq (ShapeQueryVersion, req); - req->reqType = info->codes->major_opcode; - req->shapeReqType = X_ShapeQueryVersion; - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay (dpy); - SyncHandle (); - return 0; - } - *major_versionp = rep.majorVersion; - *minor_versionp = rep.minorVersion; - UnlockDisplay (dpy); - SyncHandle (); - return 1; -} - -void XShapeCombineRegion( - register Display *dpy, - Window dest, - int destKind, int xOff, int yOff, - register REGION *r, - int op) -{ - XExtDisplayInfo *info = find_display (dpy); - register xShapeRectanglesReq *req; - register long nbytes; - register int i; - register XRectangle *xr, *pr; - register BOX *pb; - - ShapeSimpleCheckExtension (dpy, info); - - LockDisplay(dpy); - GetReq(ShapeRectangles, req); - xr = (XRectangle *) - _XAllocScratch(dpy, (unsigned long)(r->numRects * sizeof (XRectangle))); - for (pr = xr, pb = r->rects, i = r->numRects; --i >= 0; pr++, pb++) { - pr->x = pb->x1; - pr->y = pb->y1; - pr->width = pb->x2 - pb->x1; - pr->height = pb->y2 - pb->y1; - } - req->reqType = info->codes->major_opcode; - req->shapeReqType = X_ShapeRectangles; - req->op = op; - req->ordering = YXBanded; - req->destKind = destKind; - req->dest = dest; - req->xOff = xOff; - req->yOff = yOff; - - /* SIZEOF(xRectangle) will be a multiple of 4 */ - req->length += r->numRects * (SIZEOF(xRectangle) / 4); - - nbytes = r->numRects * sizeof(xRectangle); - - Data16 (dpy, (short *) xr, nbytes); - UnlockDisplay(dpy); - SyncHandle(); -} - - -void XShapeCombineRectangles ( - register Display *dpy, - XID dest, - int destKind, int xOff, int yOff, - XRectangle *rects, - int n_rects, - int op, int ordering) -{ - XExtDisplayInfo *info = find_display (dpy); - register xShapeRectanglesReq *req; - register long nbytes; - - ShapeSimpleCheckExtension (dpy, info); - - LockDisplay(dpy); - GetReq(ShapeRectangles, req); - req->reqType = info->codes->major_opcode; - req->shapeReqType = X_ShapeRectangles; - req->op = op; - req->ordering = ordering; - req->destKind = destKind; - req->dest = dest; - req->xOff = xOff; - req->yOff = yOff; - - /* SIZEOF(xRectangle) will be a multiple of 4 */ - req->length += n_rects * (SIZEOF(xRectangle) / 4); - - nbytes = n_rects * sizeof(xRectangle); - - Data16 (dpy, (short *) rects, nbytes); - UnlockDisplay(dpy); - SyncHandle(); -} - - -void XShapeCombineMask ( - register Display *dpy, - XID dest, - int destKind, - int xOff, int yOff, - Pixmap src, - int op) -{ - XExtDisplayInfo *info = find_display (dpy); - register xShapeMaskReq *req; - - ShapeSimpleCheckExtension (dpy, info); - - LockDisplay(dpy); - GetReq(ShapeMask, req); - req->reqType = info->codes->major_opcode; - req->shapeReqType = X_ShapeMask; - req->op = op; - req->destKind = destKind; - req->dest = dest; - req->xOff = xOff; - req->yOff = yOff; - req->src = src; - UnlockDisplay(dpy); - SyncHandle(); -} - -void XShapeCombineShape ( - register Display *dpy, - XID dest, - int destKind, - int xOff, int yOff, - XID src, - int srcKind, - int op) -{ - XExtDisplayInfo *info = find_display (dpy); - register xShapeCombineReq *req; - - ShapeSimpleCheckExtension (dpy, info); - - LockDisplay(dpy); - GetReq(ShapeCombine, req); - req->reqType = info->codes->major_opcode; - req->shapeReqType = X_ShapeCombine; - req->op = op; - req->destKind = destKind; - req->srcKind = srcKind; - req->dest = dest; - req->xOff = xOff; - req->yOff = yOff; - req->src = src; - UnlockDisplay(dpy); - SyncHandle(); -} - -void XShapeOffsetShape ( - register Display *dpy, - XID dest, - int destKind, - int xOff, int yOff) -{ - XExtDisplayInfo *info = find_display (dpy); - register xShapeOffsetReq *req; - - ShapeSimpleCheckExtension (dpy, info); - - LockDisplay(dpy); - GetReq(ShapeOffset, req); - req->reqType = info->codes->major_opcode; - req->shapeReqType = X_ShapeOffset; - req->destKind = destKind; - req->dest = dest; - req->xOff = xOff; - req->yOff = yOff; - UnlockDisplay(dpy); - SyncHandle(); -} - -Status XShapeQueryExtents ( - register Display *dpy, - Window window, - int *bShaped, int *xbs, int *ybs, unsigned int *wbs, unsigned int *hbs, /* RETURN */ - int *cShaped, int *xcs, int *ycs, unsigned int *wcs, unsigned int *hcs /* RETURN */) -{ - XExtDisplayInfo *info = find_display (dpy); - xShapeQueryExtentsReply rep; - register xShapeQueryExtentsReq *req; - - ShapeCheckExtension (dpy, info, 0); - - LockDisplay (dpy); - GetReq (ShapeQueryExtents, req); - req->reqType = info->codes->major_opcode; - req->shapeReqType = X_ShapeQueryExtents; - req->window = window; - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay (dpy); - SyncHandle (); - return 0; - } - *bShaped = rep.boundingShaped; - *cShaped = rep.clipShaped; - *xbs = cvtINT16toInt (rep.xBoundingShape); - *ybs = cvtINT16toInt (rep.yBoundingShape); - *wbs = rep.widthBoundingShape; - *hbs = rep.heightBoundingShape; - *xcs = cvtINT16toInt (rep.xClipShape); - *ycs = cvtINT16toInt (rep.yClipShape); - *wcs = rep.widthClipShape; - *hcs = rep.heightClipShape; - UnlockDisplay (dpy); - SyncHandle (); - return 1; -} - - -void XShapeSelectInput ( - register Display *dpy, - Window window, - unsigned long mask) -{ - XExtDisplayInfo *info = find_display (dpy); - register xShapeSelectInputReq *req; - - ShapeSimpleCheckExtension (dpy, info); - - LockDisplay (dpy); - GetReq (ShapeSelectInput, req); - req->reqType = info->codes->major_opcode; - req->shapeReqType = X_ShapeSelectInput; - req->window = window; - if (mask & ShapeNotifyMask) - req->enable = xTrue; - else - req->enable = xFalse; - UnlockDisplay (dpy); - SyncHandle (); -} - -unsigned long XShapeInputSelected (register Display *dpy, Window window) -{ - XExtDisplayInfo *info = find_display (dpy); - register xShapeInputSelectedReq *req; - xShapeInputSelectedReply rep; - - ShapeCheckExtension (dpy, info, False); - - LockDisplay (dpy); - GetReq (ShapeInputSelected, req); - req->reqType = info->codes->major_opcode; - req->shapeReqType = X_ShapeInputSelected; - req->window = window; - if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay (dpy); - SyncHandle (); - return False; - } - UnlockDisplay (dpy); - SyncHandle (); - return rep.enabled ? ShapeNotifyMask : 0L; -} - - -XRectangle *XShapeGetRectangles ( - register Display *dpy, - Window window, - int kind, - int *count, /* RETURN */ - int *ordering /* RETURN */) -{ - XExtDisplayInfo *info = find_display (dpy); - register xShapeGetRectanglesReq *req; - xShapeGetRectanglesReply rep; - XRectangle *rects; - xRectangle *xrects; - int i; - - ShapeCheckExtension (dpy, info, (XRectangle *)NULL); - - LockDisplay (dpy); - GetReq (ShapeGetRectangles, req); - req->reqType = info->codes->major_opcode; - req->shapeReqType = X_ShapeGetRectangles; - req->window = window; - req->kind = kind; - if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay (dpy); - SyncHandle (); - return (XRectangle *)NULL; - } - *count = rep.nrects; - *ordering = rep.ordering; - rects = NULL; - if (*count) { - xrects = (xRectangle *) Xmalloc (*count * sizeof (xRectangle)); - rects = (XRectangle *) Xmalloc (*count * sizeof (XRectangle)); - if (!xrects || !rects) { - if (xrects) - Xfree (xrects); - if (rects) - Xfree (rects); - _XEatData (dpy, *count * sizeof (xRectangle)); - rects = NULL; - *count = 0; - } else { - _XRead (dpy, (char *) xrects, *count * sizeof (xRectangle)); - for (i = 0; i < *count; i++) { - rects[i].x = (short) cvtINT16toInt (xrects[i].x); - rects[i].y = (short) cvtINT16toInt (xrects[i].y); - rects[i].width = xrects[i].width; - rects[i].height = xrects[i].height; - } - Xfree (xrects); - } - } - UnlockDisplay (dpy); - SyncHandle (); - return rects; -} +/* + * +Copyright 1989, 1998 The Open Group + +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + * + * Author: Keith Packard, MIT X Consortium + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include +#include +#include + +static XExtensionInfo _shape_info_data; +static XExtensionInfo *shape_info = &_shape_info_data; +static /* const */ char *shape_extension_name = SHAPENAME; + +#define ShapeCheckExtension(dpy,i,val) \ + XextCheckExtension (dpy, i, shape_extension_name, val) +#define ShapeSimpleCheckExtension(dpy,i) \ + XextSimpleCheckExtension (dpy, i, shape_extension_name) + + +/***************************************************************************** + * * + * private utility routines * + * * + *****************************************************************************/ + +static int close_display(Display *dpy, XExtCodes *codes); +static Bool wire_to_event (Display *dpy, XEvent *re, xEvent *event); +static Status event_to_wire (Display *dpy, XEvent *re, xEvent *event); +static /* const */ XExtensionHooks shape_extension_hooks = { + NULL, /* create_gc */ + NULL, /* copy_gc */ + NULL, /* flush_gc */ + NULL, /* free_gc */ + NULL, /* create_font */ + NULL, /* free_font */ + close_display, /* close_display */ + wire_to_event, /* wire_to_event */ + event_to_wire, /* event_to_wire */ + NULL, /* error */ + NULL, /* error_string */ +}; + +static XEXT_GENERATE_FIND_DISPLAY (find_display, shape_info, + shape_extension_name, + &shape_extension_hooks, + ShapeNumberEvents, NULL) + +static XEXT_GENERATE_CLOSE_DISPLAY (close_display, shape_info) + + +static Bool +wire_to_event (Display *dpy, XEvent *re, xEvent *event) +{ + XExtDisplayInfo *info = find_display (dpy); + XShapeEvent *se; + xShapeNotifyEvent *sevent; + + ShapeCheckExtension (dpy, info, False); + + switch ((event->u.u.type & 0x7f) - info->codes->first_event) { + case ShapeNotify: + se = (XShapeEvent *) re; + sevent = (xShapeNotifyEvent *) event; + se->type = sevent->type & 0x7f; + se->serial = _XSetLastRequestRead(dpy,(xGenericReply *) event); + se->send_event = (sevent->type & 0x80) != 0; + se->display = dpy; + se->window = sevent->window; + se->kind = sevent->kind; + se->x = cvtINT16toInt (sevent->x); + se->y = cvtINT16toInt (sevent->y); + se->width = sevent->width; + se->height = sevent->height; + se->time = sevent->time; + se->shaped = True; + if (sevent->shaped == xFalse) + se->shaped = False; + return True; + } + return False; +} + +static Status +event_to_wire (Display *dpy, XEvent *re, xEvent *event) +{ + XExtDisplayInfo *info = find_display (dpy); + XShapeEvent *se; + xShapeNotifyEvent *sevent; + + ShapeCheckExtension (dpy, info, 0); + + switch ((re->type & 0x7f) - info->codes->first_event) { + case ShapeNotify: + se = (XShapeEvent *) re; + sevent = (xShapeNotifyEvent *) event; + sevent->type = se->type | (se->send_event ? 0x80 : 0); + sevent->sequenceNumber = se->serial & 0xffff; + sevent->window = se->window; + sevent->kind = se->kind; + sevent->x = se->x; + sevent->y = se->y; + sevent->width = se->width; + sevent->height = se->height; + sevent->time = se->time; + return 1; + } + return 0; +} + + +/**************************************************************************** + * * + * Shape public interfaces * + * * + ****************************************************************************/ + +Bool XShapeQueryExtension (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; + } +} + + +Status XShapeQueryVersion( + Display *dpy, + int *major_versionp, + int *minor_versionp) +{ + XExtDisplayInfo *info = find_display (dpy); + xShapeQueryVersionReply rep; + register xShapeQueryVersionReq *req; + + ShapeCheckExtension (dpy, info, 0); + + LockDisplay (dpy); + GetReq (ShapeQueryVersion, req); + req->reqType = info->codes->major_opcode; + req->shapeReqType = X_ShapeQueryVersion; + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return 0; + } + *major_versionp = rep.majorVersion; + *minor_versionp = rep.minorVersion; + UnlockDisplay (dpy); + SyncHandle (); + return 1; +} + +void XShapeCombineRegion( + register Display *dpy, + Window dest, + int destKind, int xOff, int yOff, + register REGION *r, + int op) +{ + XExtDisplayInfo *info = find_display (dpy); + register xShapeRectanglesReq *req; + register long nbytes; + register int i; + register XRectangle *xr, *pr; + register BOX *pb; + + ShapeSimpleCheckExtension (dpy, info); + + LockDisplay(dpy); + GetReq(ShapeRectangles, req); + xr = (XRectangle *) + _XAllocScratch(dpy, (unsigned long)(r->numRects * sizeof (XRectangle))); + for (pr = xr, pb = r->rects, i = r->numRects; --i >= 0; pr++, pb++) { + pr->x = pb->x1; + pr->y = pb->y1; + pr->width = pb->x2 - pb->x1; + pr->height = pb->y2 - pb->y1; + } + req->reqType = info->codes->major_opcode; + req->shapeReqType = X_ShapeRectangles; + req->op = op; + req->ordering = YXBanded; + req->destKind = destKind; + req->dest = dest; + req->xOff = xOff; + req->yOff = yOff; + + /* SIZEOF(xRectangle) will be a multiple of 4 */ + req->length += r->numRects * (SIZEOF(xRectangle) / 4); + + nbytes = r->numRects * sizeof(xRectangle); + + Data16 (dpy, (short *) xr, nbytes); + UnlockDisplay(dpy); + SyncHandle(); +} + + +void XShapeCombineRectangles ( + register Display *dpy, + XID dest, + int destKind, int xOff, int yOff, + XRectangle *rects, + int n_rects, + int op, int ordering) +{ + XExtDisplayInfo *info = find_display (dpy); + register xShapeRectanglesReq *req; + register long nbytes; + + ShapeSimpleCheckExtension (dpy, info); + + LockDisplay(dpy); + GetReq(ShapeRectangles, req); + req->reqType = info->codes->major_opcode; + req->shapeReqType = X_ShapeRectangles; + req->op = op; + req->ordering = ordering; + req->destKind = destKind; + req->dest = dest; + req->xOff = xOff; + req->yOff = yOff; + + /* SIZEOF(xRectangle) will be a multiple of 4 */ + req->length += n_rects * (SIZEOF(xRectangle) / 4); + + nbytes = n_rects * sizeof(xRectangle); + + Data16 (dpy, (short *) rects, nbytes); + UnlockDisplay(dpy); + SyncHandle(); +} + + +void XShapeCombineMask ( + register Display *dpy, + XID dest, + int destKind, + int xOff, int yOff, + Pixmap src, + int op) +{ + XExtDisplayInfo *info = find_display (dpy); + register xShapeMaskReq *req; + + ShapeSimpleCheckExtension (dpy, info); + + LockDisplay(dpy); + GetReq(ShapeMask, req); + req->reqType = info->codes->major_opcode; + req->shapeReqType = X_ShapeMask; + req->op = op; + req->destKind = destKind; + req->dest = dest; + req->xOff = xOff; + req->yOff = yOff; + req->src = src; + UnlockDisplay(dpy); + SyncHandle(); +} + +void XShapeCombineShape ( + register Display *dpy, + XID dest, + int destKind, + int xOff, int yOff, + XID src, + int srcKind, + int op) +{ + XExtDisplayInfo *info = find_display (dpy); + register xShapeCombineReq *req; + + ShapeSimpleCheckExtension (dpy, info); + + LockDisplay(dpy); + GetReq(ShapeCombine, req); + req->reqType = info->codes->major_opcode; + req->shapeReqType = X_ShapeCombine; + req->op = op; + req->destKind = destKind; + req->srcKind = srcKind; + req->dest = dest; + req->xOff = xOff; + req->yOff = yOff; + req->src = src; + UnlockDisplay(dpy); + SyncHandle(); +} + +void XShapeOffsetShape ( + register Display *dpy, + XID dest, + int destKind, + int xOff, int yOff) +{ + XExtDisplayInfo *info = find_display (dpy); + register xShapeOffsetReq *req; + + ShapeSimpleCheckExtension (dpy, info); + + LockDisplay(dpy); + GetReq(ShapeOffset, req); + req->reqType = info->codes->major_opcode; + req->shapeReqType = X_ShapeOffset; + req->destKind = destKind; + req->dest = dest; + req->xOff = xOff; + req->yOff = yOff; + UnlockDisplay(dpy); + SyncHandle(); +} + +Status XShapeQueryExtents ( + register Display *dpy, + Window window, + int *bShaped, int *xbs, int *ybs, unsigned int *wbs, unsigned int *hbs, /* RETURN */ + int *cShaped, int *xcs, int *ycs, unsigned int *wcs, unsigned int *hcs /* RETURN */) +{ + XExtDisplayInfo *info = find_display (dpy); + xShapeQueryExtentsReply rep; + register xShapeQueryExtentsReq *req; + + ShapeCheckExtension (dpy, info, 0); + + LockDisplay (dpy); + GetReq (ShapeQueryExtents, req); + req->reqType = info->codes->major_opcode; + req->shapeReqType = X_ShapeQueryExtents; + req->window = window; + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return 0; + } + *bShaped = rep.boundingShaped; + *cShaped = rep.clipShaped; + *xbs = cvtINT16toInt (rep.xBoundingShape); + *ybs = cvtINT16toInt (rep.yBoundingShape); + *wbs = rep.widthBoundingShape; + *hbs = rep.heightBoundingShape; + *xcs = cvtINT16toInt (rep.xClipShape); + *ycs = cvtINT16toInt (rep.yClipShape); + *wcs = rep.widthClipShape; + *hcs = rep.heightClipShape; + UnlockDisplay (dpy); + SyncHandle (); + return 1; +} + + +void XShapeSelectInput ( + register Display *dpy, + Window window, + unsigned long mask) +{ + XExtDisplayInfo *info = find_display (dpy); + register xShapeSelectInputReq *req; + + ShapeSimpleCheckExtension (dpy, info); + + LockDisplay (dpy); + GetReq (ShapeSelectInput, req); + req->reqType = info->codes->major_opcode; + req->shapeReqType = X_ShapeSelectInput; + req->window = window; + if (mask & ShapeNotifyMask) + req->enable = xTrue; + else + req->enable = xFalse; + UnlockDisplay (dpy); + SyncHandle (); +} + +unsigned long XShapeInputSelected (register Display *dpy, Window window) +{ + XExtDisplayInfo *info = find_display (dpy); + register xShapeInputSelectedReq *req; + xShapeInputSelectedReply rep; + + ShapeCheckExtension (dpy, info, False); + + LockDisplay (dpy); + GetReq (ShapeInputSelected, req); + req->reqType = info->codes->major_opcode; + req->shapeReqType = X_ShapeInputSelected; + req->window = window; + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return False; + } + UnlockDisplay (dpy); + SyncHandle (); + return rep.enabled ? ShapeNotifyMask : 0L; +} + + +XRectangle *XShapeGetRectangles ( + register Display *dpy, + Window window, + int kind, + int *count, /* RETURN */ + int *ordering /* RETURN */) +{ + XExtDisplayInfo *info = find_display (dpy); + register xShapeGetRectanglesReq *req; + xShapeGetRectanglesReply rep; + XRectangle *rects; + xRectangle *xrects; + int i; + + ShapeCheckExtension (dpy, info, (XRectangle *)NULL); + + LockDisplay (dpy); + GetReq (ShapeGetRectangles, req); + req->reqType = info->codes->major_opcode; + req->shapeReqType = X_ShapeGetRectangles; + req->window = window; + req->kind = kind; + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return (XRectangle *)NULL; + } + *count = rep.nrects; + *ordering = rep.ordering; + rects = NULL; + if (*count) { + xrects = (xRectangle *) Xmalloc (*count * sizeof (xRectangle)); + rects = (XRectangle *) Xmalloc (*count * sizeof (XRectangle)); + if (!xrects || !rects) { + if (xrects) + Xfree (xrects); + if (rects) + Xfree (rects); + _XEatData (dpy, *count * sizeof (xRectangle)); + rects = NULL; + *count = 0; + } else { + _XRead (dpy, (char *) xrects, *count * sizeof (xRectangle)); + for (i = 0; i < *count; i++) { + rects[i].x = (short) cvtINT16toInt (xrects[i].x); + rects[i].y = (short) cvtINT16toInt (xrects[i].y); + rects[i].width = xrects[i].width; + rects[i].height = xrects[i].height; + } + Xfree (xrects); + } + } + UnlockDisplay (dpy); + SyncHandle (); + return rects; +} diff --git a/libXext/src/XShm.c b/libXext/src/XShm.c index d1f1a4d7f..e3f8fa09b 100644 --- a/libXext/src/XShm.c +++ b/libXext/src/XShm.c @@ -74,7 +74,7 @@ static /* const */ char *shm_error_list[] = { "BadShmSeg", /* BadShmSeg */ }; -static XEXT_GENERATE_FIND_DISPLAY (find_display, shm_info, shm_extension_name, +static XEXT_GENERATE_FIND_DISPLAY (find_display, shm_info, shm_extension_name, &shm_extension_hooks, ShmNumberEvents, NULL) static XEXT_GENERATE_CLOSE_DISPLAY (close_display, shm_info) diff --git a/libXext/src/XSync.c b/libXext/src/XSync.c index 9fdb47e2f..0e19922dd 100644 --- a/libXext/src/XSync.c +++ b/libXext/src/XSync.c @@ -1,999 +1,999 @@ -/* - -Copyright 1991, 1993, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -/*********************************************************** -Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts, -and Olivetti Research Limited, Cambridge, England. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -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 names of Digital or Olivetti -not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS, IN NO EVENT SHALL THEY 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. - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include - -static XExtensionInfo _sync_info_data; -static XExtensionInfo *sync_info = &_sync_info_data; -static char *sync_extension_name = SYNC_NAME; - -#define SyncCheckExtension(dpy,i,val) \ - XextCheckExtension(dpy, i, sync_extension_name, val) -#define SyncSimpleCheckExtension(dpy,i) \ - XextSimpleCheckExtension(dpy, i, sync_extension_name) - -static int close_display(Display *dpy, XExtCodes *codes); -static Bool wire_to_event(Display *dpy, XEvent *event, xEvent *wire); -static Status event_to_wire(Display *dpy, XEvent *event, xEvent *wire); -static char *error_string(Display *dpy, int code, XExtCodes *codes, - char *buf, int n); - -static XExtensionHooks sync_extension_hooks = { - NULL, /* create_gc */ - NULL, /* copy_gc */ - NULL, /* flush_gc */ - NULL, /* free_gc */ - NULL, /* create_font */ - NULL, /* free_font */ - close_display, /* close_display */ - wire_to_event, /* wire_to_event */ - event_to_wire, /* event_to_wire */ - NULL, /* error */ - error_string, /* error_string */ -}; - -static char *sync_error_list[] = { - "BadCounter", - "BadAlarm", - "BadFence", -}; - -typedef struct _SyncVersionInfoRec { - short major; - short minor; - int num_errors; -} SyncVersionInfo; - -static /* const */ SyncVersionInfo supported_versions[] = { - { 3 /* major */, 0 /* minor */, 2 /* num_errors */ }, - { 3 /* major */, 1 /* minor */, 3 /* num_errors */ }, -}; - -#define NUM_VERSIONS (sizeof(supported_versions)/sizeof(supported_versions[0])) -#define GET_VERSION(info) ((info) ? (const SyncVersionInfo*)(info)->data : NULL) -#define IS_VERSION_SUPPORTED(info) (!!GET_VERSION(info)) - -static -const SyncVersionInfo* GetVersionInfo(Display *dpy) -{ - xSyncInitializeReply rep; - xSyncInitializeReq *req; - XExtCodes codes; - int i; - - if (!XQueryExtension(dpy, sync_extension_name, - &codes.major_opcode, - &codes.first_event, - &codes.first_error)) - return NULL; - - LockDisplay(dpy); - GetReq(SyncInitialize, req); - req->reqType = codes.major_opcode; - req->syncReqType = X_SyncInitialize; - req->majorVersion = SYNC_MAJOR_VERSION; - req->minorVersion = SYNC_MINOR_VERSION; - if (!_XReply(dpy, (xReply *) & rep, 0, xTrue)) - { - UnlockDisplay(dpy); - SyncHandle(); - return NULL; - } - UnlockDisplay(dpy); - SyncHandle(); - - for (i = 0; i < NUM_VERSIONS; i++) { - if (supported_versions[i].major == rep.majorVersion && - supported_versions[i].minor == rep.minorVersion) { - return &supported_versions[i]; - } - } - - return NULL; -} - -static -XExtDisplayInfo *find_display_create_optional(Display *dpy, Bool create) -{ - XExtDisplayInfo *dpyinfo; - - if (!sync_info) { - if (!(sync_info = XextCreateExtension())) return NULL; - } - - if (!(dpyinfo = XextFindDisplay (sync_info, dpy)) && create) { - dpyinfo = XextAddDisplay(sync_info, dpy, - sync_extension_name, - &sync_extension_hooks, - XSyncNumberEvents, - (XPointer)GetVersionInfo(dpy)); - } - - return dpyinfo; -} - -static -XExtDisplayInfo *find_display (Display *dpy) -{ - return find_display_create_optional(dpy, True); -} - -static -XEXT_GENERATE_CLOSE_DISPLAY(close_display, sync_info) - -static -char *error_string(Display *dpy, int code, XExtCodes *codes, char *buf, int n) -{ - XExtDisplayInfo *info = find_display_create_optional(dpy, False); - int nerr = IS_VERSION_SUPPORTED(info) ? GET_VERSION(info)->num_errors : 0; - - code -= codes->first_error; - if (code >= 0 && code < nerr) { - char tmp[256]; - sprintf (tmp, "%s.%d", sync_extension_name, code); - XGetErrorDatabaseText (dpy, "XProtoError", tmp, sync_error_list[code], buf, n); - return buf; - } - return (char *)0; -} - -static Bool -wire_to_event(Display *dpy, XEvent *event, xEvent *wire) -{ - XExtDisplayInfo *info = find_display(dpy); - XSyncCounterNotifyEvent *aevent; - xSyncCounterNotifyEvent *awire; - XSyncAlarmNotifyEvent *anl; - xSyncAlarmNotifyEvent *ane; - - SyncCheckExtension(dpy, info, False); - - switch ((wire->u.u.type & 0x7F) - info->codes->first_event) - { - case XSyncCounterNotify: - awire = (xSyncCounterNotifyEvent *) wire; - aevent = (XSyncCounterNotifyEvent *) event; - aevent->type = awire->type & 0x7F; - aevent->serial = _XSetLastRequestRead(dpy, - (xGenericReply *) wire); - aevent->send_event = (awire->type & 0x80) != 0; - aevent->display = dpy; - aevent->counter = awire->counter; - XSyncIntsToValue(&aevent->wait_value, awire->wait_value_lo, - awire->wait_value_hi); - XSyncIntsToValue(&aevent->counter_value, - awire->counter_value_lo, - awire->counter_value_hi); - aevent->time = awire->time; - aevent->count = awire->count; - aevent->destroyed = awire->destroyed; - return True; - - case XSyncAlarmNotify: - ane = (xSyncAlarmNotifyEvent *) wire; /* ENCODING EVENT PTR */ - anl = (XSyncAlarmNotifyEvent *) event; /* LIBRARY EVENT PTR */ - anl->type = ane->type & 0x7F; - anl->serial = _XSetLastRequestRead(dpy, - (xGenericReply *) wire); - anl->send_event = (ane->type & 0x80) != 0; - anl->display = dpy; - anl->alarm = ane->alarm; - XSyncIntsToValue(&anl->counter_value, - ane->counter_value_lo, - ane->counter_value_hi); - XSyncIntsToValue(&anl->alarm_value, - ane->alarm_value_lo, - ane->alarm_value_hi); - anl->state = (XSyncAlarmState)ane->state; - anl->time = ane->time; - return True; - } - - return False; -} - -static Status -event_to_wire(Display *dpy, XEvent *event, xEvent *wire) -{ - XExtDisplayInfo *info = find_display(dpy); - XSyncCounterNotifyEvent *aevent; - xSyncCounterNotifyEvent *awire; - XSyncAlarmNotifyEvent *anl; - xSyncAlarmNotifyEvent *ane; - - SyncCheckExtension(dpy, info, False); - - switch ((event->type & 0x7F) - info->codes->first_event) - { - case XSyncCounterNotify: - awire = (xSyncCounterNotifyEvent *) wire; - aevent = (XSyncCounterNotifyEvent *) event; - awire->type = aevent->type | (aevent->send_event ? 0x80 : 0); - awire->sequenceNumber = aevent->serial & 0xFFFF; - awire->counter = aevent->counter; - awire->wait_value_lo = XSyncValueLow32(aevent->wait_value); - awire->wait_value_hi = XSyncValueHigh32(aevent->wait_value); - awire->counter_value_lo = XSyncValueLow32(aevent->counter_value); - awire->counter_value_hi = XSyncValueHigh32(aevent->counter_value); - awire->time = aevent->time; - awire->count = aevent->count; - awire->destroyed = aevent->destroyed; - return True; - - case XSyncAlarmNotify: - ane = (xSyncAlarmNotifyEvent *) wire; /* ENCODING EVENT PTR */ - anl = (XSyncAlarmNotifyEvent *) event; /* LIBRARY EVENT PTR */ - ane->type = anl->type | (anl->send_event ? 0x80 : 0); - ane->sequenceNumber = anl->serial & 0xFFFF; - ane->alarm = anl->alarm; - ane->counter_value_lo = XSyncValueLow32(anl->counter_value); - ane->counter_value_hi = XSyncValueHigh32(anl->counter_value); - ane->alarm_value_lo = XSyncValueLow32(anl->alarm_value); - ane->alarm_value_hi = XSyncValueHigh32(anl->alarm_value); - ane->state = anl->state; - ane->time = anl->time; - return True; - } - return False; -} - -Status -XSyncQueryExtension( - 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 -XSyncInitialize( - Display *dpy, - int *major_version_return, int *minor_version_return) -{ - XExtDisplayInfo *info = find_display(dpy); - - SyncCheckExtension(dpy, info, False); - - if (IS_VERSION_SUPPORTED(info)) { - *major_version_return = GET_VERSION(info)->major; - *minor_version_return = GET_VERSION(info)->minor; - - return True; - } else { - return False; - } -} - -XSyncSystemCounter * -XSyncListSystemCounters(Display *dpy, int *n_counters_return) -{ - XExtDisplayInfo *info = find_display(dpy); - xSyncListSystemCountersReply rep; - xSyncListSystemCountersReq *req; - XSyncSystemCounter *list = NULL; - - SyncCheckExtension(dpy, info, NULL); - - LockDisplay(dpy); - GetReq(SyncListSystemCounters, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncListSystemCounters; - if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) - goto bail; - - *n_counters_return = rep.nCounters; - if (rep.nCounters > 0) - { - xSyncSystemCounter *pWireSysCounter, *pNextWireSysCounter; - XSyncCounter counter; - int replylen; - int i; - - list = Xmalloc(rep.nCounters * sizeof(XSyncSystemCounter)); - replylen = rep.length << 2; - pWireSysCounter = Xmalloc ((unsigned) replylen + sizeof(XSyncCounter)); - /* +1 to leave room for last counter read-ahead */ - - if ((!list) || (!pWireSysCounter)) - { - if (list) Xfree((char *) list); - if (pWireSysCounter) Xfree((char *) pWireSysCounter); - _XEatData(dpy, (unsigned long) replylen); - list = NULL; - goto bail; - } - - _XReadPad(dpy, (char *)pWireSysCounter, replylen); - - counter = pWireSysCounter->counter; - for (i = 0; i < rep.nCounters; i++) - { - list[i].counter = counter; - XSyncIntsToValue(&list[i].resolution, - pWireSysCounter->resolution_lo, - pWireSysCounter->resolution_hi); - - /* we may be about to clobber the counter field of the - * next syscounter because we have to add a null terminator - * to the counter name string. So we save the next counter - * here. - */ - pNextWireSysCounter = (xSyncSystemCounter *) - (((char *)pWireSysCounter) + ((SIZEOF(xSyncSystemCounter) + - pWireSysCounter->name_length + 3) & ~3)); - counter = pNextWireSysCounter->counter; - - list[i].name = ((char *)pWireSysCounter) + - SIZEOF(xSyncSystemCounter); - /* null-terminate the string */ - *(list[i].name + pWireSysCounter->name_length) = '\0'; - pWireSysCounter = pNextWireSysCounter; - } - } - -bail: - UnlockDisplay(dpy); - SyncHandle(); - return list; -} - -void -XSyncFreeSystemCounterList(XSyncSystemCounter *list) -{ - if (list) - { - Xfree( ((char *)list[0].name) - SIZEOF(xSyncSystemCounter)); - Xfree(list); - } -} - - -XSyncCounter -XSyncCreateCounter(Display *dpy, XSyncValue initial_value) -{ - XExtDisplayInfo *info = find_display(dpy); - xSyncCreateCounterReq *req; - - SyncCheckExtension(dpy, info, None); - - LockDisplay(dpy); - GetReq(SyncCreateCounter, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncCreateCounter; - - req->cid = XAllocID(dpy); - req->initial_value_lo = XSyncValueLow32(initial_value); - req->initial_value_hi = XSyncValueHigh32(initial_value); - - UnlockDisplay(dpy); - SyncHandle(); - return req->cid; -} - -Status -XSyncSetCounter(Display *dpy, XSyncCounter counter, XSyncValue value) -{ - XExtDisplayInfo *info = find_display(dpy); - xSyncSetCounterReq *req; - - SyncCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(SyncSetCounter, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncSetCounter; - req->cid = counter; - req->value_lo = XSyncValueLow32(value); - req->value_hi = XSyncValueHigh32(value); - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Status -XSyncChangeCounter(Display *dpy, XSyncCounter counter, XSyncValue value) -{ - XExtDisplayInfo *info = find_display(dpy); - xSyncChangeCounterReq *req; - - SyncCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(SyncChangeCounter, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncChangeCounter; - req->cid = counter; - req->value_lo = XSyncValueLow32(value); - req->value_hi = XSyncValueHigh32(value); - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Status -XSyncDestroyCounter(Display *dpy, XSyncCounter counter) -{ - XExtDisplayInfo *info = find_display(dpy); - xSyncDestroyCounterReq *req; - - SyncCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(SyncDestroyCounter, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncDestroyCounter; - req->counter = counter; - UnlockDisplay(dpy); - SyncHandle(); - - return True; -} - -Status -XSyncQueryCounter(Display *dpy, XSyncCounter counter, XSyncValue *value_return) -{ - XExtDisplayInfo *info = find_display(dpy); - xSyncQueryCounterReply rep; - xSyncQueryCounterReq *req; - - SyncCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(SyncQueryCounter, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncQueryCounter; - req->counter = counter; - if (!_XReply(dpy, (xReply *) & rep, 0, xTrue)) - { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - XSyncIntsToValue(value_return, rep.value_lo, rep.value_hi); - UnlockDisplay(dpy); - SyncHandle(); - - return True; -} - - -Status -XSyncAwait(Display *dpy, XSyncWaitCondition *wait_list, int n_conditions) -{ - XExtDisplayInfo *info = find_display(dpy); - XSyncWaitCondition *wait_item = wait_list; - xSyncAwaitReq *req; - unsigned int len; - - SyncCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(SyncAwait, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncAwait; - len = (n_conditions * SIZEOF(xSyncWaitCondition)) >> 2; - SetReqLen(req, len, len /* XXX */ ); - - while (n_conditions--) - { - xSyncWaitCondition wc; - wc.counter = wait_item->trigger.counter; - wc.value_type = wait_item->trigger.value_type; - wc.wait_value_lo = XSyncValueLow32(wait_item->trigger.wait_value); - wc.wait_value_hi = XSyncValueHigh32(wait_item->trigger.wait_value); - wc.test_type = wait_item->trigger.test_type; - wc.event_threshold_lo = XSyncValueLow32(wait_item->event_threshold); - wc.event_threshold_hi = XSyncValueHigh32(wait_item->event_threshold); - Data(dpy, (char *)&wc, SIZEOF(xSyncWaitCondition)); - wait_item++; /* get next trigger */ - } - - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -static void -_XProcessAlarmAttributes(Display *dpy, xSyncChangeAlarmReq *req, - unsigned long valuemask, - XSyncAlarmAttributes *attributes) -{ - - unsigned long values[32]; - unsigned long *value = values; - unsigned int nvalues; - - if (valuemask & XSyncCACounter) - *value++ = attributes->trigger.counter; - - if (valuemask & XSyncCAValueType) - *value++ = attributes->trigger.value_type; - - if (valuemask & XSyncCAValue) - { - *value++ = XSyncValueHigh32(attributes->trigger.wait_value); - *value++ = XSyncValueLow32(attributes->trigger.wait_value); - } - - if (valuemask & XSyncCATestType) - *value++ = attributes->trigger.test_type; - - if (valuemask & XSyncCADelta) - { - *value++ = XSyncValueHigh32(attributes->delta); - *value++ = XSyncValueLow32(attributes->delta); - } - - if (valuemask & XSyncCAEvents) - *value++ = attributes->events; - - /* N.B. the 'state' field cannot be set or changed */ - req->length += (nvalues = value - values); - nvalues <<= 2; /* watch out for macros... */ - - Data32(dpy, (long *) values, (long) nvalues); -} - -XSyncAlarm -XSyncCreateAlarm( - Display *dpy, - unsigned long values_mask, - XSyncAlarmAttributes *values) -{ - XExtDisplayInfo *info = find_display(dpy); - xSyncCreateAlarmReq *req; - XSyncAlarm aid; - - SyncCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(SyncCreateAlarm, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncCreateAlarm; - req->id = aid = XAllocID(dpy); - values_mask &= XSyncCACounter | XSyncCAValueType | XSyncCAValue - | XSyncCATestType | XSyncCADelta | XSyncCAEvents; - if ((req->valueMask = values_mask)) - _XProcessAlarmAttributes(dpy, (xSyncChangeAlarmReq *) req, - values_mask, values); - UnlockDisplay(dpy); - SyncHandle(); - return aid; -} - -Status -XSyncDestroyAlarm(Display *dpy, XSyncAlarm alarm) -{ - XExtDisplayInfo *info = find_display(dpy); - xSyncDestroyAlarmReq *req; - - SyncCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(SyncDestroyAlarm, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncDestroyAlarm; - req->alarm = alarm; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Status -XSyncQueryAlarm( - Display *dpy, - XSyncAlarm alarm, - XSyncAlarmAttributes *values_return) -{ - XExtDisplayInfo *info = find_display(dpy); - xSyncQueryAlarmReq *req; - xSyncQueryAlarmReply rep; - - SyncCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(SyncQueryAlarm, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncQueryAlarm; - req->alarm = alarm; - - if (!(_XReply(dpy, (xReply *) & rep, - ((SIZEOF(xSyncQueryAlarmReply) - SIZEOF(xGenericReply)) >> 2), xFalse))) - { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - - values_return->trigger.counter = rep.counter; - values_return->trigger.value_type = (XSyncValueType)rep.value_type; - XSyncIntsToValue(&values_return->trigger.wait_value, - rep.wait_value_lo, rep.wait_value_hi); - values_return->trigger.test_type = (XSyncTestType)rep.test_type; - XSyncIntsToValue(&values_return->delta, rep.delta_lo, - rep.delta_hi); - values_return->events = rep.events; - values_return->state = (XSyncAlarmState)rep.state; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Status -XSyncChangeAlarm( - Display *dpy, - XSyncAlarm alarm, - unsigned long values_mask, - XSyncAlarmAttributes *values) -{ - XExtDisplayInfo *info = find_display(dpy); - xSyncChangeAlarmReq *req; - - SyncCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(SyncChangeAlarm, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncChangeAlarm; - req->alarm = alarm; - values_mask &= XSyncCACounter | XSyncCAValueType | XSyncCAValue - | XSyncCATestType | XSyncCADelta | XSyncCAEvents; - if ((req->valueMask = values_mask)) - _XProcessAlarmAttributes(dpy, req, values_mask, values); - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Status -XSyncSetPriority( - Display *dpy, - XID client_resource_id, - int priority) -{ - XExtDisplayInfo *info = find_display(dpy); - xSyncSetPriorityReq *req; - - SyncCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(SyncSetPriority, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncSetPriority; - req->id = client_resource_id; - req->priority = priority; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Status -XSyncGetPriority(Display *dpy, XID client_resource_id, int *return_priority) -{ - XExtDisplayInfo *info = find_display(dpy); - xSyncGetPriorityReply rep; - xSyncGetPriorityReq *req; - - SyncCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(SyncGetPriority, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncGetPriority; - req->id = client_resource_id; - - if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) - { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - if (return_priority) - *return_priority = rep.priority; - - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -XSyncFence -XSyncCreateFence(Display *dpy, Drawable d, Bool initially_triggered) -{ - XExtDisplayInfo *info = find_display(dpy); - xSyncCreateFenceReq *req; - XSyncFence id; - - SyncCheckExtension(dpy, info, None); - - LockDisplay(dpy); - GetReq(SyncCreateFence, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncCreateFence; - - req->d = d; - id = req->fid = XAllocID(dpy); - req->initially_triggered = initially_triggered; - - UnlockDisplay(dpy); - SyncHandle(); - return id; -} - -Bool -XSyncTriggerFence(Display *dpy, XSyncFence fence) -{ - XExtDisplayInfo *info = find_display(dpy); - xSyncTriggerFenceReq *req; - - SyncCheckExtension(dpy, info, None); - - LockDisplay(dpy); - GetReq(SyncTriggerFence, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncTriggerFence; - - req->fid = fence; - - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XSyncResetFence(Display *dpy, XSyncFence fence) -{ - XExtDisplayInfo *info = find_display(dpy); - xSyncResetFenceReq *req; - - SyncCheckExtension(dpy, info, None); - - LockDisplay(dpy); - GetReq(SyncResetFence, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncResetFence; - - req->fid = fence; - - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XSyncDestroyFence(Display *dpy, XSyncFence fence) -{ - XExtDisplayInfo *info = find_display(dpy); - xSyncDestroyFenceReq *req; - - SyncCheckExtension(dpy, info, None); - - LockDisplay(dpy); - GetReq(SyncDestroyFence, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncDestroyFence; - - req->fid = fence; - - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XSyncQueryFence(Display *dpy, XSyncFence fence, Bool *triggered) -{ - XExtDisplayInfo *info = find_display(dpy); - xSyncQueryFenceReply rep; - xSyncQueryFenceReq *req; - - SyncCheckExtension(dpy, info, None); - - LockDisplay(dpy); - GetReq(SyncQueryFence, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncQueryFence; - req->fid = fence; - - if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) - { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - if (triggered) - *triggered = rep.triggered; - - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XSyncAwaitFence(Display *dpy, const XSyncFence *fence_list, int n_fences) -{ - XExtDisplayInfo *info = find_display(dpy); - xSyncAwaitFenceReq *req; - - SyncCheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(SyncAwaitFence, req); - req->reqType = info->codes->major_opcode; - req->syncReqType = X_SyncAwaitFence; - SetReqLen(req, n_fences, n_fences); - - Data32(dpy, (char *)fence_list, sizeof(CARD32) * n_fences); - - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -/* - * Functions corresponding to the macros for manipulating 64-bit values - */ - -void -XSyncIntToValue(XSyncValue *pv, int i) -{ - _XSyncIntToValue(pv,i); -} - -void -XSyncIntsToValue(XSyncValue *pv, unsigned int l, int h) -{ - _XSyncIntsToValue(pv, l, h); -} - -Bool -XSyncValueGreaterThan(XSyncValue a, XSyncValue b) -{ - return _XSyncValueGreaterThan(a, b); -} - -Bool -XSyncValueLessThan(XSyncValue a, XSyncValue b) -{ - return _XSyncValueLessThan(a, b); -} - -Bool -XSyncValueGreaterOrEqual(XSyncValue a, XSyncValue b) -{ - return _XSyncValueGreaterOrEqual(a, b); -} - -Bool -XSyncValueLessOrEqual(XSyncValue a, XSyncValue b) -{ - return _XSyncValueLessOrEqual(a, b); -} - -Bool -XSyncValueEqual(XSyncValue a, XSyncValue b) -{ - return _XSyncValueEqual(a, b); -} - -Bool -XSyncValueIsNegative(XSyncValue v) -{ - return _XSyncValueIsNegative(v); -} - -Bool -XSyncValueIsZero(XSyncValue a) -{ - return _XSyncValueIsZero(a); -} - -Bool -XSyncValueIsPositive(XSyncValue v) -{ - return _XSyncValueIsPositive(v); -} - -unsigned int -XSyncValueLow32(XSyncValue v) -{ - return _XSyncValueLow32(v); -} - -int -XSyncValueHigh32(XSyncValue v) -{ - return _XSyncValueHigh32(v); -} - -void -XSyncValueAdd(XSyncValue *presult, XSyncValue a, XSyncValue b, Bool *poverflow) -{ - _XSyncValueAdd(presult, a, b, poverflow); -} - -void -XSyncValueSubtract( - XSyncValue *presult, - XSyncValue a, XSyncValue b, - Bool *poverflow) -{ - _XSyncValueSubtract(presult, a, b, poverflow); -} - -void -XSyncMaxValue(XSyncValue *pv) -{ - _XSyncMaxValue(pv); -} - -void -XSyncMinValue(XSyncValue *pv) -{ - _XSyncMinValue(pv); -} +/* + +Copyright 1991, 1993, 1998 The Open Group + +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +/*********************************************************** +Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts, +and Olivetti Research Limited, Cambridge, England. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +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 names of Digital or Olivetti +not be used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL THEY 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. + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include +#include + +static XExtensionInfo _sync_info_data; +static XExtensionInfo *sync_info = &_sync_info_data; +static char *sync_extension_name = SYNC_NAME; + +#define SyncCheckExtension(dpy,i,val) \ + XextCheckExtension(dpy, i, sync_extension_name, val) +#define SyncSimpleCheckExtension(dpy,i) \ + XextSimpleCheckExtension(dpy, i, sync_extension_name) + +static int close_display(Display *dpy, XExtCodes *codes); +static Bool wire_to_event(Display *dpy, XEvent *event, xEvent *wire); +static Status event_to_wire(Display *dpy, XEvent *event, xEvent *wire); +static char *error_string(Display *dpy, int code, XExtCodes *codes, + char *buf, int n); + +static XExtensionHooks sync_extension_hooks = { + NULL, /* create_gc */ + NULL, /* copy_gc */ + NULL, /* flush_gc */ + NULL, /* free_gc */ + NULL, /* create_font */ + NULL, /* free_font */ + close_display, /* close_display */ + wire_to_event, /* wire_to_event */ + event_to_wire, /* event_to_wire */ + NULL, /* error */ + error_string, /* error_string */ +}; + +static char *sync_error_list[] = { + "BadCounter", + "BadAlarm", + "BadFence", +}; + +typedef struct _SyncVersionInfoRec { + short major; + short minor; + int num_errors; +} SyncVersionInfo; + +static /* const */ SyncVersionInfo supported_versions[] = { + { 3 /* major */, 0 /* minor */, 2 /* num_errors */ }, + { 3 /* major */, 1 /* minor */, 3 /* num_errors */ }, +}; + +#define NUM_VERSIONS (sizeof(supported_versions)/sizeof(supported_versions[0])) +#define GET_VERSION(info) ((info) ? (const SyncVersionInfo*)(info)->data : NULL) +#define IS_VERSION_SUPPORTED(info) (!!GET_VERSION(info)) + +static +const SyncVersionInfo* GetVersionInfo(Display *dpy) +{ + xSyncInitializeReply rep; + xSyncInitializeReq *req; + XExtCodes codes; + int i; + + if (!XQueryExtension(dpy, sync_extension_name, + &codes.major_opcode, + &codes.first_event, + &codes.first_error)) + return NULL; + + LockDisplay(dpy); + GetReq(SyncInitialize, req); + req->reqType = codes.major_opcode; + req->syncReqType = X_SyncInitialize; + req->majorVersion = SYNC_MAJOR_VERSION; + req->minorVersion = SYNC_MINOR_VERSION; + if (!_XReply(dpy, (xReply *) & rep, 0, xTrue)) + { + UnlockDisplay(dpy); + SyncHandle(); + return NULL; + } + UnlockDisplay(dpy); + SyncHandle(); + + for (i = 0; i < NUM_VERSIONS; i++) { + if (supported_versions[i].major == rep.majorVersion && + supported_versions[i].minor == rep.minorVersion) { + return &supported_versions[i]; + } + } + + return NULL; +} + +static +XExtDisplayInfo *find_display_create_optional(Display *dpy, Bool create) +{ + XExtDisplayInfo *dpyinfo; + + if (!sync_info) { + if (!(sync_info = XextCreateExtension())) return NULL; + } + + if (!(dpyinfo = XextFindDisplay (sync_info, dpy)) && create) { + dpyinfo = XextAddDisplay(sync_info, dpy, + sync_extension_name, + &sync_extension_hooks, + XSyncNumberEvents, + (XPointer)GetVersionInfo(dpy)); + } + + return dpyinfo; +} + +static +XExtDisplayInfo *find_display (Display *dpy) +{ + return find_display_create_optional(dpy, True); +} + +static +XEXT_GENERATE_CLOSE_DISPLAY(close_display, sync_info) + +static +char *error_string(Display *dpy, int code, XExtCodes *codes, char *buf, int n) +{ + XExtDisplayInfo *info = find_display_create_optional(dpy, False); + int nerr = IS_VERSION_SUPPORTED(info) ? GET_VERSION(info)->num_errors : 0; + + code -= codes->first_error; + if (code >= 0 && code < nerr) { + char tmp[256]; + sprintf (tmp, "%s.%d", sync_extension_name, code); + XGetErrorDatabaseText (dpy, "XProtoError", tmp, sync_error_list[code], buf, n); + return buf; + } + return (char *)0; +} + +static Bool +wire_to_event(Display *dpy, XEvent *event, xEvent *wire) +{ + XExtDisplayInfo *info = find_display(dpy); + XSyncCounterNotifyEvent *aevent; + xSyncCounterNotifyEvent *awire; + XSyncAlarmNotifyEvent *anl; + xSyncAlarmNotifyEvent *ane; + + SyncCheckExtension(dpy, info, False); + + switch ((wire->u.u.type & 0x7F) - info->codes->first_event) + { + case XSyncCounterNotify: + awire = (xSyncCounterNotifyEvent *) wire; + aevent = (XSyncCounterNotifyEvent *) event; + aevent->type = awire->type & 0x7F; + aevent->serial = _XSetLastRequestRead(dpy, + (xGenericReply *) wire); + aevent->send_event = (awire->type & 0x80) != 0; + aevent->display = dpy; + aevent->counter = awire->counter; + XSyncIntsToValue(&aevent->wait_value, awire->wait_value_lo, + awire->wait_value_hi); + XSyncIntsToValue(&aevent->counter_value, + awire->counter_value_lo, + awire->counter_value_hi); + aevent->time = awire->time; + aevent->count = awire->count; + aevent->destroyed = awire->destroyed; + return True; + + case XSyncAlarmNotify: + ane = (xSyncAlarmNotifyEvent *) wire; /* ENCODING EVENT PTR */ + anl = (XSyncAlarmNotifyEvent *) event; /* LIBRARY EVENT PTR */ + anl->type = ane->type & 0x7F; + anl->serial = _XSetLastRequestRead(dpy, + (xGenericReply *) wire); + anl->send_event = (ane->type & 0x80) != 0; + anl->display = dpy; + anl->alarm = ane->alarm; + XSyncIntsToValue(&anl->counter_value, + ane->counter_value_lo, + ane->counter_value_hi); + XSyncIntsToValue(&anl->alarm_value, + ane->alarm_value_lo, + ane->alarm_value_hi); + anl->state = (XSyncAlarmState)ane->state; + anl->time = ane->time; + return True; + } + + return False; +} + +static Status +event_to_wire(Display *dpy, XEvent *event, xEvent *wire) +{ + XExtDisplayInfo *info = find_display(dpy); + XSyncCounterNotifyEvent *aevent; + xSyncCounterNotifyEvent *awire; + XSyncAlarmNotifyEvent *anl; + xSyncAlarmNotifyEvent *ane; + + SyncCheckExtension(dpy, info, False); + + switch ((event->type & 0x7F) - info->codes->first_event) + { + case XSyncCounterNotify: + awire = (xSyncCounterNotifyEvent *) wire; + aevent = (XSyncCounterNotifyEvent *) event; + awire->type = aevent->type | (aevent->send_event ? 0x80 : 0); + awire->sequenceNumber = aevent->serial & 0xFFFF; + awire->counter = aevent->counter; + awire->wait_value_lo = XSyncValueLow32(aevent->wait_value); + awire->wait_value_hi = XSyncValueHigh32(aevent->wait_value); + awire->counter_value_lo = XSyncValueLow32(aevent->counter_value); + awire->counter_value_hi = XSyncValueHigh32(aevent->counter_value); + awire->time = aevent->time; + awire->count = aevent->count; + awire->destroyed = aevent->destroyed; + return True; + + case XSyncAlarmNotify: + ane = (xSyncAlarmNotifyEvent *) wire; /* ENCODING EVENT PTR */ + anl = (XSyncAlarmNotifyEvent *) event; /* LIBRARY EVENT PTR */ + ane->type = anl->type | (anl->send_event ? 0x80 : 0); + ane->sequenceNumber = anl->serial & 0xFFFF; + ane->alarm = anl->alarm; + ane->counter_value_lo = XSyncValueLow32(anl->counter_value); + ane->counter_value_hi = XSyncValueHigh32(anl->counter_value); + ane->alarm_value_lo = XSyncValueLow32(anl->alarm_value); + ane->alarm_value_hi = XSyncValueHigh32(anl->alarm_value); + ane->state = anl->state; + ane->time = anl->time; + return True; + } + return False; +} + +Status +XSyncQueryExtension( + 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 +XSyncInitialize( + Display *dpy, + int *major_version_return, int *minor_version_return) +{ + XExtDisplayInfo *info = find_display(dpy); + + SyncCheckExtension(dpy, info, False); + + if (IS_VERSION_SUPPORTED(info)) { + *major_version_return = GET_VERSION(info)->major; + *minor_version_return = GET_VERSION(info)->minor; + + return True; + } else { + return False; + } +} + +XSyncSystemCounter * +XSyncListSystemCounters(Display *dpy, int *n_counters_return) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncListSystemCountersReply rep; + xSyncListSystemCountersReq *req; + XSyncSystemCounter *list = NULL; + + SyncCheckExtension(dpy, info, NULL); + + LockDisplay(dpy); + GetReq(SyncListSystemCounters, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncListSystemCounters; + if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) + goto bail; + + *n_counters_return = rep.nCounters; + if (rep.nCounters > 0) + { + xSyncSystemCounter *pWireSysCounter, *pNextWireSysCounter; + XSyncCounter counter; + int replylen; + int i; + + list = Xmalloc(rep.nCounters * sizeof(XSyncSystemCounter)); + replylen = rep.length << 2; + pWireSysCounter = Xmalloc ((unsigned) replylen + sizeof(XSyncCounter)); + /* +1 to leave room for last counter read-ahead */ + + if ((!list) || (!pWireSysCounter)) + { + if (list) Xfree((char *) list); + if (pWireSysCounter) Xfree((char *) pWireSysCounter); + _XEatData(dpy, (unsigned long) replylen); + list = NULL; + goto bail; + } + + _XReadPad(dpy, (char *)pWireSysCounter, replylen); + + counter = pWireSysCounter->counter; + for (i = 0; i < rep.nCounters; i++) + { + list[i].counter = counter; + XSyncIntsToValue(&list[i].resolution, + pWireSysCounter->resolution_lo, + pWireSysCounter->resolution_hi); + + /* we may be about to clobber the counter field of the + * next syscounter because we have to add a null terminator + * to the counter name string. So we save the next counter + * here. + */ + pNextWireSysCounter = (xSyncSystemCounter *) + (((char *)pWireSysCounter) + ((SIZEOF(xSyncSystemCounter) + + pWireSysCounter->name_length + 3) & ~3)); + counter = pNextWireSysCounter->counter; + + list[i].name = ((char *)pWireSysCounter) + + SIZEOF(xSyncSystemCounter); + /* null-terminate the string */ + *(list[i].name + pWireSysCounter->name_length) = '\0'; + pWireSysCounter = pNextWireSysCounter; + } + } + +bail: + UnlockDisplay(dpy); + SyncHandle(); + return list; +} + +void +XSyncFreeSystemCounterList(XSyncSystemCounter *list) +{ + if (list) + { + Xfree( ((char *)list[0].name) - SIZEOF(xSyncSystemCounter)); + Xfree(list); + } +} + + +XSyncCounter +XSyncCreateCounter(Display *dpy, XSyncValue initial_value) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncCreateCounterReq *req; + + SyncCheckExtension(dpy, info, None); + + LockDisplay(dpy); + GetReq(SyncCreateCounter, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncCreateCounter; + + req->cid = XAllocID(dpy); + req->initial_value_lo = XSyncValueLow32(initial_value); + req->initial_value_hi = XSyncValueHigh32(initial_value); + + UnlockDisplay(dpy); + SyncHandle(); + return req->cid; +} + +Status +XSyncSetCounter(Display *dpy, XSyncCounter counter, XSyncValue value) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncSetCounterReq *req; + + SyncCheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(SyncSetCounter, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncSetCounter; + req->cid = counter; + req->value_lo = XSyncValueLow32(value); + req->value_hi = XSyncValueHigh32(value); + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Status +XSyncChangeCounter(Display *dpy, XSyncCounter counter, XSyncValue value) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncChangeCounterReq *req; + + SyncCheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(SyncChangeCounter, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncChangeCounter; + req->cid = counter; + req->value_lo = XSyncValueLow32(value); + req->value_hi = XSyncValueHigh32(value); + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Status +XSyncDestroyCounter(Display *dpy, XSyncCounter counter) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncDestroyCounterReq *req; + + SyncCheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(SyncDestroyCounter, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncDestroyCounter; + req->counter = counter; + UnlockDisplay(dpy); + SyncHandle(); + + return True; +} + +Status +XSyncQueryCounter(Display *dpy, XSyncCounter counter, XSyncValue *value_return) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncQueryCounterReply rep; + xSyncQueryCounterReq *req; + + SyncCheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(SyncQueryCounter, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncQueryCounter; + req->counter = counter; + if (!_XReply(dpy, (xReply *) & rep, 0, xTrue)) + { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + XSyncIntsToValue(value_return, rep.value_lo, rep.value_hi); + UnlockDisplay(dpy); + SyncHandle(); + + return True; +} + + +Status +XSyncAwait(Display *dpy, XSyncWaitCondition *wait_list, int n_conditions) +{ + XExtDisplayInfo *info = find_display(dpy); + XSyncWaitCondition *wait_item = wait_list; + xSyncAwaitReq *req; + unsigned int len; + + SyncCheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(SyncAwait, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncAwait; + len = (n_conditions * SIZEOF(xSyncWaitCondition)) >> 2; + SetReqLen(req, len, len /* XXX */ ); + + while (n_conditions--) + { + xSyncWaitCondition wc; + wc.counter = wait_item->trigger.counter; + wc.value_type = wait_item->trigger.value_type; + wc.wait_value_lo = XSyncValueLow32(wait_item->trigger.wait_value); + wc.wait_value_hi = XSyncValueHigh32(wait_item->trigger.wait_value); + wc.test_type = wait_item->trigger.test_type; + wc.event_threshold_lo = XSyncValueLow32(wait_item->event_threshold); + wc.event_threshold_hi = XSyncValueHigh32(wait_item->event_threshold); + Data(dpy, (char *)&wc, SIZEOF(xSyncWaitCondition)); + wait_item++; /* get next trigger */ + } + + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +static void +_XProcessAlarmAttributes(Display *dpy, xSyncChangeAlarmReq *req, + unsigned long valuemask, + XSyncAlarmAttributes *attributes) +{ + + unsigned long values[32]; + unsigned long *value = values; + unsigned int nvalues; + + if (valuemask & XSyncCACounter) + *value++ = attributes->trigger.counter; + + if (valuemask & XSyncCAValueType) + *value++ = attributes->trigger.value_type; + + if (valuemask & XSyncCAValue) + { + *value++ = XSyncValueHigh32(attributes->trigger.wait_value); + *value++ = XSyncValueLow32(attributes->trigger.wait_value); + } + + if (valuemask & XSyncCATestType) + *value++ = attributes->trigger.test_type; + + if (valuemask & XSyncCADelta) + { + *value++ = XSyncValueHigh32(attributes->delta); + *value++ = XSyncValueLow32(attributes->delta); + } + + if (valuemask & XSyncCAEvents) + *value++ = attributes->events; + + /* N.B. the 'state' field cannot be set or changed */ + req->length += (nvalues = value - values); + nvalues <<= 2; /* watch out for macros... */ + + Data32(dpy, (long *) values, (long) nvalues); +} + +XSyncAlarm +XSyncCreateAlarm( + Display *dpy, + unsigned long values_mask, + XSyncAlarmAttributes *values) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncCreateAlarmReq *req; + XSyncAlarm aid; + + SyncCheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(SyncCreateAlarm, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncCreateAlarm; + req->id = aid = XAllocID(dpy); + values_mask &= XSyncCACounter | XSyncCAValueType | XSyncCAValue + | XSyncCATestType | XSyncCADelta | XSyncCAEvents; + if ((req->valueMask = values_mask)) + _XProcessAlarmAttributes(dpy, (xSyncChangeAlarmReq *) req, + values_mask, values); + UnlockDisplay(dpy); + SyncHandle(); + return aid; +} + +Status +XSyncDestroyAlarm(Display *dpy, XSyncAlarm alarm) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncDestroyAlarmReq *req; + + SyncCheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(SyncDestroyAlarm, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncDestroyAlarm; + req->alarm = alarm; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Status +XSyncQueryAlarm( + Display *dpy, + XSyncAlarm alarm, + XSyncAlarmAttributes *values_return) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncQueryAlarmReq *req; + xSyncQueryAlarmReply rep; + + SyncCheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(SyncQueryAlarm, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncQueryAlarm; + req->alarm = alarm; + + if (!(_XReply(dpy, (xReply *) & rep, + ((SIZEOF(xSyncQueryAlarmReply) - SIZEOF(xGenericReply)) >> 2), xFalse))) + { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + + values_return->trigger.counter = rep.counter; + values_return->trigger.value_type = (XSyncValueType)rep.value_type; + XSyncIntsToValue(&values_return->trigger.wait_value, + rep.wait_value_lo, rep.wait_value_hi); + values_return->trigger.test_type = (XSyncTestType)rep.test_type; + XSyncIntsToValue(&values_return->delta, rep.delta_lo, + rep.delta_hi); + values_return->events = rep.events; + values_return->state = (XSyncAlarmState)rep.state; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Status +XSyncChangeAlarm( + Display *dpy, + XSyncAlarm alarm, + unsigned long values_mask, + XSyncAlarmAttributes *values) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncChangeAlarmReq *req; + + SyncCheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(SyncChangeAlarm, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncChangeAlarm; + req->alarm = alarm; + values_mask &= XSyncCACounter | XSyncCAValueType | XSyncCAValue + | XSyncCATestType | XSyncCADelta | XSyncCAEvents; + if ((req->valueMask = values_mask)) + _XProcessAlarmAttributes(dpy, req, values_mask, values); + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Status +XSyncSetPriority( + Display *dpy, + XID client_resource_id, + int priority) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncSetPriorityReq *req; + + SyncCheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(SyncSetPriority, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncSetPriority; + req->id = client_resource_id; + req->priority = priority; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Status +XSyncGetPriority(Display *dpy, XID client_resource_id, int *return_priority) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncGetPriorityReply rep; + xSyncGetPriorityReq *req; + + SyncCheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(SyncGetPriority, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncGetPriority; + req->id = client_resource_id; + + if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) + { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + if (return_priority) + *return_priority = rep.priority; + + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +XSyncFence +XSyncCreateFence(Display *dpy, Drawable d, Bool initially_triggered) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncCreateFenceReq *req; + XSyncFence id; + + SyncCheckExtension(dpy, info, None); + + LockDisplay(dpy); + GetReq(SyncCreateFence, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncCreateFence; + + req->d = d; + id = req->fid = XAllocID(dpy); + req->initially_triggered = initially_triggered; + + UnlockDisplay(dpy); + SyncHandle(); + return id; +} + +Bool +XSyncTriggerFence(Display *dpy, XSyncFence fence) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncTriggerFenceReq *req; + + SyncCheckExtension(dpy, info, None); + + LockDisplay(dpy); + GetReq(SyncTriggerFence, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncTriggerFence; + + req->fid = fence; + + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XSyncResetFence(Display *dpy, XSyncFence fence) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncResetFenceReq *req; + + SyncCheckExtension(dpy, info, None); + + LockDisplay(dpy); + GetReq(SyncResetFence, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncResetFence; + + req->fid = fence; + + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XSyncDestroyFence(Display *dpy, XSyncFence fence) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncDestroyFenceReq *req; + + SyncCheckExtension(dpy, info, None); + + LockDisplay(dpy); + GetReq(SyncDestroyFence, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncDestroyFence; + + req->fid = fence; + + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XSyncQueryFence(Display *dpy, XSyncFence fence, Bool *triggered) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncQueryFenceReply rep; + xSyncQueryFenceReq *req; + + SyncCheckExtension(dpy, info, None); + + LockDisplay(dpy); + GetReq(SyncQueryFence, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncQueryFence; + req->fid = fence; + + if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) + { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + if (triggered) + *triggered = rep.triggered; + + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XSyncAwaitFence(Display *dpy, const XSyncFence *fence_list, int n_fences) +{ + XExtDisplayInfo *info = find_display(dpy); + xSyncAwaitFenceReq *req; + + SyncCheckExtension(dpy, info, False); + + LockDisplay(dpy); + GetReq(SyncAwaitFence, req); + req->reqType = info->codes->major_opcode; + req->syncReqType = X_SyncAwaitFence; + SetReqLen(req, n_fences, n_fences); + + Data32(dpy, (char *)fence_list, sizeof(CARD32) * n_fences); + + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +/* + * Functions corresponding to the macros for manipulating 64-bit values + */ + +void +XSyncIntToValue(XSyncValue *pv, int i) +{ + _XSyncIntToValue(pv,i); +} + +void +XSyncIntsToValue(XSyncValue *pv, unsigned int l, int h) +{ + _XSyncIntsToValue(pv, l, h); +} + +Bool +XSyncValueGreaterThan(XSyncValue a, XSyncValue b) +{ + return _XSyncValueGreaterThan(a, b); +} + +Bool +XSyncValueLessThan(XSyncValue a, XSyncValue b) +{ + return _XSyncValueLessThan(a, b); +} + +Bool +XSyncValueGreaterOrEqual(XSyncValue a, XSyncValue b) +{ + return _XSyncValueGreaterOrEqual(a, b); +} + +Bool +XSyncValueLessOrEqual(XSyncValue a, XSyncValue b) +{ + return _XSyncValueLessOrEqual(a, b); +} + +Bool +XSyncValueEqual(XSyncValue a, XSyncValue b) +{ + return _XSyncValueEqual(a, b); +} + +Bool +XSyncValueIsNegative(XSyncValue v) +{ + return _XSyncValueIsNegative(v); +} + +Bool +XSyncValueIsZero(XSyncValue a) +{ + return _XSyncValueIsZero(a); +} + +Bool +XSyncValueIsPositive(XSyncValue v) +{ + return _XSyncValueIsPositive(v); +} + +unsigned int +XSyncValueLow32(XSyncValue v) +{ + return _XSyncValueLow32(v); +} + +int +XSyncValueHigh32(XSyncValue v) +{ + return _XSyncValueHigh32(v); +} + +void +XSyncValueAdd(XSyncValue *presult, XSyncValue a, XSyncValue b, Bool *poverflow) +{ + _XSyncValueAdd(presult, a, b, poverflow); +} + +void +XSyncValueSubtract( + XSyncValue *presult, + XSyncValue a, XSyncValue b, + Bool *poverflow) +{ + _XSyncValueSubtract(presult, a, b, poverflow); +} + +void +XSyncMaxValue(XSyncValue *pv) +{ + _XSyncMaxValue(pv); +} + +void +XSyncMinValue(XSyncValue *pv) +{ + _XSyncMinValue(pv); +} diff --git a/libXext/src/XTestExt1.c b/libXext/src/XTestExt1.c index 83a59a3d8..15aa4c0f2 100644 --- a/libXext/src/XTestExt1.c +++ b/libXext/src/XTestExt1.c @@ -1,1317 +1,1317 @@ -/* - * File: xtestext1lib.c - * - * This file contains the Xlib parts of the input synthesis extension - */ - -/* - - -Copyright 1986, 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, 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 Hewlett-Packard not be used in -advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -Hewlett-Packard makes no representations about the -suitability of this software for any purpose. It is provided -"as is" without express or implied warranty. - -This software is not subject to any license of the American -Telephone and Telegraph Company or of the Regents of the -University of California. - -*/ - -/****************************************************************************** - * include files - *****************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include - -/****************************************************************************** - * variables - *****************************************************************************/ - -/* - * Holds the request type code for this extension. The request type code - * for this extension may vary depending on how many extensions are installed - * already, so the initial value given below will be added to the base request - * code that is acquired when this extension is installed. - */ -static int XTestReqCode = 0; -/* - * Holds the two event type codes for this extension. The event type codes - * for this extension may vary depending on how many extensions are installed - * already, so the initial values given below will be added to the base event - * code that is acquired when this extension is installed. - * - * These two variables must be available to programs that use this extension. - */ -int XTestInputActionType = 0; -int XTestFakeAckType = 1; -/* - * holds the current x and y coordinates for XTestMovePointer - */ -static int current_x = 0; -static int current_y = 0; -/* - * Holds input actions being accumulated until the input action buffer is - * full or until XTestFlush is called. - */ -static CARD8 action_buf[XTestMAX_ACTION_LIST_SIZE]; -/* - * the index into the input action buffer - */ -static int action_index = 0; -/* - * the number of input actions that the server can handle at one time - */ -static unsigned long action_array_size = 0; -/* - * the current number of input actions - */ -static unsigned long action_count = 0; - -/****************************************************************************** - * function declarations - *****************************************************************************/ - -static int XTestWireToEvent(Display *dpy, XEvent *reTemp, xEvent *eventTemp); -static int XTestCheckExtInit(register Display *dpy); -static Bool XTestIdentifyMyEvent(Display *display, XEvent *event_ptr, char *args); -static int XTestInitExtension(register Display *dpy); -static int XTestKeyOrButton(Display *display, int device_id, long unsigned int delay, unsigned int code, unsigned int action); -static int XTestCheckDelay(Display *display, long unsigned int *delay_addr); -static int XTestPackInputAction(Display *display, CARD8 *action_addr, int action_size); -static int XTestWriteInputActions(Display *display, char *action_list_addr, int action_list_size, int ack_flag); - -/****************************************************************************** - * - * XTestFakeInput - * - * Send a a request containing one or more input actions to be sent - * to the server by this extension. - */ -int -XTestFakeInput( -/* - * the connection to the X server - */ -register Display *dpy, -/* - * the address of a list of input actions to be sent to the server - */ -char *action_list_addr, -/* - * the size (in bytes) of the list of input actions - */ -int action_list_size, -/* - * specifies whether the server needs to send an event to indicate that its - * input action buffer is empty - */ -int ack_flag) -{ - /* - * pointer to xTestFakeInputReq structure - */ - xTestFakeInputReq *req; - /* - * loop index - */ - int i; - - LockDisplay(dpy); - if ((XTestCheckExtInit(dpy) == -1) || - (action_list_size > XTestMAX_ACTION_LIST_SIZE)) - { - /* - * if the extension is not installed in the server or the - * action list will not fit in the request, then unlock - * the display and return -1. - */ - UnlockDisplay(dpy); - return(-1); - } - else - { - /* - * Get the next available X request packet in the buffer. - * It sets the `length' field to the size (in 32-bit words) - * of the request. It also sets the `reqType' field in the - * request to X_TestFakeInput, which is not what is needed. - * - * GetReq is a macro defined in Xlibint.h. - */ - GetReq(TestFakeInput, req); - /* - * fix up the request type code to what is needed - */ - req->reqType = XTestReqCode; - /* - * set the minor request type code to X_TestFakeInput - */ - req->XTestReqType = X_TestFakeInput; - /* - * set the ack code - */ - req->ack = ack_flag; - /* - * Set the action_list area to all 0's. An input action header - * value of 0 is interpreted as a flag to the input action - * list handling code in the server part of this extension - * that there are no more input actions in this request. - */ - for (i = 0; i < XTestMAX_ACTION_LIST_SIZE; i++) - { - req->action_list[i] = 0; - } - /* - * copy the input actions into the request - */ - for (i = 0; i < action_list_size; i++) - { - req->action_list[i] = *(action_list_addr++); - } - UnlockDisplay(dpy); - SyncHandle(); - return(0); - } -} - -/****************************************************************************** - * - * XTestGetInput - * - * Request the server to begin putting user input actions into events - * to be sent to the client that called this function. - */ -int -XTestGetInput( -/* - * the connection to the X server - */ -register Display *dpy, -/* - * tells the server what to do with the user input actions - */ -int action_handling) -{ - /* - * pointer to xTestGetInputReq structure - */ - xTestGetInputReq *req; - - LockDisplay(dpy); - if (XTestCheckExtInit(dpy) == -1) - { - /* - * if the extension is not installed in the server - * then unlock the display and return -1. - */ - UnlockDisplay(dpy); - return(-1); - } - else - { - /* - * Get the next available X request packet in the buffer. - * It sets the `length' field to the size (in 32-bit words) - * of the request. It also sets the `reqType' field in the - * request to X_TestGetInput, which is not what is needed. - * - * GetReq is a macro defined in Xlibint.h. - */ - GetReq(TestGetInput, req); - /* - * fix up the request type code to what is needed - */ - req->reqType = XTestReqCode; - /* - * set the minor request type code to X_TestGetInput - */ - req->XTestReqType = X_TestGetInput; - /* - * set the action handling mode - */ - req->mode = action_handling; - UnlockDisplay(dpy); - SyncHandle(); - return(0); - } -} - -/****************************************************************************** - * - * XTestStopInput - * - * Tell the server to stop putting information about user input actions - * into events. - */ -int -XTestStopInput( -/* - * the connection to the X server - */ -register Display *dpy) -{ - /* - * pointer to xTestStopInputReq structure - */ - xTestStopInputReq *req; - - LockDisplay(dpy); - if (XTestCheckExtInit(dpy) == -1) - { - /* - * if the extension is not installed in the server - * then unlock the display and return -1. - */ - UnlockDisplay(dpy); - return(-1); - } - else - { - /* - * Get the next available X request packet in the buffer. - * It sets the `length' field to the size (in 32-bit words) - * of the request. It also sets the `reqType' field in the - * request to X_TestStopInput, which is not what is needed. - * - * GetReq is a macro defined in Xlibint.h. - */ - GetReq(TestStopInput, req); - /* - * fix up the request type code to what is needed - */ - req->reqType = XTestReqCode; - /* - * set the minor request type code to X_TestStopInput - */ - req->XTestReqType = X_TestStopInput; - UnlockDisplay(dpy); - SyncHandle(); - return(0); - } -} - -/****************************************************************************** - * - * XTestReset - * - * Tell the server to set everything having to do with this extension - * back to its initial state. - */ -int -XTestReset( -/* - * the connection to the X server - */ -register Display *dpy) -{ - /* - * pointer to xTestReset structure - */ - xTestResetReq *req; - - LockDisplay(dpy); - if (XTestCheckExtInit(dpy) == -1) - { - /* - * if the extension is not installed in the server - * then unlock the display and return -1. - */ - UnlockDisplay(dpy); - return(-1); - } - else - { - /* - * Get the next available X request packet in the buffer. - * It sets the `length' field to the size (in 32-bit words) - * of the request. It also sets the `reqType' field in the - * request to X_TestReset, which is not what is needed. - * - * GetReq is a macro defined in Xlibint.h. - */ - GetReq(TestReset, req); - /* - * fix up the request type code to what is needed - */ - req->reqType = XTestReqCode; - /* - * set the minor request type code to X_TestReset - */ - req->XTestReqType = X_TestReset; - UnlockDisplay(dpy); - SyncHandle(); - return(0); - } -} - -/****************************************************************************** - * - * XTestQueryInputSize - * - * Returns the number of input actions in the server's input action buffer. - */ -int -XTestQueryInputSize( -/* - * the connection to the X server - */ -register Display *dpy, -/* - * the address of the place to put the number of input actions in the - * server's input action buffer - */ -unsigned long *size_return) -{ - /* - * pointer to xTestQueryInputSize structure - */ - xTestQueryInputSizeReq *req; - /* - * pointer to xTestQueryInputSize structure - */ - xTestQueryInputSizeReply rep; - - LockDisplay(dpy); - if (XTestCheckExtInit(dpy) == -1) - { - /* - * if the extension is not installed in the server - * then unlock the display and return -1. - */ - UnlockDisplay(dpy); - return(-1); - } - else - { - /* - * Get the next available X request packet in the buffer. - * It sets the `length' field to the size (in 32-bit words) - * of the request. It also sets the `reqType' field in the - * request to X_TestQueryInputSize, which is not what is needed. - * - * GetReq is a macro defined in Xlibint.h. - */ - GetReq(TestQueryInputSize, req); - /* - * fix up the request type code to what is needed - */ - req->reqType = XTestReqCode; - /* - * set the minor request type code to X_TestQueryInputSize - */ - req->XTestReqType = X_TestQueryInputSize; - /* - * get a reply from the server - */ - (void) _XReply (dpy, (xReply *) &rep, 0, xTrue); - /* - * put the size in the caller's variable - */ - *size_return = (unsigned long) rep.size_return; - UnlockDisplay(dpy); - SyncHandle(); - return(0); - } -} - -/****************************************************************************** - * - * XTestCheckExtInit - * - * Check to see if the XTest extension is installed in the server. - */ -static int -XTestCheckExtInit( -/* - * the connection to the X server - */ -register Display *dpy) -{ - /* - * if the extension has not been initialized, then do so - */ - if (!XTestReqCode) - { - return(XTestInitExtension(dpy)); - } - return(0); -} - -/****************************************************************************** - * - * XTestInitExtension - * - * Attempt to initialize this extension in the server. Return 0 if it - * succeeds, -1 if it does not succeed. - */ -static int -XTestInitExtension( -/* - * the connection to the X server - */ -register Display *dpy) -{ - /* - * loop index - */ - int i; - /* - * return value from XInitExtension - */ - XExtCodes *ret; - - /* - * attempt to initialize the extension - */ - ret = XInitExtension(dpy, XTestEXTENSION_NAME); - /* - * if the initialize failed, return -1 - */ - if (ret == NULL) - { - return (-1); - } - /* - * the initialize succeeded, remember the major opcode - * for this extension - */ - XTestReqCode = ret->major_opcode; - /* - * set up the event handler for any events from - * this extension - */ - for (i = 0; i < XTestEVENT_COUNT; i++) - { - XESetWireToEvent(dpy, - ret->first_event+i, - XTestWireToEvent); - } - /* - * compute the event type codes for the events - * in this extension - */ - XTestInputActionType += ret->first_event; - XTestFakeAckType += ret->first_event; - /* - * everything worked ok - */ - return(0); -} - -/****************************************************************************** - * - * XTestWireToEvent - * - * Handle XTest extension events. - * Reformat a wire event into an XEvent structure of the right type. - */ -static Bool -XTestWireToEvent( -/* - * the connection to the X server - */ -Display *dpy, -/* - * a pointer to where a host formatted event should be stored - * with the information copied to it - */ -XEvent *reTemp, -/* - * a pointer to the wire event - */ -xEvent *eventTemp) -{ - XTestInputActionEvent *re = (XTestInputActionEvent *) reTemp; - xTestInputActionEvent *event = (xTestInputActionEvent *) eventTemp; - - /* - * loop index - */ - int i; - /* - * pointer to where the input actions go in the host format event - */ - CARD8 *to; - /* - * pointer to the input actions in the wire event - */ - CARD8 *from; - - /* - * Copy the type of the wire event to the new event. - * This will work for either event type because the type, - * display, and window fields in the events have to be the same. - */ - re->type = event->type; - /* - * set the display parameter in case it is needed (by who?) - */ - re->display = dpy; - if (re->type == XTestInputActionType) - { - /* - * point at the first byte of input actions in the wire event - */ - from = &(event->actions[0]); - /* - * point at where the input action bytes go in the new event - */ - to = &(re->actions[0]); - /* - * copy the input action bytes from the wire event to - * the new event - */ - for (i = 0; i < XTestACTIONS_SIZE; i++) - { - *(to++) = *(from++); - } - } - else if (re->type == XTestFakeAckType) - { - /* - * nothing else needs to be done - */ - } - else - { - printf("XTestWireToEvent: UNKNOWN WIRE EVENT! type=%d\n", - (int) event->type); - printf("%s is giving up.\n", XTestEXTENSION_NAME); - exit (1); - } - return 1; -} - -/****************************************************************************** - * - * XTestPressKey - * - * Send input actions to the server to cause the server to think - * that the specified key on the keyboard was moved as specified. - */ -int -XTestPressKey( -Display *display, -int device_id, -unsigned long delay, -unsigned int keycode, -unsigned int key_action) -{ - /* - * bounds check the key code - */ - if (keycode < 8 || keycode > 255) - { - return(-1); - } - /* - * use the commmon key/button handling routine - */ - return(XTestKeyOrButton(display, - device_id, - delay, - keycode, - key_action)); -} - -/****************************************************************************** - * - * XTestPressButton - * - * Send input actions to the server to cause the server to think - * that the specified button on the mouse was moved as specified. - */ -int -XTestPressButton( -Display *display, -int device_id, -unsigned long delay, -unsigned int button_number, -unsigned int button_action) -{ - /* - * bounds check the button number - */ - if (button_number > 7) - { - return(-1); - } - /* - * use the commmon key/button handling routine - */ - return(XTestKeyOrButton(display, - device_id, - delay, - button_number, - button_action)); -} - -/****************************************************************************** - * - * XTestKeyOrButton - * - * Send input actions to the server to cause the server to think - * that the specified key/button was moved as specified. - */ -static int -XTestKeyOrButton( -Display *display, -int device_id, -unsigned long delay, -unsigned int code, -unsigned int action) -{ - /* - * holds a key input action to be filled out and sent to the server - */ - XTestKeyInfo keyinfo; - - /* - * bounds check the device id - */ - if (device_id < 0 || device_id > XTestMAX_DEVICE_ID) - { - return(-1); - } - /* - * fill out the key input action(s) as appropriate - */ - switch(action) - { - case XTestPRESS: - /* - * Check the delay. If it is larger than will fit in the - * key input action, send a delay input action. - */ - if(XTestCheckDelay(display, &delay) == -1) - { - /* - * an error occurred, return -1 - */ - return(-1); - } - /* - * create the header - */ - keyinfo.header = XTestPackDeviceID(device_id) | - XTestKEY_ACTION | - XTestKEY_DOWN; - /* - * set the key/button code - */ - keyinfo.keycode = code; - /* - * set the delay time - */ - keyinfo.delay_time = delay; - /* - * pack the input action into a request to be sent to the - * server when the request is full or XTestFlush is called - */ - return(XTestPackInputAction(display, - (CARD8 *) &keyinfo, - sizeof(XTestKeyInfo))); - case XTestRELEASE: - /* - * Check the delay. If it is larger than will fit in the - * key input action, send a delay input action. - */ - if(XTestCheckDelay(display, &delay) == -1) - { - /* - * an error occurred, return -1 - */ - return(-1); - } - /* - * create the header - */ - keyinfo.header = XTestPackDeviceID(device_id) | - XTestKEY_ACTION | - XTestKEY_UP; - /* - * set the key/button code - */ - keyinfo.keycode = code; - /* - * set the delay time - */ - keyinfo.delay_time = delay; - /* - * pack the input action into a request to be sent to the - * server when the request is full or XTestFlush is called - */ - return(XTestPackInputAction(display, - (CARD8 *) &keyinfo, - sizeof(XTestKeyInfo))); - case XTestSTROKE: - /* - * Check the delay. If it is larger than will fit in the - * key input action, send a delay input action. - */ - if(XTestCheckDelay(display, &delay) == -1) - { - /* - * an error occurred, return -1 - */ - return(-1); - } - /* - * create a key/button-down input action header - */ - keyinfo.header = XTestPackDeviceID(device_id) | - XTestKEY_ACTION | - XTestKEY_DOWN; - /* - * set the key/button code - */ - keyinfo.keycode = code; - /* - * set the delay time - */ - keyinfo.delay_time = delay; - /* - * pack the input action into a request to be sent to the - * server when the request is full or XTestFlush is called - */ - if (XTestPackInputAction(display, - (CARD8 *) &keyinfo, - sizeof(XTestKeyInfo)) == -1) - { - /* - * an error occurred, return -1 - */ - return(-1); - } - /* - * set the delay to XTestSTROKE_DELAY_TIME - */ - delay = XTestSTROKE_DELAY_TIME; - /* - * Check the delay. If it is larger than will fit in the - * key input action, send a delay input action. - */ - if(XTestCheckDelay(display, &delay) == -1) - { - /* - * an error occurred, return -1 - */ - return(-1); - } - /* - * create a key/button-up input action header - */ - keyinfo.header = XTestPackDeviceID(device_id) | - XTestKEY_ACTION | - XTestKEY_UP; - /* - * set the key/button code - */ - keyinfo.keycode = code; - /* - * set the delay time - */ - keyinfo.delay_time = delay; - /* - * pack the input action into a request to be sent to the - * server when the request is full or XTestFlush is called - */ - return(XTestPackInputAction(display, - (CARD8 *) &keyinfo, - sizeof(XTestKeyInfo))); - default: - /* - * invalid action value, return -1 - */ - return(-1); - } -} - -/****************************************************************************** - * - * XTestMovePointer - * - * Send input actions to the server to cause the server to think - * that the mouse was moved as specified. - */ -int -XTestMovePointer( -Display *display, -int device_id, -unsigned long delay[], -int x[], -int y[], -unsigned int count) -{ - /* - * holds a motion input action to be filled out and sent to the server - */ - XTestMotionInfo motioninfo; - /* - * holds a jump input action to be filled out and sent to the server - */ - XTestJumpInfo jumpinfo; - /* - * loop index - */ - unsigned int i; - /* - * holds the change in x and y directions from the current x and y - * coordinates - */ - int dx; - int dy; - - /* - * bounds check the device id - */ - if (device_id < 0 || device_id > XTestMAX_DEVICE_ID) - { - return(-1); - } - /* - * if the count is 0, there is nothing to do. return 0 - */ - if (count == 0) - { - return(0); - } - /* - * loop through the pointer motions, creating the appropriate - * input actions for each motion - */ - for (i = 0; i < count; i++) - { - /* - * Check the delay. If it is larger than will fit in the - * input action, send a delay input action. - */ - if(XTestCheckDelay(display, &(delay[i])) == -1) - { - /* - * an error occurred, return -1 - */ - return(-1); - } - /* - * compute the change from the current x and y coordinates - * to the new x and y coordinates - */ - dx = x[i] - current_x; - dy = y[i] - current_y; - /* - * update the current x and y coordinates - */ - current_x = x[i]; - current_y = y[i]; - /* - * If the pointer motion range is too large to fit into - * a motion input action, then use a jump input action. - * Otherwise, use a motion input action. - */ - if ((dx > XTestMOTION_MAX) || (dx < XTestMOTION_MIN) || - (dy > XTestMOTION_MAX) || (dy < XTestMOTION_MIN)) - { - /* - * create a jump input action header - */ - jumpinfo.header = XTestPackDeviceID(device_id) | - XTestJUMP_ACTION; - /* - * set the x and y coordinates to jump to - */ - jumpinfo.jumpx = x[i]; - jumpinfo.jumpy = y[i]; - /* - * set the delay time - */ - jumpinfo.delay_time = delay[i]; - /* - * pack the jump input action into a request to be - * sent to the server when the request is full - * or XTestFlush is called - */ - if (XTestPackInputAction(display, - (CARD8 *) &jumpinfo, - sizeof(XTestJumpInfo)) == -1) - { - /* - * an error occurred, return -1 - */ - return(-1); - } - } - else - { - /* - * create a motion input action header - */ - motioninfo.header = XTestPackDeviceID(device_id) | - XTestMOTION_ACTION; - /* - * compute the motion data byte - */ - if (dx < 0) - { - motioninfo.header |= XTestX_NEGATIVE; - dx = abs(dx); - } - if (dy < 0) - { - motioninfo.header |= XTestY_NEGATIVE; - dy = abs(dy); - } - motioninfo.motion_data = XTestPackXMotionValue(dx); - motioninfo.motion_data |= XTestPackYMotionValue(dy); - /* - * set the delay time - */ - motioninfo.delay_time = delay[i]; - /* - * pack the motion input action into a request to be - * sent to the server when the request is full - * or XTestFlush is called - */ - if (XTestPackInputAction(display, - (CARD8 *) &motioninfo, - sizeof(XTestMotionInfo)) == -1) - { - /* - * an error occurred, return -1 - */ - return(-1); - } - } - } - /* - * if you get here, everything went ok - */ - return(0); -} - -/****************************************************************************** - * - * XTestCheckDelay - * - * Check the delay value at the passed-in address. If it is larger than - * will fit in a normal input action, then send a delay input action. - */ -static int -XTestCheckDelay( -Display *display, -unsigned long *delay_addr) -{ - /* - * holds a delay input action to be filled out and sent to the server - */ - XTestDelayInfo delayinfo; - - /* - * if the delay value will fit in the input action, - * then there is no need for a delay input action - */ - if (*delay_addr <= XTestSHORT_DELAY_TIME) - { - return(0); - } - /* - * fill out a delay input action - */ - delayinfo.header = XTestPackDeviceID(XTestDELAY_DEVICE_ID); - delayinfo.delay_time = *delay_addr; - /* - * all of the delay time will be accounted for in the - * delay input action, so set the original delay value to 0 - */ - *delay_addr = 0; - /* - * pack the delay input action into a request to be sent to the - * server when the request is full or XTestFlush is called - */ - return(XTestPackInputAction(display, - (CARD8 *) &delayinfo, - sizeof(XTestDelayInfo))); -} - -/****************************************************************************** - * - * XTestPackInputAction - * - * If the input action buffer is full or the number of input actions - * has reached the maximum that the server can handle at one time, - * then send the input actions to the server using XTestFakeInput. - */ -static int -XTestPackInputAction( -Display *display, -CARD8 *action_addr, -int action_size) -{ - /* - * loop index - */ - int i; - /* - * acknowledge flag - */ - int ack_flag; - - /* - * if we don't already know it, find out how many input actions - * the server can handle at one time - */ - if (action_array_size == 0) - { - if(XTestQueryInputSize(display, &action_array_size) == -1) - { - /* - * if an error, return -1 - */ - return(-1); - } - } - /* - * if the specified input action will fit in the the input - * action buffer and won't exceed the server's capacity, then - * put the input action into the input buffer - */ - if(((action_index + action_size) <= XTestMAX_ACTION_LIST_SIZE) && - ((action_count + 1) < action_array_size)) - { - /* - * copy the input action into the buffer - */ - for (i = 0; i < action_size; i++) - { - action_buf[action_index++] = *(action_addr++); - } - /* - * increment the action count - */ - action_count++; - /* - * everything went ok, return 0 - */ - return(0); - } - /* - * We have to write input actions to the server. If the server's - * input action capacity will be reached, then ask for an - * acknowledge event when the server has processed all of the - * input actions. Otherwise, an acknowledge event is not needed. - */ - if (action_count >= action_array_size) - { - ack_flag = XTestFAKE_ACK_REQUEST; - } - else - { - ack_flag = XTestFAKE_ACK_NOT_NEEDED; - } - /* - * write the input actions to the server - */ - if (XTestWriteInputActions(display, - (char *) &(action_buf[0]), - action_index, - ack_flag) == -1) - { - /* - * error, return -1 - */ - return(-1); - } - /* - * copy the input action into the buffer - */ - for (i = 0; i < action_size; i++) - { - action_buf[action_index++] = *(action_addr++); - } - /* - * increment the action count - */ - action_count++; - return(0); -} - -/****************************************************************************** - * - * XTestWriteInputActions - * - * Send input actions to the server. - */ -static int -XTestWriteInputActions( -Display *display, -char *action_list_addr, -int action_list_size, -int ack_flag) -{ - /* - * Holds an event. Used while waiting for an acknowledge event - */ - XEvent event; - /* - * points to XTestIdentifyMyEvent - */ - Bool (*func_ptr)(Display *, XEvent *, XPointer); - - /* - * write the input actions to the server - */ - if (XTestFakeInput(display, - action_list_addr, - action_list_size, - ack_flag) == -1) - { - /* - * if an error, return -1 - */ - return(-1); - } - /* - * flush X's buffers to make sure that the server really gets - * the input actions - */ - XFlush(display); - /* - * mark the input action buffer as empty - */ - action_index = 0; - /* - * if we asked for an acknowledge event, then wait for it - */ - if (ack_flag == XTestFAKE_ACK_REQUEST) - { - /* - * point func_ptr at XTestIdentifyMyEvent - */ - func_ptr = XTestIdentifyMyEvent; - /* - * Wait until the acknowledge event comes. When the - * acknowledge event comes, it is removed from the event - * queue without disturbing any other events that might - * be in the queue. - */ - XIfEvent(display, &event, func_ptr, NULL); - /* - * set the input action count back to 0 - */ - action_count = 0; - } - /* - * if we got here, then everything is ok, return 0 - */ - return(0); -} - -/****************************************************************************** - * - * XTestIdentifyMyEvent - * - * This function is called by XIfEvent to look at an event and see if - * it is of XTestFakeAckType. - */ -static Bool -XTestIdentifyMyEvent( -Display *display, -/* - * Holds the event that this routine is supposed to look at. - */ -XEvent *event_ptr, -/* - * this points to any user-specified arguments (ignored) - */ -char *args) -{ - /* - * if the event if of the correct type, return the Bool True, - * otherwise return the Bool False. - */ - if (event_ptr->type == XTestFakeAckType) - { - return(True); - } - else - { - return(False); - } -} - -/****************************************************************************** - * - * XTestFlush - * - * Send any input actions in the input action buffer to the server. - */ -int -XTestFlush(Display *display) -{ - /* - * acknowledge flag - */ - int ack_flag; - - /* - * if there are no input actions in the input action buffer, - * then return 0 - */ - if (action_index == 0) - { - return(0); - } - /* - * We have input actions to write to the server. We will - * wait until the server has finished processing the input actions. - */ - ack_flag = XTestFAKE_ACK_REQUEST; - /* - * write the input actions to the server - */ - return(XTestWriteInputActions(display, - (char *) &(action_buf[0]), - action_index, - ack_flag)); -} +/* + * File: xtestext1lib.c + * + * This file contains the Xlib parts of the input synthesis extension + */ + +/* + + +Copyright 1986, 1987, 1988, 1998 The Open Group + +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation + +Permission to use, copy, modify, and distribute this +software and its documentation for any purpose and without +fee is hereby granted, 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 Hewlett-Packard not be used in +advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +Hewlett-Packard makes no representations about the +suitability of this software for any purpose. It is provided +"as is" without express or implied warranty. + +This software is not subject to any license of the American +Telephone and Telegraph Company or of the Regents of the +University of California. + +*/ + +/****************************************************************************** + * include files + *****************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include + +/****************************************************************************** + * variables + *****************************************************************************/ + +/* + * Holds the request type code for this extension. The request type code + * for this extension may vary depending on how many extensions are installed + * already, so the initial value given below will be added to the base request + * code that is acquired when this extension is installed. + */ +static int XTestReqCode = 0; +/* + * Holds the two event type codes for this extension. The event type codes + * for this extension may vary depending on how many extensions are installed + * already, so the initial values given below will be added to the base event + * code that is acquired when this extension is installed. + * + * These two variables must be available to programs that use this extension. + */ +int XTestInputActionType = 0; +int XTestFakeAckType = 1; +/* + * holds the current x and y coordinates for XTestMovePointer + */ +static int current_x = 0; +static int current_y = 0; +/* + * Holds input actions being accumulated until the input action buffer is + * full or until XTestFlush is called. + */ +static CARD8 action_buf[XTestMAX_ACTION_LIST_SIZE]; +/* + * the index into the input action buffer + */ +static int action_index = 0; +/* + * the number of input actions that the server can handle at one time + */ +static unsigned long action_array_size = 0; +/* + * the current number of input actions + */ +static unsigned long action_count = 0; + +/****************************************************************************** + * function declarations + *****************************************************************************/ + +static int XTestWireToEvent(Display *dpy, XEvent *reTemp, xEvent *eventTemp); +static int XTestCheckExtInit(register Display *dpy); +static Bool XTestIdentifyMyEvent(Display *display, XEvent *event_ptr, char *args); +static int XTestInitExtension(register Display *dpy); +static int XTestKeyOrButton(Display *display, int device_id, long unsigned int delay, unsigned int code, unsigned int action); +static int XTestCheckDelay(Display *display, long unsigned int *delay_addr); +static int XTestPackInputAction(Display *display, CARD8 *action_addr, int action_size); +static int XTestWriteInputActions(Display *display, char *action_list_addr, int action_list_size, int ack_flag); + +/****************************************************************************** + * + * XTestFakeInput + * + * Send a a request containing one or more input actions to be sent + * to the server by this extension. + */ +int +XTestFakeInput( +/* + * the connection to the X server + */ +register Display *dpy, +/* + * the address of a list of input actions to be sent to the server + */ +char *action_list_addr, +/* + * the size (in bytes) of the list of input actions + */ +int action_list_size, +/* + * specifies whether the server needs to send an event to indicate that its + * input action buffer is empty + */ +int ack_flag) +{ + /* + * pointer to xTestFakeInputReq structure + */ + xTestFakeInputReq *req; + /* + * loop index + */ + int i; + + LockDisplay(dpy); + if ((XTestCheckExtInit(dpy) == -1) || + (action_list_size > XTestMAX_ACTION_LIST_SIZE)) + { + /* + * if the extension is not installed in the server or the + * action list will not fit in the request, then unlock + * the display and return -1. + */ + UnlockDisplay(dpy); + return(-1); + } + else + { + /* + * Get the next available X request packet in the buffer. + * It sets the `length' field to the size (in 32-bit words) + * of the request. It also sets the `reqType' field in the + * request to X_TestFakeInput, which is not what is needed. + * + * GetReq is a macro defined in Xlibint.h. + */ + GetReq(TestFakeInput, req); + /* + * fix up the request type code to what is needed + */ + req->reqType = XTestReqCode; + /* + * set the minor request type code to X_TestFakeInput + */ + req->XTestReqType = X_TestFakeInput; + /* + * set the ack code + */ + req->ack = ack_flag; + /* + * Set the action_list area to all 0's. An input action header + * value of 0 is interpreted as a flag to the input action + * list handling code in the server part of this extension + * that there are no more input actions in this request. + */ + for (i = 0; i < XTestMAX_ACTION_LIST_SIZE; i++) + { + req->action_list[i] = 0; + } + /* + * copy the input actions into the request + */ + for (i = 0; i < action_list_size; i++) + { + req->action_list[i] = *(action_list_addr++); + } + UnlockDisplay(dpy); + SyncHandle(); + return(0); + } +} + +/****************************************************************************** + * + * XTestGetInput + * + * Request the server to begin putting user input actions into events + * to be sent to the client that called this function. + */ +int +XTestGetInput( +/* + * the connection to the X server + */ +register Display *dpy, +/* + * tells the server what to do with the user input actions + */ +int action_handling) +{ + /* + * pointer to xTestGetInputReq structure + */ + xTestGetInputReq *req; + + LockDisplay(dpy); + if (XTestCheckExtInit(dpy) == -1) + { + /* + * if the extension is not installed in the server + * then unlock the display and return -1. + */ + UnlockDisplay(dpy); + return(-1); + } + else + { + /* + * Get the next available X request packet in the buffer. + * It sets the `length' field to the size (in 32-bit words) + * of the request. It also sets the `reqType' field in the + * request to X_TestGetInput, which is not what is needed. + * + * GetReq is a macro defined in Xlibint.h. + */ + GetReq(TestGetInput, req); + /* + * fix up the request type code to what is needed + */ + req->reqType = XTestReqCode; + /* + * set the minor request type code to X_TestGetInput + */ + req->XTestReqType = X_TestGetInput; + /* + * set the action handling mode + */ + req->mode = action_handling; + UnlockDisplay(dpy); + SyncHandle(); + return(0); + } +} + +/****************************************************************************** + * + * XTestStopInput + * + * Tell the server to stop putting information about user input actions + * into events. + */ +int +XTestStopInput( +/* + * the connection to the X server + */ +register Display *dpy) +{ + /* + * pointer to xTestStopInputReq structure + */ + xTestStopInputReq *req; + + LockDisplay(dpy); + if (XTestCheckExtInit(dpy) == -1) + { + /* + * if the extension is not installed in the server + * then unlock the display and return -1. + */ + UnlockDisplay(dpy); + return(-1); + } + else + { + /* + * Get the next available X request packet in the buffer. + * It sets the `length' field to the size (in 32-bit words) + * of the request. It also sets the `reqType' field in the + * request to X_TestStopInput, which is not what is needed. + * + * GetReq is a macro defined in Xlibint.h. + */ + GetReq(TestStopInput, req); + /* + * fix up the request type code to what is needed + */ + req->reqType = XTestReqCode; + /* + * set the minor request type code to X_TestStopInput + */ + req->XTestReqType = X_TestStopInput; + UnlockDisplay(dpy); + SyncHandle(); + return(0); + } +} + +/****************************************************************************** + * + * XTestReset + * + * Tell the server to set everything having to do with this extension + * back to its initial state. + */ +int +XTestReset( +/* + * the connection to the X server + */ +register Display *dpy) +{ + /* + * pointer to xTestReset structure + */ + xTestResetReq *req; + + LockDisplay(dpy); + if (XTestCheckExtInit(dpy) == -1) + { + /* + * if the extension is not installed in the server + * then unlock the display and return -1. + */ + UnlockDisplay(dpy); + return(-1); + } + else + { + /* + * Get the next available X request packet in the buffer. + * It sets the `length' field to the size (in 32-bit words) + * of the request. It also sets the `reqType' field in the + * request to X_TestReset, which is not what is needed. + * + * GetReq is a macro defined in Xlibint.h. + */ + GetReq(TestReset, req); + /* + * fix up the request type code to what is needed + */ + req->reqType = XTestReqCode; + /* + * set the minor request type code to X_TestReset + */ + req->XTestReqType = X_TestReset; + UnlockDisplay(dpy); + SyncHandle(); + return(0); + } +} + +/****************************************************************************** + * + * XTestQueryInputSize + * + * Returns the number of input actions in the server's input action buffer. + */ +int +XTestQueryInputSize( +/* + * the connection to the X server + */ +register Display *dpy, +/* + * the address of the place to put the number of input actions in the + * server's input action buffer + */ +unsigned long *size_return) +{ + /* + * pointer to xTestQueryInputSize structure + */ + xTestQueryInputSizeReq *req; + /* + * pointer to xTestQueryInputSize structure + */ + xTestQueryInputSizeReply rep; + + LockDisplay(dpy); + if (XTestCheckExtInit(dpy) == -1) + { + /* + * if the extension is not installed in the server + * then unlock the display and return -1. + */ + UnlockDisplay(dpy); + return(-1); + } + else + { + /* + * Get the next available X request packet in the buffer. + * It sets the `length' field to the size (in 32-bit words) + * of the request. It also sets the `reqType' field in the + * request to X_TestQueryInputSize, which is not what is needed. + * + * GetReq is a macro defined in Xlibint.h. + */ + GetReq(TestQueryInputSize, req); + /* + * fix up the request type code to what is needed + */ + req->reqType = XTestReqCode; + /* + * set the minor request type code to X_TestQueryInputSize + */ + req->XTestReqType = X_TestQueryInputSize; + /* + * get a reply from the server + */ + (void) _XReply (dpy, (xReply *) &rep, 0, xTrue); + /* + * put the size in the caller's variable + */ + *size_return = (unsigned long) rep.size_return; + UnlockDisplay(dpy); + SyncHandle(); + return(0); + } +} + +/****************************************************************************** + * + * XTestCheckExtInit + * + * Check to see if the XTest extension is installed in the server. + */ +static int +XTestCheckExtInit( +/* + * the connection to the X server + */ +register Display *dpy) +{ + /* + * if the extension has not been initialized, then do so + */ + if (!XTestReqCode) + { + return(XTestInitExtension(dpy)); + } + return(0); +} + +/****************************************************************************** + * + * XTestInitExtension + * + * Attempt to initialize this extension in the server. Return 0 if it + * succeeds, -1 if it does not succeed. + */ +static int +XTestInitExtension( +/* + * the connection to the X server + */ +register Display *dpy) +{ + /* + * loop index + */ + int i; + /* + * return value from XInitExtension + */ + XExtCodes *ret; + + /* + * attempt to initialize the extension + */ + ret = XInitExtension(dpy, XTestEXTENSION_NAME); + /* + * if the initialize failed, return -1 + */ + if (ret == NULL) + { + return (-1); + } + /* + * the initialize succeeded, remember the major opcode + * for this extension + */ + XTestReqCode = ret->major_opcode; + /* + * set up the event handler for any events from + * this extension + */ + for (i = 0; i < XTestEVENT_COUNT; i++) + { + XESetWireToEvent(dpy, + ret->first_event+i, + XTestWireToEvent); + } + /* + * compute the event type codes for the events + * in this extension + */ + XTestInputActionType += ret->first_event; + XTestFakeAckType += ret->first_event; + /* + * everything worked ok + */ + return(0); +} + +/****************************************************************************** + * + * XTestWireToEvent + * + * Handle XTest extension events. + * Reformat a wire event into an XEvent structure of the right type. + */ +static Bool +XTestWireToEvent( +/* + * the connection to the X server + */ +Display *dpy, +/* + * a pointer to where a host formatted event should be stored + * with the information copied to it + */ +XEvent *reTemp, +/* + * a pointer to the wire event + */ +xEvent *eventTemp) +{ + XTestInputActionEvent *re = (XTestInputActionEvent *) reTemp; + xTestInputActionEvent *event = (xTestInputActionEvent *) eventTemp; + + /* + * loop index + */ + int i; + /* + * pointer to where the input actions go in the host format event + */ + CARD8 *to; + /* + * pointer to the input actions in the wire event + */ + CARD8 *from; + + /* + * Copy the type of the wire event to the new event. + * This will work for either event type because the type, + * display, and window fields in the events have to be the same. + */ + re->type = event->type; + /* + * set the display parameter in case it is needed (by who?) + */ + re->display = dpy; + if (re->type == XTestInputActionType) + { + /* + * point at the first byte of input actions in the wire event + */ + from = &(event->actions[0]); + /* + * point at where the input action bytes go in the new event + */ + to = &(re->actions[0]); + /* + * copy the input action bytes from the wire event to + * the new event + */ + for (i = 0; i < XTestACTIONS_SIZE; i++) + { + *(to++) = *(from++); + } + } + else if (re->type == XTestFakeAckType) + { + /* + * nothing else needs to be done + */ + } + else + { + printf("XTestWireToEvent: UNKNOWN WIRE EVENT! type=%d\n", + (int) event->type); + printf("%s is giving up.\n", XTestEXTENSION_NAME); + exit (1); + } + return 1; +} + +/****************************************************************************** + * + * XTestPressKey + * + * Send input actions to the server to cause the server to think + * that the specified key on the keyboard was moved as specified. + */ +int +XTestPressKey( +Display *display, +int device_id, +unsigned long delay, +unsigned int keycode, +unsigned int key_action) +{ + /* + * bounds check the key code + */ + if (keycode < 8 || keycode > 255) + { + return(-1); + } + /* + * use the commmon key/button handling routine + */ + return(XTestKeyOrButton(display, + device_id, + delay, + keycode, + key_action)); +} + +/****************************************************************************** + * + * XTestPressButton + * + * Send input actions to the server to cause the server to think + * that the specified button on the mouse was moved as specified. + */ +int +XTestPressButton( +Display *display, +int device_id, +unsigned long delay, +unsigned int button_number, +unsigned int button_action) +{ + /* + * bounds check the button number + */ + if (button_number > 7) + { + return(-1); + } + /* + * use the commmon key/button handling routine + */ + return(XTestKeyOrButton(display, + device_id, + delay, + button_number, + button_action)); +} + +/****************************************************************************** + * + * XTestKeyOrButton + * + * Send input actions to the server to cause the server to think + * that the specified key/button was moved as specified. + */ +static int +XTestKeyOrButton( +Display *display, +int device_id, +unsigned long delay, +unsigned int code, +unsigned int action) +{ + /* + * holds a key input action to be filled out and sent to the server + */ + XTestKeyInfo keyinfo; + + /* + * bounds check the device id + */ + if (device_id < 0 || device_id > XTestMAX_DEVICE_ID) + { + return(-1); + } + /* + * fill out the key input action(s) as appropriate + */ + switch(action) + { + case XTestPRESS: + /* + * Check the delay. If it is larger than will fit in the + * key input action, send a delay input action. + */ + if(XTestCheckDelay(display, &delay) == -1) + { + /* + * an error occurred, return -1 + */ + return(-1); + } + /* + * create the header + */ + keyinfo.header = XTestPackDeviceID(device_id) | + XTestKEY_ACTION | + XTestKEY_DOWN; + /* + * set the key/button code + */ + keyinfo.keycode = code; + /* + * set the delay time + */ + keyinfo.delay_time = delay; + /* + * pack the input action into a request to be sent to the + * server when the request is full or XTestFlush is called + */ + return(XTestPackInputAction(display, + (CARD8 *) &keyinfo, + sizeof(XTestKeyInfo))); + case XTestRELEASE: + /* + * Check the delay. If it is larger than will fit in the + * key input action, send a delay input action. + */ + if(XTestCheckDelay(display, &delay) == -1) + { + /* + * an error occurred, return -1 + */ + return(-1); + } + /* + * create the header + */ + keyinfo.header = XTestPackDeviceID(device_id) | + XTestKEY_ACTION | + XTestKEY_UP; + /* + * set the key/button code + */ + keyinfo.keycode = code; + /* + * set the delay time + */ + keyinfo.delay_time = delay; + /* + * pack the input action into a request to be sent to the + * server when the request is full or XTestFlush is called + */ + return(XTestPackInputAction(display, + (CARD8 *) &keyinfo, + sizeof(XTestKeyInfo))); + case XTestSTROKE: + /* + * Check the delay. If it is larger than will fit in the + * key input action, send a delay input action. + */ + if(XTestCheckDelay(display, &delay) == -1) + { + /* + * an error occurred, return -1 + */ + return(-1); + } + /* + * create a key/button-down input action header + */ + keyinfo.header = XTestPackDeviceID(device_id) | + XTestKEY_ACTION | + XTestKEY_DOWN; + /* + * set the key/button code + */ + keyinfo.keycode = code; + /* + * set the delay time + */ + keyinfo.delay_time = delay; + /* + * pack the input action into a request to be sent to the + * server when the request is full or XTestFlush is called + */ + if (XTestPackInputAction(display, + (CARD8 *) &keyinfo, + sizeof(XTestKeyInfo)) == -1) + { + /* + * an error occurred, return -1 + */ + return(-1); + } + /* + * set the delay to XTestSTROKE_DELAY_TIME + */ + delay = XTestSTROKE_DELAY_TIME; + /* + * Check the delay. If it is larger than will fit in the + * key input action, send a delay input action. + */ + if(XTestCheckDelay(display, &delay) == -1) + { + /* + * an error occurred, return -1 + */ + return(-1); + } + /* + * create a key/button-up input action header + */ + keyinfo.header = XTestPackDeviceID(device_id) | + XTestKEY_ACTION | + XTestKEY_UP; + /* + * set the key/button code + */ + keyinfo.keycode = code; + /* + * set the delay time + */ + keyinfo.delay_time = delay; + /* + * pack the input action into a request to be sent to the + * server when the request is full or XTestFlush is called + */ + return(XTestPackInputAction(display, + (CARD8 *) &keyinfo, + sizeof(XTestKeyInfo))); + default: + /* + * invalid action value, return -1 + */ + return(-1); + } +} + +/****************************************************************************** + * + * XTestMovePointer + * + * Send input actions to the server to cause the server to think + * that the mouse was moved as specified. + */ +int +XTestMovePointer( +Display *display, +int device_id, +unsigned long delay[], +int x[], +int y[], +unsigned int count) +{ + /* + * holds a motion input action to be filled out and sent to the server + */ + XTestMotionInfo motioninfo; + /* + * holds a jump input action to be filled out and sent to the server + */ + XTestJumpInfo jumpinfo; + /* + * loop index + */ + unsigned int i; + /* + * holds the change in x and y directions from the current x and y + * coordinates + */ + int dx; + int dy; + + /* + * bounds check the device id + */ + if (device_id < 0 || device_id > XTestMAX_DEVICE_ID) + { + return(-1); + } + /* + * if the count is 0, there is nothing to do. return 0 + */ + if (count == 0) + { + return(0); + } + /* + * loop through the pointer motions, creating the appropriate + * input actions for each motion + */ + for (i = 0; i < count; i++) + { + /* + * Check the delay. If it is larger than will fit in the + * input action, send a delay input action. + */ + if(XTestCheckDelay(display, &(delay[i])) == -1) + { + /* + * an error occurred, return -1 + */ + return(-1); + } + /* + * compute the change from the current x and y coordinates + * to the new x and y coordinates + */ + dx = x[i] - current_x; + dy = y[i] - current_y; + /* + * update the current x and y coordinates + */ + current_x = x[i]; + current_y = y[i]; + /* + * If the pointer motion range is too large to fit into + * a motion input action, then use a jump input action. + * Otherwise, use a motion input action. + */ + if ((dx > XTestMOTION_MAX) || (dx < XTestMOTION_MIN) || + (dy > XTestMOTION_MAX) || (dy < XTestMOTION_MIN)) + { + /* + * create a jump input action header + */ + jumpinfo.header = XTestPackDeviceID(device_id) | + XTestJUMP_ACTION; + /* + * set the x and y coordinates to jump to + */ + jumpinfo.jumpx = x[i]; + jumpinfo.jumpy = y[i]; + /* + * set the delay time + */ + jumpinfo.delay_time = delay[i]; + /* + * pack the jump input action into a request to be + * sent to the server when the request is full + * or XTestFlush is called + */ + if (XTestPackInputAction(display, + (CARD8 *) &jumpinfo, + sizeof(XTestJumpInfo)) == -1) + { + /* + * an error occurred, return -1 + */ + return(-1); + } + } + else + { + /* + * create a motion input action header + */ + motioninfo.header = XTestPackDeviceID(device_id) | + XTestMOTION_ACTION; + /* + * compute the motion data byte + */ + if (dx < 0) + { + motioninfo.header |= XTestX_NEGATIVE; + dx = abs(dx); + } + if (dy < 0) + { + motioninfo.header |= XTestY_NEGATIVE; + dy = abs(dy); + } + motioninfo.motion_data = XTestPackXMotionValue(dx); + motioninfo.motion_data |= XTestPackYMotionValue(dy); + /* + * set the delay time + */ + motioninfo.delay_time = delay[i]; + /* + * pack the motion input action into a request to be + * sent to the server when the request is full + * or XTestFlush is called + */ + if (XTestPackInputAction(display, + (CARD8 *) &motioninfo, + sizeof(XTestMotionInfo)) == -1) + { + /* + * an error occurred, return -1 + */ + return(-1); + } + } + } + /* + * if you get here, everything went ok + */ + return(0); +} + +/****************************************************************************** + * + * XTestCheckDelay + * + * Check the delay value at the passed-in address. If it is larger than + * will fit in a normal input action, then send a delay input action. + */ +static int +XTestCheckDelay( +Display *display, +unsigned long *delay_addr) +{ + /* + * holds a delay input action to be filled out and sent to the server + */ + XTestDelayInfo delayinfo; + + /* + * if the delay value will fit in the input action, + * then there is no need for a delay input action + */ + if (*delay_addr <= XTestSHORT_DELAY_TIME) + { + return(0); + } + /* + * fill out a delay input action + */ + delayinfo.header = XTestPackDeviceID(XTestDELAY_DEVICE_ID); + delayinfo.delay_time = *delay_addr; + /* + * all of the delay time will be accounted for in the + * delay input action, so set the original delay value to 0 + */ + *delay_addr = 0; + /* + * pack the delay input action into a request to be sent to the + * server when the request is full or XTestFlush is called + */ + return(XTestPackInputAction(display, + (CARD8 *) &delayinfo, + sizeof(XTestDelayInfo))); +} + +/****************************************************************************** + * + * XTestPackInputAction + * + * If the input action buffer is full or the number of input actions + * has reached the maximum that the server can handle at one time, + * then send the input actions to the server using XTestFakeInput. + */ +static int +XTestPackInputAction( +Display *display, +CARD8 *action_addr, +int action_size) +{ + /* + * loop index + */ + int i; + /* + * acknowledge flag + */ + int ack_flag; + + /* + * if we don't already know it, find out how many input actions + * the server can handle at one time + */ + if (action_array_size == 0) + { + if(XTestQueryInputSize(display, &action_array_size) == -1) + { + /* + * if an error, return -1 + */ + return(-1); + } + } + /* + * if the specified input action will fit in the the input + * action buffer and won't exceed the server's capacity, then + * put the input action into the input buffer + */ + if(((action_index + action_size) <= XTestMAX_ACTION_LIST_SIZE) && + ((action_count + 1) < action_array_size)) + { + /* + * copy the input action into the buffer + */ + for (i = 0; i < action_size; i++) + { + action_buf[action_index++] = *(action_addr++); + } + /* + * increment the action count + */ + action_count++; + /* + * everything went ok, return 0 + */ + return(0); + } + /* + * We have to write input actions to the server. If the server's + * input action capacity will be reached, then ask for an + * acknowledge event when the server has processed all of the + * input actions. Otherwise, an acknowledge event is not needed. + */ + if (action_count >= action_array_size) + { + ack_flag = XTestFAKE_ACK_REQUEST; + } + else + { + ack_flag = XTestFAKE_ACK_NOT_NEEDED; + } + /* + * write the input actions to the server + */ + if (XTestWriteInputActions(display, + (char *) &(action_buf[0]), + action_index, + ack_flag) == -1) + { + /* + * error, return -1 + */ + return(-1); + } + /* + * copy the input action into the buffer + */ + for (i = 0; i < action_size; i++) + { + action_buf[action_index++] = *(action_addr++); + } + /* + * increment the action count + */ + action_count++; + return(0); +} + +/****************************************************************************** + * + * XTestWriteInputActions + * + * Send input actions to the server. + */ +static int +XTestWriteInputActions( +Display *display, +char *action_list_addr, +int action_list_size, +int ack_flag) +{ + /* + * Holds an event. Used while waiting for an acknowledge event + */ + XEvent event; + /* + * points to XTestIdentifyMyEvent + */ + Bool (*func_ptr)(Display *, XEvent *, XPointer); + + /* + * write the input actions to the server + */ + if (XTestFakeInput(display, + action_list_addr, + action_list_size, + ack_flag) == -1) + { + /* + * if an error, return -1 + */ + return(-1); + } + /* + * flush X's buffers to make sure that the server really gets + * the input actions + */ + XFlush(display); + /* + * mark the input action buffer as empty + */ + action_index = 0; + /* + * if we asked for an acknowledge event, then wait for it + */ + if (ack_flag == XTestFAKE_ACK_REQUEST) + { + /* + * point func_ptr at XTestIdentifyMyEvent + */ + func_ptr = XTestIdentifyMyEvent; + /* + * Wait until the acknowledge event comes. When the + * acknowledge event comes, it is removed from the event + * queue without disturbing any other events that might + * be in the queue. + */ + XIfEvent(display, &event, func_ptr, NULL); + /* + * set the input action count back to 0 + */ + action_count = 0; + } + /* + * if we got here, then everything is ok, return 0 + */ + return(0); +} + +/****************************************************************************** + * + * XTestIdentifyMyEvent + * + * This function is called by XIfEvent to look at an event and see if + * it is of XTestFakeAckType. + */ +static Bool +XTestIdentifyMyEvent( +Display *display, +/* + * Holds the event that this routine is supposed to look at. + */ +XEvent *event_ptr, +/* + * this points to any user-specified arguments (ignored) + */ +char *args) +{ + /* + * if the event if of the correct type, return the Bool True, + * otherwise return the Bool False. + */ + if (event_ptr->type == XTestFakeAckType) + { + return(True); + } + else + { + return(False); + } +} + +/****************************************************************************** + * + * XTestFlush + * + * Send any input actions in the input action buffer to the server. + */ +int +XTestFlush(Display *display) +{ + /* + * acknowledge flag + */ + int ack_flag; + + /* + * if there are no input actions in the input action buffer, + * then return 0 + */ + if (action_index == 0) + { + return(0); + } + /* + * We have input actions to write to the server. We will + * wait until the server has finished processing the input actions. + */ + ack_flag = XTestFAKE_ACK_REQUEST; + /* + * write the input actions to the server + */ + return(XTestWriteInputActions(display, + (char *) &(action_buf[0]), + action_index, + ack_flag)); +} diff --git a/libXext/src/Xcup.c b/libXext/src/Xcup.c index d050ba0b6..ad78699be 100644 --- a/libXext/src/Xcup.c +++ b/libXext/src/Xcup.c @@ -1,262 +1,262 @@ -/* - -Copyright 1987, 1988, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#ifdef WIN32 -#include -#endif - -#include -#include -#include -#include -#include - -static XExtensionInfo _xcup_info_data; -static XExtensionInfo *xcup_info = &_xcup_info_data; -static char *xcup_extension_name = XCUPNAME; - -/***************************************************************************** - * * - * private utility routines * - * * - *****************************************************************************/ - -static int close_display(Display *dpy, XExtCodes *codes); -static /* const */ XExtensionHooks xcup_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, xcup_info, - xcup_extension_name, - &xcup_extension_hooks, - 0, NULL) - -static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xcup_info) - - -/***************************************************************************** - * * - * public Xcup Extension routines * - * * - *****************************************************************************/ - -Status -XcupQueryVersion( - Display* dpy, - int* major_version_return, - int* minor_version_return) -{ - XExtDisplayInfo *info = find_display (dpy); - xXcupQueryVersionReply rep; - xXcupQueryVersionReq *req; - - XextCheckExtension (dpy, info, xcup_extension_name, False); - - LockDisplay(dpy); - GetReq(XcupQueryVersion, req); - req->reqType = info->codes->major_opcode; - req->xcupReqType = X_XcupQueryVersion; - req->client_major_version = XCUP_MAJOR_VERSION; - req->client_minor_version = XCUP_MINOR_VERSION; - if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - *major_version_return = rep.server_major_version; - *minor_version_return = rep.server_minor_version; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -/* Win32 reserves 20 colormap entries for its desktop */ -#ifndef TYP_RESERVED_ENTRIES -#define TYP_RESERVED_ENTRIES 20 -#endif - -Status -XcupGetReservedColormapEntries( - Display* dpy, - int screen, - XColor** colors_out, - int* ncolors) -{ - XExtDisplayInfo *info = find_display (dpy); - xXcupGetReservedColormapEntriesReply rep; - xXcupGetReservedColormapEntriesReq *req; - xColorItem rbuf[TYP_RESERVED_ENTRIES]; - - *ncolors = 0; - - XextCheckExtension (dpy, info, xcup_extension_name, False); - - LockDisplay(dpy); - GetReq(XcupGetReservedColormapEntries, req); - req->reqType = info->codes->major_opcode; - req->xcupReqType = X_XcupGetReservedColormapEntries; - req->screen = screen; - if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - long nbytes; - xColorItem* rbufp; - int nentries = rep.length / 3; - - nbytes = nentries * SIZEOF (xColorItem); - if (nentries > TYP_RESERVED_ENTRIES) - rbufp = (xColorItem*) Xmalloc (nbytes); - else - rbufp = rbuf; - - if (rbufp == NULL) { - _XEatData (dpy, (unsigned long) nbytes); - UnlockDisplay (dpy); - SyncHandle (); - return False; - } - _XRead (dpy, (char*) rbufp, nbytes); - - *colors_out = (XColor*) Xmalloc (nentries * sizeof (XColor)); - if (*colors_out) { - xColorItem* cs = (xColorItem *) rbufp; - XColor* cd = *colors_out; - int i; - - *ncolors = nentries; - for (i = 0; i < *ncolors; i++, cd++) { - cd->pixel = cs->pixel; - cd->red = cs->red; - cd->green = cs->green; - cd->blue = cs->blue; - cs = (xColorItem*) (((char*) cs) + SIZEOF(xColorItem)); - } - if (rbufp != rbuf) XFree ((char*) rbufp); - UnlockDisplay(dpy); - SyncHandle(); - return True; - } - if (rbufp != rbuf) XFree ((char*) rbufp); - } - UnlockDisplay(dpy); - SyncHandle(); - return False; -} - -Status -XcupStoreColors( - Display* dpy, - Colormap colormap, - XColor* colors_in_out, - int ncolors) -{ - XExtDisplayInfo *info = find_display (dpy); - xXcupStoreColorsReply rep; - xXcupStoreColorsReq *req; - xColorItem rbuf[256]; - xColorItem citem; - int i; - XColor* xcp; - - XextCheckExtension (dpy, info, xcup_extension_name, False); - - LockDisplay(dpy); - GetReq(XcupStoreColors, req); - req->reqType = info->codes->major_opcode; - req->xcupReqType = X_XcupStoreColors; - req->cmap = colormap; - req->length += (ncolors * SIZEOF(xColorItem)) >> 2; - - for (i = 0, xcp = colors_in_out; i < ncolors; i++, xcp++) { - citem.pixel = xcp->pixel; - citem.red = xcp->red; - citem.green = xcp->green; - citem.blue = xcp->blue; - - /* note that xColorItem doesn't contain all 16-bit quantities, so - we can't use Data16 */ - Data(dpy, (char *)&citem, (long) SIZEOF(xColorItem)); - } - - if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - long nbytes; - xColorItem* rbufp; - xColorItem* cs; - int nentries = rep.length / 3; - - nbytes = nentries * SIZEOF (xColorItem); - - if (nentries != ncolors) { - _XEatData (dpy, (unsigned long) nbytes); - UnlockDisplay (dpy); - SyncHandle (); - return False; - } - - if (ncolors > 256) - rbufp = (xColorItem*) Xmalloc (nbytes); - else - rbufp = rbuf; - - if (rbufp == NULL) { - _XEatData (dpy, (unsigned long) nbytes); - UnlockDisplay (dpy); - SyncHandle (); - return False; - - } - - _XRead (dpy, (char*) rbufp, nbytes); - - for (i = 0, xcp = colors_in_out, cs = rbufp; i < ncolors; i++, xcp++, cs++) { - xcp->pixel = cs->pixel; - xcp->red = cs->red; - xcp->green = cs->green; - xcp->blue = cs->blue; - xcp->flags = cs->flags; - } - if (rbufp != rbuf) XFree ((char*)rbufp); - - UnlockDisplay(dpy); - SyncHandle(); - return True; - } - UnlockDisplay(dpy); - SyncHandle(); - return False; -} - +/* + +Copyright 1987, 1988, 1998 The Open Group + +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#ifdef WIN32 +#include +#endif + +#include +#include +#include +#include +#include + +static XExtensionInfo _xcup_info_data; +static XExtensionInfo *xcup_info = &_xcup_info_data; +static char *xcup_extension_name = XCUPNAME; + +/***************************************************************************** + * * + * private utility routines * + * * + *****************************************************************************/ + +static int close_display(Display *dpy, XExtCodes *codes); +static /* const */ XExtensionHooks xcup_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, xcup_info, + xcup_extension_name, + &xcup_extension_hooks, + 0, NULL) + +static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xcup_info) + + +/***************************************************************************** + * * + * public Xcup Extension routines * + * * + *****************************************************************************/ + +Status +XcupQueryVersion( + Display* dpy, + int* major_version_return, + int* minor_version_return) +{ + XExtDisplayInfo *info = find_display (dpy); + xXcupQueryVersionReply rep; + xXcupQueryVersionReq *req; + + XextCheckExtension (dpy, info, xcup_extension_name, False); + + LockDisplay(dpy); + GetReq(XcupQueryVersion, req); + req->reqType = info->codes->major_opcode; + req->xcupReqType = X_XcupQueryVersion; + req->client_major_version = XCUP_MAJOR_VERSION; + req->client_minor_version = XCUP_MINOR_VERSION; + if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + *major_version_return = rep.server_major_version; + *minor_version_return = rep.server_minor_version; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +/* Win32 reserves 20 colormap entries for its desktop */ +#ifndef TYP_RESERVED_ENTRIES +#define TYP_RESERVED_ENTRIES 20 +#endif + +Status +XcupGetReservedColormapEntries( + Display* dpy, + int screen, + XColor** colors_out, + int* ncolors) +{ + XExtDisplayInfo *info = find_display (dpy); + xXcupGetReservedColormapEntriesReply rep; + xXcupGetReservedColormapEntriesReq *req; + xColorItem rbuf[TYP_RESERVED_ENTRIES]; + + *ncolors = 0; + + XextCheckExtension (dpy, info, xcup_extension_name, False); + + LockDisplay(dpy); + GetReq(XcupGetReservedColormapEntries, req); + req->reqType = info->codes->major_opcode; + req->xcupReqType = X_XcupGetReservedColormapEntries; + req->screen = screen; + if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) { + long nbytes; + xColorItem* rbufp; + int nentries = rep.length / 3; + + nbytes = nentries * SIZEOF (xColorItem); + if (nentries > TYP_RESERVED_ENTRIES) + rbufp = (xColorItem*) Xmalloc (nbytes); + else + rbufp = rbuf; + + if (rbufp == NULL) { + _XEatData (dpy, (unsigned long) nbytes); + UnlockDisplay (dpy); + SyncHandle (); + return False; + } + _XRead (dpy, (char*) rbufp, nbytes); + + *colors_out = (XColor*) Xmalloc (nentries * sizeof (XColor)); + if (*colors_out) { + xColorItem* cs = (xColorItem *) rbufp; + XColor* cd = *colors_out; + int i; + + *ncolors = nentries; + for (i = 0; i < *ncolors; i++, cd++) { + cd->pixel = cs->pixel; + cd->red = cs->red; + cd->green = cs->green; + cd->blue = cs->blue; + cs = (xColorItem*) (((char*) cs) + SIZEOF(xColorItem)); + } + if (rbufp != rbuf) XFree ((char*) rbufp); + UnlockDisplay(dpy); + SyncHandle(); + return True; + } + if (rbufp != rbuf) XFree ((char*) rbufp); + } + UnlockDisplay(dpy); + SyncHandle(); + return False; +} + +Status +XcupStoreColors( + Display* dpy, + Colormap colormap, + XColor* colors_in_out, + int ncolors) +{ + XExtDisplayInfo *info = find_display (dpy); + xXcupStoreColorsReply rep; + xXcupStoreColorsReq *req; + xColorItem rbuf[256]; + xColorItem citem; + int i; + XColor* xcp; + + XextCheckExtension (dpy, info, xcup_extension_name, False); + + LockDisplay(dpy); + GetReq(XcupStoreColors, req); + req->reqType = info->codes->major_opcode; + req->xcupReqType = X_XcupStoreColors; + req->cmap = colormap; + req->length += (ncolors * SIZEOF(xColorItem)) >> 2; + + for (i = 0, xcp = colors_in_out; i < ncolors; i++, xcp++) { + citem.pixel = xcp->pixel; + citem.red = xcp->red; + citem.green = xcp->green; + citem.blue = xcp->blue; + + /* note that xColorItem doesn't contain all 16-bit quantities, so + we can't use Data16 */ + Data(dpy, (char *)&citem, (long) SIZEOF(xColorItem)); + } + + if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) { + long nbytes; + xColorItem* rbufp; + xColorItem* cs; + int nentries = rep.length / 3; + + nbytes = nentries * SIZEOF (xColorItem); + + if (nentries != ncolors) { + _XEatData (dpy, (unsigned long) nbytes); + UnlockDisplay (dpy); + SyncHandle (); + return False; + } + + if (ncolors > 256) + rbufp = (xColorItem*) Xmalloc (nbytes); + else + rbufp = rbuf; + + if (rbufp == NULL) { + _XEatData (dpy, (unsigned long) nbytes); + UnlockDisplay (dpy); + SyncHandle (); + return False; + + } + + _XRead (dpy, (char*) rbufp, nbytes); + + for (i = 0, xcp = colors_in_out, cs = rbufp; i < ncolors; i++, xcp++, cs++) { + xcp->pixel = cs->pixel; + xcp->red = cs->red; + xcp->green = cs->green; + xcp->blue = cs->blue; + xcp->flags = cs->flags; + } + if (rbufp != rbuf) XFree ((char*)rbufp); + + UnlockDisplay(dpy); + SyncHandle(); + return True; + } + UnlockDisplay(dpy); + SyncHandle(); + return False; +} + diff --git a/libXext/src/Xdbe.c b/libXext/src/Xdbe.c index 930b51f60..1b9e2da52 100644 --- a/libXext/src/Xdbe.c +++ b/libXext/src/Xdbe.c @@ -1,468 +1,468 @@ -/****************************************************************************** - * - * Copyright (c) 1994, 1995 Hewlett-Packard Company - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR - * THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the Hewlett-Packard - * Company shall not be used in advertising or otherwise to promote the - * sale, use or other dealings in this Software without prior written - * authorization from the Hewlett-Packard Company. - * - * Xlib DBE code - * - *****************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include - -static XExtensionInfo _dbe_info_data; -static XExtensionInfo *dbe_info = &_dbe_info_data; -static char *dbe_extension_name = DBE_PROTOCOL_NAME; - -#define DbeCheckExtension(dpy,i,val) \ - XextCheckExtension (dpy, i, dbe_extension_name, val) -#define DbeSimpleCheckExtension(dpy,i) \ - XextSimpleCheckExtension (dpy, i, dbe_extension_name) - -#if !defined(UNIXCPP) -#define DbeGetReq(name,req,info) GetReq (name, req); \ - req->reqType = info->codes->major_opcode; \ - req->dbeReqType = X_##name; -#else -#define DbeGetReq(name,req,info) GetReq (name, req); \ - req->reqType = info->codes->major_opcode; \ - req->dbeReqType = X_/**/name; -#endif - - -/***************************************************************************** - * * - * private utility routines * - * * - *****************************************************************************/ - -/* - * find_display - locate the display info block - */ -static int close_display(Display *dpy, XExtCodes *codes); -static char *error_string(Display *dpy, int code, XExtCodes *codes, - char *buf, int n); -static XExtensionHooks dbe_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 */ - error_string, /* error_string */ -}; - -static char *dbe_error_list[] = { - "BadBuffer", /* DbeBadBuffer */ -}; - -static XEXT_GENERATE_FIND_DISPLAY (find_display, dbe_info, - dbe_extension_name, - &dbe_extension_hooks, - DbeNumberEvents, NULL) - -static XEXT_GENERATE_CLOSE_DISPLAY (close_display, dbe_info) - -static XEXT_GENERATE_ERROR_STRING (error_string, dbe_extension_name, - DbeNumberErrors, - dbe_error_list) - - -/***************************************************************************** - * * - * Double-Buffering public interfaces * - * * - *****************************************************************************/ - -/* - * XdbeQueryExtension - - * Sets major_version_return and minor_verion_return to the major and - * minor DBE protocol version supported by the server. If the DBE - * library is compatible with the version returned by the server, this - * function returns non-zero. If dpy does not support the DBE - * extension, or if there was an error during communication with the - * server, or if the server and library protocol versions are - * incompatible, this functions returns zero. No other Xdbe functions - * may be called before this function. If a client violates this rule, - * the effects of all subsequent Xdbe calls are undefined. - */ -Status XdbeQueryExtension ( - Display *dpy, - int *major_version_return, - int *minor_version_return) -{ - XExtDisplayInfo *info = find_display (dpy); - xDbeGetVersionReply rep; - register xDbeGetVersionReq *req; - - if (!XextHasExtension (info)) - return (Status)0; /* failure */ - - LockDisplay (dpy); - DbeGetReq (DbeGetVersion, req, info); - req->majorVersion = DBE_MAJOR_VERSION; - req->minorVersion = DBE_MINOR_VERSION; - - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay (dpy); - SyncHandle (); - return (Status)0; /* failure */ - } - *major_version_return = rep.majorVersion; - *minor_version_return = rep.minorVersion; - UnlockDisplay (dpy); - - SyncHandle (); - - if (*major_version_return != DBE_MAJOR_VERSION) - return (Status)0; /* failure */ - else - return (Status)1; /* success */ -} - - -/* - * XdbeAllocateBackBuffer - - * This function returns a drawable ID used to refer to the back buffer - * of the specified window. The swap_action is a hint to indicate the - * swap action that will likely be used in subsequent calls to - * XdbeSwapBuffers. The actual swap action used in calls to - * XdbeSwapBuffers does not have to be the same as the swap_action - * passed to this function, though clients are encouraged to provide - * accurate information whenever possible. - */ - -XdbeBackBuffer XdbeAllocateBackBufferName( - Display *dpy, - Window window, - XdbeSwapAction swap_action) -{ - XExtDisplayInfo *info = find_display (dpy); - register xDbeAllocateBackBufferNameReq *req; - XdbeBackBuffer buffer; - - /* make sure extension is available; if not, return the - * third parameter (0). - */ - DbeCheckExtension (dpy, info, (XdbeBackBuffer)0); - - LockDisplay(dpy); - DbeGetReq(DbeAllocateBackBufferName, req, info); - req->window = window; - req->swapAction = (unsigned char)swap_action; - req->buffer = buffer = XAllocID (dpy); - - UnlockDisplay (dpy); - SyncHandle (); - return buffer; - -} /* XdbeAllocateBackBufferName() */ - -/* - * XdbeDeallocateBackBufferName - - * This function frees a drawable ID, buffer, that was obtained via - * XdbeAllocateBackBufferName. The buffer must refer to the back buffer - * of the specified window, or a protocol error results. - */ -Status XdbeDeallocateBackBufferName ( - Display *dpy, - XdbeBackBuffer buffer) -{ - XExtDisplayInfo *info = find_display (dpy); - register xDbeDeallocateBackBufferNameReq *req; - - DbeCheckExtension (dpy, info, (Status)0 /* failure */); - - LockDisplay (dpy); - DbeGetReq (DbeDeallocateBackBufferName, req, info); - req->buffer = buffer; - UnlockDisplay (dpy); - SyncHandle (); - - return (Status)1; /* success */ -} - - -/* - * XdbeSwapBuffers - - * This function swaps the front and back buffers for a list of windows. - * The argument num_windows specifies how many windows are to have their - * buffers swapped; it is the number of elements in the swap_info array. - * The argument swap_info specifies the information needed per window - * to do the swap. - */ -Status XdbeSwapBuffers ( - Display *dpy, - XdbeSwapInfo *swap_info, - int num_windows) -{ - XExtDisplayInfo *info = find_display (dpy); - register xDbeSwapBuffersReq *req; - int i; - - DbeCheckExtension (dpy, info, (Status)0 /* failure */); - - LockDisplay (dpy); - DbeGetReq (DbeSwapBuffers, req, info); - req->length += 2*num_windows; - req->n = num_windows; - - /* We need to handle 64-bit machines, where we can not use PackData32 - * directly because info would be lost in translating from 32- to 64-bit. - * Instead we send data via a loop that accounts for the translation. - */ - for (i = 0; i < num_windows; i++) - { - char tmp[4]; - Data32 (dpy, (long *)&swap_info[i].swap_window, 4); - tmp[0] = swap_info[i].swap_action; - Data (dpy, (char *)tmp, 4); - } - - UnlockDisplay (dpy); - SyncHandle (); - - - return (Status)1; /* success */ - -} /* XdbeSwapBuffers() */ - - -/* - * XdbeBeginIdiom - - * This function marks the beginning of an idiom sequence. - */ -Status XdbeBeginIdiom (Display *dpy) -{ - XExtDisplayInfo *info = find_display(dpy); - register xDbeBeginIdiomReq *req; - - DbeCheckExtension (dpy, info, (Status)0 /* failure */); - - LockDisplay (dpy); - DbeGetReq (DbeBeginIdiom, req, info); - UnlockDisplay (dpy); - SyncHandle (); - - return (Status)1; /* success */ -} - - -/* - * XdbeEndIdiom - - * This function marks the end of an idiom sequence. - */ -Status XdbeEndIdiom (Display *dpy) -{ - XExtDisplayInfo *info = find_display(dpy); - register xDbeEndIdiomReq *req; - - DbeCheckExtension (dpy, info, (Status)0 /* failure */); - - LockDisplay (dpy); - DbeGetReq (DbeEndIdiom, req, info); - UnlockDisplay (dpy); - SyncHandle (); - - return (Status)1; /* success */ -} - - -/* - * XdbeGetVisualInfo - - * This function returns information about which visuals support - * double buffering. The argument num_screens specifies how many - * elements there are in the screen_specifiers list. Each drawable - * in screen_specifiers designates a screen for which the supported - * visuals are being requested. If num_screens is zero, information - * for all screens is requested. In this case, upon return from this - * function, num_screens will be set to the number of screens that were - * found. If an error occurs, this function returns NULL, else it returns - * a pointer to a list of XdbeScreenVisualInfo structures of length - * num_screens. The nth element in the returned list corresponds to the - * nth drawable in the screen_specifiers list, unless num_screens was - * passed in with the value zero, in which case the nth element in the - * returned list corresponds to the nth screen of the server, starting - * with screen zero. - */ -XdbeScreenVisualInfo *XdbeGetVisualInfo ( - Display *dpy, - Drawable *screen_specifiers, - int *num_screens) /* SEND and RETURN */ -{ - XExtDisplayInfo *info = find_display(dpy); - register xDbeGetVisualInfoReq *req; - xDbeGetVisualInfoReply rep; - XdbeScreenVisualInfo *scrVisInfo; - int i; - - DbeCheckExtension (dpy, info, (XdbeScreenVisualInfo *)NULL); - - LockDisplay (dpy); - - DbeGetReq(DbeGetVisualInfo, req, info); - req->length = 2 + *num_screens; - req->n = *num_screens; - Data32 (dpy, screen_specifiers, (*num_screens * sizeof (CARD32))); - - if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay (dpy); - SyncHandle (); - return NULL; - } - - /* return the number of screens actually found if we - * requested information about all screens (*num_screens == 0) - */ - if (*num_screens == 0) - *num_screens = rep.m; - - /* allocate list of visual information to be returned */ - if (!(scrVisInfo = - (XdbeScreenVisualInfo *)Xmalloc( - (unsigned)(*num_screens * sizeof(XdbeScreenVisualInfo))))) { - UnlockDisplay (dpy); - SyncHandle (); - return NULL; - } - - for (i = 0; i < *num_screens; i++) - { - int nbytes; - int j; - long c; - - _XRead32 (dpy, &c, sizeof(CARD32)); - scrVisInfo[i].count = c; - - nbytes = scrVisInfo[i].count * sizeof(XdbeVisualInfo); - - /* if we can not allocate the list of visual/depth info - * then free the lists that we already allocate as well - * as the visual info list itself - */ - if (!(scrVisInfo[i].visinfo = (XdbeVisualInfo *)Xmalloc( - (unsigned)nbytes))) { - for (j = 0; j < i; j++) { - Xfree ((char *)scrVisInfo[j].visinfo); - } - Xfree ((char *)scrVisInfo); - UnlockDisplay (dpy); - SyncHandle (); - return NULL; - } - - /* Read the visual info item into the wire structure. Then copy each - * element into the library structure. The element sizes and/or - * padding may be different in the two structures. - */ - for (j = 0; j < scrVisInfo[i].count; j++) { - xDbeVisInfo xvi; - - _XRead (dpy, (char *)&xvi, sizeof(xDbeVisInfo)); - scrVisInfo[i].visinfo[j].visual = xvi.visualID; - scrVisInfo[i].visinfo[j].depth = xvi.depth; - scrVisInfo[i].visinfo[j].perflevel = xvi.perfLevel; - } - - } - - UnlockDisplay (dpy); - SyncHandle (); - return scrVisInfo; - -} /* XdbeGetVisualInfo() */ - - -/* - * XdbeFreeVisualInfo - - * This function frees the list of XdbeScreenVisualInfo returned by the - * function XdbeGetVisualInfo. - */ -void XdbeFreeVisualInfo(XdbeScreenVisualInfo *visual_info) -{ - if (visual_info == NULL) { - return; - } - - if (visual_info->visinfo) { - XFree(visual_info->visinfo); - } - - XFree(visual_info); -} - - -/* - * XdbeGetBackBufferAttributes - - * This function returns the attributes associated with the specified - * buffer. - */ -XdbeBackBufferAttributes *XdbeGetBackBufferAttributes( - Display *dpy, - XdbeBackBuffer buffer) -{ - XExtDisplayInfo *info = find_display(dpy); - register xDbeGetBackBufferAttributesReq *req; - xDbeGetBackBufferAttributesReply rep; - XdbeBackBufferAttributes *attr; - - DbeCheckExtension(dpy, info, (XdbeBackBufferAttributes *)NULL); - - if (!(attr = - (XdbeBackBufferAttributes *)Xmalloc(sizeof(XdbeBackBufferAttributes)))) { - return NULL; - } - - LockDisplay(dpy); - DbeGetReq(DbeGetBackBufferAttributes, req, info); - req->buffer = buffer; - - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay (dpy); - SyncHandle (); - Xfree(attr); - return NULL; - } - attr->window = rep.attributes; - - UnlockDisplay (dpy); - SyncHandle (); - - return attr; -} - +/****************************************************************************** + * + * Copyright (c) 1994, 1995 Hewlett-Packard Company + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the Hewlett-Packard + * Company shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization from the Hewlett-Packard Company. + * + * Xlib DBE code + * + *****************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include +#include + +static XExtensionInfo _dbe_info_data; +static XExtensionInfo *dbe_info = &_dbe_info_data; +static char *dbe_extension_name = DBE_PROTOCOL_NAME; + +#define DbeCheckExtension(dpy,i,val) \ + XextCheckExtension (dpy, i, dbe_extension_name, val) +#define DbeSimpleCheckExtension(dpy,i) \ + XextSimpleCheckExtension (dpy, i, dbe_extension_name) + +#if !defined(UNIXCPP) +#define DbeGetReq(name,req,info) GetReq (name, req); \ + req->reqType = info->codes->major_opcode; \ + req->dbeReqType = X_##name; +#else +#define DbeGetReq(name,req,info) GetReq (name, req); \ + req->reqType = info->codes->major_opcode; \ + req->dbeReqType = X_/**/name; +#endif + + +/***************************************************************************** + * * + * private utility routines * + * * + *****************************************************************************/ + +/* + * find_display - locate the display info block + */ +static int close_display(Display *dpy, XExtCodes *codes); +static char *error_string(Display *dpy, int code, XExtCodes *codes, + char *buf, int n); +static XExtensionHooks dbe_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 */ + error_string, /* error_string */ +}; + +static char *dbe_error_list[] = { + "BadBuffer", /* DbeBadBuffer */ +}; + +static XEXT_GENERATE_FIND_DISPLAY (find_display, dbe_info, + dbe_extension_name, + &dbe_extension_hooks, + DbeNumberEvents, NULL) + +static XEXT_GENERATE_CLOSE_DISPLAY (close_display, dbe_info) + +static XEXT_GENERATE_ERROR_STRING (error_string, dbe_extension_name, + DbeNumberErrors, + dbe_error_list) + + +/***************************************************************************** + * * + * Double-Buffering public interfaces * + * * + *****************************************************************************/ + +/* + * XdbeQueryExtension - + * Sets major_version_return and minor_verion_return to the major and + * minor DBE protocol version supported by the server. If the DBE + * library is compatible with the version returned by the server, this + * function returns non-zero. If dpy does not support the DBE + * extension, or if there was an error during communication with the + * server, or if the server and library protocol versions are + * incompatible, this functions returns zero. No other Xdbe functions + * may be called before this function. If a client violates this rule, + * the effects of all subsequent Xdbe calls are undefined. + */ +Status XdbeQueryExtension ( + Display *dpy, + int *major_version_return, + int *minor_version_return) +{ + XExtDisplayInfo *info = find_display (dpy); + xDbeGetVersionReply rep; + register xDbeGetVersionReq *req; + + if (!XextHasExtension (info)) + return (Status)0; /* failure */ + + LockDisplay (dpy); + DbeGetReq (DbeGetVersion, req, info); + req->majorVersion = DBE_MAJOR_VERSION; + req->minorVersion = DBE_MINOR_VERSION; + + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return (Status)0; /* failure */ + } + *major_version_return = rep.majorVersion; + *minor_version_return = rep.minorVersion; + UnlockDisplay (dpy); + + SyncHandle (); + + if (*major_version_return != DBE_MAJOR_VERSION) + return (Status)0; /* failure */ + else + return (Status)1; /* success */ +} + + +/* + * XdbeAllocateBackBuffer - + * This function returns a drawable ID used to refer to the back buffer + * of the specified window. The swap_action is a hint to indicate the + * swap action that will likely be used in subsequent calls to + * XdbeSwapBuffers. The actual swap action used in calls to + * XdbeSwapBuffers does not have to be the same as the swap_action + * passed to this function, though clients are encouraged to provide + * accurate information whenever possible. + */ + +XdbeBackBuffer XdbeAllocateBackBufferName( + Display *dpy, + Window window, + XdbeSwapAction swap_action) +{ + XExtDisplayInfo *info = find_display (dpy); + register xDbeAllocateBackBufferNameReq *req; + XdbeBackBuffer buffer; + + /* make sure extension is available; if not, return the + * third parameter (0). + */ + DbeCheckExtension (dpy, info, (XdbeBackBuffer)0); + + LockDisplay(dpy); + DbeGetReq(DbeAllocateBackBufferName, req, info); + req->window = window; + req->swapAction = (unsigned char)swap_action; + req->buffer = buffer = XAllocID (dpy); + + UnlockDisplay (dpy); + SyncHandle (); + return buffer; + +} /* XdbeAllocateBackBufferName() */ + +/* + * XdbeDeallocateBackBufferName - + * This function frees a drawable ID, buffer, that was obtained via + * XdbeAllocateBackBufferName. The buffer must refer to the back buffer + * of the specified window, or a protocol error results. + */ +Status XdbeDeallocateBackBufferName ( + Display *dpy, + XdbeBackBuffer buffer) +{ + XExtDisplayInfo *info = find_display (dpy); + register xDbeDeallocateBackBufferNameReq *req; + + DbeCheckExtension (dpy, info, (Status)0 /* failure */); + + LockDisplay (dpy); + DbeGetReq (DbeDeallocateBackBufferName, req, info); + req->buffer = buffer; + UnlockDisplay (dpy); + SyncHandle (); + + return (Status)1; /* success */ +} + + +/* + * XdbeSwapBuffers - + * This function swaps the front and back buffers for a list of windows. + * The argument num_windows specifies how many windows are to have their + * buffers swapped; it is the number of elements in the swap_info array. + * The argument swap_info specifies the information needed per window + * to do the swap. + */ +Status XdbeSwapBuffers ( + Display *dpy, + XdbeSwapInfo *swap_info, + int num_windows) +{ + XExtDisplayInfo *info = find_display (dpy); + register xDbeSwapBuffersReq *req; + int i; + + DbeCheckExtension (dpy, info, (Status)0 /* failure */); + + LockDisplay (dpy); + DbeGetReq (DbeSwapBuffers, req, info); + req->length += 2*num_windows; + req->n = num_windows; + + /* We need to handle 64-bit machines, where we can not use PackData32 + * directly because info would be lost in translating from 32- to 64-bit. + * Instead we send data via a loop that accounts for the translation. + */ + for (i = 0; i < num_windows; i++) + { + char tmp[4]; + Data32 (dpy, (long *)&swap_info[i].swap_window, 4); + tmp[0] = swap_info[i].swap_action; + Data (dpy, (char *)tmp, 4); + } + + UnlockDisplay (dpy); + SyncHandle (); + + + return (Status)1; /* success */ + +} /* XdbeSwapBuffers() */ + + +/* + * XdbeBeginIdiom - + * This function marks the beginning of an idiom sequence. + */ +Status XdbeBeginIdiom (Display *dpy) +{ + XExtDisplayInfo *info = find_display(dpy); + register xDbeBeginIdiomReq *req; + + DbeCheckExtension (dpy, info, (Status)0 /* failure */); + + LockDisplay (dpy); + DbeGetReq (DbeBeginIdiom, req, info); + UnlockDisplay (dpy); + SyncHandle (); + + return (Status)1; /* success */ +} + + +/* + * XdbeEndIdiom - + * This function marks the end of an idiom sequence. + */ +Status XdbeEndIdiom (Display *dpy) +{ + XExtDisplayInfo *info = find_display(dpy); + register xDbeEndIdiomReq *req; + + DbeCheckExtension (dpy, info, (Status)0 /* failure */); + + LockDisplay (dpy); + DbeGetReq (DbeEndIdiom, req, info); + UnlockDisplay (dpy); + SyncHandle (); + + return (Status)1; /* success */ +} + + +/* + * XdbeGetVisualInfo - + * This function returns information about which visuals support + * double buffering. The argument num_screens specifies how many + * elements there are in the screen_specifiers list. Each drawable + * in screen_specifiers designates a screen for which the supported + * visuals are being requested. If num_screens is zero, information + * for all screens is requested. In this case, upon return from this + * function, num_screens will be set to the number of screens that were + * found. If an error occurs, this function returns NULL, else it returns + * a pointer to a list of XdbeScreenVisualInfo structures of length + * num_screens. The nth element in the returned list corresponds to the + * nth drawable in the screen_specifiers list, unless num_screens was + * passed in with the value zero, in which case the nth element in the + * returned list corresponds to the nth screen of the server, starting + * with screen zero. + */ +XdbeScreenVisualInfo *XdbeGetVisualInfo ( + Display *dpy, + Drawable *screen_specifiers, + int *num_screens) /* SEND and RETURN */ +{ + XExtDisplayInfo *info = find_display(dpy); + register xDbeGetVisualInfoReq *req; + xDbeGetVisualInfoReply rep; + XdbeScreenVisualInfo *scrVisInfo; + int i; + + DbeCheckExtension (dpy, info, (XdbeScreenVisualInfo *)NULL); + + LockDisplay (dpy); + + DbeGetReq(DbeGetVisualInfo, req, info); + req->length = 2 + *num_screens; + req->n = *num_screens; + Data32 (dpy, screen_specifiers, (*num_screens * sizeof (CARD32))); + + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return NULL; + } + + /* return the number of screens actually found if we + * requested information about all screens (*num_screens == 0) + */ + if (*num_screens == 0) + *num_screens = rep.m; + + /* allocate list of visual information to be returned */ + if (!(scrVisInfo = + (XdbeScreenVisualInfo *)Xmalloc( + (unsigned)(*num_screens * sizeof(XdbeScreenVisualInfo))))) { + UnlockDisplay (dpy); + SyncHandle (); + return NULL; + } + + for (i = 0; i < *num_screens; i++) + { + int nbytes; + int j; + long c; + + _XRead32 (dpy, &c, sizeof(CARD32)); + scrVisInfo[i].count = c; + + nbytes = scrVisInfo[i].count * sizeof(XdbeVisualInfo); + + /* if we can not allocate the list of visual/depth info + * then free the lists that we already allocate as well + * as the visual info list itself + */ + if (!(scrVisInfo[i].visinfo = (XdbeVisualInfo *)Xmalloc( + (unsigned)nbytes))) { + for (j = 0; j < i; j++) { + Xfree ((char *)scrVisInfo[j].visinfo); + } + Xfree ((char *)scrVisInfo); + UnlockDisplay (dpy); + SyncHandle (); + return NULL; + } + + /* Read the visual info item into the wire structure. Then copy each + * element into the library structure. The element sizes and/or + * padding may be different in the two structures. + */ + for (j = 0; j < scrVisInfo[i].count; j++) { + xDbeVisInfo xvi; + + _XRead (dpy, (char *)&xvi, sizeof(xDbeVisInfo)); + scrVisInfo[i].visinfo[j].visual = xvi.visualID; + scrVisInfo[i].visinfo[j].depth = xvi.depth; + scrVisInfo[i].visinfo[j].perflevel = xvi.perfLevel; + } + + } + + UnlockDisplay (dpy); + SyncHandle (); + return scrVisInfo; + +} /* XdbeGetVisualInfo() */ + + +/* + * XdbeFreeVisualInfo - + * This function frees the list of XdbeScreenVisualInfo returned by the + * function XdbeGetVisualInfo. + */ +void XdbeFreeVisualInfo(XdbeScreenVisualInfo *visual_info) +{ + if (visual_info == NULL) { + return; + } + + if (visual_info->visinfo) { + XFree(visual_info->visinfo); + } + + XFree(visual_info); +} + + +/* + * XdbeGetBackBufferAttributes - + * This function returns the attributes associated with the specified + * buffer. + */ +XdbeBackBufferAttributes *XdbeGetBackBufferAttributes( + Display *dpy, + XdbeBackBuffer buffer) +{ + XExtDisplayInfo *info = find_display(dpy); + register xDbeGetBackBufferAttributesReq *req; + xDbeGetBackBufferAttributesReply rep; + XdbeBackBufferAttributes *attr; + + DbeCheckExtension(dpy, info, (XdbeBackBufferAttributes *)NULL); + + if (!(attr = + (XdbeBackBufferAttributes *)Xmalloc(sizeof(XdbeBackBufferAttributes)))) { + return NULL; + } + + LockDisplay(dpy); + DbeGetReq(DbeGetBackBufferAttributes, req, info); + req->buffer = buffer; + + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + Xfree(attr); + return NULL; + } + attr->window = rep.attributes; + + UnlockDisplay (dpy); + SyncHandle (); + + return attr; +} + diff --git a/libXext/src/extutil.c b/libXext/src/extutil.c index 8813c1154..361a3274d 100644 --- a/libXext/src/extutil.c +++ b/libXext/src/extutil.c @@ -1,280 +1,280 @@ -/* - * -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Jim Fulton, MIT X Consortium - * - * - * Xlib Extension-Writing Utilities - * - * This package contains utilities for writing the client API for various - * protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND - * ARE SUBJECT TO CHANGE! - * - * Routines include: - * - * XextCreateExtension called once per extension - * XextDestroyExtension if no longer using extension - * XextAddDisplay add another display - * XextRemoveDisplay remove a display - * XextFindDisplay is a display open - * - * In addition, the following Xlib-style interfaces are provided: - * - * XSetExtensionErrorHandler establish an extension error handler - * XMissingExtension raise an error about missing ext - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include - -/* defined in Xge.c */ -extern _X_HIDDEN Bool -xgeExtRegister(Display* dpy, int extension, XExtensionHooks* callbacks); - -/* - * XextCreateExtension - return an extension descriptor containing context - * information for this extension. This object is passed to all Xext - * routines. - */ -XExtensionInfo *XextCreateExtension (void) -{ - register XExtensionInfo *info = - (XExtensionInfo *) Xmalloc (sizeof (XExtensionInfo)); - - if (info) { - info->head = NULL; - info->cur = NULL; - info->ndisplays = 0; - } - return info; -} - - -/* - * XextDestroyExtension - free memory the given extension descriptor - */ -void XextDestroyExtension (XExtensionInfo *info) -{ - info->head = NULL; /* to catch refs after this */ - info->cur = NULL; - info->ndisplays = 0; - XFree ((char *) info); -} - - - -/* - * XextAddDisplay - add a display to this extension - */ -XExtDisplayInfo *XextAddDisplay ( - XExtensionInfo *extinfo, - Display *dpy, - char *ext_name, - XExtensionHooks *hooks, - int nevents, - XPointer data) -{ - XExtDisplayInfo *dpyinfo; - - dpyinfo = (XExtDisplayInfo *) Xmalloc (sizeof (XExtDisplayInfo)); - if (!dpyinfo) return NULL; - dpyinfo->display = dpy; - dpyinfo->data = data; - dpyinfo->codes = XInitExtension (dpy, ext_name); - - /* - * if the server has the extension, then we can initialize the - * appropriate function vectors - */ - if (dpyinfo->codes) { - int i, j; - - for (i = 0, j = dpyinfo->codes->first_event; i < nevents; i++, j++) { - XESetWireToEvent (dpy, j, hooks->wire_to_event); - XESetEventToWire (dpy, j, hooks->event_to_wire); - } - - /* register extension for XGE */ - if (strcmp(ext_name, GE_NAME)) - xgeExtRegister(dpy, dpyinfo->codes->major_opcode, hooks); - - if (hooks->create_gc) - XESetCreateGC (dpy, dpyinfo->codes->extension, hooks->create_gc); - if (hooks->copy_gc) - XESetCopyGC (dpy, dpyinfo->codes->extension, hooks->copy_gc); - if (hooks->flush_gc) - XESetFlushGC (dpy, dpyinfo->codes->extension, hooks->flush_gc); - if (hooks->free_gc) - XESetFreeGC (dpy, dpyinfo->codes->extension, hooks->free_gc); - if (hooks->create_font) - XESetCreateFont (dpy, dpyinfo->codes->extension, hooks->create_font); - if (hooks->free_font) - XESetFreeFont (dpy, dpyinfo->codes->extension, hooks->free_font); - if (hooks->close_display) - XESetCloseDisplay (dpy, dpyinfo->codes->extension, - hooks->close_display); - if (hooks->error) - XESetError (dpy, dpyinfo->codes->extension, hooks->error); - if (hooks->error_string) - XESetErrorString (dpy, dpyinfo->codes->extension, - hooks->error_string); - } else if (hooks->close_display) { - /* The server doesn't have this extension. - * Use a private Xlib-internal extension to hang the close_display - * hook on so that the "cache" (extinfo->cur) is properly cleaned. - * (XBUG 7955) - */ - XExtCodes *codes = XAddExtension(dpy); - if (!codes) { - XFree(dpyinfo); - return NULL; - } - XESetCloseDisplay (dpy, codes->extension, hooks->close_display); - } - - /* - * now, chain it onto the list - */ - _XLockMutex(_Xglobal_lock); - dpyinfo->next = extinfo->head; - extinfo->head = dpyinfo; - extinfo->cur = dpyinfo; - extinfo->ndisplays++; - _XUnlockMutex(_Xglobal_lock); - return dpyinfo; -} - - -/* - * XextRemoveDisplay - remove the indicated display from the extension object - */ -int XextRemoveDisplay (XExtensionInfo *extinfo, Display *dpy) -{ - XExtDisplayInfo *dpyinfo, *prev; - - /* - * locate this display and its back link so that it can be removed - */ - _XLockMutex(_Xglobal_lock); - prev = NULL; - for (dpyinfo = extinfo->head; dpyinfo; dpyinfo = dpyinfo->next) { - if (dpyinfo->display == dpy) break; - prev = dpyinfo; - } - if (!dpyinfo) { - _XUnlockMutex(_Xglobal_lock); - return 0; /* hmm, actually an error */ - } - - /* - * remove the display from the list; handles going to zero - */ - if (prev) - prev->next = dpyinfo->next; - else - extinfo->head = dpyinfo->next; - - extinfo->ndisplays--; - if (dpyinfo == extinfo->cur) extinfo->cur = NULL; /* flush cache */ - _XUnlockMutex(_Xglobal_lock); - - Xfree ((char *) dpyinfo); - return 1; -} - - -/* - * XextFindDisplay - look for a display in this extension; keeps a cache - * of the most-recently used for efficiency. - */ -XExtDisplayInfo *XextFindDisplay (XExtensionInfo *extinfo, Display *dpy) -{ - register XExtDisplayInfo *dpyinfo; - - /* - * see if this was the most recently accessed display - */ - if ((dpyinfo = extinfo->cur)&& dpyinfo->display == dpy) return dpyinfo; - - - /* - * look for display in list - */ - _XLockMutex(_Xglobal_lock); - for (dpyinfo = extinfo->head; dpyinfo; dpyinfo = dpyinfo->next) { - if (dpyinfo->display == dpy) { - extinfo->cur = dpyinfo; /* cache most recently used */ - _XUnlockMutex(_Xglobal_lock); - return dpyinfo; - } - } - _XUnlockMutex(_Xglobal_lock); - - return NULL; -} - - - -static int _default_exterror (Display *dpy, _Xconst char *ext_name, _Xconst char *reason) -{ - fprintf (stderr, "Xlib: extension \"%s\" %s on display \"%s\".\n", - ext_name, reason, DisplayString(dpy)); - return 0; -} - - -/* - * XSetExtensionErrorHandler - sets the handler that gets called when a - * requested extension is referenced. This should eventually move into Xlib. - */ - -extern XextErrorHandler _XExtensionErrorFunction; - -XextErrorHandler XSetExtensionErrorHandler (XextErrorHandler handler) -{ - XextErrorHandler oldhandler = _XExtensionErrorFunction; - - _XExtensionErrorFunction = (handler ? handler : - _default_exterror); - return oldhandler; -} - - -/* - * XMissingExtension - call the extension error handler - */ -int XMissingExtension (Display *dpy, _Xconst char *ext_name) -{ - XextErrorHandler func = (_XExtensionErrorFunction ? - _XExtensionErrorFunction : _default_exterror); - - if (!ext_name) ext_name = X_EXTENSION_UNKNOWN; - return (*func) (dpy, ext_name, X_EXTENSION_MISSING); -} +/* + * +Copyright 1989, 1998 The Open Group + +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + * + * Author: Jim Fulton, MIT X Consortium + * + * + * Xlib Extension-Writing Utilities + * + * This package contains utilities for writing the client API for various + * protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND + * ARE SUBJECT TO CHANGE! + * + * Routines include: + * + * XextCreateExtension called once per extension + * XextDestroyExtension if no longer using extension + * XextAddDisplay add another display + * XextRemoveDisplay remove a display + * XextFindDisplay is a display open + * + * In addition, the following Xlib-style interfaces are provided: + * + * XSetExtensionErrorHandler establish an extension error handler + * XMissingExtension raise an error about missing ext + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include + +/* defined in Xge.c */ +extern _X_HIDDEN Bool +xgeExtRegister(Display* dpy, int extension, XExtensionHooks* callbacks); + +/* + * XextCreateExtension - return an extension descriptor containing context + * information for this extension. This object is passed to all Xext + * routines. + */ +XExtensionInfo *XextCreateExtension (void) +{ + register XExtensionInfo *info = + (XExtensionInfo *) Xmalloc (sizeof (XExtensionInfo)); + + if (info) { + info->head = NULL; + info->cur = NULL; + info->ndisplays = 0; + } + return info; +} + + +/* + * XextDestroyExtension - free memory the given extension descriptor + */ +void XextDestroyExtension (XExtensionInfo *info) +{ + info->head = NULL; /* to catch refs after this */ + info->cur = NULL; + info->ndisplays = 0; + XFree ((char *) info); +} + + + +/* + * XextAddDisplay - add a display to this extension + */ +XExtDisplayInfo *XextAddDisplay ( + XExtensionInfo *extinfo, + Display *dpy, + char *ext_name, + XExtensionHooks *hooks, + int nevents, + XPointer data) +{ + XExtDisplayInfo *dpyinfo; + + dpyinfo = (XExtDisplayInfo *) Xmalloc (sizeof (XExtDisplayInfo)); + if (!dpyinfo) return NULL; + dpyinfo->display = dpy; + dpyinfo->data = data; + dpyinfo->codes = XInitExtension (dpy, ext_name); + + /* + * if the server has the extension, then we can initialize the + * appropriate function vectors + */ + if (dpyinfo->codes) { + int i, j; + + for (i = 0, j = dpyinfo->codes->first_event; i < nevents; i++, j++) { + XESetWireToEvent (dpy, j, hooks->wire_to_event); + XESetEventToWire (dpy, j, hooks->event_to_wire); + } + + /* register extension for XGE */ + if (strcmp(ext_name, GE_NAME)) + xgeExtRegister(dpy, dpyinfo->codes->major_opcode, hooks); + + if (hooks->create_gc) + XESetCreateGC (dpy, dpyinfo->codes->extension, hooks->create_gc); + if (hooks->copy_gc) + XESetCopyGC (dpy, dpyinfo->codes->extension, hooks->copy_gc); + if (hooks->flush_gc) + XESetFlushGC (dpy, dpyinfo->codes->extension, hooks->flush_gc); + if (hooks->free_gc) + XESetFreeGC (dpy, dpyinfo->codes->extension, hooks->free_gc); + if (hooks->create_font) + XESetCreateFont (dpy, dpyinfo->codes->extension, hooks->create_font); + if (hooks->free_font) + XESetFreeFont (dpy, dpyinfo->codes->extension, hooks->free_font); + if (hooks->close_display) + XESetCloseDisplay (dpy, dpyinfo->codes->extension, + hooks->close_display); + if (hooks->error) + XESetError (dpy, dpyinfo->codes->extension, hooks->error); + if (hooks->error_string) + XESetErrorString (dpy, dpyinfo->codes->extension, + hooks->error_string); + } else if (hooks->close_display) { + /* The server doesn't have this extension. + * Use a private Xlib-internal extension to hang the close_display + * hook on so that the "cache" (extinfo->cur) is properly cleaned. + * (XBUG 7955) + */ + XExtCodes *codes = XAddExtension(dpy); + if (!codes) { + XFree(dpyinfo); + return NULL; + } + XESetCloseDisplay (dpy, codes->extension, hooks->close_display); + } + + /* + * now, chain it onto the list + */ + _XLockMutex(_Xglobal_lock); + dpyinfo->next = extinfo->head; + extinfo->head = dpyinfo; + extinfo->cur = dpyinfo; + extinfo->ndisplays++; + _XUnlockMutex(_Xglobal_lock); + return dpyinfo; +} + + +/* + * XextRemoveDisplay - remove the indicated display from the extension object + */ +int XextRemoveDisplay (XExtensionInfo *extinfo, Display *dpy) +{ + XExtDisplayInfo *dpyinfo, *prev; + + /* + * locate this display and its back link so that it can be removed + */ + _XLockMutex(_Xglobal_lock); + prev = NULL; + for (dpyinfo = extinfo->head; dpyinfo; dpyinfo = dpyinfo->next) { + if (dpyinfo->display == dpy) break; + prev = dpyinfo; + } + if (!dpyinfo) { + _XUnlockMutex(_Xglobal_lock); + return 0; /* hmm, actually an error */ + } + + /* + * remove the display from the list; handles going to zero + */ + if (prev) + prev->next = dpyinfo->next; + else + extinfo->head = dpyinfo->next; + + extinfo->ndisplays--; + if (dpyinfo == extinfo->cur) extinfo->cur = NULL; /* flush cache */ + _XUnlockMutex(_Xglobal_lock); + + Xfree ((char *) dpyinfo); + return 1; +} + + +/* + * XextFindDisplay - look for a display in this extension; keeps a cache + * of the most-recently used for efficiency. + */ +XExtDisplayInfo *XextFindDisplay (XExtensionInfo *extinfo, Display *dpy) +{ + register XExtDisplayInfo *dpyinfo; + + /* + * see if this was the most recently accessed display + */ + if ((dpyinfo = extinfo->cur)&& dpyinfo->display == dpy) return dpyinfo; + + + /* + * look for display in list + */ + _XLockMutex(_Xglobal_lock); + for (dpyinfo = extinfo->head; dpyinfo; dpyinfo = dpyinfo->next) { + if (dpyinfo->display == dpy) { + extinfo->cur = dpyinfo; /* cache most recently used */ + _XUnlockMutex(_Xglobal_lock); + return dpyinfo; + } + } + _XUnlockMutex(_Xglobal_lock); + + return NULL; +} + + + +static int _default_exterror (Display *dpy, _Xconst char *ext_name, _Xconst char *reason) +{ + fprintf (stderr, "Xlib: extension \"%s\" %s on display \"%s\".\n", + ext_name, reason, DisplayString(dpy)); + return 0; +} + + +/* + * XSetExtensionErrorHandler - sets the handler that gets called when a + * requested extension is referenced. This should eventually move into Xlib. + */ + +extern XextErrorHandler _XExtensionErrorFunction; + +XextErrorHandler XSetExtensionErrorHandler (XextErrorHandler handler) +{ + XextErrorHandler oldhandler = _XExtensionErrorFunction; + + _XExtensionErrorFunction = (handler ? handler : + _default_exterror); + return oldhandler; +} + + +/* + * XMissingExtension - call the extension error handler + */ +int XMissingExtension (Display *dpy, _Xconst char *ext_name) +{ + XextErrorHandler func = (_XExtensionErrorFunction ? + _XExtensionErrorFunction : _default_exterror); + + if (!ext_name) ext_name = X_EXTENSION_UNKNOWN; + return (*func) (dpy, ext_name, X_EXTENSION_MISSING); +} diff --git a/libXext/src/globals.c b/libXext/src/globals.c index a40492abe..8b5923de6 100644 --- a/libXext/src/globals.c +++ b/libXext/src/globals.c @@ -1,87 +1,87 @@ -/* - -Copyright 1989, 1998 The Open Group - -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -/* - * This file should contain only those objects which must be predefined. - */ -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include /* for definition of NULL */ - -/* - * If possible, it is useful to have the global data default to a null value. - * Some shared library implementations are *much* happier if there isn't any - * global initialized data. - */ -#ifdef NULL_NOT_ZERO /* then need to initialize */ -#define SetZero(t,var,z) t var = z -#else -#define SetZero(t,var,z) t var -#endif - -#ifdef ATTSHAREDLIB /* then need extra variables */ -/* - * If we need to define extra variables for each global - */ -#if !defined(UNIXCPP) || defined(ANSICPP) -#define ZEROINIT(t,var,val) SetZero(t,var,val); \ - SetZero (long, _libX_##var##Flag, 0); \ - SetZero (void *, _libX_##var##Ptr, NULL) -#else /* else pcc concatenation */ -#define ZEROINIT(t,var,val) SetZero(t,var,val); \ - SetZero (long, _libX_/**/var/**/Flag, 0); \ - SetZero (void *, _libX_/**/var/**/Ptr, NULL) -#endif /* concat ANSI C vs. pcc */ - -#else /* else not ATTSHAREDLIB */ -/* - * no extra crud - */ -#define ZEROINIT(t,var,val) SetZero (t, var, val) - -#endif /* ATTSHAREDLIB */ - - -/* - * Error handlers; used to be in XlibInt.c - */ -ZEROINIT (XextErrorHandler, _XExtensionErrorFunction, NULL); - -/* - * NOTE: any additional external definition NEED - * to be inserted BELOW this point!!! - */ - -/* - * NOTE: any additional external definition NEED - * to be inserted ABOVE this point!!! - */ - +/* + +Copyright 1989, 1998 The Open Group + +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +/* + * This file should contain only those objects which must be predefined. + */ +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include /* for definition of NULL */ + +/* + * If possible, it is useful to have the global data default to a null value. + * Some shared library implementations are *much* happier if there isn't any + * global initialized data. + */ +#ifdef NULL_NOT_ZERO /* then need to initialize */ +#define SetZero(t,var,z) t var = z +#else +#define SetZero(t,var,z) t var +#endif + +#ifdef ATTSHAREDLIB /* then need extra variables */ +/* + * If we need to define extra variables for each global + */ +#if !defined(UNIXCPP) || defined(ANSICPP) +#define ZEROINIT(t,var,val) SetZero(t,var,val); \ + SetZero (long, _libX_##var##Flag, 0); \ + SetZero (void *, _libX_##var##Ptr, NULL) +#else /* else pcc concatenation */ +#define ZEROINIT(t,var,val) SetZero(t,var,val); \ + SetZero (long, _libX_/**/var/**/Flag, 0); \ + SetZero (void *, _libX_/**/var/**/Ptr, NULL) +#endif /* concat ANSI C vs. pcc */ + +#else /* else not ATTSHAREDLIB */ +/* + * no extra crud + */ +#define ZEROINIT(t,var,val) SetZero (t, var, val) + +#endif /* ATTSHAREDLIB */ + + +/* + * Error handlers; used to be in XlibInt.c + */ +ZEROINIT (XextErrorHandler, _XExtensionErrorFunction, NULL); + +/* + * NOTE: any additional external definition NEED + * to be inserted BELOW this point!!! + */ + +/* + * NOTE: any additional external definition NEED + * to be inserted ABOVE this point!!! + */ + -- cgit v1.2.3