This patch should be applied to an un-modified XFree86 version 4.4.0 source tree. It is patch 4 of 4 patches that will will convert the source tree to XFree86 version 4.5.0. To apply this patch, run the following from the directory containing your 'xc' directory: patch -p0 -E < XFree86-4.4.0-4.5.0.diff1 patch -p0 -E < XFree86-4.4.0-4.5.0.diff2 patch -p0 -E < XFree86-4.4.0-4.5.0.diff3 patch -p0 -E < XFree86-4.4.0-4.5.0.diff4 sh XFree86-4.4.0-4.5.0-cleanup.sh gzip -d < XFree86-4.4.0-4.5.0-diff0.tgz | tar vxf - ------------------------------------------------------------------------------- Index: xc/nls/XI18N_OBJS/Imakefile diff -u xc/nls/XI18N_OBJS/Imakefile:1.8 xc/nls/XI18N_OBJS/Imakefile:1.10 --- xc/nls/XI18N_OBJS/Imakefile:1.8 Wed Aug 6 10:04:00 2003 +++ xc/nls/XI18N_OBJS/Imakefile Mon May 31 20:16:58 2004 @@ -1,13 +1,56 @@ -XCOMM $Xorg: Imakefile,v 1.1 2000/12/12 13:00:42 coskrey Exp $ - - - - -XCOMM $XFree86: xc/nls/XI18N_OBJS/Imakefile,v 1.8 2003/08/06 14:04:00 eich Exp $ +XCOMM $XFree86: xc/nls/XI18N_OBJS/Imakefile,v 1.10 2004/06/01 00:16:58 dawes Exp $ +/* + * Copyright (c) 1994-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #ifndef Win32Architecture # define XI18NTarget(name) @@\ -all:: name @@\ +AllTarget($(BUILDLIBDIR)/locale/name/XI18N_OBJS) @@\ + @@\ +$(BUILDLIBDIR)/locale/name/XI18N_OBJS: name @@\ MakeDir($(BUILDLIBDIR)/locale/name) @@\ RemoveFile($(BUILDLIBDIR)/locale/name/XI18N_OBJS) @@\ cd $(BUILDLIBDIR)/locale/name && $(LN) $(BUILDLIBTOP)/../../$(CURRENT_DIR)/name XI18N_OBJS @@\ Index: xc/nls/XLC_LOCALE/Imakefile diff -u xc/nls/XLC_LOCALE/Imakefile:1.26 xc/nls/XLC_LOCALE/Imakefile:1.30 --- xc/nls/XLC_LOCALE/Imakefile:1.26 Wed Aug 6 10:04:00 2003 +++ xc/nls/XLC_LOCALE/Imakefile Thu Jan 27 11:01:37 2005 @@ -1,35 +1,102 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:59 cpqbld Exp $ - - - -XCOMM $XFree86: xc/nls/XLC_LOCALE/Imakefile,v 1.26 2003/08/06 14:04:00 eich Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/Imakefile,v 1.30 2005/01/27 16:01:37 tsi Exp $ +/* + * Copyright (c) 1994-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ WCHAR32 = HasWChar32 -#ifndef Win32Architecture +#ifdef Win32Architecture # define LTarget(name) @@\ all:: name.lt @@\ @@\ CppFileTarget(name.lt,name,-DWCHAR32=$(WCHAR32),NullParameter) @@\ @@\ all:: name.lt @@\ - MakeDir($(BUILDLIBDIR)/locale/name) @@\ - RemoveFile($(BUILDLIBDIR)/locale/name/XLC_LOCALE) @@\ - cd $(BUILDLIBDIR)/locale/name && $(LN) $(BUILDLIBTOP)/../../$(CURRENT_DIR)/name.lt XLC_LOCALE @@\ + MakeDir(Concat($(BUILDLIBDIR:/=\)\locale\,name)) @@\ + RemoveFile(Concat($(BUILDLIBDIR:/=\)\locale\,name\XLC_LOCALE)) @@\ + cd Concat($(BUILDLIBDIR:/=\)\locale\,name) && \ @@\ + $(LN) Concat($(BUILDLIBTOP:/=\)\..\..\$(CURRENT_DIR:/=\)\,name.lt) XLC_LOCALE @@\ @@\ InstallNamedNonExec(name.lt,XLC_LOCALE,$(XLOCALEDIR)/name) #else -# define LTarget(name) @@\ -all:: name.lt @@\ +# if defined(SGIArchitecture) && (!defined(HasGcc) || !HasGcc) +# define LTarget(name) @@\ +AllTarget(name.lt) @@\ + @@\ +name.lt: name @@\ + RemoveFile($@) @@\ + $(CPP) CppNoLineInfoOption -DWCHAR32=$(WCHAR32) name | \ @@\ + CppSedMagic >$@ @@\ + MakeDir($(BUILDLIBDIR)/locale/name) @@\ + RemoveFile($(BUILDLIBDIR)/locale/name/XLC_LOCALE) @@\ + cd $(BUILDLIBDIR)/locale/name && \ @@\ + $(LN) $(BUILDLIBTOP)/../../$(CURRENT_DIR)/name.lt XLC_LOCALE @@\ @@\ -CppFileTarget(name.lt,name,-DWCHAR32=$(WCHAR32),NullParameter) @@\ +clean:: @@\ + RemoveFile(name.lt) @@\ @@\ -all:: name.lt @@\ - MakeDir(Concat($(BUILDLIBDIR:/=\)\locale\,name)) @@\ - RemoveFile(Concat($(BUILDLIBDIR:/=\)\locale\,name\XLC_LOCALE)) @@\ - cd Concat($(BUILDLIBDIR:/=\)\locale\,name) && $(LN) Concat($(BUILDLIBTOP:/=\)\..\..\$(CURRENT_DIR:/=\)\,name.lt) XLC_LOCALE @@\ +InstallNamedNonExec(name.lt,XLC_LOCALE,$(XLOCALEDIR)/name) +# else +# define LTarget(name) @@\ +AllTarget(name.lt) @@\ + @@\ +name.lt: name @@\ + RemoveFile($@) @@\ + $(CPP) CppNoLineInfoOption -DWCHAR32=$(WCHAR32) $@ @@\ + MakeDir($(BUILDLIBDIR)/locale/name) @@\ + RemoveFile($(BUILDLIBDIR)/locale/name/XLC_LOCALE) @@\ + cd $(BUILDLIBDIR)/locale/name && \ @@\ + $(LN) $(BUILDLIBTOP)/../../$(CURRENT_DIR)/name.lt XLC_LOCALE @@\ + @@\ +clean:: @@\ + RemoveFile(name.lt) @@\ @@\ InstallNamedNonExec(name.lt,XLC_LOCALE,$(XLOCALEDIR)/name) +# endif #endif LTarget(C) Index: xc/nls/XLC_LOCALE/armscii-8 diff -u xc/nls/XLC_LOCALE/armscii-8:1.2 xc/nls/XLC_LOCALE/armscii-8:1.3 --- xc/nls/XLC_LOCALE/armscii-8:1.2 Fri Dec 1 12:43:02 2000 +++ xc/nls/XLC_LOCALE/armscii-8 Wed Feb 2 09:33:23 2005 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/armscii-8,v 1.2 2000/12/01 17:43:02 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/armscii-8,v 1.3 2005/02/02 14:33:23 pascal Exp $ XCOMM XLocale Database Sample for armscii-8. XCOMM @@ -21,6 +21,11 @@ charset ARMSCII-8:GR font ARMSCII-8:GR } +XCOMM fs2 class +fs2 { + charset ARMSCII-8:GL + font ARMSCII-8:GL +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/georgian-academy diff -u xc/nls/XLC_LOCALE/georgian-academy:1.2 xc/nls/XLC_LOCALE/georgian-academy:1.3 --- xc/nls/XLC_LOCALE/georgian-academy:1.2 Fri Dec 1 12:43:02 2000 +++ xc/nls/XLC_LOCALE/georgian-academy Wed Feb 2 09:33:23 2005 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/georgian-academy,v 1.2 2000/12/01 17:43:02 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/georgian-academy,v 1.3 2005/02/02 14:33:23 pascal Exp $ XCOMM XLocale Database Sample for georgian-academy XCOMM @@ -21,6 +21,11 @@ charset GEORGIAN-ACADEMY:GR font GEORGIAN-ACADEMY:GR } +XCOMM fs2 class +fs2 { + charset GEORGIAN-ACADEMY:GL + font GEORGIAN-ACADEMY:GL +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/georgian-ps diff -u xc/nls/XLC_LOCALE/georgian-ps:1.2 xc/nls/XLC_LOCALE/georgian-ps:1.3 --- xc/nls/XLC_LOCALE/georgian-ps:1.2 Fri Dec 1 12:43:02 2000 +++ xc/nls/XLC_LOCALE/georgian-ps Wed Feb 2 09:33:23 2005 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/georgian-ps,v 1.2 2000/12/01 17:43:02 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/georgian-ps,v 1.3 2005/02/02 14:33:23 pascal Exp $ XCOMM XLocale Database Sample for georgian-ps XCOMM @@ -21,6 +21,11 @@ charset GEORGIAN-PS:GR font GEORGIAN-PS:GR } +XCOMM fs2 class +fs2 { + charset GEORGIAN-PS:GL + font GEORGIAN-PS:GL +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/ibm-cp1133 diff -u xc/nls/XLC_LOCALE/ibm-cp1133:1.2 xc/nls/XLC_LOCALE/ibm-cp1133:1.3 --- xc/nls/XLC_LOCALE/ibm-cp1133:1.2 Fri Dec 1 12:43:03 2000 +++ xc/nls/XLC_LOCALE/ibm-cp1133 Wed Feb 2 09:33:23 2005 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/ibm-cp1133,v 1.2 2000/12/01 17:43:03 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/ibm-cp1133,v 1.3 2005/02/02 14:33:23 pascal Exp $ XCOMM XLocale Database Sample for ibm-cp1133. XCOMM @@ -21,6 +21,11 @@ charset IBM-CP1133:GR font IBM-CP1133:GR } +XCOMM fs2 class +fs2 { + charset IBM-CP1133:GL + font IBM-CP1133:GL +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/iscii-dev diff -u xc/nls/XLC_LOCALE/iscii-dev:1.2 xc/nls/XLC_LOCALE/iscii-dev:1.3 --- xc/nls/XLC_LOCALE/iscii-dev:1.2 Fri Dec 1 12:43:03 2000 +++ xc/nls/XLC_LOCALE/iscii-dev Wed Feb 2 09:33:23 2005 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/iscii-dev,v 1.2 2000/12/01 17:43:03 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/iscii-dev,v 1.3 2005/02/02 14:33:23 pascal Exp $ XCOMM XLocale Database Sample for mulelao-1. XCOMM @@ -21,6 +21,11 @@ charset ISCII-DEV:GR font ISCII-DEV:GR } +XCOMM fs2 class +fs2 { + charset ISCII-DEV:GL + font ISCII-DEV:GL +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/isiri-3342 diff -u xc/nls/XLC_LOCALE/isiri-3342:1.2 xc/nls/XLC_LOCALE/isiri-3342:1.3 --- xc/nls/XLC_LOCALE/isiri-3342:1.2 Fri Dec 1 12:43:03 2000 +++ xc/nls/XLC_LOCALE/isiri-3342 Wed Feb 2 09:33:23 2005 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/isiri-3342,v 1.2 2000/12/01 17:43:03 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/isiri-3342,v 1.3 2005/02/02 14:33:23 pascal Exp $ XCOMM XLocale Database Sample for mulelao-1. XCOMM @@ -21,6 +21,11 @@ charset ISIRI-3342:GR font ISIRI-3342:GR } +XCOMM fs2 class +fs2 { + charset ISIRI-3342:GL + font ISIRI-3342:GL +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/iso8859-10 diff -u xc/nls/XLC_LOCALE/iso8859-10:1.2 xc/nls/XLC_LOCALE/iso8859-10:1.3 --- xc/nls/XLC_LOCALE/iso8859-10:1.2 Wed Jan 17 14:37:05 2001 +++ xc/nls/XLC_LOCALE/iso8859-10 Wed Feb 2 09:33:23 2005 @@ -26,6 +26,15 @@ primary ISO8859-10:GR } } +XCOMM fs2 class +fs2 { + charset { + name ISO8859-10:GL + } + font { + primary ISO8859-10:GL + } +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/iso8859-11 diff -u xc/nls/XLC_LOCALE/iso8859-11:1.1 xc/nls/XLC_LOCALE/iso8859-11:1.2 --- xc/nls/XLC_LOCALE/iso8859-11:1.1 Tue Oct 8 19:31:42 2002 +++ xc/nls/XLC_LOCALE/iso8859-11 Wed Feb 2 09:33:23 2005 @@ -1,7 +1,7 @@ XCOMM XLocale Database Sample for iso8859-11. XCOMM XCOMM Id: xf-cvs20020709-iso8859_11locale.patch,v 1.1 2002/07/09 12:24:01 thep Exp -XCOMM $XFree86: xc/nls/XLC_LOCALE/iso8859-11,v 1.1 2002/10/08 23:31:42 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/iso8859-11,v 1.2 2005/02/02 14:33:23 pascal Exp $ XCOMM XCOMM XLC_FONTSET category @@ -27,6 +27,15 @@ primary ISO8859-11:GR } } +XCOMM fs2 class +fs2 { + charset { + name ISO8859-11:GL + } + font { + primary ISO8859-11:GL + } +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/iso8859-13 diff -u xc/nls/XLC_LOCALE/iso8859-13:1.1 xc/nls/XLC_LOCALE/iso8859-13:1.2 --- xc/nls/XLC_LOCALE/iso8859-13:1.1 Fri Oct 27 14:30:56 2000 +++ xc/nls/XLC_LOCALE/iso8859-13 Wed Feb 2 09:33:23 2005 @@ -1,7 +1,7 @@ XCOMM $TOG: iso8859-13 /main/1 1998/05/20 13:49:21 kaleb $ XCOMM XLocale Database Sample for iso8859-13. XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/iso8859-13,v 1.1 2000/10/27 18:30:56 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/iso8859-13,v 1.2 2005/02/02 14:33:23 pascal Exp $ XCOMM XCOMM XLC_FONTSET category @@ -27,6 +27,15 @@ primary ISO8859-13:GR } } +XCOMM fs2 class +fs2 { + charset { + name ISO8859-13:GL + } + font { + primary ISO8859-13:GL + } +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/iso8859-14 diff -u xc/nls/XLC_LOCALE/iso8859-14:1.1 xc/nls/XLC_LOCALE/iso8859-14:1.2 --- xc/nls/XLC_LOCALE/iso8859-14:1.1 Sun Jun 6 10:05:59 1999 +++ xc/nls/XLC_LOCALE/iso8859-14 Wed Feb 2 09:33:23 2005 @@ -1,7 +1,7 @@ XCOMM $TOG: iso8859-14 /main/1 1998/05/20 14:49:21 kaleb $ XCOMM XLocale Database Sample for iso8859-14. XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/iso8859-14,v 1.1 1999/06/06 14:05:59 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/iso8859-14,v 1.2 2005/02/02 14:33:23 pascal Exp $ XCOMM XCOMM XLC_FONTSET category @@ -27,6 +27,15 @@ primary ISO8859-14:GR } } +XCOMM fs2 class +fs2 { + charset { + name ISO8859-14:GL + } + font { + primary ISO8859-14:GL + } +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/iso8859-15 diff -u xc/nls/XLC_LOCALE/iso8859-15:1.3 xc/nls/XLC_LOCALE/iso8859-15:1.6 --- xc/nls/XLC_LOCALE/iso8859-15:1.3 Sun Oct 25 07:47:53 1998 +++ xc/nls/XLC_LOCALE/iso8859-15 Wed Feb 2 09:33:23 2005 @@ -6,7 +6,7 @@ XCOMM (a.k.a. Latin-0) character set so that Europeans who want XCOMM the Euro currency character can do so. XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/iso8859-15,v 1.3 1998/10/25 12:47:53 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/iso8859-15,v 1.6 2005/02/02 14:33:23 pascal Exp $ XCOMM XCOMM @@ -20,7 +20,7 @@ } font { primary ISO8859-15:GL - substitute ISO8859-15:GL + substitute ISO8859-1:GL vertical_rotate all } } @@ -33,6 +33,15 @@ primary ISO8859-15:GR } } +XCOMM fs2 class +fs2 { + charset { + name ISO8859-15:GL + } + font { + primary ISO8859-15:GL + } +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/iso8859-2 diff -u xc/nls/XLC_LOCALE/iso8859-2:1.1.1.2 xc/nls/XLC_LOCALE/iso8859-2:1.2 --- xc/nls/XLC_LOCALE/iso8859-2:1.1.1.2 Tue Jan 16 17:28:47 2001 +++ xc/nls/XLC_LOCALE/iso8859-2 Wed Feb 2 09:33:23 2005 @@ -26,6 +26,15 @@ primary ISO8859-2:GR } } +XCOMM fs2 class +fs2 { + charset { + name ISO8859-2:GL + } + font { + primary ISO8859-2:GL + } +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/iso8859-3 diff -u xc/nls/XLC_LOCALE/iso8859-3:1.1.1.2 xc/nls/XLC_LOCALE/iso8859-3:1.2 --- xc/nls/XLC_LOCALE/iso8859-3:1.1.1.2 Tue Jan 16 17:28:49 2001 +++ xc/nls/XLC_LOCALE/iso8859-3 Wed Feb 2 09:33:23 2005 @@ -26,6 +26,15 @@ primary ISO8859-3:GR } } +XCOMM fs2 class +fs2 { + charset { + name ISO8859-3:GL + } + font { + primary ISO8859-3:GL + } +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/iso8859-4 diff -u xc/nls/XLC_LOCALE/iso8859-4:1.1.1.2 xc/nls/XLC_LOCALE/iso8859-4:1.2 --- xc/nls/XLC_LOCALE/iso8859-4:1.1.1.2 Tue Jan 16 17:28:50 2001 +++ xc/nls/XLC_LOCALE/iso8859-4 Wed Feb 2 09:33:23 2005 @@ -26,6 +26,15 @@ primary ISO8859-4:GR } } +XCOMM fs2 class +fs2 { + charset { + name ISO8859-4:GL + } + font { + primary ISO8859-4:GL + } +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/iso8859-5 diff -u xc/nls/XLC_LOCALE/iso8859-5:1.1.1.2 xc/nls/XLC_LOCALE/iso8859-5:1.2 --- xc/nls/XLC_LOCALE/iso8859-5:1.1.1.2 Tue Jan 16 17:28:51 2001 +++ xc/nls/XLC_LOCALE/iso8859-5 Wed Feb 2 09:33:23 2005 @@ -26,6 +26,15 @@ primary ISO8859-5:GR } } +XCOMM fs2 class +fs2 { + charset { + name ISO8859-5:GL + } + font { + primary ISO8859-5:GL + } +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/iso8859-6 diff -u xc/nls/XLC_LOCALE/iso8859-6:1.1.1.2 xc/nls/XLC_LOCALE/iso8859-6:1.2 --- xc/nls/XLC_LOCALE/iso8859-6:1.1.1.2 Tue Jan 16 17:28:52 2001 +++ xc/nls/XLC_LOCALE/iso8859-6 Wed Feb 2 09:33:23 2005 @@ -26,6 +26,15 @@ primary ISO8859-6:GR } } +XCOMM fs2 class +fs2 { + charset { + name ISO8859-6:GL + } + font { + primary ISO8859-6:GL + } +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/iso8859-7 diff -u xc/nls/XLC_LOCALE/iso8859-7:1.1.1.2 xc/nls/XLC_LOCALE/iso8859-7:1.2 --- xc/nls/XLC_LOCALE/iso8859-7:1.1.1.2 Tue Jan 16 17:28:53 2001 +++ xc/nls/XLC_LOCALE/iso8859-7 Wed Feb 2 09:33:23 2005 @@ -26,6 +26,15 @@ primary ISO8859-7:GR } } +XCOMM fs2 class +fs2 { + charset { + name ISO8859-7:GL + } + font { + primary ISO8859-7:GL + } +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/iso8859-8 diff -u xc/nls/XLC_LOCALE/iso8859-8:1.1.1.2 xc/nls/XLC_LOCALE/iso8859-8:1.2 --- xc/nls/XLC_LOCALE/iso8859-8:1.1.1.2 Tue Jan 16 17:28:54 2001 +++ xc/nls/XLC_LOCALE/iso8859-8 Wed Feb 2 09:33:23 2005 @@ -26,6 +26,15 @@ primary ISO8859-8:GR } } +XCOMM fs2 class +fs2 { + charset { + name ISO8859-8:GL + } + font { + primary ISO8859-8:GL + } +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/iso8859-9 diff -u xc/nls/XLC_LOCALE/iso8859-9:1.1.1.2 xc/nls/XLC_LOCALE/iso8859-9:1.2 --- xc/nls/XLC_LOCALE/iso8859-9:1.1.1.2 Tue Jan 16 17:28:54 2001 +++ xc/nls/XLC_LOCALE/iso8859-9 Wed Feb 2 09:33:23 2005 @@ -26,6 +26,15 @@ primary ISO8859-9:GR } } +XCOMM fs2 class +fs2 { + charset { + name ISO8859-9:GL + } + font { + primary ISO8859-9:GL + } +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/iso8859-9e diff -u xc/nls/XLC_LOCALE/iso8859-9e:1.3 xc/nls/XLC_LOCALE/iso8859-9e:1.4 --- xc/nls/XLC_LOCALE/iso8859-9e:1.3 Fri Dec 1 12:43:03 2000 +++ xc/nls/XLC_LOCALE/iso8859-9e Wed Feb 2 09:33:23 2005 @@ -1,7 +1,7 @@ XCOMM $XConsortium: iso8859-9e /main/7 1996/09/28 16:51:50 rws $ XCOMM XLocale Database Sample for iso8859-9e. XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/iso8859-9e,v 1.3 2000/12/01 17:43:03 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/iso8859-9e,v 1.4 2005/02/02 14:33:23 pascal Exp $ XCOMM XCOMM XLC_FONTSET category @@ -27,6 +27,15 @@ primary ISO8859-9E:GR } } +XCOMM fs2 class +fs2 { + charset { + name ISO8859-9E:GL + } + font { + primary ISO8859-9E:GL + } +} END XLC_FONTSET XCOMM XCOMM XLC_CHARSET_DEFINE category Index: xc/nls/XLC_LOCALE/koi8-c diff -u xc/nls/XLC_LOCALE/koi8-c:1.2 xc/nls/XLC_LOCALE/koi8-c:1.3 --- xc/nls/XLC_LOCALE/koi8-c:1.2 Fri Dec 1 12:43:03 2000 +++ xc/nls/XLC_LOCALE/koi8-c Wed Feb 2 09:33:23 2005 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/koi8-c,v 1.2 2000/12/01 17:43:03 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/koi8-c,v 1.3 2005/02/02 14:33:23 pascal Exp $ XCOMM XLocale Database Sample for koi8-c. XCOMM @@ -21,6 +21,11 @@ charset KOI8-C:GR font KOI8-C:GR } +XCOMM fs2 class +fs2 { + charset KOI8-C:GL + font KOI8-C:GL +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/koi8-r diff -u xc/nls/XLC_LOCALE/koi8-r:3.4 xc/nls/XLC_LOCALE/koi8-r:3.5 --- xc/nls/XLC_LOCALE/koi8-r:3.4 Wed Jan 17 14:37:05 2001 +++ xc/nls/XLC_LOCALE/koi8-r Wed Feb 2 09:33:23 2005 @@ -2,7 +2,7 @@ XCOMM XLocale Database Sample for koi8-r. XCOMM XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/koi8-r,v 3.4 2001/01/17 19:37:05 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/koi8-r,v 3.5 2005/02/02 14:33:23 pascal Exp $ XCOMM XCOMM XLC_FONTSET category @@ -23,6 +23,11 @@ charset KOI8-R:GR font KOI8-R:GR } +XCOMM fs2 class +fs2 { + charset KOI8-R:GL + font KOI8-R:GL +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/koi8-u diff -u xc/nls/XLC_LOCALE/koi8-u:1.2 xc/nls/XLC_LOCALE/koi8-u:1.3 --- xc/nls/XLC_LOCALE/koi8-u:1.2 Fri Dec 1 12:43:03 2000 +++ xc/nls/XLC_LOCALE/koi8-u Wed Feb 2 09:33:23 2005 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/koi8-u,v 1.2 2000/12/01 17:43:03 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/koi8-u,v 1.3 2005/02/02 14:33:23 pascal Exp $ XCOMM XLocale Database Sample for koi8-u. XCOMM @@ -21,6 +21,11 @@ charset KOI8-U:GR font KOI8-U:GR } +XCOMM fs2 class +fs2 { + charset KOI8-U:GL + font KOI8-U:GL +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/microsoft-cp1251 diff -u xc/nls/XLC_LOCALE/microsoft-cp1251:1.2 xc/nls/XLC_LOCALE/microsoft-cp1251:1.3 --- xc/nls/XLC_LOCALE/microsoft-cp1251:1.2 Fri Dec 1 12:43:03 2000 +++ xc/nls/XLC_LOCALE/microsoft-cp1251 Wed Feb 2 09:33:23 2005 @@ -1,7 +1,7 @@ XCOMM $TOG: microsoft-cp1251 /main/1 1998/05/20 14:49:21 kaleb $ XCOMM XLocale Database Sample for microsoft-cp1251. XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/microsoft-cp1251,v 1.2 2000/12/01 17:43:03 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/microsoft-cp1251,v 1.3 2005/02/02 14:33:23 pascal Exp $ XCOMM XCOMM XLC_FONTSET category @@ -27,6 +27,15 @@ primary MICROSOFT-CP1251:GR } } +XCOMM fs2 class +fs2 { + charset { + name MICROSOFT-CP1251:GL + } + font { + primary MICROSOFT-CP1251:GL + } +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/microsoft-cp1255 diff -u xc/nls/XLC_LOCALE/microsoft-cp1255:1.2 xc/nls/XLC_LOCALE/microsoft-cp1255:1.3 --- xc/nls/XLC_LOCALE/microsoft-cp1255:1.2 Fri Dec 1 12:43:03 2000 +++ xc/nls/XLC_LOCALE/microsoft-cp1255 Wed Feb 2 09:33:23 2005 @@ -1,7 +1,7 @@ XCOMM $TOG: microsoft-cp1255 /main/1 1998/05/20 14:49:21 kaleb $ XCOMM XLocale Database Sample for microsoft-cp1255. XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/microsoft-cp1255,v 1.2 2000/12/01 17:43:03 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/microsoft-cp1255,v 1.3 2005/02/02 14:33:23 pascal Exp $ XCOMM XCOMM XLC_FONTSET category @@ -27,6 +27,15 @@ primary MICROSOFT-CP1255:GR } } +XCOMM fs2 class +fs2 { + charset { + name MICROSOFT-CP1255:GL + } + font { + primary MICROSOFT-CP1255:GL + } +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/microsoft-cp1256 diff -u xc/nls/XLC_LOCALE/microsoft-cp1256:1.2 xc/nls/XLC_LOCALE/microsoft-cp1256:1.3 --- xc/nls/XLC_LOCALE/microsoft-cp1256:1.2 Fri Dec 1 12:43:03 2000 +++ xc/nls/XLC_LOCALE/microsoft-cp1256 Wed Feb 2 09:33:23 2005 @@ -1,7 +1,7 @@ XCOMM $TOG: microsoft-cp1256 /main/1 1998/05/20 14:49:21 kaleb $ XCOMM XLocale Database Sample for microsoft-cp1256. XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/microsoft-cp1256,v 1.2 2000/12/01 17:43:03 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/microsoft-cp1256,v 1.3 2005/02/02 14:33:23 pascal Exp $ XCOMM XCOMM XLC_FONTSET category @@ -27,6 +27,15 @@ primary MICROSOFT-CP1256:GR } } +XCOMM fs2 class +fs2 { + charset { + name MICROSOFT-CP1256:GL + } + font { + primary MICROSOFT-CP1256:GL + } +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/mulelao-1 diff -u xc/nls/XLC_LOCALE/mulelao-1:1.2 xc/nls/XLC_LOCALE/mulelao-1:1.3 --- xc/nls/XLC_LOCALE/mulelao-1:1.2 Fri Dec 1 12:43:03 2000 +++ xc/nls/XLC_LOCALE/mulelao-1 Wed Feb 2 09:33:23 2005 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/mulelao-1,v 1.2 2000/12/01 17:43:03 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/mulelao-1,v 1.3 2005/02/02 14:33:23 pascal Exp $ XCOMM XLocale Database Sample for mulelao-1. XCOMM @@ -21,6 +21,11 @@ charset MULELAO-1:GR font MULELAO-1:GR } +XCOMM fs2 class +fs2 { + charset MULELAO-1:GL + font MULELAO-1:GL +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/nokhchi-1 diff -u xc/nls/XLC_LOCALE/nokhchi-1:1.2 xc/nls/XLC_LOCALE/nokhchi-1:1.3 --- xc/nls/XLC_LOCALE/nokhchi-1:1.2 Fri Dec 1 12:43:03 2000 +++ xc/nls/XLC_LOCALE/nokhchi-1 Wed Feb 2 09:33:23 2005 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/nokhchi-1,v 1.2 2000/12/01 17:43:03 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/nokhchi-1,v 1.3 2005/02/02 14:33:23 pascal Exp $ XCOMM XLocale Database Sample for mulelao-1. XCOMM @@ -21,6 +21,11 @@ charset NOKHCHI-1:GR font NOKHCHI-1:GR } +XCOMM fs2 class +fs2 { + charset NOKHCHI-1:GL + font NOKHCHI-1:GL +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/tatar-cyr diff -u xc/nls/XLC_LOCALE/tatar-cyr:1.2 xc/nls/XLC_LOCALE/tatar-cyr:1.3 --- xc/nls/XLC_LOCALE/tatar-cyr:1.2 Fri Dec 1 12:43:03 2000 +++ xc/nls/XLC_LOCALE/tatar-cyr Wed Feb 2 09:33:23 2005 @@ -1,7 +1,7 @@ XCOMM $TOG: tatar-cyr /main/1 1998/05/20 14:49:21 kaleb $ XCOMM XLocale Database Sample for tatar-cyr. XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/tatar-cyr,v 1.2 2000/12/01 17:43:03 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/tatar-cyr,v 1.3 2005/02/02 14:33:23 pascal Exp $ XCOMM XCOMM XLC_FONTSET category @@ -27,6 +27,15 @@ primary TATAR-CYR:GR } } +XCOMM fs2 class +fs2 { + charset { + name TATAR-CYR:GL + } + font { + primary TATAR-CYR:GL + } +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/tscii-0 diff -u xc/nls/XLC_LOCALE/tscii-0:1.2 xc/nls/XLC_LOCALE/tscii-0:1.3 --- xc/nls/XLC_LOCALE/tscii-0:1.2 Fri Dec 1 12:43:03 2000 +++ xc/nls/XLC_LOCALE/tscii-0 Wed Feb 2 09:33:23 2005 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/nls/XLC_LOCALE/tscii-0,v 1.2 2000/12/01 17:43:03 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/tscii-0,v 1.3 2005/02/02 14:33:23 pascal Exp $ XCOMM XLocale Database Sample for mulelao-1. XCOMM @@ -21,6 +21,11 @@ charset TSCII-0:GR font TSCII-0:GR } +XCOMM fs2 class +fs2 { + charset TSCII-0:GL + font TSCII-0:GL +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/vi_VN.tcvn diff -u xc/nls/XLC_LOCALE/vi_VN.tcvn:1.2 xc/nls/XLC_LOCALE/vi_VN.tcvn:1.3 --- xc/nls/XLC_LOCALE/vi_VN.tcvn:1.2 Fri Dec 1 12:43:03 2000 +++ xc/nls/XLC_LOCALE/vi_VN.tcvn Wed Feb 2 09:33:23 2005 @@ -1,6 +1,6 @@ XCOMM XLocale Database Sample for vi_VN.TCVN XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/vi_VN.tcvn,v 1.2 2000/12/01 17:43:03 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/vi_VN.tcvn,v 1.3 2005/02/02 14:33:23 pascal Exp $ XCOMM XCOMM XLC_FONTSET category @@ -21,6 +21,11 @@ charset TCVN-5712:GR font TCVN-5712:GR } +XCOMM fs2 class +fs2 { + charset TCVN-5712:GL + font TCVN-5712:GL +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/vi_VN.viscii diff -u xc/nls/XLC_LOCALE/vi_VN.viscii:1.2 xc/nls/XLC_LOCALE/vi_VN.viscii:1.3 --- xc/nls/XLC_LOCALE/vi_VN.viscii:1.2 Fri Dec 1 12:43:03 2000 +++ xc/nls/XLC_LOCALE/vi_VN.viscii Wed Feb 2 09:33:23 2005 @@ -1,6 +1,6 @@ XCOMM XLocale Database Sample for vi_VN.VISCII XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/vi_VN.viscii,v 1.2 2000/12/01 17:43:03 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/vi_VN.viscii,v 1.3 2005/02/02 14:33:23 pascal Exp $ XCOMM XCOMM XLC_FONTSET category @@ -21,6 +21,11 @@ charset VISCII1.1-1:GR font VISCII1.1-1:GR } +XCOMM fs2 class +fs2 { + charset VISCII1.1-1:GL + font VISCII1.1-1:GL +} END XLC_FONTSET XCOMM Index: xc/nls/XLC_LOCALE/zh_CN.gbk diff -u xc/nls/XLC_LOCALE/zh_CN.gbk:1.1 xc/nls/XLC_LOCALE/zh_CN.gbk:1.2 --- xc/nls/XLC_LOCALE/zh_CN.gbk:1.1 Tue Mar 6 13:03:18 2001 +++ xc/nls/XLC_LOCALE/zh_CN.gbk Sat May 8 02:14:47 2004 @@ -3,7 +3,7 @@ XCOMM modified from xc/nls/XLC_LOCALE/zh_TW.Big5 XCOMM by Sean Chen XCOMM -XCOMM $XFree86: xc/nls/XLC_LOCALE/zh_CN.gbk,v 1.1 2001/03/06 18:03:18 dawes Exp $ +XCOMM $XFree86: xc/nls/XLC_LOCALE/zh_CN.gbk,v 1.2 2004/05/08 06:14:47 pascal Exp $ XCOMM XCOMM XLC_FONTSET category @@ -62,7 +62,7 @@ byte2 \x40,\x7e;\x80,\xfe wc_encoding \x00008000 - ct_encoding GBK-0:GLGR:\x1b\x25\x2f\x32\x80\x88\x47\x42\x4b\x2d\x30\x02 + ct_encoding GBK-0:GLGR:\x1b\x25\x2f\x32 mb_conversion [\x8140,\xfefe]->\x0140 ct_conversion [\x0140,\x7efe]->\x8140 Index: xc/programs/Imakefile diff -u xc/programs/Imakefile:3.56 xc/programs/Imakefile:3.58 --- xc/programs/Imakefile:3.56 Fri Jun 20 11:49:50 2003 +++ xc/programs/Imakefile Sun Feb 27 23:14:32 2005 @@ -1,10 +1,8 @@ -XCOMM $Xorg: Imakefile,v 1.4 2000/08/17 19:47:01 cpqbld Exp $ - - - -XCOMM $XFree86: xc/programs/Imakefile,v 3.56 2003/06/20 15:49:50 eich Exp $ +XCOMM $XFree86: xc/programs/Imakefile,v 3.58 2005/02/28 04:14:32 dawes Exp $ +#if BuildServer || BuildClients #define IHaveSubdirs +#endif #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" #if BuildServer || UseRgbTxt @@ -32,9 +30,6 @@ #if BuildXF86DGALibrary XF86DGASRCDIR = xf86dga #endif -#if BuildXAServer - XASSRCDIR = Xaserver -#endif #if BuildLBX LBXPROXYSRCDIR = lbxproxy #endif @@ -133,9 +128,11 @@ xsetroot $(XSMSRCDIR) xstdcmap $(XINPUTCLIENTDIRS) \ $(XTERMSRCDIR) $(XTRAPCLIENTDIRS) $(XVIDTUNESRCDIR) xwd xwininfo xwud \ $(XPMCLIENTDIRS) $(XVINFOSRCDIR) \ - $(XSSRCDIR) $(XASSRCDIR) $(LBXPROXYSRCDIR) $(SCRIPTSDIR) \ + $(XSSRCDIR) $(LBXPROXYSRCDIR) $(SCRIPTSDIR) \ $(GLXCLIENTDIRS) $(XRANDRDIR) $(XCURSORGENDIR) #endif +#ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) +#endif Index: xc/programs/Xserver/Imakefile diff -u xc/programs/Xserver/Imakefile:3.297 xc/programs/Xserver/Imakefile:3.310 --- xc/programs/Xserver/Imakefile:3.297 Mon Jan 12 16:43:19 2004 +++ xc/programs/Xserver/Imakefile Wed Feb 9 16:46:51 2005 @@ -1,8 +1,54 @@ -XCOMM $Xorg: Imakefile,v 1.4 2001/03/14 18:42:02 pookie Exp $ /* * Server Master Makefile */ -XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.297 2004/01/12 21:43:19 herrb Exp $ +XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.310 2005/02/09 21:46:51 dawes Exp $ + +/* + * Copyright (c) 1994-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #ifndef InstallXserverSetUID #define InstallXserverSetUID NO @@ -17,15 +63,12 @@ #endif #define PreFbLibs $(DIX) $(OS) $(XPDDX) +#define TinyPreFbLibs $(TINY_DIX) $(TINY_OS) $(XPDDX) #define PreFbLibsNoFont $(DIX) $(OS) -#define BarePostFbLibs $(MFB) $(XPFBLIBS) $(MI) +#define BarePostFbLibs $(MFB) $(MI) #define PostFbLibs BarePostFbLibs $(EXTENSIONS) -#define NoMfbBarePostFbLibs $(XPFBLIBS) $(MI) -#if !BuildXinerama +#define NoMfbBarePostFbLibs $(MI) #define NoMfbPostFbLibs NoMfbBarePostFbLibs $(EXTENSIONS) -#else -#define NoMfbPostFbLibs $(EXTENSIONS) NoMfbBarePostFbLibs $(EXTENSIONS) -#endif #define MFBBareLibs PreFbLibs BarePostFbLibs #define NoMFBBareLibs PreFbLibs NoMfbBarePostFbLibs @@ -44,11 +87,12 @@ #define NoMFBCFBLibs PreFbLibs $(CFB) NoMfbPostFbLibs #define NoMFBCFB8Libs PreFbLibs $(CFB8) NoMfbPostFbLibs #define FbPostFbLibs $(FB) NoMfbPostFbLibs +#define TinyFbPostFbLibs $(FB) $(MI) $(TINY_EXTENSIONS) #define FBLibs PreFbLibs FbPostFbLibs #define MiExtLibs $(SHADOW) -#define AllFBLibs PreFbLibs $(FB) $(CFB) PostFbLibs +#define BareAllFBLibs PreFbLibs $(FB) $(CFB) BarePostFbLibs #if BuildGlxExt #if BuildXF86DRI @@ -117,25 +161,7 @@ #endif LIBREGEX = RegexLibrary -#if DoLoadableServer - LIBCWRAPPER = os/libcwrapper.o -#endif - #if BuildXprint - -#ifndef XpRasterDDX -#define XpRasterDDX YES -#endif -#ifndef XpColorPclDDX -#define XpColorPclDDX YES -#endif -#ifndef XpMonoPclDDX -#define XpMonoPclDDX NO -#endif -#ifndef XpPostScriptDDX -#define XpPostScriptDDX YES -#endif - #if XpRasterDDX XPRASTLIB = Xprint/raster/LibraryTargetName(raster) #endif @@ -151,10 +177,10 @@ XPDDXLIBS = Xprint/LibraryTargetName(printer) \ $(XPRASTLIB) $(XPPCLLIB) $(XPMPCLLIB) $(XPPSLIB) -XPDDXFBLIBS = $(MFB) $(CFB32) +XPDDXFBLIBS = $(CFB32) $(MFB) #if !PrintOnlyServer + XPDDX = $(XPDDXLIBS) XPFBLIBS = $(XPDDXFBLIBS) - XPDDX = $(XPDDXLIBS) #endif XPDDXDIR = Xprint #endif @@ -164,23 +190,53 @@ #if BuildRender RENDERDIR = render - RENDERLIB = $(RENDERDIR)/librender.a + RENDERLIB = $(RENDERDIR)/LibraryTargetName(render) +#if BuildSeparateTinyDIX + TINY_RENDERLIB = $(RENDERDIR)/tiny/LibraryTargetName(render) +#else + TINY_RENDERLIB = $(RENDERLIB) +#endif #endif #if BuildRandR RANDRDIR = randr - RANDRLIB = $(RANDRDIR)/librandr.a + RANDRLIB = $(RANDRDIR)/LibraryTargetName(randr) +#if BuildSeparateTinyDIX + TINY_RANDRLIB = $(RANDRDIR)/tiny/LibraryTargetName(randr) +#else + TINY_RANDRLIB = $(RANDRLIB) #endif -#if DoLoadableServer - EXTENSIONS = $(OTHEREXTS) $(RANDRLIB) $(RENDERLIB) - LOADABLEEXTS = $(MISCEXT) $(DBEEXT) $(RECORDEXT) $(GLXEXT) $(XTRAPEXT) +#endif + BASEEXTS = Xext/LibraryTargetName(exts) + STATICEXTS = $(XKBEXT) $(XINPUTEXT) $(LBXEXT) $(SITEEXTS) $(RANDRLIB) \ + $(RENDERLIB) MISCEXT = Xext/LibraryTargetName(ext) - OTHEREXTS = Xext/LibraryTargetName(exts) $(XKBEXT) $(XINPUTEXT) \ - $(LBXEXT) $(SITEEXTS) + LOADABLEEXTS = $(MISCEXT) $(DBEEXT) $(RECORDEXT) $(GLXEXT) $(XTRAPEXT) + EXTENSIONS = $(LOADABLEEXTS) $(STATICEXTS) + +#if BuildSeparateTinyDIX +TINY_STATICEXTS = $(XKBEXT) $(XINPUTEXT) $(LBXEXT) $(SITEEXTS) \ + $(TINY_RANDRLIB) $(TINY_RENDERLIB) + TINY_MISCEXT = Xext/tiny/LibraryTargetName(ext) +#else +TINY_STATICEXTS = $(STATICEXTS) + TINY_MISCEXT = $(MISCEXT) +#endif +TINY_LOADABLEEXTS = $(TINY_MISCEXT) $(DBEEXT) $(RECORDEXT) $(GLXEXT) $(XTRAPEXT) +TINY_EXTENSIONS = $(TINY_STATICEXTS) $(TINY_LOADABLEEXTS) + + XPLOADABLEEXTS = $(MISCEXT) $(DBEEXT) $(RECORDEXT) $(XTRAPEXT) + XPEXTENSIONS = $(XPLOADABLEEXTS) $(STATICEXTS) + +#if DoLoadableServer + XF86EXTENSIONS = $(BASEEXTS) $(STATICEXTS) #else - EXTENSIONS = $(OTHEREXTS) $(GLXEXT) $(RANDRLIB) $(RENDERLIB) - OTHEREXTS = Xext/LibraryTargetName(ext) $(XKBEXT) $(XINPUTEXT) \ - $(LBXEXT) $(DBEEXT) $(RECORDEXT) $(SITEEXTS) $(XTRAPEXT) + XF86EXTENSIONS = $(STATICEXTS) $(LOADABLEEXTS) #endif + + DMXSTATICEXTS = $(XKBEXT) $(XINPUTEXT) $(LBXEXT) $(SITEEXTS) $(RENDERLIB) +DMXLOADABLEEXTS = $(MISCEXT) $(RECORDEXT) $(XTRAPEXT) + DMXEXTENSIONS = $(DMXLOADABLEEXTS) $(DMXSTATICEXTS) + EXTDIRS = Xext $(XKBDIR) $(XIDIR) $(GLXDIR) \ $(LBXDIRS) $(DBEDIR) $(RECORDDIR) $(SITEEXTDIRS) \ $(RANDRDIR) $(RENDERDIR) $(XTRAPDIR) @@ -188,23 +244,28 @@ ZLIB = GzipLibrary #endif OS = os/LibraryTargetName(os) +#if BuildSeparateTinyDIX + TINY_OS = os/tiny/LibraryTargetName(os) +#else + TINY_OS = $(OS) +#endif BSDEMUL = $(DEPXBSDLIB) #if DoLoadableServer MFB = mfb/ModuleLibraryTargetName(mfb) FB = fb/ModuleLibraryTargetName(fb) - CFB = cfb/ModuleLibraryTargetName(cfb) \ - cfb16/ModuleLibraryTargetName(cfb16) \ + CFB = cfb16/ModuleLibraryTargetName(cfb16) \ cfb24/ModuleLibraryTargetName(cfb24) \ - cfb32/ModuleLibraryTargetName(cfb32) + cfb32/ModuleLibraryTargetName(cfb32) \ + cfb/ModuleLibraryTargetName(cfb) CFB8 = cfb/ModuleLibraryTargetName(cfb) - CFB4 = cfb/ModuleLibraryTargetName(cfb) \ - cfb4/ModuleLibraryTargetName(cfb4) - CFB16 = cfb/ModuleLibraryTargetName(cfb) \ - cfb16/ModuleLibraryTargetName(cfb16) - CFB24 = cfb/ModuleLibraryTargetName(cfb) \ - cfb24/ModuleLibraryTargetName(cfb24) - CFB32 = cfb/ModuleLibraryTargetName(cfb) \ - cfb32/ModuleLibraryTargetName(cfb32) + CFB4 = cfb4/ModuleLibraryTargetName(cfb4) \ + cfb/ModuleLibraryTargetName(cfb) + CFB16 = cfb16/ModuleLibraryTargetName(cfb16) \ + cfb/ModuleLibraryTargetName(cfb) + CFB24 = cfb24/ModuleLibraryTargetName(cfb24) \ + cfb/ModuleLibraryTargetName(cfb) + CFB32 = cfb32/ModuleLibraryTargetName(cfb32) \ + cfb/ModuleLibraryTargetName(cfb) SHADOW = miext/shadow/ModuleLibraryTargetName(shadow) LAYER = miext/layer/ModuleLibraryTargetName(layer) #else @@ -232,14 +293,24 @@ MI = mi/LibraryTargetName(mi) MIINITEXTOBJ = mi/miinitext.o DIX = dix/LibraryTargetName(dix) +#if BuildSeparateTinyDIX + TINY_DIX = dix/tiny/LibraryTargetName(dix) +#else + TINY_DIX = $(DIX) +#endif +#if DoLoadableServer FONTBASE = $(FONTLIBSRC)/fontbase.o \ $(FONTLIBSRC)/LibraryTargetName(fontbase) +#endif #if XserverStaticFontLib FONT = $(FONTLIBSRC)/LibraryTargetName(Xfont) $(FREETYPE2LIB) + TINY_FONT = $(FONTLIBSRC)/LibraryTargetName(Xfont) #else FONT = $(LDPRELIB) $(XFONTLIB) $(FREETYPE2LIB) + TINY_FONT = $(LDPRELIB) $(XFONTLIB) #endif FONTLIBS = $(FONT) $(XPFBLIBS) + TINY_FONTLIBS = $(TINY_FONT) $(XPFBLIBS) #if UsbMouseSupport #if !HasLibUsb USB = $(XF86OSSRC)/bsd/libusb/LibraryTargetName(usb) @@ -257,7 +328,9 @@ DBMLIBS = DBMLibrary #endif SYSLIBS = $(ZLIB) MathLibrary Krb5Libraries $(DBMLIBS) $(USB) \ - $(PAMLIBS) $(XAUTHLIB) $(XDMCPLIB) $(EXTRASYSLIBS) + $(PAMLIBS) $(XAUTHLIB) $(XDMCPLIB) $(EXTRASYSLIBS) + NOAUTH_SYSLIBS = $(ZLIB) MathLibrary Krb5Libraries $(DBMLIBS) $(USB) \ + $(PAMLIBS) $(XDMCPLIB) $(EXTRASYSLIBS) #if !HasCbrt CBRT = mi/LibraryTargetName(cbrt) #endif @@ -270,6 +343,9 @@ CFB24DIR = cfb24 CFB32DIR = cfb32 AFBDIR = afb + LAYERDIR = miext/layer + ROOTLESSDIR = miext/rootless + SHADOWDIR = miext/shadow XCOMM XCOMM This turns off the default rule for compiling .c files because @@ -376,8 +452,8 @@ #endif SUNSYSLIBS = $(FONTLIBS) $(WIDECHARSYSLIB) $(SYSLIBS) SetUIDServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS), \ - $(LIBCWRAPPER) $(SUNLIBS) $(LOADABLEEXTS),$(SUNSYSLIBS)) -#ifndef ServerToInstall + $(SUNLIBS),$(SUNSYSLIBS)) +#if !defined(ServerToInstall) && (!defined(XF86Server) || !XF86Server) #define ServerToInstall Xsun #endif #endif /* XsunServer */ @@ -405,8 +481,8 @@ #endif SUN24LIBS = hw/sun/LibraryTargetName(sun) CFBLibs SetUIDServerTarget(Xsun24,$(SUN24DIRS),$(SUN24OBJS), \ - $(LIBCWRAPPER) $(SUN24LIBS) $(LOADABLEEXTS),$(FONTLIBS) $(SYSLIBS)) -#ifndef ServerToInstall + $(SUN24LIBS),$(FONTLIBS) $(SYSLIBS)) +#if !defined(ServerToInstall) && (!defined(XF86Server) || !XF86Server) #define ServerToInstall Xsun24 #endif #endif /* Xsun24Server */ @@ -424,10 +500,10 @@ #else SUNMOBJS = hw/sun/sunInitMono.o hw/sun/sunInExMono.o #endif -SUNMLIBS = hw/sun/LibraryTargetName(sun) MFBBareLibs $(EXTENSIONS) +SUNMLIBS = hw/sun/LibraryTargetName(sun) MFBLibs SetUIDServerTarget(XsunMono,$(SUNMDIRS),$(SUNMOBJS), \ - $(LIBCWRAPPER) $(SUNMLIBS) $(LOADABLEEXTS),$(FONTLIBS) $(SYSLIBS)) -#ifndef ServerToInstall + $(SUNMLIBS),$(FONTLIBS) $(SYSLIBS)) +#if !defined(ServerToInstall) && (!defined(XF86Server) || !XF86Server) #define ServerToInstall XsunMono #endif #endif /* XsunMonoServer */ @@ -481,14 +557,18 @@ #if defined(XVirtualFramebufferServer) && XVirtualFramebufferServer XVFB = Xvfb #endif +#if defined(XdmxServer) && XdmxServer +XDMX = Xdmx +#endif #if defined(XWinServer) && XWinServer && !MakeDllModules XWIN = XWin #endif #if (defined(XF86Server) && XF86Server) || \ (defined(XnestServer) && XnestServer) || \ (defined(XVirtualFramebufferServer) && XVirtualFramebufferServer) || \ + (defined(XdmxServer) && XdmxServer) || \ (!MakeDllModules && defined(XWinServer) && XWinServer) -MakeMutex($(XF86SERVER) $(XNEST) $(XVFB) $(XWIN)) +MakeMutex($(XF86SERVER) $(XNEST) $(XVFB) $(XDMX) $(XWIN)) #endif MakeMutex($(STDDIRS) mfb fb cfb cfb16 cfb24 cfb32) #endif @@ -504,12 +584,11 @@ CFB16SUBDIR = cfb16 CFB24SUBDIR = cfb24 CFB32SUBDIR = cfb32 -SHADOWDIR = miext/shadow -LAYERDIR = miext/layer #ifdef OS2Architecture SERVERDEFFILE = XFree86.def XNESTDEFFILE = Xnest.def XVFBDEFFILE = Xvfb.def +XDMXDEFFILE = Xdmx.def #endif #if XF86AFB AFBSUBDIR = afb @@ -599,13 +678,13 @@ #if DoLoadableServer XF86LOADERLIB = $(XF86SRC)/loader/LibraryTargetName(loader) XF86MAINLIBS = PreFbLibsNoFont \ - $(FONTBASE) $(OTHEREXTS) $(XF86COMLIB) \ - NoMfbPostFbLibs -XF86SERVERSYSLIBS = $(SYSLIBS) $(LIBDL) $(LIBREGEX) + $(FONTBASE) $(XF86COMLIB) \ + NoMfbBarePostFbLibs $(XF86EXTENSIONS) +XF86SERVERSYSLIBS = $(XPFBLIBS) $(SYSLIBS) $(LIBDL) $(LIBREGEX) XF86SERVERLIBS = $(XF86DRVLIBS) $(XF86IDRVLIBS) $(XF86LIBS) $(XF86LOADERLIB) \ $(XF86COMLIB) $(XF86MAINLIBS) $(XF86SCANLIB) $(XF86OSLIB) #else -XF86MAINLIBS = MiExtLibs AllFBLibs $(XF86COMLIB) $(MI) +XF86MAINLIBS = MiExtLibs BareAllFBLibs $(XF86EXTENSIONS) $(XF86COMLIB) $(MI) XF86SERVERSYSLIBS = $(FONTLIBS) $(SYSLIBS) $(LIBDL) $(LIBREGEX) XF86SERVERLIBS = $(XF86DRVLIBS) $(XF86IDRVLIBS) $(XF86LIBS) $(XF86LOADERLIB) \ $(XF86COMLIB) $(XF86MAINLIBS) $(XF86SCANLIB) $(XF86OSLIB) \ @@ -629,53 +708,50 @@ #endif #endif /* XF86Server */ -#if defined(KDriveXServer) && KDriveXServer +#if defined(TinyXServer) && TinyXServer XCOMM XCOMM Tiny X server section XCOMM - KDRIVE = hw/kdrive + TINYXDIR = hw/tinyx #if HasTsLib - KDTSLIB = -lts + TINYXTSLIB = -lts #endif #ifdef LinuxArchitecture - KDOSDIR = $(KDRIVE)/linux - KDOS = $(KDOSDIR)/LibraryTargetName(linux) $(KDTSLIB) + TINYXOSDIR = $(TINYXDIR)/linux + TINYXOS = $(TINYXOSDIR)/LibraryTargetName(linux) $(TINYXTSLIB) #endif #ifdef VXWORKS - KDOSDIR = $(KDRIVE)/vxworks - KDOS = $(KDOSDIR)/LibraryTargetName(vxworks) + TINYXOSDIR = $(TINYXDIR)/vxworks + TINYXOS = $(TINYXOSDIR)/LibraryTargetName(vxworks) #endif -#if BuildPseudo8 - PSEUDO8 = $(KDRIVE)/pseudo8/LibraryTargetName(pseudo8) - PSEUDO8DIR = $(KDRIVE)/pseudo8 -#endif - SHADOWDIR = miext/shadow - LAYERDIR = miext/layer - KD = $(KDRIVE)/LibraryTargetName(kdrive) - KDFBDEV = $(KDRIVE)/fbdev/LibraryTargetName(fbdev) + FBSUBDIR = fb + TINYX = $(TINYXDIR)/LibraryTargetName(tinyx) + TINYXFBDEV = $(TINYXDIR)/fbdev/LibraryTargetName(fbdev) -#define StdKdDirs $(KDRIVE) $(KDOSDIR) $(PSEUDO8DIR) fb $(DEPDIRS) -#define StdKdSysLibs $(FONTLIBS) $(SYSLIBS) -#define KdLibs $(KD) $(KDOS) $(PSEUDO8) MiExtLibs $(RANDRLIB) $(RENDERLIB) +#define StdTinyxDirs $(TINYXDIR) $(TINYXOSDIR) $(DEPDIRS) +#define StdTinyxSysLibs $(TINY_FONTLIBS) $(SYSLIBS) +#define TinyxLibs $(TINYX) $(TINYXOS) MiExtLibs +#define TinyxObjs $(TINYXDIR)/miinitext.o $(TINYXDIR)/register.o $(TINYXDIR)/ffcheck.o $(TINYXDIR)/stubs.o os/tiny/lbxio.o #if defined(XfbdevServer) && XfbdevServer XCOMM -XCOMM server with Keith's fbdev driver only +XCOMM server with TinyX fbdev driver only XCOMM - FBDEVDIR = $(KDRIVE)/fbdev + FBDEVDIR = $(TINYXDIR)/fbdev FBDEV = $(FBDEVDIR)/LibraryTargetName(fbdev) - KDDIRS = StdKdDirs + TINYXDIRS = StdTinyxDirs - FBDEVDIRS = $(STDDIRS) $(KDDIRS) $(FBDEVDIR) $(SHADOWDIR) $(LAYERDIR) + FBDEVDIRS = $(STDDIRS) $(TINYXDIRS) $(FBDEVDIR) $(SHADOWDIR) $(LAYERDIR) - FBDEVLIBS = PreFbLibs $(FBDEV) $(LAYER) KdLibs FbPostFbLibs -FBDEVSYSLIBS = StdKdSysLibs + FBDEVLIBS = TinyPreFbLibs $(FBDEV) $(LAYER) TinyxLibs TinyFbPostFbLibs + FBDEVOBJS = TinyxObjs +FBDEVSYSLIBS = StdTinyxSysLibs #if HasParallelMake MakeMutex($(FBDEVDIRS) $(FBDEVOBJS) $(FBDEVLIBS) $(FBDEVSYSLIBS)) @@ -690,18 +766,19 @@ #if defined(XSavageServer) && XSavageServer XCOMM -XCOMM server with Keith's S3 Savage driver +XCOMM server with TinyX S3 Savage driver XCOMM - SAVAGEDIR = $(KDRIVE)/savage + SAVAGEDIR = $(TINYXDIR)/savage SAVAGE = $(SAVAGEDIR)/LibraryTargetName(savage) - KDDIRS = StdKdDirs + TINYXDIRS = StdTinyxDirs - SAVAGEDIRS = $(STDDIRS) $(KDDIRS) $(SAVAGEDIR) + SAVAGEDIRS = $(STDDIRS) $(TINYXDIRS) $(SAVAGEDIR) - SAVAGELIBS = PreFbLibs $(SAVAGE) KdLibs FbPostFbLibs -SAVAGESYSLIBS = StdKdSysLibs + SAVAGEOBJS = TinyxObjs + SAVAGELIBS = TinyPreFbLibs $(SAVAGE) TinyxLibs TinyFbPostFbLibs +SAVAGESYSLIBS = StdTinyxSysLibs #if HasParallelMake MakeMutex($(SAVAGEDIRS) $(SAVAGEOBJS) $(SAVAGELIBS) $(SAVAGESYSLIBS)) @@ -716,18 +793,19 @@ #if defined(XIgsServer) && XIgsServer XCOMM -XCOMM server with Keith's S3 Igs driver +XCOMM server with TinyX S3 Igs driver XCOMM - IGSDIR = $(KDRIVE)/igs + IGSDIR = $(TINYXDIR)/igs IGS = $(IGSDIR)/LibraryTargetName(igs) - KDDIRS = StdKdDirs + TINYXDIRS = StdTinyxDirs - IGSDIRS = $(STDDIRS) $(KDDIRS) $(IGSDIR) + IGSDIRS = $(STDDIRS) $(TINYXDIRS) $(IGSDIR) - IGSLIBS = PreFbLibs $(IGS) KdLibs FbPostFbLibs - IGSSYSLIBS = StdKdSysLibs + IGSOBJS = TinyxObjs + IGSLIBS = TinyPreFbLibs $(IGS) TinyxLibs TinyFbPostFbLibs + IGSSYSLIBS = StdTinyxSysLibs #if HasParallelMake MakeMutex($(IGSDIRS) $(IGSOBJS) $(IGSLIBS) $(IGSSYSLIBS)) @@ -742,23 +820,25 @@ #if defined(XTridentServer) && XTridentServer XCOMM -XCOMM server with Keith's TRIDENT Cyber9525 driver +XCOMM server with TinyX TRIDENT Cyber9525 driver XCOMM - FBDEVDIR = $(KDRIVE)/fbdev + FBDEVDIR = $(TINYXDIR)/fbdev FBDEV = $(FBDEVDIR)/LibraryTargetName(fbdev) - VESADIR = $(KDRIVE)/vesa + VESADIR = $(TINYXDIR)/vesa VESA = $(VESADIR)/LibraryTargetName(vesa) - TRIDENTDIR = $(KDRIVE)/trident + TRIDENTDIR = $(TINYXDIR)/trident TRIDENT = $(TRIDENTDIR)/LibraryTargetName(trident) - KDDIRS = StdKdDirs + TINYXDIRS = StdTinyxDirs - TRIDENTDIRS = $(STDDIRS) $(KDDIRS) \ + TRIDENTDIRS = $(STDDIRS) $(TINYXDIRS) \ $(FBDEVDIR) $(VESADIR) $(SHADOWDIR) $(LAYERDIR) $(TRIDENTDIR) - TRIDENTLIBS = PreFbLibs $(TRIDENT) $(FBDEV) $(VESA) $(LAYER) KdLibs FbPostFbLibs -TRIDENTSYSLIBS = StdKdSysLibs + TRIDENTOBJS = TinyxObjs + TRIDENTLIBS = TinyPreFbLibs $(TRIDENT) $(FBDEV) $(VESA) $(LAYER) \ + TinyxLibs TinyFbPostFbLibs +TRIDENTSYSLIBS = StdTinyxSysLibs #if HasParallelMake MakeMutex($(TRIDENTDIRS) $(TRIDENTLIBS) $(TRIDENTSYSLIBS)) @@ -773,21 +853,22 @@ #if defined(XchipsServer) && XchipsServer XCOMM -XCOMM server with Keith's C&T driver +XCOMM server with TinyX C&T driver XCOMM - VESADIR = $(KDRIVE)/vesa + VESADIR = $(TINYXDIR)/vesa VESA = $(VESADIR)/LibraryTargetName(vesa) - CHIPSDIR = $(KDRIVE)/chips + CHIPSDIR = $(TINYXDIR)/chips CHIPS = $(CHIPSDIR)/LibraryTargetName(chips) - KDDIRS = StdKdDirs + TINYXDIRS = StdTinyxDirs - CHIPSDIRS = $(STDDIRS) $(KDDIRS) \ + CHIPSDIRS = $(STDDIRS) $(TINYXDIRS) \ $(FBDEVDIR) $(VESADIR) $(SHADOWDIR) $(LAYERDIR) $(CHIPSDIR) - CHIPSLIBS = PreFbLibs $(CHIPS) $(VESA) $(LAYER) KdLibs FbPostFbLibs -CHIPSSYSLIBS = StdKdSysLibs + CHIPSOBJS = TinyxObjs + CHIPSLIBS = TinyPreFbLibs $(CHIPS) $(VESA) $(LAYER) TinyxLibs TinyFbPostFbLibs +CHIPSSYSLIBS = StdTinyxSysLibs #if HasParallelMake MakeMutex($(CHIPSDIRS) $(CHIPSLIBS) $(CHIPSSYSLIBS)) @@ -802,21 +883,22 @@ #if defined(Xmach64Server) && Xmach64Server XCOMM -XCOMM server with Keith's Mach64 driver (for Mobility 1 machines) +XCOMM server with TinyX Mach64 driver (for Mobility 1 machines) XCOMM - VESADIR = $(KDRIVE)/vesa + VESADIR = $(TINYXDIR)/vesa VESA = $(VESADIR)/LibraryTargetName(vesa) - MACH64DIR = $(KDRIVE)/mach64 + MACH64DIR = $(TINYXDIR)/mach64 MACH64 = $(MACH64DIR)/LibraryTargetName(mach64) - KDDIRS = StdKdDirs + TINYXDIRS = StdTinyxDirs - MACH64DIRS = $(STDDIRS) $(KDDIRS) \ + MACH64DIRS = $(STDDIRS) $(TINYXDIRS) \ $(VESADIR) $(SHADOWDIR) $(LAYERDIR) $(MACH64DIR) - MACH64LIBS = PreFbLibs $(MACH64) $(VESA) $(LAYER) KdLibs FbPostFbLibs -MACH64SYSLIBS = StdKdSysLibs + MACH64OBJS = TinyxObjs + MACH64LIBS = TinyPreFbLibs $(MACH64) $(VESA) $(LAYER) TinyxLibs TinyFbPostFbLibs +MACH64SYSLIBS = StdTinyxSysLibs #if HasParallelMake MakeMutex($(MACH64DIRS) $(MACH64LIBS) $(MACH64SYSLIBS)) @@ -834,19 +916,20 @@ XCOMM server with Intel i810 driver XCOMM - FBDEVDIR = $(KDRIVE)/fbdev + FBDEVDIR = $(TINYXDIR)/fbdev FBDEV = $(FBDEVDIR)/LibraryTargetName(fbdev) - VESADIR = $(KDRIVE)/vesa + VESADIR = $(TINYXDIR)/vesa VESA = $(VESADIR)/LibraryTargetName(vesa) - I810DIR = $(KDRIVE)/i810 + I810DIR = $(TINYXDIR)/i810 I810 = $(I810DIR)/LibraryTargetName(i810) - KDDIRS = StdKdDirs + TINYXDIRS = StdTinyxDirs - I810DIRS = $(STDDIRS) $(KDDIRS) $(SHADOWDIR) $(I810DIR) + I810DIRS = $(STDDIRS) $(TINYXDIRS) $(SHADOWDIR) $(I810DIR) - I810LIBS = PreFbLibs $(I810) KdLibs FbPostFbLibs - I810SYSLIBS = StdKdSysLibs + I810OBJS = TinyxObjs + I810LIBS = TinyPreFbLibs $(I810) TinyxLibs TinyFbPostFbLibs + I810SYSLIBS = StdTinyxSysLibs #if HasParallelMake MakeMutex($(I810DIRS) $(I810LIBS) $(I810SYSLIBS)) @@ -862,18 +945,19 @@ #if defined(XSis530Server) && XSis530Server XCOMM -XCOMM server with Keith's SiS 530 driver +XCOMM server with TinyX SiS 530 driver XCOMM - SIS530DIR = $(KDRIVE)/sis530 + SIS530DIR = $(TINYXDIR)/sis530 SIS530 = $(SIS530DIR)/LibraryTargetName(sis530) - KDDIRS = StdKdDirs + TINYXDIRS = StdTinyxDirs - SIS530DIRS = $(STDDIRS) $(KDDIRS) $(SIS530DIR) + SIS530DIRS = $(STDDIRS) $(TINYXDIRS) $(SIS530DIR) - SIS530LIBS = PreFbLibs $(SIS530) KdLibs FbPostFbLibs -SIS530SYSLIBS = StdKdSysLibs + SIS530OBJS = TinyxObjs + SIS530LIBS = TinyPreFbLibs $(SIS530) TinyxLibs TinyFbPostFbLibs +SIS530SYSLIBS = StdTinyxSysLibs #if HasParallelMake MakeMutex($(SIS530DIRS) $(SIS530OBJS) $(SIS530LIBS) $(SIS530SYSLIBS)) @@ -888,18 +972,19 @@ #if defined(XTrioServer) && XTrioServer XCOMM -XCOMM server with Keith's S3 Trio driver +XCOMM server with TinyX S3 Trio driver XCOMM - TRIODIR = $(KDRIVE)/trio + TRIODIR = $(TINYXDIR)/trio TRIO = $(TRIODIR)/LibraryTargetName(trio) - KDDIRS = StdKdDirs + TINYXDIRS = StdTinyxDirs - TRIODIRS = $(STDDIRS) $(KDDIRS) $(TRIODIR) + TRIODIRS = $(STDDIRS) $(TINYXDIRS) $(TRIODIR) - TRIOLIBS = PreFbLibs $(TRIO) KdLibs FbPostFbLibs -TRIOSYSLIBS = StdKdSysLibs + TRIOOBJS = TinyxObjs + TRIOLIBS = TinyPreFbLibs $(TRIO) TinyxLibs TinyFbPostFbLibs +TRIOSYSLIBS = StdTinyxSysLibs #if HasParallelMake MakeMutex($(TRIODIRS) $(TRIOOBJS) $(TRIOLIBS) $(TRIOSYSLIBS)) @@ -917,23 +1002,23 @@ XCOMM server with Alan's HP VGA Out PCMCIA driver & fbdev XCOMM - FBDEVDIR = $(KDRIVE)/fbdev + FBDEVDIR = $(TINYXDIR)/fbdev FBDEV = $(FBDEVDIR)/LibraryTargetName(fbdev) - PCMCIADIR = $(KDRIVE)/pcmcia + PCMCIADIR = $(TINYXDIR)/pcmcia PCMCIA = $(PCMCIADIR)/LibraryTargetName(pcmcia) - SHADOWDIR = miext/shadow - - IPAQDIR = $(KDRIVE)/ipaq + IPAQDIR = $(TINYXDIR)/ipaq IPAQ = $(IPAQDIR)/LibraryTargetName(ipaq) - KDDIRS = StdKdDirs + TINYXDIRS = StdTinyxDirs - IPAQDIRS = $(STDDIRS) $(KDDIRS) $(FBDEVDIR) $(LAYERDIR) $(SHADOWDIR) $(PCMCIADIR) $(IPAQDIR) + IPAQDIRS = $(STDDIRS) $(TINYXDIRS) $(FBDEVDIR) $(LAYERDIR) $(SHADOWDIR) $(PCMCIADIR) $(IPAQDIR) - IPAQLIBS = PreFbLibs $(IPAQ) $(FBDEV) $(LAYER) $(SHADOW) $(PCMCIA) KdLibs FbPostFbLibs - IPAQSYSLIBS = StdKdSysLibs + IPAQOBJS = TinyxObjs + IPAQLIBS = TinyPreFbLibs $(IPAQ) $(FBDEV) $(LAYER) $(SHADOW) \ + $(PCMCIA) TinyxLibs TinyFbPostFbLibs + IPAQSYSLIBS = StdTinyxSysLibs #if HasParallelMake MakeMutex($(IPAQDIRS) $(IPAQOBJS) $(IPAQLIBS) $(IPAQSYSLIBS)) @@ -948,24 +1033,25 @@ #if defined(XTS300Server) && XTS300Server XCOMM -XCOMM server with Keith's S3 Trio and SiS530 driver for the TS300/TS400 +XCOMM server with TinyX S3 Trio and SiS530 driver for the TS300/TS400 XCOMM - TRIODIR = $(KDRIVE)/trio + TRIODIR = $(TINYXDIR)/trio TRIO = $(TRIODIR)/LibraryTargetName(trio) - SIS530DIR = $(KDRIVE)/sis530 + SIS530DIR = $(TINYXDIR)/sis530 SIS530 = $(SIS530DIR)/LibraryTargetName(sis530) - TS300DIR = $(KDRIVE)/ts300 + TS300DIR = $(TINYXDIR)/ts300 TS300 = $(TS300DIR)/LibraryTargetName(ts300) - KDDIRS = StdKdDirs + TINYXDIRS = StdTinyxDirs - TS300DIRS = $(STDDIRS) $(KDDIRS) $(TRIODIR) $(SIS530DIR) $(TS300DIR) + TS300DIRS = $(STDDIRS) $(TINYXDIRS) $(TRIODIR) $(SIS530DIR) $(TS300DIR) - TS300LIBS = PreFbLibs $(TS300) $(TRIO) $(SIS530) KdLibs FbPostFbLibs - TS300SYSLIBS = StdKdSysLibs + TS300OBJS = TinyxObjs + TS300LIBS = TinyPreFbLibs $(TS300) $(TRIO) $(SIS530) TinyxLibs TinyFbPostFbLibs + TS300SYSLIBS = StdTinyxSysLibs #if HasParallelMake MakeMutex($(TS300DIRS) $(TS300OBJS) $(TS300LIBS) $(TS300SYSLIBS)) @@ -980,17 +1066,18 @@ #if defined(XItsyServer) && XItsyServer XCOMM -XCOMM server with Keith's FB driver only +XCOMM server with TinyX FB driver only XCOMM - ITSYDIR = $(KDRIVE)/itsy + ITSYDIR = $(TINYXDIR)/itsy ITSY = $(ITSYDIR)/LibraryTargetName(itsy) - KDDIRS = StdKdDirs + TINYXDIRS = StdTinyxDirs - ITSYDIRS = $(STDDIRS) $(KDDIRS) $(ITSYDIR) + ITSYDIRS = $(STDDIRS) $(TINYXDIRS) $(ITSYDIR) - ITSYLIBS = PreFbLibs $(ITSY) KdLibs FbPostFbLibs -ITSYSYSLIBS = StdKdSysLibs + ITSYOBJS = TinyxObjs + ITSYLIBS = TinyPreFbLibs $(ITSY) TinyxLibs TinyFbPostFbLibs +ITSYSYSLIBS = StdTinyxSysLibs #if HasParallelMake MakeMutex($(ITSYDIRS) $(ITSYOBJS) $(ITSYLIBS) $(ITSYSYSLIBS)) @@ -1005,18 +1092,19 @@ #if defined(XvesaServer) && XvesaServer XCOMM -XCOMM server with vesa driver only based on Keith's server +XCOMM server with vesa driver only based on TinyX server XCOMM - VESADIR = $(KDRIVE)/vesa + VESADIR = $(TINYXDIR)/vesa VESA = $(VESADIR)/LibraryTargetName(vesa) - KDDIRS = StdKdDirs + TINYXDIRS = StdTinyxDirs - VESADIRS = $(STDDIRS) $(KDDIRS) $(VESADIR) $(SHADOWDIR) $(LAYERDIR) + VESADIRS = $(STDDIRS) $(TINYXDIRS) $(VESADIR) $(SHADOWDIR) $(LAYERDIR) - VESALIBS = PreFbLibs $(VESA) $(LAYER) KdLibs FbPostFbLibs -VESASYSLIBS = StdKdSysLibs + VESAOBJS = TinyxObjs + VESALIBS = TinyPreFbLibs $(VESA) $(LAYER) TinyxLibs TinyFbPostFbLibs +VESASYSLIBS = StdTinyxSysLibs #if HasParallelMake MakeMutex($(VESADIRS) $(VESAOBJS) $(VESALIBS) $(VESASYSLIBS)) @@ -1029,10 +1117,10 @@ $(VESALIBS),$(VESASYSLIBS)) #endif /* XvesaServer */ -KDRIVEDIRS=$(KDDIRS) $(FBDEVDIR) $(SAVAGEDIR) $(TRIDENTDIR) $(I810DIR) \ +TINYXSUBDIRS=$(TINYXDIRS) $(FBDEVDIR) $(SAVAGEDIR) $(TRIDENTDIR) $(I810DIR) \ $(SIS530DIR) $(TRIODIR) $(TS300DIR) $(ITSYDIR) $(IGSDIR) \ $(VESADIR) $(PCMCIADIR) $(IPAQDIR) $(MACH64DIR) $(CHIPSDIR) -#endif /* KDriveXServer */ +#endif /* TinyXServer */ #if defined(XprtServer) && XprtServer XCOMM @@ -1047,16 +1135,16 @@ XPDPMSSTUBOBJS = Xprint/dpmsstubs.o #endif XPOBJS = Xprint/ddxInit.o Xprint/miinitext.o $(XPDPMSSTUBOBJS) -XPLIBS = PreFbLibs $(XPDDXLIBS) $(XPDDXFBLIBS) PostFbLibs +XPLIBS = PreFbLibs $(XPDDXLIBS) $(XPDDXFBLIBS) $(MI) $(XPEXTENSIONS) #else XPOBJS = Xprint/ddxInit.o -XPLIBS = PreFbLibs PostFbLibs +XPLIBS = PreFbLibs $(XPFBLIBS) BarePostFbLibs $(XPEXTENSIONS) #endif #if (defined(SunArchitecture) || defined(SparcArchitecture)) && \ defined(SVR4Architecture) -XPSYSLIBS = $(FONTLIBS) $(CBRT) $(SYSLIBS) -lw +XPSYSLIBS = $(FONT) $(CBRT) $(SYSLIBS) -lw #else -XPSYSLIBS = $(FONTLIBS) $(CBRT) $(SYSLIBS) +XPSYSLIBS = $(FONT) $(CBRT) $(SYSLIBS) #endif #if HasParallelMake MakeMutex($(XPSUBDIRS) $(XPOBJS) $(XPLIBS) $(XPSYSLIBS)) @@ -1066,7 +1154,7 @@ @if [ -f $@ ]; then touch $@ >/dev/null 2>&1 || exit 0; fi #endif ServerTarget(Xprt,$(XPSUBDIRS),$(XPOBJS), \ - $(LIBCWRAPPER) $(XPLIBS) $(LOADABLEEXTS),$(XPSYSLIBS)) + $(XPLIBS),$(XPSYSLIBS)) #endif /* XprtServer */ #if defined(XnestServer) && XnestServer @@ -1088,7 +1176,7 @@ #endif XNEST = hw/xnest/LibraryTargetName(xnest) XNESTLIBS = PreFbLibs $(XNEST) NoMfbPostFbLibs $(XNEST) -XNESTSYSLIBS = $(FONTLIBS) $(LDPRELIBS) $(XLIB) $(SYSLIBS) +XNESTSYSLIBS = $(FONTLIBS) $(LDPRELIBS) $(XLIB) $(NOAUTH_SYSLIBS) #if HasParallelMake MakeMutex($(XNESTDIRS) $(XNESTOBJS) $(XNESTLIBS) $(XNESTSYSLIBS)) #endif @@ -1097,7 +1185,7 @@ @if [ -f $@ ]; then touch $@ >/dev/null 2>&1 || exit 0; fi #endif ServerTarget(Xnest,$(XNESTDIRS),$(XNESTOBJS) $(XNESTDEFFILE), \ - $(LIBCWRAPPER) $(XNESTLIBS) $(LOADABLEEXTS),$(XNESTSYSLIBS)) + $(XNESTLIBS),$(XNESTSYSLIBS)) #endif /* XnestServer */ @@ -1137,7 +1225,7 @@ XVFBOBJS = dix/main.o hw/vfb/stubs.o hw/vfb/miinitext.o #endif XVFB = $(XVFBDDXDIR)/LibraryTargetName(vfb) -XVFBLIBS = PreFbLibs $(XVFB) $(FB) PostFbLibs $(MI) +XVFBLIBS = PreFbLibs $(XVFB) $(FB) PostFbLibs XVFBSYSLIBS = $(FONTLIBS) $(SYSLIBS) #if HasParallelMake MakeMutex($(XVFBDIRS) $(XVFBOBJS) $(XVFB) $(XVFBLIBS) $(XVFBSYSLIBS)) @@ -1147,19 +1235,59 @@ @if [ -f $@ ]; then touch $@ >/dev/null 2>&1 || exit 0; fi #endif ServerTarget(Xvfb,$(XVFBDIRS),$(XVFBOBJS) $(XVFBDEFFILE), \ - $(LIBCWRAPPER) $(XVFBLIBS) $(LOADABLEEXTS),$(XVFBSYSLIBS)) + $(XVFBLIBS),$(XVFBSYSLIBS)) #endif /* XVirtualFramebufferServer */ +#if defined(XdmxServer) && XdmxServer +XCOMM +XCOMM distribued multihead Server +XCOMM +#ifndef Win32Architecture +XDMXDDXDIR = hw/dmx +#else +XDMXDDXDIR = hw +#endif +FBSUBDIR = fb +XDMXDIRS = $(STDDIRS) $(XDMXDDXDIR) $(SHADOWDIR) $(DEPDIRS) $(FBDIR) +#if BuildGlxInDmx +#if BuildXinerama +GLXPROXY_EXTRAOBJS = hw/dmx/panoramiX.o +#endif +GLXPROXYLIB = hw/dmx/glxProxy/LibraryTargetName(glxProxy) +#endif +#if !defined(LynxOSArchitecture) && \ + !defined(Win32Architecture) && \ + !defined(QNX4Architecture) +XDMXOBJS = hw/dmx/miinitext.o $(GLXPROXY_EXTRAOBJS) +#else +XDMXOBJS = hw/dmx/miinitext.o $(GLXPROXY_EXTRAOBJS) dix/main.o +#endif +XDMXINPUT = hw/dmx/input/LibraryTargetName(dmxinput) +XDMXCONFIG = hw/dmx/config/LibraryTargetName(dmxconfig) +XDMX = hw/dmx/LibraryTargetName(dmxlib) $(XDMXCONFIG) $(GLXPROXYLIB) +XDMXLIBS = PreFbLibs $(XDMX) MiExtLibs $(FB) $(MI) $(DMXEXTENSIONS) $(XDMXINPUT) +#if BuildRender +XDMXRENDERLIB = $(XRENDERLIB) +#endif +XDMXSYSLIBS = $(FONTLIBS) $(LDPRELIBS) $(XILIB) $(XMULIB) $(XDMXRENDERLIB) \ + $(XLIB) $(NOAUTH_SYSLIBS) +#if HasParallelMake +MakeMutex($(XDMXDIRS) $(XDMXOBJS) $(XDMXLIBS) $(XDMXSYSLIBS)) +#endif +#if ForceServerRemake +$(XDMXOBJS) $(XDMXLIBS) $(XDMXSYSLIBS):: $(XDMXDIRS) + @if [ -f $@ ]; then touch $@ >/dev/null 2>&1 || exit 0; fi +#endif +ServerTarget(Xdmx,$(XDMXDIRS),$(XDMXOBJS) $(XDMXDEFFILE), \ + $(LIBCWRAPPER) $(XDMXLIBS),$(XDMXSYSLIBS)) +#endif /* XdmxServer */ #if defined(XWinServer) && XWinServer XCOMM XCOMM X Server for MS Windows XCOMM FBSUBDIR = fb -SHADOWDIR = miext/shadow -#if 0 -LAYERDIR = miext/layer -#else +#if 1 LAYERDIR = #endif XWINDDXDIR = hw/xwin @@ -1198,7 +1326,7 @@ #endif ServerTarget(XWin,$(XWINDIRS),$(XWINOBJS), \ - $(LIBCWRAPPER) $(XWINLIBS) $(LOADABLEEXTS),$(XWINSYSLIBS)) + $(XWINLIBS),$(XWINSYSLIBS)) #ifndef ServerToInstall #define ServerToInstall XWin @@ -1221,12 +1349,11 @@ XCOMM X Darwin server for Mac OS X / Darwin XCOMM FBSUBDIR = fb -SHADOWDIR = miext/shadow -ROOTLESSDIR = miext/rootless DARWINDDXDIR = hw/darwin DARWINDIRS = $(STDDIRS) $(FBDIR) $(SHADOWDIR) $(DARWINDDXDIR) $(DEPDIRS) +DARWINOBJS = $(DARWINDDXDIR)/miinitext.o DARWINLIBS = PreFbLibs $(DARWINDDXDIR)/LibraryTargetName(darwin) -DARWINEXTLIBS = MiExtLibs FbPostFbLibs +DARWINEXTLIBS = MiExtLibs FbPostFbLibs $(DARWINDDXDIR)/LibraryTargetName(darwin) DARWINSYSLIBS = $(FONTLIBS) $(SYSLIBS) -framework IOKit IOKITLIB = $(DARWINDDXDIR)/iokit/LibraryTargetName(iokit) @@ -1238,17 +1365,6 @@ #if DarwinQuartzSupport -/* - * Quartz modes load a GLX extension dynamically, so we can't build it in. - */ -AQUAEXTENSIONS = $(OTHEREXTS) $(RANDRLIB) $(RENDERLIB) -#if !BuildXinerama -#define AquaPostFbLibs NoMfbBarePostFbLibs $(AQUAEXTENSIONS) -#else -#define AquaPostFbLibs $(AQUAEXTENSIONS) NoMfbBarePostFbLibs $(AQUAEXTENSIONS) -#endif -QUARTZEXTLIBS = MiExtLibs $(FB) AquaPostFbLibs - QUARTZDIR = $(DARWINDDXDIR)/quartz QUARTZLIB = $(QUARTZDIR)/LibraryTargetName(XQuartz) QUARTZSYSLIBS = -framework ApplicationServices -framework Cocoa \ @@ -1267,8 +1383,8 @@ /* * Quartz X server (installed in its application bundle) */ -SetUIDServerTarget(XDarwinApp,$(DARWINDIRS),$(QUARTZOBJS), \ - $(DARWINLIBS) $(QUARTZLIB) $(QUARTZEXTLIBS), \ +SetUIDServerTarget(XDarwinApp,$(DARWINDIRS),$(DARWINOBJS), \ + $(DARWINLIBS) $(QUARTZLIB) $(DARWINEXTLIBS), \ $(DARWINSYSLIBS) $(QUARTZSYSLIBS) -u _miDCInitialize) install:: @@ -1336,10 +1452,10 @@ IPLANDIRS = $(IPLAN2P2DIR) $(IPLAN2P4DIR) $(IPLAN2P8DIR) DDXDIRS = $(DECWSDDXDIR) $(SUNDDXDIR) $(LYNXDDXDIR) \ $(HPDDXDIR) $(XFREE86DDXDIR) $(XWINDDXDIR) $(DARWINDDXDIR) \ - $(XVFBDDXDIR) $(XNESTDDXDIR) + $(XVFBDDXDIR) $(XNESTDDXDIR) $(XDMXDDXDIR) SUBDIRS = $(STDDIRS) $(MFBSUBDIR) $(CFBSUBDIRS) \ $(IPLANDIRS) $(ILBMDIR) $(AFBSUBDIR) \ - $(LMFCFBDIR) $(DDXDIRS) $(FBSUBDIR) $(KDRIVEDIRS) $(MIEXTDIRS) \ + $(LMFCFBDIR) $(DDXDIRS) $(FBSUBDIR) $(TINYXSUBDIRS) $(MIEXTDIRS) \ $(XWINPARSERDIR) #if defined(ServerToInstall) && !defined(OS2Architecture) Index: xc/programs/Xserver/XFree86.def diff -u xc/programs/Xserver/XFree86.def:1.5 xc/programs/Xserver/XFree86.def:1.6 --- xc/programs/Xserver/XFree86.def:1.5 Wed Jan 14 12:32:39 2004 +++ xc/programs/Xserver/XFree86.def Sun Feb 6 20:38:24 2005 @@ -1,5 +1,5 @@ NAME XFree86 NOTWINDOWCOMPAT -DESCRIPTION "@#XFREE86:4.4.0#@ $XFree86: xc/programs/Xserver/XFree86.def,v 1.5 2004/01/14 17:32:39 dawes Exp $" +DESCRIPTION "@#XFREE86:4.5.0#@ $XFree86: xc/programs/Xserver/XFree86.def,v 1.6 2005/02/07 01:38:24 tsi Exp $" PROTMODE EXETYPE OS2 Index: xc/programs/Xserver/Xdmx.def diff -u /dev/null xc/programs/Xserver/Xdmx.def:1.1 --- /dev/null Wed Mar 16 21:06:08 2005 +++ xc/programs/Xserver/Xdmx.def Sun Feb 6 20:38:24 2005 @@ -0,0 +1,4 @@ +NAME Xdmx WINDOWCOMPAT +DESCRIPTION "@#XFREE86:4.5.0#@ $XFree86: xc/programs/Xserver/Xdmx.def,v 1.1 2005/02/07 01:38:24 tsi Exp $" +PROTMODE +EXETYPE OS2 Index: xc/programs/Xserver/Xnest.def diff -u xc/programs/Xserver/Xnest.def:3.5 xc/programs/Xserver/Xnest.def:3.6 --- xc/programs/Xserver/Xnest.def:3.5 Wed Jan 14 12:32:39 2004 +++ xc/programs/Xserver/Xnest.def Sun Feb 6 20:38:24 2005 @@ -1,4 +1,4 @@ NAME Xnest WINDOWCOMPAT -DESCRIPTION "@#XFREE86:4.4.0#@ $XFree86: xc/programs/Xserver/Xnest.def,v 3.5 2004/01/14 17:32:39 dawes Exp $" +DESCRIPTION "@#XFREE86:4.5.0#@ $XFree86: xc/programs/Xserver/Xnest.def,v 3.6 2005/02/07 01:38:24 tsi Exp $" PROTMODE EXETYPE OS2 Index: xc/programs/Xserver/Xserver.man diff -u xc/programs/Xserver/Xserver.man:3.32 xc/programs/Xserver/Xserver.man:3.33 --- xc/programs/Xserver/Xserver.man:3.32 Mon Jan 12 16:43:19 2004 +++ xc/programs/Xserver/Xserver.man Thu Feb 10 22:03:10 2005 @@ -22,10 +22,10 @@ .\" 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. -.\" $XFree86: xc/programs/Xserver/Xserver.man,v 3.32 2004/01/12 21:43:19 herrb Exp $ +.\" $XFree86: xc/programs/Xserver/Xserver.man,v 3.33 2005/02/11 03:03:10 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' -.TH XSERVER 1 __xorgversion__ +.TH XSERVER 1 __vendorversion__ .SH NAME Xserver \- X Window System display server .SH SYNOPSIS Index: xc/programs/Xserver/Xvfb.def diff -u xc/programs/Xserver/Xvfb.def:3.4 xc/programs/Xserver/Xvfb.def:3.5 --- xc/programs/Xserver/Xvfb.def:3.4 Wed Jan 14 12:32:39 2004 +++ xc/programs/Xserver/Xvfb.def Sun Feb 6 20:38:24 2005 @@ -1,4 +1,4 @@ NAME Xvfb WINDOWCOMPAT -DESCRIPTION "@#XFREE86:4.4.0#@ $XFree86: xc/programs/Xserver/Xvfb.def,v 3.4 2004/01/14 17:32:39 dawes Exp $" +DESCRIPTION "@#XFREE86:4.5.0#@ $XFree86: xc/programs/Xserver/Xvfb.def,v 3.5 2005/02/07 01:38:24 tsi Exp $" PROTMODE EXETYPE OS2 Index: xc/programs/Xserver/GL/Imakefile diff -u xc/programs/Xserver/GL/Imakefile:1.12 xc/programs/Xserver/GL/Imakefile:1.15 --- xc/programs/Xserver/GL/Imakefile:1.12 Wed Aug 6 10:04:01 2003 +++ xc/programs/Xserver/GL/Imakefile Wed Jun 2 18:42:55 2004 @@ -1,6 +1,51 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/Imakefile,v 1.12 2003/08/06 14:04:01 eich Exp $ +XCOMM $XFree86: xc/programs/Xserver/GL/Imakefile,v 1.15 2004/06/02 22:42:55 dawes Exp $ +/* + * Copyright (c) 2000-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ -#define IHaveModules #include #define IHaveSubdirs @@ -19,43 +64,9 @@ SUBDIRS = glx $(DRI_SUBDIR) $(CORE_SUBDIR) -#if DoLoadableServer -MSRCS = glxmodule.c -MOBJS = glxmodule.o -#endif - -#if BuildModuleInSubdir -SRCS = glx/module/?*.c $(MSRCS) -OBJS = glx/module/?*.o $(MOBJS) -#else -SRCS = glx/?*.c $(MSRCS) -OBJS = glx/?*.o $(MOBJS) -#endif - -DONES = glx/DONE - -INCLUDES = -Iinclude -Idri -I$(SERVERSRC)/include -I$(SERVERSRC)/mi \ - -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(XF86OSSRC) -DEPEND_DEFINES = $(EXT_DEFINES) DependDefines -DEFINES = $(GLX_DEFINES) - -#if HasParallelMake -MakeMutex($(SUBDIRS) $(OBJS) $(DONES)) -#endif - -#if HasGnuMake || HasBsdMake -$(DONES): $(SUBDIRS) -#endif - -ModuleObjectRule() - -DepLibraryModuleTarget(glx,$(SUBDIRS) $(DONES) $(MOBJS),$(OBJS)) - -InstallLibraryModule(glx,$(MODULEDIR),extensions) -ForceSubdirs($(SUBDIRS)) +MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) MakeLintLibSubdirs($(SUBDIRS)) LintSubdirs($(SUBDIRS)) -InstallDriverSDKLibraryModule(glx,$(DRIVERSDKMODULEDIR),extensions) Index: xc/programs/Xserver/GL/glxmodule.c diff -u xc/programs/Xserver/GL/glxmodule.c:1.12 xc/programs/Xserver/GL/glxmodule.c:removed --- xc/programs/Xserver/GL/glxmodule.c:1.12 Sun Sep 28 16:15:40 2003 +++ xc/programs/Xserver/GL/glxmodule.c Wed Mar 16 21:06:09 2005 @@ -1,1266 +0,0 @@ - -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ -/* $XFree86: xc/programs/Xserver/GL/glxmodule.c,v 1.12 2003/09/28 20:15:40 alanh Exp $ */ - -/* - * Authors: - * Kevin E. Martin - * - */ - -#include "xf86Module.h" -#include "colormap.h" -#include "micmap.h" - -static MODULESETUPPROTO(glxSetup); - -extern void GlxExtensionInit(INITARGS); -extern void GlxWrapInitVisuals(miInitVisualsProcPtr *); -extern void InitGlxWrapInitVisuals(void (*f)(miInitVisualsProcPtr *)); - -static const char *initdeps[] = { "DOUBLE-BUFFER", NULL }; - -ExtensionModule GLXExt = -{ - GlxExtensionInit, - "GLX", - NULL, - NULL, - initdeps -}; - -static const char *glcoreSymbols[] = { - "__glCallLists_size", - "__glColorTableParameterfv_size", - "__glColorTableParameteriv_size", - "__glConvolutionParameterfv_size", - "__glConvolutionParameteriv_size", - "__glDDXExtensionInfo", - "__glDDXScreenInfo", - "__glEvalComputeK", - "__glFloorLog2", - "__glFogfv_size", - "__glFogiv_size", - "__glGetBooleanv_size", - "__glGetColorTableParameterfv_size", - "__glGetColorTableParameteriv_size", - "__glGetConvolutionParameterfv_size", - "__glGetConvolutionParameteriv_size", - "__glGetDoublev_size", - "__glGetFloatv_size", - "__glGetHistogramParameterfv_size", - "__glGetHistogramParameteriv_size", - "__glGetIntegerv_size", - "__glGetLightfv_size", - "__glGetLightiv_size", - "__glGetMapdv_size", - "__glGetMapfv_size", - "__glGetMapiv_size", - "__glGetMaterialfv_size", - "__glGetMaterialiv_size", - "__glGetMinmaxParameterfv_size", - "__glGetMinmaxParameteriv_size", - "__glGetPixelMapfv_size", - "__glGetPixelMapuiv_size", - "__glGetPixelMapusv_size", - "__glGetTexEnvfv_size", - "__glGetTexEnviv_size", - "__glGetTexGendv_size", - "__glGetTexGenfv_size", - "__glGetTexGeniv_size", - "__glGetTexImage_size", - "__glGetTexLevelParameterfv_size", - "__glGetTexLevelParameteriv_size", - "__glGetTexParameterfv_size", - "__glGetTexParameteriv_size", - "__glLightModelfv_size", - "__glLightModeliv_size", - "__glLightfv_size", - "__glLightiv_size", - "__glMaterialfv_size", - "__glMaterialiv_size", - "__glPointParameterfvARB_size", - "__glReadPixels_size", - "__glTexEnvfv_size", - "__glTexEnviv_size", - "__glTexGendv_size", - "__glTexGenfv_size", - "__glTexGeniv_size", - "__glTexParameterfv_size", - "__glTexParameteriv_size", - "__glXActiveScreens", - "__glXAssociateContext", - "__glXBadContext", - "__glXBadContextState", - "__glXBadContextTag", - "__glXBadCurrentWindow", - "__glXBadDrawable", - "__glXBadLargeRequest", - "__glXBadPixmap", - "__glXBadRenderRequest", - "__glXBitmapReqSize", - "__glXCacheDrawableSize", - "__glXCallListsReqSize", - "__glXClearErrorOccured", - "__glXClientInfo", - "__glXClientRes", - "__glXClients", - "__glXColorSubTableReqSize", - "__glXColorTableParameterfvReqSize", - "__glXColorTableParameterivReqSize", - "__glXColorTableReqSize", - "__glXContextRes", - "__glXConvolutionFilter1DReqSize", - "__glXConvolutionFilter2DReqSize", - "__glXConvolutionParameterfvReqSize", - "__glXConvolutionParameterivReqSize", - "__glXCopyContext", - "__glXCoreType", - "__glXCreateContext", - "__glXCreateGLXPixmap", - "__glXDeassociateContext", - "__glXDestroyContext", - "__glXDestroyGLXPixmap", - "__glXDispSwap_Accum", - "__glXDispSwap_ActiveStencilFaceEXT", - "__glXDispSwap_ActiveTextureARB", - "__glXDispSwap_AlphaFunc", - "__glXDispSwap_AreTexturesResident", - "__glXDispSwap_AreTexturesResidentEXT", - "__glXDispSwap_Begin", - "__glXDispSwap_BindTexture", - "__glXDispSwap_Bitmap", - "__glXDispSwap_BlendColor", - "__glXDispSwap_BlendEquation", - "__glXDispSwap_BlendFunc", - "__glXDispSwap_CallList", - "__glXDispSwap_CallLists", - "__glXDispSwap_Clear", - "__glXDispSwap_ClearAccum", - "__glXDispSwap_ClearColor", - "__glXDispSwap_ClearDepth", - "__glXDispSwap_ClearIndex", - "__glXDispSwap_ClearStencil", - "__glXDispSwap_ClipPlane", - "__glXDispSwap_Color3bv", - "__glXDispSwap_Color3dv", - "__glXDispSwap_Color3fv", - "__glXDispSwap_Color3iv", - "__glXDispSwap_Color3sv", - "__glXDispSwap_Color3ubv", - "__glXDispSwap_Color3uiv", - "__glXDispSwap_Color3usv", - "__glXDispSwap_Color4bv", - "__glXDispSwap_Color4dv", - "__glXDispSwap_Color4fv", - "__glXDispSwap_Color4iv", - "__glXDispSwap_Color4sv", - "__glXDispSwap_Color4ubv", - "__glXDispSwap_Color4uiv", - "__glXDispSwap_Color4usv", - "__glXDispSwap_ColorMask", - "__glXDispSwap_ColorMaterial", - "__glXDispSwap_ColorSubTable", - "__glXDispSwap_ColorTable", - "__glXDispSwap_ColorTableParameterfv", - "__glXDispSwap_ColorTableParameteriv", - "__glXDispSwap_ConvolutionFilter1D", - "__glXDispSwap_ConvolutionFilter2D", - "__glXDispSwap_ConvolutionParameterf", - "__glXDispSwap_ConvolutionParameterfv", - "__glXDispSwap_ConvolutionParameteri", - "__glXDispSwap_ConvolutionParameteriv", - "__glXDispSwap_CopyColorSubTable", - "__glXDispSwap_CopyColorTable", - "__glXDispSwap_CopyConvolutionFilter1D", - "__glXDispSwap_CopyConvolutionFilter2D", - "__glXDispSwap_CopyPixels", - "__glXDispSwap_CopyTexImage1D", - "__glXDispSwap_CopyTexImage2D", - "__glXDispSwap_CopyTexSubImage1D", - "__glXDispSwap_CopyTexSubImage2D", - "__glXDispSwap_CopyTexSubImage3D", - "__glXDispSwap_CullFace", - "__glXDispSwap_DeleteLists", - "__glXDispSwap_DeleteTextures", - "__glXDispSwap_DeleteTexturesEXT", - "__glXDispSwap_DepthFunc", - "__glXDispSwap_DepthMask", - "__glXDispSwap_DepthRange", - "__glXDispSwap_Disable", - "__glXDispSwap_DrawArrays", - "__glXDispSwap_DrawArraysEXT", - "__glXDispSwap_DrawBuffer", - "__glXDispSwap_DrawPixels", - "__glXDispSwap_EdgeFlagv", - "__glXDispSwap_Enable", - "__glXDispSwap_End", - "__glXDispSwap_EndList", - "__glXDispSwap_EvalCoord1dv", - "__glXDispSwap_EvalCoord1fv", - "__glXDispSwap_EvalCoord2dv", - "__glXDispSwap_EvalCoord2fv", - "__glXDispSwap_EvalMesh1", - "__glXDispSwap_EvalMesh2", - "__glXDispSwap_EvalPoint1", - "__glXDispSwap_EvalPoint2", - "__glXDispSwap_FeedbackBuffer", - "__glXDispSwap_Finish", - "__glXDispSwap_Flush", - "__glXDispSwap_Fogf", - "__glXDispSwap_Fogfv", - "__glXDispSwap_Fogi", - "__glXDispSwap_Fogiv", - "__glXDispSwap_FrontFace", - "__glXDispSwap_Frustum", - "__glXDispSwap_GenLists", - "__glXDispSwap_GenTextures", - "__glXDispSwap_GenTexturesEXT", - "__glXDispSwap_GetBooleanv", - "__glXDispSwap_GetClipPlane", - "__glXDispSwap_GetColorTable", - "__glXDispSwap_GetColorTableParameterfv", - "__glXDispSwap_GetColorTableParameteriv", - "__glXDispSwap_GetConvolutionFilter", - "__glXDispSwap_GetConvolutionParameterfv", - "__glXDispSwap_GetConvolutionParameteriv", - "__glXDispSwap_GetDoublev", - "__glXDispSwap_GetError", - "__glXDispSwap_GetFloatv", - "__glXDispSwap_GetHistogram", - "__glXDispSwap_GetHistogramParameterfv", - "__glXDispSwap_GetHistogramParameteriv", - "__glXDispSwap_GetIntegerv", - "__glXDispSwap_GetLightfv", - "__glXDispSwap_GetLightiv", - "__glXDispSwap_GetMapdv", - "__glXDispSwap_GetMapfv", - "__glXDispSwap_GetMapiv", - "__glXDispSwap_GetMaterialfv", - "__glXDispSwap_GetMaterialiv", - "__glXDispSwap_GetMinmax", - "__glXDispSwap_GetMinmaxParameterfv", - "__glXDispSwap_GetMinmaxParameteriv", - "__glXDispSwap_GetPixelMapfv", - "__glXDispSwap_GetPixelMapuiv", - "__glXDispSwap_GetPixelMapusv", - "__glXDispSwap_GetPolygonStipple", - "__glXDispSwap_GetSeparableFilter", - "__glXDispSwap_GetString", - "__glXDispSwap_GetTexEnvfv", - "__glXDispSwap_GetTexEnviv", - "__glXDispSwap_GetTexGendv", - "__glXDispSwap_GetTexGenfv", - "__glXDispSwap_GetTexGeniv", - "__glXDispSwap_GetTexImage", - "__glXDispSwap_GetTexLevelParameterfv", - "__glXDispSwap_GetTexLevelParameteriv", - "__glXDispSwap_GetTexParameterfv", - "__glXDispSwap_GetTexParameteriv", - "__glXDispSwap_Hint", - "__glXDispSwap_Histogram", - "__glXDispSwap_IndexMask", - "__glXDispSwap_Indexdv", - "__glXDispSwap_Indexfv", - "__glXDispSwap_Indexiv", - "__glXDispSwap_Indexsv", - "__glXDispSwap_Indexubv", - "__glXDispSwap_InitNames", - "__glXDispSwap_IsEnabled", - "__glXDispSwap_IsList", - "__glXDispSwap_IsTexture", - "__glXDispSwap_IsTextureEXT", - "__glXDispSwap_LightModelf", - "__glXDispSwap_LightModelfv", - "__glXDispSwap_LightModeli", - "__glXDispSwap_LightModeliv", - "__glXDispSwap_Lightf", - "__glXDispSwap_Lightfv", - "__glXDispSwap_Lighti", - "__glXDispSwap_Lightiv", - "__glXDispSwap_LineStipple", - "__glXDispSwap_LineWidth", - "__glXDispSwap_ListBase", - "__glXDispSwap_LoadIdentity", - "__glXDispSwap_LoadMatrixd", - "__glXDispSwap_LoadMatrixf", - "__glXDispSwap_LoadName", - "__glXDispSwap_LogicOp", - "__glXDispSwap_Map1d", - "__glXDispSwap_Map1f", - "__glXDispSwap_Map2d", - "__glXDispSwap_Map2f", - "__glXDispSwap_MapGrid1d", - "__glXDispSwap_MapGrid1f", - "__glXDispSwap_MapGrid2d", - "__glXDispSwap_MapGrid2f", - "__glXDispSwap_Materialf", - "__glXDispSwap_Materialfv", - "__glXDispSwap_Materiali", - "__glXDispSwap_Materialiv", - "__glXDispSwap_MatrixMode", - "__glXDispSwap_Minmax", - "__glXDispSwap_MultMatrixd", - "__glXDispSwap_MultMatrixf", - "__glXDispSwap_MultiTexCoord1dvARB", - "__glXDispSwap_MultiTexCoord1fvARB", - "__glXDispSwap_MultiTexCoord1ivARB", - "__glXDispSwap_MultiTexCoord1svARB", - "__glXDispSwap_MultiTexCoord2dvARB", - "__glXDispSwap_MultiTexCoord2fvARB", - "__glXDispSwap_MultiTexCoord2ivARB", - "__glXDispSwap_MultiTexCoord2svARB", - "__glXDispSwap_MultiTexCoord3dvARB", - "__glXDispSwap_MultiTexCoord3fvARB", - "__glXDispSwap_MultiTexCoord3ivARB", - "__glXDispSwap_MultiTexCoord3svARB", - "__glXDispSwap_MultiTexCoord4dvARB", - "__glXDispSwap_MultiTexCoord4fvARB", - "__glXDispSwap_MultiTexCoord4ivARB", - "__glXDispSwap_MultiTexCoord4svARB", - "__glXDispSwap_NewList", - "__glXDispSwap_Normal3bv", - "__glXDispSwap_Normal3dv", - "__glXDispSwap_Normal3fv", - "__glXDispSwap_Normal3iv", - "__glXDispSwap_Normal3sv", - "__glXDispSwap_Ortho", - "__glXDispSwap_PassThrough", - "__glXDispSwap_PixelMapfv", - "__glXDispSwap_PixelMapuiv", - "__glXDispSwap_PixelMapusv", - "__glXDispSwap_PixelStoref", - "__glXDispSwap_PixelStorei", - "__glXDispSwap_PixelTransferf", - "__glXDispSwap_PixelTransferi", - "__glXDispSwap_PixelZoom", - "__glXDispSwap_PointParameterfARB", - "__glXDispSwap_PointParameterfvARB", - "__glXDispSwap_PointSize", - "__glXDispSwap_PolygonMode", - "__glXDispSwap_PolygonOffset", - "__glXDispSwap_PolygonStipple", - "__glXDispSwap_PopAttrib", - "__glXDispSwap_PopMatrix", - "__glXDispSwap_PopName", - "__glXDispSwap_PrioritizeTextures", - "__glXDispSwap_PushAttrib", - "__glXDispSwap_PushMatrix", - "__glXDispSwap_PushName", - "__glXDispSwap_RasterPos2dv", - "__glXDispSwap_RasterPos2fv", - "__glXDispSwap_RasterPos2iv", - "__glXDispSwap_RasterPos2sv", - "__glXDispSwap_RasterPos3dv", - "__glXDispSwap_RasterPos3fv", - "__glXDispSwap_RasterPos3iv", - "__glXDispSwap_RasterPos3sv", - "__glXDispSwap_RasterPos4dv", - "__glXDispSwap_RasterPos4fv", - "__glXDispSwap_RasterPos4iv", - "__glXDispSwap_RasterPos4sv", - "__glXDispSwap_ReadBuffer", - "__glXDispSwap_ReadPixels", - "__glXDispSwap_Rectdv", - "__glXDispSwap_Rectfv", - "__glXDispSwap_Rectiv", - "__glXDispSwap_Rectsv", - "__glXDispSwap_RenderMode", - "__glXDispSwap_ResetHistogram", - "__glXDispSwap_ResetMinmax", - "__glXDispSwap_Rotated", - "__glXDispSwap_Rotatef", - "__glXDispSwap_Scaled", - "__glXDispSwap_Scalef", - "__glXDispSwap_Scissor", - "__glXDispSwap_SelectBuffer", - "__glXDispSwap_SeparableFilter2D", - "__glXDispSwap_ShadeModel", - "__glXDispSwap_StencilFunc", - "__glXDispSwap_StencilMask", - "__glXDispSwap_StencilOp", - "__glXDispSwap_TexCoord1dv", - "__glXDispSwap_TexCoord1fv", - "__glXDispSwap_TexCoord1iv", - "__glXDispSwap_TexCoord1sv", - "__glXDispSwap_TexCoord2dv", - "__glXDispSwap_TexCoord2fv", - "__glXDispSwap_TexCoord2iv", - "__glXDispSwap_TexCoord2sv", - "__glXDispSwap_TexCoord3dv", - "__glXDispSwap_TexCoord3fv", - "__glXDispSwap_TexCoord3iv", - "__glXDispSwap_TexCoord3sv", - "__glXDispSwap_TexCoord4dv", - "__glXDispSwap_TexCoord4fv", - "__glXDispSwap_TexCoord4iv", - "__glXDispSwap_TexCoord4sv", - "__glXDispSwap_TexEnvf", - "__glXDispSwap_TexEnvfv", - "__glXDispSwap_TexEnvi", - "__glXDispSwap_TexEnviv", - "__glXDispSwap_TexGend", - "__glXDispSwap_TexGendv", - "__glXDispSwap_TexGenf", - "__glXDispSwap_TexGenfv", - "__glXDispSwap_TexGeni", - "__glXDispSwap_TexGeniv", - "__glXDispSwap_TexImage1D", - "__glXDispSwap_TexImage2D", - "__glXDispSwap_TexImage3D", - "__glXDispSwap_TexParameterf", - "__glXDispSwap_TexParameterfv", - "__glXDispSwap_TexParameteri", - "__glXDispSwap_TexParameteriv", - "__glXDispSwap_TexSubImage1D", - "__glXDispSwap_TexSubImage2D", - "__glXDispSwap_TexSubImage3D", - "__glXDispSwap_Translated", - "__glXDispSwap_Translatef", - "__glXDispSwap_Vertex2dv", - "__glXDispSwap_Vertex2fv", - "__glXDispSwap_Vertex2iv", - "__glXDispSwap_Vertex2sv", - "__glXDispSwap_Vertex3dv", - "__glXDispSwap_Vertex3fv", - "__glXDispSwap_Vertex3iv", - "__glXDispSwap_Vertex3sv", - "__glXDispSwap_Vertex4dv", - "__glXDispSwap_Vertex4fv", - "__glXDispSwap_Vertex4iv", - "__glXDispSwap_Vertex4sv", - "__glXDispSwap_Viewport", - "__glXDispSwap_WindowPos3fARB", - "__glXDisp_Accum", - "__glXDisp_ActiveStencilFaceEXT", - "__glXDisp_ActiveTextureARB", - "__glXDisp_AlphaFunc", - "__glXDisp_AreTexturesResident", - "__glXDisp_AreTexturesResidentEXT", - "__glXDisp_Begin", - "__glXDisp_BindTexture", - "__glXDisp_Bitmap", - "__glXDisp_BlendColor", - "__glXDisp_BlendEquation", - "__glXDisp_BlendFunc", - "__glXDisp_CallList", - "__glXDisp_CallLists", - "__glXDisp_Clear", - "__glXDisp_ClearAccum", - "__glXDisp_ClearColor", - "__glXDisp_ClearDepth", - "__glXDisp_ClearIndex", - "__glXDisp_ClearStencil", - "__glXDisp_ClipPlane", - "__glXDisp_Color3bv", - "__glXDisp_Color3dv", - "__glXDisp_Color3fv", - "__glXDisp_Color3iv", - "__glXDisp_Color3sv", - "__glXDisp_Color3ubv", - "__glXDisp_Color3uiv", - "__glXDisp_Color3usv", - "__glXDisp_Color4bv", - "__glXDisp_Color4dv", - "__glXDisp_Color4fv", - "__glXDisp_Color4iv", - "__glXDisp_Color4sv", - "__glXDisp_Color4ubv", - "__glXDisp_Color4uiv", - "__glXDisp_Color4usv", - "__glXDisp_ColorMask", - "__glXDisp_ColorMaterial", - "__glXDisp_ColorSubTable", - "__glXDisp_ColorTable", - "__glXDisp_ColorTableParameterfv", - "__glXDisp_ColorTableParameteriv", - "__glXDisp_ConvolutionFilter1D", - "__glXDisp_ConvolutionFilter2D", - "__glXDisp_ConvolutionParameterf", - "__glXDisp_ConvolutionParameterfv", - "__glXDisp_ConvolutionParameteri", - "__glXDisp_ConvolutionParameteriv", - "__glXDisp_CopyColorSubTable", - "__glXDisp_CopyColorTable", - "__glXDisp_CopyConvolutionFilter1D", - "__glXDisp_CopyConvolutionFilter2D", - "__glXDisp_CopyPixels", - "__glXDisp_CopyTexImage1D", - "__glXDisp_CopyTexImage2D", - "__glXDisp_CopyTexSubImage1D", - "__glXDisp_CopyTexSubImage2D", - "__glXDisp_CopyTexSubImage3D", - "__glXDisp_CullFace", - "__glXDisp_DeleteLists", - "__glXDisp_DeleteTextures", - "__glXDisp_DeleteTexturesEXT", - "__glXDisp_DepthFunc", - "__glXDisp_DepthMask", - "__glXDisp_DepthRange", - "__glXDisp_Disable", - "__glXDisp_DrawArrays", - "__glXDisp_DrawArraysEXT", - "__glXDisp_DrawBuffer", - "__glXDisp_DrawPixels", - "__glXDisp_EdgeFlagv", - "__glXDisp_Enable", - "__glXDisp_End", - "__glXDisp_EndList", - "__glXDisp_EvalCoord1dv", - "__glXDisp_EvalCoord1fv", - "__glXDisp_EvalCoord2dv", - "__glXDisp_EvalCoord2fv", - "__glXDisp_EvalMesh1", - "__glXDisp_EvalMesh2", - "__glXDisp_EvalPoint1", - "__glXDisp_EvalPoint2", - "__glXDisp_FeedbackBuffer", - "__glXDisp_Finish", - "__glXDisp_Flush", - "__glXDisp_Fogf", - "__glXDisp_Fogfv", - "__glXDisp_Fogi", - "__glXDisp_Fogiv", - "__glXDisp_FrontFace", - "__glXDisp_Frustum", - "__glXDisp_GenLists", - "__glXDisp_GenTextures", - "__glXDisp_GenTexturesEXT", - "__glXDisp_GetBooleanv", - "__glXDisp_GetClipPlane", - "__glXDisp_GetColorTable", - "__glXDisp_GetColorTableParameterfv", - "__glXDisp_GetColorTableParameteriv", - "__glXDisp_GetConvolutionFilter", - "__glXDisp_GetConvolutionParameterfv", - "__glXDisp_GetConvolutionParameteriv", - "__glXDisp_GetDoublev", - "__glXDisp_GetError", - "__glXDisp_GetFloatv", - "__glXDisp_GetHistogram", - "__glXDisp_GetHistogramParameterfv", - "__glXDisp_GetHistogramParameteriv", - "__glXDisp_GetIntegerv", - "__glXDisp_GetLightfv", - "__glXDisp_GetLightiv", - "__glXDisp_GetMapdv", - "__glXDisp_GetMapfv", - "__glXDisp_GetMapiv", - "__glXDisp_GetMaterialfv", - "__glXDisp_GetMaterialiv", - "__glXDisp_GetMinmax", - "__glXDisp_GetMinmaxParameterfv", - "__glXDisp_GetMinmaxParameteriv", - "__glXDisp_GetPixelMapfv", - "__glXDisp_GetPixelMapuiv", - "__glXDisp_GetPixelMapusv", - "__glXDisp_GetPolygonStipple", - "__glXDisp_GetSeparableFilter", - "__glXDisp_GetString", - "__glXDisp_GetTexEnvfv", - "__glXDisp_GetTexEnviv", - "__glXDisp_GetTexGendv", - "__glXDisp_GetTexGenfv", - "__glXDisp_GetTexGeniv", - "__glXDisp_GetTexImage", - "__glXDisp_GetTexLevelParameterfv", - "__glXDisp_GetTexLevelParameteriv", - "__glXDisp_GetTexParameterfv", - "__glXDisp_GetTexParameteriv", - "__glXDisp_Hint", - "__glXDisp_Histogram", - "__glXDisp_IndexMask", - "__glXDisp_Indexdv", - "__glXDisp_Indexfv", - "__glXDisp_Indexiv", - "__glXDisp_Indexsv", - "__glXDisp_Indexubv", - "__glXDisp_InitNames", - "__glXDisp_IsEnabled", - "__glXDisp_IsList", - "__glXDisp_IsTexture", - "__glXDisp_IsTextureEXT", - "__glXDisp_LightModelf", - "__glXDisp_LightModelfv", - "__glXDisp_LightModeli", - "__glXDisp_LightModeliv", - "__glXDisp_Lightf", - "__glXDisp_Lightfv", - "__glXDisp_Lighti", - "__glXDisp_Lightiv", - "__glXDisp_LineStipple", - "__glXDisp_LineWidth", - "__glXDisp_ListBase", - "__glXDisp_LoadIdentity", - "__glXDisp_LoadMatrixd", - "__glXDisp_LoadMatrixf", - "__glXDisp_LoadName", - "__glXDisp_LogicOp", - "__glXDisp_Map1d", - "__glXDisp_Map1f", - "__glXDisp_Map2d", - "__glXDisp_Map2f", - "__glXDisp_MapGrid1d", - "__glXDisp_MapGrid1f", - "__glXDisp_MapGrid2d", - "__glXDisp_MapGrid2f", - "__glXDisp_Materialf", - "__glXDisp_Materialfv", - "__glXDisp_Materiali", - "__glXDisp_Materialiv", - "__glXDisp_MatrixMode", - "__glXDisp_Minmax", - "__glXDisp_MultMatrixd", - "__glXDisp_MultMatrixf", - "__glXDisp_MultiTexCoord1dvARB", - "__glXDisp_MultiTexCoord1fvARB", - "__glXDisp_MultiTexCoord1ivARB", - "__glXDisp_MultiTexCoord1svARB", - "__glXDisp_MultiTexCoord2dvARB", - "__glXDisp_MultiTexCoord2fvARB", - "__glXDisp_MultiTexCoord2ivARB", - "__glXDisp_MultiTexCoord2svARB", - "__glXDisp_MultiTexCoord3dvARB", - "__glXDisp_MultiTexCoord3fvARB", - "__glXDisp_MultiTexCoord3ivARB", - "__glXDisp_MultiTexCoord3svARB", - "__glXDisp_MultiTexCoord4dvARB", - "__glXDisp_MultiTexCoord4fvARB", - "__glXDisp_MultiTexCoord4ivARB", - "__glXDisp_MultiTexCoord4svARB", - "__glXDisp_NewList", - "__glXDisp_Normal3bv", - "__glXDisp_Normal3dv", - "__glXDisp_Normal3fv", - "__glXDisp_Normal3iv", - "__glXDisp_Normal3sv", - "__glXDisp_Ortho", - "__glXDisp_PassThrough", - "__glXDisp_PixelMapfv", - "__glXDisp_PixelMapuiv", - "__glXDisp_PixelMapusv", - "__glXDisp_PixelStoref", - "__glXDisp_PixelStorei", - "__glXDisp_PixelTransferf", - "__glXDisp_PixelTransferi", - "__glXDisp_PixelZoom", - "__glXDisp_PointParameterfARB", - "__glXDisp_PointParameterfvARB", - "__glXDisp_PointSize", - "__glXDisp_PolygonMode", - "__glXDisp_PolygonOffset", - "__glXDisp_PolygonStipple", - "__glXDisp_PopAttrib", - "__glXDisp_PopMatrix", - "__glXDisp_PopName", - "__glXDisp_PrioritizeTextures", - "__glXDisp_PushAttrib", - "__glXDisp_PushMatrix", - "__glXDisp_PushName", - "__glXDisp_RasterPos2dv", - "__glXDisp_RasterPos2fv", - "__glXDisp_RasterPos2iv", - "__glXDisp_RasterPos2sv", - "__glXDisp_RasterPos3dv", - "__glXDisp_RasterPos3fv", - "__glXDisp_RasterPos3iv", - "__glXDisp_RasterPos3sv", - "__glXDisp_RasterPos4dv", - "__glXDisp_RasterPos4fv", - "__glXDisp_RasterPos4iv", - "__glXDisp_RasterPos4sv", - "__glXDisp_ReadBuffer", - "__glXDisp_ReadPixels", - "__glXDisp_Rectdv", - "__glXDisp_Rectfv", - "__glXDisp_Rectiv", - "__glXDisp_Rectsv", - "__glXDisp_RenderMode", - "__glXDisp_ResetHistogram", - "__glXDisp_ResetMinmax", - "__glXDisp_Rotated", - "__glXDisp_Rotatef", - "__glXDisp_Scaled", - "__glXDisp_Scalef", - "__glXDisp_Scissor", - "__glXDisp_SelectBuffer", - "__glXDisp_SeparableFilter2D", - "__glXDisp_ShadeModel", - "__glXDisp_StencilFunc", - "__glXDisp_StencilMask", - "__glXDisp_StencilOp", - "__glXDisp_TexCoord1dv", - "__glXDisp_TexCoord1fv", - "__glXDisp_TexCoord1iv", - "__glXDisp_TexCoord1sv", - "__glXDisp_TexCoord2dv", - "__glXDisp_TexCoord2fv", - "__glXDisp_TexCoord2iv", - "__glXDisp_TexCoord2sv", - "__glXDisp_TexCoord3dv", - "__glXDisp_TexCoord3fv", - "__glXDisp_TexCoord3iv", - "__glXDisp_TexCoord3sv", - "__glXDisp_TexCoord4dv", - "__glXDisp_TexCoord4fv", - "__glXDisp_TexCoord4iv", - "__glXDisp_TexCoord4sv", - "__glXDisp_TexEnvf", - "__glXDisp_TexEnvfv", - "__glXDisp_TexEnvi", - "__glXDisp_TexEnviv", - "__glXDisp_TexGend", - "__glXDisp_TexGendv", - "__glXDisp_TexGenf", - "__glXDisp_TexGenfv", - "__glXDisp_TexGeni", - "__glXDisp_TexGeniv", - "__glXDisp_TexImage1D", - "__glXDisp_TexImage2D", - "__glXDisp_TexImage3D", - "__glXDisp_TexParameterf", - "__glXDisp_TexParameterfv", - "__glXDisp_TexParameteri", - "__glXDisp_TexParameteriv", - "__glXDisp_TexSubImage1D", - "__glXDisp_TexSubImage2D", - "__glXDisp_TexSubImage3D", - "__glXDisp_Translated", - "__glXDisp_Translatef", - "__glXDisp_Vertex2dv", - "__glXDisp_Vertex2fv", - "__glXDisp_Vertex2iv", - "__glXDisp_Vertex2sv", - "__glXDisp_Vertex3dv", - "__glXDisp_Vertex3fv", - "__glXDisp_Vertex3iv", - "__glXDisp_Vertex3sv", - "__glXDisp_Vertex4dv", - "__glXDisp_Vertex4fv", - "__glXDisp_Vertex4iv", - "__glXDisp_Vertex4sv", - "__glXDisp_Viewport", - "__glXDisp_WindowPos3fARB", - "__glXDrawArraysSize", - "__glXDrawPixelsReqSize", - "__glXDrawableRes", - "__glXErrorOccured", - "__glXFBInitDrawable", - "__glXFBMemSwapBuffers", - "__glXFindDrawablePrivate", - "__glXFogfvReqSize", - "__glXFogivReqSize", - "__glXForceCurrent", - "__glXFormatGLModes", - "__glXFree", - "__glXFreeBuffers", - "__glXFreeContext", - "__glXGetDrawablePrivate", - "__glXGetVisualConfigs", - "__glXImageSize", - "__glXImpAtoi", - "__glXImpCalloc", - "__glXImpFatal", - "__glXImpFclose", - "__glXImpFopen", - "__glXImpFprintf", - "__glXImpFree", - "__glXImpGetDrawablePrivate", - "__glXImpGetenv", - "__glXImpMalloc", - "__glXImpRealloc", - "__glXImpSprintf", - "__glXImpWarning", - "__glXInitFB", - "__glXInitMem", - "__glXInitPix", - "__glXIsDirect", - "__glXLastContext", - "__glXLightModelfvReqSize", - "__glXLightModelivReqSize", - "__glXLightfvReqSize", - "__glXLightivReqSize", - "__glXLookupContextByTag", - "__glXMakeCurrent", - "__glXMalloc", - "__glXMap1dReqSize", - "__glXMap1fReqSize", - "__glXMap2dReqSize", - "__glXMap2fReqSize", - "__glXMaterialfvReqSize", - "__glXMaterialivReqSize", - "__glXNoSuchRenderOpcode", - "__glXNoSuchSingleOpcode", - "__glXNop", - "__glXPixInitDrawable", - "__glXPixelMapfvReqSize", - "__glXPixelMapuivReqSize", - "__glXPixelMapusvReqSize", - "__glXPixmapRes", - "__glXPrioritizeTexturesReqSize", - "__glXQueryContextInfoEXT", - "__glXQueryExtensionsString", - "__glXQueryServerString", - "__glXQueryVersion", - "__glXRealloc", - "__glXRender", - "__glXRenderLarge", - "__glXRenderSizeTable", - "__glXRenderSizeTable_EXT", - "__glXRenderTable", - "__glXRenderTable_EXT", - "__glXReply", - "__glXResetLargeCommandStatus", - "__glXResizeBuffers", - "__glXResizeDrawableBuffers", - "__glXScreenInit", - "__glXScreenReset", - "__glXSeparableFilter2DReqSize", - "__glXSingleTable", - "__glXSwapBuffers", - "__glXSwapClientInfo", - "__glXSwapCopyContext", - "__glXSwapCreateContext", - "__glXSwapCreateGLXPixmap", - "__glXSwapDestroyContext", - "__glXSwapDestroyGLXPixmap", - "__glXSwapGetVisualConfigs", - "__glXSwapIsDirect", - "__glXSwapIsDirectReply", - "__glXSwapMakeCurrent", - "__glXSwapMakeCurrentReply", - "__glXSwapQueryContextInfoEXTReply", - "__glXSwapQueryExtensionsString", - "__glXSwapQueryServerString", - "__glXSwapQueryVersion", - "__glXSwapQueryVersionReply", - "__glXSwapRender", - "__glXSwapRenderLarge", - "__glXSwapRenderTable", - "__glXSwapRenderTable_EXT", - "__glXSwapSingleTable", - "__glXSwapSwapBuffers", - "__glXSwapUseXFont", - "__glXSwapVendorPrivTable_EXT", - "__glXSwapVendorPrivate", - "__glXSwapVendorPrivateWithReply", - "__glXSwapWaitGL", - "__glXSwapWaitX", - "__glXTexEnvfvReqSize", - "__glXTexEnvivReqSize", - "__glXTexGendvReqSize", - "__glXTexGenfvReqSize", - "__glXTexGenivReqSize", - "__glXTexImage1DReqSize", - "__glXTexImage2DReqSize", - "__glXTexImage3DReqSize", - "__glXTexParameterfvReqSize", - "__glXTexParameterivReqSize", - "__glXTexSubImage1DReqSize", - "__glXTexSubImage2DReqSize", - "__glXTexSubImage3DReqSize", - "__glXTypeSize", - "__glXUnrefDrawablePrivate", - "__glXUnsupportedPrivateRequest", - "__glXUseXFont", - "__glXVendorPrivTable_EXT", - "__glXVendorPrivate", - "__glXVendorPrivateWithReply", - "__glXWaitGL", - "__glXWaitX", - "__glXcombine_strings", - "glAccum", - "glActiveStencilFaceEXT", - "glActiveTextureARB", - "glAlphaFunc", - "glAreTexturesResident", - "glAreTexturesResidentEXT", - "glBegin", - "glBindTexture", - "glBitmap", - "glBlendColor", - "glBlendEquation", - "glBlendFunc", - "glCallList", - "glCallLists", - "glClear", - "glClearAccum", - "glClearColor", - "glClearDepth", - "glClearIndex", - "glClearStencil", - "glClipPlane", - "glColor3bv", - "glColor3dv", - "glColor3fv", - "glColor3iv", - "glColor3sv", - "glColor3ubv", - "glColor3uiv", - "glColor3usv", - "glColor4bv", - "glColor4dv", - "glColor4fv", - "glColor4iv", - "glColor4sv", - "glColor4ubv", - "glColor4uiv", - "glColor4usv", - "glColorMask", - "glColorMaterial", - "glColorPointer", - "glColorSubTable", - "glColorTable", - "glColorTableParameterfv", - "glColorTableParameteriv", - "glConvolutionFilter1D", - "glConvolutionFilter2D", - "glConvolutionParameterf", - "glConvolutionParameterfv", - "glConvolutionParameteri", - "glConvolutionParameteriv", - "glCopyColorSubTable", - "glCopyColorTable", - "glCopyConvolutionFilter1D", - "glCopyConvolutionFilter2D", - "glCopyPixels", - "glCopyTexImage1D", - "glCopyTexImage2D", - "glCopyTexSubImage1D", - "glCopyTexSubImage2D", - "glCopyTexSubImage3D", - "glCullFace", - "glDeleteLists", - "glDeleteTextures", - "glDeleteTexturesEXT", - "glDepthFunc", - "glDepthMask", - "glDepthRange", - "glDisable", - "glDisableClientState", - "glDrawArrays", - "glDrawBuffer", - "glDrawPixels", - "glEdgeFlagPointer", - "glEdgeFlagv", - "glEnable", - "glEnableClientState", - "glEnd", - "glEndList", - "glEvalCoord1dv", - "glEvalCoord1fv", - "glEvalCoord2dv", - "glEvalCoord2fv", - "glEvalMesh1", - "glEvalMesh2", - "glEvalPoint1", - "glEvalPoint2", - "glFeedbackBuffer", - "glFinish", - "glFlush", - "glFogf", - "glFogfv", - "glFogi", - "glFogiv", - "glFrontFace", - "glFrustum", - "glGenLists", - "glGenTextures", - "glGenTexturesEXT", - "glGetBooleanv", - "glGetClipPlane", - "glGetColorTable", - "glGetColorTableParameterfv", - "glGetColorTableParameteriv", - "glGetConvolutionFilter", - "glGetConvolutionParameterfv", - "glGetConvolutionParameteriv", - "glGetDoublev", - "glGetError", - "glGetFloatv", - "glGetHistogram", - "glGetHistogramParameterfv", - "glGetHistogramParameteriv", - "glGetIntegerv", - "glGetLightfv", - "glGetLightiv", - "glGetMapdv", - "glGetMapfv", - "glGetMapiv", - "glGetMaterialfv", - "glGetMaterialiv", - "glGetMinmax", - "glGetMinmaxParameterfv", - "glGetMinmaxParameteriv", - "glGetPixelMapfv", - "glGetPixelMapuiv", - "glGetPixelMapusv", - "glGetPolygonStipple", - "glGetSeparableFilter", - "glGetString", - "glGetTexEnvfv", - "glGetTexEnviv", - "glGetTexGendv", - "glGetTexGenfv", - "glGetTexGeniv", - "glGetTexImage", - "glGetTexLevelParameterfv", - "glGetTexLevelParameteriv", - "glGetTexParameterfv", - "glGetTexParameteriv", - "glHint", - "glHistogram", - "glIndexMask", - "glIndexPointer", - "glIndexdv", - "glIndexfv", - "glIndexiv", - "glIndexsv", - "glIndexubv", - "glInitNames", - "glIsEnabled", - "glIsList", - "glIsTexture", - "glIsTextureEXT", - "glLightModelf", - "glLightModelfv", - "glLightModeli", - "glLightModeliv", - "glLightf", - "glLightfv", - "glLighti", - "glLightiv", - "glLineStipple", - "glLineWidth", - "glListBase", - "glLoadIdentity", - "glLoadMatrixd", - "glLoadMatrixf", - "glLoadName", - "glLogicOp", - "glMap1d", - "glMap1f", - "glMap2d", - "glMap2f", - "glMapGrid1d", - "glMapGrid1f", - "glMapGrid2d", - "glMapGrid2f", - "glMaterialf", - "glMaterialfv", - "glMateriali", - "glMaterialiv", - "glMatrixMode", - "glMinmax", - "glMultMatrixd", - "glMultMatrixf", - "glMultiTexCoord1dvARB", - "glMultiTexCoord1fvARB", - "glMultiTexCoord1ivARB", - "glMultiTexCoord1svARB", - "glMultiTexCoord2dvARB", - "glMultiTexCoord2fvARB", - "glMultiTexCoord2ivARB", - "glMultiTexCoord2svARB", - "glMultiTexCoord3dvARB", - "glMultiTexCoord3fvARB", - "glMultiTexCoord3ivARB", - "glMultiTexCoord3svARB", - "glMultiTexCoord4dvARB", - "glMultiTexCoord4fvARB", - "glMultiTexCoord4ivARB", - "glMultiTexCoord4svARB", - "glNewList", - "glNormal3bv", - "glNormal3dv", - "glNormal3fv", - "glNormal3iv", - "glNormal3sv", - "glNormalPointer", - "glOrtho", - "glPassThrough", - "glPixelMapfv", - "glPixelMapuiv", - "glPixelMapusv", - "glPixelStoref", - "glPixelStorei", - "glPixelTransferf", - "glPixelTransferi", - "glPixelZoom", - "glPointParameterfARB", - "glPointParameterfvARB", - "glPointSize", - "glPolygonMode", - "glPolygonOffset", - "glPolygonStipple", - "glPopAttrib", - "glPopMatrix", - "glPopName", - "glPrioritizeTextures", - "glPushAttrib", - "glPushMatrix", - "glPushName", - "glRasterPos2dv", - "glRasterPos2fv", - "glRasterPos2iv", - "glRasterPos2sv", - "glRasterPos3dv", - "glRasterPos3fv", - "glRasterPos3iv", - "glRasterPos3sv", - "glRasterPos4dv", - "glRasterPos4fv", - "glRasterPos4iv", - "glRasterPos4sv", - "glReadBuffer", - "glReadPixels", - "glRectdv", - "glRectfv", - "glRectiv", - "glRectsv", - "glRenderMode", - "glResetHistogram", - "glResetMinmax", - "glRotated", - "glRotatef", - "glScaled", - "glScalef", - "glScissor", - "glSelectBuffer", - "glSeparableFilter2D", - "glShadeModel", - "glStencilFunc", - "glStencilMask", - "glStencilOp", - "glTexCoord1dv", - "glTexCoord1fv", - "glTexCoord1iv", - "glTexCoord1sv", - "glTexCoord2dv", - "glTexCoord2fv", - "glTexCoord2iv", - "glTexCoord2sv", - "glTexCoord3dv", - "glTexCoord3fv", - "glTexCoord3iv", - "glTexCoord3sv", - "glTexCoord4dv", - "glTexCoord4fv", - "glTexCoord4iv", - "glTexCoord4sv", - "glTexCoordPointer", - "glTexEnvf", - "glTexEnvfv", - "glTexEnvi", - "glTexEnviv", - "glTexGend", - "glTexGendv", - "glTexGenf", - "glTexGenfv", - "glTexGeni", - "glTexGeniv", - "glTexImage1D", - "glTexImage2D", - "glTexImage3D", - "glTexParameterf", - "glTexParameterfv", - "glTexParameteri", - "glTexParameteriv", - "glTexSubImage1D", - "glTexSubImage2D", - "glTexSubImage3D", - "glTranslated", - "glTranslatef", - "glVertex2dv", - "glVertex2fv", - "glVertex2iv", - "glVertex2sv", - "glVertex3dv", - "glVertex3fv", - "glVertex3iv", - "glVertex3sv", - "glVertex4dv", - "glVertex4fv", - "glVertex4iv", - "glVertex4sv", - "glVertexPointer", - "glViewport", - "glWindowPos3fARB", - "glxSwapQueryExtensionsStringReply", - "glxSwapQueryServerStringReply", - NULL -}; - -static XF86ModuleVersionInfo VersRec = -{ - "glx", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XF86_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_EXTENSION, - ABI_EXTENSION_VERSION, - MOD_CLASS_NONE, - {0,0,0,0} -}; - -XF86ModuleData glxModuleData = { &VersRec, glxSetup, NULL }; - -static pointer -glxSetup(pointer module, pointer opts, int *errmaj, int *errmin) -{ - static Bool setupDone = FALSE; - pointer GLcore = NULL; -#ifdef GLX_USE_SGI_SI - char GLcoreName[] = "GL"; -#else - char GLcoreName[] = "GLcore"; -#endif - - if (!setupDone) { - setupDone = TRUE; - - GLcore = LoadSubModule(module, GLcoreName, NULL, NULL, NULL, NULL, - errmaj, errmin); - if (!GLcore) { - if (errmaj) *errmaj = LDR_NOSUBENT; - } else { - LoaderReqSymLists(glcoreSymbols, NULL); - LoadExtension(&GLXExt, FALSE); - /* Wrap the init visuals routine in micmap.c */ - GlxWrapInitVisuals(&miInitVisualsProc); - /* Make sure this gets wrapped each time InitVisualWrap is called */ - miHookInitVisuals(NULL, GlxWrapInitVisuals); - } - } else { - if (errmaj) *errmaj = LDR_ONCEONLY; - } - /* Need a non-NULL return value to indicate success */ - return GLcore; -} Index: xc/programs/Xserver/GL/apple/Imakefile diff -u xc/programs/Xserver/GL/apple/Imakefile:1.3 xc/programs/Xserver/GL/apple/Imakefile:1.5 --- xc/programs/Xserver/GL/apple/Imakefile:1.3 Tue Feb 10 17:47:57 2004 +++ xc/programs/Xserver/GL/apple/Imakefile Fri Dec 10 12:52:46 2004 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/apple/Imakefile,v 1.3 2004/02/10 22:47:57 torrey Exp $ +XCOMM $XFree86: xc/programs/Xserver/GL/apple/Imakefile,v 1.5 2004/12/10 17:52:46 alanh Exp $ #include @@ -35,7 +35,8 @@ -I$(SERVERSRC)/render -I$(SERVERSRC)/GL/include \ -I$(SERVERSRC)/GL/glx -I$(SERVERSRC)/hw/darwin/quartz/cr \ -I$(SERVERSRC)/hw/darwin/quartz $(GL_INCLUDES) \ - -I$(MESASRCDIR)/src + -I$(MESASRCDIR)/include -I$(MESASRCDIR)/src/mesa/glapi \ + -I$(XF86OSSRC) DEFINES = $(GLX_DEFINES) Index: xc/programs/Xserver/GL/apple/aglGlx.c diff -u xc/programs/Xserver/GL/apple/aglGlx.c:1.3 xc/programs/Xserver/GL/apple/aglGlx.c:1.4 --- xc/programs/Xserver/GL/apple/aglGlx.c:1.3 Sun Oct 12 20:30:54 2003 +++ xc/programs/Xserver/GL/apple/aglGlx.c Fri Dec 10 12:52:46 2004 @@ -1,10 +1,14 @@ /* * GLX implementation that uses Apple's AGL.framework for OpenGL + * + * FIXME: This file and indirect.c are very similar. The two should be + * merged by introducing suitable abstractions. */ /* * Copyright (c) 2002 Greg Parker. All Rights Reserved. + * Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved. * - * Portions of this file are copied from xf86glx.c, + * Large portions of this file are copied from Mesa's xf86glx.c, * which contains the following copyright: * * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -27,12 +31,8 @@ * 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(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. */ -/* $XFree86: xc/programs/Xserver/GL/apple/aglGlx.c,v 1.3 2003/10/13 00:30:54 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/apple/aglGlx.c,v 1.4 2004/12/10 17:52:46 alanh Exp $ */ #include "quartzCommon.h" #include @@ -58,6 +58,11 @@ #include #undef BOOL +#include "glcontextmodes.h" + +// ggs: needed to call back to glx with visual configs +extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **configprivs); + // Write debugging output, or not #ifdef GLAQUA_DEBUG #define GLAQUA_DEBUG_MSG ErrorF @@ -84,14 +89,14 @@ // some prototypes static Bool glAquaScreenProbe(int screen); static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB); + int *nvisualp, int *ndepthp, + int *rootDepthp, VisualID *defaultVisp, + unsigned long sizes, int bitsPerRGB); static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates); + void **privates); static __GLinterface *glAquaCreateContext(__GLimports *imports, - __GLcontextModes *mode, - __GLinterface *shareGC); + __GLcontextModes *mode, + __GLinterface *shareGC); static void glAquaCreateBuffer(__GLXdrawablePrivate *glxPriv); static void glAquaResetExtension(void); @@ -102,14 +107,14 @@ * __glXScreenInit to initialize each of the active screens * (__glXActiveScreens[]). Several of the fields must be initialized by * the screenProbe routine before they are copied to the active screens - * struct. In particular, the contextCreate, pGlxVisual, numVisuals, + * struct. In particular, the contextCreate, modes, numVisuals, * and numUsableVisuals fields must be initialized. */ -__GLXscreenInfo __glDDXScreenInfo = { +static __GLXscreenInfo __glDDXScreenInfo = { glAquaScreenProbe, /* Must be generic and handle all screens */ glAquaCreateContext, /* Substitute screen's createContext routine */ glAquaCreateBuffer, /* Substitute screen's createBuffer routine */ - NULL, /* Set up pGlxVisual in probe */ + NULL, /* Set up modes in probe */ NULL, /* Set up pVisualPriv in probe */ 0, /* Set up numVisuals in probe */ 0, /* Set up numUsableVisuals in probe */ @@ -119,13 +124,20 @@ NULL /* WrappedPositionWindow is overwritten */ }; -__GLXextensionInfo __glDDXExtensionInfo = { +void *__glXglDDXScreenInfo(void) { + return &__glDDXScreenInfo; +} + +static __GLXextensionInfo __glDDXExtensionInfo = { GL_CORE_APPLE, glAquaResetExtension, glAquaInitVisuals, glAquaSetVisualConfigs }; +void *__glXglDDXExtensionInfo(void) { + return &__glDDXExtensionInfo; +} // prototypes @@ -134,7 +146,7 @@ static GLboolean glAquaMakeCurrent(__GLcontext *gc); static GLboolean glAquaShareContext(__GLcontext *gc, __GLcontext *gcShare); static GLboolean glAquaCopyContext(__GLcontext *dst, const __GLcontext *src, - GLuint mask); + GLuint mask); static GLboolean glAquaForceCurrent(__GLcontext *gc); /* Drawing surface notification callbacks */ @@ -168,7 +180,7 @@ typedef struct { int num_vis; - __GLXvisualConfig *glx_vis; + __GLcontextModes *modes; void **priv; // wrapped screen functions @@ -192,6 +204,7 @@ AGLContext ctx; AGLPixelFormat pixelFormat; + Bool isAttached; // TRUE if ctx is really attached to a window }; @@ -206,22 +219,28 @@ if (gc->pixelFormat) aglDestroyPixelFormat(gc->pixelFormat); free(gc); } + return GL_TRUE; } static GLboolean glAquaLoseCurrent(__GLcontext *gc) { - // GLAQUA_DEBUG_MSG("glAquaLoseCurrent (ctx 0x%x)\n", gc->ctx); + GLAQUA_DEBUG_MSG("glAquaLoseCurrent (ctx 0x%x)\n", gc->ctx); + aglSetCurrentContext(NULL); __glXLastContext = NULL; // Mesa does this; why? + gc->isAttached = FALSE; + return GL_TRUE; } -// (x, y, w, h) is global coordinates of view or -1 -// glPriv may be NULL -static void attach(__GLcontext *gc, __GLdrawablePrivate *glPriv, - int x, int y, int w, int h) + +/* + * Attach a GL context to a GL drawable + * If glPriv is NULL, the context is detached. + */ +static void attach(__GLcontext *gc, __GLdrawablePrivate *glPriv) { __GLXdrawablePrivate *glxPriv; @@ -244,7 +263,15 @@ CRWindowPtr crWinPtr; AGLDrawable newPort; - crWinPtr = (CRWindowPtr) quartzProcs->FrameForWindow(pWin, TRUE); + if (glPriv->width <= 0 || glPriv->height <= 0) { + // attach to zero size drawable - will really attach later + GLAQUA_DEBUG_MSG("couldn't attach to zero size drawable\n"); + aglSetDrawable(gc->ctx, NULL); + gc->isAttached = FALSE; + return; + } + + crWinPtr = (CRWindowPtr) quartzProcs->FrameForWindow(pWin, FALSE); if (crWinPtr) { newPort = (AGLDrawable) crWinPtr->port; @@ -253,35 +280,43 @@ } if (newPort) { - // fixme won't be a CGrafPtr if currently offscreen or fullscreen + // FIXME: won't be a CGrafPtr if currently offscreen or fullscreen AGLDrawable oldPort = aglGetDrawable(gc->ctx); // AGLDrawable newPort = GetWindowPort(window); - GLint frame[4] = {x, y, w, h}; // fixme multi-screen? - // frame is now X11-global + + // Frame is GLdrawable in X11 global coordinates + // FIXME: Does this work for multiple screens? + GLint frame[4] = {glPriv->xOrigin, glPriv->yOrigin, glPriv->width, glPriv->height}; + GLAQUA_DEBUG_MSG("global size %d %d %d %d\n", + frame[0], frame[1], frame[2], frame[3]); + + // Convert to window-local coordinates frame[0] -= topWin->drawable.x - topWin->borderWidth; frame[1] -= topWin->drawable.y - topWin->borderWidth; - // frame is now window-local - // GL uses flipped coordinates + + // AGL uses flipped coordinates frame[1] = topWin->drawable.height + 2*topWin->borderWidth - frame[1] - frame[3]; - // GLAQUA_DEBUG_MSG("local size %d %d %d %d\n", - // frame[0], frame[1], frame[2], frame[3]); + GLAQUA_DEBUG_MSG("local size %d %d %d %d\n", + frame[0], frame[1], frame[2], frame[3]); if (oldPort != newPort) { - // fixme retain/release windows - aglSetDrawable(gc->ctx, newPort); + // FIXME: retain/release windows + if (!aglSetDrawable(gc->ctx, newPort)) return; } - aglSetInteger(gc->ctx, AGL_BUFFER_RECT, frame); - aglEnable(gc->ctx, AGL_BUFFER_RECT); - // aglSetInteger(gc->ctx, AGL_SWAP_RECT, frame); - // aglEnable(gc->ctx, AGL_SWAP_RECT); - aglUpdateContext(gc->ctx); + if (!aglSetInteger(gc->ctx, AGL_BUFFER_RECT, frame)) return; + if (!aglEnable(gc->ctx, AGL_BUFFER_RECT)) return; + if (!aglSetInteger(gc->ctx, AGL_SWAP_RECT, frame)) return; + if (!aglEnable(gc->ctx, AGL_SWAP_RECT)) return; + if (!aglUpdateContext(gc->ctx)) return; + gc->isAttached = TRUE; - GLAQUA_DEBUG_MSG("attached\n"); + GLAQUA_DEBUG_MSG("attached context 0x%x to window 0x%x\n", gc->ctx, + pWin->drawable.id); } else { // attach to not-yet-realized window - will really attach later - GLAQUA_DEBUG_MSG("couldn't attach\n"); + GLAQUA_DEBUG_MSG("couldn't attach to unrealized window\n"); aglSetDrawable(gc->ctx, NULL); gc->isAttached = FALSE; } @@ -294,14 +329,14 @@ static GLboolean glAquaMakeCurrent(__GLcontext *gc) { -#if 0 __GLdrawablePrivate *glPriv = gc->interface.imports.getDrawablePrivate(gc); + GLAQUA_DEBUG_MSG("glAquaMakeCurrent (ctx 0x%x)\n", gc->ctx); if (!gc->isAttached) { - attach(gc, glPriv, glPriv->xOrigin, glPriv->yOrigin, glPriv->width, glPriv->height); + attach(gc, glPriv); } -#endif + return aglSetCurrentContext(gc->ctx); } @@ -317,8 +352,8 @@ GLuint mask) { GLAQUA_DEBUG_MSG("glAquaCopyContext\n"); - aglCopyContext(src->ctx, dst->ctx, mask); - return GL_TRUE; + + return aglCopyContext(src->ctx, dst->ctx, mask); } static GLboolean glAquaForceCurrent(__GLcontext *gc) @@ -436,16 +471,15 @@ } static __GLinterface *glAquaCreateContext(__GLimports *imports, - __GLcontextModes *mode, - __GLinterface *shareGC) + __GLcontextModes *mode, + __GLinterface *shareGC) { __GLcontext *result; __GLcontext *sharectx = (__GLcontext *)shareGC; - GLint value; GLAQUA_DEBUG_MSG("glAquaCreateContext\n"); - result = (__GLcontext *)malloc(sizeof(__GLcontext)); + result = (__GLcontext *)calloc(1, sizeof(__GLcontext)); if (!result) return NULL; result->interface.imports = *imports; @@ -468,10 +502,6 @@ result->isAttached = FALSE; - // Tell aglSwapBuffers to wait for vertical retrace - value = 1; - aglSetInteger(result->ctx, AGL_SWAP_INTERVAL, &value); - GLAQUA_DEBUG_MSG("glAquaCreateContext done\n"); return (__GLinterface *)result; } @@ -505,17 +535,15 @@ GLAQUA_DEBUG_MSG("glAquaRealizeWindow is GL drawable!\n"); // GL contexts bound to this window for drawing - for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->next) { + for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->nextDrawPriv) { gc = (__GLcontext *)gx->gc; - attach(gc, glPriv, glxPriv->xorigin, glxPriv->yorigin, - glxPriv->width, glxPriv->height); + attach(gc, glPriv); } // GL contexts bound to this window for reading - for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->next) { + for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->nextReadPriv) { gc = (__GLcontext *)gx->gc; - attach(gc, glPriv, glxPriv->xorigin, glxPriv->yorigin, - glxPriv->width, glxPriv->height); + attach(gc, glPriv); } } @@ -544,15 +572,15 @@ GLAQUA_DEBUG_MSG("glAquaUnealizeWindow is GL drawable!\n"); // GL contexts bound to this window for drawing - for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->next) { + for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->nextDrawPriv) { gc = (__GLcontext *)gx->gc; - attach(gc, NULL, 0, 0, 0, 0); + attach(gc, NULL); } // GL contexts bound to this window for reading - for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->next) { + for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->nextReadPriv) { gc = (__GLcontext *)gx->gc; - attach(gc, NULL, 0, 0, 0, 0); + attach(gc, NULL); } } @@ -564,23 +592,21 @@ } - - - - -/* - * In the case the driver has no GLX visuals we'll use these. - * [0] = RGB, double buffered - * [1] = RGB, double buffered, stencil, accum - */ // Originally copied from Mesa static int numConfigs = 0; static __GLXvisualConfig *visualConfigs = NULL; static void **visualPrivates = NULL; -#define NUM_FALLBACK_CONFIGS 2 +/* + * In the case the driver defines no GLX visuals we'll use these. + * Note that for TrueColor and DirectColor visuals, bufferSize is the + * sum of redSize, greenSize, blueSize and alphaSize, which may be larger + * than the nplanes/rootDepth of the server's X11 visuals + */ +#define NUM_FALLBACK_CONFIGS 5 static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { + /* [0] = RGB, double buffered, Z */ { -1, /* vid */ -1, /* class */ @@ -595,11 +621,12 @@ 0, /* stencilSize */ 0, /* auxBuffers */ 0, /* level */ - GLX_NONE_EXT, /* visualRating */ - 0, /* transparentPixel */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ 0 /* transparentIndex */ }, + /* [1] = RGB, double buffered, Z, stencil, accum */ { -1, /* vid */ -1, /* class */ @@ -614,15 +641,94 @@ 8, /* stencilSize */ 0, /* auxBuffers */ 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + /* [2] = RGB+Alpha, double buffered, Z, stencil, accum */ + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 8, /* rgba sizes */ + -1, -1, -1, -1, /* rgba masks */ + 16, 16, 16, 16, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 8, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + /* [3] = RGB+Alpha, single buffered, Z, stencil, accum */ + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 8, /* rgba sizes */ + -1, -1, -1, -1, /* rgba masks */ + 16, 16, 16, 16, /* rgba accum sizes */ + False, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 8, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + /* [4] = CI, double buffered, Z */ + { + -1, /* vid */ + -1, /* class */ + False, /* rgba? (false = color index) */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 0, 0, 0, 0, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 0, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, +}; + +static __GLXvisualConfig NullConfig = { + -1, /* vid */ + -1, /* class */ + False, /* rgba */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 0, 0, 0, 0, /* rgba accum sizes */ + False, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 0, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ GLX_NONE_EXT, /* visualRating */ 0, /* transparentPixel */ 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ 0 /* transparentIndex */ - } }; - static int count_bits(unsigned int n) { int bits = 0; @@ -635,11 +741,10 @@ } -// Mostly copied from Mesa's xf86glx.c static Bool init_visuals(int *nvisualp, VisualPtr *visualp, - VisualID *defaultVisp, - int ndepth, DepthPtr pdepth, - int rootDepth) + VisualID *defaultVisp, + int ndepth, DepthPtr pdepth, + int rootDepth) { int numRGBconfigs; int numCIconfigs; @@ -649,7 +754,7 @@ VisualPtr pVisual = *visualp; VisualPtr pVisualNew = NULL; VisualID *orig_vid = NULL; - __GLXvisualConfig *glXVisualPtr = NULL; + __GLcontextModes *modes; __GLXvisualConfig *pNewVisualConfigs = NULL; void **glXVisualPriv; void **pNewVisualPriv; @@ -667,14 +772,14 @@ pNewVisualConfigs = (__GLXvisualConfig *) __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); if (!pNewVisualConfigs) { - return FALSE; + return FALSE; } /* Alloc space for the list of new GLX visual privates */ pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *)); if (!pNewVisualPriv) { - __glXFree(pNewVisualConfigs); - return FALSE; + __glXFree(pNewVisualConfigs); + return FALSE; } /* @@ -682,9 +787,9 @@ ** visual configs. */ if (numConfigs == 0) { - memcpy(pNewVisualConfigs, FallbackConfigs, + memcpy(pNewVisualConfigs, FallbackConfigs, NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig)); - memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); + memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); } else { /* copy driver's visual config info */ @@ -698,18 +803,24 @@ numRGBconfigs = 0; numCIconfigs = 0; for (i = 0; i < numNewConfigs; i++) { - if (pNewVisualConfigs[i].rgba) - numRGBconfigs++; - else - numCIconfigs++; + if (pNewVisualConfigs[i].rgba) + numRGBconfigs++; + else + numCIconfigs++; } /* Count the total number of visuals to compute */ numNewVisuals = 0; for (i = 0; i < numVisuals; i++) { - numNewVisuals += - (pVisual[i].class == TrueColor || pVisual[i].class == DirectColor) - ? numRGBconfigs : numCIconfigs; + int count; + + count = ((pVisual[i].class == TrueColor || + pVisual[i].class == DirectColor) + ? numRGBconfigs : numCIconfigs); + if (count == 0) + count = 1; /* preserve the existing visual */ + + numNewVisuals += count; } /* Reset variables for use with the next screen/driver's visual configs */ @@ -719,127 +830,159 @@ /* Alloc temp space for the list of orig VisualIDs for each new visual */ orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID)); if (!orig_vid) { - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; } /* Alloc space for the list of glXVisuals */ - glXVisualPtr = (__GLXvisualConfig *)__glXMalloc(numNewVisuals * - sizeof(__GLXvisualConfig)); - if (!glXVisualPtr) { - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; + modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); + if (modes == NULL) { + __glXFree(orig_vid); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; } /* Alloc space for the list of glXVisualPrivates */ glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); if (!glXVisualPriv) { - __glXFree(glXVisualPtr); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; + _gl_context_modes_destroy( modes ); + __glXFree(orig_vid); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; } /* Alloc space for the new list of the X server's visuals */ pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); if (!pVisualNew) { - __glXFree(glXVisualPriv); - __glXFree(glXVisualPtr); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; + __glXFree(glXVisualPriv); + _gl_context_modes_destroy( modes ); + __glXFree(orig_vid); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; } /* Initialize the new visuals */ found_default = FALSE; + glAquaScreens[screenInfo.numScreens-1].modes = modes; for (i = j = 0; i < numVisuals; i++) { int is_rgb = (pVisual[i].class == TrueColor || - pVisual[i].class == DirectColor); + pVisual[i].class == DirectColor); + + if (!is_rgb) + { + /* We don't support non-rgb visuals for GL. But we don't + want to remove them either, so just pass them through + with null glX configs */ + + pVisualNew[j] = pVisual[i]; + pVisualNew[j].vid = FakeClientID(0); + + /* Check for the default visual */ + if (!found_default && pVisual[i].vid == *defaultVisp) { + *defaultVisp = pVisualNew[j].vid; + found_default = TRUE; + } + + /* Save the old VisualID */ + orig_vid[j] = pVisual[i].vid; - for (k = 0; k < numNewConfigs; k++) { - if (pNewVisualConfigs[k].rgba != is_rgb) - continue; - - /* Initialize the new visual */ - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } - - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; - - /* Initialize the glXVisual */ - glXVisualPtr[j] = pNewVisualConfigs[k]; - glXVisualPtr[j].vid = pVisualNew[j].vid; - - /* - * If the class is -1, then assume the X visual information - * is identical to what GLX needs, and take them from the X - * visual. NOTE: if class != -1, then all other fields MUST - * be initialized. - */ - if (glXVisualPtr[j].class == -1) { - glXVisualPtr[j].class = pVisual[i].class; - glXVisualPtr[j].redSize = count_bits(pVisual[i].redMask); - glXVisualPtr[j].greenSize = count_bits(pVisual[i].greenMask); - glXVisualPtr[j].blueSize = count_bits(pVisual[i].blueMask); - glXVisualPtr[j].alphaSize = glXVisualPtr[j].alphaSize; - glXVisualPtr[j].redMask = pVisual[i].redMask; - glXVisualPtr[j].greenMask = pVisual[i].greenMask; - glXVisualPtr[j].blueMask = pVisual[i].blueMask; - glXVisualPtr[j].alphaMask = glXVisualPtr[j].alphaMask; - glXVisualPtr[j].bufferSize = rootDepth; - } + /* Initialize the glXVisual */ + _gl_copy_visual_to_context_mode( modes, & NullConfig ); + modes->visualID = pVisualNew[j].vid; - /* Save the device-dependent private for this visual */ - glXVisualPriv[j] = pNewVisualPriv[k]; + j++; - j++; - } + continue; + } + + for (k = 0; k < numNewConfigs; k++) { + if (pNewVisualConfigs[k].rgba != is_rgb) + continue; + + assert( modes != NULL ); + + /* Initialize the new visual */ + pVisualNew[j] = pVisual[i]; + pVisualNew[j].vid = FakeClientID(0); + + /* Check for the default visual */ + if (!found_default && pVisual[i].vid == *defaultVisp) { + *defaultVisp = pVisualNew[j].vid; + found_default = TRUE; + } + + /* Save the old VisualID */ + orig_vid[j] = pVisual[i].vid; + + /* Initialize the glXVisual */ + _gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] ); + modes->visualID = pVisualNew[j].vid; + + /* + * If the class is -1, then assume the X visual information + * is identical to what GLX needs, and take them from the X + * visual. NOTE: if class != -1, then all other fields MUST + * be initialized. + */ + if (modes->visualType == GLX_NONE) { + modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class ); + modes->redBits = count_bits(pVisual[i].redMask); + modes->greenBits = count_bits(pVisual[i].greenMask); + modes->blueBits = count_bits(pVisual[i].blueMask); + modes->alphaBits = modes->alphaBits; + modes->redMask = pVisual[i].redMask; + modes->greenMask = pVisual[i].greenMask; + modes->blueMask = pVisual[i].blueMask; + modes->alphaMask = modes->alphaMask; + modes->rgbBits = (is_rgb) + ? (modes->redBits + modes->greenBits + + modes->blueBits + modes->alphaBits) + : rootDepth; + } + + /* Save the device-dependent private for this visual */ + glXVisualPriv[j] = pNewVisualPriv[k]; + + j++; + modes = modes->next; + } } assert(j <= numNewVisuals); /* Save the GLX visuals in the screen structure */ glAquaScreens[screenInfo.numScreens-1].num_vis = numNewVisuals; - glAquaScreens[screenInfo.numScreens-1].glx_vis = glXVisualPtr; glAquaScreens[screenInfo.numScreens-1].priv = glXVisualPriv; /* Set up depth's VisualIDs */ for (i = 0; i < ndepth; i++) { - int numVids = 0; - VisualID *pVids = NULL; - int k, n = 0; - - /* Count the new number of VisualIDs at this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - numVids++; - - /* Allocate a new list of VisualIDs for this depth */ - pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); - - /* Initialize the new list of VisualIDs for this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - pVids[n++] = pVisualNew[k].vid; - - /* Update this depth's list of VisualIDs */ - __glXFree(pdepth[i].vids); - pdepth[i].vids = pVids; - pdepth[i].numVids = numVids; + int numVids = 0; + VisualID *pVids = NULL; + int k, n = 0; + + /* Count the new number of VisualIDs at this depth */ + for (j = 0; j < pdepth[i].numVids; j++) + for (k = 0; k < numNewVisuals; k++) + if (pdepth[i].vids[j] == orig_vid[k]) + numVids++; + + /* Allocate a new list of VisualIDs for this depth */ + pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); + + /* Initialize the new list of VisualIDs for this depth */ + for (j = 0; j < pdepth[i].numVids; j++) + for (k = 0; k < numNewVisuals; k++) + if (pdepth[i].vids[j] == orig_vid[k]) + pVids[n++] = pVisualNew[k].vid; + + /* Update this depth's list of VisualIDs */ + __glXFree(pdepth[i].vids); + pdepth[i].vids = pVids; + pdepth[i].numVids = numVids; } /* Update the X server's visuals */ @@ -862,9 +1005,96 @@ return TRUE; } -// Copied from Mesa +/* based on code in i830_dri.c + This ends calling glAquaSetVisualConfigs to set the static + numconfigs, etc. */ +static void +glAquaInitVisualConfigs(void) +{ + int lclNumConfigs = 0; + __GLXvisualConfig *lclVisualConfigs = NULL; + void **lclVisualPrivates = NULL; + + int depth, aux, buffers, stencil, accum; + int i = 0; + + GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs "); + + /* count num configs: + 2 Z buffer (0, 24 bit) + 2 AUX buffer (0, 2) + 2 buffers (single, double) + 2 stencil (0, 8 bit) + 2 accum (0, 64 bit) + = 32 configs */ + + lclNumConfigs = 2 * 2 * 2 * 2 * 2; /* 32 */ + + /* alloc */ + lclVisualConfigs = xcalloc(sizeof(__GLXvisualConfig), lclNumConfigs); + lclVisualPrivates = xcalloc(sizeof(void *), lclNumConfigs); + + /* fill in configs */ + if (NULL != lclVisualConfigs) { + i = 0; /* current buffer */ + for (depth = 0; depth < 2; depth++) { + for (aux = 0; aux < 2; aux++) { + for (buffers = 0; buffers < 2; buffers++) { + for (stencil = 0; stencil < 2; stencil++) { + for (accum = 0; accum < 2; accum++) { + lclVisualConfigs[i].vid = -1; + lclVisualConfigs[i].class = -1; + lclVisualConfigs[i].rgba = TRUE; + lclVisualConfigs[i].redSize = -1; + lclVisualConfigs[i].greenSize = -1; + lclVisualConfigs[i].blueSize = -1; + lclVisualConfigs[i].redMask = -1; + lclVisualConfigs[i].greenMask = -1; + lclVisualConfigs[i].blueMask = -1; + lclVisualConfigs[i].alphaMask = 0; + if (accum) { + lclVisualConfigs[i].accumRedSize = 16; + lclVisualConfigs[i].accumGreenSize = 16; + lclVisualConfigs[i].accumBlueSize = 16; + lclVisualConfigs[i].accumAlphaSize = 16; + } + else { + lclVisualConfigs[i].accumRedSize = 0; + lclVisualConfigs[i].accumGreenSize = 0; + lclVisualConfigs[i].accumBlueSize = 0; + lclVisualConfigs[i].accumAlphaSize = 0; + } + lclVisualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE; + lclVisualConfigs[i].stereo = FALSE; + lclVisualConfigs[i].bufferSize = -1; + + lclVisualConfigs[i].depthSize = depth? 24 : 0; + lclVisualConfigs[i].stencilSize = stencil ? 8 : 0; + lclVisualConfigs[i].auxBuffers = aux ? 2 : 0; + lclVisualConfigs[i].level = 0; + lclVisualConfigs[i].visualRating = GLX_NONE_EXT; + lclVisualConfigs[i].transparentPixel = 0; + lclVisualConfigs[i].transparentRed = 0; + lclVisualConfigs[i].transparentGreen = 0; + lclVisualConfigs[i].transparentBlue = 0; + lclVisualConfigs[i].transparentAlpha = 0; + lclVisualConfigs[i].transparentIndex = 0; + i++; + } + } + } + } + } + } + if (i != lclNumConfigs) + GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs failed to alloc visual configs"); + + GlxSetVisualConfigs(lclNumConfigs, lclVisualConfigs, lclVisualPrivates); +} + + static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates) + void **privates) { GLAQUA_DEBUG_MSG("glAquaSetVisualConfigs\n"); @@ -873,19 +1103,21 @@ visualPrivates = privates; } -// Copied from Mesa static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB) + int *nvisualp, int *ndepthp, + int *rootDepthp, VisualID *defaultVisp, + unsigned long sizes, int bitsPerRGB) { GLAQUA_DEBUG_MSG("glAquaInitVisuals\n"); + if (numConfigs == 0) /* if no configs */ + glAquaInitVisualConfigs(); /* ensure the visual configs are setup */ + /* * Setup the visuals supported by this particular screen. */ return init_visuals(nvisualp, visualp, defaultVisp, - *ndepthp, *depthp, *rootDepthp); + *ndepthp, *depthp, *rootDepthp); } @@ -893,100 +1125,92 @@ { ScreenPtr pScreen = screenInfo.screens[screen]; glAquaScreenRec *pScr = &glAquaScreens[screen]; - __GLXvisualConfig *pGLXVis = pScr->glx_vis; - VisualPtr pVis; - int i, j; + int j; + __GLcontextModes *modes; GLAQUA_DEBUG_MSG("fixup_visuals\n"); - for (i = 0; i < pScr->num_vis; i++, pGLXVis++) { - pVis = pScreen->visuals; - - /* Find a visual that matches the GLX visual's class and size */ - for (j = 0; j < pScreen->numVisuals; j++, pVis++) { - if (pVis->class == pGLXVis->class && - pVis->nplanes == pGLXVis->bufferSize) { - - /* Fixup the masks */ - pGLXVis->redMask = pVis->redMask; - pGLXVis->greenMask = pVis->greenMask; - pGLXVis->blueMask = pVis->blueMask; - - /* Recalc the sizes */ - pGLXVis->redSize = count_bits(pGLXVis->redMask); - pGLXVis->greenSize = count_bits(pGLXVis->greenMask); - pGLXVis->blueSize = count_bits(pGLXVis->blueMask); - } - } + for ( modes = pScr->modes ; modes != NULL ; modes = modes->next ) { + const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); + const int nplanes = (modes->rgbBits - modes->alphaBits); + const VisualPtr pVis = pScreen->visuals; + + /* Find a visual that matches the GLX visual's class and size */ + for (j = 0; j < pScreen->numVisuals; j++) { + if (pVis[j].class == vis_class && + pVis[j].nplanes == nplanes) { + + /* Fixup the masks */ + modes->redMask = pVis[j].redMask; + modes->greenMask = pVis[j].greenMask; + modes->blueMask = pVis[j].blueMask; + + /* Recalc the sizes */ + modes->redBits = count_bits(modes->redMask); + modes->greenBits = count_bits(modes->greenMask); + modes->blueBits = count_bits(modes->blueMask); + } + } } } static void init_screen_visuals(int screen) { ScreenPtr pScreen = screenInfo.screens[screen]; - __GLXvisualConfig *pGLXVis = glAquaScreens[screen].glx_vis; - // XMesaVisual *pXMesaVisual; - VisualPtr pVis; + __GLcontextModes *modes; int *used; int i, j; GLAQUA_DEBUG_MSG("init_screen_visuals\n"); - /* Alloc space for the list of XMesa visuals */ - // pXMesaVisual = (XMesaVisual *)__glXMalloc(MESAScreens[screen].num_vis * - // sizeof(XMesaVisual)); - // __glXMemset(pXMesaVisual, 0, - // MESAScreens[screen].num_vis * sizeof(XMesaVisual)); - + /* FIXME: Change 'used' to be a array of bits (rather than of ints), + * FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less + * FIXME: than 64 or 128 the stack array can be used instead of calling + * FIXME: __glXMalloc / __glXFree. If nothing else, convert 'used' to + * FIXME: array of bytes instead of ints! + */ used = (int *)__glXMalloc(pScreen->numVisuals * sizeof(int)); __glXMemset(used, 0, pScreen->numVisuals * sizeof(int)); - for (i = 0; i < glAquaScreens[screen].num_vis; i++, pGLXVis++) { - pVis = pScreen->visuals; - for (j = 0; j < pScreen->numVisuals; j++, pVis++) { - - if (pVis->class == pGLXVis->class && - pVis->nplanes == pGLXVis->bufferSize && - !used[j]) { - - if (pVis->redMask == pGLXVis->redMask && - pVis->greenMask == pGLXVis->greenMask && - pVis->blueMask == pGLXVis->blueMask) { - - /* Create the XMesa visual */ - /* - pXMesaVisual[i] = - XMesaCreateVisual(pScreen, - pVis, - pGLXVis->rgba, - (pGLXVis->alphaSize > 0), - pGLXVis->doubleBuffer, - pGLXVis->stereo, - GL_TRUE, // ximage_flag - pGLXVis->depthSize, - pGLXVis->stencilSize, - pGLXVis->accumRedSize, - pGLXVis->accumGreenSize, - pGLXVis->accumBlueSize, - pGLXVis->accumAlphaSize, - 0, // numSamples - pGLXVis->level, - pGLXVis->visualRating ); - */ - /* Set the VisualID */ - pGLXVis->vid = pVis->vid; - - /* Mark this visual used */ - used[j] = 1; - break; - } - } - } + i = 0; + for ( modes = glAquaScreens[screen].modes + ; modes != NULL + ; modes = modes->next ) { + const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); + const int nplanes = (modes->rgbBits - modes->alphaBits); + const VisualPtr pVis = pScreen->visuals; + + for (j = 0; j < pScreen->numVisuals; j++) { + if (pVis[j].class == vis_class && + pVis[j].nplanes == nplanes && + pVis[j].redMask == modes->redMask && + pVis[j].greenMask == modes->greenMask && + pVis[j].blueMask == modes->blueMask && + !used[j]) { + + /* Set the VisualID */ + modes->visualID = pVis[j].vid; + + /* Mark this visual used */ + used[j] = 1; + break; + } + } + if ( j == pScreen->numVisuals ) { + ErrorF("No matching visual for __GLcontextMode with " + "visual class = %d (%d), nplanes = %u\n", + vis_class, + (int)modes->visualType, + (unsigned int)(modes->rgbBits - modes->alphaBits) ); + } + else if ( modes->visualID == -1 ) { + FatalError( "Matching visual found, but visualID still -1!\n" ); + } + + i++; } __glXFree(used); - - // glAquaScreens[screen].xm_vis = pXMesaVisual; } static Bool glAquaScreenProbe(int screen) @@ -999,10 +1223,10 @@ /* * Set up the current screen's visuals. */ - __glDDXScreenInfo.pGlxVisual = glAquaScreens[screen].glx_vis; + __glDDXScreenInfo.modes = glAquaScreens[screen].modes; __glDDXScreenInfo.pVisualPriv = glAquaScreens[screen].priv; __glDDXScreenInfo.numVisuals = - __glDDXScreenInfo.numUsableVisuals = glAquaScreens[screen].num_vis; + __glDDXScreenInfo.numUsableVisuals = glAquaScreens[screen].num_vis; /* * Set the current screen's createContext routine. This could be @@ -1022,7 +1246,9 @@ */ init_screen_visuals(screen); - // Wrap RealizeWindow and UnrealizeWindow on this screen + /* + * Wrap RealizeWindow and UnrealizeWindow on this screen + */ pScreen = screenInfo.screens[screen]; screenPriv = &glAquaScreens[screen]; screenPriv->RealizeWindow = pScreen->RealizeWindow; @@ -1035,28 +1261,28 @@ static GLboolean glAquaResizeBuffers(__GLdrawableBuffer *buffer, - GLint x, GLint y, - GLuint width, GLuint height, - __GLdrawablePrivate *glPriv, - GLuint bufferMask) + GLint x, GLint y, + GLuint width, GLuint height, + __GLdrawablePrivate *glPriv, + GLuint bufferMask) { GLAquaDrawableRec *aquaPriv = (GLAquaDrawableRec *)glPriv->private; + __GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *)glPriv->other; __GLXcontext *gx; __GLcontext *gc; - __GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *)glPriv->other; GLAQUA_DEBUG_MSG("glAquaResizeBuffers to (%d %d %d %d)\n", x, y, width, height); // update all contexts that point at this drawable for drawing (hack?) - for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->next) { + for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->nextDrawPriv) { gc = (__GLcontext *)gx->gc; - attach(gc, glPriv, x, y, width, height); + attach(gc, glPriv); } // update all contexts that point at this drawable for reading (hack?) - for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->next) { + for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->nextReadPriv) { gc = (__GLcontext *)gx->gc; - attach(gc, glPriv, x, y, width, height); + attach(gc, glPriv); } return aquaPriv->resize(buffer, x, y, width, height, glPriv, bufferMask); @@ -1122,24 +1348,24 @@ case GL_MAP2_VERTEX_4: case GL_MAP2_COLOR_4: case GL_MAP2_TEXTURE_COORD_4: - return 4; + return 4; case GL_MAP1_VERTEX_3: case GL_MAP1_TEXTURE_COORD_3: case GL_MAP1_NORMAL: case GL_MAP2_VERTEX_3: case GL_MAP2_TEXTURE_COORD_3: case GL_MAP2_NORMAL: - return 3; + return 3; case GL_MAP1_TEXTURE_COORD_2: case GL_MAP2_TEXTURE_COORD_2: - return 2; + return 2; case GL_MAP1_TEXTURE_COORD_1: case GL_MAP2_TEXTURE_COORD_1: case GL_MAP1_INDEX: case GL_MAP2_INDEX: - return 1; + return 1; default: - return 0; + return 0; } } @@ -1148,8 +1374,8 @@ int c = 0; while (val > 1) { - c++; - val >>= 1; + c++; + val >>= 1; } return c; } Index: xc/programs/Xserver/GL/apple/indirect.c diff -u xc/programs/Xserver/GL/apple/indirect.c:1.3 xc/programs/Xserver/GL/apple/indirect.c:1.4 --- xc/programs/Xserver/GL/apple/indirect.c:1.3 Sun Oct 12 20:30:54 2003 +++ xc/programs/Xserver/GL/apple/indirect.c Fri Dec 10 12:52:46 2004 @@ -5,8 +5,9 @@ /* * Copyright (c) 2002 Greg Parker. All Rights Reserved. * Copyright (c) 2002 Apple Computer, Inc. + * Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved. * - * Portions of this file are copied from xf86glx.c, + * Portions of this file are copied from Mesa's xf86glx.c, * which contains the following copyright: * * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -29,12 +30,8 @@ * 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(s) of the above copyright - * holders shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written authorization. */ -/* $XFree86: xc/programs/Xserver/GL/apple/indirect.c,v 1.3 2003/10/13 00:30:54 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/apple/indirect.c,v 1.4 2004/12/10 17:52:46 alanh Exp $ */ #include "dri.h" #include "quartz.h" @@ -61,6 +58,8 @@ #include "x-hash.h" #include "x-list.h" +#include "glcontextmodes.h" + // ggs: needed to call back to glx with visual configs extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **configprivs); @@ -72,6 +71,7 @@ #define GLAQUA_DEBUG_MSG(a, ...) #endif + // The following GL functions don't have an EXT suffix in OpenGL.framework. GLboolean glAreTexturesResidentEXT(GLsizei a, const GLuint *b, GLboolean *c) { return glAreTexturesResident(a, b, c); @@ -89,14 +89,14 @@ // some prototypes static Bool glAquaScreenProbe(int screen); static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB); + int *nvisualp, int *ndepthp, + int *rootDepthp, VisualID *defaultVisp, + unsigned long sizes, int bitsPerRGB); static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates); + void **privates); static __GLinterface *glAquaCreateContext(__GLimports *imports, - __GLcontextModes *mode, - __GLinterface *shareGC); + __GLcontextModes *mode, + __GLinterface *shareGC); static void glAquaCreateBuffer(__GLXdrawablePrivate *glxPriv); static void glAquaResetExtension(void); @@ -106,14 +106,14 @@ * __glXScreenInit to initialize each of the active screens * (__glXActiveScreens[]). Several of the fields must be initialized by * the screenProbe routine before they are copied to the active screens - * struct. In particular, the contextCreate, pGlxVisual, numVisuals, + * struct. In particular, the contextCreate, modes, numVisuals, * and numUsableVisuals fields must be initialized. */ -__GLXscreenInfo __glDDXScreenInfo = { +static __GLXscreenInfo __glDDXScreenInfo = { glAquaScreenProbe, /* Must be generic and handle all screens */ glAquaCreateContext, /* Substitute screen's createContext routine */ glAquaCreateBuffer, /* Substitute screen's createBuffer routine */ - NULL, /* Set up pGlxVisual in probe */ + NULL, /* Set up modes in probe */ NULL, /* Set up pVisualPriv in probe */ 0, /* Set up numVisuals in probe */ 0, /* Set up numUsableVisuals in probe */ @@ -123,13 +123,21 @@ NULL /* WrappedPositionWindow is overwritten */ }; -__GLXextensionInfo __glDDXExtensionInfo = { +void *__glXglDDXScreenInfo(void) { + return &__glDDXScreenInfo; +} + +static __GLXextensionInfo __glDDXExtensionInfo = { GL_CORE_APPLE, glAquaResetExtension, glAquaInitVisuals, glAquaSetVisualConfigs }; +void *__glXglDDXExtensionInfo(void) { + return &__glDDXExtensionInfo; +} + // prototypes static GLboolean glAquaDestroyContext(__GLcontext *gc); @@ -137,7 +145,7 @@ static GLboolean glAquaMakeCurrent(__GLcontext *gc); static GLboolean glAquaShareContext(__GLcontext *gc, __GLcontext *gcShare); static GLboolean glAquaCopyContext(__GLcontext *dst, const __GLcontext *src, - GLuint mask); + GLuint mask); static GLboolean glAquaForceCurrent(__GLcontext *gc); /* Drawing surface notification callbacks */ @@ -169,7 +177,7 @@ typedef struct { int num_vis; - __GLXvisualConfig *glx_vis; + __GLcontextModes *modes; void **priv; // wrapped screen functions @@ -186,15 +194,15 @@ } GLAquaDrawableRec; struct __GLcontextRec { - struct __GLinterfaceRec interface; // required to be first + struct __GLinterfaceRec interface; // required to be first - CGLContextObj ctx; - CGLPixelFormatObj pixelFormat; + CGLContextObj ctx; + CGLPixelFormatObj pixelFormat; - /* set when attached */ - xp_surface_id sid; + /* set when attached */ + xp_surface_id sid; - unsigned isAttached :1; + unsigned isAttached :1; }; /* maps from surface id -> list of __GLcontext */ @@ -206,22 +214,23 @@ { x_list *lst; - GLAQUA_DEBUG_MSG("glAquaDestroyContext (ctx 0x%x)\n", gc->ctx); + GLAQUA_DEBUG_MSG("glAquaDestroyContext (ctx 0x%x)\n", + (unsigned int) gc->ctx); if (gc != NULL) { - if (gc->sid != 0 && surface_hash != NULL) - { - lst = x_hash_table_lookup(surface_hash, (void *) gc->sid, NULL); - lst = x_list_remove(lst, gc); - x_hash_table_insert(surface_hash, (void *) gc->sid, lst); - } + if (gc->sid != 0 && surface_hash != NULL) + { + lst = x_hash_table_lookup(surface_hash, (void *) gc->sid, NULL); + lst = x_list_remove(lst, gc); + x_hash_table_insert(surface_hash, (void *) gc->sid, lst); + } if (gc->ctx != NULL) - CGLDestroyContext(gc->ctx); + CGLDestroyContext(gc->ctx); if (gc->pixelFormat != NULL) - CGLDestroyPixelFormat(gc->pixelFormat); + CGLDestroyPixelFormat(gc->pixelFormat); free(gc); } @@ -233,11 +242,11 @@ { CGLError gl_err; - GLAQUA_DEBUG_MSG("glAquaLoseCurrent (ctx 0x%x)\n", gc->ctx); + GLAQUA_DEBUG_MSG("glAquaLoseCurrent (ctx 0x%x)\n", (unsigned int) gc->ctx); gl_err = CGLSetCurrentContext(NULL); if (gl_err != 0) - ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err)); + ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err)); __glXLastContext = NULL; // Mesa does this; why? @@ -256,24 +265,24 @@ switch (arg->kind) { case AppleDRISurfaceNotifyDestroyed: - if (surface_hash != NULL) - x_hash_table_remove(surface_hash, (void *) arg->id); + if (surface_hash != NULL) + x_hash_table_remove(surface_hash, (void *) arg->id); - aquaPriv->pDraw = NULL; - aquaPriv->sid = 0; - break; + aquaPriv->pDraw = NULL; + aquaPriv->sid = 0; + break; case AppleDRISurfaceNotifyChanged: - if (surface_hash != NULL) - { - lst = x_hash_table_lookup(surface_hash, (void *) arg->id, NULL); - for (; lst != NULL; lst = lst->next) - { - gc = lst->data; - xp_update_gl_context(gc->ctx); - } - } - break; + if (surface_hash != NULL) + { + lst = x_hash_table_lookup(surface_hash, (void *) arg->id, NULL); + for (; lst != NULL; lst = lst->next) + { + gc = lst->data; + xp_update_gl_context(gc->ctx); + } + } + break; } } @@ -283,80 +292,72 @@ if (gc->isAttached) { - GLAQUA_DEBUG_MSG("unattaching\n"); + GLAQUA_DEBUG_MSG("unattaching\n"); - if (surface_hash != NULL) - { - lst = x_hash_table_lookup(surface_hash, (void *) gc->sid, NULL); - lst = x_list_remove(lst, gc); - x_hash_table_insert(surface_hash, (void *) gc->sid, lst); - } - - CGLClearDrawable(gc->ctx); - gc->isAttached = FALSE; - gc->sid = 0; + if (surface_hash != NULL) + { + lst = x_hash_table_lookup(surface_hash, (void *) gc->sid, NULL); + lst = x_list_remove(lst, gc); + x_hash_table_insert(surface_hash, (void *) gc->sid, lst); + } + + CGLClearDrawable(gc->ctx); + gc->isAttached = FALSE; + gc->sid = 0; } } static void attach(__GLcontext *gc, __GLdrawablePrivate *glPriv) { __GLXdrawablePrivate *glxPriv; + GLAquaDrawableRec *aquaPriv; + DrawablePtr pDraw; glxPriv = (__GLXdrawablePrivate *)glPriv->other; + aquaPriv = (GLAquaDrawableRec *)glPriv->private; + pDraw = glxPriv->pDraw; - if (glxPriv->type == DRAWABLE_WINDOW) + if (aquaPriv->sid == 0) { - WindowPtr pWin = (WindowPtr) glxPriv->pDraw; - GLAquaDrawableRec *aquaPriv = (GLAquaDrawableRec *)glPriv->private; - x_list *lst; - - if (aquaPriv->sid == 0) - { - if (!quartzProcs->CreateSurface(pWin->drawable.pScreen, - pWin->drawable.id, &pWin->drawable, - 0, &aquaPriv->sid, NULL, - surface_notify, aquaPriv)) - { - return; - } - aquaPriv->pDraw = &pWin->drawable; - } - - if (!gc->isAttached || gc->sid != aquaPriv->sid) - { - if (xp_attach_gl_context(gc->ctx, aquaPriv->sid) != Success) - { - quartzProcs->DestroySurface(pWin->drawable.pScreen, - pWin->drawable.id, &pWin->drawable, - surface_notify, aquaPriv); - - if (surface_hash != NULL) - x_hash_table_remove(surface_hash, (void *) aquaPriv->sid); - - aquaPriv->sid = 0; - return; - } - - gc->isAttached = TRUE; - gc->sid = aquaPriv->sid; - - if (surface_hash == NULL) - surface_hash = x_hash_table_new(NULL, NULL, NULL, NULL); - - lst = x_hash_table_lookup(surface_hash, (void *) gc->sid, NULL); - if (x_list_find(lst, gc) == NULL) - { - lst = x_list_prepend(lst, gc); - x_hash_table_insert(surface_hash, (void *) gc->sid, lst); - } - - GLAQUA_DEBUG_MSG("attached 0x%x to 0x%x\n", pWin->drawable.id, - aquaPriv->sid); - } - } else { - GLAQUA_DEBUG_MSG("attach: attach to non-window unimplemented\n"); - CGLClearDrawable(gc->ctx); - gc->isAttached = FALSE; + if (!quartzProcs->CreateSurface(pDraw->pScreen, pDraw->id, pDraw, + 0, &aquaPriv->sid, NULL, + surface_notify, aquaPriv)) + { + return; + } + aquaPriv->pDraw = pDraw; + } + + if (!gc->isAttached || gc->sid != aquaPriv->sid) + { + x_list *lst; + + if (xp_attach_gl_context(gc->ctx, aquaPriv->sid) != Success) + { + quartzProcs->DestroySurface(pDraw->pScreen, pDraw->id, pDraw, + surface_notify, aquaPriv); + if (surface_hash != NULL) + x_hash_table_remove(surface_hash, (void *) aquaPriv->sid); + + aquaPriv->sid = 0; + return; + } + + gc->isAttached = TRUE; + gc->sid = aquaPriv->sid; + + if (surface_hash == NULL) + surface_hash = x_hash_table_new(NULL, NULL, NULL, NULL); + + lst = x_hash_table_lookup(surface_hash, (void *) gc->sid, NULL); + if (x_list_find(lst, gc) == NULL) + { + lst = x_list_prepend(lst, gc); + x_hash_table_insert(surface_hash, (void *) gc->sid, lst); + } + + GLAQUA_DEBUG_MSG("attached 0x%x to 0x%x\n", (unsigned int) pDraw->id, + (unsigned int) aquaPriv->sid); } } @@ -365,13 +366,13 @@ __GLdrawablePrivate *glPriv = gc->interface.imports.getDrawablePrivate(gc); CGLError gl_err; - GLAQUA_DEBUG_MSG("glAquaMakeCurrent (ctx 0x%x)\n", gc->ctx); + GLAQUA_DEBUG_MSG("glAquaMakeCurrent (ctx 0x%x)\n", (unsigned int) gc->ctx); attach(gc, glPriv); gl_err = CGLSetCurrentContext(gc->ctx); if (gl_err != 0) - ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err)); + ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err)); return gl_err == 0; } @@ -392,7 +393,7 @@ gl_err = CGLCopyContext(src->ctx, dst->ctx, mask); if (gl_err != 0) - ErrorF("CGLCopyContext error: %s\n", CGLErrorString(gl_err)); + ErrorF("CGLCopyContext error: %s\n", CGLErrorString(gl_err)); return gl_err == 0; } @@ -401,11 +402,12 @@ { CGLError gl_err; - GLAQUA_DEBUG_MSG("glAquaForceCurrent (ctx 0x%x)\n", gc->ctx); + GLAQUA_DEBUG_MSG("glAquaForceCurrent (ctx 0x%x)\n", + (unsigned int) gc->ctx); gl_err = CGLSetCurrentContext(gc->ctx); if (gl_err != 0) - ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err)); + ErrorF("CGLSetCurrentContext error: %s\n", CGLErrorString(gl_err)); return gl_err == 0; } @@ -456,7 +458,7 @@ GLAQUA_DEBUG_MSG("makeFormat\n"); if (!mode->rgbMode) - return NULL; + return NULL; i = 0; @@ -471,14 +473,14 @@ } if (mode->colorIndexMode) { - /* ignored */ + /* ignored */ } if (mode->rgbMode) { attr[i++] = kCGLPFAColorSize; attr[i++] = mode->redBits + mode->greenBits + mode->blueBits; attr[i++] = kCGLPFAAlphaSize; - attr[i++] = 1; /* FIXME: ignoring mode->alphaBits which is always 0 */ + attr[i++] = 1; /* FIXME: ignoring mode->alphaBits which is always 0 */ } if (mode->haveAccumBuffer) { @@ -509,16 +511,16 @@ result = NULL; gl_err = CGLChoosePixelFormat(attr, &result, &n_formats); if (gl_err != 0) - ErrorF("CGLChoosePixelFormat error: %s\n", CGLErrorString(gl_err)); + ErrorF("CGLChoosePixelFormat error: %s\n", CGLErrorString(gl_err)); - GLAQUA_DEBUG_MSG("makeFormat done (0x%x)\n", result); + GLAQUA_DEBUG_MSG("makeFormat done (0x%x)\n", (unsigned int) result); return result; } static __GLinterface *glAquaCreateContext(__GLimports *imports, - __GLcontextModes *mode, - __GLinterface *shareGC) + __GLcontextModes *mode, + __GLinterface *shareGC) { __GLcontext *result; __GLcontext *sharectx = (__GLcontext *)shareGC; @@ -540,11 +542,11 @@ result->ctx = NULL; gl_err = CGLCreateContext(result->pixelFormat, - sharectx ? sharectx->ctx : NULL, - &result->ctx); + sharectx ? sharectx->ctx : NULL, + &result->ctx); if (gl_err != 0) { - ErrorF("CGLCreateContext error: %s\n", CGLErrorString(gl_err)); + ErrorF("CGLCreateContext error: %s\n", CGLErrorString(gl_err)); CGLDestroyPixelFormat(result->pixelFormat); free(result); return NULL; @@ -638,19 +640,22 @@ return result; } -/* - * In the case the driver has no GLX visuals we'll use these. - * [0] = RGB, double buffered - * [1] = RGB, double buffered, stencil, accum - */ + // Originally copied from Mesa static int numConfigs = 0; static __GLXvisualConfig *visualConfigs = NULL; static void **visualPrivates = NULL; -#define NUM_FALLBACK_CONFIGS 2 +/* + * In the case the driver defines no GLX visuals we'll use these. + * Note that for TrueColor and DirectColor visuals, bufferSize is the + * sum of redSize, greenSize, blueSize and alphaSize, which may be larger + * than the nplanes/rootDepth of the server's X11 visuals + */ +#define NUM_FALLBACK_CONFIGS 5 static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { + /* [0] = RGB, double buffered, Z */ { -1, /* vid */ -1, /* class */ @@ -665,11 +670,12 @@ 0, /* stencilSize */ 0, /* auxBuffers */ 0, /* level */ - GLX_NONE_EXT, /* visualRating */ - 0, /* transparentPixel */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ 0 /* transparentIndex */ }, + /* [1] = RGB, double buffered, Z, stencil, accum */ { -1, /* vid */ -1, /* class */ @@ -684,11 +690,71 @@ 8, /* stencilSize */ 0, /* auxBuffers */ 0, /* level */ - GLX_NONE_EXT, /* visualRating */ - 0, /* transparentPixel */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + /* [2] = RGB+Alpha, double buffered, Z, stencil, accum */ + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 8, /* rgba sizes */ + -1, -1, -1, -1, /* rgba masks */ + 16, 16, 16, 16, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 8, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + /* [3] = RGB+Alpha, single buffered, Z, stencil, accum */ + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 8, /* rgba sizes */ + -1, -1, -1, -1, /* rgba masks */ + 16, 16, 16, 16, /* rgba accum sizes */ + False, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 8, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + /* [4] = CI, double buffered, Z */ + { + -1, /* vid */ + -1, /* class */ + False, /* rgba? (false = color index) */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 0, 0, 0, 0, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 0, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ 0 /* transparentIndex */ - } + }, }; static __GLXvisualConfig NullConfig = { @@ -711,6 +777,7 @@ 0 /* transparentIndex */ }; + static inline int count_bits(uint32_t x) { x = x - ((x >> 1) & 0x55555555); @@ -721,11 +788,11 @@ return x & 63; } -// Mostly copied from Mesa's xf86glx.c + static Bool init_visuals(int *nvisualp, VisualPtr *visualp, - VisualID *defaultVisp, - int ndepth, DepthPtr pdepth, - int rootDepth) + VisualID *defaultVisp, + int ndepth, DepthPtr pdepth, + int rootDepth) { int numRGBconfigs; int numCIconfigs; @@ -735,7 +802,7 @@ VisualPtr pVisual = *visualp; VisualPtr pVisualNew = NULL; VisualID *orig_vid = NULL; - __GLXvisualConfig *glXVisualPtr = NULL; + __GLcontextModes *modes; __GLXvisualConfig *pNewVisualConfigs = NULL; void **glXVisualPriv; void **pNewVisualPriv; @@ -753,14 +820,14 @@ pNewVisualConfigs = (__GLXvisualConfig *) __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); if (!pNewVisualConfigs) { - return FALSE; + return FALSE; } /* Alloc space for the list of new GLX visual privates */ pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *)); if (!pNewVisualPriv) { - __glXFree(pNewVisualConfigs); - return FALSE; + __glXFree(pNewVisualConfigs); + return FALSE; } /* @@ -768,9 +835,9 @@ ** visual configs. */ if (numConfigs == 0) { - memcpy(pNewVisualConfigs, FallbackConfigs, + memcpy(pNewVisualConfigs, FallbackConfigs, NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig)); - memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); + memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); } else { /* copy driver's visual config info */ @@ -784,22 +851,22 @@ numRGBconfigs = 0; numCIconfigs = 0; for (i = 0; i < numNewConfigs; i++) { - if (pNewVisualConfigs[i].rgba) - numRGBconfigs++; - else - numCIconfigs++; + if (pNewVisualConfigs[i].rgba) + numRGBconfigs++; + else + numCIconfigs++; } /* Count the total number of visuals to compute */ numNewVisuals = 0; for (i = 0; i < numVisuals; i++) { - int count; + int count; - count = ((pVisual[i].class == TrueColor - || pVisual[i].class == DirectColor) - ? numRGBconfigs : numCIconfigs); - if (count == 0) - count = 1; /* preserve the existing visual */ + count = ((pVisual[i].class == TrueColor || + pVisual[i].class == DirectColor) + ? numRGBconfigs : numCIconfigs); + if (count == 0) + count = 1; /* preserve the existing visual */ numNewVisuals += count; } @@ -811,154 +878,159 @@ /* Alloc temp space for the list of orig VisualIDs for each new visual */ orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID)); if (!orig_vid) { - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; } /* Alloc space for the list of glXVisuals */ - glXVisualPtr = (__GLXvisualConfig *)__glXMalloc(numNewVisuals * - sizeof(__GLXvisualConfig)); - if (!glXVisualPtr) { - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; + modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); + if (modes == NULL) { + __glXFree(orig_vid); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; } /* Alloc space for the list of glXVisualPrivates */ glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); if (!glXVisualPriv) { - __glXFree(glXVisualPtr); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; + _gl_context_modes_destroy( modes ); + __glXFree(orig_vid); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; } /* Alloc space for the new list of the X server's visuals */ pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); if (!pVisualNew) { - __glXFree(glXVisualPriv); - __glXFree(glXVisualPtr); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; + __glXFree(glXVisualPriv); + _gl_context_modes_destroy( modes ); + __glXFree(orig_vid); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; } /* Initialize the new visuals */ found_default = FALSE; + glAquaScreens[screenInfo.numScreens-1].modes = modes; for (i = j = 0; i < numVisuals; i++) { int is_rgb = (pVisual[i].class == TrueColor || - pVisual[i].class == DirectColor); + pVisual[i].class == DirectColor); + + if (!is_rgb) + { + /* We don't support non-rgb visuals for GL. But we don't + want to remove them either, so just pass them through + with null glX configs */ + + pVisualNew[j] = pVisual[i]; + pVisualNew[j].vid = FakeClientID(0); + + /* Check for the default visual */ + if (!found_default && pVisual[i].vid == *defaultVisp) { + *defaultVisp = pVisualNew[j].vid; + found_default = TRUE; + } + + /* Save the old VisualID */ + orig_vid[j] = pVisual[i].vid; - if (!is_rgb) - { - /* We don't support non-rgb visuals for GL. But we don't - want to remove them either, so just pass them through - with null glX configs */ - - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } - - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; - - /* Initialize the glXVisual */ - glXVisualPtr[j] = NullConfig; - glXVisualPriv[j] = NULL; - - j++; - - continue; - } - - for (k = 0; k < numNewConfigs; k++) { - if (pNewVisualConfigs[k].rgba != is_rgb) - continue; - - /* Initialize the new visual */ - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } - - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; - - /* Initialize the glXVisual */ - glXVisualPtr[j] = pNewVisualConfigs[k]; - glXVisualPtr[j].vid = pVisualNew[j].vid; - - /* - * If the class is -1, then assume the X visual information - * is identical to what GLX needs, and take them from the X - * visual. NOTE: if class != -1, then all other fields MUST - * be initialized. - */ - if (glXVisualPtr[j].class == -1) { - glXVisualPtr[j].class = pVisual[i].class; - glXVisualPtr[j].redSize = count_bits(pVisual[i].redMask); - glXVisualPtr[j].greenSize = count_bits(pVisual[i].greenMask); - glXVisualPtr[j].blueSize = count_bits(pVisual[i].blueMask); - glXVisualPtr[j].alphaSize = glXVisualPtr[j].alphaSize; - glXVisualPtr[j].redMask = pVisual[i].redMask; - glXVisualPtr[j].greenMask = pVisual[i].greenMask; - glXVisualPtr[j].blueMask = pVisual[i].blueMask; - glXVisualPtr[j].alphaMask = glXVisualPtr[j].alphaMask; - glXVisualPtr[j].bufferSize = rootDepth; - } + /* Initialize the glXVisual */ + _gl_copy_visual_to_context_mode( modes, & NullConfig ); + modes->visualID = pVisualNew[j].vid; - /* Save the device-dependent private for this visual */ - glXVisualPriv[j] = pNewVisualPriv[k]; + j++; - j++; - } + continue; + } + + for (k = 0; k < numNewConfigs; k++) { + if (pNewVisualConfigs[k].rgba != is_rgb) + continue; + + assert( modes != NULL ); + + /* Initialize the new visual */ + pVisualNew[j] = pVisual[i]; + pVisualNew[j].vid = FakeClientID(0); + + /* Check for the default visual */ + if (!found_default && pVisual[i].vid == *defaultVisp) { + *defaultVisp = pVisualNew[j].vid; + found_default = TRUE; + } + + /* Save the old VisualID */ + orig_vid[j] = pVisual[i].vid; + + /* Initialize the glXVisual */ + _gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] ); + modes->visualID = pVisualNew[j].vid; + + /* + * If the class is -1, then assume the X visual information + * is identical to what GLX needs, and take them from the X + * visual. NOTE: if class != -1, then all other fields MUST + * be initialized. + */ + if (modes->visualType == GLX_NONE) { + modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class ); + modes->redBits = count_bits(pVisual[i].redMask); + modes->greenBits = count_bits(pVisual[i].greenMask); + modes->blueBits = count_bits(pVisual[i].blueMask); + modes->alphaBits = modes->alphaBits; + modes->redMask = pVisual[i].redMask; + modes->greenMask = pVisual[i].greenMask; + modes->blueMask = pVisual[i].blueMask; + modes->alphaMask = modes->alphaMask; + modes->rgbBits = (is_rgb) + ? (modes->redBits + modes->greenBits + + modes->blueBits + modes->alphaBits) + : rootDepth; + } + + /* Save the device-dependent private for this visual */ + glXVisualPriv[j] = pNewVisualPriv[k]; + + j++; + modes = modes->next; + } } assert(j <= numNewVisuals); /* Save the GLX visuals in the screen structure */ glAquaScreens[screenInfo.numScreens-1].num_vis = numNewVisuals; - glAquaScreens[screenInfo.numScreens-1].glx_vis = glXVisualPtr; glAquaScreens[screenInfo.numScreens-1].priv = glXVisualPriv; /* Set up depth's VisualIDs */ for (i = 0; i < ndepth; i++) { - int numVids = 0; - VisualID *pVids = NULL; - int k, n = 0; - - /* Count the new number of VisualIDs at this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - numVids++; - - /* Allocate a new list of VisualIDs for this depth */ - pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); - - /* Initialize the new list of VisualIDs for this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - pVids[n++] = pVisualNew[k].vid; - - /* Update this depth's list of VisualIDs */ - __glXFree(pdepth[i].vids); - pdepth[i].vids = pVids; - pdepth[i].numVids = numVids; + int numVids = 0; + VisualID *pVids = NULL; + int k, n = 0; + + /* Count the new number of VisualIDs at this depth */ + for (j = 0; j < pdepth[i].numVids; j++) + for (k = 0; k < numNewVisuals; k++) + if (pdepth[i].vids[j] == orig_vid[k]) + numVids++; + + /* Allocate a new list of VisualIDs for this depth */ + pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); + + /* Initialize the new list of VisualIDs for this depth */ + for (j = 0; j < pdepth[i].numVids; j++) + for (k = 0; k < numNewVisuals; k++) + if (pdepth[i].vids[j] == orig_vid[k]) + pVids[n++] = pVisualNew[k].vid; + + /* Update this depth's list of VisualIDs */ + __glXFree(pdepth[i].vids); + pdepth[i].vids = pVids; + pdepth[i].numVids = numVids; } /* Update the X server's visuals */ @@ -995,14 +1067,14 @@ int i = 0; GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs "); - + /* count num configs: - 2 Z buffer (0, 24 bit) - 2 AUX buffer (0, 2) - 2 buffers (single, double) - 2 stencil (0, 8 bit) - 2 accum (0, 64 bit) - = 32 configs */ + 2 Z buffer (0, 24 bit) + 2 AUX buffer (0, 2) + 2 buffers (single, double) + 2 stencil (0, 8 bit) + 2 accum (0, 64 bit) + = 32 configs */ lclNumConfigs = 2 * 2 * 2 * 2 * 2; /* 32 */ @@ -1012,66 +1084,65 @@ /* fill in configs */ if (NULL != lclVisualConfigs) { - i = 0; /* current buffer */ - for (depth = 0; depth < 2; depth++) { - for (aux = 0; aux < 2; aux++) { - for (buffers = 0; buffers < 2; buffers++) { - for (stencil = 0; stencil < 2; stencil++) { - for (accum = 0; accum < 2; accum++) { - lclVisualConfigs[i].vid = -1; - lclVisualConfigs[i].class = -1; - lclVisualConfigs[i].rgba = TRUE; - lclVisualConfigs[i].redSize = -1; - lclVisualConfigs[i].greenSize = -1; - lclVisualConfigs[i].blueSize = -1; - lclVisualConfigs[i].redMask = -1; - lclVisualConfigs[i].greenMask = -1; - lclVisualConfigs[i].blueMask = -1; - lclVisualConfigs[i].alphaMask = 0; - if (accum) { - lclVisualConfigs[i].accumRedSize = 16; - lclVisualConfigs[i].accumGreenSize = 16; - lclVisualConfigs[i].accumBlueSize = 16; - lclVisualConfigs[i].accumAlphaSize = 16; - } - else { - lclVisualConfigs[i].accumRedSize = 0; - lclVisualConfigs[i].accumGreenSize = 0; - lclVisualConfigs[i].accumBlueSize = 0; - lclVisualConfigs[i].accumAlphaSize = 0; - } - lclVisualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE; - lclVisualConfigs[i].stereo = FALSE; - lclVisualConfigs[i].bufferSize = -1; - - lclVisualConfigs[i].depthSize = depth? 24 : 0; - lclVisualConfigs[i].stencilSize = stencil ? 8 : 0; - lclVisualConfigs[i].auxBuffers = aux ? 2 : 0; - lclVisualConfigs[i].level = 0; - lclVisualConfigs[i].visualRating = GLX_NONE_EXT; - lclVisualConfigs[i].transparentPixel = 0; - lclVisualConfigs[i].transparentRed = 0; - lclVisualConfigs[i].transparentGreen = 0; - lclVisualConfigs[i].transparentBlue = 0; - lclVisualConfigs[i].transparentAlpha = 0; - lclVisualConfigs[i].transparentIndex = 0; - i++; - } - } - } - } - } + i = 0; /* current buffer */ + for (depth = 0; depth < 2; depth++) { + for (aux = 0; aux < 2; aux++) { + for (buffers = 0; buffers < 2; buffers++) { + for (stencil = 0; stencil < 2; stencil++) { + for (accum = 0; accum < 2; accum++) { + lclVisualConfigs[i].vid = -1; + lclVisualConfigs[i].class = -1; + lclVisualConfigs[i].rgba = TRUE; + lclVisualConfigs[i].redSize = -1; + lclVisualConfigs[i].greenSize = -1; + lclVisualConfigs[i].blueSize = -1; + lclVisualConfigs[i].redMask = -1; + lclVisualConfigs[i].greenMask = -1; + lclVisualConfigs[i].blueMask = -1; + lclVisualConfigs[i].alphaMask = 0; + if (accum) { + lclVisualConfigs[i].accumRedSize = 16; + lclVisualConfigs[i].accumGreenSize = 16; + lclVisualConfigs[i].accumBlueSize = 16; + lclVisualConfigs[i].accumAlphaSize = 16; + } + else { + lclVisualConfigs[i].accumRedSize = 0; + lclVisualConfigs[i].accumGreenSize = 0; + lclVisualConfigs[i].accumBlueSize = 0; + lclVisualConfigs[i].accumAlphaSize = 0; + } + lclVisualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE; + lclVisualConfigs[i].stereo = FALSE; + lclVisualConfigs[i].bufferSize = -1; + + lclVisualConfigs[i].depthSize = depth? 24 : 0; + lclVisualConfigs[i].stencilSize = stencil ? 8 : 0; + lclVisualConfigs[i].auxBuffers = aux ? 2 : 0; + lclVisualConfigs[i].level = 0; + lclVisualConfigs[i].visualRating = GLX_NONE_EXT; + lclVisualConfigs[i].transparentPixel = 0; + lclVisualConfigs[i].transparentRed = 0; + lclVisualConfigs[i].transparentGreen = 0; + lclVisualConfigs[i].transparentBlue = 0; + lclVisualConfigs[i].transparentAlpha = 0; + lclVisualConfigs[i].transparentIndex = 0; + i++; + } + } + } + } + } } if (i != lclNumConfigs) - GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs failed to alloc visual configs"); + GLAQUA_DEBUG_MSG("glAquaInitVisualConfigs failed to alloc visual configs"); GlxSetVisualConfigs(lclNumConfigs, lclVisualConfigs, lclVisualPrivates); } -// Copied from Mesa static void glAquaSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates) + void **privates) { GLAQUA_DEBUG_MSG("glAquaSetVisualConfigs\n"); @@ -1080,122 +1151,114 @@ visualPrivates = privates; } -// Copied from Mesa static Bool glAquaInitVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, - int *rootDepthp, VisualID *defaultVisp, - unsigned long sizes, int bitsPerRGB) + int *nvisualp, int *ndepthp, + int *rootDepthp, VisualID *defaultVisp, + unsigned long sizes, int bitsPerRGB) { GLAQUA_DEBUG_MSG("glAquaInitVisuals\n"); - if (0 == numConfigs) /* if no configs */ - glAquaInitVisualConfigs(); /* ensure the visula configs are setup */ + if (numConfigs == 0) /* if no configs */ + glAquaInitVisualConfigs(); /* ensure the visual configs are setup */ /* * Setup the visuals supported by this particular screen. */ return init_visuals(nvisualp, visualp, defaultVisp, - *ndepthp, *depthp, *rootDepthp); + *ndepthp, *depthp, *rootDepthp); } + static void fixup_visuals(int screen) { ScreenPtr pScreen = screenInfo.screens[screen]; glAquaScreenRec *pScr = &glAquaScreens[screen]; - __GLXvisualConfig *pGLXVis = pScr->glx_vis; - VisualPtr pVis; - int i, j; + int j; + __GLcontextModes *modes; GLAQUA_DEBUG_MSG("fixup_visuals\n"); - for (i = 0; i < pScr->num_vis; i++, pGLXVis++) { - pVis = pScreen->visuals; - - /* Find a visual that matches the GLX visual's class and size */ - for (j = 0; j < pScreen->numVisuals; j++, pVis++) { - if (pVis->class == pGLXVis->class && - pVis->nplanes == pGLXVis->bufferSize) { - - /* Fixup the masks */ - pGLXVis->redMask = pVis->redMask; - pGLXVis->greenMask = pVis->greenMask; - pGLXVis->blueMask = pVis->blueMask; - - /* Recalc the sizes */ - pGLXVis->redSize = count_bits(pGLXVis->redMask); - pGLXVis->greenSize = count_bits(pGLXVis->greenMask); - pGLXVis->blueSize = count_bits(pGLXVis->blueMask); - } - } + for ( modes = pScr->modes ; modes != NULL ; modes = modes->next ) { + const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); + const int nplanes = (modes->rgbBits - modes->alphaBits); + const VisualPtr pVis = pScreen->visuals; + + /* Find a visual that matches the GLX visual's class and size */ + for (j = 0; j < pScreen->numVisuals; j++) { + if (pVis[j].class == vis_class && + pVis[j].nplanes == nplanes) { + + /* Fixup the masks */ + modes->redMask = pVis[j].redMask; + modes->greenMask = pVis[j].greenMask; + modes->blueMask = pVis[j].blueMask; + + /* Recalc the sizes */ + modes->redBits = count_bits(modes->redMask); + modes->greenBits = count_bits(modes->greenMask); + modes->blueBits = count_bits(modes->blueMask); + } + } } } static void init_screen_visuals(int screen) { ScreenPtr pScreen = screenInfo.screens[screen]; - __GLXvisualConfig *pGLXVis = glAquaScreens[screen].glx_vis; - // XMesaVisual *pXMesaVisual; - VisualPtr pVis; + __GLcontextModes *modes; int *used; int i, j; GLAQUA_DEBUG_MSG("init_screen_visuals\n"); - /* Alloc space for the list of XMesa visuals */ - // pXMesaVisual = (XMesaVisual *)__glXMalloc(MESAScreens[screen].num_vis * - // sizeof(XMesaVisual)); - // __glXMemset(pXMesaVisual, 0, - // MESAScreens[screen].num_vis * sizeof(XMesaVisual)); - + /* FIXME: Change 'used' to be a array of bits (rather than of ints), + * FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less + * FIXME: than 64 or 128 the stack array can be used instead of calling + * FIXME: __glXMalloc / __glXFree. If nothing else, convert 'used' to + * FIXME: array of bytes instead of ints! + */ used = (int *)__glXMalloc(pScreen->numVisuals * sizeof(int)); __glXMemset(used, 0, pScreen->numVisuals * sizeof(int)); - for (i = 0; i < glAquaScreens[screen].num_vis; i++, pGLXVis++) { - pVis = pScreen->visuals; - for (j = 0; j < pScreen->numVisuals; j++, pVis++) { - - if (pVis->class == pGLXVis->class && - pVis->nplanes == pGLXVis->bufferSize && - !used[j]) { - - if (pVis->redMask == pGLXVis->redMask && - pVis->greenMask == pGLXVis->greenMask && - pVis->blueMask == pGLXVis->blueMask) { - - /* Create the XMesa visual */ - /* - pXMesaVisual[i] = - XMesaCreateVisual(pScreen, - pVis, - pGLXVis->rgba, - (pGLXVis->alphaSize > 0), - pGLXVis->doubleBuffer, - pGLXVis->stereo, - GL_TRUE, // ximage_flag - pGLXVis->depthSize, - pGLXVis->stencilSize, - pGLXVis->accumRedSize, - pGLXVis->accumGreenSize, - pGLXVis->accumBlueSize, - pGLXVis->accumAlphaSize, - 0, // numSamples - pGLXVis->level, - pGLXVis->visualRating ); - */ - /* Set the VisualID */ - pGLXVis->vid = pVis->vid; - - /* Mark this visual used */ - used[j] = 1; - break; - } - } - } + i = 0; + for ( modes = glAquaScreens[screen].modes + ; modes != NULL + ; modes = modes->next ) { + const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); + const int nplanes = (modes->rgbBits - modes->alphaBits); + const VisualPtr pVis = pScreen->visuals; + + for (j = 0; j < pScreen->numVisuals; j++) { + if (pVis[j].class == vis_class && + pVis[j].nplanes == nplanes && + pVis[j].redMask == modes->redMask && + pVis[j].greenMask == modes->greenMask && + pVis[j].blueMask == modes->blueMask && + !used[j]) { + + /* Set the VisualID */ + modes->visualID = pVis[j].vid; + + /* Mark this visual used */ + used[j] = 1; + break; + } + } + if ( j == pScreen->numVisuals ) { + ErrorF("No matching visual for __GLcontextMode with " + "visual class = %d (%d), nplanes = %u\n", + vis_class, + (int)modes->visualType, + (unsigned int)(modes->rgbBits - modes->alphaBits) ); + } + else if ( modes->visualID == -1 ) { + FatalError( "Matching visual found, but visualID still -1!\n" ); + } + + i++; } __glXFree(used); - - // glAquaScreens[screen].xm_vis = pXMesaVisual; } static Bool glAquaScreenProbe(int screen) @@ -1208,10 +1271,10 @@ /* * Set up the current screen's visuals. */ - __glDDXScreenInfo.pGlxVisual = glAquaScreens[screen].glx_vis; + __glDDXScreenInfo.modes = glAquaScreens[screen].modes; __glDDXScreenInfo.pVisualPriv = glAquaScreens[screen].priv; __glDDXScreenInfo.numVisuals = - __glDDXScreenInfo.numUsableVisuals = glAquaScreens[screen].num_vis; + __glDDXScreenInfo.numUsableVisuals = glAquaScreens[screen].num_vis; /* * Set the current screen's createContext routine. This could be @@ -1231,7 +1294,9 @@ */ init_screen_visuals(screen); - // Wrap RealizeWindow and UnrealizeWindow on this screen + /* + * Wrap RealizeWindow and UnrealizeWindow on this screen + */ pScreen = screenInfo.screens[screen]; screenPriv = &glAquaScreens[screen]; screenPriv->RealizeWindow = pScreen->RealizeWindow; @@ -1253,9 +1318,9 @@ if (gc != NULL && gc->ctx != NULL) { - gl_err = CGLFlushDrawable(gc->ctx); - if (gl_err != 0) - ErrorF("CGLFlushDrawable error: %s\n", CGLErrorString(gl_err)); + gl_err = CGLFlushDrawable(gc->ctx); + if (gl_err != 0) + ErrorF("CGLFlushDrawable error: %s\n", CGLErrorString(gl_err)); } return GL_TRUE; @@ -1308,24 +1373,24 @@ case GL_MAP2_VERTEX_4: case GL_MAP2_COLOR_4: case GL_MAP2_TEXTURE_COORD_4: - return 4; + return 4; case GL_MAP1_VERTEX_3: case GL_MAP1_TEXTURE_COORD_3: case GL_MAP1_NORMAL: case GL_MAP2_VERTEX_3: case GL_MAP2_TEXTURE_COORD_3: case GL_MAP2_NORMAL: - return 3; + return 3; case GL_MAP1_TEXTURE_COORD_2: case GL_MAP2_TEXTURE_COORD_2: - return 2; + return 2; case GL_MAP1_TEXTURE_COORD_1: case GL_MAP2_TEXTURE_COORD_1: case GL_MAP1_INDEX: case GL_MAP2_INDEX: - return 1; + return 1; default: - return 0; + return 0; } } @@ -1334,8 +1399,8 @@ int c = 0; while (val > 1) { - c++; - val >>= 1; + c++; + val >>= 1; } return c; } Index: xc/programs/Xserver/GL/dri/Imakefile diff -u xc/programs/Xserver/GL/dri/Imakefile:1.7 xc/programs/Xserver/GL/dri/Imakefile:1.12 --- xc/programs/Xserver/GL/dri/Imakefile:1.7 Tue Feb 11 16:34:04 2003 +++ xc/programs/Xserver/GL/dri/Imakefile Mon Feb 28 22:48:50 2005 @@ -1,4 +1,50 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/dri/Imakefile,v 1.7 2003/02/11 21:34:04 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/GL/dri/Imakefile,v 1.12 2005/03/01 03:48:50 dawes Exp $ +/* + * Copyright (c) 2000-2005 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #define IHaveModules #include @@ -12,17 +58,18 @@ OBJS = xf86dri.o dri.o $(MOBJ) INCLUDES = -I$(SERVERSRC)/include -I$(INCLUDESRC) -I$(XINCLUDESRC) \ - -I$(EXTINCSRC) \ + -I$(EXTINCSRC) -I$(MESASRCDIR)/include \ -I$(XF86OSSRC) -I$(XF86COMSRC) \ -I../include -I../glx -I$(LIBSRC)/GL/include \ - -I$(SERVERSRC)/mi -I$(FONTINCSRC) + -I$(SERVERSRC)/mi -I$(FONTINCSRC) \ + -I$(DRMINCLUDESDIR) DEFINES = $(GLX_DEFINES) -LinkSourceFile(xf86dri.h,$(LIBSRC)/GL/dri) -LinkSourceFile(xf86dristr.h,$(LIBSRC)/GL/dri) +LinkSourceFile(xf86dri.h,$(LIBSRC)/GL/glx) +LinkSourceFile(xf86dristr.h,$(LIBSRC)/GL/glx) ModuleObjectRule() -LibraryModuleTarget(dri,$(OBJS)) +LibraryModuleTarget(dri,$(OBJS),extensions) InstallLibraryModule(dri,$(MODULEDIR),extensions) DependTarget() Index: xc/programs/Xserver/GL/dri/dri.c diff -u xc/programs/Xserver/GL/dri/dri.c:1.40 xc/programs/Xserver/GL/dri/dri.c:1.42 --- xc/programs/Xserver/GL/dri/dri.c:1.40 Fri Jan 30 09:31:58 2004 +++ xc/programs/Xserver/GL/dri/dri.c Fri Dec 10 11:06:58 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/dri/dri.c,v 1.40 2004/01/30 14:31:58 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/dri.c,v 1.42 2004/12/10 16:06:58 alanh Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -34,8 +34,8 @@ * */ -#ifdef XFree86LOADER #include "xf86.h" +#ifdef XFree86LOADER #include "xf86_ansic.h" #else #include @@ -57,6 +57,7 @@ #define _XF86DRI_SERVER_ #include "xf86dristr.h" #include "swaprep.h" +#include "xf86str.h" #include "dri.h" #include "sarea.h" #include "dristruct.h" @@ -113,11 +114,14 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) { DRIScreenPrivPtr pDRIPriv; - drmContextPtr reserved; + drm_context_t * reserved; int reserved_count; int i, fd, drmWasAvailable; Bool xineramaInCore = FALSE; int err = 0; + char *openbusid; + drmVersionPtr drmlibv; + int drmlibmajor, drmlibminor, drmdimajor, drmdiminor; if (DRIGeneration != serverGeneration) { if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0) @@ -148,8 +152,31 @@ drmWasAvailable = drmAvailable(); + /* Check the DRM lib version. + * drmGetLibVersion was not supported in version 1.0, so check for + * symbol first to avoid possible crash or hang. + */ + drmlibmajor = 1; + drmlibminor = 0; + if (xf86LoaderCheckSymbol("drmGetLibVersion")) { + drmlibv = drmGetLibVersion(-1); + if (drmlibv != NULL) { + drmlibmajor = drmlibv->version_major; + drmlibminor = drmlibv->version_minor; + drmFreeVersion(drmlibv); + } + } + + /* Check if the libdrm can handle falling back to loading based on name + * if a busid string is passed. + */ + if (drmlibmajor == 1 && drmlibminor >= 2) + openbusid = pDRIInfo->busIdString; + else + openbusid = NULL; + /* Note that drmOpen will try to load the kernel module, if needed. */ - fd = drmOpen(pDRIInfo->drmDriverName, NULL ); + fd = drmOpen(pDRIInfo->drmDriverName, openbusid); if (fd < 0) { /* failed to open DRM */ pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; @@ -184,7 +211,40 @@ pDRIPriv->grabbedDRILock = FALSE; pDRIPriv->drmSIGIOHandlerInstalled = FALSE; - if ((err = drmSetBusid(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString)) < 0) { + if (drmlibmajor == 1 && drmlibminor >= 2) { + drmSetVersion sv; + + /* Get the interface version, asking for 1.1. */ + sv.drm_di_major = 1; + sv.drm_di_minor = 1; + sv.drm_dd_major = -1; + err = drmSetInterfaceVersion(pDRIPriv->drmFD, &sv); + if (err == 0) { + drmdimajor = sv.drm_di_major; + drmdiminor = sv.drm_di_minor; + } else { + /* failure, so set it to 1.0.0. */ + drmdimajor = 1; + drmdiminor = 0; + } + } + else { + /* We can't check the DI DRM interface version, so set it to 1.0.0. */ + drmdimajor = 1; + drmdiminor = 0; + } + DRIDrvMsg(pScreen->myNum, X_INFO, + "[drm] DRM interface version %d.%d\n", drmdimajor, drmdiminor); + + /* If the interface minor number is 1.1, then we've opened a DRM device + * that already had the busid set through drmOpen. + */ + if (drmdimajor == 1 && drmdiminor >= 1) + err = 0; + else + err = drmSetBusid(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString); + + if (err < 0) { pDRIPriv->directRenderingSupport = FALSE; pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; drmClose(pDRIPriv->drmFD); @@ -235,7 +295,7 @@ pDRIPriv->hSAREA, pDRIPriv->pSAREA); if (drmAddMap( pDRIPriv->drmFD, - (drmHandle)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress, + (drm_handle_t)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress, pDRIPriv->pDriverInfo->frameBufferSize, DRM_FRAME_BUFFER, 0, @@ -424,7 +484,7 @@ { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIInfoPtr pDRIInfo; - drmContextPtr reserved; + drm_context_t * reserved; int reserved_count; if (pDRIPriv && pDRIPriv->directRenderingSupport) { @@ -575,7 +635,7 @@ } Bool -DRIOpenConnection(ScreenPtr pScreen, drmHandlePtr hSAREA, char **busIdString) +DRIOpenConnection(ScreenPtr pScreen, drm_handle_t * hSAREA, char **busIdString) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -586,7 +646,7 @@ } Bool -DRIAuthConnection(ScreenPtr pScreen, drmMagic magic) +DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -620,18 +680,18 @@ /* DRICreateContextPriv and DRICreateContextPrivFromHandle are helper functions that layer on drmCreateContext and drmAddContextTag. - DRICreateContextPriv always creates a kernel drmContext and then calls + DRICreateContextPriv always creates a kernel drm_context_t and then calls DRICreateContextPrivFromHandle to create a DRIContextPriv structure for - DRI tracking. For the SIGIO handler, the drmContext is associated with + DRI tracking. For the SIGIO handler, the drm_context_t is associated with DRIContextPrivPtr. Any special flags are stored in the DRIContextPriv area and are passed to the kernel (if necessary). DRICreateContextPriv returns a pointer to newly allocated - DRIContextPriv, and returns the kernel drmContext in pHWContext. */ + DRIContextPriv, and returns the kernel drm_context_t in pHWContext. */ DRIContextPrivPtr DRICreateContextPriv(ScreenPtr pScreen, - drmContextPtr pHWContext, + drm_context_t * pHWContext, DRIContextFlags flags) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -645,7 +705,7 @@ DRIContextPrivPtr DRICreateContextPrivFromHandle(ScreenPtr pScreen, - drmContext hHWContext, + drm_context_t hHWContext, DRIContextFlags flags) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -720,8 +780,8 @@ DRICreateDummyContext(ScreenPtr pScreen, Bool needCtxPriv) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - __GLXscreenInfo *pGLXScreen = &__glXActiveScreens[pScreen->myNum]; - __GLXvisualConfig *pGLXVis = pGLXScreen->pGlxVisual; + __GLXscreenInfo *pGLXScreen = __glXgetActiveScreen(pScreen->myNum); + __GLcontextModes *modes = pGLXScreen->modes; void **pVisualConfigPriv = pGLXScreen->pVisualPriv; DRIContextPrivPtr pDRIContextPriv; void *contextStore; @@ -734,7 +794,7 @@ for (visNum = 0; visNum < pScreen->numVisuals; visNum++, visual++) { - if (pGLXVis->vid == visual->vid) + if (modes->visualID == visual->vid) break; } if (visNum == pScreen->numVisuals) return FALSE; @@ -781,15 +841,14 @@ Bool DRICreateContext(ScreenPtr pScreen, VisualPtr visual, - XID context, drmContextPtr pHWContext) + XID context, drm_context_t * pHWContext) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - __GLXscreenInfo *pGLXScreen = &__glXActiveScreens[pScreen->myNum]; - __GLXvisualConfig *pGLXVis = pGLXScreen->pGlxVisual; + __GLXscreenInfo *pGLXScreen = __glXgetActiveScreen(pScreen->myNum); + __GLcontextModes *modes = pGLXScreen->modes; void **pVisualConfigPriv = pGLXScreen->pVisualPriv; DRIContextPrivPtr pDRIContextPriv; void *contextStore; - int visNum; if (pDRIPriv->createDummyCtx && !pDRIPriv->dummyCtxPriv) { if (!DRICreateDummyContext(pScreen, pDRIPriv->createDummyCtxPriv)) { @@ -800,12 +859,13 @@ } /* Find the GLX visual associated with the one requested */ - for (visNum = 0; - visNum < pGLXScreen->numVisuals; - visNum++, pGLXVis++, pVisualConfigPriv++) - if (pGLXVis->vid == visual->vid) + for (modes = pGLXScreen->modes; modes != NULL; modes = modes->next) { + if (modes->visualID == visual->vid) break; - if (visNum == pGLXScreen->numVisuals) { + pVisualConfigPriv++; + } + + if (modes == NULL) { /* No matching GLX visual found */ return FALSE; } @@ -928,7 +988,7 @@ Bool DRICreateDrawable(ScreenPtr pScreen, Drawable id, - DrawablePtr pDrawable, drmDrawablePtr hHWDrawable) + DrawablePtr pDrawable, drm_drawable_t * hHWDrawable) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIDrawablePrivPtr pDRIDrawablePriv; @@ -945,7 +1005,7 @@ return FALSE; } - /* Only create a drmDrawable once */ + /* Only create a drm_drawable_t once */ if (drmCreateDrawable(pDRIPriv->drmFD, hHWDrawable)) { xfree(pDRIDrawablePriv); return FALSE; @@ -1065,11 +1125,11 @@ int* W, int* H, int* numClipRects, - XF86DRIClipRectPtr* pClipRects, + drm_clip_rect_t ** pClipRects, int* backX, int* backY, int* numBackClipRects, - XF86DRIClipRectPtr* pBackClipRects) + drm_clip_rect_t ** pBackClipRects) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIDrawablePrivPtr pDRIDrawablePriv, pOldDrawPriv; @@ -1165,7 +1225,7 @@ *W = (int)(pWin->drawable.width); *H = (int)(pWin->drawable.height); *numClipRects = REGION_NUM_RECTS(&pWin->clipList); - *pClipRects = (XF86DRIClipRectPtr)REGION_RECTS(&pWin->clipList); + *pClipRects = (drm_clip_rect_t *)REGION_RECTS(&pWin->clipList); if (!*numClipRects && pDRIPriv->fullscreen) { /* use fake full-screen clip rect */ @@ -1222,7 +1282,7 @@ Bool DRIGetDeviceInfo(ScreenPtr pScreen, - drmHandlePtr hFrameBuffer, + drm_handle_t * hFrameBuffer, int* fbOrigin, int* fbSize, int* fbStride, @@ -1870,7 +1930,7 @@ return (void *)(((char*)pDRIPriv->pSAREA)+sizeof(XF86DRISAREARec)); } -drmContext +drm_context_t DRIGetContext(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1967,7 +2027,7 @@ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; WindowPtr pWin = (WindowPtr)pDrawable; - XF86DRIClipRectPtr pClipRects = (void *)REGION_RECTS(&pWin->clipList); + drm_clip_rect_t * pClipRects = (void *)REGION_RECTS(&pWin->clipList); _DRIAdjustFrame(pScrn, pDRIPriv, pScrn->frameX0, pScrn->frameY0); @@ -2115,3 +2175,21 @@ } else *xdir = 1; } + +char * +DRICreatePCIBusID(pciVideoPtr PciInfo) +{ + char *busID; + int domain; + PCITAG tag; + + busID = xalloc(20); + if (busID == NULL) + return NULL; + + tag = pciTag(PciInfo->bus, PciInfo->device, PciInfo->func); + domain = xf86GetPciDomain(tag); + snprintf(busID, 20, "pci:%04x:%02x:%02x.%d", domain, PciInfo->bus, + PciInfo->device, PciInfo->func); + return busID; +} Index: xc/programs/Xserver/GL/dri/dri.h diff -u xc/programs/Xserver/GL/dri/dri.h:1.19 xc/programs/Xserver/GL/dri/dri.h:1.22 --- xc/programs/Xserver/GL/dri/dri.h:1.19 Wed Oct 30 07:52:03 2002 +++ xc/programs/Xserver/GL/dri/dri.h Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/dri/dri.h,v 1.19 2002/10/30 12:52:03 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/dri.h,v 1.22 2004/12/10 16:06:59 alanh Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -105,11 +105,11 @@ */ Bool (*CreateContext)(ScreenPtr pScreen, VisualPtr visual, - drmContext hHWContext, + drm_context_t hHWContext, void* pVisualConfigPriv, DRIContextType context); void (*DestroyContext)(ScreenPtr pScreen, - drmContext hHWContext, + drm_context_t hHWContext, DRIContextType context); void (*SwapContext)(ScreenPtr pScreen, DRISyncType syncType, @@ -175,10 +175,10 @@ Bool *isCapable); extern Bool DRIOpenConnection(ScreenPtr pScreen, - drmHandlePtr hSAREA, + drm_handle_t * hSAREA, char **busIdString); -extern Bool DRIAuthConnection(ScreenPtr pScreen, drmMagic magic); +extern Bool DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic); extern Bool DRICloseConnection(ScreenPtr pScreen); @@ -191,7 +191,7 @@ extern Bool DRICreateContext(ScreenPtr pScreen, VisualPtr visual, XID context, - drmContextPtr pHWContext); + drm_context_t * pHWContext); extern Bool DRIDestroyContext(ScreenPtr pScreen, XID context); @@ -200,7 +200,7 @@ extern Bool DRICreateDrawable(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable, - drmDrawablePtr hHWDrawable); + drm_drawable_t * hHWDrawable); extern Bool DRIDestroyDrawable(ScreenPtr pScreen, Drawable id, @@ -218,14 +218,14 @@ int* W, int* H, int* numClipRects, - XF86DRIClipRectPtr* pClipRects, + drm_clip_rect_t ** pClipRects, int* backX, int* backY, int* numBackClipRects, - XF86DRIClipRectPtr* pBackClipRects); + drm_clip_rect_t ** pBackClipRects); extern Bool DRIGetDeviceInfo(ScreenPtr pScreen, - drmHandlePtr hFrameBuffer, + drm_handle_t * hFrameBuffer, int* fbOrigin, int* fbSize, int* fbStride, @@ -298,16 +298,16 @@ CARD32 drawable_index); extern DRIContextPrivPtr DRICreateContextPriv(ScreenPtr pScreen, - drmContextPtr pHWContext, + drm_context_t * pHWContext, DRIContextFlags flags); extern DRIContextPrivPtr DRICreateContextPrivFromHandle(ScreenPtr pScreen, - drmContext hHWContext, + drm_context_t hHWContext, DRIContextFlags flags); extern Bool DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv); -extern drmContext DRIGetContext(ScreenPtr pScreen); +extern drm_context_t DRIGetContext(ScreenPtr pScreen); extern void DRIQueryVersion(int *majorVersion, int *minorVersion, @@ -325,6 +325,8 @@ int *ydir, RegionPtr reg); +extern char *DRICreatePCIBusID(pciVideoPtr PciInfo); + #define _DRI_H_ #endif Index: xc/programs/Xserver/GL/dri/drimodule.c diff -u xc/programs/Xserver/GL/dri/drimodule.c:1.6 xc/programs/Xserver/GL/dri/drimodule.c:1.7 --- xc/programs/Xserver/GL/dri/drimodule.c:1.6 Mon Dec 10 14:07:19 2001 +++ xc/programs/Xserver/GL/dri/drimodule.c Mon Feb 28 22:48:50 2005 @@ -24,7 +24,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/GL/dri/drimodule.c,v 1.6 2001/12/10 19:07:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/drimodule.c,v 1.7 2005/03/01 03:48:50 dawes Exp $ */ /* * Authors: @@ -95,27 +95,18 @@ static pointer driSetup(pointer module, pointer opts, int *errmaj, int *errmin) { - static Bool setupDone = FALSE; pointer drm = NULL; - if (!setupDone) { - setupDone = TRUE; + drm = LoadSubModule(module, "drm", NULL, NULL, NULL, NULL, errmaj, errmin); - drm = - LoadSubModule(module, "drm", NULL, NULL, NULL, NULL, errmaj, errmin); - - if (!drm) { - if (errmaj) *errmaj = LDR_NOSUBENT; - } - else { - LoaderReqSymLists(drmSymbols, NULL); - LoaderRefSymbols("noPanoramiXExtension", NULL); - LoadExtension(&XF86DRIExt, FALSE); - } + if (!drm) { + if (errmaj) *errmaj = LDR_NOSUBENT; } else { - if (errmaj) *errmaj = LDR_ONCEONLY; + LoaderReqSymLists(drmSymbols, NULL); + LoaderRefSymbols("noPanoramiXExtension", NULL); + LoadExtension(&XF86DRIExt, FALSE); } - /* Need a non-NULL return value to indicate success */ + /* Need a non-NULL return value to indicate success. */ return drm; } Index: xc/programs/Xserver/GL/dri/dristruct.h diff -u xc/programs/Xserver/GL/dri/dristruct.h:1.13 xc/programs/Xserver/GL/dri/dristruct.h:1.14 --- xc/programs/Xserver/GL/dri/dristruct.h:1.13 Wed Nov 20 13:10:24 2002 +++ xc/programs/Xserver/GL/dri/dristruct.h Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/dri/dristruct.h,v 1.13 2002/11/20 18:10:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/dristruct.h,v 1.14 2004/12/10 16:06:59 alanh Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -50,7 +50,7 @@ typedef struct _DRIDrawablePrivRec { - drmDrawable hwDrawable; + drm_drawable_t hwDrawable; int drawableIndex; ScreenPtr pScreen; int refCount; @@ -58,7 +58,7 @@ struct _DRIContextPrivRec { - drmContext hwContext; + drm_context_t hwContext; ScreenPtr pScreen; Bool valid3D; DRIContextFlags flags; @@ -78,19 +78,19 @@ { Bool directRenderingSupport; int drmFD; /* File descriptor for /dev/video/? */ - drmHandle hSAREA; /* Handle to SAREA, for mapping */ + drm_handle_t hSAREA; /* Handle to SAREA, for mapping */ XF86DRISAREAPtr pSAREA; /* Mapped pointer to SAREA */ - drmHandle hFrameBuffer; /* Handle to framebuffer, for mapping */ - drmContext myContext; /* DDX Driver's context */ + drm_handle_t hFrameBuffer; /* Handle to framebuffer, for mapping */ + drm_context_t myContext; /* DDX Driver's context */ DRIContextPrivPtr myContextPriv;/* Pointer to server's private area */ DRIContextPrivPtr lastPartial3DContext; /* last one partially saved */ void** hiddenContextStore; /* hidden X context */ void** partial3DContextStore; /* parital 3D context */ DRIInfoPtr pDriverInfo; int nrWindows; - XF86DRIClipRectRec private_buffer_rect; /* management of private buffers */ + drm_clip_rect_t private_buffer_rect; /* management of private buffers */ DrawablePtr fullscreen; /* pointer to fullscreen drawable */ - XF86DRIClipRectRec fullscreen_rect; /* fake rect for fullscreen mode */ + drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */ DRIWrappedFuncsRec wrap; DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES]; DRIContextPrivPtr dummyCtxPriv; /* Pointer to dummy context */ Index: xc/programs/Xserver/GL/dri/sarea.h diff -u xc/programs/Xserver/GL/dri/sarea.h:1.12 xc/programs/Xserver/GL/dri/sarea.h:1.13 --- xc/programs/Xserver/GL/dri/sarea.h:1.12 Sun Sep 28 16:15:41 2003 +++ xc/programs/Xserver/GL/dri/sarea.h Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/dri/sarea.h,v 1.12 2003/09/28 20:15:41 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/sarea.h,v 1.13 2004/12/10 16:06:59 alanh Exp $ */ /** * \file sarea.h * SAREA definitions. @@ -34,7 +34,7 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/GL/dri/sarea.h,v 1.12 2003/09/28 20:15:41 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/sarea.h,v 1.13 2004/12/10 16:06:59 alanh Exp $ */ #ifndef _SAREA_H_ #define _SAREA_H_ @@ -88,7 +88,7 @@ drmLock drawable_lock; XF86DRISAREADrawableRec drawableTable[SAREA_MAX_DRAWABLES]; XF86DRISAREAFrameRec frame; - drmContext dummy_context; + drm_context_t dummy_context; } XF86DRISAREARec, *XF86DRISAREAPtr; #endif Index: xc/programs/Xserver/GL/dri/xf86dri.c diff -u xc/programs/Xserver/GL/dri/xf86dri.c:1.13 xc/programs/Xserver/GL/dri/xf86dri.c:1.14 --- xc/programs/Xserver/GL/dri/xf86dri.c:1.13 Tue Sep 23 22:43:12 2003 +++ xc/programs/Xserver/GL/dri/xf86dri.c Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/dri/xf86dri.c,v 1.13 2003/09/24 02:43:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/xf86dri.c,v 1.14 2004/12/10 16:06:59 alanh Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -35,8 +35,8 @@ * */ -#ifdef XFree86LOADER #include "xf86.h" +#ifdef XFree86LOADER #include "xf86_ansic.h" #endif @@ -54,6 +54,7 @@ #define _XF86DRI_SERVER_ #include "xf86dristr.h" #include "swaprep.h" +#include "xf86str.h" #include "dri.h" #include "sarea.h" #include "dristruct.h" @@ -184,7 +185,7 @@ ) { xXF86DRIOpenConnectionReply rep; - drmHandle hSAREA; + drm_handle_t hSAREA; char* busIdString; REQUEST(xXF86DRIOpenConnectionReq); @@ -340,7 +341,7 @@ if (!DRICreateContext( pScreen, visual, stuff->context, - (drmContextPtr)&rep.hHWContext)) { + (drm_context_t *)&rep.hHWContext)) { return BadValue; } @@ -397,7 +398,7 @@ if (!DRICreateDrawable( screenInfo.screens[stuff->screen], (Drawable)stuff->drawable, pDrawable, - (drmDrawablePtr)&rep.hHWDrawable)) { + (drm_drawable_t *)&rep.hHWDrawable)) { return BadValue; } @@ -442,8 +443,8 @@ xXF86DRIGetDrawableInfoReply rep; DrawablePtr pDrawable; int X, Y, W, H; - XF86DRIClipRectPtr pClipRects; - XF86DRIClipRectPtr pBackClipRects; + drm_clip_rect_t * pClipRects; + drm_clip_rect_t * pBackClipRects; int backX, backY; REQUEST(xXF86DRIGetDrawableInfoReq); @@ -492,10 +493,10 @@ rep.backY = backY; if (rep.numBackClipRects) - rep.length += sizeof(XF86DRIClipRectRec) * rep.numBackClipRects; + rep.length += sizeof(drm_clip_rect_t) * rep.numBackClipRects; if (rep.numClipRects) - rep.length += sizeof(XF86DRIClipRectRec) * rep.numClipRects; + rep.length += sizeof(drm_clip_rect_t) * rep.numClipRects; rep.length = ((rep.length + 3) & ~3) >> 2; @@ -503,13 +504,13 @@ if (rep.numClipRects) { WriteToClient(client, - sizeof(XF86DRIClipRectRec) * rep.numClipRects, + sizeof(drm_clip_rect_t) * rep.numClipRects, (char *)pClipRects); } if (rep.numBackClipRects) { WriteToClient(client, - sizeof(XF86DRIClipRectRec) * rep.numBackClipRects, + sizeof(drm_clip_rect_t) * rep.numBackClipRects, (char *)pBackClipRects); } @@ -522,7 +523,7 @@ ) { xXF86DRIGetDeviceInfoReply rep; - drmHandle hFrameBuffer; + drm_handle_t hFrameBuffer; void *pDevPrivate; REQUEST(xXF86DRIGetDeviceInfoReq); Index: xc/programs/Xserver/GL/glx/Imakefile diff -u xc/programs/Xserver/GL/glx/Imakefile:1.12 xc/programs/Xserver/GL/glx/Imakefile:1.17 --- xc/programs/Xserver/GL/glx/Imakefile:1.12 Wed Feb 11 21:25:00 2004 +++ xc/programs/Xserver/GL/glx/Imakefile Fri Dec 10 11:06:59 2004 @@ -1,4 +1,50 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/glx/Imakefile,v 1.12 2004/02/12 02:25:00 torrey Exp $ +XCOMM $XFree86: xc/programs/Xserver/GL/glx/Imakefile,v 1.17 2004/12/10 16:06:59 alanh Exp $ +/* + * Copyright (c) 2000-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #if DoLoadableServer # if !BuildModuleInSubdir @@ -9,8 +55,22 @@ # endif #endif +#ifdef IHaveModules +MSRCS = glxmodule.c +MOBJS = glxmodule.o +#endif + +/* Large PIC tables needed for SPARC builds */ +#if defined(sparc) || defined(SparcArchitecture) +# define LargePICTable YES + PICFLAGS = LargePositionIndependentCFlags +#endif + #include +LinkSourceFile(glcontextmodes.c, $(MESASRCDIR)/src/mesa/drivers/dri/common) +LinkSourceFile(glcontextmodes.h, $(MESASRCDIR)/src/mesa/drivers/dri/common) + SRCS = global.c glxbuf.c glxcmds.c glxcmdsswap.c glxext.c \ glxfb.c glximports.c glxmem.c glxpix.c glxscreens.c \ glxutil.c render2.c render2swap.c renderpix.c \ @@ -18,7 +78,7 @@ single2swap.c singlepix.c singlepixswap.c \ singlesize.c xfont.c g_disptab.c g_disptab_EXT.c \ g_render.c g_renderswap.c g_single.c g_singleswap.c \ - $(MSRCS) + glcontextmodes.c $(MSRCS) OBJS = global.o glxbuf.o glxcmds.o glxcmdsswap.o glxext.o \ glxfb.o glximports.o glxmem.o glxpix.o glxscreens.o \ @@ -27,7 +87,7 @@ single2swap.o singlepix.o singlepixswap.o \ singlesize.o xfont.o g_disptab.o g_disptab_EXT.o \ g_render.o g_renderswap.o g_single.o g_singleswap.o \ - $(MOBJS) + glcontextmodes.o $(MOBJS) INCLUDES = -I$(SERVERSRC)/GL/glx -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/include -I$(INCLUDESRC) -I$(MESASRCDIR)/include \ -I$(XINCLUDESRC) -I$(SERVERSRC)/mi \ @@ -45,12 +105,13 @@ #ifdef IHaveModules ModuleObjectRule() -LibraryModuleTarget(glx,$(OBJS)) +LibraryModuleTarget(glx,$(OBJS),extensions) +InstallLibraryModule(glx,$(MODULEDIR),extensions) +InstallDriverSDKLibraryModule(glx,$(DRIVERSDKMODULEDIR),extensions) #else NormalLibraryObjectRule() NormalLibraryTarget(glx,$(OBJS)) #endif -SubdirLibraryRule($(OBJS)) LintLibraryTarget(glx,$(SRCS)) NormalLintTarget($(SRCS)) @@ -71,6 +132,7 @@ LinkSourceFile(glxfb.c,LinkDirectory) LinkSourceFile(glximports.c,LinkDirectory) LinkSourceFile(glxmem.c,LinkDirectory) +LinkSourceFile(glxmodule.c,LinkDirectory) LinkSourceFile(glxpix.c,LinkDirectory) LinkSourceFile(glxscreens.c,LinkDirectory) LinkSourceFile(glxutil.c,LinkDirectory) Index: xc/programs/Xserver/GL/glx/g_disptab.c diff -u xc/programs/Xserver/GL/glx/g_disptab.c:1.6 xc/programs/Xserver/GL/glx/g_disptab.c:1.7 --- xc/programs/Xserver/GL/glx/g_disptab.c:1.6 Wed Feb 11 21:25:00 2004 +++ xc/programs/Xserver/GL/glx/g_disptab.c Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.c,v 1.6 2004/02/12 02:25:00 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.c,v 1.7 2004/12/10 16:06:59 alanh Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ /* ** License Applicability. Except to the extent portions of this file are @@ -54,18 +54,18 @@ __glXQueryExtensionsString, __glXQueryServerString, __glXClientInfo, - __glXNoSuchSingleOpcode, /* glXGetFBConfigs */ - __glXNoSuchSingleOpcode, /* glXCreatePixmap */ - __glXNoSuchSingleOpcode, /* glXDestroyPixmap */ - __glXNoSuchSingleOpcode, /* glXCreateNewContext */ + __glXGetFBConfigs, + __glXCreatePixmap, + __glXDestroyGLXPixmap, /* glXDestroyPixmap */ + __glXCreateNewContext, __glXNoSuchSingleOpcode, /* glXQueryContext */ __glXMakeContextCurrent, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, /* glXCreatePbuffer */ + __glXNoSuchSingleOpcode, /* glXDestroyPbuffer */ + __glXNoSuchSingleOpcode, /* glXGetDrawableAttributes */ + __glXNoSuchSingleOpcode, /* glXChangeDrawableAttributes */ + __glXNoSuchSingleOpcode, /* glXCreateWindow */ + __glXNoSuchSingleOpcode, /* glXDestroyWindow */ __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, @@ -455,18 +455,18 @@ __glXSwapQueryExtensionsString, __glXSwapQueryServerString, __glXSwapClientInfo, - __glXNoSuchSingleOpcode, /* glXGetFBConfigs */ - __glXNoSuchSingleOpcode, /* glXCreatePixmap */ - __glXNoSuchSingleOpcode, /* glXDestroyPixmap */ - __glXNoSuchSingleOpcode, /* glXCreateNewContext */ + __glXSwapGetFBConfigs, + __glXSwapCreatePixmap, + __glXSwapDestroyGLXPixmap, /* glXDestroyPixmap */ + __glXSwapCreateNewContext, __glXNoSuchSingleOpcode, /* glXQueryContext */ __glXSwapMakeContextCurrent, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, + __glXNoSuchSingleOpcode, /* glXCreatePbuffer */ + __glXNoSuchSingleOpcode, /* glXDestroyPbuffer */ + __glXNoSuchSingleOpcode, /* glXGetDrawableAttributes */ + __glXNoSuchSingleOpcode, /* glXChangeDrawableAttributes */ + __glXNoSuchSingleOpcode, /* glXCreateWindow */ + __glXNoSuchSingleOpcode, /* glXDestroyWindow */ __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, __glXNoSuchSingleOpcode, Index: xc/programs/Xserver/GL/glx/g_disptab.h diff -u xc/programs/Xserver/GL/glx/g_disptab.h:1.5 xc/programs/Xserver/GL/glx/g_disptab.h:1.6 --- xc/programs/Xserver/GL/glx/g_disptab.h:1.5 Wed Jan 28 13:11:50 2004 +++ xc/programs/Xserver/GL/glx/g_disptab.h Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.h,v 1.5 2004/01/28 18:11:50 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/g_disptab.h,v 1.6 2004/12/10 16:06:59 alanh Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ #ifndef _GLX_g_disptab_h_ #define _GLX_g_disptab_h_ @@ -52,6 +52,9 @@ extern int __glXQueryServerString(__GLXclientState*, GLbyte*); extern int __glXClientInfo(__GLXclientState*, GLbyte*); extern int __glXMakeContextCurrent(__GLXclientState*, GLbyte*); +extern int __glXGetFBConfigs(__GLXclientState*, GLbyte*); +extern int __glXCreateNewContext(__GLXclientState*, GLbyte*); +extern int __glXCreatePixmap(__GLXclientState*, GLbyte*); extern int __glXDisp_NewList(__GLXclientState*, GLbyte*); extern int __glXDisp_EndList(__GLXclientState*, GLbyte*); @@ -349,6 +352,9 @@ extern int __glXSwapQueryServerString(__GLXclientState*, GLbyte*); extern int __glXSwapClientInfo(__GLXclientState*, GLbyte*); extern int __glXSwapMakeContextCurrent(__GLXclientState*, GLbyte*); +extern int __glXSwapGetFBConfigs(__GLXclientState*, GLbyte*); +extern int __glXSwapCreateNewContext(__GLXclientState*, GLbyte*); +extern int __glXSwapCreatePixmap(__GLXclientState*, GLbyte*); extern int __glXDispSwap_NewList(__GLXclientState*, GLbyte*); extern int __glXDispSwap_EndList(__GLXclientState*, GLbyte*); Index: xc/programs/Xserver/GL/glx/g_render.c diff -u xc/programs/Xserver/GL/glx/g_render.c:1.9 xc/programs/Xserver/GL/glx/g_render.c:1.12 --- xc/programs/Xserver/GL/glx/g_render.c:1.9 Wed Feb 11 21:25:01 2004 +++ xc/programs/Xserver/GL/glx/g_render.c Fri Dec 17 11:38:03 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_render.c,v 1.9 2004/02/12 02:25:01 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/g_render.c,v 1.12 2004/12/17 16:38:03 tsi Exp $ */ /* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ /* ** License Applicability. Except to the extent portions of this file are @@ -68,11 +68,15 @@ #define __GLX_SWAP_GLdouble(ptr) __GLX_SWAP_DOUBLE(ptr) #define __GLX_SWAP_GLfloat(ptr) __GLX_SWAP_FLOAT(ptr) -#define __GLX_SWAP_GLbyte_ARRAY(ptr,count) (void) swapEnd; (void) swapPC; (void) sw; +#define __GLX_SWAP_GLbyte_ARRAY(ptr,count) swapEnd = 0; (void)swapEnd; \ + swapPC = 0; (void)swapPC; \ + sw = 0; (void)sw #define __GLX_SWAP_GLshort_ARRAY(ptr,count) __GLX_SWAP_SHORT_ARRAY(ptr,count) #define __GLX_SWAP_GLint_ARRAY(ptr,count) __GLX_SWAP_INT_ARRAY(ptr,count) #define __GLX_SWAP_GLenum_ARRAY(ptr,count) __GLX_SWAP_INT_ARRAY(ptr,count) -#define __GLX_SWAP_GLubyte_ARRAY(ptr,count) (void) swapEnd; (void) swapPC; (void) sw; +#define __GLX_SWAP_GLubyte_ARRAY(ptr,count) swapEnd = 0; (void)swapEnd; \ + swapPC = 0; (void)swapPC; \ + sw = 0; (void)sw #define __GLX_SWAP_GLushort_ARRAY(ptr,count) __GLX_SWAP_SHORT_ARRAY(ptr,count) #define __GLX_SWAP_GLuint_ARRAY(ptr,count) __GLX_SWAP_INT_ARRAY(ptr,count) #define __GLX_SWAP_GLdouble_ARRAY(ptr,count) __GLX_SWAP_DOUBLE_ARRAY(ptr,count) @@ -2273,7 +2277,6 @@ *(GLfloat *)(pc + 8) ); } - #endif /* !MISSING_GL_EXTS */ void __glXDisp_SampleCoverageARB(GLbyte *pc) Index: xc/programs/Xserver/GL/glx/g_renderswap.c diff -u xc/programs/Xserver/GL/glx/g_renderswap.c:1.9 xc/programs/Xserver/GL/glx/g_renderswap.c:1.11 --- xc/programs/Xserver/GL/glx/g_renderswap.c:1.9 Wed Feb 11 21:25:01 2004 +++ xc/programs/Xserver/GL/glx/g_renderswap.c Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_renderswap.c,v 1.9 2004/02/12 02:25:01 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/g_renderswap.c,v 1.11 2004/12/10 16:06:59 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -3368,7 +3368,6 @@ *(GLfloat *)(pc + 8) ); } - #endif /* !MISSING_GL_EXTS */ void __glXDispSwap_SampleCoverageARB(GLbyte *pc) Index: xc/programs/Xserver/GL/glx/g_singleswap.c diff -u xc/programs/Xserver/GL/glx/g_singleswap.c:1.5 xc/programs/Xserver/GL/glx/g_singleswap.c:1.7 --- xc/programs/Xserver/GL/glx/g_singleswap.c:1.5 Mon Jan 14 17:47:08 2002 +++ xc/programs/Xserver/GL/glx/g_singleswap.c Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/g_singleswap.c,v 1.5 2002/01/14 22:47:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/g_singleswap.c,v 1.7 2004/12/10 16:06:59 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free Index: xc/programs/Xserver/GL/glx/glx-def.cpp diff -u xc/programs/Xserver/GL/glx/glx-def.cpp:1.1 xc/programs/Xserver/GL/glx/glx-def.cpp:1.2 --- xc/programs/Xserver/GL/glx/glx-def.cpp:1.1 Thu Aug 10 13:40:29 2000 +++ xc/programs/Xserver/GL/glx/glx-def.cpp Fri Dec 10 11:06:59 2004 @@ -92,7 +92,6 @@ __glXDeassociateContext __glXDestroyDrawablePrivate __glXFindDrawablePrivate -__glXFormatGLModes __glXFree __glXGetDrawablePrivate __glXGetDrawableSize @@ -660,4 +659,4 @@ __glXDispSwap_PixelStoref __glXDispSwap_PixelStorei -/* $XFree86: xc/programs/Xserver/GL/glx/glx-def.cpp,v 1.1 2000/08/10 17:40:29 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glx-def.cpp,v 1.2 2004/12/10 16:06:59 alanh Exp $ */ Index: xc/programs/Xserver/GL/glx/glxcmds.c diff -u xc/programs/Xserver/GL/glx/glxcmds.c:1.13 xc/programs/Xserver/GL/glx/glxcmds.c:1.14 --- xc/programs/Xserver/GL/glx/glxcmds.c:1.13 Wed Feb 11 21:25:01 2004 +++ xc/programs/Xserver/GL/glx/glxcmds.c Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcmds.c,v 1.13 2004/02/12 02:25:01 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxcmds.c,v 1.14 2004/12/10 16:06:59 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -47,6 +47,7 @@ #include "glxutil.h" #include "glxext.h" #include "GL/glx_ansic.h" +#include "glcontextmodes.h" /************************************************************************/ @@ -68,29 +69,32 @@ NULL }; -static int DoMakeCurrent( __GLXclientState *cl, GLXDrawable drawId, - GLXDrawable readId, GLXContextID contextId, GLXContextTag tag ); +static int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc); +static int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); +static int __glXCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); +static int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc); /************************************************************************/ -/* -** Create a GL context with the given properties. -*/ -int __glXCreateContext(__GLXclientState *cl, GLbyte *pc) +/** + * Create a GL context with the given properties. This routine is used + * to implement \c glXCreateContext, \c glXCreateNewContext, and + * \c glXCreateContextWithConfigSGIX. This works becuase of the hack way + * that GLXFBConfigs are implemented. Basically, the FBConfigID is the + * same as the VisualID. + */ + +int DoCreateContext(__GLXclientState *cl, GLXContextID gcId, + GLXContextID shareList, VisualID visual, + GLuint screen, GLboolean isDirect) { ClientPtr client = cl->client; - xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; VisualPtr pVisual; ScreenPtr pScreen; __GLXcontext *glxc, *shareglxc; - __GLXvisualConfig *pGlxVisual; + __GLcontextModes *modes; __GLXscreenInfo *pGlxScreen; __GLinterface *shareGC; - GLXContextID gcId = req->context; - GLXContextID shareList = req->shareList; - VisualID visual = req->visual; - GLuint screen = req->screen; - GLboolean isDirect = req->isDirect; GLint i; /* @@ -123,13 +127,9 @@ ** subset of Visuals that are supported by this implementation of the ** OpenGL. */ - pGlxVisual = pGlxScreen->pGlxVisual; - for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) { - if (pGlxVisual->vid == visual) { - break; - } - } - if (i == pGlxScreen->numVisuals) { + + modes = _gl_context_modes_find_visual( pGlxScreen->modes, visual ); + if (modes == NULL) { /* ** Visual not support on this screen by this OpenGL implementation. */ @@ -192,22 +192,15 @@ glxc->pScreen = pScreen; glxc->pGlxScreen = pGlxScreen; glxc->pVisual = pVisual; - glxc->pGlxVisual = pGlxVisual; + glxc->modes = modes; if (!isDirect) { - __GLcontextModes *modes; - /* - ** first build __GLcontextModes from __GLXvisualConfig - */ - modes = (__GLcontextModes *) __glXMalloc(sizeof(__GLcontextModes)); - glxc->modes = modes; - __glXFormatGLModes(modes, pGlxVisual); /* ** Allocate a GL context */ imports.other = (void *)glxc; - glxc->gc = (*pGlxScreen->createContext)(&imports, modes, shareGC); + glxc->gc = (*pGlxScreen->createContext)(&imports, glxc->modes, shareGC); if (!glxc->gc) { __glXFree(glxc); client->errorValue = gcId; @@ -245,6 +238,31 @@ return Success; } + +int __glXCreateContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; + return DoCreateContext( cl, req->context, req->shareList, req->visual, + req->screen, req->isDirect ); +} + + +int __glXCreateNewContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; + return DoCreateContext( cl, req->context, req->shareList, req->fbconfig, + req->screen, req->isDirect ); +} + + +int __glXCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateContextWithConfigSGIXReq *req = + (xGLXCreateContextWithConfigSGIXReq *) pc; + return DoCreateContext( cl, req->context, req->shareList, req->fbconfig, + req->screen, req->isDirect ); +} + /* ** Destroy a GL context as an X resource. */ @@ -370,24 +388,24 @@ { xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc; - return DoMakeCurrent( cl, req->drawable, req->drawable, - req->context, req->oldContextTag ); + return DoMakeCurrent( cl, req->drawable, req->drawable, + req->context, req->oldContextTag ); } int __glXMakeContextCurrent(__GLXclientState *cl, GLbyte *pc) { xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc; - return DoMakeCurrent( cl, req->drawable, req->readdrawable, - req->context, req->oldContextTag ); + return DoMakeCurrent( cl, req->drawable, req->readdrawable, + req->context, req->oldContextTag ); } int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) { xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc; - return DoMakeCurrent( cl, req->drawable, req->readable, - req->context, req->oldContextTag ); + return DoMakeCurrent( cl, req->drawable, req->readable, + req->context, req->oldContextTag ); } @@ -449,7 +467,7 @@ ** Check if pixmap and context are similar. */ if (drawPixmap->pScreen != glxc->pScreen || - drawPixmap->pGlxVisual != glxc->pGlxVisual) { + drawPixmap->modes->visualID != glxc->modes->visualID) { client->errorValue = drawId; return BadMatch; } @@ -471,9 +489,9 @@ } -static int DoMakeCurrent( __GLXclientState *cl, - GLXDrawable drawId, GLXDrawable readId, - GLXContextID contextId, GLXContextTag tag ) +int DoMakeCurrent( __GLXclientState *cl, + GLXDrawable drawId, GLXDrawable readId, + GLXContextID contextId, GLXContextTag tag ) { ClientPtr client = cl->client; DrawablePtr pDraw; @@ -639,7 +657,8 @@ if (prevglxc) { if (prevglxc->drawPixmap) { - if (prevglxc->drawPixmap != prevglxc->readPixmap) { + if (prevglxc->readPixmap && + prevglxc->drawPixmap != prevglxc->readPixmap) { /* ** The previous drawable was a glx pixmap, release it. */ @@ -881,18 +900,19 @@ return Success; } -int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) + +int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen, + GLboolean do_swap) { ClientPtr client = cl->client; - xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; xGLXGetVisualConfigsReply reply; __GLXscreenInfo *pGlxScreen; - __GLXvisualConfig *pGlxVisual; + __GLcontextModes *modes; CARD32 buf[__GLX_TOTAL_CONFIG]; - unsigned int screen; - int i, p; + int p; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - screen = req->screen; if (screen >= screenInfo.numScreens) { /* The client library must send a valid screen number. */ client->errorValue = screen; @@ -907,77 +927,206 @@ reply.type = X_Reply; reply.sequenceNumber = client->sequence; + if ( do_swap ) { + __GLX_SWAP_SHORT(&reply.sequenceNumber); + __GLX_SWAP_INT(&reply.length); + __GLX_SWAP_INT(&reply.numVisuals); + __GLX_SWAP_INT(&reply.numProps); + } + WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply); - for (i=0; i < pGlxScreen->numVisuals; i++) { - pGlxVisual = &pGlxScreen->pGlxVisual[i]; - if (pGlxVisual->vid == 0) { + for ( modes = pGlxScreen->modes ; modes != NULL ; modes = modes->next ) { + if (modes->visualID == 0) { /* not a usable visual */ continue; } p = 0; - buf[p++] = pGlxVisual->vid; - buf[p++] = pGlxVisual->class; - buf[p++] = pGlxVisual->rgba; - - buf[p++] = pGlxVisual->redSize; - buf[p++] = pGlxVisual->greenSize; - buf[p++] = pGlxVisual->blueSize; - buf[p++] = pGlxVisual->alphaSize; - buf[p++] = pGlxVisual->accumRedSize; - buf[p++] = pGlxVisual->accumGreenSize; - buf[p++] = pGlxVisual->accumBlueSize; - buf[p++] = pGlxVisual->accumAlphaSize; - - buf[p++] = pGlxVisual->doubleBuffer; - buf[p++] = pGlxVisual->stereo; - - buf[p++] = pGlxVisual->bufferSize; - buf[p++] = pGlxVisual->depthSize; - buf[p++] = pGlxVisual->stencilSize; - buf[p++] = pGlxVisual->auxBuffers; - buf[p++] = pGlxVisual->level; + buf[p++] = modes->visualID; + buf[p++] = _gl_convert_to_x_visual_type( modes->visualType ); + buf[p++] = modes->rgbMode; + + buf[p++] = modes->redBits; + buf[p++] = modes->greenBits; + buf[p++] = modes->blueBits; + buf[p++] = modes->alphaBits; + buf[p++] = modes->accumRedBits; + buf[p++] = modes->accumGreenBits; + buf[p++] = modes->accumBlueBits; + buf[p++] = modes->accumAlphaBits; + + buf[p++] = modes->doubleBufferMode; + buf[p++] = modes->stereoMode; + + buf[p++] = modes->rgbBits; + buf[p++] = modes->depthBits; + buf[p++] = modes->stencilBits; + buf[p++] = modes->numAuxBuffers; + buf[p++] = modes->level; /* ** Add token/value pairs for extensions. */ buf[p++] = GLX_VISUAL_CAVEAT_EXT; - buf[p++] = pGlxVisual->visualRating; - buf[p++] = GLX_TRANSPARENT_TYPE_EXT; - buf[p++] = pGlxVisual->transparentPixel; - buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT; - buf[p++] = pGlxVisual->transparentRed; - buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT; - buf[p++] = pGlxVisual->transparentGreen; - buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT; - buf[p++] = pGlxVisual->transparentBlue; - buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT; - buf[p++] = pGlxVisual->transparentAlpha; - buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT; - buf[p++] = pGlxVisual->transparentIndex; + buf[p++] = modes->visualRating; + buf[p++] = GLX_TRANSPARENT_TYPE; + buf[p++] = modes->transparentPixel; + buf[p++] = GLX_TRANSPARENT_RED_VALUE; + buf[p++] = modes->transparentRed; + buf[p++] = GLX_TRANSPARENT_GREEN_VALUE; + buf[p++] = modes->transparentGreen; + buf[p++] = GLX_TRANSPARENT_BLUE_VALUE; + buf[p++] = modes->transparentBlue; + buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE; + buf[p++] = modes->transparentAlpha; + buf[p++] = GLX_TRANSPARENT_INDEX_VALUE; + buf[p++] = modes->transparentIndex; + if ( do_swap ) { + __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG); + } WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, (char *)buf); } return Success; } +int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; + return DoGetVisualConfigs( cl, req->screen, GL_FALSE ); +} + + + +#define __GLX_TOTAL_FBCONFIG_ATTRIBS (28) + +/** + * Send the set of GLXFBConfigs to the client. There is not currently + * and interface into the driver on the server-side to get GLXFBConfigs, + * so we "invent" some based on the \c __GLXvisualConfig structures that + * the driver does supply. + * + * The reply format for both \c glXGetFBConfigs and \c glXGetFBConfigsSGIX + * is the same, so this routine pulls double duty. + */ + +int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap) +{ + ClientPtr client = cl->client; + xGLXGetFBConfigsReply reply; + __GLXscreenInfo *pGlxScreen; + CARD32 buf[__GLX_TOTAL_FBCONFIG_ATTRIBS * 2]; + int p; + __GLcontextModes *modes; + __GLX_DECLARE_SWAP_VARIABLES; + __GLX_DECLARE_SWAP_ARRAY_VARIABLES; + + + if (screen >= screenInfo.numScreens) { + /* The client library must send a valid screen number. */ + client->errorValue = screen; + return BadValue; + } + pGlxScreen = &__glXActiveScreens[screen]; + + reply.numFBConfigs = pGlxScreen->numUsableVisuals; + reply.numAttribs = __GLX_TOTAL_FBCONFIG_ATTRIBS; + reply.length = (reply.numAttribs * reply.numFBConfigs); + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + + if ( do_swap ) { + __GLX_SWAP_SHORT(&reply.sequenceNumber); + __GLX_SWAP_INT(&reply.length); + __GLX_SWAP_INT(&reply.numFBConfigs); + __GLX_SWAP_INT(&reply.numAttribs); + } + + WriteToClient(client, sz_xGLXGetFBConfigsReply, (char *)&reply); + + for ( modes = pGlxScreen->modes ; modes != NULL ; modes = modes->next ) { + if (modes->visualID == 0) { + /* not a usable visual */ + continue; + } + p = 0; + +#define WRITE_PAIR(tag,value) \ + do { buf[p++] = tag ; buf[p++] = value ; } while( 0 ) + + WRITE_PAIR( GLX_VISUAL_ID, modes->visualID ); + WRITE_PAIR( GLX_FBCONFIG_ID, modes->visualID ); + WRITE_PAIR( GLX_X_RENDERABLE, GL_TRUE ); + + WRITE_PAIR( GLX_RGBA, modes->rgbMode ); + WRITE_PAIR( GLX_DOUBLEBUFFER, modes->doubleBufferMode ); + WRITE_PAIR( GLX_STEREO, modes->stereoMode ); + + WRITE_PAIR( GLX_BUFFER_SIZE, modes->rgbBits ); + WRITE_PAIR( GLX_LEVEL, modes->level ); + WRITE_PAIR( GLX_AUX_BUFFERS, modes->numAuxBuffers ); + WRITE_PAIR( GLX_RED_SIZE, modes->redBits ); + WRITE_PAIR( GLX_GREEN_SIZE, modes->greenBits ); + WRITE_PAIR( GLX_BLUE_SIZE, modes->blueBits ); + WRITE_PAIR( GLX_ALPHA_SIZE, modes->alphaBits ); + WRITE_PAIR( GLX_ACCUM_RED_SIZE, modes->accumRedBits ); + WRITE_PAIR( GLX_ACCUM_GREEN_SIZE, modes->accumGreenBits ); + WRITE_PAIR( GLX_ACCUM_BLUE_SIZE, modes->accumBlueBits ); + WRITE_PAIR( GLX_ACCUM_ALPHA_SIZE, modes->accumAlphaBits ); + WRITE_PAIR( GLX_DEPTH_SIZE, modes->depthBits ); + WRITE_PAIR( GLX_STENCIL_SIZE, modes->stencilBits ); + + WRITE_PAIR( GLX_X_VISUAL_TYPE, modes->visualType ); + + /* + ** Add token/value pairs for extensions. + */ + WRITE_PAIR( GLX_CONFIG_CAVEAT, modes->visualRating ); + WRITE_PAIR( GLX_TRANSPARENT_TYPE, modes->transparentPixel ); + WRITE_PAIR( GLX_TRANSPARENT_RED_VALUE, modes->transparentRed ); + WRITE_PAIR( GLX_TRANSPARENT_GREEN_VALUE, modes->transparentGreen ); + WRITE_PAIR( GLX_TRANSPARENT_BLUE_VALUE, modes->transparentBlue ); + WRITE_PAIR( GLX_TRANSPARENT_ALPHA_VALUE, modes->transparentAlpha ); + WRITE_PAIR( GLX_TRANSPARENT_INDEX_VALUE, modes->transparentIndex ); + WRITE_PAIR( GLX_SWAP_METHOD_OML, modes->swapMethod ); + + if ( do_swap ) { + __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_FBCONFIG_ATTRIBS * 2); + } + WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_FBCONFIG_ATTRIBS * 2, + (char *)buf); + } + return Success; +} + + +int __glXGetFBConfigs(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; + return DoGetFBConfigs( cl, req->screen, GL_FALSE ); +} + + +int __glXGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; + return DoGetFBConfigs( cl, req->screen, GL_FALSE ); +} + + /* ** Create a GLX Pixmap from an X Pixmap. */ -int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) +int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual, + GLuint screenNum, XID pixmapId, XID glxpixmapId) { ClientPtr client = cl->client; - xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; - VisualID visual = req->visual; - GLuint screenNum = req->screen; - XID pixmapId = req->pixmap; - XID glxpixmapId = req->glxpixmap; DrawablePtr pDraw; ScreenPtr pScreen; VisualPtr pVisual; __GLXpixmap *pGlxPixmap; __GLXscreenInfo *pGlxScreen; - __GLXvisualConfig *pGlxVisual; + __GLcontextModes *modes; int i; pDraw = (DrawablePtr) LookupDrawable(pixmapId, client); @@ -1018,13 +1167,8 @@ ** Get configuration of the visual. */ pGlxScreen = &__glXActiveScreens[screenNum]; - pGlxVisual = pGlxScreen->pGlxVisual; - for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) { - if (pGlxVisual->vid == visual) { - break; - } - } - if (i == pGlxScreen->numVisuals) { + modes = _gl_context_modes_find_visual( pGlxScreen->modes, visual ); + if (modes == NULL) { /* ** Visual not support on this screen by this OpenGL implementation. */ @@ -1041,11 +1185,12 @@ } pGlxPixmap->pDraw = pDraw; pGlxPixmap->pGlxScreen = pGlxScreen; - pGlxPixmap->pGlxVisual = pGlxVisual; pGlxPixmap->pScreen = pScreen; pGlxPixmap->idExists = True; pGlxPixmap->refcnt = 0; + pGlxPixmap->modes = modes; + /* ** Bump the ref count on the X pixmap so it won't disappear. */ @@ -1054,6 +1199,34 @@ return Success; } +int __glXCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; + return DoCreateGLXPixmap( cl, req->visual, req->screen, + req->pixmap, req->glxpixmap ); +} + +int __glXCreatePixmap(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; + return DoCreateGLXPixmap( cl, req->fbconfig, req->screen, + req->pixmap, req->glxpixmap ); +} + +int __glXCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateGLXPixmapWithConfigSGIXReq *req = + (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc; + return DoCreateGLXPixmap( cl, req->fbconfig, req->screen, + req->pixmap, req->glxpixmap ); +} + + +/** + * Destroy a GLX pixmap. This function is used for both + * \c glXDestroyGLXPixmap and \c glXDestroyPixmap. + */ + int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; @@ -1592,6 +1765,12 @@ return __glXQueryContextInfoEXT(cl, pc); case X_GLXvop_MakeCurrentReadSGI: return __glXMakeCurrentReadSGI(cl, pc); + case X_GLXvop_GetFBConfigsSGIX: + return __glXGetFBConfigsSGIX(cl, pc); + case X_GLXvop_CreateContextWithConfigSGIX: + return __glXCreateContextWithConfigSGIX(cl, pc); + case X_GLXvop_CreateGLXPixmapWithConfigSGIX: + return __glXCreateGLXPixmapWithConfigSGIX(cl, pc); default: break; } Index: xc/programs/Xserver/GL/glx/glxcmdsswap.c diff -u xc/programs/Xserver/GL/glx/glxcmdsswap.c:1.11 xc/programs/Xserver/GL/glx/glxcmdsswap.c:1.13 --- xc/programs/Xserver/GL/glx/glxcmdsswap.c:1.11 Wed Feb 11 21:25:01 2004 +++ xc/programs/Xserver/GL/glx/glxcmdsswap.c Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcmdsswap.c,v 1.11 2004/02/12 02:25:01 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxcmdsswap.c,v 1.13 2004/12/10 16:06:59 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -47,6 +47,11 @@ #include "glxext.h" #include "GL/glx_ansic.h" +static int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc); +static int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); +static int __glXSwapCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc); +static int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc); + /************************************************************************/ /* @@ -67,7 +72,41 @@ __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->shareList); - return __glXCreateContext(cl, pc); + return DoCreateContext( cl, req->context, req->shareList, req->visual, + req->screen, req->isDirect ); +} + +int __glXSwapCreateNewContext(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->renderType); + __GLX_SWAP_INT(&req->shareList); + + return DoCreateContext( cl, req->context, req->shareList, req->fbconfig, + req->screen, req->isDirect ); +} + +int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateContextWithConfigSGIXReq *req = + (xGLXCreateContextWithConfigSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->context); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->renderType); + __GLX_SWAP_INT(&req->shareList); + + return DoCreateContext( cl, req->context, req->shareList, req->fbconfig, + req->screen, req->isDirect ); } int __glXSwapDestroyContext(__GLXclientState *cl, GLbyte *pc) @@ -91,7 +130,8 @@ __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->oldContextTag); - return __glXMakeCurrent(cl, pc); + return DoMakeCurrent( cl, req->drawable, req->drawable, + req->context, req->oldContextTag ); } int __glXSwapMakeContextCurrent(__GLXclientState *cl, GLbyte *pc) @@ -105,7 +145,8 @@ __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->oldContextTag); - return __glXMakeContextCurrent(cl, pc); + return DoMakeCurrent( cl, req->drawable, req->readdrawable, + req->context, req->oldContextTag ); } int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) @@ -119,7 +160,8 @@ __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->oldContextTag); - return __glXMakeCurrentReadSGI(cl, pc); + return DoMakeCurrent( cl, req->drawable, req->readable, + req->context, req->oldContextTag ); } int __glXSwapIsDirect(__GLXclientState *cl, GLbyte *pc) @@ -182,90 +224,29 @@ int __glXSwapGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) { - ClientPtr client = cl->client; xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; - xGLXGetVisualConfigsReply reply; - __GLXscreenInfo *pGlxScreen; - __GLXvisualConfig *pGlxVisual; - CARD32 buf[__GLX_TOTAL_CONFIG]; - unsigned int screen; - int i, p; __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; __GLX_SWAP_INT(&req->screen); - screen = req->screen; - if (screen > screenInfo.numScreens) { - /* The client library must send a valid screen number. */ - client->errorValue = screen; - return BadValue; - } - pGlxScreen = &__glXActiveScreens[screen]; + return DoGetVisualConfigs( cl, req->screen, GL_TRUE ); +} - reply.numVisuals = pGlxScreen->numUsableVisuals; - reply.numProps = __GLX_TOTAL_CONFIG; - reply.length = (pGlxScreen->numUsableVisuals * __GLX_SIZE_CARD32 * - __GLX_TOTAL_CONFIG) >> 2; - reply.type = X_Reply; - reply.sequenceNumber = client->sequence; - - __GLX_SWAP_SHORT(&reply.sequenceNumber); - __GLX_SWAP_INT(&reply.length); - __GLX_SWAP_INT(&reply.numVisuals); - __GLX_SWAP_INT(&reply.numProps); - WriteToClient(client, sz_xGLXGetVisualConfigsReply, (char *)&reply); - - for (i=0; i < pGlxScreen->numVisuals; i++) { - pGlxVisual = &pGlxScreen->pGlxVisual[i]; - if (pGlxVisual->vid == 0) { - /* not a usable visual */ - continue; - } - p = 0; - buf[p++] = pGlxVisual->vid; - buf[p++] = pGlxVisual->class; - buf[p++] = pGlxVisual->rgba; - - buf[p++] = pGlxVisual->redSize; - buf[p++] = pGlxVisual->greenSize; - buf[p++] = pGlxVisual->blueSize; - buf[p++] = pGlxVisual->alphaSize; - buf[p++] = pGlxVisual->accumRedSize; - buf[p++] = pGlxVisual->accumGreenSize; - buf[p++] = pGlxVisual->accumBlueSize; - buf[p++] = pGlxVisual->accumAlphaSize; - - buf[p++] = pGlxVisual->doubleBuffer; - buf[p++] = pGlxVisual->stereo; - - buf[p++] = pGlxVisual->bufferSize; - buf[p++] = pGlxVisual->depthSize; - buf[p++] = pGlxVisual->stencilSize; - buf[p++] = pGlxVisual->auxBuffers; - buf[p++] = pGlxVisual->level; - /* - ** Add token/value pairs for extensions. - */ - buf[p++] = GLX_VISUAL_CAVEAT_EXT; - buf[p++] = pGlxVisual->visualRating; - buf[p++] = GLX_TRANSPARENT_TYPE_EXT; - buf[p++] = pGlxVisual->transparentPixel; - buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT; - buf[p++] = pGlxVisual->transparentRed; - buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT; - buf[p++] = pGlxVisual->transparentGreen; - buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT; - buf[p++] = pGlxVisual->transparentBlue; - buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT; - buf[p++] = pGlxVisual->transparentAlpha; - buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT; - buf[p++] = pGlxVisual->transparentIndex; - - __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG); - WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, - (char *)buf); - } - return Success; +int __glXSwapGetFBConfigs(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&req->screen); + return DoGetFBConfigs( cl, req->screen, GL_TRUE ); +} + +int __glXSwapGetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_INT(&req->screen); + return DoGetFBConfigs( cl, req->screen, GL_TRUE ); } int __glXSwapCreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) @@ -279,7 +260,39 @@ __GLX_SWAP_INT(&req->pixmap); __GLX_SWAP_INT(&req->glxpixmap); - return __glXCreateGLXPixmap(cl, pc); + return DoCreateGLXPixmap( cl, req->visual, req->screen, + req->pixmap, req->glxpixmap ); +} + +int __glXSwapCreatePixmap(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->pixmap); + __GLX_SWAP_INT(&req->glxpixmap); + + return DoCreateGLXPixmap( cl, req->fbconfig, req->screen, + req->pixmap, req->glxpixmap ); +} + +int __glXSwapCreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) +{ + xGLXCreateGLXPixmapWithConfigSGIXReq *req = + (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc; + __GLX_DECLARE_SWAP_VARIABLES; + + __GLX_SWAP_SHORT(&req->length); + __GLX_SWAP_INT(&req->screen); + __GLX_SWAP_INT(&req->fbconfig); + __GLX_SWAP_INT(&req->pixmap); + __GLX_SWAP_INT(&req->glxpixmap); + + return DoCreateGLXPixmap( cl, req->fbconfig, req->screen, + req->pixmap, req->glxpixmap ); } int __glXSwapDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) @@ -806,6 +819,7 @@ } #endif + if ((vendorcode >= __GLX_MIN_VENDPRIV_OPCODE_EXT) && (vendorcode <= __GLX_MAX_VENDPRIV_OPCODE_EXT)) { (*__glXSwapVendorPrivTable_EXT[vendorcode-__GLX_MIN_VENDPRIV_OPCODE_EXT])(cl, (GLbyte*)req); @@ -833,6 +847,12 @@ return __glXSwapQueryContextInfoEXT(cl, pc); case X_GLXvop_MakeCurrentReadSGI: return __glXSwapMakeCurrentReadSGI(cl, pc); + case X_GLXvop_GetFBConfigsSGIX: + return __glXSwapGetFBConfigsSGIX(cl, pc); + case X_GLXvop_CreateContextWithConfigSGIX: + return __glXSwapCreateContextWithConfigSGIX(cl, pc); + case X_GLXvop_CreateGLXPixmapWithConfigSGIX: + return __glXSwapCreateGLXPixmapWithConfigSGIX(cl, pc); default: break; } Index: xc/programs/Xserver/GL/glx/glxcontext.h diff -u xc/programs/Xserver/GL/glx/glxcontext.h:1.5 xc/programs/Xserver/GL/glx/glxcontext.h:1.6 --- xc/programs/Xserver/GL/glx/glxcontext.h:1.5 Sun Sep 28 16:15:43 2003 +++ xc/programs/Xserver/GL/glx/glxcontext.h Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcontext.h,v 1.5 2003/09/28 20:15:43 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxcontext.h,v 1.6 2004/12/10 16:06:59 alanh Exp $ */ #ifndef _GLX_context_h_ #define _GLX_context_h_ @@ -80,7 +80,6 @@ ** This context is created with respect to this visual. */ VisualRec *pVisual; - __GLXvisualConfig *pGlxVisual; /* ** The XID of this context. Index: xc/programs/Xserver/GL/glx/glxdrawable.h diff -u xc/programs/Xserver/GL/glx/glxdrawable.h:1.4 xc/programs/Xserver/GL/glx/glxdrawable.h:1.5 --- xc/programs/Xserver/GL/glx/glxdrawable.h:1.4 Sun Sep 28 16:15:43 2003 +++ xc/programs/Xserver/GL/glx/glxdrawable.h Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxdrawable.h,v 1.4 2003/09/28 20:15:43 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxdrawable.h,v 1.5 2004/12/10 16:06:59 alanh Exp $ */ #ifndef _GLX_drawable_h_ #define _GLX_drawable_h_ @@ -40,7 +40,7 @@ typedef struct { DrawablePtr pDraw; - __GLXvisualConfig *pGlxVisual; + __GLcontextModes *modes; __GLXscreenInfo *pGlxScreen; ScreenPtr pScreen; Bool idExists; @@ -69,11 +69,12 @@ /* ** Configuration of the visual to which this drawable was created. */ - __GLXvisualConfig *pGlxVisual; + __GLcontextModes *modes; /* ** cached drawable size and origin */ + GLint xorigin, yorigin; GLint width, height; Index: xc/programs/Xserver/GL/glx/glxext.c diff -u xc/programs/Xserver/GL/glx/glxext.c:1.10 xc/programs/Xserver/GL/glx/glxext.c:1.11 --- xc/programs/Xserver/GL/glx/glxext.c:1.10 Wed Jan 28 17:36:05 2004 +++ xc/programs/Xserver/GL/glx/glxext.c Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxext.c,v 1.10 2004/01/28 22:36:05 alanh Exp $ +/* $XFree86: xc/programs/Xserver/GL/glx/glxext.c,v 1.11 2004/12/10 16:06:59 alanh Exp $ ** The contents of this file are subject to the GLX Public License Version 1.0 ** (the "License"). You may not use this file except in compliance with the ** License. You may obtain a copy of the License at Silicon Graphics, Inc., @@ -30,12 +30,11 @@ #include "micmap.h" -extern __GLXextensionInfo __glDDXExtensionInfo; void GlxWrapInitVisuals(miInitVisualsProcPtr *); void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **privates); -__GLXextensionInfo *__glXExt = &__glDDXExtensionInfo; +static __GLXextensionInfo *__glXExt /* = &__glDDXExtensionInfo */; /* ** Forward declarations. @@ -314,6 +313,8 @@ { saveInitVisualsProc = *initVisProc; *initVisProc = GlxInitVisuals; + /* HACK: this shouldn't be done here but it's the earliest time */ + __glXExt = __glXglDDXExtensionInfo(); /* from GLcore */ } /************************************************************************/ Index: xc/programs/Xserver/GL/glx/glxext.h diff -u xc/programs/Xserver/GL/glx/glxext.h:1.8 xc/programs/Xserver/GL/glx/glxext.h:1.9 --- xc/programs/Xserver/GL/glx/glxext.h:1.8 Mon Feb 9 18:46:31 2004 +++ xc/programs/Xserver/GL/glx/glxext.h Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxext.h,v 1.8 2004/02/09 23:46:31 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxext.h,v 1.9 2004/12/10 16:06:59 alanh Exp $ */ #ifndef _glxext_h_ #define _glxext_h_ @@ -73,8 +73,16 @@ extern int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc); extern int __glXSwapQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc); -extern int __glXMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc); -extern int __glXSwapMakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc); +extern int DoMakeCurrent( __GLXclientState *cl, GLXDrawable drawId, + GLXDrawable readId, GLXContextID contextId, GLXContextTag tag ); +extern int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen, + GLboolean do_swap); +extern int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, + GLboolean do_swap); +extern int DoCreateContext(__GLXclientState *cl, GLXContextID gcId, + GLXContextID shareList, VisualID visual, GLuint screen, GLboolean isDirect); +extern int DoCreateGLXPixmap(__GLXclientState *cl, VisualID visual, + GLuint screenNum, XID pixmapId, XID glxpixmapId); extern void GlxExtensionInit(void); Index: xc/programs/Xserver/GL/glx/glxmodule.c diff -u /dev/null xc/programs/Xserver/GL/glx/glxmodule.c:1.2 --- /dev/null Wed Mar 16 21:06:11 2005 +++ xc/programs/Xserver/GL/glx/glxmodule.c Fri Dec 10 11:06:59 2004 @@ -0,0 +1,1267 @@ + +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +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, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ +/* $XFree86: xc/programs/Xserver/GL/glx/glxmodule.c,v 1.2 2004/12/10 16:06:59 alanh Exp $ */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +#include "xf86Module.h" +#include "colormap.h" +#include "micmap.h" + +static MODULESETUPPROTO(glxSetup); + +extern void GlxExtensionInit(INITARGS); +extern void GlxWrapInitVisuals(miInitVisualsProcPtr *); +extern void InitGlxWrapInitVisuals(void (*f)(miInitVisualsProcPtr *)); + +static const char *initdeps[] = { "DOUBLE-BUFFER", NULL }; + +ExtensionModule GLXExt = +{ + GlxExtensionInit, + "GLX", + NULL, + NULL, + initdeps +}; + +static const char *glcoreSymbols[] = { + "__glCallLists_size", + "__glColorTableParameterfv_size", + "__glColorTableParameteriv_size", + "__glConvolutionParameterfv_size", + "__glConvolutionParameteriv_size", + "__glDDXExtensionInfo", + "__glDDXScreenInfo", + "__glEvalComputeK", + "__glFloorLog2", + "__glFogfv_size", + "__glFogiv_size", + "__glGetBooleanv_size", + "__glGetColorTableParameterfv_size", + "__glGetColorTableParameteriv_size", + "__glGetConvolutionParameterfv_size", + "__glGetConvolutionParameteriv_size", + "__glGetDoublev_size", + "__glGetFloatv_size", + "__glGetHistogramParameterfv_size", + "__glGetHistogramParameteriv_size", + "__glGetIntegerv_size", + "__glGetLightfv_size", + "__glGetLightiv_size", + "__glGetMapdv_size", + "__glGetMapfv_size", + "__glGetMapiv_size", + "__glGetMaterialfv_size", + "__glGetMaterialiv_size", + "__glGetMinmaxParameterfv_size", + "__glGetMinmaxParameteriv_size", + "__glGetPixelMapfv_size", + "__glGetPixelMapuiv_size", + "__glGetPixelMapusv_size", + "__glGetTexEnvfv_size", + "__glGetTexEnviv_size", + "__glGetTexGendv_size", + "__glGetTexGenfv_size", + "__glGetTexGeniv_size", + "__glGetTexImage_size", + "__glGetTexLevelParameterfv_size", + "__glGetTexLevelParameteriv_size", + "__glGetTexParameterfv_size", + "__glGetTexParameteriv_size", + "__glLightModelfv_size", + "__glLightModeliv_size", + "__glLightfv_size", + "__glLightiv_size", + "__glMaterialfv_size", + "__glMaterialiv_size", + "__glPointParameterfvARB_size", + "__glReadPixels_size", + "__glTexEnvfv_size", + "__glTexEnviv_size", + "__glTexGendv_size", + "__glTexGenfv_size", + "__glTexGeniv_size", + "__glTexParameterfv_size", + "__glTexParameteriv_size", + "__glXglDDXExtensionInfo", + "__glXglDDXScreenInfo", + "__glXActiveScreens", + "__glXAssociateContext", + "__glXBadContext", + "__glXBadContextState", + "__glXBadContextTag", + "__glXBadCurrentWindow", + "__glXBadDrawable", + "__glXBadLargeRequest", + "__glXBadPixmap", + "__glXBadRenderRequest", + "__glXBitmapReqSize", + "__glXCacheDrawableSize", + "__glXCallListsReqSize", + "__glXClearErrorOccured", + "__glXClientInfo", + "__glXClientRes", + "__glXClients", + "__glXColorSubTableReqSize", + "__glXColorTableParameterfvReqSize", + "__glXColorTableParameterivReqSize", + "__glXColorTableReqSize", + "__glXContextRes", + "__glXConvolutionFilter1DReqSize", + "__glXConvolutionFilter2DReqSize", + "__glXConvolutionParameterfvReqSize", + "__glXConvolutionParameterivReqSize", + "__glXCopyContext", + "__glXCoreType", + "__glXCreateContext", + "__glXCreateGLXPixmap", + "__glXDeassociateContext", + "__glXDestroyContext", + "__glXDestroyGLXPixmap", + "__glXDispSwap_Accum", + "__glXDispSwap_ActiveStencilFaceEXT", + "__glXDispSwap_ActiveTextureARB", + "__glXDispSwap_AlphaFunc", + "__glXDispSwap_AreTexturesResident", + "__glXDispSwap_AreTexturesResidentEXT", + "__glXDispSwap_Begin", + "__glXDispSwap_BindTexture", + "__glXDispSwap_Bitmap", + "__glXDispSwap_BlendColor", + "__glXDispSwap_BlendEquation", + "__glXDispSwap_BlendFunc", + "__glXDispSwap_CallList", + "__glXDispSwap_CallLists", + "__glXDispSwap_Clear", + "__glXDispSwap_ClearAccum", + "__glXDispSwap_ClearColor", + "__glXDispSwap_ClearDepth", + "__glXDispSwap_ClearIndex", + "__glXDispSwap_ClearStencil", + "__glXDispSwap_ClipPlane", + "__glXDispSwap_Color3bv", + "__glXDispSwap_Color3dv", + "__glXDispSwap_Color3fv", + "__glXDispSwap_Color3iv", + "__glXDispSwap_Color3sv", + "__glXDispSwap_Color3ubv", + "__glXDispSwap_Color3uiv", + "__glXDispSwap_Color3usv", + "__glXDispSwap_Color4bv", + "__glXDispSwap_Color4dv", + "__glXDispSwap_Color4fv", + "__glXDispSwap_Color4iv", + "__glXDispSwap_Color4sv", + "__glXDispSwap_Color4ubv", + "__glXDispSwap_Color4uiv", + "__glXDispSwap_Color4usv", + "__glXDispSwap_ColorMask", + "__glXDispSwap_ColorMaterial", + "__glXDispSwap_ColorSubTable", + "__glXDispSwap_ColorTable", + "__glXDispSwap_ColorTableParameterfv", + "__glXDispSwap_ColorTableParameteriv", + "__glXDispSwap_ConvolutionFilter1D", + "__glXDispSwap_ConvolutionFilter2D", + "__glXDispSwap_ConvolutionParameterf", + "__glXDispSwap_ConvolutionParameterfv", + "__glXDispSwap_ConvolutionParameteri", + "__glXDispSwap_ConvolutionParameteriv", + "__glXDispSwap_CopyColorSubTable", + "__glXDispSwap_CopyColorTable", + "__glXDispSwap_CopyConvolutionFilter1D", + "__glXDispSwap_CopyConvolutionFilter2D", + "__glXDispSwap_CopyPixels", + "__glXDispSwap_CopyTexImage1D", + "__glXDispSwap_CopyTexImage2D", + "__glXDispSwap_CopyTexSubImage1D", + "__glXDispSwap_CopyTexSubImage2D", + "__glXDispSwap_CopyTexSubImage3D", + "__glXDispSwap_CullFace", + "__glXDispSwap_DeleteLists", + "__glXDispSwap_DeleteTextures", + "__glXDispSwap_DeleteTexturesEXT", + "__glXDispSwap_DepthFunc", + "__glXDispSwap_DepthMask", + "__glXDispSwap_DepthRange", + "__glXDispSwap_Disable", + "__glXDispSwap_DrawArrays", + "__glXDispSwap_DrawArraysEXT", + "__glXDispSwap_DrawBuffer", + "__glXDispSwap_DrawPixels", + "__glXDispSwap_EdgeFlagv", + "__glXDispSwap_Enable", + "__glXDispSwap_End", + "__glXDispSwap_EndList", + "__glXDispSwap_EvalCoord1dv", + "__glXDispSwap_EvalCoord1fv", + "__glXDispSwap_EvalCoord2dv", + "__glXDispSwap_EvalCoord2fv", + "__glXDispSwap_EvalMesh1", + "__glXDispSwap_EvalMesh2", + "__glXDispSwap_EvalPoint1", + "__glXDispSwap_EvalPoint2", + "__glXDispSwap_FeedbackBuffer", + "__glXDispSwap_Finish", + "__glXDispSwap_Flush", + "__glXDispSwap_Fogf", + "__glXDispSwap_Fogfv", + "__glXDispSwap_Fogi", + "__glXDispSwap_Fogiv", + "__glXDispSwap_FrontFace", + "__glXDispSwap_Frustum", + "__glXDispSwap_GenLists", + "__glXDispSwap_GenTextures", + "__glXDispSwap_GenTexturesEXT", + "__glXDispSwap_GetBooleanv", + "__glXDispSwap_GetClipPlane", + "__glXDispSwap_GetColorTable", + "__glXDispSwap_GetColorTableParameterfv", + "__glXDispSwap_GetColorTableParameteriv", + "__glXDispSwap_GetConvolutionFilter", + "__glXDispSwap_GetConvolutionParameterfv", + "__glXDispSwap_GetConvolutionParameteriv", + "__glXDispSwap_GetDoublev", + "__glXDispSwap_GetError", + "__glXDispSwap_GetFloatv", + "__glXDispSwap_GetHistogram", + "__glXDispSwap_GetHistogramParameterfv", + "__glXDispSwap_GetHistogramParameteriv", + "__glXDispSwap_GetIntegerv", + "__glXDispSwap_GetLightfv", + "__glXDispSwap_GetLightiv", + "__glXDispSwap_GetMapdv", + "__glXDispSwap_GetMapfv", + "__glXDispSwap_GetMapiv", + "__glXDispSwap_GetMaterialfv", + "__glXDispSwap_GetMaterialiv", + "__glXDispSwap_GetMinmax", + "__glXDispSwap_GetMinmaxParameterfv", + "__glXDispSwap_GetMinmaxParameteriv", + "__glXDispSwap_GetPixelMapfv", + "__glXDispSwap_GetPixelMapuiv", + "__glXDispSwap_GetPixelMapusv", + "__glXDispSwap_GetPolygonStipple", + "__glXDispSwap_GetSeparableFilter", + "__glXDispSwap_GetString", + "__glXDispSwap_GetTexEnvfv", + "__glXDispSwap_GetTexEnviv", + "__glXDispSwap_GetTexGendv", + "__glXDispSwap_GetTexGenfv", + "__glXDispSwap_GetTexGeniv", + "__glXDispSwap_GetTexImage", + "__glXDispSwap_GetTexLevelParameterfv", + "__glXDispSwap_GetTexLevelParameteriv", + "__glXDispSwap_GetTexParameterfv", + "__glXDispSwap_GetTexParameteriv", + "__glXDispSwap_Hint", + "__glXDispSwap_Histogram", + "__glXDispSwap_IndexMask", + "__glXDispSwap_Indexdv", + "__glXDispSwap_Indexfv", + "__glXDispSwap_Indexiv", + "__glXDispSwap_Indexsv", + "__glXDispSwap_Indexubv", + "__glXDispSwap_InitNames", + "__glXDispSwap_IsEnabled", + "__glXDispSwap_IsList", + "__glXDispSwap_IsTexture", + "__glXDispSwap_IsTextureEXT", + "__glXDispSwap_LightModelf", + "__glXDispSwap_LightModelfv", + "__glXDispSwap_LightModeli", + "__glXDispSwap_LightModeliv", + "__glXDispSwap_Lightf", + "__glXDispSwap_Lightfv", + "__glXDispSwap_Lighti", + "__glXDispSwap_Lightiv", + "__glXDispSwap_LineStipple", + "__glXDispSwap_LineWidth", + "__glXDispSwap_ListBase", + "__glXDispSwap_LoadIdentity", + "__glXDispSwap_LoadMatrixd", + "__glXDispSwap_LoadMatrixf", + "__glXDispSwap_LoadName", + "__glXDispSwap_LogicOp", + "__glXDispSwap_Map1d", + "__glXDispSwap_Map1f", + "__glXDispSwap_Map2d", + "__glXDispSwap_Map2f", + "__glXDispSwap_MapGrid1d", + "__glXDispSwap_MapGrid1f", + "__glXDispSwap_MapGrid2d", + "__glXDispSwap_MapGrid2f", + "__glXDispSwap_Materialf", + "__glXDispSwap_Materialfv", + "__glXDispSwap_Materiali", + "__glXDispSwap_Materialiv", + "__glXDispSwap_MatrixMode", + "__glXDispSwap_Minmax", + "__glXDispSwap_MultMatrixd", + "__glXDispSwap_MultMatrixf", + "__glXDispSwap_MultiTexCoord1dvARB", + "__glXDispSwap_MultiTexCoord1fvARB", + "__glXDispSwap_MultiTexCoord1ivARB", + "__glXDispSwap_MultiTexCoord1svARB", + "__glXDispSwap_MultiTexCoord2dvARB", + "__glXDispSwap_MultiTexCoord2fvARB", + "__glXDispSwap_MultiTexCoord2ivARB", + "__glXDispSwap_MultiTexCoord2svARB", + "__glXDispSwap_MultiTexCoord3dvARB", + "__glXDispSwap_MultiTexCoord3fvARB", + "__glXDispSwap_MultiTexCoord3ivARB", + "__glXDispSwap_MultiTexCoord3svARB", + "__glXDispSwap_MultiTexCoord4dvARB", + "__glXDispSwap_MultiTexCoord4fvARB", + "__glXDispSwap_MultiTexCoord4ivARB", + "__glXDispSwap_MultiTexCoord4svARB", + "__glXDispSwap_NewList", + "__glXDispSwap_Normal3bv", + "__glXDispSwap_Normal3dv", + "__glXDispSwap_Normal3fv", + "__glXDispSwap_Normal3iv", + "__glXDispSwap_Normal3sv", + "__glXDispSwap_Ortho", + "__glXDispSwap_PassThrough", + "__glXDispSwap_PixelMapfv", + "__glXDispSwap_PixelMapuiv", + "__glXDispSwap_PixelMapusv", + "__glXDispSwap_PixelStoref", + "__glXDispSwap_PixelStorei", + "__glXDispSwap_PixelTransferf", + "__glXDispSwap_PixelTransferi", + "__glXDispSwap_PixelZoom", + "__glXDispSwap_PointParameterfARB", + "__glXDispSwap_PointParameterfvARB", + "__glXDispSwap_PointSize", + "__glXDispSwap_PolygonMode", + "__glXDispSwap_PolygonOffset", + "__glXDispSwap_PolygonStipple", + "__glXDispSwap_PopAttrib", + "__glXDispSwap_PopMatrix", + "__glXDispSwap_PopName", + "__glXDispSwap_PrioritizeTextures", + "__glXDispSwap_PushAttrib", + "__glXDispSwap_PushMatrix", + "__glXDispSwap_PushName", + "__glXDispSwap_RasterPos2dv", + "__glXDispSwap_RasterPos2fv", + "__glXDispSwap_RasterPos2iv", + "__glXDispSwap_RasterPos2sv", + "__glXDispSwap_RasterPos3dv", + "__glXDispSwap_RasterPos3fv", + "__glXDispSwap_RasterPos3iv", + "__glXDispSwap_RasterPos3sv", + "__glXDispSwap_RasterPos4dv", + "__glXDispSwap_RasterPos4fv", + "__glXDispSwap_RasterPos4iv", + "__glXDispSwap_RasterPos4sv", + "__glXDispSwap_ReadBuffer", + "__glXDispSwap_ReadPixels", + "__glXDispSwap_Rectdv", + "__glXDispSwap_Rectfv", + "__glXDispSwap_Rectiv", + "__glXDispSwap_Rectsv", + "__glXDispSwap_RenderMode", + "__glXDispSwap_ResetHistogram", + "__glXDispSwap_ResetMinmax", + "__glXDispSwap_Rotated", + "__glXDispSwap_Rotatef", + "__glXDispSwap_Scaled", + "__glXDispSwap_Scalef", + "__glXDispSwap_Scissor", + "__glXDispSwap_SelectBuffer", + "__glXDispSwap_SeparableFilter2D", + "__glXDispSwap_ShadeModel", + "__glXDispSwap_StencilFunc", + "__glXDispSwap_StencilMask", + "__glXDispSwap_StencilOp", + "__glXDispSwap_TexCoord1dv", + "__glXDispSwap_TexCoord1fv", + "__glXDispSwap_TexCoord1iv", + "__glXDispSwap_TexCoord1sv", + "__glXDispSwap_TexCoord2dv", + "__glXDispSwap_TexCoord2fv", + "__glXDispSwap_TexCoord2iv", + "__glXDispSwap_TexCoord2sv", + "__glXDispSwap_TexCoord3dv", + "__glXDispSwap_TexCoord3fv", + "__glXDispSwap_TexCoord3iv", + "__glXDispSwap_TexCoord3sv", + "__glXDispSwap_TexCoord4dv", + "__glXDispSwap_TexCoord4fv", + "__glXDispSwap_TexCoord4iv", + "__glXDispSwap_TexCoord4sv", + "__glXDispSwap_TexEnvf", + "__glXDispSwap_TexEnvfv", + "__glXDispSwap_TexEnvi", + "__glXDispSwap_TexEnviv", + "__glXDispSwap_TexGend", + "__glXDispSwap_TexGendv", + "__glXDispSwap_TexGenf", + "__glXDispSwap_TexGenfv", + "__glXDispSwap_TexGeni", + "__glXDispSwap_TexGeniv", + "__glXDispSwap_TexImage1D", + "__glXDispSwap_TexImage2D", + "__glXDispSwap_TexImage3D", + "__glXDispSwap_TexParameterf", + "__glXDispSwap_TexParameterfv", + "__glXDispSwap_TexParameteri", + "__glXDispSwap_TexParameteriv", + "__glXDispSwap_TexSubImage1D", + "__glXDispSwap_TexSubImage2D", + "__glXDispSwap_TexSubImage3D", + "__glXDispSwap_Translated", + "__glXDispSwap_Translatef", + "__glXDispSwap_Vertex2dv", + "__glXDispSwap_Vertex2fv", + "__glXDispSwap_Vertex2iv", + "__glXDispSwap_Vertex2sv", + "__glXDispSwap_Vertex3dv", + "__glXDispSwap_Vertex3fv", + "__glXDispSwap_Vertex3iv", + "__glXDispSwap_Vertex3sv", + "__glXDispSwap_Vertex4dv", + "__glXDispSwap_Vertex4fv", + "__glXDispSwap_Vertex4iv", + "__glXDispSwap_Vertex4sv", + "__glXDispSwap_Viewport", + "__glXDispSwap_WindowPos3fARB", + "__glXDisp_Accum", + "__glXDisp_ActiveStencilFaceEXT", + "__glXDisp_ActiveTextureARB", + "__glXDisp_AlphaFunc", + "__glXDisp_AreTexturesResident", + "__glXDisp_AreTexturesResidentEXT", + "__glXDisp_Begin", + "__glXDisp_BindTexture", + "__glXDisp_Bitmap", + "__glXDisp_BlendColor", + "__glXDisp_BlendEquation", + "__glXDisp_BlendFunc", + "__glXDisp_CallList", + "__glXDisp_CallLists", + "__glXDisp_Clear", + "__glXDisp_ClearAccum", + "__glXDisp_ClearColor", + "__glXDisp_ClearDepth", + "__glXDisp_ClearIndex", + "__glXDisp_ClearStencil", + "__glXDisp_ClipPlane", + "__glXDisp_Color3bv", + "__glXDisp_Color3dv", + "__glXDisp_Color3fv", + "__glXDisp_Color3iv", + "__glXDisp_Color3sv", + "__glXDisp_Color3ubv", + "__glXDisp_Color3uiv", + "__glXDisp_Color3usv", + "__glXDisp_Color4bv", + "__glXDisp_Color4dv", + "__glXDisp_Color4fv", + "__glXDisp_Color4iv", + "__glXDisp_Color4sv", + "__glXDisp_Color4ubv", + "__glXDisp_Color4uiv", + "__glXDisp_Color4usv", + "__glXDisp_ColorMask", + "__glXDisp_ColorMaterial", + "__glXDisp_ColorSubTable", + "__glXDisp_ColorTable", + "__glXDisp_ColorTableParameterfv", + "__glXDisp_ColorTableParameteriv", + "__glXDisp_ConvolutionFilter1D", + "__glXDisp_ConvolutionFilter2D", + "__glXDisp_ConvolutionParameterf", + "__glXDisp_ConvolutionParameterfv", + "__glXDisp_ConvolutionParameteri", + "__glXDisp_ConvolutionParameteriv", + "__glXDisp_CopyColorSubTable", + "__glXDisp_CopyColorTable", + "__glXDisp_CopyConvolutionFilter1D", + "__glXDisp_CopyConvolutionFilter2D", + "__glXDisp_CopyPixels", + "__glXDisp_CopyTexImage1D", + "__glXDisp_CopyTexImage2D", + "__glXDisp_CopyTexSubImage1D", + "__glXDisp_CopyTexSubImage2D", + "__glXDisp_CopyTexSubImage3D", + "__glXDisp_CullFace", + "__glXDisp_DeleteLists", + "__glXDisp_DeleteTextures", + "__glXDisp_DeleteTexturesEXT", + "__glXDisp_DepthFunc", + "__glXDisp_DepthMask", + "__glXDisp_DepthRange", + "__glXDisp_Disable", + "__glXDisp_DrawArrays", + "__glXDisp_DrawArraysEXT", + "__glXDisp_DrawBuffer", + "__glXDisp_DrawPixels", + "__glXDisp_EdgeFlagv", + "__glXDisp_Enable", + "__glXDisp_End", + "__glXDisp_EndList", + "__glXDisp_EvalCoord1dv", + "__glXDisp_EvalCoord1fv", + "__glXDisp_EvalCoord2dv", + "__glXDisp_EvalCoord2fv", + "__glXDisp_EvalMesh1", + "__glXDisp_EvalMesh2", + "__glXDisp_EvalPoint1", + "__glXDisp_EvalPoint2", + "__glXDisp_FeedbackBuffer", + "__glXDisp_Finish", + "__glXDisp_Flush", + "__glXDisp_Fogf", + "__glXDisp_Fogfv", + "__glXDisp_Fogi", + "__glXDisp_Fogiv", + "__glXDisp_FrontFace", + "__glXDisp_Frustum", + "__glXDisp_GenLists", + "__glXDisp_GenTextures", + "__glXDisp_GenTexturesEXT", + "__glXDisp_GetBooleanv", + "__glXDisp_GetClipPlane", + "__glXDisp_GetColorTable", + "__glXDisp_GetColorTableParameterfv", + "__glXDisp_GetColorTableParameteriv", + "__glXDisp_GetConvolutionFilter", + "__glXDisp_GetConvolutionParameterfv", + "__glXDisp_GetConvolutionParameteriv", + "__glXDisp_GetDoublev", + "__glXDisp_GetError", + "__glXDisp_GetFloatv", + "__glXDisp_GetHistogram", + "__glXDisp_GetHistogramParameterfv", + "__glXDisp_GetHistogramParameteriv", + "__glXDisp_GetIntegerv", + "__glXDisp_GetLightfv", + "__glXDisp_GetLightiv", + "__glXDisp_GetMapdv", + "__glXDisp_GetMapfv", + "__glXDisp_GetMapiv", + "__glXDisp_GetMaterialfv", + "__glXDisp_GetMaterialiv", + "__glXDisp_GetMinmax", + "__glXDisp_GetMinmaxParameterfv", + "__glXDisp_GetMinmaxParameteriv", + "__glXDisp_GetPixelMapfv", + "__glXDisp_GetPixelMapuiv", + "__glXDisp_GetPixelMapusv", + "__glXDisp_GetPolygonStipple", + "__glXDisp_GetSeparableFilter", + "__glXDisp_GetString", + "__glXDisp_GetTexEnvfv", + "__glXDisp_GetTexEnviv", + "__glXDisp_GetTexGendv", + "__glXDisp_GetTexGenfv", + "__glXDisp_GetTexGeniv", + "__glXDisp_GetTexImage", + "__glXDisp_GetTexLevelParameterfv", + "__glXDisp_GetTexLevelParameteriv", + "__glXDisp_GetTexParameterfv", + "__glXDisp_GetTexParameteriv", + "__glXDisp_Hint", + "__glXDisp_Histogram", + "__glXDisp_IndexMask", + "__glXDisp_Indexdv", + "__glXDisp_Indexfv", + "__glXDisp_Indexiv", + "__glXDisp_Indexsv", + "__glXDisp_Indexubv", + "__glXDisp_InitNames", + "__glXDisp_IsEnabled", + "__glXDisp_IsList", + "__glXDisp_IsTexture", + "__glXDisp_IsTextureEXT", + "__glXDisp_LightModelf", + "__glXDisp_LightModelfv", + "__glXDisp_LightModeli", + "__glXDisp_LightModeliv", + "__glXDisp_Lightf", + "__glXDisp_Lightfv", + "__glXDisp_Lighti", + "__glXDisp_Lightiv", + "__glXDisp_LineStipple", + "__glXDisp_LineWidth", + "__glXDisp_ListBase", + "__glXDisp_LoadIdentity", + "__glXDisp_LoadMatrixd", + "__glXDisp_LoadMatrixf", + "__glXDisp_LoadName", + "__glXDisp_LogicOp", + "__glXDisp_Map1d", + "__glXDisp_Map1f", + "__glXDisp_Map2d", + "__glXDisp_Map2f", + "__glXDisp_MapGrid1d", + "__glXDisp_MapGrid1f", + "__glXDisp_MapGrid2d", + "__glXDisp_MapGrid2f", + "__glXDisp_Materialf", + "__glXDisp_Materialfv", + "__glXDisp_Materiali", + "__glXDisp_Materialiv", + "__glXDisp_MatrixMode", + "__glXDisp_Minmax", + "__glXDisp_MultMatrixd", + "__glXDisp_MultMatrixf", + "__glXDisp_MultiTexCoord1dvARB", + "__glXDisp_MultiTexCoord1fvARB", + "__glXDisp_MultiTexCoord1ivARB", + "__glXDisp_MultiTexCoord1svARB", + "__glXDisp_MultiTexCoord2dvARB", + "__glXDisp_MultiTexCoord2fvARB", + "__glXDisp_MultiTexCoord2ivARB", + "__glXDisp_MultiTexCoord2svARB", + "__glXDisp_MultiTexCoord3dvARB", + "__glXDisp_MultiTexCoord3fvARB", + "__glXDisp_MultiTexCoord3ivARB", + "__glXDisp_MultiTexCoord3svARB", + "__glXDisp_MultiTexCoord4dvARB", + "__glXDisp_MultiTexCoord4fvARB", + "__glXDisp_MultiTexCoord4ivARB", + "__glXDisp_MultiTexCoord4svARB", + "__glXDisp_NewList", + "__glXDisp_Normal3bv", + "__glXDisp_Normal3dv", + "__glXDisp_Normal3fv", + "__glXDisp_Normal3iv", + "__glXDisp_Normal3sv", + "__glXDisp_Ortho", + "__glXDisp_PassThrough", + "__glXDisp_PixelMapfv", + "__glXDisp_PixelMapuiv", + "__glXDisp_PixelMapusv", + "__glXDisp_PixelStoref", + "__glXDisp_PixelStorei", + "__glXDisp_PixelTransferf", + "__glXDisp_PixelTransferi", + "__glXDisp_PixelZoom", + "__glXDisp_PointParameterfARB", + "__glXDisp_PointParameterfvARB", + "__glXDisp_PointSize", + "__glXDisp_PolygonMode", + "__glXDisp_PolygonOffset", + "__glXDisp_PolygonStipple", + "__glXDisp_PopAttrib", + "__glXDisp_PopMatrix", + "__glXDisp_PopName", + "__glXDisp_PrioritizeTextures", + "__glXDisp_PushAttrib", + "__glXDisp_PushMatrix", + "__glXDisp_PushName", + "__glXDisp_RasterPos2dv", + "__glXDisp_RasterPos2fv", + "__glXDisp_RasterPos2iv", + "__glXDisp_RasterPos2sv", + "__glXDisp_RasterPos3dv", + "__glXDisp_RasterPos3fv", + "__glXDisp_RasterPos3iv", + "__glXDisp_RasterPos3sv", + "__glXDisp_RasterPos4dv", + "__glXDisp_RasterPos4fv", + "__glXDisp_RasterPos4iv", + "__glXDisp_RasterPos4sv", + "__glXDisp_ReadBuffer", + "__glXDisp_ReadPixels", + "__glXDisp_Rectdv", + "__glXDisp_Rectfv", + "__glXDisp_Rectiv", + "__glXDisp_Rectsv", + "__glXDisp_RenderMode", + "__glXDisp_ResetHistogram", + "__glXDisp_ResetMinmax", + "__glXDisp_Rotated", + "__glXDisp_Rotatef", + "__glXDisp_Scaled", + "__glXDisp_Scalef", + "__glXDisp_Scissor", + "__glXDisp_SelectBuffer", + "__glXDisp_SeparableFilter2D", + "__glXDisp_ShadeModel", + "__glXDisp_StencilFunc", + "__glXDisp_StencilMask", + "__glXDisp_StencilOp", + "__glXDisp_TexCoord1dv", + "__glXDisp_TexCoord1fv", + "__glXDisp_TexCoord1iv", + "__glXDisp_TexCoord1sv", + "__glXDisp_TexCoord2dv", + "__glXDisp_TexCoord2fv", + "__glXDisp_TexCoord2iv", + "__glXDisp_TexCoord2sv", + "__glXDisp_TexCoord3dv", + "__glXDisp_TexCoord3fv", + "__glXDisp_TexCoord3iv", + "__glXDisp_TexCoord3sv", + "__glXDisp_TexCoord4dv", + "__glXDisp_TexCoord4fv", + "__glXDisp_TexCoord4iv", + "__glXDisp_TexCoord4sv", + "__glXDisp_TexEnvf", + "__glXDisp_TexEnvfv", + "__glXDisp_TexEnvi", + "__glXDisp_TexEnviv", + "__glXDisp_TexGend", + "__glXDisp_TexGendv", + "__glXDisp_TexGenf", + "__glXDisp_TexGenfv", + "__glXDisp_TexGeni", + "__glXDisp_TexGeniv", + "__glXDisp_TexImage1D", + "__glXDisp_TexImage2D", + "__glXDisp_TexImage3D", + "__glXDisp_TexParameterf", + "__glXDisp_TexParameterfv", + "__glXDisp_TexParameteri", + "__glXDisp_TexParameteriv", + "__glXDisp_TexSubImage1D", + "__glXDisp_TexSubImage2D", + "__glXDisp_TexSubImage3D", + "__glXDisp_Translated", + "__glXDisp_Translatef", + "__glXDisp_Vertex2dv", + "__glXDisp_Vertex2fv", + "__glXDisp_Vertex2iv", + "__glXDisp_Vertex2sv", + "__glXDisp_Vertex3dv", + "__glXDisp_Vertex3fv", + "__glXDisp_Vertex3iv", + "__glXDisp_Vertex3sv", + "__glXDisp_Vertex4dv", + "__glXDisp_Vertex4fv", + "__glXDisp_Vertex4iv", + "__glXDisp_Vertex4sv", + "__glXDisp_Viewport", + "__glXDisp_WindowPos3fARB", + "__glXDrawArraysSize", + "__glXDrawPixelsReqSize", + "__glXDrawableRes", + "__glXErrorOccured", + "__glXFBInitDrawable", + "__glXFBMemSwapBuffers", + "__glXFindDrawablePrivate", + "__glXFogfvReqSize", + "__glXFogivReqSize", + "__glXForceCurrent", + "__glXFree", + "__glXFreeBuffers", + "__glXFreeContext", + "__glXGetDrawablePrivate", + "__glXGetVisualConfigs", + "__glXImageSize", + "__glXImpAtoi", + "__glXImpCalloc", + "__glXImpFatal", + "__glXImpFclose", + "__glXImpFopen", + "__glXImpFprintf", + "__glXImpFree", + "__glXImpGetDrawablePrivate", + "__glXImpGetenv", + "__glXImpMalloc", + "__glXImpRealloc", + "__glXImpSprintf", + "__glXImpWarning", + "__glXInitFB", + "__glXInitMem", + "__glXInitPix", + "__glXIsDirect", + "__glXLastContext", + "__glXLightModelfvReqSize", + "__glXLightModelivReqSize", + "__glXLightfvReqSize", + "__glXLightivReqSize", + "__glXLookupContextByTag", + "__glXMakeCurrent", + "__glXMalloc", + "__glXMap1dReqSize", + "__glXMap1fReqSize", + "__glXMap2dReqSize", + "__glXMap2fReqSize", + "__glXMaterialfvReqSize", + "__glXMaterialivReqSize", + "__glXNoSuchRenderOpcode", + "__glXNoSuchSingleOpcode", + "__glXNop", + "__glXPixInitDrawable", + "__glXPixelMapfvReqSize", + "__glXPixelMapuivReqSize", + "__glXPixelMapusvReqSize", + "__glXPixmapRes", + "__glXPrioritizeTexturesReqSize", + "__glXQueryContextInfoEXT", + "__glXQueryExtensionsString", + "__glXQueryServerString", + "__glXQueryVersion", + "__glXRealloc", + "__glXRender", + "__glXRenderLarge", + "__glXRenderSizeTable", + "__glXRenderSizeTable_EXT", + "__glXRenderTable", + "__glXRenderTable_EXT", + "__glXReply", + "__glXResetLargeCommandStatus", + "__glXResizeBuffers", + "__glXResizeDrawableBuffers", + "__glXScreenInit", + "__glXScreenReset", + "__glXSeparableFilter2DReqSize", + "__glXSingleTable", + "__glXSwapBuffers", + "__glXSwapClientInfo", + "__glXSwapCopyContext", + "__glXSwapCreateContext", + "__glXSwapCreateGLXPixmap", + "__glXSwapDestroyContext", + "__glXSwapDestroyGLXPixmap", + "__glXSwapGetVisualConfigs", + "__glXSwapIsDirect", + "__glXSwapIsDirectReply", + "__glXSwapMakeCurrent", + "__glXSwapMakeCurrentReply", + "__glXSwapQueryContextInfoEXTReply", + "__glXSwapQueryExtensionsString", + "__glXSwapQueryServerString", + "__glXSwapQueryVersion", + "__glXSwapQueryVersionReply", + "__glXSwapRender", + "__glXSwapRenderLarge", + "__glXSwapRenderTable", + "__glXSwapRenderTable_EXT", + "__glXSwapSingleTable", + "__glXSwapSwapBuffers", + "__glXSwapUseXFont", + "__glXSwapVendorPrivTable_EXT", + "__glXSwapVendorPrivate", + "__glXSwapVendorPrivateWithReply", + "__glXSwapWaitGL", + "__glXSwapWaitX", + "__glXTexEnvfvReqSize", + "__glXTexEnvivReqSize", + "__glXTexGendvReqSize", + "__glXTexGenfvReqSize", + "__glXTexGenivReqSize", + "__glXTexImage1DReqSize", + "__glXTexImage2DReqSize", + "__glXTexImage3DReqSize", + "__glXTexParameterfvReqSize", + "__glXTexParameterivReqSize", + "__glXTexSubImage1DReqSize", + "__glXTexSubImage2DReqSize", + "__glXTexSubImage3DReqSize", + "__glXTypeSize", + "__glXUnrefDrawablePrivate", + "__glXUnsupportedPrivateRequest", + "__glXUseXFont", + "__glXVendorPrivTable_EXT", + "__glXVendorPrivate", + "__glXVendorPrivateWithReply", + "__glXWaitGL", + "__glXWaitX", + "__glXcombine_strings", + "glAccum", + "glActiveStencilFaceEXT", + "glActiveTextureARB", + "glAlphaFunc", + "glAreTexturesResident", + "glAreTexturesResidentEXT", + "glBegin", + "glBindTexture", + "glBitmap", + "glBlendColor", + "glBlendEquation", + "glBlendFunc", + "glCallList", + "glCallLists", + "glClear", + "glClearAccum", + "glClearColor", + "glClearDepth", + "glClearIndex", + "glClearStencil", + "glClipPlane", + "glColor3bv", + "glColor3dv", + "glColor3fv", + "glColor3iv", + "glColor3sv", + "glColor3ubv", + "glColor3uiv", + "glColor3usv", + "glColor4bv", + "glColor4dv", + "glColor4fv", + "glColor4iv", + "glColor4sv", + "glColor4ubv", + "glColor4uiv", + "glColor4usv", + "glColorMask", + "glColorMaterial", + "glColorPointer", + "glColorSubTable", + "glColorTable", + "glColorTableParameterfv", + "glColorTableParameteriv", + "glConvolutionFilter1D", + "glConvolutionFilter2D", + "glConvolutionParameterf", + "glConvolutionParameterfv", + "glConvolutionParameteri", + "glConvolutionParameteriv", + "glCopyColorSubTable", + "glCopyColorTable", + "glCopyConvolutionFilter1D", + "glCopyConvolutionFilter2D", + "glCopyPixels", + "glCopyTexImage1D", + "glCopyTexImage2D", + "glCopyTexSubImage1D", + "glCopyTexSubImage2D", + "glCopyTexSubImage3D", + "glCullFace", + "glDeleteLists", + "glDeleteTextures", + "glDeleteTexturesEXT", + "glDepthFunc", + "glDepthMask", + "glDepthRange", + "glDisable", + "glDisableClientState", + "glDrawArrays", + "glDrawBuffer", + "glDrawPixels", + "glEdgeFlagPointer", + "glEdgeFlagv", + "glEnable", + "glEnableClientState", + "glEnd", + "glEndList", + "glEvalCoord1dv", + "glEvalCoord1fv", + "glEvalCoord2dv", + "glEvalCoord2fv", + "glEvalMesh1", + "glEvalMesh2", + "glEvalPoint1", + "glEvalPoint2", + "glFeedbackBuffer", + "glFinish", + "glFlush", + "glFogf", + "glFogfv", + "glFogi", + "glFogiv", + "glFrontFace", + "glFrustum", + "glGenLists", + "glGenTextures", + "glGenTexturesEXT", + "glGetBooleanv", + "glGetClipPlane", + "glGetColorTable", + "glGetColorTableParameterfv", + "glGetColorTableParameteriv", + "glGetConvolutionFilter", + "glGetConvolutionParameterfv", + "glGetConvolutionParameteriv", + "glGetDoublev", + "glGetError", + "glGetFloatv", + "glGetHistogram", + "glGetHistogramParameterfv", + "glGetHistogramParameteriv", + "glGetIntegerv", + "glGetLightfv", + "glGetLightiv", + "glGetMapdv", + "glGetMapfv", + "glGetMapiv", + "glGetMaterialfv", + "glGetMaterialiv", + "glGetMinmax", + "glGetMinmaxParameterfv", + "glGetMinmaxParameteriv", + "glGetPixelMapfv", + "glGetPixelMapuiv", + "glGetPixelMapusv", + "glGetPolygonStipple", + "glGetSeparableFilter", + "glGetString", + "glGetTexEnvfv", + "glGetTexEnviv", + "glGetTexGendv", + "glGetTexGenfv", + "glGetTexGeniv", + "glGetTexImage", + "glGetTexLevelParameterfv", + "glGetTexLevelParameteriv", + "glGetTexParameterfv", + "glGetTexParameteriv", + "glHint", + "glHistogram", + "glIndexMask", + "glIndexPointer", + "glIndexdv", + "glIndexfv", + "glIndexiv", + "glIndexsv", + "glIndexubv", + "glInitNames", + "glIsEnabled", + "glIsList", + "glIsTexture", + "glIsTextureEXT", + "glLightModelf", + "glLightModelfv", + "glLightModeli", + "glLightModeliv", + "glLightf", + "glLightfv", + "glLighti", + "glLightiv", + "glLineStipple", + "glLineWidth", + "glListBase", + "glLoadIdentity", + "glLoadMatrixd", + "glLoadMatrixf", + "glLoadName", + "glLogicOp", + "glMap1d", + "glMap1f", + "glMap2d", + "glMap2f", + "glMapGrid1d", + "glMapGrid1f", + "glMapGrid2d", + "glMapGrid2f", + "glMaterialf", + "glMaterialfv", + "glMateriali", + "glMaterialiv", + "glMatrixMode", + "glMinmax", + "glMultMatrixd", + "glMultMatrixf", + "glMultiTexCoord1dvARB", + "glMultiTexCoord1fvARB", + "glMultiTexCoord1ivARB", + "glMultiTexCoord1svARB", + "glMultiTexCoord2dvARB", + "glMultiTexCoord2fvARB", + "glMultiTexCoord2ivARB", + "glMultiTexCoord2svARB", + "glMultiTexCoord3dvARB", + "glMultiTexCoord3fvARB", + "glMultiTexCoord3ivARB", + "glMultiTexCoord3svARB", + "glMultiTexCoord4dvARB", + "glMultiTexCoord4fvARB", + "glMultiTexCoord4ivARB", + "glMultiTexCoord4svARB", + "glNewList", + "glNormal3bv", + "glNormal3dv", + "glNormal3fv", + "glNormal3iv", + "glNormal3sv", + "glNormalPointer", + "glOrtho", + "glPassThrough", + "glPixelMapfv", + "glPixelMapuiv", + "glPixelMapusv", + "glPixelStoref", + "glPixelStorei", + "glPixelTransferf", + "glPixelTransferi", + "glPixelZoom", + "glPointParameterfARB", + "glPointParameterfvARB", + "glPointSize", + "glPolygonMode", + "glPolygonOffset", + "glPolygonStipple", + "glPopAttrib", + "glPopMatrix", + "glPopName", + "glPrioritizeTextures", + "glPushAttrib", + "glPushMatrix", + "glPushName", + "glRasterPos2dv", + "glRasterPos2fv", + "glRasterPos2iv", + "glRasterPos2sv", + "glRasterPos3dv", + "glRasterPos3fv", + "glRasterPos3iv", + "glRasterPos3sv", + "glRasterPos4dv", + "glRasterPos4fv", + "glRasterPos4iv", + "glRasterPos4sv", + "glReadBuffer", + "glReadPixels", + "glRectdv", + "glRectfv", + "glRectiv", + "glRectsv", + "glRenderMode", + "glResetHistogram", + "glResetMinmax", + "glRotated", + "glRotatef", + "glScaled", + "glScalef", + "glScissor", + "glSelectBuffer", + "glSeparableFilter2D", + "glShadeModel", + "glStencilFunc", + "glStencilMask", + "glStencilOp", + "glTexCoord1dv", + "glTexCoord1fv", + "glTexCoord1iv", + "glTexCoord1sv", + "glTexCoord2dv", + "glTexCoord2fv", + "glTexCoord2iv", + "glTexCoord2sv", + "glTexCoord3dv", + "glTexCoord3fv", + "glTexCoord3iv", + "glTexCoord3sv", + "glTexCoord4dv", + "glTexCoord4fv", + "glTexCoord4iv", + "glTexCoord4sv", + "glTexCoordPointer", + "glTexEnvf", + "glTexEnvfv", + "glTexEnvi", + "glTexEnviv", + "glTexGend", + "glTexGendv", + "glTexGenf", + "glTexGenfv", + "glTexGeni", + "glTexGeniv", + "glTexImage1D", + "glTexImage2D", + "glTexImage3D", + "glTexParameterf", + "glTexParameterfv", + "glTexParameteri", + "glTexParameteriv", + "glTexSubImage1D", + "glTexSubImage2D", + "glTexSubImage3D", + "glTranslated", + "glTranslatef", + "glVertex2dv", + "glVertex2fv", + "glVertex2iv", + "glVertex2sv", + "glVertex3dv", + "glVertex3fv", + "glVertex3iv", + "glVertex3sv", + "glVertex4dv", + "glVertex4fv", + "glVertex4iv", + "glVertex4sv", + "glVertexPointer", + "glViewport", + "glWindowPos3fARB", + "glxSwapQueryExtensionsStringReply", + "glxSwapQueryServerStringReply", + NULL +}; + +static XF86ModuleVersionInfo VersRec = +{ + "glx", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + 1, 0, 0, + ABI_CLASS_EXTENSION, + ABI_EXTENSION_VERSION, + MOD_CLASS_NONE, + {0,0,0,0} +}; + +XF86ModuleData glxModuleData = { &VersRec, glxSetup, NULL }; + +static pointer +glxSetup(pointer module, pointer opts, int *errmaj, int *errmin) +{ + static Bool setupDone = FALSE; + pointer GLcore = NULL; +#ifdef GLX_USE_SGI_SI + char GLcoreName[] = "GL"; +#else + char GLcoreName[] = "GLcore"; +#endif + + if (!setupDone) { + setupDone = TRUE; + + GLcore = LoadSubModule(module, GLcoreName, NULL, NULL, NULL, NULL, + errmaj, errmin); + if (!GLcore) { + if (errmaj) *errmaj = LDR_NOSUBENT; + } else { + LoaderReqSymLists(glcoreSymbols, NULL); + LoadExtension(&GLXExt, FALSE); + /* Wrap the init visuals routine in micmap.c */ + GlxWrapInitVisuals(&miInitVisualsProc); + /* Make sure this gets wrapped each time InitVisualWrap is called */ + miHookInitVisuals(NULL, GlxWrapInitVisuals); + } + } else { + if (errmaj) *errmaj = LDR_ONCEONLY; + } + /* Need a non-NULL return value to indicate success */ + return GLcore; +} Index: xc/programs/Xserver/GL/glx/glxscreens.c diff -u xc/programs/Xserver/GL/glx/glxscreens.c:1.15 xc/programs/Xserver/GL/glx/glxscreens.c:1.16 --- xc/programs/Xserver/GL/glx/glxscreens.c:1.15 Wed Feb 11 21:25:01 2004 +++ xc/programs/Xserver/GL/glx/glxscreens.c Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.c,v 1.15 2004/02/12 02:25:01 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.c,v 1.16 2004/12/10 16:06:59 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -133,104 +133,34 @@ "GLX_EXT_visual_info " "GLX_EXT_visual_rating " "GLX_EXT_import_context " + "GLX_OML_swap_method " "GLX_SGI_make_current_read " #ifndef __DARWIN__ "GLX_SGIS_multisample " #endif + "GLX_SGIX_fbconfig " ; /* -** This comes from the GL library that the server will link with. Right -** now, that is the DDX Sample OpenGL. -*/ -extern __GLXscreenInfo __glDDXScreenInfo; - -__GLXscreenInfo *__glXScreens[] = { - &__glDDXScreenInfo, + * __glDDXScreenInfo comes from GLcore, so we can't resolve this symbol at + * module open time. Leave a placeholder, and fill this in when we first + * need it (in __glXScreenInit). XXX Why make this an array? + */ +static __GLXscreenInfo *__glXScreens[] = { + NULL /* &__glDDXScreenInfo */ , }; -GLint __glXNumStaticScreens = (sizeof __glXScreens / sizeof __glXScreens[0]); +static GLint __glXNumStaticScreens = + (sizeof __glXScreens / sizeof __glXScreens[0]); __GLXscreenInfo *__glXActiveScreens; GLint __glXNumActiveScreens; RESTYPE __glXDrawableRes; -#if 0 -static int -CountBits(unsigned long mask) -{ - int count = 0; - - while(mask) { - count += (mask&1); - mask >>= 1; - } - - return count; +__GLXscreenInfo *__glXgetActiveScreen(int num) { + return &__glXActiveScreens[num]; } -#endif - -#if 0 -/* -** A typical implementation would not probably not run through the screen's -** visuals to find ones that match the visual configs supplied by the DDX -** Sample OpenGL as we do here; we have done this to make this code easy to -** drop into an existing X server. -*/ -static int matchVisuals(__GLXvisualConfig *pGlxVisual, int numVisuals, - int screen) -{ - int i, j; - __GLXvisualConfig *pvis = pGlxVisual; - ScreenPtr pScreen = screenInfo.screens[screen]; - VisualPtr pVisual; - int numMatchingVisuals = 0; - int *used; - - used = (int *)__glXMalloc(pScreen->numVisuals*sizeof(int)); - __glXMemset(used, 0, pScreen->numVisuals*sizeof(int)); - - for (i=0; i < numVisuals; i++, pvis++) { - /* - ** Look through all the server's visuals to see which match. - */ - pvis->vid = 0; - pVisual = pScreen->visuals; - for (j=0; j < pScreen->numVisuals; j++, pVisual++) { - if (pvis->class == pVisual->class && - pvis->bufferSize == pVisual->nplanes && - !used[j]) { - int rBits, gBits, bBits, aBits; - - /* count bits per rgb */ - rBits = CountBits(pVisual->redMask); - gBits = CountBits(pVisual->greenMask); - bBits = CountBits(pVisual->blueMask); - aBits = 0; - if ((pvis->redSize == rBits) && - (pvis->greenSize == gBits) && - (pvis->blueSize == bBits) && - (pvis->alphaSize == aBits)) { - /* - ** We'll consider this a match. - */ - pvis->vid = pVisual->vid; - pvis->redMask = pVisual->redMask; - pvis->greenMask = pVisual->greenMask; - pvis->blueMask = pVisual->blueMask; - pvis->alphaMask = 0; - numMatchingVisuals++; - used[j] = 1; - break; - } - } - } - } - __glXFree(used); - return numMatchingVisuals; -} -#endif /* ** Destroy routine that gets called when a drawable is freed. A drawable @@ -346,6 +276,8 @@ { GLint i,j; + __glXScreens[0] = __glXglDDXScreenInfo(); /* from GLcore */ + /* ** This alloc has to work or else the server might as well core dump. */ @@ -360,14 +292,7 @@ if ((*__glXScreens[j]->screenProbe)(i)) { __glXActiveScreens[i] = *__glXScreens[j]; -#if 0 - /* we don't use this since matchVisuals doesn't allow alpha */ - __glXActiveScreens[i].numUsableVisuals = - matchVisuals(__glXActiveScreens[i].pGlxVisual, - __glXActiveScreens[i].numVisuals, i); -#else __glXActiveScreens[i].numUsableVisuals = __glXActiveScreens[i].numVisuals; -#endif __glXActiveScreens[i].GLextensions = __glXStrdup(GLServerExtensions); __glXActiveScreens[i].GLXvendor = __glXStrdup(GLXServerVendorName); __glXActiveScreens[i].GLXversion = __glXStrdup(GLXServerVersion); Index: xc/programs/Xserver/GL/glx/glxscreens.h diff -u xc/programs/Xserver/GL/glx/glxscreens.h:1.5 xc/programs/Xserver/GL/glx/glxscreens.h:1.6 --- xc/programs/Xserver/GL/glx/glxscreens.h:1.5 Fri Feb 22 16:45:07 2002 +++ xc/programs/Xserver/GL/glx/glxscreens.h Fri Dec 10 11:06:59 2004 @@ -1,7 +1,7 @@ #ifndef _GLX_screens_h_ #define _GLX_screens_h_ -/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.h,v 1.5 2002/02/22 21:45:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.h,v 1.6 2004/12/10 16:06:59 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -70,7 +70,11 @@ */ void (*createBuffer)(__GLXdrawablePrivate *glxPriv); - __GLXvisualConfig *pGlxVisual; + /** + * Linked list of valid context modes for this screen. + */ + __GLcontextModes *modes; + void **pVisualPriv; GLint numVisuals; GLint numUsableVisuals; Index: xc/programs/Xserver/GL/glx/glxserver.h diff -u xc/programs/Xserver/GL/glx/glxserver.h:1.6 xc/programs/Xserver/GL/glx/glxserver.h:1.7 --- xc/programs/Xserver/GL/glx/glxserver.h:1.6 Wed Jan 28 13:11:50 2004 +++ xc/programs/Xserver/GL/glx/glxserver.h Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxserver.h,v 1.6 2004/01/28 18:11:50 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxserver.h,v 1.7 2004/12/10 16:06:59 alanh Exp $ */ #ifndef _GLX_server_h_ #define _GLX_server_h_ @@ -92,6 +92,7 @@ extern __GLXscreenInfo *__glXActiveScreens; extern GLint __glXNumActiveScreens; +extern __GLXscreenInfo *__glXgetActiveScreen(int num); /************************************************************************/ Index: xc/programs/Xserver/GL/glx/glxutil.c diff -u xc/programs/Xserver/GL/glx/glxutil.c:1.6 xc/programs/Xserver/GL/glx/glxutil.c:1.7 --- xc/programs/Xserver/GL/glx/glxutil.c:1.6 Sun Sep 28 16:15:43 2003 +++ xc/programs/Xserver/GL/glx/glxutil.c Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.c,v 1.6 2003/09/28 20:15:43 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.c,v 1.7 2004/12/10 16:06:59 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -44,6 +44,9 @@ #include "glxutil.h" #include "glxbuf.h" #include "GL/glx_ansic.h" +#include "GL/internal/glcore.h" +#include "GL/glxint.h" +#include "glcontextmodes.h" /************************************************************************/ @@ -214,53 +217,6 @@ } -/************************************************************************/ - -void -__glXFormatGLModes(__GLcontextModes *modes, __GLXvisualConfig *config) -{ - __glXMemset(modes, 0, sizeof(__GLcontextModes)); - - modes->rgbMode = (config->rgba != 0); - modes->colorIndexMode = !(modes->rgbMode); - modes->doubleBufferMode = (config->doubleBuffer != 0); - modes->stereoMode = (config->stereo != 0); - - modes->haveAccumBuffer = ((config->accumRedSize + - config->accumGreenSize + - config->accumBlueSize + - config->accumAlphaSize) > 0); - modes->haveDepthBuffer = (config->depthSize > 0); - modes->haveStencilBuffer = (config->stencilSize > 0); - - modes->redBits = config->redSize; - modes->greenBits = config->greenSize; - modes->blueBits = config->blueSize; - modes->alphaBits = config->alphaSize; - modes->redMask = config->redMask; - modes->greenMask = config->greenMask; - modes->blueMask = config->blueMask; - modes->alphaMask = config->alphaMask; -#if 0 - modes->rgbBits = modes->redBits + modes->greenBits + - modes->blueBits + modes->alphaBits; -#endif - assert( !modes->rgbMode || ((config->bufferSize & 0x7) == 0) ); - modes->rgbBits = config->bufferSize; - modes->indexBits = config->bufferSize; - - modes->accumRedBits = config->accumRedSize; - modes->accumGreenBits = config->accumGreenSize; - modes->accumBlueBits = config->accumBlueSize; - modes->accumAlphaBits = config->accumAlphaSize; - modes->depthBits = config->depthSize; - modes->stencilBits = config->stencilSize; - - modes->numAuxBuffers = 0; /* XXX: should be picked up from the visual */ - - modes->level = config->level; -} - /*****************************************************************************/ /* accessing the drawable private */ @@ -382,21 +338,13 @@ pGlxScreen = &__glXActiveScreens[pDraw->pScreen->myNum]; - /* allocate the buffers */ if (glxPriv->type == DRAWABLE_WINDOW) { - int i; VisualID vid = wVisual((WindowPtr)pDraw); - __GLXvisualConfig *pGlxVisual = pGlxScreen->pGlxVisual; - for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) { - if (pGlxVisual->vid == vid) { - glxPriv->pGlxVisual = pGlxVisual; - break; - } - } + glxPriv->modes = _gl_context_modes_find_visual( pGlxScreen->modes, vid ); __glXFBInitDrawable(glxPriv, modes); } else { - glxPriv->pGlxVisual = glxPriv->pGlxPixmap->pGlxVisual; + glxPriv->modes = glxPriv->pGlxPixmap->modes; __glXPixInitDrawable(glxPriv, modes); } Index: xc/programs/Xserver/GL/glx/glxutil.h diff -u xc/programs/Xserver/GL/glx/glxutil.h:1.4 xc/programs/Xserver/GL/glx/glxutil.h:1.5 --- xc/programs/Xserver/GL/glx/glxutil.h:1.4 Sun Sep 28 16:15:43 2003 +++ xc/programs/Xserver/GL/glx/glxutil.h Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.h,v 1.4 2003/09/28 20:15:43 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxutil.h,v 1.5 2004/12/10 16:06:59 alanh Exp $ */ #ifndef _glxcmds_h_ #define _glxcmds_h_ @@ -55,7 +55,6 @@ GLuint *width, GLuint *height); extern GLboolean __glXResizeDrawable(__GLdrawablePrivate *glPriv); extern GLboolean __glXResizeDrawableBuffers(__GLXdrawablePrivate *glxPriv); -extern void __glXFormatGLModes(__GLcontextModes *modes, __GLXvisualConfig *config); /* drawable management */ extern void __glXRefDrawablePrivate(__GLXdrawablePrivate *glxPriv); @@ -73,6 +72,9 @@ /* context helper routines */ extern __GLXcontext *__glXLookupContextByTag(__GLXclientState*, GLXContextTag); +/* init helper routines */ +extern void *__glXglDDXScreenInfo(void); +extern void *__glXglDDXExtensionInfo(void); #endif /* _glxcmds_h_ */ Index: xc/programs/Xserver/GL/glx/render2.c diff -u xc/programs/Xserver/GL/glx/render2.c:1.9 xc/programs/Xserver/GL/glx/render2.c:1.11 --- xc/programs/Xserver/GL/glx/render2.c:1.9 Wed Feb 11 21:25:01 2004 +++ xc/programs/Xserver/GL/glx/render2.c Fri Feb 4 21:01:39 2005 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2.c,v 1.9 2004/02/12 02:25:01 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/render2.c,v 1.11 2005/02/05 02:01:39 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -239,8 +239,8 @@ glEnableClientState(GL_SECONDARY_COLOR_ARRAY); glSecondaryColorPointer(numVals, datatype, stride, pc); break; - case GL_FOG_COORDINATE_ARRAY: - glEnableClientState(GL_FOG_COORDINATE_ARRAY); + case GL_FOG_COORD_ARRAY: + glEnableClientState(GL_FOG_COORD_ARRAY); glFogCoordPointer(datatype, stride, pc); break; #endif @@ -261,7 +261,7 @@ glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_EDGE_FLAG_ARRAY); glDisableClientState(GL_SECONDARY_COLOR_ARRAY); - glDisableClientState(GL_FOG_COORDINATE_ARRAY); + glDisableClientState(GL_FOG_COORD_ARRAY); } void __glXDisp_DrawArraysEXT(GLbyte *pc) Index: xc/programs/Xserver/GL/glx/render2swap.c diff -u xc/programs/Xserver/GL/glx/render2swap.c:1.7 xc/programs/Xserver/GL/glx/render2swap.c:1.9 --- xc/programs/Xserver/GL/glx/render2swap.c:1.7 Tue Feb 3 18:04:08 2004 +++ xc/programs/Xserver/GL/glx/render2swap.c Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/render2swap.c,v 1.7 2004/02/03 23:04:08 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/render2swap.c,v 1.9 2004/12/10 16:06:59 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free Index: xc/programs/Xserver/GL/glx/rensize.c diff -u xc/programs/Xserver/GL/glx/rensize.c:1.7 xc/programs/Xserver/GL/glx/rensize.c:1.8 --- xc/programs/Xserver/GL/glx/rensize.c:1.7 Wed Jan 28 13:11:53 2004 +++ xc/programs/Xserver/GL/glx/rensize.c Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/rensize.c,v 1.7 2004/01/28 18:11:53 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/rensize.c,v 1.8 2004/12/10 16:06:59 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -558,7 +558,7 @@ return -1; } break; - case GL_FOG_COORDINATE_ARRAY: + case GL_FOG_COORD_ARRAY: case GL_INDEX_ARRAY: if (numVals != 1) { /* bad size */ Index: xc/programs/Xserver/GL/glx/single2.c diff -u xc/programs/Xserver/GL/glx/single2.c:1.9 xc/programs/Xserver/GL/glx/single2.c:1.10 --- xc/programs/Xserver/GL/glx/single2.c:1.9 Wed Feb 11 04:18:15 2004 +++ xc/programs/Xserver/GL/glx/single2.c Thu Mar 4 14:22:20 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/single2.c,v 1.9 2004/02/11 09:18:15 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/single2.c,v 1.10 2004/03/04 19:22:20 dawes Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -344,7 +344,7 @@ if ( atof( string ) > atof( GLServerVersion ) ) { buf = __glXMalloc( __glXStrlen( string ) + __glXStrlen( GLServerVersion ) - + 3 ); + + 4 ); if ( buf == NULL ) { string = GLServerVersion; } Index: xc/programs/Xserver/GL/glx/single2swap.c diff -u xc/programs/Xserver/GL/glx/single2swap.c:1.8 xc/programs/Xserver/GL/glx/single2swap.c:1.10 --- xc/programs/Xserver/GL/glx/single2swap.c:1.8 Mon Feb 9 18:46:31 2004 +++ xc/programs/Xserver/GL/glx/single2swap.c Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/single2swap.c,v 1.8 2004/02/09 23:46:31 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/single2swap.c,v 1.10 2004/12/10 16:06:59 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free Index: xc/programs/Xserver/GL/glx/singlesize.c diff -u xc/programs/Xserver/GL/glx/singlesize.c:1.8 xc/programs/Xserver/GL/glx/singlesize.c:1.9 --- xc/programs/Xserver/GL/glx/singlesize.c:1.8 Mon Feb 9 14:51:32 2004 +++ xc/programs/Xserver/GL/glx/singlesize.c Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.c,v 1.8 2004/02/09 19:51:32 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/singlesize.c,v 1.9 2004/12/10 16:06:59 alanh Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -81,7 +81,7 @@ case GL_ALPHA_SCALE: /* GL_ARB_point_sprite / GL_NV_point_sprite */ - case GL_COORD_REPLACE_NV: + case GL_COORD_REPLACE_ARB: /* GL_NV_texture_env_combine4 */ case GL_SOURCE3_RGB_NV: @@ -179,6 +179,9 @@ /* GL_EXT_texture_filter_anisotropic */ case GL_TEXTURE_MAX_ANISOTROPY_EXT: + + /* GL_NV_texture_expand_normal */ + case GL_TEXTURE_UNSIGNED_REMAP_MODE_NV: return 1; default: @@ -898,11 +901,11 @@ case GL_BLEND_SRC_ALPHA: /* GL_EXT_fog_coord / GL 1.4 */ - case GL_CURRENT_FOG_COORDINATE: - case GL_FOG_COORDINATE_ARRAY_TYPE: - case GL_FOG_COORDINATE_ARRAY_STRIDE: - case GL_FOG_COORDINATE_ARRAY: - case GL_FOG_COORDINATE_SOURCE: + case GL_CURRENT_FOG_COORD: + case GL_FOG_COORD_ARRAY_TYPE: + case GL_FOG_COORD_ARRAY_STRIDE: + case GL_FOG_COORD_ARRAY: + case GL_FOG_COORD_SRC: /* GL_EXT_secondary_color / GL 1.4 */ case GL_COLOR_SUM: @@ -915,7 +918,7 @@ case GL_MAX_TEXTURE_LOD_BIAS: /* GL_ARB_point_sprite */ - case GL_POINT_SPRITE_NV: + case GL_POINT_SPRITE_ARB: /* GL_ARB_vertex_blend */ case GL_MAX_VERTEX_UNITS_ARB: @@ -942,6 +945,9 @@ /* GL_EXT_clip_volume_hint */ case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: + /* GL_EXT_depth_bounds_test */ + case GL_DEPTH_BOUNDS_TEST_EXT: + /* GL_EXT_stencil_two_size */ case GL_STENCIL_TEST_TWO_SIDE_EXT: case GL_ACTIVE_STENCIL_FACE_EXT: @@ -958,9 +964,38 @@ /* case GL_MODELVIEW0_STACK_DEPTH_EXT: */ /* alias */ case GL_MODELVIEW1_STACK_DEPTH_EXT: + /* GL_EXT_blend_equation_separate */ + /* case GL_BLEND_EQUATION_RGB_EXT: */ /* alias */ + case GL_BLEND_EQUATION_ALPHA_EXT: + /* GL_ATI_vertex_streams */ case GL_MAX_VERTEX_STREAMS_ATI: + /* GL_ATI_draw_buffers */ + case GL_MAX_DRAW_BUFFERS_ATI: + case GL_DRAW_BUFFER0_ATI: + case GL_DRAW_BUFFER1_ATI: + case GL_DRAW_BUFFER2_ATI: + case GL_DRAW_BUFFER3_ATI: + case GL_DRAW_BUFFER4_ATI: + case GL_DRAW_BUFFER5_ATI: + case GL_DRAW_BUFFER6_ATI: + case GL_DRAW_BUFFER7_ATI: + case GL_DRAW_BUFFER8_ATI: + case GL_DRAW_BUFFER9_ATI: + case GL_DRAW_BUFFER10_ATI: + case GL_DRAW_BUFFER11_ATI: + case GL_DRAW_BUFFER12_ATI: + case GL_DRAW_BUFFER13_ATI: + case GL_DRAW_BUFFER14_ATI: + case GL_DRAW_BUFFER15_ATI: + + /* GL_ATI_separate_stencil */ + case GL_STENCIL_BACK_FUNC_ATI: + case GL_STENCIL_BACK_FAIL_ATI: + case GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI: + case GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI: + /* GL_NV_depth_clamp */ case GL_DEPTH_CLAMP_NV: @@ -978,6 +1013,10 @@ /* case GL_POINT_SPRITE_NV: */ /* alias */ case GL_POINT_SPRITE_R_MODE_NV: + /* GL_NV_primitive_restart */ + case GL_PRIMITIVE_RESTART_NV: + case GL_PRIMITIVE_RESTART_INDEX_NV: + /* GL_NV_register_combiners */ case GL_REGISTER_COMBINERS_NV: case GL_NUM_GENERAL_COMBINERS_NV: @@ -993,6 +1032,10 @@ case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: return 1; + /* GL_EXT_depth_bounds_test */ + case GL_DEPTH_BOUNDS_EXT: + return 2; + /* GL_EXT_secondary_color / GL 1.4 */ case GL_CURRENT_SECONDARY_COLOR: Index: xc/programs/Xserver/GL/glx/unpack.h diff -u xc/programs/Xserver/GL/glx/unpack.h:1.5 xc/programs/Xserver/GL/glx/unpack.h:1.7 --- xc/programs/Xserver/GL/glx/unpack.h:1.5 Wed Oct 30 07:52:03 2002 +++ xc/programs/Xserver/GL/glx/unpack.h Fri Dec 10 11:06:59 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/unpack.h,v 1.5 2002/10/30 12:52:03 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/unpack.h,v 1.7 2004/12/10 16:06:59 alanh Exp $ */ #ifndef __GLX_unpack_h__ #define __GLX_unpack_h__ Index: xc/programs/Xserver/GL/include/GL/glx_ansic.h diff -u xc/programs/Xserver/GL/include/GL/glx_ansic.h:1.7 xc/programs/Xserver/GL/include/GL/glx_ansic.h:1.9 --- xc/programs/Xserver/GL/include/GL/glx_ansic.h:1.7 Thu Apr 4 09:05:36 2002 +++ xc/programs/Xserver/GL/include/GL/glx_ansic.h Tue Dec 14 20:26:50 2004 @@ -1,7 +1,7 @@ #ifndef _glx_ansic_h_ #define _glx_ansic_h_ -/* $XFree86: xc/programs/Xserver/GL/include/GL/glx_ansic.h,v 1.7 2002/04/04 14:05:36 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/include/GL/glx_ansic.h,v 1.9 2004/12/15 01:26:50 tsi Exp $ */ /* ** License Applicability. Except to the extent portions of this file are ** made subject to an alternative license as permitted in the SGI Free @@ -50,11 +50,9 @@ ** tree and all should be taken care of. */ -#ifdef XFree86Server +#if defined(XFree86Server) && !defined(XFree86FakeServer) -#ifdef XFree86LOADER #include "xf86_ansic.h" -#endif #ifndef assert #define assert(a) #endif Index: xc/programs/Xserver/GL/mesa/Imakefile diff -u xc/programs/Xserver/GL/mesa/Imakefile:1.6 xc/programs/Xserver/GL/mesa/Imakefile:1.9 --- xc/programs/Xserver/GL/mesa/Imakefile:1.6 Sun Feb 24 19:45:41 2002 +++ xc/programs/Xserver/GL/mesa/Imakefile Fri Dec 10 11:07:00 2004 @@ -1,14 +1,29 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/Imakefile,v 1.6 2002/02/25 00:45:41 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/Imakefile,v 1.9 2004/12/10 16:07:00 alanh Exp $ #define IHaveModules -#include #define IHaveSubdirs + SUBDIRS = main math array_cache shader swrast swrast_setup tnl X GLcore + +#include + + +#define NeedAllMesaSrc +#define NeedToLinkMesaSrc +#define MesaBuildDir /**/ +#include "../../../../lib/GL/mesa/Imakefile.inc" + + INCLUDES = -I$(INCLUDESRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) \ + -I$(MESASRCDIR)/include -I$(GLXLIBSRC)/include \ + -I$(MESASRCDIR)/src/mesa \ + -I$(SERVERSRC)/include - SUBDIRS = src GLcore DEFINES = $(GLX_DEFINES) +ModuleObjectRule() + MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) -MakeLintLibSubdirs($(SUBDIRS)) -LintSubdirs($(SUBDIRS)) + +DependTarget() + Index: xc/programs/Xserver/GL/mesa/GLcore/Imakefile diff -u xc/programs/Xserver/GL/mesa/GLcore/Imakefile:1.4 xc/programs/Xserver/GL/mesa/GLcore/Imakefile:1.8 --- xc/programs/Xserver/GL/mesa/GLcore/Imakefile:1.4 Sat Jun 1 21:21:13 2002 +++ xc/programs/Xserver/GL/mesa/GLcore/Imakefile Fri Dec 10 12:58:27 2004 @@ -1,4 +1,50 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/GLcore/Imakefile,v 1.4 2002/06/02 01:21:13 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/GLcore/Imakefile,v 1.8 2004/12/10 17:58:27 alanh Exp $ +/* + * Copyright (c) 2000-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #if DoLoadableServer #if !BuildModuleInSubdir @@ -13,38 +59,41 @@ #define NeedAllMesaSrc #define MesaInXServer -#define MesaBuildDir ../src/ -#define MesaACBuildDir ../src/array_cache/ -#define MesaMathBuildDir ../src/math/ -#define MesaSwrastBuildDir ../src/swrast/ -#define MesaSwrastSetupBuildDir ../src/swrast_setup/ -#define MesaTnlBuildDir ../src/tnl/ -#define MesaXBuildDir ../src/X/ - -#include "../../../../../lib/GL/mesa/src/array_cache/Imakefile.inc" -#include "../../../../../lib/GL/mesa/src/swrast/Imakefile.inc" -#include "../../../../../lib/GL/mesa/src/swrast_setup/Imakefile.inc" -#include "../../../../../lib/GL/mesa/src/tnl/Imakefile.inc" -#include "../../../../../lib/GL/mesa/src/math/Imakefile.inc" -#include "../../../../../lib/GL/mesa/src/X/Imakefile.inc" -#include "../../../../../lib/GL/mesa/src/Imakefile.inc" +#define MesaBuildDir ../main/ +#define MesaACBuildDir ../array_cache/ +#define MesaMathBuildDir ../math/ +#define MesaSwrastBuildDir ../swrast/ +#define MesaSwrastSetupBuildDir ../swrast_setup/ +#define MesaTnlBuildDir ../tnl/ +#define MesaShaderBuildDir ../shader/ +#define MesaXBuildDir ../X/ + +#include "../../../../../lib/GL/mesa/array_cache/Imakefile.inc" +#include "../../../../../lib/GL/mesa/swrast/Imakefile.inc" +#include "../../../../../lib/GL/mesa/swrast_setup/Imakefile.inc" +#include "../../../../../lib/GL/mesa/tnl/Imakefile.inc" +#include "../../../../../lib/GL/mesa/main/Imakefile.inc" +#include "../../../../../lib/GL/mesa/math/Imakefile.inc" +#include "../../../../../lib/GL/mesa/shader/Imakefile.inc" +#include "../../../../../lib/GL/mesa/drivers/x11/Imakefile.inc" +#include "../../../../../lib/GL/mesa/Imakefile.inc" #ifdef IHaveModules MSRCS = GLcoremodule.c MOBJS = GLcoremodule.o #endif - XOBJS = ../src/X/?*.o + XOBJS = ../X/?*.o OBJS = $(COREMESAOBJS) $(MOBJS) - DONES = ../src/DONE ../src/X/DONE ../src/array_cache/DONE \ - ../src/math/DONE ../src/swrast/DONE ../src/swrast_setup/DONE \ - ../src/tnl/DONE + DONES = ../main/DONE ../X/DONE ../array_cache/DONE \ + ../math/DONE ../swrast/DONE ../swrast_setup/DONE \ + ../tnl/DONE ../shader/DONE INCLUDES = -I$(INCLUDESRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) \ -I$(MESASRCDIR)/include -I$(GLXLIBSRC)/include \ - -I$(MESASRCDIR)/src \ + -I$(MESASRCDIR)/src/mesa \ -I$(SERVERSRC)/include DEFINES = $(GLX_DEFINES) @@ -52,7 +101,7 @@ #ifdef IHaveModules ModuleObjectRule() -DepLibraryModuleTarget(GLcore, $(DONES) $(OBJS),$(OBJS) $(XOBJS)) +DepLibraryModuleTarget(GLcore, $(DONES) $(OBJS),$(OBJS) $(XOBJS),extensions) InstallLibraryModule(GLcore,$(MODULEDIR),extensions) #else Index: xc/programs/Xserver/GL/mesa/GLcore/module/Imakefile diff -u xc/programs/Xserver/GL/mesa/GLcore/module/Imakefile:1.1 xc/programs/Xserver/GL/mesa/GLcore/module/Imakefile:1.5 --- xc/programs/Xserver/GL/mesa/GLcore/module/Imakefile:1.1 Fri May 31 14:12:37 2002 +++ xc/programs/Xserver/GL/mesa/GLcore/module/Imakefile Thu Jan 6 14:08:12 2005 @@ -1,39 +1,88 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/GLcore/module/Imakefile,v 1.1 2002/05/31 18:12:37 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/GLcore/module/Imakefile,v 1.5 2005/01/06 19:08:12 dawes Exp $ +/* + * Copyright (c) 2000-2005 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #define IHaveModules #include #define NeedAllMesaSrc #define MesaInXServer -#define MesaBuildDir ../../src/module/ -#define MesaACBuildDir ../../src/array_cache/module/ -#define MesaMathBuildDir ../../src/math/module/ -#define MesaSwrastBuildDir ../../src/swrast/module/ -#define MesaSwrastSetupBuildDir ../../src/swrast_setup/module/ -#define MesaTnlBuildDir ../../src/tnl/module/ -#define MesaXBuildDir ../../src/X/module/ - -#include "../../../../../../lib/GL/mesa/src/array_cache/Imakefile.inc" -#include "../../../../../../lib/GL/mesa/src/swrast/Imakefile.inc" -#include "../../../../../../lib/GL/mesa/src/swrast_setup/Imakefile.inc" -#include "../../../../../../lib/GL/mesa/src/tnl/Imakefile.inc" -#include "../../../../../../lib/GL/mesa/src/math/Imakefile.inc" -#include "../../../../../../lib/GL/mesa/src/X/Imakefile.inc" -#include "../../../../../../lib/GL/mesa/src/Imakefile.inc" +#define MesaBuildDir ../../main/module/ +#define MesaACBuildDir ../../array_cache/module/ +#define MesaMathBuildDir ../../math/module/ +#define MesaSwrastBuildDir ../../swrast/module/ +#define MesaSwrastSetupBuildDir ../../swrast_setup/module/ +#define MesaTnlBuildDir ../../tnl/module/ +#define MesaShaderBuildDir ../../shader/module/ +#define MesaXBuildDir ../../X/module/ + +#include "../../../../../../lib/GL/mesa/array_cache/Imakefile.inc" +#include "../../../../../../lib/GL/mesa/swrast/Imakefile.inc" +#include "../../../../../../lib/GL/mesa/swrast_setup/Imakefile.inc" +#include "../../../../../../lib/GL/mesa/tnl/Imakefile.inc" +#include "../../../../../../lib/GL/mesa/math/Imakefile.inc" +#include "../../../../../../lib/GL/mesa/main/Imakefile.inc" +#include "../../../../../../lib/GL/mesa/shader/Imakefile.inc" +#include "../../../../../../lib/GL/mesa/Imakefile.inc" #if DoLoadableServer MSRCS = GLcoremodule.c MOBJS = GLcoremodule.o #endif - XOBJS = ../../src/X/module/?*.o + XOBJS = ../../X/module/?*.o OBJS = $(COREMESAOBJS) $(MOBJS) - DONES = ../../src/module/DONE ../../src/X/module/DONE \ - ../../src/array_cache/module/DONE ../../src/math/module/DONE \ - ../../src/swrast/module/DONE \ - ../../src/swrast_setup/module/DONE ../../src/tnl/module/DONE + DONES = ../../main/module/DONE ../../X/module/DONE \ + ../../array_cache/module/DONE ../../math/module/DONE \ + ../../swrast/module/DONE \ + ../../swrast_setup/module/DONE ../../tnl/module/DONE \ + ../../shader/module/DONE INCLUDES = -I$(INCLUDESRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) \ -I$(MESASRCDIR)/include -I$(GLXLIBSRC)/include \ @@ -44,7 +93,7 @@ ModuleObjectRule() -DepLibraryModuleTarget(GLcore, $(DONES) $(OBJS),$(OBJS) $(XOBJS)) +DepLibraryModuleTarget(GLcore, $(DONES) $(OBJS),$(OBJS) $(XOBJS),extensions) InstallLibraryModule(GLcore,$(MODULEDIR),extensions) InstallDriverSDKLibraryModule(GLcore,$(DRIVERSDKMODULEDIR),extensions) Index: xc/programs/Xserver/GL/mesa/X/Imakefile diff -u /dev/null xc/programs/Xserver/GL/mesa/X/Imakefile:1.6 --- /dev/null Wed Mar 16 21:06:12 2005 +++ xc/programs/Xserver/GL/mesa/X/Imakefile Mon Feb 28 22:48:50 2005 @@ -0,0 +1,93 @@ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/X/Imakefile,v 1.6 2005/03/01 03:48:50 dawes Exp $ + +#if DoLoadableServer +#if !BuildModuleInSubdir +#define IHaveModules +#elif !defined(IHaveModules) +#define IHaveSubdirs +SUBDIRS = module +#endif +#endif + +#include + +#define NeedAllMesaSrc +#define NeedToLinkMesaSrc +#define MesaXBuildDir /**/ +#define MesaInXServer +#if !defined(IHaveModules) || !BuildModuleInSubdir +#include "../../../../../lib/GL/mesa/drivers/x11/Imakefile.inc" +#else +#include "../../../../../../lib/GL/mesa/drivers/x11/Imakefile.inc" +#endif + + +LinkSourceFile(compsize.c,$(LIBSRC)/GL/glx) + + DRIVER_SRCS = $(XMESA_SRCS) + DRIVER_OBJS = $(XMESA_OBJS) + + COMMON_SRCS = driverfuncs.c + COMMON_OBJS = driverfuncs.o + +#ifndef XFree86Version + +/* This appears to be the quickest way to build a non-XFree86 server */ +GLXSRV_DEFINES = -DXFree86Server -DXFree86FakeServer + +#endif + + GLX_SRCS = xf86glx.c xf86glx_util.c compsize.c + GLX_OBJS = xf86glx.o xf86glx_util.o compsize.o + + SRCS = $(DRIVER_SRCS) $(GLX_SRCS) $(COMMON_SRCS) + OBJS = $(DRIVER_OBJS) $(GLX_OBJS) $(COMMON_OBJS) + + INCLUDES = -I$(SERVERSRC)/GL/mesa/X -I$(XINCLUDESRC) \ + -I$(EXTINCSRC) \ + -I$(MESASRCDIR)/src/mesa \ + -I$(MESASRCDIR)/src/mesa/main \ + -I$(MESASRCDIR)/src/mesa/glapi \ + -I$(MESASRCDIR)/src/mesa/shader \ + -I$(MESASRCDIR)/src -I$(MESASRCDIR)/src/mesa/drivers/x11 \ + -I$(MESASRCDIR)/include \ + -I$(LIBSRC)/GL/glx -I$(LIBSRC)/GL/include \ + -I$(SERVERSRC)/include -I$(SERVERSRC)/GL/include \ + -I$(SERVERSRC)/GL/glx \ + -I$(XF86OSSRC) \ + -I$(DRMINCLUDESDIR) + + DEFINES = $(GLX_DEFINES) $(GLXSRV_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ + +#ifdef IHaveModules +ModuleObjectRule() +#else +NormalLibraryObjectRule() +#endif + +SubdirLibraryRule($(OBJS)) + +LintLibraryTarget(dri,$(SRCS)) +NormalLintTarget($(SRCS)) + +DependTarget() + +#ifdef IHaveSubdirs +MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) +#endif + +#if defined(IHaveModules) && BuildModuleInSubdir +LinkSourceFile(xf86glx.c,..) +LinkSourceFile(xf86glx_util.c,..) +#endif + +#ifndef MesaDrvSrcDir +#define MesaDrvSrcDir $(MESASRCDIR)/src/mesa/drivers/dri +#endif + +MESADRVSRCDIR = MesaDrvSrcDir + + +LinkSourceFile(driverfuncs.c, $(MESADRVSRCDIR)/../common) +LinkSourceFile(driverfuncs.h, $(MESADRVSRCDIR)/../common) Index: xc/programs/Xserver/GL/mesa/X/xf86glx.c diff -u /dev/null xc/programs/Xserver/GL/mesa/X/xf86glx.c:1.6 --- /dev/null Wed Mar 16 21:06:12 2005 +++ xc/programs/Xserver/GL/mesa/X/xf86glx.c Fri Dec 17 11:38:03 2004 @@ -0,0 +1,934 @@ +/* $XFree86: xc/programs/Xserver/GL/mesa/X/xf86glx.c,v 1.6 2004/12/17 16:38:03 tsi Exp $ */ +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +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, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ + +/* + * Authors: + * Kevin E. Martin + * Brian E. Paul + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "xf86glxint.h" +#include "context.h" +#include "xmesaP.h" +#include +#include "context.h" + +/* + * This define is for the glcore.h header file. + * If you add it here, then make sure you also add it in + * ../../../glx/Imakefile. + */ +#if 0 +#define DEBUG +#include +#undef DEBUG +#else +#include +#endif + +#include "glcontextmodes.h" + +/* + * This structure is statically allocated in the __glXScreens[] + * structure. This struct is not used anywhere other than in + * __glXScreenInit to initialize each of the active screens + * (__glXActiveScreens[]). Several of the fields must be initialized by + * the screenProbe routine before they are copied to the active screens + * struct. In particular, the contextCreate, pGlxVisual, numVisuals, + * and numUsableVisuals fields must be initialized. + */ +static __GLXscreenInfo __glDDXScreenInfo = { + __MESA_screenProbe, /* Must be generic and handle all screens */ + __MESA_createContext, /* Substitute screen's createContext routine */ + __MESA_createBuffer, /* Substitute screen's createBuffer routine */ + NULL, /* Set up modes in probe */ + NULL, /* Set up pVisualPriv in probe */ + 0, /* Set up numVisuals in probe */ + 0, /* Set up numUsableVisuals in probe */ + "Vendor String", /* GLXvendor is overwritten by __glXScreenInit */ + "Version String", /* GLXversion is overwritten by __glXScreenInit */ + "Extensions String", /* GLXextensions is overwritten by __glXScreenInit */ + NULL /* WrappedPositionWindow is overwritten */ +}; + +void *__glXglDDXScreenInfo(void) { + return &__glDDXScreenInfo; +} + +static __GLXextensionInfo __glDDXExtensionInfo = { + GL_CORE_MESA, + __MESA_resetExtension, + __MESA_initVisuals, + __MESA_setVisualConfigs +}; + +void *__glXglDDXExtensionInfo(void) { + return &__glDDXExtensionInfo; +} + +static __MESA_screen MESAScreens[MAXSCREENS]; + +static int numConfigs = 0; +static __GLXvisualConfig *visualConfigs = NULL; +static void **visualPrivates = NULL; + + +static int count_bits(unsigned int n) +{ + int bits = 0; + + while (n > 0) { + if (n & 1) bits++; + n >>= 1; + } + return bits; +} + + +static XMesaVisual find_mesa_visual(int screen, VisualID vid) +{ + __MESA_screen * const pMScr = &MESAScreens[screen]; + const __GLcontextModes *modes; + unsigned i = 0; + + for ( modes = pMScr->modes ; modes != NULL ; modes = modes->next ) { + if ( modes->visualID == vid ) { + break; + } + + i++; + } + + return (modes != NULL) ? pMScr->xm_vis[i] : NULL; +} + + +/* + * In the case the driver defines no GLX visuals we'll use these. + * Note that for TrueColor and DirectColor visuals, bufferSize is the + * sum of redSize, greenSize, blueSize and alphaSize, which may be larger + * than the nplanes/rootDepth of the server's X11 visuals + */ +#define NUM_FALLBACK_CONFIGS 5 +static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { + /* [0] = RGB, double buffered, Z */ + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 0, 0, 0, 0, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 0, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + /* [1] = RGB, double buffered, Z, stencil, accum */ + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 16, 16, 16, 0, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 8, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + /* [2] = RGB+Alpha, double buffered, Z, stencil, accum */ + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 8, /* rgba sizes */ + -1, -1, -1, -1, /* rgba masks */ + 16, 16, 16, 16, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 8, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + /* [3] = RGB+Alpha, single buffered, Z, stencil, accum */ + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 8, /* rgba sizes */ + -1, -1, -1, -1, /* rgba masks */ + 16, 16, 16, 16, /* rgba accum sizes */ + False, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 8, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + /* [4] = CI, double buffered, Z */ + { + -1, /* vid */ + -1, /* class */ + False, /* rgba? (false = color index) */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 0, 0, 0, 0, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 0, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE, /* visualRating */ + GLX_NONE, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, +}; + + +static Bool init_visuals(int *nvisualp, VisualPtr *visualp, + VisualID *defaultVisp, + int ndepth, DepthPtr pdepth, + int rootDepth) +{ + int numRGBconfigs; + int numCIconfigs; + int numVisuals = *nvisualp; + int numNewVisuals; + int numNewConfigs; + VisualPtr pVisual = *visualp; + VisualPtr pVisualNew = NULL; + VisualID *orig_vid = NULL; + __GLcontextModes *modes; + __GLXvisualConfig *pNewVisualConfigs = NULL; + void **glXVisualPriv; + void **pNewVisualPriv; + int found_default; + int i, j, k; + + if (numConfigs > 0) + numNewConfigs = numConfigs; + else + numNewConfigs = NUM_FALLBACK_CONFIGS; + + /* Alloc space for the list of new GLX visuals */ + pNewVisualConfigs = (__GLXvisualConfig *) + __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); + if (!pNewVisualConfigs) { + return FALSE; + } + + /* Alloc space for the list of new GLX visual privates */ + pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *)); + if (!pNewVisualPriv) { + __glXFree(pNewVisualConfigs); + return FALSE; + } + + /* + ** If SetVisualConfigs was not called, then use default GLX + ** visual configs. + */ + if (numConfigs == 0) { + memcpy(pNewVisualConfigs, FallbackConfigs, + NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig)); + memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); + } + else { + /* copy driver's visual config info */ + for (i = 0; i < numConfigs; i++) { + pNewVisualConfigs[i] = visualConfigs[i]; + pNewVisualPriv[i] = visualPrivates[i]; + } + } + + /* Count the number of RGB and CI visual configs */ + numRGBconfigs = 0; + numCIconfigs = 0; + for (i = 0; i < numNewConfigs; i++) { + if (pNewVisualConfigs[i].rgba) + numRGBconfigs++; + else + numCIconfigs++; + } + + /* Count the total number of visuals to compute */ + numNewVisuals = 0; + for (i = 0; i < numVisuals; i++) { + numNewVisuals += + (pVisual[i].class == TrueColor || pVisual[i].class == DirectColor) + ? numRGBconfigs : numCIconfigs; + } + + /* Reset variables for use with the next screen/driver's visual configs */ + visualConfigs = NULL; + numConfigs = 0; + + /* Alloc temp space for the list of orig VisualIDs for each new visual */ + orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID)); + if (!orig_vid) { + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; + } + + /* Alloc space for the list of glXVisuals */ + modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); + if (modes == NULL) { + __glXFree(orig_vid); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; + } + + /* Alloc space for the list of glXVisualPrivates */ + glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); + if (!glXVisualPriv) { + _gl_context_modes_destroy( modes ); + __glXFree(orig_vid); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; + } + + /* Alloc space for the new list of the X server's visuals */ + pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); + if (!pVisualNew) { + __glXFree(glXVisualPriv); + _gl_context_modes_destroy( modes ); + __glXFree(orig_vid); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + return FALSE; + } + + /* Initialize the new visuals */ + found_default = FALSE; + MESAScreens[screenInfo.numScreens-1].modes = modes; + for (i = j = 0; i < numVisuals; i++) { + int is_rgb = (pVisual[i].class == TrueColor || + pVisual[i].class == DirectColor); + + for (k = 0; k < numNewConfigs; k++) { + if (pNewVisualConfigs[k].rgba != is_rgb) + continue; + + assert( modes != NULL ); + + /* Initialize the new visual */ + pVisualNew[j] = pVisual[i]; + pVisualNew[j].vid = FakeClientID(0); + + /* Check for the default visual */ + if (!found_default && pVisual[i].vid == *defaultVisp) { + *defaultVisp = pVisualNew[j].vid; + found_default = TRUE; + } + + /* Save the old VisualID */ + orig_vid[j] = pVisual[i].vid; + + /* Initialize the glXVisual */ + _gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] ); + modes->visualID = pVisualNew[j].vid; + + /* + * If the class is -1, then assume the X visual information + * is identical to what GLX needs, and take them from the X + * visual. NOTE: if class != -1, then all other fields MUST + * be initialized. + */ + if (modes->visualType == GLX_NONE) { + modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class ); + modes->redBits = count_bits(pVisual[i].redMask); + modes->greenBits = count_bits(pVisual[i].greenMask); + modes->blueBits = count_bits(pVisual[i].blueMask); + modes->alphaBits = modes->alphaBits; + modes->redMask = pVisual[i].redMask; + modes->greenMask = pVisual[i].greenMask; + modes->blueMask = pVisual[i].blueMask; + modes->alphaMask = modes->alphaMask; + modes->rgbBits = (is_rgb) + ? (modes->redBits + modes->greenBits + + modes->blueBits + modes->alphaBits) + : rootDepth; + } + + /* Save the device-dependent private for this visual */ + glXVisualPriv[j] = pNewVisualPriv[k]; + + j++; + modes = modes->next; + } + } + + assert(j <= numNewVisuals); + + /* Save the GLX visuals in the screen structure */ + MESAScreens[screenInfo.numScreens-1].num_vis = numNewVisuals; + MESAScreens[screenInfo.numScreens-1].private = glXVisualPriv; + + /* Set up depth's VisualIDs */ + for (i = 0; i < ndepth; i++) { + int numVids = 0; + VisualID *pVids = NULL; + int k, n = 0; + + /* Count the new number of VisualIDs at this depth */ + for (j = 0; j < pdepth[i].numVids; j++) + for (k = 0; k < numNewVisuals; k++) + if (pdepth[i].vids[j] == orig_vid[k]) + numVids++; + + /* Allocate a new list of VisualIDs for this depth */ + pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); + + /* Initialize the new list of VisualIDs for this depth */ + for (j = 0; j < pdepth[i].numVids; j++) + for (k = 0; k < numNewVisuals; k++) + if (pdepth[i].vids[j] == orig_vid[k]) + pVids[n++] = pVisualNew[k].vid; + + /* Update this depth's list of VisualIDs */ + __glXFree(pdepth[i].vids); + pdepth[i].vids = pVids; + pdepth[i].numVids = numVids; + } + + /* Update the X server's visuals */ + *nvisualp = numNewVisuals; + *visualp = pVisualNew; + + /* Free the old list of the X server's visuals */ + __glXFree(pVisual); + + /* Clean up temporary allocations */ + __glXFree(orig_vid); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); + + /* Free the private list created by DDX HW driver */ + if (visualPrivates) + xfree(visualPrivates); + visualPrivates = NULL; + + return TRUE; +} + +void __MESA_setVisualConfigs(int nconfigs, __GLXvisualConfig *configs, + void **privates) +{ + numConfigs = nconfigs; + visualConfigs = configs; + visualPrivates = privates; +} + +Bool __MESA_initVisuals(VisualPtr *visualp, DepthPtr *depthp, + int *nvisualp, int *ndepthp, int *rootDepthp, + VisualID *defaultVisp, unsigned long sizes, + int bitsPerRGB) +{ + /* + * Setup the visuals supported by this particular screen. + */ + return init_visuals(nvisualp, visualp, defaultVisp, + *ndepthp, *depthp, *rootDepthp); +} + +static void fixup_visuals(int screen) +{ + ScreenPtr pScreen = screenInfo.screens[screen]; + __MESA_screen *pMScr = &MESAScreens[screen]; + int j; + __GLcontextModes *modes; + + for ( modes = pMScr->modes ; modes != NULL ; modes = modes->next ) { + const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); + const int nplanes = (modes->rgbBits - modes->alphaBits); + const VisualPtr pVis = pScreen->visuals; + + /* Find a visual that matches the GLX visual's class and size */ + for (j = 0; j < pScreen->numVisuals; j++) { + if (pVis[j].class == vis_class && + pVis[j].nplanes == nplanes) { + + /* Fixup the masks */ + modes->redMask = pVis[j].redMask; + modes->greenMask = pVis[j].greenMask; + modes->blueMask = pVis[j].blueMask; + + /* Recalc the sizes */ + modes->redBits = count_bits(modes->redMask); + modes->greenBits = count_bits(modes->greenMask); + modes->blueBits = count_bits(modes->blueMask); + } + } + } +} + +static void init_screen_visuals(int screen) +{ + ScreenPtr pScreen = screenInfo.screens[screen]; + __GLcontextModes *modes; + XMesaVisual *pXMesaVisual; + int *used; + int i, j; + + /* Alloc space for the list of XMesa visuals */ + pXMesaVisual = (XMesaVisual *)__glXMalloc(MESAScreens[screen].num_vis * + sizeof(XMesaVisual)); + __glXMemset(pXMesaVisual, 0, + MESAScreens[screen].num_vis * sizeof(XMesaVisual)); + + /* FIXME: Change 'used' to be a array of bits (rather than of ints), + * FIXME: create a stack array of 8 or 16 bytes. If 'numVisuals' is less + * FIXME: than 64 or 128 the stack array can be used instead of calling + * FIXME: __glXMalloc / __glXFree. If nothing else, convert 'used' to + * FIXME: array of bytes instead of ints! + */ + used = (int *)__glXMalloc(pScreen->numVisuals * sizeof(int)); + __glXMemset(used, 0, pScreen->numVisuals * sizeof(int)); + + i = 0; + for ( modes = MESAScreens[screen].modes + ; modes != NULL + ; modes = modes->next ) { + const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); + const int nplanes = (modes->rgbBits - modes->alphaBits); + const VisualPtr pVis = pScreen->visuals; + + for (j = 0; j < pScreen->numVisuals; j++) { + if (pVis[j].class == vis_class && + pVis[j].nplanes == nplanes && + pVis[j].redMask == modes->redMask && + pVis[j].greenMask == modes->greenMask && + pVis[j].blueMask == modes->blueMask && + !used[j]) { + + /* Create the XMesa visual */ + pXMesaVisual[i] = + XMesaCreateVisual(pScreen, + pVis, + modes->rgbMode, + (modes->alphaBits > 0), + modes->doubleBufferMode, + modes->stereoMode, + GL_TRUE, /* ximage_flag */ + modes->depthBits, + modes->stencilBits, + modes->accumRedBits, + modes->accumGreenBits, + modes->accumBlueBits, + modes->accumAlphaBits, + modes->samples, + modes->level, + modes->visualRating); + /* Set the VisualID */ + modes->visualID = pVis[j].vid; + + /* Mark this visual used */ + used[j] = 1; + break; + } + } + + if ( j == pScreen->numVisuals ) { + ErrorF("No matching visual for __GLcontextMode with " + "visual class = %d (%d), nplanes = %u\n", + vis_class, + modes->visualType, + (modes->rgbBits - modes->alphaBits) ); + } + else if ( modes->visualID == -1 ) { + FatalError( "Matching visual found, but visualID still -1!\n" ); + } + + i++; + } + + __glXFree(used); + + MESAScreens[screen].xm_vis = pXMesaVisual; +} + +Bool __MESA_screenProbe(int screen) +{ + /* + * Set up the current screen's visuals. + */ + __glDDXScreenInfo.modes = MESAScreens[screen].modes; + __glDDXScreenInfo.pVisualPriv = MESAScreens[screen].private; + __glDDXScreenInfo.numVisuals = + __glDDXScreenInfo.numUsableVisuals = MESAScreens[screen].num_vis; + + /* + * Set the current screen's createContext routine. This could be + * wrapped by a DDX GLX context creation routine. + */ + __glDDXScreenInfo.createContext = __MESA_createContext; + + /* + * The ordering of the rgb compenents might have been changed by the + * driver after mi initialized them. + */ + fixup_visuals(screen); + + /* + * Find the GLX visuals that are supported by this screen and create + * XMesa's visuals. + */ + init_screen_visuals(screen); + + return TRUE; +} + +extern void __MESA_resetExtension(void) +{ + int i, j; + + XMesaReset(); + + for (i = 0; i < screenInfo.numScreens; i++) { + for (j = 0; j < MESAScreens[i].num_vis; j++) { + if (MESAScreens[i].xm_vis[j]) { + XMesaDestroyVisual(MESAScreens[i].xm_vis[j]); + MESAScreens[i].xm_vis[j] = NULL; + } + } + _gl_context_modes_destroy( MESAScreens[i].modes ); + MESAScreens[i].modes = NULL; + __glXFree(MESAScreens[i].private); + MESAScreens[i].private = NULL; + __glXFree(MESAScreens[i].xm_vis); + MESAScreens[i].xm_vis = NULL; + MESAScreens[i].num_vis = 0; + } + __glDDXScreenInfo.modes = NULL; +} + +void __MESA_createBuffer(__GLXdrawablePrivate *glxPriv) +{ + DrawablePtr pDraw = glxPriv->pDraw; + XMesaVisual xm_vis = find_mesa_visual(pDraw->pScreen->myNum, + glxPriv->modes->visualID); + __GLdrawablePrivate *glPriv = &glxPriv->glPriv; + __MESA_buffer buf; + + if (xm_vis == NULL) { + ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n", + glxPriv->modes->visualID); + } + buf = (__MESA_buffer)__glXMalloc(sizeof(struct __MESA_bufferRec)); + + /* Create Mesa's buffers */ + if (glxPriv->type == DRAWABLE_WINDOW) { + buf->xm_buf = (void *)XMesaCreateWindowBuffer(xm_vis, + (WindowPtr)pDraw); + } else { + buf->xm_buf = (void *)XMesaCreatePixmapBuffer(xm_vis, + (PixmapPtr)pDraw, 0); + } + + /* Wrap the front buffer's resize routine */ + buf->fbresize = glPriv->frontBuffer.resize; + glPriv->frontBuffer.resize = __MESA_resizeBuffers; + + /* Wrap the swap buffers routine */ + buf->fbswap = glxPriv->swapBuffers; + glxPriv->swapBuffers = __MESA_swapBuffers; + + /* Save Mesa's private buffer structure */ + glPriv->private = (void *)buf; + glPriv->freePrivate = __MESA_destroyBuffer; +} + +GLboolean __MESA_resizeBuffers(__GLdrawableBuffer *buffer, + GLint x, GLint y, + GLuint width, GLuint height, + __GLdrawablePrivate *glPriv, + GLuint bufferMask) +{ + __MESA_buffer buf = (__MESA_buffer)glPriv->private; + + if (buf->xm_buf) + XMesaResizeBuffers(buf->xm_buf); + + return (*buf->fbresize)(buffer, x, y, width, height, glPriv, bufferMask); +} + +GLboolean __MESA_swapBuffers(__GLXdrawablePrivate *glxPriv) +{ + __MESA_buffer buf = (__MESA_buffer)glxPriv->glPriv.private; + + /* + ** Do not call the wrapped swap buffers routine since Mesa has + ** already done the swap. + */ + XMesaSwapBuffers(buf->xm_buf); + + return GL_TRUE; +} + +void __MESA_destroyBuffer(__GLdrawablePrivate *glPriv) +{ + __MESA_buffer buf = (__MESA_buffer)glPriv->private; + __GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *)glPriv->other; + + /* Destroy Mesa's buffers */ + if (buf->xm_buf) + XMesaDestroyBuffer(buf->xm_buf); + + /* Unwrap these routines */ + glxPriv->swapBuffers = buf->fbswap; + glPriv->frontBuffer.resize = buf->fbresize; + + __glXFree(glPriv->private); + glPriv->private = NULL; +} + +__GLinterface *__MESA_createContext(__GLimports *imports, + __GLcontextModes *modes, + __GLinterface *shareGC) +{ + __GLcontext *gl_ctx = NULL; + __GLcontext *m_share = NULL; + __GLXcontext *glxc = (__GLXcontext *)imports->other; + XMesaVisual xm_vis; + + if (shareGC) + m_share = (__GLcontext *)shareGC; + + xm_vis = find_mesa_visual(glxc->pScreen->myNum, glxc->modes->visualID); + if (xm_vis) { + XMesaContext xmshare = m_share ? m_share->DriverCtx : 0; + XMesaContext xmctx = XMesaCreateContext(xm_vis, xmshare); + gl_ctx = xmctx ? &xmctx->mesa : 0; + } + else { + ErrorF("find_mesa_visual returned NULL for visualID = 0x%04x\n", + glxc->modes->visualID); + } + + + if (!gl_ctx) + return NULL; + + gl_ctx->imports = *imports; + gl_ctx->exports.destroyContext = __MESA_destroyContext; + gl_ctx->exports.loseCurrent = __MESA_loseCurrent; + gl_ctx->exports.makeCurrent = __MESA_makeCurrent; + gl_ctx->exports.shareContext = __MESA_shareContext; + gl_ctx->exports.copyContext = __MESA_copyContext; + gl_ctx->exports.forceCurrent = __MESA_forceCurrent; + gl_ctx->exports.notifyResize = __MESA_notifyResize; + gl_ctx->exports.notifyDestroy = __MESA_notifyDestroy; + gl_ctx->exports.notifySwapBuffers = __MESA_notifySwapBuffers; + gl_ctx->exports.dispatchExec = __MESA_dispatchExec; + gl_ctx->exports.beginDispatchOverride = __MESA_beginDispatchOverride; + gl_ctx->exports.endDispatchOverride = __MESA_endDispatchOverride; + + return (__GLinterface *)gl_ctx; +} + +GLboolean __MESA_destroyContext(__GLcontext *gc) +{ + XMesaContext xmesa = (XMesaContext) gc->DriverCtx; + XMesaDestroyContext( xmesa ); + return GL_TRUE; +} + +GLboolean __MESA_loseCurrent(__GLcontext *gc) +{ + XMesaContext xmesa = (XMesaContext) gc->DriverCtx; + __glXLastContext = NULL; + return XMesaLoseCurrent(xmesa); +} + +GLboolean __MESA_makeCurrent(__GLcontext *gc) +{ + __GLdrawablePrivate *drawPriv = gc->imports.getDrawablePrivate( gc ); + __MESA_buffer drawBuf = (__MESA_buffer)drawPriv->private; + __GLdrawablePrivate *readPriv = gc->imports.getReadablePrivate( gc ); + __MESA_buffer readBuf = (__MESA_buffer)readPriv->private; + XMesaContext xmesa = (XMesaContext) gc->DriverCtx; + + return XMesaMakeCurrent2(xmesa, drawBuf->xm_buf, readBuf->xm_buf); +} + +GLboolean __MESA_shareContext(__GLcontext *gc, __GLcontext *gcShare) +{ + /* NOT_DONE */ + /* XXX I don't see where/how this could ever be called */ + ErrorF("__MESA_shareContext\n"); + return GL_FALSE; +} + +GLboolean __MESA_copyContext(__GLcontext *dst, const __GLcontext *src, + GLuint mask) +{ + XMesaContext xm_dst = (XMesaContext) dst->DriverCtx; + const XMesaContext xm_src = (XMesaContext) src->DriverCtx; + _mesa_copy_context(&xm_src->mesa, &xm_dst->mesa, mask); + return GL_TRUE; +} + +GLboolean __MESA_forceCurrent(__GLcontext *gc) +{ + XMesaContext xmesa = (XMesaContext) gc->DriverCtx; + return XMesaForceCurrent(xmesa); +} + +GLboolean __MESA_notifyResize(__GLcontext *gc) +{ + /* NOT_DONE */ + ErrorF("__MESA_notifyResize\n"); + return GL_FALSE; +} + +void __MESA_notifyDestroy(__GLcontext *gc) +{ + /* NOT_DONE */ + ErrorF("__MESA_notifyDestroy\n"); + return; +} + +void __MESA_notifySwapBuffers(__GLcontext *gc) +{ + _mesa_notifySwapBuffers(gc); +} + +struct __GLdispatchStateRec *__MESA_dispatchExec(__GLcontext *gc) +{ + /* NOT_DONE */ + ErrorF("__MESA_dispatchExec\n"); + return NULL; +} + +void __MESA_beginDispatchOverride(__GLcontext *gc) +{ + /* NOT_DONE */ + ErrorF("__MESA_beginDispatchOverride\n"); + return; +} + +void __MESA_endDispatchOverride(__GLcontext *gc) +{ + /* NOT_DONE */ + ErrorF("__MESA_endDispatchOverride\n"); + return; +} + + +/* + * Server-side GLX uses these functions which are normally defined + * in the OpenGL SI. + */ + +GLint __glEvalComputeK(GLenum target) +{ + switch (target) { + case GL_MAP1_VERTEX_4: + case GL_MAP1_COLOR_4: + case GL_MAP1_TEXTURE_COORD_4: + case GL_MAP2_VERTEX_4: + case GL_MAP2_COLOR_4: + case GL_MAP2_TEXTURE_COORD_4: + return 4; + case GL_MAP1_VERTEX_3: + case GL_MAP1_TEXTURE_COORD_3: + case GL_MAP1_NORMAL: + case GL_MAP2_VERTEX_3: + case GL_MAP2_TEXTURE_COORD_3: + case GL_MAP2_NORMAL: + return 3; + case GL_MAP1_TEXTURE_COORD_2: + case GL_MAP2_TEXTURE_COORD_2: + return 2; + case GL_MAP1_TEXTURE_COORD_1: + case GL_MAP2_TEXTURE_COORD_1: + case GL_MAP1_INDEX: + case GL_MAP2_INDEX: + return 1; + default: + return 0; + } +} + +GLuint __glFloorLog2(GLuint val) +{ + int c = 0; + + while (val > 1) { + c++; + val >>= 1; + } + return c; +} + Index: xc/programs/Xserver/GL/mesa/X/xf86glx_util.c diff -u /dev/null xc/programs/Xserver/GL/mesa/X/xf86glx_util.c:1.2 --- /dev/null Wed Mar 16 21:06:12 2005 +++ xc/programs/Xserver/GL/mesa/X/xf86glx_util.c Sat Oct 23 11:29:27 2004 @@ -0,0 +1,143 @@ +/* $XFree86: xc/programs/Xserver/GL/mesa/X/xf86glx_util.c,v 1.2 2004/10/23 15:29:27 dawes Exp $ */ +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +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, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ + +/* + * Authors: + * Kevin E. Martin + * Brian Paul + */ + +#include +#include "pixmapstr.h" +#include "xf86glx_util.h" +#include +#include "GL/xf86glx.h" + +#ifdef ROUNDUP +#undef ROUNDUP +#endif + +#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3)) + +XMesaImage *XMesaCreateImage(int bitsPerPixel, int width, int height, char *data) +{ + XMesaImage *image; + + image = (XMesaImage *)xalloc(sizeof(XMesaImage)); + + if (image) { + image->width = width; + image->height = height; + image->data = data; + /* Always pad to 32 bits */ + image->bytes_per_line = ROUNDUP((bitsPerPixel * width), 32); + image->bits_per_pixel = bitsPerPixel; + } + + return image; +} + +void XMesaDestroyImage(XMesaImage *image) +{ + if (image->data) + free(image->data); + xfree(image); +} + +unsigned long XMesaGetPixel(XMesaImage *image, int x, int y) +{ + CARD8 *row = (CARD8 *)(image->data + y*image->bytes_per_line); + CARD8 *i8; + CARD16 *i16; + CARD32 *i32; + switch (image->bits_per_pixel) { + case 8: + i8 = (CARD8 *)row; + return i8[x]; + case 15: + case 16: + i16 = (CARD16 *)row; + return i16[x]; + case 24: /* WARNING: architecture specific code */ + i8 = (CARD8 *)row; + return (((CARD32)i8[x*3]) | + (((CARD32)i8[x*3+1])<<8) | + (((CARD32)i8[x*3+2])<<16)); + case 32: + i32 = (CARD32 *)row; + return i32[x]; + } + return 0; +} + +#ifndef XMESA_USE_PUTPIXEL_MACRO +void XMesaPutPixel(XMesaImage *image, int x, int y, unsigned long pixel) +{ + CARD8 *row = (CARD8 *)(image->data + y*image->bytes_per_line); + CARD8 *i8; + CARD16 *i16; + CARD32 *i32; + switch (image->bits_per_pixel) { + case 8: + i8 = (CARD8 *)row; + i8[x] = (CARD8)pixel; + break; + case 15: + case 16: + i16 = (CARD16 *)row; + i16[x] = (CARD16)pixel; + break; + case 24: /* WARNING: architecture specific code */ + i8 = (CARD8 *)__row; + i8[x*3] = (CARD8)(p); + i8[x*3+1] = (CARD8)(p>>8); + i8[x*3+2] = (CARD8)(p>>16); + case 32: + i32 = (CARD32 *)row; + i32[x] = (CARD32)pixel; + break; + } +} +#endif + +void XMesaPutImageHelper(ScreenPtr display, + DrawablePtr d, GCPtr gc, + XMesaImage *image, + int src_x, int src_y, + int dest_x, int dest_y, + unsigned int width, unsigned int height) +{ + /* NOT_DONE: Verify that the following works for all depths */ + char *src = (image->data + + src_y * image->bytes_per_line + + ((src_x * image->bits_per_pixel) >> 3)); + + ValidateGC(d, gc); + (*gc->ops->PutImage)(d, gc, d->depth, dest_x, dest_y, width, height, + 0, ZPixmap, src); +} Index: xc/programs/Xserver/GL/mesa/X/xf86glx_util.h diff -u /dev/null xc/programs/Xserver/GL/mesa/X/xf86glx_util.h:1.1 --- /dev/null Wed Mar 16 21:06:12 2005 +++ xc/programs/Xserver/GL/mesa/X/xf86glx_util.h Thu Apr 8 06:08:01 2004 @@ -0,0 +1,102 @@ +/* $XFree86: xc/programs/Xserver/GL/mesa/X/xf86glx_util.h,v 1.1 2004/04/08 10:08:01 alanh Exp $ */ +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +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, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ + +/* + * Authors: + * Kevin E. Martin + * Brian Paul + */ + +#ifndef _XF86GLX_UTIL_H_ +#define _XF86GLX_UTIL_H_ + +#ifdef __CYGWIN__ +#undef WIN32 +#undef _WIN32 +#endif + +#include +#include +#include +#include "GL/xmesa.h" + +#define XMESA_USE_PUTPIXEL_MACRO + +struct _XMesaImageRec { + int width, height; + char *data; + int bytes_per_line; /* Padded to 32 bits */ + int bits_per_pixel; +}; + +extern XMesaImage *XMesaCreateImage(int bitsPerPixel, int width, int height, + char *data); +extern void XMesaDestroyImage(XMesaImage *image); +extern unsigned long XMesaGetPixel(XMesaImage *image, int x, int y); +#ifdef XMESA_USE_PUTPIXEL_MACRO +#define XMesaPutPixel(__i,__x,__y,__p) \ +{ \ + CARD8 *__row = (CARD8 *)(__i->data + __y*__i->bytes_per_line); \ + CARD8 *__i8; \ + CARD16 *__i16; \ + CARD32 *__i32; \ + switch (__i->bits_per_pixel) { \ + case 8: \ + __i8 = (CARD8 *)__row; \ + __i8[__x] = (CARD8)__p; \ + break; \ + case 15: \ + case 16: \ + __i16 = (CARD16 *)__row; \ + __i16[__x] = (CARD16)__p; \ + break; \ + case 24: /* WARNING: architecture specific code */ \ + __i8 = (CARD8 *)__row; \ + __i8[__x*3] = (CARD8)(__p); \ + __i8[__x*3+1] = (CARD8)(__p>>8); \ + __i8[__x*3+2] = (CARD8)(__p>>16); \ + break; \ + case 32: \ + __i32 = (CARD32 *)__row; \ + __i32[__x] = (CARD32)__p; \ + break; \ + } \ +} +#else +extern void XMesaPutPixel(XMesaImage *image, int x, int y, + unsigned long pixel); +#endif + +extern void XMesaPutImageHelper(ScreenPtr display, + DrawablePtr d, GCPtr gc, + XMesaImage *image, + int src_x, int src_y, + int dest_x, int dest_y, + unsigned int width, unsigned int height); + +#endif /* _XF86GLX_UTIL_H_ */ Index: xc/programs/Xserver/GL/mesa/X/xf86glxint.h diff -u /dev/null xc/programs/Xserver/GL/mesa/X/xf86glxint.h:1.2 --- /dev/null Wed Mar 16 21:06:12 2005 +++ xc/programs/Xserver/GL/mesa/X/xf86glxint.h Fri Dec 10 11:07:00 2004 @@ -0,0 +1,115 @@ +/* $XFree86: xc/programs/Xserver/GL/mesa/X/xf86glxint.h,v 1.2 2004/12/10 16:07:00 alanh Exp $ */ +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +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, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ + +/* + * Authors: + * Kevin E. Martin + * + */ + +#ifndef _XF86GLXINT_H_ +#define _XF86GLXINT_H_ + +#include +#include +#include + +typedef struct __MESA_screenRec __MESA_screen; +struct __MESA_screenRec { + int num_vis; + __GLcontextModes *modes; + XMesaVisual *xm_vis; + void **private; +}; + +typedef struct __MESA_bufferRec *__MESA_buffer; +struct __MESA_bufferRec { + XMesaBuffer xm_buf; + GLboolean (*fbresize)(__GLdrawableBuffer *buf, + GLint x, GLint y, GLuint width, GLuint height, + __GLdrawablePrivate *glPriv, GLuint bufferMask); + GLboolean (*fbswap)(__GLXdrawablePrivate *glxPriv); +}; + +extern void __MESA_setVisualConfigs(int nconfigs, __GLXvisualConfig *configs, + void **privates); +extern Bool __MESA_initVisuals(VisualPtr *visualp, DepthPtr *depthp, + int *nvisualp, int *ndepthp, int *rootDepthp, + VisualID *defaultVisp, unsigned long sizes, + int bitsPerRGB); +extern Bool __MESA_screenProbe(int screen); + +extern void __MESA_resetExtension(void); + +extern void __MESA_createBuffer(__GLXdrawablePrivate *glxPriv); +extern GLboolean __MESA_resizeBuffers(__GLdrawableBuffer *buf, + GLint x, GLint y, + GLuint width, GLuint height, + __GLdrawablePrivate *glPriv, + GLuint bufferMask); +extern GLboolean __MESA_swapBuffers(__GLXdrawablePrivate *glxPriv); +extern void __MESA_destroyBuffer(__GLdrawablePrivate *glPriv); + +extern __GLinterface *__MESA_createContext(__GLimports *imports, + __GLcontextModes *modes, + __GLinterface *shareGC); +extern GLboolean __MESA_destroyContext(__GLcontext *gc); +extern GLboolean __MESA_loseCurrent(__GLcontext *gc); +extern GLboolean __MESA_makeCurrent(__GLcontext *gc); +extern GLboolean __MESA_shareContext(__GLcontext *gc, __GLcontext *gcShare); +extern GLboolean __MESA_copyContext(__GLcontext *dst, const __GLcontext *src, + GLuint mask); +extern GLboolean __MESA_forceCurrent(__GLcontext *gc); + +extern GLboolean __MESA_notifyResize(__GLcontext *gc); +extern void __MESA_notifyDestroy(__GLcontext *gc); +extern void __MESA_notifySwapBuffers(__GLcontext *gc); +extern struct __GLdispatchStateRec *__MESA_dispatchExec(__GLcontext *gc); +extern void __MESA_beginDispatchOverride(__GLcontext *gc); +extern void __MESA_endDispatchOverride(__GLcontext *gc); + +extern GLint __glCallLists_size(GLsizei n, GLenum type); +extern GLint __glEvalComputeK(GLenum target); +extern GLuint __glFloorLog2(GLuint val); +extern GLint __glFogfv_size(GLenum pname); +extern GLint __glFogiv_size(GLenum pname); +extern GLint __glLightModelfv_size(GLenum pname); +extern GLint __glLightModeliv_size(GLenum pname); +extern GLint __glLightfv_size(GLenum pname); +extern GLint __glLightiv_size(GLenum pname); +extern GLint __glMaterialfv_size(GLenum pname); +extern GLint __glMaterialiv_size(GLenum pname); +extern GLint __glTexEnvfv_size(GLenum pname); +extern GLint __glTexEnviv_size(GLenum pname); +extern GLint __glTexGendv_size(GLenum pname); +extern GLint __glTexGenfv_size(GLenum pname); +extern GLint __glTexGeniv_size(GLenum pname); +extern GLint __glTexParameterfv_size(GLenum pname); +extern GLint __glTexParameteriv_size(GLenum pname); + +#endif /* _XF86GLXINT_H_ */ Index: xc/programs/Xserver/GL/mesa/X/module/Imakefile diff -u /dev/null xc/programs/Xserver/GL/mesa/X/module/Imakefile:1.1 --- /dev/null Wed Mar 16 21:06:13 2005 +++ xc/programs/Xserver/GL/mesa/X/module/Imakefile Thu Apr 8 06:08:01 2004 @@ -0,0 +1,6 @@ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/X/module/Imakefile,v 1.1 2004/04/08 10:08:01 alanh Exp $ + +#define IHaveModules + +#include "../Imakefile" + Index: xc/programs/Xserver/GL/mesa/array_cache/Imakefile diff -u /dev/null xc/programs/Xserver/GL/mesa/array_cache/Imakefile:1.1 --- /dev/null Wed Mar 16 21:06:13 2005 +++ xc/programs/Xserver/GL/mesa/array_cache/Imakefile Thu Apr 8 06:08:01 2004 @@ -0,0 +1,56 @@ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/array_cache/Imakefile,v 1.1 2004/04/08 10:08:01 alanh Exp $ + +#if DoLoadableServer +#if !BuildModuleInSubdir +#define IHaveModules +#elif !defined(IHaveModules) +#define IHaveSubdirs +SUBDIRS = module +#endif +#endif + +#include + +#define NeedAllMesaSrc +#define NeedToLinkMesaSrc +#define MesaACBuildDir /**/ +#if !defined(IHaveModules) || !BuildModuleInSubdir +#include "../../../../../lib/GL/mesa/array_cache/Imakefile.inc" +#else +#include "../../../../../../lib/GL/mesa/array_cache/Imakefile.inc" +#endif + + SRCS = $(MESA_AC_SRCS) + OBJS = $(MESA_AC_OBJS) + + INCLUDES = -I$(MESASRCDIR)/src/mesa \ + -I$(MESASRCDIR)/src/mesa/array_cache \ + -I$(MESASRCDIR)/src/mesa/math \ + -I$(MESASRCDIR)/src/mesa/main \ + -I$(MESASRCDIR)/src/mesa/glapi \ + -I$(MESASRCDIR)/include \ + -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ + -I$(LIBSRC)/GL/include \ + -I$(XF86SRC) -I$(INCLUDESRC) + + DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ + +#ifdef IHaveModules +ModuleObjectRule() +#else +NormalLibraryObjectRule() +#endif + +SubdirLibraryRule($(OBJS)) + +LintLibraryTarget(dri,$(SRCS)) +NormalLintTarget($(SRCS)) + +DependTarget() + +#ifdef IHaveSubdirs +MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) +#endif + Index: xc/programs/Xserver/GL/mesa/array_cache/module/Imakefile diff -u /dev/null xc/programs/Xserver/GL/mesa/array_cache/module/Imakefile:1.1 --- /dev/null Wed Mar 16 21:06:13 2005 +++ xc/programs/Xserver/GL/mesa/array_cache/module/Imakefile Thu Apr 8 06:08:01 2004 @@ -0,0 +1,6 @@ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/array_cache/module/Imakefile,v 1.1 2004/04/08 10:08:01 alanh Exp $ + +#define IHaveModules + +#include "../Imakefile" + Index: xc/programs/Xserver/GL/mesa/main/Imakefile diff -u /dev/null xc/programs/Xserver/GL/mesa/main/Imakefile:1.2 --- /dev/null Wed Mar 16 21:06:13 2005 +++ xc/programs/Xserver/GL/mesa/main/Imakefile Fri Dec 10 11:07:00 2004 @@ -0,0 +1,55 @@ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/main/Imakefile,v 1.2 2004/12/10 16:07:00 alanh Exp $ + +#if DoLoadableServer +#if !BuildModuleInSubdir +#define IHaveModules +#elif !defined(IHaveModules) +#define IHaveSubdirs +SUBDIRS = module +#endif +#endif + +#include + +#define NeedAllMesaSrc +#define NeedToLinkMesaSrc +#define MesaBuildDir /**/ +#if !defined(IHaveModules) || !BuildModuleInSubdir +#include "../../../../../lib/GL/mesa/main/Imakefile.inc" +#else +#include "../../../../../../lib/GL/mesa/main/Imakefile.inc" +#endif + + SRCS = $(COREMESABASESRCS) + OBJS = $(COREMESABASEOBJS) + + INCLUDES = -I$(MESASRCDIR)/src/mesa \ + -I$(MESASRCDIR)/src/mesa/main \ + -I$(MESASRCDIR)/src/mesa/glapi \ + -I$(MESASRCDIR)/src/mesa/shader \ + -I$(MESASRCDIR)/include \ + -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ + -I$(LIBSRC)/GL/include \ + -I$(XF86SRC) -I$(INCLUDESRC) + + DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ + +#ifdef IHaveModules +ModuleObjectRule() +#else +NormalLibraryObjectRule() +#endif + +SubdirLibraryRule($(OBJS)) + +LintLibraryTarget(dri,$(SRCS)) +NormalLintTarget($(SRCS)) + +DependTarget() + +#ifdef IHaveSubdirs +MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) +#endif + Index: xc/programs/Xserver/GL/mesa/main/module/Imakefile diff -u /dev/null xc/programs/Xserver/GL/mesa/main/module/Imakefile:1.1 --- /dev/null Wed Mar 16 21:06:13 2005 +++ xc/programs/Xserver/GL/mesa/main/module/Imakefile Thu Apr 8 06:08:01 2004 @@ -0,0 +1,6 @@ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/main/module/Imakefile,v 1.1 2004/04/08 10:08:01 alanh Exp $ + +#define IHaveModules + +#include "../Imakefile" + Index: xc/programs/Xserver/GL/mesa/math/Imakefile diff -u /dev/null xc/programs/Xserver/GL/mesa/math/Imakefile:1.1 --- /dev/null Wed Mar 16 21:06:13 2005 +++ xc/programs/Xserver/GL/mesa/math/Imakefile Thu Apr 8 06:08:01 2004 @@ -0,0 +1,55 @@ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/math/Imakefile,v 1.1 2004/04/08 10:08:01 alanh Exp $ + +#if DoLoadableServer +#if !BuildModuleInSubdir +#define IHaveModules +#elif !defined(IHaveModules) +#define IHaveSubdirs +SUBDIRS = module +#endif +#endif + +#include + +#define NeedAllMesaSrc +#define NeedToLinkMesaSrc +#define MesaMathBuildDir /**/ +#if !defined(IHaveModules) || !BuildModuleInSubdir +#include "../../../../../lib/GL/mesa/math/Imakefile.inc" +#else +#include "../../../../../../lib/GL/mesa/math/Imakefile.inc" +#endif + + SRCS = $(MESA_MATH_SRCS) + OBJS = $(MESA_MATH_OBJS) + + INCLUDES = -I$(MESASRCDIR)/src/mesa \ + -I$(MESASRCDIR)/src/mesa/math \ + -I$(MESASRCDIR)/src/mesa/main \ + -I$(MESASRCDIR)/src/mesa/glapi \ + -I$(MESASRCDIR)/include \ + -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ + -I$(LIBSRC)/GL/include \ + -I$(XF86SRC) -I$(INCLUDESRC) + + DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ + +#ifdef IHaveModules +ModuleObjectRule() +#else +NormalLibraryObjectRule() +#endif + +SubdirLibraryRule($(OBJS)) + +LintLibraryTarget(dri,$(SRCS)) +NormalLintTarget($(SRCS)) + +DependTarget() + +#ifdef IHaveSubdirs +MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) +#endif + Index: xc/programs/Xserver/GL/mesa/math/module/Imakefile diff -u /dev/null xc/programs/Xserver/GL/mesa/math/module/Imakefile:1.1 --- /dev/null Wed Mar 16 21:06:13 2005 +++ xc/programs/Xserver/GL/mesa/math/module/Imakefile Thu Apr 8 06:08:01 2004 @@ -0,0 +1,6 @@ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/math/module/Imakefile,v 1.1 2004/04/08 10:08:01 alanh Exp $ + +#define IHaveModules + +#include "../Imakefile" + Index: xc/programs/Xserver/GL/mesa/shader/Imakefile diff -u /dev/null xc/programs/Xserver/GL/mesa/shader/Imakefile:1.2 --- /dev/null Wed Mar 16 21:06:13 2005 +++ xc/programs/Xserver/GL/mesa/shader/Imakefile Fri Dec 10 12:58:27 2004 @@ -0,0 +1,56 @@ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/shader/Imakefile,v 1.2 2004/12/10 17:58:27 alanh Exp $ + +#if DoLoadableServer +#if !BuildModuleInSubdir +#define IHaveModules +#elif !defined(IHaveModules) +#define IHaveSubdirs +SUBDIRS = module +#endif +#endif + +#include + +#define NeedAllMesaSrc +#define NeedToLinkMesaSrc +#define MesaShaderBuildDir /**/ +#if !defined(IHaveModules) || !BuildModuleInSubdir +#include "../../../../../lib/GL/mesa/shader/Imakefile.inc" +#else +#include "../../../../../../lib/GL/mesa/shader/Imakefile.inc" +#endif + + + SRCS = $(MESA_SHADER_SRCS) + OBJS = $(MESA_SHADER_OBJS) + + INCLUDES = -I$(MESASRCDIR)/src/mesa \ + -I$(MESASRCDIR)/src/mesa/main \ + -I$(MESASRCDIR)/src/mesa/glapi \ + -I$(MESASRCDIR)/src/mesa/shader \ + -I$(MESASRCDIR)/include \ + -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ + -I$(LIBSRC)/GL/include \ + -I$(XF86SRC) -I$(INCLUDESRC) + + DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ + +#ifdef IHaveModules +ModuleObjectRule() +#else +NormalLibraryObjectRule() +#endif + +SubdirLibraryRule($(OBJS)) + +LintLibraryTarget(dri,$(SRCS)) +NormalLintTarget($(SRCS)) + +DependTarget() + +#ifdef IHaveSubdirs +MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) +#endif + Index: xc/programs/Xserver/GL/mesa/shader/module/Imakefile diff -u /dev/null xc/programs/Xserver/GL/mesa/shader/module/Imakefile:1.1 --- /dev/null Wed Mar 16 21:06:13 2005 +++ xc/programs/Xserver/GL/mesa/shader/module/Imakefile Fri Dec 10 11:07:00 2004 @@ -0,0 +1,6 @@ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/shader/module/Imakefile,v 1.1 2004/12/10 16:07:00 alanh Exp $ + +#define IHaveModules + +#include "../Imakefile" + Index: xc/programs/Xserver/GL/mesa/src/Imakefile diff -u xc/programs/Xserver/GL/mesa/src/Imakefile:1.23 xc/programs/Xserver/GL/mesa/src/Imakefile:removed --- xc/programs/Xserver/GL/mesa/src/Imakefile:1.23 Fri Nov 22 17:56:00 2002 +++ xc/programs/Xserver/GL/mesa/src/Imakefile Wed Mar 16 21:06:14 2005 @@ -1,52 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.23 2002/11/22 22:56:00 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) - MODSUBDIR = module -#endif -#endif - -#if !defined(IHaveModules) || !BuildModuleInSubdir -#define IHaveSubdirs - SUBDIRS = math array_cache swrast swrast_setup tnl X $(MODSUBDIR) -#endif - -#include - - -#define NeedAllMesaSrc -#define NeedToLinkMesaSrc -#define MesaBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../lib/GL/mesa/src/Imakefile.inc" -#else -#include "../../../../../../lib/GL/mesa/src/Imakefile.inc" -#endif - - SRCS = $(COREMESABASESRCS) - OBJS = $(COREMESABASEOBJS) - - INCLUDES = -I$(INCLUDESRC) -I$(XINCLUDESRC) -I$(EXTINCSRC) \ - -I$(MESASRCDIR)/include -I$(GLXLIBSRC)/include \ - -I$(MESASRCDIR)/src \ - -I$(SERVERSRC)/include - - DEFINES = $(GLX_DEFINES) - -#ifdef IHaveModules -ModuleObjectRule() -#else -NormalLibraryObjectRule() -#endif - -#ifdef IHaveSubdirs -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -#endif - -SubdirLibraryRule($(OBJS)) - -DependTarget() - Index: xc/programs/Xserver/GL/mesa/src/X/Imakefile diff -u xc/programs/Xserver/GL/mesa/src/X/Imakefile:1.16 xc/programs/Xserver/GL/mesa/src/X/Imakefile:removed --- xc/programs/Xserver/GL/mesa/src/X/Imakefile:1.16 Fri Nov 22 17:56:01 2002 +++ xc/programs/Xserver/GL/mesa/src/X/Imakefile Wed Mar 16 21:06:14 2005 @@ -1,75 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/X/Imakefile,v 1.16 2002/11/22 22:56:01 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - -#include - -#define NeedAllMesaSrc -#define NeedToLinkMesaSrc -#define MesaXBuildDir /**/ -#define MesaInXServer -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../../lib/GL/mesa/src/X/Imakefile.inc" -#else -#include "../../../../../../../lib/GL/mesa/src/X/Imakefile.inc" -#endif - - -LinkSourceFile(compsize.c,$(LIBSRC)/GL/glx) - - DRIVER_SRCS = $(XMESA_SRCS) - DRIVER_OBJS = $(XMESA_OBJS) - -#ifndef XFree86Version - -/* This appears to be the quickest way to build a non-XFree86 server */ -GLXSRV_DEFINES = -DXFree86Server - -#endif - - GLX_SRCS = xf86glx.c xf86glx_util.c compsize.c - GLX_OBJS = xf86glx.o xf86glx_util.o compsize.o - - SRCS = $(DRIVER_SRCS) $(GLX_SRCS) - OBJS = $(DRIVER_OBJS) $(GLX_OBJS) - - INCLUDES = -I$(SERVERSRC)/GL/mesa/src/X -I$(INCLUDESRC) -I$(XINCLUDESRC) \ - -I$(EXTINCSRC) \ - -I$(MESASRCDIR)/src -I$(MESASRCDIR)/src/X \ - -I$(MESASRCDIR)/include \ - -I$(LIBSRC)/GL/glx -I$(LIBSRC)/GL/include \ - -I$(SERVERSRC)/include -I$(SERVERSRC)/GL/include \ - -I$(SERVERSRC)/GL/glx - - DEFINES = $(GLX_DEFINES) $(GLXSRV_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ - -#ifdef IHaveModules -ModuleObjectRule() -#else -NormalLibraryObjectRule() -#endif - -SubdirLibraryRule($(OBJS)) - -LintLibraryTarget(dri,$(SRCS)) -NormalLintTarget($(SRCS)) - -DependTarget() - -#ifdef IHaveSubdirs -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -#endif - -#if defined(IHaveModules) && BuildModuleInSubdir -LinkSourceFile(xf86glx.c,..) -LinkSourceFile(xf86glx_util.c,..) -#endif - Index: xc/programs/Xserver/GL/mesa/src/X/xf86glx.c diff -u xc/programs/Xserver/GL/mesa/src/X/xf86glx.c:1.21 xc/programs/Xserver/GL/mesa/src/X/xf86glx.c:removed --- xc/programs/Xserver/GL/mesa/src/X/xf86glx.c:1.21 Tue Oct 28 17:50:18 2003 +++ xc/programs/Xserver/GL/mesa/src/X/xf86glx.c Wed Mar 16 21:06:14 2005 @@ -1,898 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx.c,v 1.21 2003/10/28 22:50:18 tsi Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin - * Brian E. Paul - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "xf86glxint.h" -#include "context.h" -#include "xmesaP.h" -#include -#include "context.h" - -/* - * This define is for the glcore.h header file. - * If you add it here, then make sure you also add it in - * ../../../glx/Imakefile. - */ -#if 0 -#define DEBUG -#include -#undef DEBUG -#else -#include -#endif - - -/* - * This structure is statically allocated in the __glXScreens[] - * structure. This struct is not used anywhere other than in - * __glXScreenInit to initialize each of the active screens - * (__glXActiveScreens[]). Several of the fields must be initialized by - * the screenProbe routine before they are copied to the active screens - * struct. In particular, the contextCreate, pGlxVisual, numVisuals, - * and numUsableVisuals fields must be initialized. - */ -__GLXscreenInfo __glDDXScreenInfo = { - __MESA_screenProbe, /* Must be generic and handle all screens */ - __MESA_createContext, /* Substitute screen's createContext routine */ - __MESA_createBuffer, /* Substitute screen's createBuffer routine */ - NULL, /* Set up pGlxVisual in probe */ - NULL, /* Set up pVisualPriv in probe */ - 0, /* Set up numVisuals in probe */ - 0, /* Set up numUsableVisuals in probe */ - "Vendor String", /* GLXvendor is overwritten by __glXScreenInit */ - "Version String", /* GLXversion is overwritten by __glXScreenInit */ - "Extensions String", /* GLXextensions is overwritten by __glXScreenInit */ - NULL /* WrappedPositionWindow is overwritten */ -}; - -__GLXextensionInfo __glDDXExtensionInfo = { - GL_CORE_MESA, - __MESA_resetExtension, - __MESA_initVisuals, - __MESA_setVisualConfigs -}; - -static __MESA_screen MESAScreens[MAXSCREENS]; - -static int numConfigs = 0; -static __GLXvisualConfig *visualConfigs = NULL; -static void **visualPrivates = NULL; - - -static int count_bits(unsigned int n) -{ - int bits = 0; - - while (n > 0) { - if (n & 1) bits++; - n >>= 1; - } - return bits; -} - - -static XMesaVisual find_mesa_visual(int screen, VisualID vid) -{ - XMesaVisual xm_vis = NULL; - __MESA_screen *pMScr = &MESAScreens[screen]; - int i; - - for (i = 0; i < pMScr->num_vis; i++) { - if (pMScr->glx_vis[i].vid == vid) { - xm_vis = pMScr->xm_vis[i]; - break; - } - } - - return xm_vis; -} - - -/* - * In the case the driver defines no GLX visuals we'll use these. - * Note that for TrueColor and DirectColor visuals, bufferSize is the - * sum of redSize, greenSize, blueSize and alphaSize, which may be larger - * than the nplanes/rootDepth of the server's X11 visuals - */ -#define NUM_FALLBACK_CONFIGS 5 -static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { - /* [0] = RGB, double buffered, Z */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [1] = RGB, double buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 16, 16, 16, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [2] = RGB+Alpha, double buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 8, /* rgba sizes */ - -1, -1, -1, -1, /* rgba masks */ - 16, 16, 16, 16, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [3] = RGB+Alpha, single buffered, Z, stencil, accum */ - { - -1, /* vid */ - -1, /* class */ - True, /* rgba */ - -1, -1, -1, 8, /* rgba sizes */ - -1, -1, -1, -1, /* rgba masks */ - 16, 16, 16, 16, /* rgba accum sizes */ - False, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 8, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, - /* [4] = CI, double buffered, Z */ - { - -1, /* vid */ - -1, /* class */ - False, /* rgba? (false = color index) */ - -1, -1, -1, 0, /* rgba sizes */ - -1, -1, -1, 0, /* rgba masks */ - 0, 0, 0, 0, /* rgba accum sizes */ - True, /* doubleBuffer */ - False, /* stereo */ - -1, /* bufferSize */ - 16, /* depthSize */ - 0, /* stencilSize */ - 0, /* auxBuffers */ - 0, /* level */ - GLX_NONE, /* visualRating */ - GLX_NONE, /* transparentPixel */ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ - 0 /* transparentIndex */ - }, -}; - - -static Bool init_visuals(int *nvisualp, VisualPtr *visualp, - VisualID *defaultVisp, - int ndepth, DepthPtr pdepth, - int rootDepth) -{ - int numRGBconfigs; - int numCIconfigs; - int numVisuals = *nvisualp; - int numNewVisuals; - int numNewConfigs; - VisualPtr pVisual = *visualp; - VisualPtr pVisualNew = NULL; - VisualID *orig_vid = NULL; - __GLXvisualConfig *glXVisualPtr = NULL; - __GLXvisualConfig *pNewVisualConfigs = NULL; - void **glXVisualPriv; - void **pNewVisualPriv; - int found_default; - int i, j, k; - - if (numConfigs > 0) - numNewConfigs = numConfigs; - else - numNewConfigs = NUM_FALLBACK_CONFIGS; - - /* Alloc space for the list of new GLX visuals */ - pNewVisualConfigs = (__GLXvisualConfig *) - __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); - if (!pNewVisualConfigs) { - return FALSE; - } - - /* Alloc space for the list of new GLX visual privates */ - pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *)); - if (!pNewVisualPriv) { - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* - ** If SetVisualConfigs was not called, then use default GLX - ** visual configs. - */ - if (numConfigs == 0) { - memcpy(pNewVisualConfigs, FallbackConfigs, - NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig)); - memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); - } - else { - /* copy driver's visual config info */ - for (i = 0; i < numConfigs; i++) { - pNewVisualConfigs[i] = visualConfigs[i]; - pNewVisualPriv[i] = visualPrivates[i]; - } - } - - /* Count the number of RGB and CI visual configs */ - numRGBconfigs = 0; - numCIconfigs = 0; - for (i = 0; i < numNewConfigs; i++) { - if (pNewVisualConfigs[i].rgba) - numRGBconfigs++; - else - numCIconfigs++; - } - - /* Count the total number of visuals to compute */ - numNewVisuals = 0; - for (i = 0; i < numVisuals; i++) { - numNewVisuals += - (pVisual[i].class == TrueColor || pVisual[i].class == DirectColor) - ? numRGBconfigs : numCIconfigs; - } - - /* Reset variables for use with the next screen/driver's visual configs */ - visualConfigs = NULL; - numConfigs = 0; - - /* Alloc temp space for the list of orig VisualIDs for each new visual */ - orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID)); - if (!orig_vid) { - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the list of glXVisuals */ - glXVisualPtr = (__GLXvisualConfig *)__glXMalloc(numNewVisuals * - sizeof(__GLXvisualConfig)); - if (!glXVisualPtr) { - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the list of glXVisualPrivates */ - glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); - if (!glXVisualPriv) { - __glXFree(glXVisualPtr); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Alloc space for the new list of the X server's visuals */ - pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); - if (!pVisualNew) { - __glXFree(glXVisualPriv); - __glXFree(glXVisualPtr); - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - return FALSE; - } - - /* Initialize the new visuals */ - found_default = FALSE; - for (i = j = 0; i < numVisuals; i++) { - int is_rgb = (pVisual[i].class == TrueColor || - pVisual[i].class == DirectColor); - - for (k = 0; k < numNewConfigs; k++) { - if (pNewVisualConfigs[k].rgba != is_rgb) - continue; - - /* Initialize the new visual */ - pVisualNew[j] = pVisual[i]; - pVisualNew[j].vid = FakeClientID(0); - - /* Check for the default visual */ - if (!found_default && pVisual[i].vid == *defaultVisp) { - *defaultVisp = pVisualNew[j].vid; - found_default = TRUE; - } - - /* Save the old VisualID */ - orig_vid[j] = pVisual[i].vid; - - /* Initialize the glXVisual */ - glXVisualPtr[j] = pNewVisualConfigs[k]; - glXVisualPtr[j].vid = pVisualNew[j].vid; - - /* - * If the class is -1, then assume the X visual information - * is identical to what GLX needs, and take them from the X - * visual. NOTE: if class != -1, then all other fields MUST - * be initialized. - */ - if (glXVisualPtr[j].class == -1) { - glXVisualPtr[j].class = pVisual[i].class; - glXVisualPtr[j].redSize = count_bits(pVisual[i].redMask); - glXVisualPtr[j].greenSize = count_bits(pVisual[i].greenMask); - glXVisualPtr[j].blueSize = count_bits(pVisual[i].blueMask); - glXVisualPtr[j].alphaSize = glXVisualPtr[j].alphaSize; - glXVisualPtr[j].redMask = pVisual[i].redMask; - glXVisualPtr[j].greenMask = pVisual[i].greenMask; - glXVisualPtr[j].blueMask = pVisual[i].blueMask; - glXVisualPtr[j].alphaMask = glXVisualPtr[j].alphaMask; - if (is_rgb) { - glXVisualPtr[j].bufferSize = glXVisualPtr[j].redSize + - glXVisualPtr[j].greenSize + - glXVisualPtr[j].blueSize + - glXVisualPtr[j].alphaSize; - } else { - glXVisualPtr[j].bufferSize = rootDepth; - } - } - - /* Save the device-dependent private for this visual */ - glXVisualPriv[j] = pNewVisualPriv[k]; - - j++; - } - } - - assert(j <= numNewVisuals); - - /* Save the GLX visuals in the screen structure */ - MESAScreens[screenInfo.numScreens-1].num_vis = numNewVisuals; - MESAScreens[screenInfo.numScreens-1].glx_vis = glXVisualPtr; - MESAScreens[screenInfo.numScreens-1].private = glXVisualPriv; - - /* Set up depth's VisualIDs */ - for (i = 0; i < ndepth; i++) { - int numVids = 0; - VisualID *pVids = NULL; - int k, n = 0; - - /* Count the new number of VisualIDs at this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - numVids++; - - /* Allocate a new list of VisualIDs for this depth */ - pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); - - /* Initialize the new list of VisualIDs for this depth */ - for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numNewVisuals; k++) - if (pdepth[i].vids[j] == orig_vid[k]) - pVids[n++] = pVisualNew[k].vid; - - /* Update this depth's list of VisualIDs */ - __glXFree(pdepth[i].vids); - pdepth[i].vids = pVids; - pdepth[i].numVids = numVids; - } - - /* Update the X server's visuals */ - *nvisualp = numNewVisuals; - *visualp = pVisualNew; - - /* Free the old list of the X server's visuals */ - __glXFree(pVisual); - - /* Clean up temporary allocations */ - __glXFree(orig_vid); - __glXFree(pNewVisualPriv); - __glXFree(pNewVisualConfigs); - - /* Free the private list created by DDX HW driver */ - if (visualPrivates) - xfree(visualPrivates); - visualPrivates = NULL; - - return TRUE; -} - -void __MESA_setVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates) -{ - (void)kernel8; - (void)DitherValues; - numConfigs = nconfigs; - visualConfigs = configs; - visualPrivates = privates; -} - -Bool __MESA_initVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, int *rootDepthp, - VisualID *defaultVisp, unsigned long sizes, - int bitsPerRGB) -{ - /* - * Setup the visuals supported by this particular screen. - */ - return init_visuals(nvisualp, visualp, defaultVisp, - *ndepthp, *depthp, *rootDepthp); -} - -static void fixup_visuals(int screen) -{ - ScreenPtr pScreen = screenInfo.screens[screen]; - __MESA_screen *pMScr = &MESAScreens[screen]; - __GLXvisualConfig *pGLXVis = pMScr->glx_vis; - VisualPtr pVis; - int i, j; - - for (i = 0; i < pMScr->num_vis; i++, pGLXVis++) { - pVis = pScreen->visuals; - - /* Find a visual that matches the GLX visual's class and size */ - for (j = 0; j < pScreen->numVisuals; j++, pVis++) { - if (pVis->class == pGLXVis->class && - pVis->nplanes == (pGLXVis->bufferSize - pGLXVis->alphaSize)) { - - /* Fixup the masks */ - pGLXVis->redMask = pVis->redMask; - pGLXVis->greenMask = pVis->greenMask; - pGLXVis->blueMask = pVis->blueMask; - - /* Recalc the sizes */ - pGLXVis->redSize = count_bits(pGLXVis->redMask); - pGLXVis->greenSize = count_bits(pGLXVis->greenMask); - pGLXVis->blueSize = count_bits(pGLXVis->blueMask); - } - } - } -} - -static void init_screen_visuals(int screen) -{ - ScreenPtr pScreen = screenInfo.screens[screen]; - __GLXvisualConfig *pGLXVis = MESAScreens[screen].glx_vis; - XMesaVisual *pXMesaVisual; - VisualPtr pVis; - int *used; - int i, j; - - /* Alloc space for the list of XMesa visuals */ - pXMesaVisual = (XMesaVisual *)__glXMalloc(MESAScreens[screen].num_vis * - sizeof(XMesaVisual)); - __glXMemset(pXMesaVisual, 0, - MESAScreens[screen].num_vis * sizeof(XMesaVisual)); - - used = (int *)__glXMalloc(pScreen->numVisuals * sizeof(int)); - __glXMemset(used, 0, pScreen->numVisuals * sizeof(int)); - - for (i = 0; i < MESAScreens[screen].num_vis; i++, pGLXVis++) { - - pVis = pScreen->visuals; - for (j = 0; j < pScreen->numVisuals; j++, pVis++) { - - if (pVis->class == pGLXVis->class && - pVis->nplanes == (pGLXVis->bufferSize - pGLXVis->alphaSize) && - !used[j]) { - - if (pVis->redMask == pGLXVis->redMask && - pVis->greenMask == pGLXVis->greenMask && - pVis->blueMask == pGLXVis->blueMask) { - - /* Create the XMesa visual */ - pXMesaVisual[i] = - XMesaCreateVisual(pScreen, - pVis, - pGLXVis->rgba, - (pGLXVis->alphaSize > 0), - pGLXVis->doubleBuffer, - pGLXVis->stereo, - GL_TRUE, /* ximage_flag */ - pGLXVis->depthSize, - pGLXVis->stencilSize, - pGLXVis->accumRedSize, - pGLXVis->accumGreenSize, - pGLXVis->accumBlueSize, - pGLXVis->accumAlphaSize, - 0, /* numSamples */ - pGLXVis->level, - pGLXVis->visualRating ); - /* Set the VisualID */ - pGLXVis->vid = pVis->vid; - - /* Mark this visual used */ - used[j] = 1; - break; - } - } - } - } - - __glXFree(used); - - MESAScreens[screen].xm_vis = pXMesaVisual; -} - -Bool __MESA_screenProbe(int screen) -{ - /* - * Set up the current screen's visuals. - */ - __glDDXScreenInfo.pGlxVisual = MESAScreens[screen].glx_vis; - __glDDXScreenInfo.pVisualPriv = MESAScreens[screen].private; - __glDDXScreenInfo.numVisuals = - __glDDXScreenInfo.numUsableVisuals = MESAScreens[screen].num_vis; - - /* - * Set the current screen's createContext routine. This could be - * wrapped by a DDX GLX context creation routine. - */ - __glDDXScreenInfo.createContext = __MESA_createContext; - - /* - * The ordering of the rgb compenents might have been changed by the - * driver after mi initialized them. - */ - fixup_visuals(screen); - - /* - * Find the GLX visuals that are supported by this screen and create - * XMesa's visuals. - */ - init_screen_visuals(screen); - - return TRUE; -} - -extern void __MESA_resetExtension(void) -{ - int i, j; - - XMesaReset(); - - for (i = 0; i < screenInfo.numScreens; i++) { - for (j = 0; j < MESAScreens[i].num_vis; j++) { - if (MESAScreens[i].xm_vis[j]) { - XMesaDestroyVisual(MESAScreens[i].xm_vis[j]); - MESAScreens[i].xm_vis[j] = NULL; - } - } - __glXFree(MESAScreens[i].glx_vis); - MESAScreens[i].glx_vis = NULL; - __glXFree(MESAScreens[i].private); - MESAScreens[i].private = NULL; - __glXFree(MESAScreens[i].xm_vis); - MESAScreens[i].xm_vis = NULL; - MESAScreens[i].num_vis = 0; - } - __glDDXScreenInfo.pGlxVisual = NULL; -} - -void __MESA_createBuffer(__GLXdrawablePrivate *glxPriv) -{ - DrawablePtr pDraw = glxPriv->pDraw; - XMesaVisual xm_vis = find_mesa_visual(pDraw->pScreen->myNum, - glxPriv->pGlxVisual->vid); - __GLdrawablePrivate *glPriv = &glxPriv->glPriv; - __MESA_buffer buf; - - buf = (__MESA_buffer)__glXMalloc(sizeof(struct __MESA_bufferRec)); - - /* Create Mesa's buffers */ - if (glxPriv->type == DRAWABLE_WINDOW) { - buf->xm_buf = (void *)XMesaCreateWindowBuffer(xm_vis, - (WindowPtr)pDraw); - } else { - buf->xm_buf = (void *)XMesaCreatePixmapBuffer(xm_vis, - (PixmapPtr)pDraw, 0); - } - - /* Wrap the front buffer's resize routine */ - buf->fbresize = glPriv->frontBuffer.resize; - glPriv->frontBuffer.resize = __MESA_resizeBuffers; - - /* Wrap the swap buffers routine */ - buf->fbswap = glxPriv->swapBuffers; - glxPriv->swapBuffers = __MESA_swapBuffers; - - /* Save Mesa's private buffer structure */ - glPriv->private = (void *)buf; - glPriv->freePrivate = __MESA_destroyBuffer; -} - -GLboolean __MESA_resizeBuffers(__GLdrawableBuffer *buffer, - GLint x, GLint y, - GLuint width, GLuint height, - __GLdrawablePrivate *glPriv, - GLuint bufferMask) -{ - __MESA_buffer buf = (__MESA_buffer)glPriv->private; - - if (buf->xm_buf) - XMesaResizeBuffers(buf->xm_buf); - - return (*buf->fbresize)(buffer, x, y, width, height, glPriv, bufferMask); -} - -GLboolean __MESA_swapBuffers(__GLXdrawablePrivate *glxPriv) -{ - __MESA_buffer buf = (__MESA_buffer)glxPriv->glPriv.private; - - /* - ** Do not call the wrapped swap buffers routine since Mesa has - ** already done the swap. - */ - XMesaSwapBuffers(buf->xm_buf); - - return GL_TRUE; -} - -void __MESA_destroyBuffer(__GLdrawablePrivate *glPriv) -{ - __MESA_buffer buf = (__MESA_buffer)glPriv->private; - __GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *)glPriv->other; - - /* Destroy Mesa's buffers */ - if (buf->xm_buf) - XMesaDestroyBuffer(buf->xm_buf); - - /* Unwrap these routines */ - glxPriv->swapBuffers = buf->fbswap; - glPriv->frontBuffer.resize = buf->fbresize; - - __glXFree(glPriv->private); - glPriv->private = NULL; -} - -__GLinterface *__MESA_createContext(__GLimports *imports, - __GLcontextModes *modes, - __GLinterface *shareGC) -{ - __GLcontext *gl_ctx = NULL; - __GLcontext *m_share = NULL; - __GLXcontext *glxc = (__GLXcontext *)imports->other; - XMesaVisual xm_vis; - - if (shareGC) - m_share = (__GLcontext *)shareGC; - - xm_vis = find_mesa_visual(glxc->pScreen->myNum, glxc->pGlxVisual->vid); - if (xm_vis) { - XMesaContext xmshare = m_share ? m_share->DriverCtx : 0; - XMesaContext xmctx = XMesaCreateContext(xm_vis, xmshare); - gl_ctx = xmctx ? xmctx->gl_ctx : 0; - } - - if (!gl_ctx) - return NULL; - - gl_ctx->imports = *imports; - gl_ctx->exports.destroyContext = __MESA_destroyContext; - gl_ctx->exports.loseCurrent = __MESA_loseCurrent; - gl_ctx->exports.makeCurrent = __MESA_makeCurrent; - gl_ctx->exports.shareContext = __MESA_shareContext; - gl_ctx->exports.copyContext = __MESA_copyContext; - gl_ctx->exports.forceCurrent = __MESA_forceCurrent; - gl_ctx->exports.notifyResize = __MESA_notifyResize; - gl_ctx->exports.notifyDestroy = __MESA_notifyDestroy; - gl_ctx->exports.notifySwapBuffers = __MESA_notifySwapBuffers; - gl_ctx->exports.dispatchExec = __MESA_dispatchExec; - gl_ctx->exports.beginDispatchOverride = __MESA_beginDispatchOverride; - gl_ctx->exports.endDispatchOverride = __MESA_endDispatchOverride; - - return (__GLinterface *)gl_ctx; -} - -GLboolean __MESA_destroyContext(__GLcontext *gc) -{ - XMesaContext xmesa = (XMesaContext) gc->DriverCtx; - XMesaDestroyContext( xmesa ); - return GL_TRUE; -} - -GLboolean __MESA_loseCurrent(__GLcontext *gc) -{ - XMesaContext xmesa = (XMesaContext) gc->DriverCtx; - __glXLastContext = NULL; - return XMesaLoseCurrent(xmesa); -} - -GLboolean __MESA_makeCurrent(__GLcontext *gc) -{ - __GLdrawablePrivate *drawPriv = gc->imports.getDrawablePrivate( gc ); - __MESA_buffer drawBuf = (__MESA_buffer)drawPriv->private; - __GLdrawablePrivate *readPriv = gc->imports.getReadablePrivate( gc ); - __MESA_buffer readBuf = (__MESA_buffer)readPriv->private; - XMesaContext xmesa = (XMesaContext) gc->DriverCtx; - - return XMesaMakeCurrent2(xmesa, drawBuf->xm_buf, readBuf->xm_buf); -} - -GLboolean __MESA_shareContext(__GLcontext *gc, __GLcontext *gcShare) -{ - /* NOT_DONE */ - /* XXX I don't see where/how this could ever be called */ - ErrorF("__MESA_shareContext\n"); - return GL_FALSE; -} - -GLboolean __MESA_copyContext(__GLcontext *dst, const __GLcontext *src, - GLuint mask) -{ - XMesaContext xm_dst = (XMesaContext) dst->DriverCtx; - const XMesaContext xm_src = (XMesaContext) src->DriverCtx; - _mesa_copy_context(xm_src->gl_ctx, xm_dst->gl_ctx, mask); - return GL_TRUE; -} - -GLboolean __MESA_forceCurrent(__GLcontext *gc) -{ - XMesaContext xmesa = (XMesaContext) gc->DriverCtx; - return XMesaForceCurrent(xmesa); -} - -GLboolean __MESA_notifyResize(__GLcontext *gc) -{ - /* NOT_DONE */ - ErrorF("__MESA_notifyResize\n"); - return GL_FALSE; -} - -void __MESA_notifyDestroy(__GLcontext *gc) -{ - /* NOT_DONE */ - ErrorF("__MESA_notifyDestroy\n"); - return; -} - -void __MESA_notifySwapBuffers(__GLcontext *gc) -{ - _mesa_notifySwapBuffers(gc); -} - -struct __GLdispatchStateRec *__MESA_dispatchExec(__GLcontext *gc) -{ - /* NOT_DONE */ - ErrorF("__MESA_dispatchExec\n"); - return NULL; -} - -void __MESA_beginDispatchOverride(__GLcontext *gc) -{ - /* NOT_DONE */ - ErrorF("__MESA_beginDispatchOverride\n"); - return; -} - -void __MESA_endDispatchOverride(__GLcontext *gc) -{ - /* NOT_DONE */ - ErrorF("__MESA_endDispatchOverride\n"); - return; -} - - -/* - * Server-side GLX uses these functions which are normally defined - * in the OpenGL SI. - */ - -GLint __glEvalComputeK(GLenum target) -{ - switch (target) { - case GL_MAP1_VERTEX_4: - case GL_MAP1_COLOR_4: - case GL_MAP1_TEXTURE_COORD_4: - case GL_MAP2_VERTEX_4: - case GL_MAP2_COLOR_4: - case GL_MAP2_TEXTURE_COORD_4: - return 4; - case GL_MAP1_VERTEX_3: - case GL_MAP1_TEXTURE_COORD_3: - case GL_MAP1_NORMAL: - case GL_MAP2_VERTEX_3: - case GL_MAP2_TEXTURE_COORD_3: - case GL_MAP2_NORMAL: - return 3; - case GL_MAP1_TEXTURE_COORD_2: - case GL_MAP2_TEXTURE_COORD_2: - return 2; - case GL_MAP1_TEXTURE_COORD_1: - case GL_MAP2_TEXTURE_COORD_1: - case GL_MAP1_INDEX: - case GL_MAP2_INDEX: - return 1; - default: - return 0; - } -} - -GLuint __glFloorLog2(GLuint val) -{ - int c = 0; - - while (val > 1) { - c++; - val >>= 1; - } - return c; -} - Index: xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.c diff -u xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.c:1.5 xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.c:removed --- xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.c:1.5 Thu Mar 2 11:07:39 2000 +++ xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.c Wed Mar 16 21:06:14 2005 @@ -1,147 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.c,v 1.5 2000/03/02 16:07:39 martin Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin - * Brian Paul - */ - -#include -#include "pixmapstr.h" -#include "xf86glx_util.h" -#include -#include "GL/xf86glx.h" - -#ifdef ROUNDUP -#undef ROUNDUP -#endif - -#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3)) - -XMesaImage *XMesaCreateImage(int bitsPerPixel, int width, int height, char *data) -{ - XMesaImage *image; - - image = (XMesaImage *)xalloc(sizeof(XMesaImage)); - - if (image) { - image->width = width; - image->height = height; - image->data = data; - /* Always pad to 32 bits */ - image->bytes_per_line = ROUNDUP((bitsPerPixel * width), 32); - image->bits_per_pixel = bitsPerPixel; - } - - return image; -} - -void XMesaDestroyImage(XMesaImage *image) -{ - if (image->data) - free(image->data); - xfree(image); -} - -unsigned long XMesaGetPixel(XMesaImage *image, int x, int y) -{ - CARD8 *row = (CARD8 *)(image->data + y*image->bytes_per_line); - CARD8 *i8; - CARD16 *i16; - CARD32 *i32; - switch (image->bits_per_pixel) { - case 8: - i8 = (CARD8 *)row; - return i8[x]; - break; - case 15: - case 16: - i16 = (CARD16 *)row; - return i16[x]; - break; - case 24: /* WARNING: architecture specific code */ - i8 = (CARD8 *)row; - return (((CARD32)i8[x*3]) | - (((CARD32)i8[x*3+1])<<8) | - (((CARD32)i8[x*3+2])<<16)); - break; - case 32: - i32 = (CARD32 *)row; - return i32[x]; - break; - } - return 0; -} - -#ifndef XMESA_USE_PUTPIXEL_MACRO -void XMesaPutPixel(XMesaImage *image, int x, int y, unsigned long pixel) -{ - CARD8 *row = (CARD8 *)(image->data + y*image->bytes_per_line); - CARD8 *i8; - CARD16 *i16; - CARD32 *i32; - switch (image->bits_per_pixel) { - case 8: - i8 = (CARD8 *)row; - i8[x] = (CARD8)pixel; - break; - case 15: - case 16: - i16 = (CARD16 *)row; - i16[x] = (CARD16)pixel; - break; - case 24: /* WARNING: architecture specific code */ - i8 = (CARD8 *)__row; - i8[x*3] = (CARD8)(p); - i8[x*3+1] = (CARD8)(p>>8); - i8[x*3+2] = (CARD8)(p>>16); - case 32: - i32 = (CARD32 *)row; - i32[x] = (CARD32)pixel; - break; - } -} -#endif - -void XMesaPutImageHelper(ScreenPtr display, - DrawablePtr d, GCPtr gc, - XMesaImage *image, - int src_x, int src_y, - int dest_x, int dest_y, - unsigned int width, unsigned int height) -{ - /* NOT_DONE: Verify that the following works for all depths */ - char *src = (image->data + - src_y * image->bytes_per_line + - ((src_x * image->bits_per_pixel) >> 3)); - - ValidateGC(d, gc); - (*gc->ops->PutImage)(d, gc, d->depth, dest_x, dest_y, width, height, - 0, ZPixmap, src); -} Index: xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h diff -u xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h:1.5 xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h:removed --- xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h:1.5 Thu Aug 10 13:40:29 2000 +++ xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h Wed Mar 16 21:06:14 2005 @@ -1,102 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx_util.h,v 1.5 2000/08/10 17:40:29 dawes Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin - * Brian Paul - */ - -#ifndef _XF86GLX_UTIL_H_ -#define _XF86GLX_UTIL_H_ - -#ifdef __CYGWIN__ -#undef WIN32 -#undef _WIN32 -#endif - -#include -#include -#include -#include "GL/xmesa.h" - -#define XMESA_USE_PUTPIXEL_MACRO - -struct _XMesaImageRec { - int width, height; - char *data; - int bytes_per_line; /* Padded to 32 bits */ - int bits_per_pixel; -}; - -extern XMesaImage *XMesaCreateImage(int bitsPerPixel, int width, int height, - char *data); -extern void XMesaDestroyImage(XMesaImage *image); -extern unsigned long XMesaGetPixel(XMesaImage *image, int x, int y); -#ifdef XMESA_USE_PUTPIXEL_MACRO -#define XMesaPutPixel(__i,__x,__y,__p) \ -{ \ - CARD8 *__row = (CARD8 *)(__i->data + __y*__i->bytes_per_line); \ - CARD8 *__i8; \ - CARD16 *__i16; \ - CARD32 *__i32; \ - switch (__i->bits_per_pixel) { \ - case 8: \ - __i8 = (CARD8 *)__row; \ - __i8[__x] = (CARD8)__p; \ - break; \ - case 15: \ - case 16: \ - __i16 = (CARD16 *)__row; \ - __i16[__x] = (CARD16)__p; \ - break; \ - case 24: /* WARNING: architecture specific code */ \ - __i8 = (CARD8 *)__row; \ - __i8[__x*3] = (CARD8)(__p); \ - __i8[__x*3+1] = (CARD8)(__p>>8); \ - __i8[__x*3+2] = (CARD8)(__p>>16); \ - break; \ - case 32: \ - __i32 = (CARD32 *)__row; \ - __i32[__x] = (CARD32)__p; \ - break; \ - } \ -} -#else -extern void XMesaPutPixel(XMesaImage *image, int x, int y, - unsigned long pixel); -#endif - -extern void XMesaPutImageHelper(ScreenPtr display, - DrawablePtr d, GCPtr gc, - XMesaImage *image, - int src_x, int src_y, - int dest_x, int dest_y, - unsigned int width, unsigned int height); - -#endif /* _XF86GLX_UTIL_H_ */ Index: xc/programs/Xserver/GL/mesa/src/X/xf86glxint.h diff -u xc/programs/Xserver/GL/mesa/src/X/xf86glxint.h:1.5 xc/programs/Xserver/GL/mesa/src/X/xf86glxint.h:removed --- xc/programs/Xserver/GL/mesa/src/X/xf86glxint.h:1.5 Sun Sep 28 16:15:46 2003 +++ xc/programs/Xserver/GL/mesa/src/X/xf86glxint.h Wed Mar 16 21:06:14 2005 @@ -1,120 +0,0 @@ -/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glxint.h,v 1.5 2003/09/28 20:15:46 alanh Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -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, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin - * - */ - -#ifndef _XF86GLXINT_H_ -#define _XF86GLXINT_H_ - -#include -#include -#include - -/* struct __GLcontextRec { */ -/* __GLinterface iface; */ -/* XMesaContext xm_ctx; */ -/* }; */ - -typedef struct __MESA_screenRec __MESA_screen; -struct __MESA_screenRec { - int num_vis; - __GLXvisualConfig *glx_vis; - XMesaVisual *xm_vis; - void **private; -}; - -typedef struct __MESA_bufferRec *__MESA_buffer; -struct __MESA_bufferRec { - XMesaBuffer xm_buf; - GLboolean (*fbresize)(__GLdrawableBuffer *buf, - GLint x, GLint y, GLuint width, GLuint height, - __GLdrawablePrivate *glPriv, GLuint bufferMask); - GLboolean (*fbswap)(__GLXdrawablePrivate *glxPriv); -}; - -extern void __MESA_setVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **privates); -extern Bool __MESA_initVisuals(VisualPtr *visualp, DepthPtr *depthp, - int *nvisualp, int *ndepthp, int *rootDepthp, - VisualID *defaultVisp, unsigned long sizes, - int bitsPerRGB); -extern Bool __MESA_screenProbe(int screen); - -extern void __MESA_resetExtension(void); - -extern void __MESA_createBuffer(__GLXdrawablePrivate *glxPriv); -extern GLboolean __MESA_resizeBuffers(__GLdrawableBuffer *buf, - GLint x, GLint y, - GLuint width, GLuint height, - __GLdrawablePrivate *glPriv, - GLuint bufferMask); -extern GLboolean __MESA_swapBuffers(__GLXdrawablePrivate *glxPriv); -extern void __MESA_destroyBuffer(__GLdrawablePrivate *glPriv); - -extern __GLinterface *__MESA_createContext(__GLimports *imports, - __GLcontextModes *modes, - __GLinterface *shareGC); -extern GLboolean __MESA_destroyContext(__GLcontext *gc); -extern GLboolean __MESA_loseCurrent(__GLcontext *gc); -extern GLboolean __MESA_makeCurrent(__GLcontext *gc); -extern GLboolean __MESA_shareContext(__GLcontext *gc, __GLcontext *gcShare); -extern GLboolean __MESA_copyContext(__GLcontext *dst, const __GLcontext *src, - GLuint mask); -extern GLboolean __MESA_forceCurrent(__GLcontext *gc); - -extern GLboolean __MESA_notifyResize(__GLcontext *gc); -extern void __MESA_notifyDestroy(__GLcontext *gc); -extern void __MESA_notifySwapBuffers(__GLcontext *gc); -extern struct __GLdispatchStateRec *__MESA_dispatchExec(__GLcontext *gc); -extern void __MESA_beginDispatchOverride(__GLcontext *gc); -extern void __MESA_endDispatchOverride(__GLcontext *gc); - -extern GLint __glCallLists_size(GLsizei n, GLenum type); -extern GLint __glEvalComputeK(GLenum target); -extern GLuint __glFloorLog2(GLuint val); -extern GLint __glFogfv_size(GLenum pname); -extern GLint __glFogiv_size(GLenum pname); -extern GLint __glLightModelfv_size(GLenum pname); -extern GLint __glLightModeliv_size(GLenum pname); -extern GLint __glLightfv_size(GLenum pname); -extern GLint __glLightiv_size(GLenum pname); -extern GLint __glMaterialfv_size(GLenum pname); -extern GLint __glMaterialiv_size(GLenum pname); -extern GLint __glTexEnvfv_size(GLenum pname); -extern GLint __glTexEnviv_size(GLenum pname); -extern GLint __glTexGendv_size(GLenum pname); -extern GLint __glTexGenfv_size(GLenum pname); -extern GLint __glTexGeniv_size(GLenum pname); -extern GLint __glTexParameterfv_size(GLenum pname); -extern GLint __glTexParameteriv_size(GLenum pname); - -#endif /* _XF86GLXINT_H_ */ Index: xc/programs/Xserver/GL/mesa/src/X/module/Imakefile diff -u xc/programs/Xserver/GL/mesa/src/X/module/Imakefile:1.1 xc/programs/Xserver/GL/mesa/src/X/module/Imakefile:removed --- xc/programs/Xserver/GL/mesa/src/X/module/Imakefile:1.1 Fri May 31 14:12:38 2002 +++ xc/programs/Xserver/GL/mesa/src/X/module/Imakefile Wed Mar 16 21:06:14 2005 @@ -1,6 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/X/module/Imakefile,v 1.1 2002/05/31 18:12:38 dawes Exp $ - -#define IHaveModules - -#include "../Imakefile" - Index: xc/programs/Xserver/GL/mesa/src/array_cache/Imakefile diff -u xc/programs/Xserver/GL/mesa/src/array_cache/Imakefile:1.8 xc/programs/Xserver/GL/mesa/src/array_cache/Imakefile:removed --- xc/programs/Xserver/GL/mesa/src/array_cache/Imakefile:1.8 Fri Nov 22 17:56:01 2002 +++ xc/programs/Xserver/GL/mesa/src/array_cache/Imakefile Wed Mar 16 21:06:14 2005 @@ -1,54 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/array_cache/Imakefile,v 1.8 2002/11/22 22:56:01 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - -#include - -#define NeedAllMesaSrc -#define NeedToLinkMesaSrc -#define MesaACBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../../lib/GL/mesa/src/array_cache/Imakefile.inc" -#else -#include "../../../../../../../lib/GL/mesa/src/array_cache/Imakefile.inc" -#endif - - SRCS = $(MESA_AC_SRCS) - OBJS = $(MESA_AC_OBJS) - - INCLUDES = -I$(MESASRCDIR)/src \ - -I$(MESASRCDIR)/src/array_cache \ - -I$(MESASRCDIR)/src/math \ - -I$(MESASRCDIR)/include \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ - -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ - -I$(LIBSRC)/GL/include \ - -I$(XF86SRC) -I$(INCLUDESRC) - - DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ - -#ifdef IHaveModules -ModuleObjectRule() -#else -NormalLibraryObjectRule() -#endif - -SubdirLibraryRule($(OBJS)) - -LintLibraryTarget(dri,$(SRCS)) -NormalLintTarget($(SRCS)) - -DependTarget() - -#ifdef IHaveSubdirs -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -#endif - Index: xc/programs/Xserver/GL/mesa/src/array_cache/module/Imakefile diff -u xc/programs/Xserver/GL/mesa/src/array_cache/module/Imakefile:1.1 xc/programs/Xserver/GL/mesa/src/array_cache/module/Imakefile:removed --- xc/programs/Xserver/GL/mesa/src/array_cache/module/Imakefile:1.1 Fri May 31 14:12:39 2002 +++ xc/programs/Xserver/GL/mesa/src/array_cache/module/Imakefile Wed Mar 16 21:06:15 2005 @@ -1,6 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/array_cache/module/Imakefile,v 1.1 2002/05/31 18:12:39 dawes Exp $ - -#define IHaveModules - -#include "../Imakefile" - Index: xc/programs/Xserver/GL/mesa/src/math/Imakefile diff -u xc/programs/Xserver/GL/mesa/src/math/Imakefile:1.8 xc/programs/Xserver/GL/mesa/src/math/Imakefile:removed --- xc/programs/Xserver/GL/mesa/src/math/Imakefile:1.8 Fri Nov 22 17:56:01 2002 +++ xc/programs/Xserver/GL/mesa/src/math/Imakefile Wed Mar 16 21:06:15 2005 @@ -1,53 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/math/Imakefile,v 1.8 2002/11/22 22:56:01 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - -#include - -#define NeedAllMesaSrc -#define NeedToLinkMesaSrc -#define MesaMathBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../../lib/GL/mesa/src/math/Imakefile.inc" -#else -#include "../../../../../../../lib/GL/mesa/src/math/Imakefile.inc" -#endif - - SRCS = $(MESA_MATH_SRCS) - OBJS = $(MESA_MATH_OBJS) - - INCLUDES = -I$(MESASRCDIR)/src \ - -I$(MESASRCDIR)/src/math \ - -I$(MESASRCDIR)/include \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ - -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ - -I$(LIBSRC)/GL/include \ - -I$(XF86SRC) -I$(INCLUDESRC) - - DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ - -#ifdef IHaveModules -ModuleObjectRule() -#else -NormalLibraryObjectRule() -#endif - -SubdirLibraryRule($(OBJS)) - -LintLibraryTarget(dri,$(SRCS)) -NormalLintTarget($(SRCS)) - -DependTarget() - -#ifdef IHaveSubdirs -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -#endif - Index: xc/programs/Xserver/GL/mesa/src/math/module/Imakefile diff -u xc/programs/Xserver/GL/mesa/src/math/module/Imakefile:1.1 xc/programs/Xserver/GL/mesa/src/math/module/Imakefile:removed --- xc/programs/Xserver/GL/mesa/src/math/module/Imakefile:1.1 Fri May 31 14:12:40 2002 +++ xc/programs/Xserver/GL/mesa/src/math/module/Imakefile Wed Mar 16 21:06:15 2005 @@ -1,6 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/math/module/Imakefile,v 1.1 2002/05/31 18:12:40 dawes Exp $ - -#define IHaveModules - -#include "../Imakefile" - Index: xc/programs/Xserver/GL/mesa/src/module/Imakefile diff -u xc/programs/Xserver/GL/mesa/src/module/Imakefile:1.1 xc/programs/Xserver/GL/mesa/src/module/Imakefile:removed --- xc/programs/Xserver/GL/mesa/src/module/Imakefile:1.1 Fri May 31 14:12:40 2002 +++ xc/programs/Xserver/GL/mesa/src/module/Imakefile Wed Mar 16 21:06:15 2005 @@ -1,6 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/module/Imakefile,v 1.1 2002/05/31 18:12:40 dawes Exp $ - -#define IHaveModules - -#include "../Imakefile" - Index: xc/programs/Xserver/GL/mesa/src/swrast/Imakefile diff -u xc/programs/Xserver/GL/mesa/src/swrast/Imakefile:1.8 xc/programs/Xserver/GL/mesa/src/swrast/Imakefile:removed --- xc/programs/Xserver/GL/mesa/src/swrast/Imakefile:1.8 Fri Nov 22 17:56:01 2002 +++ xc/programs/Xserver/GL/mesa/src/swrast/Imakefile Wed Mar 16 21:06:15 2005 @@ -1,55 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/swrast/Imakefile,v 1.8 2002/11/22 22:56:01 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - -#include - -#define NeedAllMesaSrc -#define NeedToLinkMesaSrc -#define MesaSwrastBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../../lib/GL/mesa/src/swrast/Imakefile.inc" -#else -#include "../../../../../../../lib/GL/mesa/src/swrast/Imakefile.inc" -#endif - - - SRCS = $(MESA_SWRAST_SRCS) - OBJS = $(MESA_SWRAST_OBJS) - - INCLUDES = -I$(MESASRCDIR)/src \ - -I$(MESASRCDIR)/src/swrast \ - -I$(MESASRCDIR)/src/swrast_setup \ - -I$(MESASRCDIR)/include \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ - -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ - -I$(LIBSRC)/GL/include \ - -I$(XF86SRC) -I$(INCLUDESRC) - - DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ - -#ifdef IHaveModules -ModuleObjectRule() -#else -NormalLibraryObjectRule() -#endif - -SubdirLibraryRule($(OBJS)) - -LintLibraryTarget(dri,$(SRCS)) -NormalLintTarget($(SRCS)) - -DependTarget() - -#ifdef IHaveSubdirs -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -#endif - Index: xc/programs/Xserver/GL/mesa/src/swrast/module/Imakefile diff -u xc/programs/Xserver/GL/mesa/src/swrast/module/Imakefile:1.1 xc/programs/Xserver/GL/mesa/src/swrast/module/Imakefile:removed --- xc/programs/Xserver/GL/mesa/src/swrast/module/Imakefile:1.1 Fri May 31 14:12:40 2002 +++ xc/programs/Xserver/GL/mesa/src/swrast/module/Imakefile Wed Mar 16 21:06:15 2005 @@ -1,6 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/swrast/module/Imakefile,v 1.1 2002/05/31 18:12:40 dawes Exp $ - -#define IHaveModules - -#include "../Imakefile" - Index: xc/programs/Xserver/GL/mesa/src/swrast_setup/Imakefile diff -u xc/programs/Xserver/GL/mesa/src/swrast_setup/Imakefile:1.8 xc/programs/Xserver/GL/mesa/src/swrast_setup/Imakefile:removed --- xc/programs/Xserver/GL/mesa/src/swrast_setup/Imakefile:1.8 Fri Nov 22 17:56:01 2002 +++ xc/programs/Xserver/GL/mesa/src/swrast_setup/Imakefile Wed Mar 16 21:06:15 2005 @@ -1,53 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/swrast_setup/Imakefile,v 1.8 2002/11/22 22:56:01 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - -#include - -#define NeedAllMesaSrc -#define NeedToLinkMesaSrc -#define MesaSwrastSetupBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../../lib/GL/mesa/src/swrast_setup/Imakefile.inc" -#else -#include "../../../../../../../lib/GL/mesa/src/swrast_setup/Imakefile.inc" -#endif - - SRCS = $(MESA_SWR_SETUP_SRCS) - OBJS = $(MESA_SWR_SETUP_OBJS) - - INCLUDES = -I$(MESASRCDIR)/src \ - -I$(MESASRCDIR)/src/swrast_setup \ - -I$(MESASRCDIR)/include \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ - -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ - -I$(LIBSRC)/GL/include \ - -I$(XF86SRC) -I$(INCLUDESRC) - - DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ - -#ifdef IHaveModules -ModuleObjectRule() -#else -NormalLibraryObjectRule() -#endif - -SubdirLibraryRule($(OBJS)) - -LintLibraryTarget(dri,$(SRCS)) -NormalLintTarget($(SRCS)) - -DependTarget() - -#ifdef IHaveSubdirs -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -#endif - Index: xc/programs/Xserver/GL/mesa/src/swrast_setup/module/Imakefile diff -u xc/programs/Xserver/GL/mesa/src/swrast_setup/module/Imakefile:1.1 xc/programs/Xserver/GL/mesa/src/swrast_setup/module/Imakefile:removed --- xc/programs/Xserver/GL/mesa/src/swrast_setup/module/Imakefile:1.1 Fri May 31 14:12:41 2002 +++ xc/programs/Xserver/GL/mesa/src/swrast_setup/module/Imakefile Wed Mar 16 21:06:15 2005 @@ -1,6 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/swrast_setup/module/Imakefile,v 1.1 2002/05/31 18:12:41 dawes Exp $ - -#define IHaveModules - -#include "../Imakefile" - Index: xc/programs/Xserver/GL/mesa/src/tnl/Imakefile diff -u xc/programs/Xserver/GL/mesa/src/tnl/Imakefile:1.8 xc/programs/Xserver/GL/mesa/src/tnl/Imakefile:removed --- xc/programs/Xserver/GL/mesa/src/tnl/Imakefile:1.8 Fri Nov 22 17:56:02 2002 +++ xc/programs/Xserver/GL/mesa/src/tnl/Imakefile Wed Mar 16 21:06:16 2005 @@ -1,56 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/tnl/Imakefile,v 1.8 2002/11/22 22:56:02 tsi Exp $ - -#if DoLoadableServer -#if !BuildModuleInSubdir -#define IHaveModules -#elif !defined(IHaveModules) -#define IHaveSubdirs -SUBDIRS = module -#endif -#endif - -#include - -#define NeedAllMesaSrc -#define NeedToLinkMesaSrc -#define MesaTnlBuildDir /**/ -#if !defined(IHaveModules) || !BuildModuleInSubdir -#include "../../../../../../lib/GL/mesa/src/tnl/Imakefile.inc" -#else -#include "../../../../../../../lib/GL/mesa/src/tnl/Imakefile.inc" -#endif - - - SRCS = $(MESA_TNL_SRCS) - OBJS = $(MESA_TNL_OBJS) - - INCLUDES = -I$(MESASRCDIR)/src \ - -I$(MESASRCDIR)/src/array_cache \ - -I$(MESASRCDIR)/src/math \ - -I$(MESASRCDIR)/src/tnl \ - -I$(MESASRCDIR)/include \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ - -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ - -I$(LIBSRC)/GL/include \ - -I$(XF86SRC) -I$(INCLUDESRC) - - DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ - -#ifdef IHaveModules -ModuleObjectRule() -#else -NormalLibraryObjectRule() -#endif - -SubdirLibraryRule($(OBJS)) - -LintLibraryTarget(dri,$(SRCS)) -NormalLintTarget($(SRCS)) - -DependTarget() - -#ifdef IHaveSubdirs -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -#endif - Index: xc/programs/Xserver/GL/mesa/src/tnl/module/Imakefile diff -u xc/programs/Xserver/GL/mesa/src/tnl/module/Imakefile:1.1 xc/programs/Xserver/GL/mesa/src/tnl/module/Imakefile:removed --- xc/programs/Xserver/GL/mesa/src/tnl/module/Imakefile:1.1 Fri May 31 14:12:42 2002 +++ xc/programs/Xserver/GL/mesa/src/tnl/module/Imakefile Wed Mar 16 21:06:16 2005 @@ -1,6 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/tnl/module/Imakefile,v 1.1 2002/05/31 18:12:42 dawes Exp $ - -#define IHaveModules - -#include "../Imakefile" - Index: xc/programs/Xserver/GL/mesa/swrast/Imakefile diff -u /dev/null xc/programs/Xserver/GL/mesa/swrast/Imakefile:1.2 --- /dev/null Wed Mar 16 21:06:16 2005 +++ xc/programs/Xserver/GL/mesa/swrast/Imakefile Fri Dec 10 11:07:00 2004 @@ -0,0 +1,58 @@ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/swrast/Imakefile,v 1.2 2004/12/10 16:07:00 alanh Exp $ + +#if DoLoadableServer +#if !BuildModuleInSubdir +#define IHaveModules +#elif !defined(IHaveModules) +#define IHaveSubdirs +SUBDIRS = module +#endif +#endif + +#include + +#define NeedAllMesaSrc +#define NeedToLinkMesaSrc +#define MesaSwrastBuildDir /**/ +#if !defined(IHaveModules) || !BuildModuleInSubdir +#include "../../../../../lib/GL/mesa/swrast/Imakefile.inc" +#else +#include "../../../../../../lib/GL/mesa/swrast/Imakefile.inc" +#endif + + + SRCS = $(MESA_SWRAST_SRCS) + OBJS = $(MESA_SWRAST_OBJS) + + INCLUDES = -I$(MESASRCDIR)/src/mesa \ + -I$(MESASRCDIR)/src/mesa/main \ + -I$(MESASRCDIR)/src/mesa/glapi \ + -I$(MESASRCDIR)/src/mesa/shader \ + -I$(MESASRCDIR)/src/mesa/swrast \ + -I$(MESASRCDIR)/src/mesa/swrast_setup \ + -I$(MESASRCDIR)/include \ + -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ + -I$(LIBSRC)/GL/include \ + -I$(XF86SRC) -I$(INCLUDESRC) + + DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ + +#ifdef IHaveModules +ModuleObjectRule() +#else +NormalLibraryObjectRule() +#endif + +SubdirLibraryRule($(OBJS)) + +LintLibraryTarget(dri,$(SRCS)) +NormalLintTarget($(SRCS)) + +DependTarget() + +#ifdef IHaveSubdirs +MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) +#endif + Index: xc/programs/Xserver/GL/mesa/swrast/module/Imakefile diff -u /dev/null xc/programs/Xserver/GL/mesa/swrast/module/Imakefile:1.1 --- /dev/null Wed Mar 16 21:06:16 2005 +++ xc/programs/Xserver/GL/mesa/swrast/module/Imakefile Thu Apr 8 06:08:02 2004 @@ -0,0 +1,6 @@ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/swrast/module/Imakefile,v 1.1 2004/04/08 10:08:02 alanh Exp $ + +#define IHaveModules + +#include "../Imakefile" + Index: xc/programs/Xserver/GL/mesa/swrast_setup/Imakefile diff -u /dev/null xc/programs/Xserver/GL/mesa/swrast_setup/Imakefile:1.1 --- /dev/null Wed Mar 16 21:06:16 2005 +++ xc/programs/Xserver/GL/mesa/swrast_setup/Imakefile Thu Apr 8 06:08:02 2004 @@ -0,0 +1,55 @@ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/swrast_setup/Imakefile,v 1.1 2004/04/08 10:08:02 alanh Exp $ + +#if DoLoadableServer +#if !BuildModuleInSubdir +#define IHaveModules +#elif !defined(IHaveModules) +#define IHaveSubdirs +SUBDIRS = module +#endif +#endif + +#include + +#define NeedAllMesaSrc +#define NeedToLinkMesaSrc +#define MesaSwrastSetupBuildDir /**/ +#if !defined(IHaveModules) || !BuildModuleInSubdir +#include "../../../../../lib/GL/mesa/swrast_setup/Imakefile.inc" +#else +#include "../../../../../../lib/GL/mesa/swrast_setup/Imakefile.inc" +#endif + + SRCS = $(MESA_SWR_SETUP_SRCS) + OBJS = $(MESA_SWR_SETUP_OBJS) + + INCLUDES = -I$(MESASRCDIR)/src/mesa \ + -I$(MESASRCDIR)/src/mesa/main \ + -I$(MESASRCDIR)/src/mesa/glapi \ + -I$(MESASRCDIR)/src/mesa/swrast_setup \ + -I$(MESASRCDIR)/include \ + -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ + -I$(LIBSRC)/GL/include \ + -I$(XF86SRC) -I$(INCLUDESRC) + + DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ + +#ifdef IHaveModules +ModuleObjectRule() +#else +NormalLibraryObjectRule() +#endif + +SubdirLibraryRule($(OBJS)) + +LintLibraryTarget(dri,$(SRCS)) +NormalLintTarget($(SRCS)) + +DependTarget() + +#ifdef IHaveSubdirs +MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) +#endif + Index: xc/programs/Xserver/GL/mesa/swrast_setup/module/Imakefile diff -u /dev/null xc/programs/Xserver/GL/mesa/swrast_setup/module/Imakefile:1.1 --- /dev/null Wed Mar 16 21:06:16 2005 +++ xc/programs/Xserver/GL/mesa/swrast_setup/module/Imakefile Thu Apr 8 06:08:02 2004 @@ -0,0 +1,6 @@ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/swrast_setup/module/Imakefile,v 1.1 2004/04/08 10:08:02 alanh Exp $ + +#define IHaveModules + +#include "../Imakefile" + Index: xc/programs/Xserver/GL/mesa/tnl/Imakefile diff -u /dev/null xc/programs/Xserver/GL/mesa/tnl/Imakefile:1.3 --- /dev/null Wed Mar 16 21:06:16 2005 +++ xc/programs/Xserver/GL/mesa/tnl/Imakefile Mon Feb 7 11:01:47 2005 @@ -0,0 +1,60 @@ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/tnl/Imakefile,v 1.3 2005/02/07 16:01:47 tsi Exp $ + +#if DoLoadableServer +#if !BuildModuleInSubdir +#define IHaveModules +#elif !defined(IHaveModules) +#define IHaveSubdirs +SUBDIRS = module +#endif +#endif + +#include + +#define NeedAllMesaSrc +#define NeedToLinkMesaSrc +#define MesaTnlBuildDir /**/ +#if !defined(IHaveModules) || !BuildModuleInSubdir +#include "../../../../../lib/GL/mesa/tnl/Imakefile.inc" +#else +#include "../../../../../../lib/GL/mesa/tnl/Imakefile.inc" +#endif + + + SRCS = $(MESA_TNL_SRCS) + OBJS = $(MESA_TNL_OBJS) + + INCLUDES = -I$(MESASRCDIR)/src/mesa \ + -I$(MESASRCDIR)/src/mesa/array_cache \ + -I$(MESASRCDIR)/src/mesa/math \ + -I$(MESASRCDIR)/src/mesa/main \ + -I$(MESASRCDIR)/src/mesa/glapi \ + -I$(MESASRCDIR)/src/mesa/shader \ + -I$(MESASRCDIR)/src/mesa/tnl \ + -I$(MESASRCDIR)/include \ + -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/GL/glx \ + -I$(LIBSRC)/GL/include \ + -I$(XF86SRC) -I$(INCLUDESRC) + + DEFINES = $(GLX_DEFINES) /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ + +#ifdef IHaveModules +ModuleObjectRule() +#else +NormalLibraryObjectRule() +#endif + +NormalAsmObjectRule() +SubdirLibraryRule($(OBJS)) + +LintLibraryTarget(dri,$(SRCS)) +NormalLintTarget($(SRCS)) + +DependTarget() + +#ifdef IHaveSubdirs +MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) +#endif + Index: xc/programs/Xserver/GL/mesa/tnl/module/Imakefile diff -u /dev/null xc/programs/Xserver/GL/mesa/tnl/module/Imakefile:1.1 --- /dev/null Wed Mar 16 21:06:16 2005 +++ xc/programs/Xserver/GL/mesa/tnl/module/Imakefile Thu Apr 8 06:08:02 2004 @@ -0,0 +1,6 @@ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/tnl/module/Imakefile,v 1.1 2004/04/08 10:08:02 alanh Exp $ + +#define IHaveModules + +#include "../Imakefile" + Index: xc/programs/Xserver/XTrap/module/Imakefile diff -u xc/programs/Xserver/XTrap/module/Imakefile:1.3 xc/programs/Xserver/XTrap/module/Imakefile:1.5 --- xc/programs/Xserver/XTrap/module/Imakefile:1.3 Mon Sep 16 21:15:09 2002 +++ xc/programs/Xserver/XTrap/module/Imakefile Mon May 31 20:16:58 2004 @@ -1,4 +1,50 @@ -XCOMM $XFree86: xc/programs/Xserver/XTrap/module/Imakefile,v 1.3 2002/09/17 01:15:09 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/XTrap/module/Imakefile,v 1.5 2004/06/01 00:16:58 dawes Exp $ +/* + * Copyright (c) 1994-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #define IHaveModules #include @@ -16,7 +62,7 @@ LinkSourceFile(xtrapditbl.c,..) ModuleObjectRule() -LibraryModuleTarget(xtrap,$(OBJS)) +LibraryModuleTarget(xtrap,$(OBJS),extensions) InstallLibraryModule(xtrap,$(MODULEDIR),extensions) Index: xc/programs/Xserver/Xext/Imakefile diff -u xc/programs/Xserver/Xext/Imakefile:3.44 xc/programs/Xserver/Xext/Imakefile:3.48 --- xc/programs/Xserver/Xext/Imakefile:3.44 Tue Jul 15 21:38:28 2003 +++ xc/programs/Xserver/Xext/Imakefile Thu Aug 5 16:37:42 2004 @@ -1,17 +1,69 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:47:55 cpqbld Exp $ - - +XCOMM $XFree86: xc/programs/Xserver/Xext/Imakefile,v 3.48 2004/08/05 20:37:42 tsi Exp $ +/* + * Copyright (c) 1994-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ -XCOMM $XFree86: xc/programs/Xserver/Xext/Imakefile,v 3.44 2003/07/16 01:38:28 dawes Exp $ #include #if DoLoadableServer #define IHaveSubdirs -SUBDIRS = extmod +SUBDIRS1 = extmod #endif +#if BuildSeparateTinyDIX && !BuildTinyDIX +#ifndef IHaveSubdirs +#define IHaveSubdirs +#endif +SUBDIRS2 = tiny +#endif + +SUBDIRS = $(SUBDIRS1) $(SUBDIRS2) + #if BuildEVI #ifdef SGIArchitectureNotTog EVISRCS = EVI.c sgiEVI.c @@ -54,7 +106,7 @@ #endif #endif -#if BuildXF86DGA +#if BuildXF86DGA && XF86Server XF86DGASRCS = xf86dga.c xf86dga2.c XF86DGAOBJS = xf86dga.o xf86dga2.o #endif @@ -86,7 +138,12 @@ #if BuildXinerama PNRXSRCS = panoramiX.c panoramiXSwap.c panoramiXprocs.c PNRXOBJS = panoramiX.o panoramiXSwap.o panoramiXprocs.o - PNRXINCLUDES = -I$(FONTINCSRC) -I../mi -I../render + PNRXINCLUDES = -I$(FONTINCSRC) -I$(SERVERSRC)/mi -I$(SERVERSRC)/render +#endif +#if !(BuildSeparateTinyDIX && BuildTinyDIX) && XdmxServer + DMXSRCS = dmx.c + DMXOBJS = dmx.o + DMXINCLUDES = -I$(SERVERSRC)/hw/dmx #endif #if BuildDPMS DPMSSRCS = dpms.c @@ -107,14 +164,14 @@ bigreq.c sync.c $(SCRNSAVSRC) xcmisc.c $(VIDMODESRCS) \ $(XF86MISCSRCS) $(XF86BIGFSRCS) $(XF86DGASRCS) $(SECURITYSRCS) \ $(APPGROUPSRCS) xprint.c $(CUPSRCS) $(PNRXSRCS) $(DPMSSRCS) \ - $(EVISRCS) $(XVSRCS) $(FONTCACHESRCS) $(XRESSRCS) + $(EVISRCS) $(XVSRCS) $(FONTCACHESRCS) $(XRESSRCS) $(DMXSRCS) OBJS = shape.o $(SHMOBJS) $(MULTIBUFOBJ) \ mitmisc.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o \ bigreq.o sync.o $(SCRNSAVOBJ) xcmisc.o $(VIDMODEOBJS) \ $(XF86MISCOBJS) $(XF86BIGFOBJS) $(XF86DGAOBJS) $(SECURITYOBJS) \ $(APPGROUPOBJS) xprint.o $(CUPOBJS) $(PNRXOBJS) $(DPMSOBJS) \ - $(EVIOBJS) $(XVOBJS) $(FONTCACHEOBJS) $(XRESOBJS) + $(EVIOBJS) $(XVOBJS) $(FONTCACHEOBJS) $(XRESOBJS) $(DMXOBJS) SOBJS = $(SHMOBJS) $(APPGROUPOBJS) $(SECURITYOBJS) xprint.o \ xtest.o xtest1di.o xtest1dd.o sleepuntil.o $(PNRXOBJS) \ @@ -124,12 +181,17 @@ /* XXX Check if this can be eliminated */ XF86INCLUDES = -I$(XF86COMSRC) #endif - INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \ + INCLUDES = -I$(SERVERSRC)/Xext -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(EXTINCSRC) \ $(PNRXINCLUDES) $(XF86INCLUDES) -I$(FONTINCSRC) \ - $(FONTCACHEINCLUDES) - LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln + $(FONTCACHEINCLUDES) $(DMXINCLUDES) + LINTLIBS = $(SERVERSRC)/dix/llib-ldix.ln $(SERVERSRC)/os/llib-los.ln + +#if BuildTinyDIX +TINY_DEFINES = TinyDIXDefines +#endif - DEFINES = $(EXT_DEFINES) + DEFINES = $(EXT_DEFINES) $(TINY_DEFINES) NormalLibraryObjectRule() @@ -155,17 +217,22 @@ SpecialCObjectRule(security,$(ICONFIGFILES),$(POLICYFILEDEF)) #endif -LinkConfDirectory(xserver,.,xserver,.) -LinkSourceFile(modinit.h,extmod) +LinkSourceFile(modinit.h,$(SERVERSRC)/Xext/extmod) + +#if !defined(LinkDirectory) + +LinkConfDirectory(xserver,.,xserver,.) #if BuildXCSecurity && InstallSecurityConfig InstallNonExecFile(SecurityPolicy,$(SERVERCONFIGDIR)) #endif +#endif + DependTarget() -#if DoLoadableServer +#ifdef IHaveSubdirs MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif @@ -173,3 +240,39 @@ InstallDriverSDKNonExecFile(dgaproc.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(xvdix.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(xvmcext.h,$(DRIVERSDKINCLUDEDIR)) + +#ifdef LinkDirectory +LinkSourceFile(EVI.c,LinkDirectory) +LinkSourceFile(appgroup.c,LinkDirectory) +LinkSourceFile(bigreq.c,LinkDirectory) +LinkSourceFile(cup.c,LinkDirectory) +LinkSourceFile(dmx.c,LinkDirectory) +LinkSourceFile(dpms.c,LinkDirectory) +LinkSourceFile(dpmsstubs.c,LinkDirectory) +LinkSourceFile(fontcache.c,LinkDirectory) +LinkSourceFile(mbuf.c,LinkDirectory) +LinkSourceFile(mbufbf.c,LinkDirectory) +LinkSourceFile(mbufpx.c,LinkDirectory) +LinkSourceFile(mitmisc.c,LinkDirectory) +LinkSourceFile(panoramiX.c,LinkDirectory) +LinkSourceFile(panoramiXSwap.c,LinkDirectory) +LinkSourceFile(panoramiXprocs.c,LinkDirectory) +LinkSourceFile(sampleEVI.c,LinkDirectory) +LinkSourceFile(saver.c,LinkDirectory) +LinkSourceFile(security.c,LinkDirectory) +LinkSourceFile(shape.c,LinkDirectory) +LinkSourceFile(shm.c,LinkDirectory) +LinkSourceFile(sleepuntil.c,LinkDirectory) +LinkSourceFile(sync.c,LinkDirectory) +LinkSourceFile(xcmisc.c,LinkDirectory) +LinkSourceFile(xf86bigfont.c,LinkDirectory) +LinkSourceFile(xprint.c,LinkDirectory) +LinkSourceFile(xres.c,LinkDirectory) +LinkSourceFile(xtest.c,LinkDirectory) +LinkSourceFile(xtest1dd.c,LinkDirectory) +LinkSourceFile(xtest1di.c,LinkDirectory) +LinkSourceFile(xvdisp.c,LinkDirectory) +LinkSourceFile(xvmain.c,LinkDirectory) +LinkSourceFile(xvmc.c,LinkDirectory) +#endif + Index: xc/programs/Xserver/Xext/appgroup.c diff -u xc/programs/Xserver/Xext/appgroup.c:1.11 xc/programs/Xserver/Xext/appgroup.c:1.12 --- xc/programs/Xserver/Xext/appgroup.c:1.11 Tue Oct 28 18:08:43 2003 +++ xc/programs/Xserver/Xext/appgroup.c Wed Jun 2 18:42:55 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/Xext/appgroup.c,v 1.11 2003/10/28 23:08:43 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/appgroup.c,v 1.12 2004/06/02 22:42:55 dawes Exp $ */ /* Copyright 1996, 1998, 2001 The Open Group @@ -24,7 +24,53 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $Xorg: appgroup.c,v 1.6 2001/02/09 02:04:32 xorgcvs Exp $ */ + +/* + * Copyright (c) 1996-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #define NEED_REPLIES #define NEED_EVENTS @@ -53,6 +99,8 @@ #include "modinit.h" #include "appgroup.h" +#ifdef XAPPGROUP + typedef struct _AppGroupRec { struct _AppGroupRec* next; XID appgroupId; @@ -823,3 +871,5 @@ XagClientStateChange (NULL, NULL, (pointer)&clientinfo); } } + +#endif Index: xc/programs/Xserver/Xext/appgroup.h diff -u xc/programs/Xserver/Xext/appgroup.h:1.1 xc/programs/Xserver/Xext/appgroup.h:1.2 --- xc/programs/Xserver/Xext/appgroup.h:1.1 Tue Jul 15 21:38:28 2003 +++ xc/programs/Xserver/Xext/appgroup.h Fri Jun 25 11:44:42 2004 @@ -1,4 +1,7 @@ -/* $XFree86: xc/programs/Xserver/Xext/appgroup.h,v 1.1 2003/07/16 01:38:28 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/appgroup.h,v 1.2 2004/06/25 15:44:42 tsi Exp $ */ + +#ifndef APPGROUP_H +#define APPGROUP_H 1 void XagClientStateChange( CallbackListPtr* pcbl, @@ -8,3 +11,5 @@ register ClientPtr client); int ProcXagDestroy( register ClientPtr client); + +#endif Index: xc/programs/Xserver/Xext/dgaproc.h diff -u xc/programs/Xserver/Xext/dgaproc.h:1.22 xc/programs/Xserver/Xext/dgaproc.h:1.23 --- xc/programs/Xserver/Xext/dgaproc.h:1.22 Tue Jul 15 21:38:29 2003 +++ xc/programs/Xserver/Xext/dgaproc.h Tue Dec 7 10:59:16 2004 @@ -1,28 +1,32 @@ -/* $XFree86: xc/programs/Xserver/Xext/dgaproc.h,v 1.22 2003/07/16 01:38:29 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/dgaproc.h,v 1.23 2004/12/07 15:59:16 tsi Exp $ */ #ifndef __DGAPROC_H #define __DGAPROC_H -#include "Xproto.h" +#undef _XF86DGA_SERVER_ +#define _XF86DGA_SERVER_ +#include +#include #include "pixmap.h" -#define DGA_CONCURRENT_ACCESS 0x00000001 -#define DGA_FILL_RECT 0x00000002 -#define DGA_BLIT_RECT 0x00000004 -#define DGA_BLIT_RECT_TRANS 0x00000008 -#define DGA_PIXMAP_AVAILABLE 0x00000010 +/* Compatibility #define's */ +#define DGA_CONCURRENT_ACCESS XDGAConcurrentAccess +#define DGA_FILL_RECT XDGASolidFillRect +#define DGA_BLIT_RECT XDGABlitRect +#define DGA_BLIT_RECT_TRANS XDGABlitTransRect +#define DGA_PIXMAP_AVAILABLE XDGAPixmap -#define DGA_INTERLACED 0x00010000 -#define DGA_DOUBLESCAN 0x00020000 +#define DGA_INTERLACED XDGAInterlaced +#define DGA_DOUBLESCAN XDGADoublescan -#define DGA_FLIP_IMMEDIATE 0x00000001 -#define DGA_FLIP_RETRACE 0x00000002 +#define DGA_FLIP_IMMEDIATE XDGAFlipImmediate +#define DGA_FLIP_RETRACE XDGAFlipRetrace + +#define DGA_NEED_ROOT XDGANeedRoot #define DGA_COMPLETED 0x00000000 #define DGA_PENDING 0x00000001 -#define DGA_NEED_ROOT 0x00000001 - typedef struct { int num; /* A unique identifier for the mode (num > 0) */ char *name; /* name of mode given in the XF86Config */ @@ -127,8 +131,10 @@ Bool DGADeliverEvent (ScreenPtr pScreen, xEvent *e); -Bool DGAOpenFramebuffer(int Index, char **name, unsigned char **mem, - int *size, int *offset, int *flags); +#define NEW_DGAOPENFRAMEBUFFER 1 +Bool DGAOpenFramebuffer(int Index, char **name, unsigned int *mem, + unsigned int *size, unsigned int *offset, + unsigned int *flags); void DGACloseFramebuffer(int Index); Bool DGAChangePixmapMode(int Index, int *x, int *y, int mode); int DGACreateColormap(int Index, ClientPtr client, int id, int mode, Index: xc/programs/Xserver/Xext/dmx.c diff -u /dev/null xc/programs/Xserver/Xext/dmx.c:1.4 --- /dev/null Wed Mar 16 21:06:31 2005 +++ xc/programs/Xserver/Xext/dmx.c Fri Jan 28 11:56:43 2005 @@ -0,0 +1,1126 @@ +/* $XFree86: xc/programs/Xserver/Xext/dmx.c,v 1.4 2005/01/28 16:56:43 tsi Exp $ */ +/* + * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * This file implements the server-side part of the DMX protocol. A + * vector of fucntions is provided at extension initialization time, so + * most all of the useful functions in this file are declared static and + * do not appear in the doxygen documentation. + * + * Much of the low-level work is done by functions in #dmxextension.c + * + * Please see the Client-to-Server DMX Extension to the X Protocol + * document for details about the protocol. */ + +#include "X.h" +#include "Xproto.h" +#include "misc.h" +#include "os.h" +#include "dixstruct.h" +#define EXTENSION_PROC_ARGS void * +#include "extnsionst.h" +#include "opaque.h" + +#include "dmxextension.h" +#include "dmxproto.h" + +#define _DMX_SERVER_ +#include "dmxext.h" + +#ifdef PANORAMIX +#include "panoramiX.h" +extern unsigned long XRT_WINDOW; +extern int PanoramiXNumScreens; +#endif + +extern void DMXExtensionInit(void); + +static DISPATCH_PROC(ProcDMXDispatch); +static DISPATCH_PROC(ProcDMXQueryVersion); +static DISPATCH_PROC(ProcDMXSync); +static DISPATCH_PROC(ProcDMXForceWindowCreation); +static DISPATCH_PROC(ProcDMXGetScreenCount); +static DISPATCH_PROC(ProcDMXGetScreenAttributes); +static DISPATCH_PROC(ProcDMXChangeScreensAttributes); +static DISPATCH_PROC(ProcDMXAddScreen); +static DISPATCH_PROC(ProcDMXRemoveScreen); +static DISPATCH_PROC(ProcDMXGetWindowAttributes); +static DISPATCH_PROC(ProcDMXGetDesktopAttributes); +static DISPATCH_PROC(ProcDMXChangeDesktopAttributes); +static DISPATCH_PROC(ProcDMXGetInputCount); +static DISPATCH_PROC(ProcDMXGetInputAttributes); +static DISPATCH_PROC(ProcDMXAddInput); +static DISPATCH_PROC(ProcDMXRemoveInput); + +static DISPATCH_PROC(SProcDMXDispatch); +static DISPATCH_PROC(SProcDMXQueryVersion); +static DISPATCH_PROC(SProcDMXSync); +static DISPATCH_PROC(SProcDMXForceWindowCreation); +static DISPATCH_PROC(SProcDMXGetScreenCount); +static DISPATCH_PROC(SProcDMXGetScreenAttributes); +static DISPATCH_PROC(SProcDMXChangeScreensAttributes); +static DISPATCH_PROC(SProcDMXAddScreen); +static DISPATCH_PROC(SProcDMXRemoveScreen); +static DISPATCH_PROC(SProcDMXGetWindowAttributes); +static DISPATCH_PROC(SProcDMXGetDesktopAttributes); +static DISPATCH_PROC(SProcDMXChangeDesktopAttributes); +static DISPATCH_PROC(SProcDMXGetInputCount); +static DISPATCH_PROC(SProcDMXGetInputAttributes); +static DISPATCH_PROC(SProcDMXAddInput); +static DISPATCH_PROC(SProcDMXRemoveInput); + +static int _DMXXineramaActive(void) +{ +#ifdef PANORAMIX + return !noPanoramiXExtension; +#else + return 0; +#endif +} + +static void DMXResetProc(ExtensionEntry *extEntry) +{ +} + +/** Initialize the extension. */ +void DMXExtensionInit(void) +{ + AddExtension(DMX_EXTENSION_NAME, 0, 0, + ProcDMXDispatch, SProcDMXDispatch, + DMXResetProc, StandardMinorOpcode); +} + +static void dmxSetScreenAttribute(int bit, DMXScreenAttributesPtr attr, + CARD32 value) +{ + switch (1 << bit) { + case DMXScreenWindowWidth: attr->screenWindowWidth = value; break; + case DMXScreenWindowHeight: attr->screenWindowHeight = value; break; + case DMXScreenWindowXoffset: attr->screenWindowXoffset = value; break; + case DMXScreenWindowYoffset: attr->screenWindowYoffset = value; break; + case DMXRootWindowWidth: attr->rootWindowWidth = value; break; + case DMXRootWindowHeight: attr->rootWindowHeight = value; break; + case DMXRootWindowXoffset: attr->rootWindowXoffset = value; break; + case DMXRootWindowYoffset: attr->rootWindowYoffset = value; break; + case DMXRootWindowXorigin: attr->rootWindowXorigin = value; break; + case DMXRootWindowYorigin: attr->rootWindowYorigin = value; break; + } +} + +static int dmxFetchScreenAttributes(unsigned int mask, + DMXScreenAttributesPtr attr, + CARD32 *value_list) +{ + int i; + CARD32 *value = value_list; + int count = 0; + + for (i = 0; i < 32; i++) { + if (mask & (1 << i)) { + dmxSetScreenAttribute(i, attr, *value); + ++value; + ++count; + } + } + return count; +} + +static void dmxSetDesktopAttribute(int bit, DMXDesktopAttributesPtr attr, + CARD32 value) +{ + switch (1 << bit) { + case DMXDesktopWidth: attr->width = value; break; + case DMXDesktopHeight: attr->height = value; break; + case DMXDesktopShiftX: attr->shiftX = value; break; + case DMXDesktopShiftY: attr->shiftY = value; break; + } +} + +static int dmxFetchDesktopAttributes(unsigned int mask, + DMXDesktopAttributesPtr attr, + CARD32 *value_list) +{ + int i; + CARD32 *value = value_list; + int count = 0; + + for (i = 0; i < 32; i++) { + if (mask & (1 << i)) { + dmxSetDesktopAttribute(i, attr, *value); + ++value; + ++count; + } + } + return count; +} + +static void dmxSetInputAttribute(int bit, DMXInputAttributesPtr attr, + CARD32 value) +{ + switch (1 << bit) { + case DMXInputType: attr->inputType = value; break; + case DMXInputPhysicalScreen: attr->physicalScreen = value; break; + case DMXInputSendsCore: attr->sendsCore = !!value; break; + } +} + +static int dmxFetchInputAttributes(unsigned int mask, + DMXInputAttributesPtr attr, + CARD32 *value_list) +{ + int i; + CARD32 *value = value_list; + int count = 0; + + for (i = 0; i < 32; i++) { + if (mask & (1 << i)) { + dmxSetInputAttribute(i, attr, *value); + ++value; + ++count; + } + } + return count; +} + +static int ProcDMXQueryVersion(ClientPtr client) +{ + xDMXQueryVersionReply rep; + int n; + + REQUEST_SIZE_MATCH(xDMXQueryVersionReq); + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.majorVersion = DMX_EXTENSION_MAJOR; + rep.minorVersion = DMX_EXTENSION_MINOR; + rep.patchVersion = DMX_EXTENSION_PATCH; + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.majorVersion, n); + swapl(&rep.minorVersion, n); + swapl(&rep.patchVersion, n); + } + WriteToClient(client, sizeof(xDMXQueryVersionReply), (char *)&rep); + return client->noClientException; +} + +static int ProcDMXSync(ClientPtr client) +{ + xDMXSyncReply rep; + int n; + + REQUEST_SIZE_MATCH(xDMXSyncReq); + + dmxFlushPendingSyncs(); + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.status = 0; + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.status, n); + } + WriteToClient(client, sizeof(xDMXSyncReply), (char *)&rep); + return client->noClientException; +} + +static int ProcDMXForceWindowCreation(ClientPtr client) +{ + xDMXForceWindowCreationReply rep; + REQUEST(xDMXForceWindowCreationReq); + WindowPtr pWin; + int n; + + REQUEST_SIZE_MATCH(xDMXForceWindowCreationReq); + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + PanoramiXRes *win; + int i; + + if (!(win = SecurityLookupIDByType(client, stuff->window, XRT_WINDOW, + SecurityReadAccess))) + return -1; /* BadWindow */ + + FOR_NSCREENS(i) { + if (!(pWin = SecurityLookupWindow(win->info[i].id, client, + SecurityReadAccess))) + return -1; /* BadWindow */ + + dmxForceWindowCreation(pWin); + } + goto doreply; + } +#endif + + if (!(pWin = SecurityLookupWindow(stuff->window, client, + SecurityReadAccess))) + return -1; /* BadWindow */ + + dmxForceWindowCreation(pWin); +#ifdef PANORAMIX + doreply: +#endif + dmxFlushPendingSyncs(); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.status = 0; + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.status, n); + } + return Success; +} + +static int ProcDMXGetScreenCount(ClientPtr client) +{ + xDMXGetScreenCountReply rep; + int n; + + REQUEST_SIZE_MATCH(xDMXGetScreenCountReq); + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.screenCount = dmxGetNumScreens(); + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.screenCount, n); + } + WriteToClient(client, sizeof(xDMXGetScreenCountReply), (char *)&rep); + return client->noClientException; +} + +static int ProcDMXGetScreenAttributes(ClientPtr client) +{ + REQUEST(xDMXGetScreenAttributesReq); + xDMXGetScreenAttributesReply rep; + int n; + int length; + int paddedLength; + DMXScreenAttributesRec attr; + + REQUEST_SIZE_MATCH(xDMXGetScreenAttributesReq); + + if (stuff->physicalScreen >= dmxGetNumScreens()) + return BadValue; + + if (!dmxGetScreenAttributes(stuff->physicalScreen, &attr)) + return BadValue; + + rep.logicalScreen = attr.logicalScreen; + rep.screenWindowWidth = attr.screenWindowWidth; + rep.screenWindowHeight = attr.screenWindowHeight; + rep.screenWindowXoffset = attr.screenWindowXoffset; + rep.screenWindowYoffset = attr.screenWindowYoffset; + rep.rootWindowWidth = attr.rootWindowWidth; + rep.rootWindowHeight = attr.rootWindowHeight; + rep.rootWindowXoffset = attr.rootWindowXoffset; + rep.rootWindowYoffset = attr.rootWindowYoffset; + rep.rootWindowXorigin = attr.rootWindowXorigin; + rep.rootWindowYorigin = attr.rootWindowYorigin; + + length = attr.displayName ? strlen(attr.displayName) : 0; + paddedLength = (length + 3) & ~3; + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = paddedLength >> 2; + rep.displayNameLength = length; + + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.displayNameLength, n); + swapl(&rep.logicalScreen, n); + swaps(&rep.screenWindowWidth, n); + swaps(&rep.screenWindowHeight, n); + swaps(&rep.screenWindowXoffset, n); + swaps(&rep.screenWindowYoffset, n); + swaps(&rep.rootWindowWidth, n); + swaps(&rep.rootWindowHeight, n); + swaps(&rep.rootWindowXoffset, n); + swaps(&rep.rootWindowYoffset, n); + swaps(&rep.rootWindowXorigin, n); + swaps(&rep.rootWindowYorigin, n); + } + WriteToClient(client, sizeof(xDMXGetScreenAttributesReply), (char *)&rep); + if (length) WriteToClient(client, length, (char *)attr.displayName); + return client->noClientException; +} + +static int ProcDMXChangeScreensAttributes(ClientPtr client) +{ + REQUEST(xDMXChangeScreensAttributesReq); + xDMXChangeScreensAttributesReply rep; + int n; + int status = DMX_BAD_XINERAMA; + unsigned int mask = 0; + unsigned int i; + CARD32 *screen_list; + CARD32 *mask_list; + CARD32 *value_list; + DMXScreenAttributesPtr attribs; + int errorScreen = 0; + unsigned int len; + int ones = 0; + + + REQUEST_AT_LEAST_SIZE(xDMXChangeScreensAttributesReq); + len = client->req_len - (sizeof(xDMXChangeScreensAttributesReq) >> 2); + if (len < stuff->screenCount + stuff->maskCount) + return BadLength; + + screen_list = (CARD32 *)(stuff + 1); + mask_list = &screen_list[stuff->screenCount]; + value_list = &mask_list[stuff->maskCount]; + + for (i = 0; i < stuff->maskCount; i++) ones += Ones(mask_list[i]); + if (len != stuff->screenCount + stuff->maskCount + ones) + return BadLength; + + if (!_DMXXineramaActive()) goto noxinerama; + + if (!(attribs = ALLOCATE_LOCAL(stuff->screenCount * sizeof(*attribs)))) + return BadAlloc; + + for (i = 0; i < stuff->screenCount; i++) { + int count; + + if (i < stuff->maskCount) mask = mask_list[i]; + dmxGetScreenAttributes(screen_list[i], &attribs[i]); + count = dmxFetchScreenAttributes(mask, &attribs[i], value_list); + value_list += count; + } + +#ifdef PANORAMIX + status = dmxConfigureScreenWindows(stuff->screenCount, + screen_list, + attribs, + &errorScreen); +#endif + + DEALLOCATE_LOCAL(attribs); + + if (status == BadValue) return status; + + noxinerama: + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.status = status; + rep.errorScreen = errorScreen; + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.status, n); + swapl(&rep.errorScreen, n); + } + WriteToClient(client, + sizeof(xDMXChangeScreensAttributesReply), + (char *)&rep); + return client->noClientException; +} + +static int ProcDMXAddScreen(ClientPtr client) +{ + REQUEST(xDMXAddScreenReq); + xDMXAddScreenReply rep; + int n; + int status = 0; + CARD32 *value_list; + DMXScreenAttributesRec attr; + int count; + char *name; + int len; + int paddedLength; + + REQUEST_AT_LEAST_SIZE(xDMXAddScreenReq); + paddedLength = (stuff->displayNameLength + 3) & ~3; + len = client->req_len - (sizeof(xDMXAddScreenReq) >> 2); + if (len != Ones(stuff->valueMask) + paddedLength/4) + return BadLength; + + memset(&attr, 0, sizeof(attr)); + dmxGetScreenAttributes(stuff->physicalScreen, &attr); + value_list = (CARD32 *)(stuff + 1); + count = dmxFetchScreenAttributes(stuff->valueMask, &attr, value_list); + + if (!(name = ALLOCATE_LOCAL(stuff->displayNameLength + 1 + 4))) + return BadAlloc; + memcpy(name, &value_list[count], stuff->displayNameLength); + name[stuff->displayNameLength] = '\0'; + attr.displayName = name; + + status = dmxAttachScreen(stuff->physicalScreen, &attr); + + DEALLOCATE_LOCAL(name); + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.status = status; + rep.physicalScreen = stuff->physicalScreen; + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.status, n); + swapl(&rep.physicalScreen, n); + } + WriteToClient(client, + sizeof(xDMXAddScreenReply), + (char *)&rep); + return client->noClientException; +} + +static int ProcDMXRemoveScreen(ClientPtr client) +{ + REQUEST(xDMXRemoveScreenReq); + xDMXRemoveScreenReply rep; + int n; + int status = 0; + + REQUEST_SIZE_MATCH(xDMXRemoveScreenReq); + + status = dmxDetachScreen(stuff->physicalScreen); + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.status = status; + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.status, n); + } + WriteToClient(client, + sizeof(xDMXRemoveScreenReply), + (char *)&rep); + return client->noClientException; +} + + +#ifdef PANORAMIX +static int dmxPopulatePanoramiX(ClientPtr client, Window window, + CARD32 *screens, CARD32 *windows, + xRectangle *pos, xRectangle *vis) +{ + WindowPtr pWin; + PanoramiXRes *win; + int i; + int count = 0; + DMXWindowAttributesRec attr; + + if (!(win = SecurityLookupIDByType(client, window, XRT_WINDOW, + SecurityReadAccess))) + return -1; /* BadWindow */ + + FOR_NSCREENS(i) { + if (!(pWin = SecurityLookupWindow(win->info[i].id, client, + SecurityReadAccess))) + return -1; /* BadWindow */ + if (dmxGetWindowAttributes(pWin, &attr)) { + screens[count] = attr.screen; + windows[count] = attr.window; + pos[count] = attr.pos; + vis[count] = attr.vis; + ++count; /* Only count existing windows */ + } + } + return count; +} +#endif + +static int dmxPopulate(ClientPtr client, Window window, CARD32 *screens, + CARD32 *windows, xRectangle *pos, xRectangle *vis) +{ + WindowPtr pWin; + DMXWindowAttributesRec attr; + +#ifdef PANORAMIX + if (!noPanoramiXExtension) + return dmxPopulatePanoramiX(client, window, screens, windows, + pos, vis); +#endif + + if (!(pWin = SecurityLookupWindow(window, client, SecurityReadAccess))) + return -1; /* BadWindow */ + + dmxGetWindowAttributes(pWin, &attr); + *screens = attr.screen; + *windows = attr.window; + *pos = attr.pos; + *vis = attr.vis; + return 1; +} + +static int dmxMaxNumScreens(void) +{ +#ifdef PANORAMIX + if (!noPanoramiXExtension) return PanoramiXNumScreens; +#endif + return 1; +} + +static int ProcDMXGetWindowAttributes(ClientPtr client) +{ + REQUEST(xDMXGetWindowAttributesReq); + xDMXGetWindowAttributesReply rep; + int i, n; + CARD32 *screens; + CARD32 *windows; + xRectangle *pos, *vis; + int count = dmxMaxNumScreens(); + + REQUEST_SIZE_MATCH(xDMXGetWindowAttributesReq); + + if (!(screens = ALLOCATE_LOCAL(count * sizeof(*screens)))) + return BadAlloc; + if (!(windows = ALLOCATE_LOCAL(count * sizeof(*windows)))) { + DEALLOCATE_LOCAL(screens); + return BadAlloc; + } + if (!(pos = ALLOCATE_LOCAL(count * sizeof(*pos)))) { + DEALLOCATE_LOCAL(windows); + DEALLOCATE_LOCAL(screens); + return BadAlloc; + } + if (!(vis = ALLOCATE_LOCAL(count * sizeof(*vis)))) { + DEALLOCATE_LOCAL(pos); + DEALLOCATE_LOCAL(windows); + DEALLOCATE_LOCAL(screens); + return BadAlloc; + } + + if ((count = dmxPopulate(client, stuff->window, screens, windows, + pos, vis)) < 0) { + DEALLOCATE_LOCAL(vis); + DEALLOCATE_LOCAL(pos); + DEALLOCATE_LOCAL(windows); + DEALLOCATE_LOCAL(screens); + return BadWindow; + } + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = count * 6; + rep.screenCount = count; + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.screenCount, n); + for (i = 0; i < count; i++) { + swapl(&screens[i], n); + swapl(&windows[i], n); + + swaps(&pos[i].x, n); + swaps(&pos[i].y, n); + swaps(&pos[i].width, n); + swaps(&pos[i].height, n); + + swaps(&vis[i].x, n); + swaps(&vis[i].y, n); + swaps(&vis[i].width, n); + swaps(&vis[i].height, n); + } + } + + dmxFlushPendingSyncs(); + + WriteToClient(client, sizeof(xDMXGetWindowAttributesReply), (char *)&rep); + if (count) { + WriteToClient(client, count * sizeof(*screens), (char *)screens); + WriteToClient(client, count * sizeof(*windows), (char *)windows); + WriteToClient(client, count * sizeof(*pos), (char *)pos); + WriteToClient(client, count * sizeof(*vis), (char *)vis); + } + + DEALLOCATE_LOCAL(vis); + DEALLOCATE_LOCAL(pos); + DEALLOCATE_LOCAL(windows); + DEALLOCATE_LOCAL(screens); + + return client->noClientException; +} + +static int ProcDMXGetDesktopAttributes(ClientPtr client) +{ + xDMXGetDesktopAttributesReply rep; + int n; + DMXDesktopAttributesRec attr; + + REQUEST_SIZE_MATCH(xDMXGetDesktopAttributesReq); + + dmxGetDesktopAttributes(&attr); + + rep.width = attr.width; + rep.height = attr.height; + rep.shiftX = attr.shiftX; + rep.shiftY = attr.shiftY; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.width, n); + swapl(&rep.height, n); + swapl(&rep.shiftX, n); + swapl(&rep.shiftY, n); + } + WriteToClient(client, sizeof(xDMXGetDesktopAttributesReply), (char *)&rep); + return client->noClientException; +} + +static int ProcDMXChangeDesktopAttributes(ClientPtr client) +{ + REQUEST(xDMXChangeDesktopAttributesReq); + xDMXChangeDesktopAttributesReply rep; + int n; + int status = DMX_BAD_XINERAMA; + CARD32 *value_list; + DMXDesktopAttributesRec attr; + int len; + + REQUEST_AT_LEAST_SIZE(xDMXChangeDesktopAttributesReq); + len = client->req_len - (sizeof(xDMXChangeDesktopAttributesReq) >> 2); + if (len != Ones(stuff->valueMask)) + return BadLength; + + if (!_DMXXineramaActive()) goto noxinerama; + + value_list = (CARD32 *)(stuff + 1); + + dmxGetDesktopAttributes(&attr); + dmxFetchDesktopAttributes(stuff->valueMask, &attr, value_list); + +#ifdef PANORAMIX + status = dmxConfigureDesktop(&attr); +#endif + if (status == BadValue) return status; + + noxinerama: + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.status = status; + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.status, n); + } + WriteToClient(client, + sizeof(xDMXChangeDesktopAttributesReply), + (char *)&rep); + return client->noClientException; +} + +static int ProcDMXGetInputCount(ClientPtr client) +{ + xDMXGetInputCountReply rep; + int n; + + REQUEST_SIZE_MATCH(xDMXGetInputCountReq); + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.inputCount = dmxGetInputCount(); + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.inputCount, n); + } + WriteToClient(client, sizeof(xDMXGetInputCountReply), (char *)&rep); + return client->noClientException; +} + +static int ProcDMXGetInputAttributes(ClientPtr client) +{ + REQUEST(xDMXGetInputAttributesReq); + xDMXGetInputAttributesReply rep; + int n; + int length; + int paddedLength; + DMXInputAttributesRec attr; + + REQUEST_SIZE_MATCH(xDMXGetInputAttributesReq); + + if (dmxGetInputAttributes(stuff->deviceId, &attr)) return BadValue; + rep.inputType = attr.inputType; + rep.physicalScreen = attr.physicalScreen; + rep.physicalId = attr.physicalId; + rep.isCore = attr.isCore; + rep.sendsCore = attr.sendsCore; + rep.detached = attr.detached; + + length = attr.name ? strlen(attr.name) : 0; + paddedLength = (length + 3) & ~3; + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = paddedLength >> 2; + rep.nameLength = length; + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.inputType, n); + swapl(&rep.physicalScreen, n); + swapl(&rep.physicalId, n); + swapl(&rep.nameLength, n); + } + WriteToClient(client, sizeof(xDMXGetInputAttributesReply), (char *)&rep); + if (length) WriteToClient(client, length, (char *)attr.name); + return client->noClientException; +} + +static int ProcDMXAddInput(ClientPtr client) +{ + REQUEST(xDMXAddInputReq); + xDMXAddInputReply rep; + int n; + int status = 0; + CARD32 *value_list; + DMXInputAttributesRec attr; + int count; + char *name; + int len; + int paddedLength; + int id = -1; + + REQUEST_AT_LEAST_SIZE(xDMXAddInputReq); + paddedLength = (stuff->displayNameLength + 3) & ~3; + len = client->req_len - (sizeof(xDMXAddInputReq) >> 2); + if (len != Ones(stuff->valueMask) + paddedLength/4) + return BadLength; + + memset(&attr, 0, sizeof(attr)); + value_list = (CARD32 *)(stuff + 1); + count = dmxFetchInputAttributes(stuff->valueMask, &attr, value_list); + + if (!(name = ALLOCATE_LOCAL(stuff->displayNameLength + 1 + 4))) + return BadAlloc; + memcpy(name, &value_list[count], stuff->displayNameLength); + name[stuff->displayNameLength] = '\0'; + attr.name = name; + + status = dmxAddInput(&attr, &id); + + DEALLOCATE_LOCAL(name); + + if (status) return status; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.status = status; + rep.physicalId = id; + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.status, n); + swapl(&rep.physicalId, n); + } + WriteToClient(client, sizeof(xDMXAddInputReply), (char *)&rep); + return client->noClientException; +} + +static int ProcDMXRemoveInput(ClientPtr client) +{ + REQUEST(xDMXRemoveInputReq); + xDMXRemoveInputReply rep; + int n; + int status = 0; + + REQUEST_SIZE_MATCH(xDMXRemoveInputReq); + + status = dmxRemoveInput(stuff->physicalId); + + if (status) return status; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.status = status; + if (client->swapped) { + swaps(&rep.sequenceNumber, n); + swapl(&rep.length, n); + swapl(&rep.status, n); + } + WriteToClient(client, sizeof(xDMXRemoveInputReply), (char *)&rep); + return client->noClientException; +} + +static int ProcDMXDispatch(ClientPtr client) +{ + REQUEST(xReq); + + switch (stuff->data) { + case X_DMXQueryVersion: return ProcDMXQueryVersion(client); + case X_DMXSync: return ProcDMXSync(client); + case X_DMXForceWindowCreation: return ProcDMXForceWindowCreation(client); + case X_DMXGetScreenCount: return ProcDMXGetScreenCount(client); + case X_DMXGetScreenAttributes: return ProcDMXGetScreenAttributes(client); + case X_DMXChangeScreensAttributes: + return ProcDMXChangeScreensAttributes(client); + case X_DMXAddScreen: return ProcDMXAddScreen(client); + case X_DMXRemoveScreen: return ProcDMXRemoveScreen(client); + case X_DMXGetWindowAttributes: return ProcDMXGetWindowAttributes(client); + case X_DMXGetDesktopAttributes: return ProcDMXGetDesktopAttributes(client); + case X_DMXChangeDesktopAttributes: + return ProcDMXChangeDesktopAttributes(client); + case X_DMXGetInputCount: return ProcDMXGetInputCount(client); + case X_DMXGetInputAttributes: return ProcDMXGetInputAttributes(client); + case X_DMXAddInput: return ProcDMXAddInput(client); + case X_DMXRemoveInput: return ProcDMXRemoveInput(client); + + case X_DMXGetScreenInformationDEPRECATED: + case X_DMXForceWindowCreationDEPRECATED: + case X_DMXReconfigureScreenDEPRECATED: + return BadImplementation; + + default: return BadRequest; + } +} + +static int SProcDMXQueryVersion(ClientPtr client) +{ + int n; + REQUEST(xDMXQueryVersionReq); + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH(xDMXQueryVersionReq); + return ProcDMXQueryVersion(client); +} + +static int SProcDMXSync(ClientPtr client) +{ + int n; + REQUEST(xDMXSyncReq); + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH(xDMXSyncReq); + return ProcDMXSync(client); +} + +static int SProcDMXForceWindowCreation(ClientPtr client) +{ + int n; + REQUEST(xDMXForceWindowCreationReq); + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH(xDMXForceWindowCreationReq); + swaps(&stuff->window, n); + return ProcDMXForceWindowCreation(client); +} + +static int SProcDMXGetScreenCount(ClientPtr client) +{ + int n; + REQUEST(xDMXGetScreenCountReq); + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH(xDMXGetScreenCountReq); + return ProcDMXGetScreenCount(client); +} + +static int SProcDMXGetScreenAttributes(ClientPtr client) +{ + int n; + REQUEST(xDMXGetScreenAttributesReq); + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH(xDMXGetScreenAttributesReq); + swapl(&stuff->physicalScreen, n); + return ProcDMXGetScreenAttributes(client); +} + +static int SProcDMXChangeScreensAttributes(ClientPtr client) +{ + int n; + REQUEST(xDMXChangeScreensAttributesReq); + + swaps(&stuff->length, n); + REQUEST_AT_LEAST_SIZE(xDMXGetScreenAttributesReq); + swapl(&stuff->screenCount, n); + swapl(&stuff->maskCount, n); + SwapRestL(stuff); + return ProcDMXGetScreenAttributes(client); +} + +static int SProcDMXAddScreen(ClientPtr client) +{ + int n; + int paddedLength; + REQUEST(xDMXAddScreenReq); + + swaps(&stuff->length, n); + REQUEST_AT_LEAST_SIZE(xDMXAddScreenReq); + swapl(&stuff->displayNameLength, n); + swapl(&stuff->valueMask, n); + paddedLength = (stuff->displayNameLength + 3) & ~3; + SwapLongs((CARD32 *)(stuff+1), LengthRestL(stuff) - paddedLength/4); + return ProcDMXAddScreen(client); +} + +static int SProcDMXRemoveScreen(ClientPtr client) +{ + int n; + REQUEST(xDMXRemoveScreenReq); + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH(xDMXRemoveScreenReq); + swapl(&stuff->physicalScreen, n); + return ProcDMXRemoveScreen(client); +} + +static int SProcDMXGetWindowAttributes(ClientPtr client) +{ + int n; + REQUEST(xDMXGetWindowAttributesReq); + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH(xDMXGetWindowAttributesReq); + swapl(&stuff->window, n); + return ProcDMXGetWindowAttributes(client); +} + +static int SProcDMXGetDesktopAttributes(ClientPtr client) +{ + int n; + REQUEST(xDMXGetDesktopAttributesReq); + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH(xDMXGetDesktopAttributesReq); + return ProcDMXGetDesktopAttributes(client); +} + +static int SProcDMXChangeDesktopAttributes(ClientPtr client) +{ + int n; + REQUEST(xDMXChangeDesktopAttributesReq); + + swaps(&stuff->length, n); + REQUEST_AT_LEAST_SIZE(xDMXChangeDesktopAttributesReq); + swapl(&stuff->valueMask, n); + SwapRestL(stuff); + return ProcDMXChangeDesktopAttributes(client); +} + +static int SProcDMXGetInputCount(ClientPtr client) +{ + int n; + REQUEST(xDMXGetInputCountReq); + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH(xDMXGetInputCountReq); + return ProcDMXGetInputCount(client); +} + +static int SProcDMXGetInputAttributes(ClientPtr client) +{ + int n; + REQUEST(xDMXGetInputAttributesReq); + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH(xDMXGetInputAttributesReq); + swapl(&stuff->deviceId, n); + return ProcDMXGetInputAttributes(client); +} + +static int SProcDMXAddInput(ClientPtr client) +{ + int n; + int paddedLength; + REQUEST(xDMXAddInputReq); + + swaps(&stuff->length, n); + REQUEST_AT_LEAST_SIZE(xDMXAddInputReq); + swapl(&stuff->displayNameLength, n); + swapl(&stuff->valueMask, n); + paddedLength = (stuff->displayNameLength + 3) & ~3; + SwapLongs((CARD32 *)(stuff+1), LengthRestL(stuff) - paddedLength/4); + return ProcDMXAddInput(client); +} + +static int SProcDMXRemoveInput(ClientPtr client) +{ + int n; + REQUEST(xDMXRemoveInputReq); + + swaps(&stuff->length, n); + REQUEST_SIZE_MATCH(xDMXRemoveInputReq); + swapl(&stuff->physicalId, n); + return ProcDMXRemoveInput(client); +} + +static int SProcDMXDispatch (ClientPtr client) +{ + REQUEST(xReq); + + switch (stuff->data) { + case X_DMXQueryVersion: return SProcDMXQueryVersion(client); + case X_DMXSync: return SProcDMXSync(client); + case X_DMXForceWindowCreation: return SProcDMXForceWindowCreation(client); + case X_DMXGetScreenCount: return SProcDMXGetScreenCount(client); + case X_DMXGetScreenAttributes: return SProcDMXGetScreenAttributes(client); + case X_DMXChangeScreensAttributes: + return SProcDMXChangeScreensAttributes(client); + case X_DMXAddScreen: return SProcDMXAddScreen(client); + case X_DMXRemoveScreen: return SProcDMXRemoveScreen(client); + case X_DMXGetWindowAttributes: return SProcDMXGetWindowAttributes(client); + case X_DMXGetDesktopAttributes: + return SProcDMXGetDesktopAttributes(client); + case X_DMXChangeDesktopAttributes: + return SProcDMXChangeDesktopAttributes(client); + case X_DMXGetInputCount: return SProcDMXGetInputCount(client); + case X_DMXGetInputAttributes: return SProcDMXGetInputAttributes(client); + case X_DMXAddInput: return SProcDMXAddInput(client); + case X_DMXRemoveInput: return SProcDMXRemoveInput(client); + + case X_DMXGetScreenInformationDEPRECATED: + case X_DMXForceWindowCreationDEPRECATED: + case X_DMXReconfigureScreenDEPRECATED: + return BadImplementation; + + default: return BadRequest; + } +} Index: xc/programs/Xserver/Xext/dpms.c diff -u xc/programs/Xserver/Xext/dpms.c:3.12 xc/programs/Xserver/Xext/dpms.c:3.13 --- xc/programs/Xserver/Xext/dpms.c:3.12 Tue Feb 17 10:30:23 2004 +++ xc/programs/Xserver/Xext/dpms.c Wed Jun 2 18:42:55 2004 @@ -26,6 +26,52 @@ Equipment Corporation. ******************************************************************/ +/* + * Copyright (c) 1996-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ /* * HISTORY @@ -33,7 +79,7 @@ * @(#)RCSfile: dpms.c,v Revision: 1.1.4.5 (DEC) Date: 1996/03/04 15:27:00 */ -/* $XFree86: xc/programs/Xserver/Xext/dpms.c,v 3.12 2004/02/17 15:30:23 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/dpms.c,v 3.13 2004/06/02 22:42:55 dawes Exp $ */ #include "X.h" #include "Xproto.h" @@ -48,6 +94,7 @@ #include "dpmsproc.h" #include "modinit.h" +#ifdef DPMSExtension #if 0 static unsigned char DPMSCode; #endif @@ -444,3 +491,4 @@ return BadRequest; } } +#endif Index: xc/programs/Xserver/Xext/panoramiX.c diff -u xc/programs/Xserver/Xext/panoramiX.c:3.38 xc/programs/Xserver/Xext/panoramiX.c:3.40 --- xc/programs/Xserver/Xext/panoramiX.c:3.38 Mon Nov 10 13:21:43 2003 +++ xc/programs/Xserver/Xext/panoramiX.c Wed Jun 30 16:21:38 2004 @@ -23,7 +23,53 @@ dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/Xext/panoramiX.c,v 3.38 2003/11/10 18:21:43 tsi Exp $ */ +/* + * Copyright (c) 1996-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/* $XFree86: xc/programs/Xserver/Xext/panoramiX.c,v 3.40 2004/06/30 20:21:38 martin Exp $ */ #define NEED_REPLIES #include @@ -53,6 +99,17 @@ #include "modinit.h" +PanoramiXData *panoramiXdataPtr = NULL; +unsigned long XRT_WINDOW; + +#ifdef PANORAMIX + +#ifdef GLXPROXY +extern VisualPtr glxMatchVisual(ScreenPtr pScreen, + VisualPtr pVisual, + ScreenPtr pMatchScreen); +#endif + #if 0 static unsigned char PanoramiXReqCode = 0; #endif @@ -64,7 +121,6 @@ int PanoramiXPixHeight = 0; int PanoramiXNumScreens = 0; -PanoramiXData *panoramiXdataPtr = NULL; RegionRec PanoramiXScreenRegion = {{0, 0, 0, 0}, NULL}; static int PanoramiXNumDepths; @@ -76,7 +132,6 @@ XID *PanoramiXVisualTable = NULL; unsigned long XRC_DRAWABLE; -unsigned long XRT_WINDOW; unsigned long XRT_PIXMAP; unsigned long XRT_GC; unsigned long XRT_COLORMAP; @@ -416,6 +471,56 @@ return TRUE; } +static void XineramaInitData(ScreenPtr pScreen) +{ + int i, w, h; + + REGION_NULL(pScreen, &PanoramiXScreenRegion) + for (i = 0; i < PanoramiXNumScreens; i++) { + BoxRec TheBox; + + pScreen = screenInfo.screens[i]; + + panoramiXdataPtr[i].x = dixScreenOrigins[i].x; + panoramiXdataPtr[i].y = dixScreenOrigins[i].y; + panoramiXdataPtr[i].width = pScreen->width; + panoramiXdataPtr[i].height = pScreen->height; + + TheBox.x1 = panoramiXdataPtr[i].x; + TheBox.x2 = TheBox.x1 + panoramiXdataPtr[i].width; + TheBox.y1 = panoramiXdataPtr[i].y; + TheBox.y2 = TheBox.y1 + panoramiXdataPtr[i].height; + + REGION_INIT(pScreen, &XineramaScreenRegions[i], &TheBox, 1); + REGION_UNION(pScreen, &PanoramiXScreenRegion, &PanoramiXScreenRegion, + &XineramaScreenRegions[i]); + } + + PanoramiXPixWidth = panoramiXdataPtr[0].x + panoramiXdataPtr[0].width; + PanoramiXPixHeight = panoramiXdataPtr[0].y + panoramiXdataPtr[0].height; + + for (i = 1; i < PanoramiXNumScreens; i++) { + w = panoramiXdataPtr[i].x + panoramiXdataPtr[i].width; + h = panoramiXdataPtr[i].y + panoramiXdataPtr[i].height; + + if (PanoramiXPixWidth < w) + PanoramiXPixWidth = w; + if (PanoramiXPixHeight < h) + PanoramiXPixHeight = h; + } +} + +void XineramaReinitData(ScreenPtr pScreen) +{ + int i; + + REGION_UNINIT(pScreen, &PanoramiXScreenRegion); + for (i = 0; i < PanoramiXNumScreens; i++) + REGION_UNINIT(pScreen, &XineramaScreenRegions[i]); + + XineramaInitData(pScreen); +} + /* * PanoramiXExtensionInit(): * Called from InitExtensions in main(). @@ -430,8 +535,7 @@ ExtensionEntry *extEntry; ScreenPtr pScreen = screenInfo.screens[0]; PanoramiXScreenPtr pScreenPriv; - int w, h; - + if (noPanoramiXExtension) return; @@ -509,41 +613,7 @@ return; } - - REGION_NULL(pScreen, &PanoramiXScreenRegion); - for (i = 0; i < PanoramiXNumScreens; i++) { - BoxRec TheBox; - - pScreen = screenInfo.screens[i]; - - panoramiXdataPtr[i].x = dixScreenOrigins[i].x; - panoramiXdataPtr[i].y = dixScreenOrigins[i].y; - panoramiXdataPtr[i].width = pScreen->width; - panoramiXdataPtr[i].height = pScreen->height; - - TheBox.x1 = panoramiXdataPtr[i].x; - TheBox.x2 = TheBox.x1 + panoramiXdataPtr[i].width; - TheBox.y1 = panoramiXdataPtr[i].y; - TheBox.y2 = TheBox.y1 + panoramiXdataPtr[i].height; - - REGION_INIT(pScreen, &XineramaScreenRegions[i], &TheBox, 1); - REGION_UNION(pScreen, &PanoramiXScreenRegion, &PanoramiXScreenRegion, - &XineramaScreenRegions[i]); - } - - - PanoramiXPixWidth = panoramiXdataPtr[0].x + panoramiXdataPtr[0].width; - PanoramiXPixHeight = panoramiXdataPtr[0].y + panoramiXdataPtr[0].height; - - for (i = 1; i < PanoramiXNumScreens; i++) { - w = panoramiXdataPtr[i].x + panoramiXdataPtr[i].width; - h = panoramiXdataPtr[i].y + panoramiXdataPtr[i].height; - - if(PanoramiXPixWidth < w) - PanoramiXPixWidth = w; - if(PanoramiXPixHeight < h) - PanoramiXPixHeight = h; - } + XineramaInitData(pScreen); /* * Put our processes into the ProcVector @@ -789,6 +859,18 @@ /* check if the visual exists on all screens */ for (j = 1; j < PanoramiXNumScreens; j++) { pScreen2 = screenInfo.screens[j]; + +#ifdef GLXPROXY + pVisual2 = glxMatchVisual(pScreen, pVisual, pScreen2); + if (pVisual2) { + PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j] = + pVisual2->vid; + continue; + } else if (glxMatchVisual(pScreen, pVisual, pScreen)) { + PanoramiXVisualTable[(pVisual->vid * MAXSCREENS) + j] = 0; + break; + } +#endif pVisual2 = pScreen2->visuals; for (k = 0; k < pScreen2->numVisuals; k++, pVisual2++) { @@ -1256,3 +1338,11 @@ REGION_UNINIT(pScreen, &SrcRegion); REGION_UNINIT(pScreen, &GrabRegion); } + +#else +PanoramiXRes * +PanoramiXFindIDByScrnum(RESTYPE type, XID id, int screen) +{ + return NULL; +} +#endif Index: xc/programs/Xserver/Xext/panoramiXh.h diff -u xc/programs/Xserver/Xext/panoramiXh.h:1.3 xc/programs/Xserver/Xext/panoramiXh.h:1.4 --- xc/programs/Xserver/Xext/panoramiXh.h:1.3 Mon Nov 17 17:20:26 2003 +++ xc/programs/Xserver/Xext/panoramiXh.h Fri Jun 25 11:44:42 2004 @@ -1,9 +1,16 @@ -/* $XFree86: xc/programs/Xserver/Xext/panoramiXh.h,v 1.3 2003/11/17 22:20:26 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/panoramiXh.h,v 1.4 2004/06/25 15:44:42 tsi Exp $ */ /* * Server dispatcher function replacements */ +#ifndef PANORAMIXH_H +#define PANORAMIXH_H 1 + +#include +#include "dixstruct.h" +#include "scrnintstr.h" + extern int PanoramiXCreateWindow(ClientPtr client); extern int PanoramiXChangeWindowAttributes(ClientPtr client); extern int PanoramiXDestroyWindow(ClientPtr client); @@ -76,3 +83,4 @@ extern ScreenInfo *GlobalScrInfo; extern int (* SavedProcVector[256]) (ClientPtr client); +#endif Index: xc/programs/Xserver/Xext/panoramiXsrv.h diff -u xc/programs/Xserver/Xext/panoramiXsrv.h:1.9 xc/programs/Xserver/Xext/panoramiXsrv.h:1.10 --- xc/programs/Xserver/Xext/panoramiXsrv.h:1.9 Sat Aug 11 17:00:06 2001 +++ xc/programs/Xserver/Xext/panoramiXsrv.h Wed Jun 30 16:21:38 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/Xext/panoramiXsrv.h,v 1.9 2001/08/11 21:00:06 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/panoramiXsrv.h,v 1.10 2004/06/30 20:21:38 martin Exp $ */ #ifndef _PANORAMIXSRV_H_ #define _PANORAMIXSRV_H_ @@ -20,6 +20,8 @@ extern Bool XineramaRegisterConnectionBlockCallback(void (*func)(void)); extern int XineramaDeleteResource(pointer, XID); +extern void XineramaReinitData(ScreenPtr); + extern RegionRec XineramaScreenRegions[MAXSCREENS]; extern unsigned long XRC_DRAWABLE; Index: xc/programs/Xserver/Xext/saver.c diff -u xc/programs/Xserver/Xext/saver.c:3.8 xc/programs/Xserver/Xext/saver.c:3.11 --- xc/programs/Xserver/Xext/saver.c:3.8 Mon Nov 17 17:20:26 2003 +++ xc/programs/Xserver/Xext/saver.c Fri Oct 22 21:28:38 2004 @@ -1,6 +1,4 @@ /* - * $XConsortium: saver.c,v 1.12 94/04/17 20:59:36 dpw Exp $ - * Copyright (c) 1992 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy @@ -27,7 +25,53 @@ * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/Xserver/Xext/saver.c,v 3.8 2003/11/17 22:20:26 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/saver.c,v 3.11 2004/10/23 01:28:38 dawes Exp $ */ +/* + * Copyright (c) 1994-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #define NEED_REPLIES #define NEED_EVENTS @@ -810,7 +854,7 @@ DepthPtr pDepth; WindowOptPtr ancwopt; unsigned long *pVlist; - unsigned long *values = 0; + unsigned long *values = 0, *save = 0; unsigned long tmask, imask; unsigned long val; Pixmap pixID; @@ -938,6 +982,7 @@ ret = BadAlloc; goto bail; } + save = values; pAttr->screen = pScreen; pAttr->client = client; pAttr->x = stuff->x; @@ -1155,7 +1200,7 @@ pVlist++; } if (pPriv->attr) - FreeScreenAttr (pPriv->attr); + FreeResource(pPriv->attr->resource, AttrType); pPriv->attr = pAttr; pAttr->resource = FakeClientID (client->index); if (!AddResource (pAttr->resource, AttrType, (pointer) pAttr)) @@ -1166,7 +1211,7 @@ bail: CheckScreenPrivate (pScreen); xfree (pAttr); - xfree (values); + xfree (save); return ret; } @@ -1184,7 +1229,7 @@ pPriv = GetScreenPrivate (pDraw->pScreen); if (pPriv && pPriv->attr && pPriv->attr->client == client) { - FreeScreenAttr (pPriv->attr); + FreeResource(pPriv->attr->resource, AttrType); pPriv->attr = NULL; CheckScreenPrivate (pDraw->pScreen); } Index: xc/programs/Xserver/Xext/security.c diff -u xc/programs/Xserver/Xext/security.c:1.17 xc/programs/Xserver/Xext/security.c:1.18 --- xc/programs/Xserver/Xext/security.c:1.17 Thu Dec 4 11:59:35 2003 +++ xc/programs/Xserver/Xext/security.c Wed Jun 2 18:42:55 2004 @@ -24,7 +24,53 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/Xext/security.c,v 1.17 2003/12/04 16:59:35 tsi Exp $ */ +/* + * Copyright (c) 1996-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/* $XFree86: xc/programs/Xserver/Xext/security.c,v 1.18 2004/06/02 22:42:55 dawes Exp $ */ #include "dixstruct.h" #include "extnsionst.h" @@ -59,6 +105,8 @@ #include "modinit.h" +#ifdef XCSECURITY + static int SecurityErrorBase; /* first Security error number */ static int SecurityEventBase; /* first Security event number */ @@ -1997,3 +2045,5 @@ SecurityLoadPropertyAccessList(); } /* SecurityExtensionInit */ + +#endif Index: xc/programs/Xserver/Xext/shm.c diff -u xc/programs/Xserver/Xext/shm.c:3.42 xc/programs/Xserver/Xext/shm.c:3.43 --- xc/programs/Xserver/Xext/shm.c:3.42 Thu Dec 18 05:15:24 2003 +++ xc/programs/Xserver/Xext/shm.c Sat Sep 25 14:06:20 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/Xext/shm.c,v 3.42 2003/12/18 10:15:24 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/shm.c,v 3.43 2004/09/25 18:06:20 tsi Exp $ */ /************************************************************ Copyright 1989, 1998 The Open Group @@ -585,7 +585,7 @@ orig_y = stuff->dstY; sendEvent = stuff->sendEvent; stuff->sendEvent = 0; - FOR_NSCREENS(j) { + FOR_NSCREENS_BACKWARD(j) { if(!j) stuff->sendEvent = sendEvent; stuff->drawable = draw->info[j].id; stuff->gc = gc->info[j].id; @@ -1124,7 +1124,7 @@ if ( !noPanoramiXExtension ) return ProcPanoramiXShmCreatePixmap(client); #endif - return ProcShmCreatePixmap(client); + return ProcShmCreatePixmap(client); default: return BadRequest; } @@ -1199,6 +1199,10 @@ swaps(&stuff->dstY, n); swapl(&stuff->shmseg, n); swapl(&stuff->offset, n); +#ifdef PANORAMIX + if ( !noPanoramiXExtension ) + return ProcPanoramiXShmPutImage(client); +#endif return ProcShmPutImage(client); } @@ -1218,6 +1222,10 @@ swapl(&stuff->planeMask, n); swapl(&stuff->shmseg, n); swapl(&stuff->offset, n); +#ifdef PANORAMIX + if ( !noPanoramiXExtension ) + return ProcPanoramiXShmGetImage(client); +#endif return ProcShmGetImage(client); } @@ -1234,6 +1242,10 @@ swaps(&stuff->height, n); swapl(&stuff->shmseg, n); swapl(&stuff->offset, n); +#ifdef PANORAMIX + if ( !noPanoramiXExtension ) + return ProcPanoramiXShmCreatePixmap(client); +#endif return ProcShmCreatePixmap(client); } Index: xc/programs/Xserver/Xext/vidmodeproc.h diff -u xc/programs/Xserver/Xext/vidmodeproc.h:1.5 xc/programs/Xserver/Xext/vidmodeproc.h:1.6 --- xc/programs/Xserver/Xext/vidmodeproc.h:1.5 Sat May 5 20:51:19 2001 +++ xc/programs/Xserver/Xext/vidmodeproc.h Fri Jun 25 11:44:42 2004 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/Xext/vidmodeproc.h,v 1.5 2001/05/06 00:51:19 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/vidmodeproc.h,v 1.6 2004/06/25 15:44:42 tsi Exp $ */ -/* Prototypes for DGA functions that the DDX must provide */ +/* Prototypes for VidMode functions that the DDX must provide */ #ifndef _VIDMODEPROC_H_ #define _VIDMODEPROC_H_ Index: xc/programs/Xserver/Xext/xf86bigfont.c diff -u xc/programs/Xserver/Xext/xf86bigfont.c:1.18 xc/programs/Xserver/Xext/xf86bigfont.c:1.19 --- xc/programs/Xserver/Xext/xf86bigfont.c:1.18 Mon Nov 17 17:20:27 2003 +++ xc/programs/Xserver/Xext/xf86bigfont.c Sat Apr 3 17:26:22 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/Xext/xf86bigfont.c,v 1.18 2003/11/17 22:20:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xf86bigfont.c,v 1.19 2004/04/03 22:26:22 dawes Exp $ */ /* * BIGFONT extension for sharing font metrics between clients (if possible) * and for transmitting font metrics to clients in a compressed form. @@ -47,7 +47,7 @@ #ifdef SVR4 #include #endif -#if defined(ISC) || defined(__CYGWIN__) || defined(SCO) || defined(SCO325) +#if defined(ISC) || defined(__CYGWIN__) || defined(__SCO__) #include #include #endif Index: xc/programs/Xserver/Xext/xf86dga.c diff -u xc/programs/Xserver/Xext/xf86dga.c:3.22 xc/programs/Xserver/Xext/xf86dga.c:3.24 --- xc/programs/Xserver/Xext/xf86dga.c:3.22 Tue Jul 15 21:38:30 2003 +++ xc/programs/Xserver/Xext/xf86dga.c Thu Dec 9 14:33:00 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/Xext/xf86dga.c,v 3.22 2003/07/16 01:38:30 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xf86dga.c,v 3.24 2004/12/09 19:33:00 tsi Exp $ */ /* @@ -44,7 +44,8 @@ REQUEST(xXF86DGAGetVideoLLReq); xXF86DGAGetVideoLLReply rep; XDGAModeRec mode; - int num, offset, flags; + int num; + unsigned int addr[2], offset, flags; char *name; if (stuff->screen > screenInfo.numScreens) @@ -64,12 +65,20 @@ /* get the parameters for the mode that best matches */ DGAGetModeInfo(stuff->screen, &mode, num); - if(!DGAOpenFramebuffer(stuff->screen, &name, - (unsigned char**)(&rep.offset), - (int*)(&rep.bank_size), &offset, &flags)) + addr[0] = addr[1] = rep.bank_size = offset = flags = 0; + name = NULL; + + if(!DGAOpenFramebuffer(stuff->screen, &name, addr, + (unsigned int*)(&rep.bank_size), &offset, &flags)) return BadAlloc; - rep.offset += mode.offset; + /* There's room only for the bottom 32 bits of the address */ + if ((name && *name) || (addr[1] != 0) || (rep.bank_size == 0) || + (((rep.offset = addr[0]) ^ (unsigned int)(-1L)) < offset) || + (((rep.offset += offset) ^ (unsigned int)(-1L)) < mode.offset) || + (((rep.offset += mode.offset) ^ (unsigned int)(-1L)) < rep.bank_size)) + return (DGAErrorBase + XF86DGAOperationNotSupported); /* BadAlloc? */ + rep.width = mode.bytesPerScanline / (mode.bitsPerPixel >> 3); rep.ram_size = rep.bank_size >> 10; Index: xc/programs/Xserver/Xext/xf86dga2.c diff -u xc/programs/Xserver/Xext/xf86dga2.c:1.18 xc/programs/Xserver/Xext/xf86dga2.c:1.21 --- xc/programs/Xserver/Xext/xf86dga2.c:1.18 Tue Jul 15 21:38:30 2003 +++ xc/programs/Xserver/Xext/xf86dga2.c Thu Jan 20 12:53:44 2005 @@ -3,7 +3,7 @@ Written by Mark Vojkovich */ -/* $XFree86: xc/programs/Xserver/Xext/xf86dga2.c,v 1.18 2003/07/16 01:38:30 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xf86dga2.c,v 1.21 2005/01/20 17:53:44 tsi Exp $ */ #define NEED_REPLIES @@ -160,17 +160,18 @@ REQUEST_SIZE_MATCH(xXDGAOpenFramebufferReq); rep.type = X_Reply; - rep.length = 0; + rep.length = rep.mem1 = rep.mem2 = rep.size = rep.offset = rep.extra = 0; rep.sequenceNumber = client->sequence; + deviceName = NULL; if(!DGAOpenFramebuffer(stuff->screen, &deviceName, - (unsigned char**)(&rep.mem1), - (int*)&rep.size, (int*)&rep.offset, (int*)&rep.extra)) - { + (unsigned int*)(&rep.mem1), + (unsigned int*)&rep.size, + (unsigned int*)&rep.offset, + (unsigned int*)&rep.extra)) return BadAlloc; - } - nameSize = deviceName ? (strlen(deviceName) + 1) : 0; + nameSize = (deviceName && *deviceName) ? (strlen(deviceName) + 1) : 0; rep.length = (nameSize + 3) >> 2; WriteToClient(client, sizeof(xXDGAOpenFramebufferReply), (char *)&rep); @@ -217,17 +218,14 @@ rep.number = 0; rep.sequenceNumber = client->sequence; - if (!DGAAvailable(stuff->screen)) { - rep.number = 0; - rep.length = 0; + if (!DGAAvailable(stuff->screen) || + ((num = DGAGetModes(stuff->screen)) <= 0)) { WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep); return (client->noClientException); } - if(!(num = DGAGetModes(stuff->screen))) { - WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep); - return (client->noClientException); - } + if (num != (CARD16)num) + num = (CARD16)-1; if(!(mode = (XDGAModePtr)xalloc(num * sizeof(XDGAModeRec)))) return BadAlloc; @@ -247,6 +245,14 @@ for(i = 0; i < num; i++) { size = strlen(mode[i].name) + 1; +#undef SetCARD16 +#define SetCARD16(a,b) \ + do { \ + info.a = mode[i].b; \ + if (info.a != mode[i].b) \ + info.a = (CARD16)-1; \ + } while (0) + info.byte_order = mode[i].byteOrder; info.depth = mode[i].depth; info.num = mode[i].num; @@ -255,24 +261,26 @@ info.vsync_num = mode[i].VSync_num; info.vsync_den = mode[i].VSync_den; info.flags = mode[i].flags; - info.image_width = mode[i].imageWidth; - info.image_height = mode[i].imageHeight; - info.pixmap_width = mode[i].pixmapWidth; - info.pixmap_height = mode[i].pixmapHeight; + SetCARD16(image_width, imageWidth); + SetCARD16(image_height, imageHeight); + SetCARD16(pixmap_width, pixmapWidth); + SetCARD16(pixmap_height, pixmapHeight); info.bytes_per_scanline = mode[i].bytesPerScanline; info.red_mask = mode[i].red_mask; info.green_mask = mode[i].green_mask; info.blue_mask = mode[i].blue_mask; info.visual_class = mode[i].visualClass; - info.viewport_width = mode[i].viewportWidth; - info.viewport_height = mode[i].viewportHeight; - info.viewport_xstep = mode[i].xViewportStep; - info.viewport_ystep = mode[i].yViewportStep; - info.viewport_xmax = mode[i].maxViewportX; - info.viewport_ymax = mode[i].maxViewportY; + SetCARD16(viewport_width, viewportWidth); + SetCARD16(viewport_height, viewportHeight); + SetCARD16(viewport_xstep, xViewportStep); + SetCARD16(viewport_ystep, yViewportStep); + SetCARD16(viewport_xmax, maxViewportX); + SetCARD16(viewport_ymax, maxViewportY); info.viewport_flags = mode[i].viewportFlags; info.reserved1 = mode[i].reserved1; info.reserved2 = mode[i].reserved2; + +#undef SetCARD16 WriteToClient(client, sz_xXDGAModeInfo, (char*)(&info)); WriteToClient(client, size, mode[i].name); @@ -450,8 +458,6 @@ client->errorValue = stuff->cmap; return (BadColor); } - - return (client->noClientException); } Index: xc/programs/Xserver/Xext/xf86dgaext.h diff -u xc/programs/Xserver/Xext/xf86dgaext.h:1.1 xc/programs/Xserver/Xext/xf86dgaext.h:1.2 --- xc/programs/Xserver/Xext/xf86dgaext.h:1.1 Tue Jul 15 21:38:30 2003 +++ xc/programs/Xserver/Xext/xf86dgaext.h Fri Jun 25 11:44:42 2004 @@ -1,8 +1,10 @@ -/* $XFree86: xc/programs/Xserver/Xext/xf86dgaext.h,v 1.1 2003/07/16 01:38:30 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xf86dgaext.h,v 1.2 2004/06/25 15:44:42 tsi Exp $ */ #ifndef _XF86DGAEXT_H_ #define _XF86DGAEXT_H_ +#include "dixstruct.h" + extern DISPATCH_PROC(ProcXF86DGADispatch); #endif /* _XF86DGAEXT_H_ */ Index: xc/programs/Xserver/Xext/xf86misc.c diff -u xc/programs/Xserver/Xext/xf86misc.c:3.42 xc/programs/Xserver/Xext/xf86misc.c:3.46 --- xc/programs/Xserver/Xext/xf86misc.c:3.42 Fri Feb 13 18:58:30 2004 +++ xc/programs/Xserver/Xext/xf86misc.c Wed Dec 15 10:03:28 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/Xext/xf86misc.c,v 3.42 2004/02/13 23:58:30 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xf86misc.c,v 3.46 2004/12/15 15:03:28 twini Exp $ */ /* * Copyright (c) 1995, 1996 The XFree86 Project, Inc @@ -547,7 +547,8 @@ return BadAlloc; MPRIV(client) = pPriv; } - ErrorF("SetClientVersion: %i %i\n",stuff->major,stuff->minor); + xf86MsgVerb(X_INFO, 4, "SetClientVersion: %i %i\n", + stuff->major,stuff->minor); pPriv->major = stuff->major; pPriv->minor = stuff->minor; @@ -625,20 +626,29 @@ strncpy(msgtype,(char*)(&stuff[1]),stuff->typelen); } else return BadValue; if (stuff->vallen) { - if (!(msgval = xalloc(stuff->vallen))) + if (!(msgval = xalloc(stuff->vallen))) { + xfree(msgtype); return BadAlloc; - strncpy(msgval,(char*)(&stuff[1] + ((stuff->typelen + 3) & ~3)), + } + strncpy(msgval,(char*)((char*)&stuff[1] + ((stuff->typelen + 3) & ~3)), stuff->vallen); - } else return BadValue; + } else { + xfree(msgtype); + return BadValue; + } - if ((retval= MiscExtPassMessage(stuff->screen,msgtype,msgval,&retstr)) != 0) + if ((retval = MiscExtPassMessage(stuff->screen,msgtype,msgval,&retstr)) != 0) { + xfree(msgtype); + xfree(msgval); return retval; + } rep.type = X_Reply; rep.sequenceNumber = client->sequence; - rep.mesglen = (retstr? strlen(retstr): 0); + rep.mesglen = (retstr ? strlen(retstr) : 0); rep.length = (SIZEOF(xXF86MiscPassMessageReply) - SIZEOF(xGenericReply) + ((rep.mesglen + 3) & ~3)) >> 2; + rep.status = 0; if (client->swapped) { swaps(&rep.sequenceNumber, n); @@ -650,6 +660,8 @@ if (rep.mesglen) WriteToClient(client, rep.mesglen, (char *)retstr); + xfree(msgtype); + xfree(msgval); return (client->noClientException); } Index: xc/programs/Xserver/Xext/xres.c diff -u xc/programs/Xserver/Xext/xres.c:1.8 xc/programs/Xserver/Xext/xres.c:1.9 --- xc/programs/Xserver/Xext/xres.c:1.8 Tue Oct 28 18:08:44 2003 +++ xc/programs/Xserver/Xext/xres.c Thu Mar 4 14:31:37 2004 @@ -1,7 +1,7 @@ /* Copyright (c) 2002 XFree86 Inc */ -/* $XFree86: xc/programs/Xserver/Xext/xres.c,v 1.8 2003/10/28 23:08:44 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xres.c,v 1.9 2004/03/04 19:31:37 dawes Exp $ */ #define NEED_EVENTS #define NEED_REPLIES @@ -52,22 +52,23 @@ /* REQUEST(xXResQueryClientsReq); */ xXResQueryClientsReply rep; int *current_clients; - int i; + int i, num_clients; REQUEST_SIZE_MATCH(xXResQueryClientsReq); current_clients = ALLOCATE_LOCAL((currentMaxClients - 1) * sizeof(int)); - rep.num_clients = 0; + num_clients = 0; for(i = 1; i < currentMaxClients; i++) { if(clients[i]) { - current_clients[rep.num_clients] = i; - rep.num_clients++; + current_clients[num_clients] = i; + num_clients++; } } rep.type = X_Reply; rep.sequenceNumber = client->sequence; + rep.num_clients = num_clients; rep.length = rep.num_clients * sz_xXResClient >> 2; if (client->swapped) { int n; @@ -77,10 +78,10 @@ } WriteToClient (client, sizeof (xXResQueryClientsReply), (char *) &rep); - if(rep.num_clients) { + if(num_clients) { xXResClient scratch; - for(i = 0; i < rep.num_clients; i++) { + for(i = 0; i < num_clients; i++) { scratch.resource_base = clients[current_clients[i]]->clientAsMask; scratch.resource_mask = RESOURCE_ID_MASK; @@ -112,7 +113,7 @@ { REQUEST(xXResQueryClientResourcesReq); xXResQueryClientResourcesReply rep; - int i, clientID; + int i, clientID, num_types; int *counts; REQUEST_SIZE_MATCH(xXResQueryClientResourcesReq); @@ -132,14 +133,15 @@ FindAllClientResources(clients[clientID], ResFindAllRes, counts); - rep.num_types = 0; + num_types = 0; for(i = 0; i <= lastResourceType; i++) { - if(counts[i]) rep.num_types++; + if(counts[i]) num_types++; } rep.type = X_Reply; rep.sequenceNumber = client->sequence; + rep.num_types = num_types; rep.length = rep.num_types * sz_xXResType >> 2; if (client->swapped) { int n; @@ -149,7 +151,7 @@ } WriteToClient (client,sizeof(xXResQueryClientResourcesReply),(char*)&rep); - if(rep.num_types) { + if(num_types) { xXResType scratch; for(i = 0; i < lastResourceType; i++) { Index: xc/programs/Xserver/Xext/xvdisp.h diff -u xc/programs/Xserver/Xext/xvdisp.h:1.1 xc/programs/Xserver/Xext/xvdisp.h:1.2 --- xc/programs/Xserver/Xext/xvdisp.h:1.1 Tue Jul 15 21:38:31 2003 +++ xc/programs/Xserver/Xext/xvdisp.h Fri Jun 25 11:44:42 2004 @@ -1,3 +1,8 @@ -/* $XFree86: xc/programs/Xserver/Xext/xvdisp.h,v 1.1 2003/07/16 01:38:31 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xvdisp.h,v 1.2 2004/06/25 15:44:42 tsi Exp $ */ + +#ifndef XVDISP_H +#define XVDISP_H 1 extern void XineramifyXv(void); + +#endif Index: xc/programs/Xserver/Xext/xvmodproc.h diff -u xc/programs/Xserver/Xext/xvmodproc.h:1.3 xc/programs/Xserver/Xext/xvmodproc.h:1.4 --- xc/programs/Xserver/Xext/xvmodproc.h:1.3 Sun Apr 8 12:33:22 2001 +++ xc/programs/Xserver/Xext/xvmodproc.h Fri Jun 25 11:44:42 2004 @@ -1,4 +1,7 @@ -/* $XFree86: xc/programs/Xserver/Xext/xvmodproc.h,v 1.3 2001/04/08 16:33:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xvmodproc.h,v 1.4 2004/06/25 15:44:42 tsi Exp $ */ + +#ifndef XVMODPROC_H +#define XVMODPROC_H 1 #include "xvmcext.h" @@ -8,3 +11,5 @@ extern int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr); extern void XvRegister(void); + +#endif Index: xc/programs/Xserver/Xext/extmod/Imakefile diff -u xc/programs/Xserver/Xext/extmod/Imakefile:1.22 xc/programs/Xserver/Xext/extmod/Imakefile:1.24 --- xc/programs/Xserver/Xext/extmod/Imakefile:1.22 Wed Mar 6 16:12:32 2002 +++ xc/programs/Xserver/Xext/extmod/Imakefile Mon May 31 20:16:59 2004 @@ -1,4 +1,50 @@ -XCOMM $XFree86: xc/programs/Xserver/Xext/extmod/Imakefile,v 1.22 2002/03/06 21:12:32 mvojkovi Exp $ +XCOMM $XFree86: xc/programs/Xserver/Xext/extmod/Imakefile,v 1.24 2004/06/01 00:16:59 dawes Exp $ +/* + * Copyright (c) 1994-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ XCOMM This directory is only entered if DoLoadableServer is set #define IHaveModules @@ -117,7 +163,7 @@ #endif SpecialCObjectRule(modinit,$(ICONFIGFILES),$(EXT_DEFINES)) -LibraryModuleTarget(extmod,$(MOBJS)) +LibraryModuleTarget(extmod,$(MOBJS),extensions) NormalLintTarget($(SRCS)) InstallLibraryModule(extmod,$(MODULEDIR),extensions) Index: xc/programs/Xserver/Xext/tiny/Imakefile diff -u /dev/null xc/programs/Xserver/Xext/tiny/Imakefile:1.2 --- /dev/null Wed Mar 16 21:06:33 2005 +++ xc/programs/Xserver/Xext/tiny/Imakefile Thu Aug 5 16:37:42 2004 @@ -0,0 +1,66 @@ +XCOMM $XFree86: xc/programs/Xserver/Xext/tiny/Imakefile,v 1.2 2004/08/05 20:37:42 tsi Exp $ +/* + * Copyright (c) 2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#undef XF86Server +#define XF86Server NO +#undef DoLoadableServer +#define DoLoadableServer NO +#undef BuildTinyDIX +#define BuildTinyDIX YES +#define LinkDirectory .. + +/* + * The above doesn't really work because rules that depend on the symbols being + * over-ridden above have already been #define'd. Catch this at the Makefiles + * stage. + */ +IMAKE_DEFINES=-DXF86Server=NO -DBuildTinyDIX=YES + +#include "../Imakefile" + +Makefiles:: Makefile Index: xc/programs/Xserver/Xi/stubs.c diff -u xc/programs/Xserver/Xi/stubs.c:3.5 xc/programs/Xserver/Xi/stubs.c:3.6 --- xc/programs/Xserver/Xi/stubs.c:3.5 Mon Nov 17 17:20:30 2003 +++ xc/programs/Xserver/Xi/stubs.c Wed Jun 2 18:42:56 2004 @@ -1,5 +1,3 @@ -/* $Xorg: stubs.c,v 1.4 2001/02/09 02:04:35 xorgcvs Exp $ */ - /************************************************************ Copyright 1989, 1998 The Open Group @@ -45,7 +43,54 @@ SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/Xi/stubs.c,v 3.5 2003/11/17 22:20:30 dawes Exp $ */ +/* + * Copyright (c) 1996-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* $XFree86: xc/programs/Xserver/Xi/stubs.c,v 3.6 2004/06/02 22:42:56 dawes Exp $ */ /* * stubs.c -- stub routines for the X server side of the XINPUT @@ -65,6 +110,8 @@ #include "XIproto.h" #include "XIstubs.h" +#ifdef XINPUT + /*********************************************************************** * * Caller: ProcXChangeKeyboardDevice @@ -311,3 +358,15 @@ return (BadMatch); } } + +#else + +int DeviceValuator = 0; + +DeviceIntPtr +LookupDeviceIntRec(int i) +{ + return NULL; +} + +#endif Index: xc/programs/Xserver/Xprint/Imakefile diff -u xc/programs/Xserver/Xprint/Imakefile:1.20 xc/programs/Xserver/Xprint/Imakefile:1.21 --- xc/programs/Xserver/Xprint/Imakefile:1.20 Tue Jul 15 21:38:33 2003 +++ xc/programs/Xserver/Xprint/Imakefile Mon Jan 31 17:54:46 2005 @@ -3,23 +3,10 @@ -XCOMM $XFree86: xc/programs/Xserver/Xprint/Imakefile,v 1.20 2003/07/16 01:38:33 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/Xprint/Imakefile,v 1.21 2005/01/31 22:54:46 tsi Exp $ #include -#ifndef XpRasterDDX -#define XpRasterDDX YES -#endif -#ifndef XpColorPclDDX -#define XpColorPclDDX YES -#endif -#ifndef XpMonoPclDDX -#define XpMonoPclDDX NO -#endif -#ifndef XpPostScriptDDX -#define XpPostScriptDDX YES -#endif - SRCS1 = Init.c Quarks.c attributes.c Util.c mediaSizes.c \ Oid.c AttrValid.c Index: xc/programs/Xserver/Xprint/attributes.c diff -u xc/programs/Xserver/Xprint/attributes.c:1.21 xc/programs/Xserver/Xprint/attributes.c:1.22 --- xc/programs/Xserver/Xprint/attributes.c:1.21 Thu Dec 18 21:05:38 2003 +++ xc/programs/Xserver/Xprint/attributes.c Sat Apr 3 17:26:22 2004 @@ -44,7 +44,7 @@ ** ********************************************************* ** ********************************************************************/ -/* $XFree86: xc/programs/Xserver/Xprint/attributes.c,v 1.21 2003/12/19 02:05:38 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xprint/attributes.c,v 1.22 2004/04/03 22:26:22 dawes Exp $ */ #include #include @@ -52,7 +52,7 @@ #include #include #include -#if (defined(sun) && defined(SVR4)) || (defined(SCO)) +#if (defined(sun) && defined(SVR4)) || (defined(__SCO__)) #include #endif Index: xc/programs/Xserver/Xprint/ddxInit.c diff -u xc/programs/Xserver/Xprint/ddxInit.c:1.15 xc/programs/Xserver/Xprint/ddxInit.c:1.16 --- xc/programs/Xserver/Xprint/ddxInit.c:1.15 Mon Jun 23 13:35:44 2003 +++ xc/programs/Xserver/Xprint/ddxInit.c Wed Jun 2 18:42:56 2004 @@ -1,4 +1,3 @@ -/* $Xorg: ddxInit.c,v 1.3 2000/08/17 19:48:07 cpqbld Exp $ */ /* (c) Copyright 1996 Hewlett-Packard Company (c) Copyright 1996 International Business Machines Corp. @@ -30,7 +29,54 @@ dealings in this Software without prior written authorization from said copyright holders. */ -/* $XFree86: xc/programs/Xserver/Xprint/ddxInit.c,v 1.15 2003/06/23 17:35:44 eich Exp $ */ +/* + * Copyright (c) 1996-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* $XFree86: xc/programs/Xserver/Xprint/ddxInit.c,v 1.16 2004/06/02 22:42:56 dawes Exp $ */ #include "X.h" #include "Xproto.h" @@ -203,6 +249,11 @@ #ifdef DDXOSINIT void +OsVendorPreInit(void) +{ +} + +void OsVendorInit(void) { } Index: xc/programs/Xserver/Xprint/ps/PsGC.c diff -u xc/programs/Xserver/Xprint/ps/PsGC.c:1.7 xc/programs/Xserver/Xprint/ps/PsGC.c:1.8 --- xc/programs/Xserver/Xprint/ps/PsGC.c:1.7 Wed Oct 29 17:11:55 2003 +++ xc/programs/Xserver/Xprint/ps/PsGC.c Sat Oct 23 11:29:27 2004 @@ -57,7 +57,7 @@ * or other dealings in this Software without prior written authorization * from said copyright holders. */ -/* $XFree86: xc/programs/Xserver/Xprint/ps/PsGC.c,v 1.7 2003/10/29 22:11:55 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/Xprint/ps/PsGC.c,v 1.8 2004/10/23 15:29:27 dawes Exp $ */ /******************************************************************* ** @@ -191,7 +191,6 @@ case DRAWABLE_PIXMAP: /* we don't support pixmaps yet! */ return FALSE; - break; case DRAWABLE_WINDOW: if( pGC ) { Index: xc/programs/Xserver/afb/Imakefile diff -u xc/programs/Xserver/afb/Imakefile:3.7 xc/programs/Xserver/afb/Imakefile:3.9 --- xc/programs/Xserver/afb/Imakefile:3.7 Fri May 31 14:45:54 2002 +++ xc/programs/Xserver/afb/Imakefile Mon May 31 20:16:59 2004 @@ -1,5 +1,50 @@ -XCOMM $XFree86: xc/programs/Xserver/afb/Imakefile,v 3.7 2002/05/31 18:45:54 dawes Exp $ -XCOMM $XConsortium: Imakefile,v 1.38 94/03/11 18:47:47 dpw Exp $ +XCOMM $XFree86: xc/programs/Xserver/afb/Imakefile,v 3.9 2004/06/01 00:16:59 dawes Exp $ +/* + * Copyright (c) 1994-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #define IHaveModules #include @@ -38,7 +83,7 @@ ../mfb/llib-lmfb.ln ../mi/llib-lmi.ln ModuleObjectRule() -LibraryModuleTarget(afb,$(OBJS)) +LibraryModuleTarget(afb,$(OBJS),.) LintLibraryTarget(afb,$(SRCS1)) NormalLintTarget($(LINTDEFS) $(SRCS1)) Index: xc/programs/Xserver/cfb/Imakefile.inc diff -u xc/programs/Xserver/cfb/Imakefile.inc:1.4 xc/programs/Xserver/cfb/Imakefile.inc:1.8 --- xc/programs/Xserver/cfb/Imakefile.inc:1.4 Fri Nov 22 17:56:02 2002 +++ xc/programs/Xserver/cfb/Imakefile.inc Wed Feb 9 14:41:59 2005 @@ -1,8 +1,50 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:48:12 cpqbld Exp $ - - - -XCOMM $XFree86: xc/programs/Xserver/cfb/Imakefile.inc,v 1.4 2002/11/22 22:56:02 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/cfb/Imakefile.inc,v 1.8 2005/02/09 19:41:59 dawes Exp $ +/* + * Copyright (c) 1994-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #if DoLoadableServer #if !BuildModuleInSubdir @@ -22,15 +64,13 @@ #if PixelSize == 8 PSZSRCS = cfb8bit.c cfbteblt8.c cfbglrop8.c cfbpush8.c cfbrctstp8.c PSZOBJS = cfb8bit.o cfbteblt8.o cfbglrop8.o cfbpush8.o cfbrctstp8.o -#ifdef MipsArchitecture -#ifndef ArcArchitecture -#ifndef Mips64Architecture +#if defined(MipsArchitecture) && \ + !defined(ArcArchitecture) && \ + !defined(Mips64Architecture) STIPPLESRC = stipmips.s stipmipste.s STIPPLEOBJ = stipmips.o stipmipste.o STIPPLEDEF = -DHAS_STIPPLE_CODE #endif -#endif -#endif #ifdef SparcArchitecture STIPPLESRC = stipsparc.s stipsparcte.s STIPPLEOBJ = stipsparc.o stipsparcte.o @@ -51,7 +91,7 @@ XFMODOBJ = cfbmodule.o #endif -#if !(defined(IHaveModules) && defined(LinkDirectory)) +#if !(defined(IHaveModules) && PixelSize != 8) CFBCMAP = cfbcmap.o #endif @@ -115,7 +155,7 @@ #ifdef IHaveModules ModuleObjectRule() -LibraryModuleTarget($(CFBNAME),$(OBJS)) +LibraryModuleTarget($(CFBNAME),$(OBJS),.) #else NormalLibraryObjectRule() NormalLibraryTarget($(CFBNAME),$(OBJS)) @@ -165,7 +205,9 @@ LinkSourceFile(cfbpush8.c,LinkDirectory) LinkSourceFile(cfbrctstp8.c,LinkDirectory) LinkSourceFile(cfbteblt8.c,LinkDirectory) -#ifdef MipsArchitecture +#if defined(MipsArchitecture) && \ + !defined(ArcArchitecture) && \ + !defined(Mips64Architecture) LinkSourceFile(stipmips.s,LinkDirectory) #endif #ifdef SparcArchitecture @@ -227,7 +269,9 @@ #if PixelSize == 8 ObjectFromSpecialSource(cfbglrop8,cfbglblt8,-DGLYPHROP) -#ifdef MipsArchitecture +#if defined(MipsArchitecture) && \ + !defined(ArcArchitecture) && \ + !defined(Mips64Architecture) stipmipste.s: stipmips.s $(RM) $@ $(LN) stipmips.s stipmipste.s Index: xc/programs/Xserver/cfb/cfb8line.c diff -u xc/programs/Xserver/cfb/cfb8line.c:3.19 xc/programs/Xserver/cfb/cfb8line.c:3.20 --- xc/programs/Xserver/cfb/cfb8line.c:3.19 Wed Oct 29 17:44:52 2003 +++ xc/programs/Xserver/cfb/cfb8line.c Wed Sep 15 11:01:24 2004 @@ -1,6 +1,6 @@ +/* $XFree86: xc/programs/Xserver/cfb/cfb8line.c,v 3.20 2004/09/15 15:01:24 dawes Exp $ */ + /* - * $Xorg: cfb8line.c,v 1.4 2001/02/09 02:04:37 xorgcvs Exp $ - * Copyright 1990, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -25,10 +25,57 @@ * * Author: Keith Packard, MIT X Consortium * - * $XFree86: xc/programs/Xserver/cfb/cfb8line.c,v 3.19 2003/10/29 22:44:52 tsi Exp $ * Jeff Anton'x fixes: cfb8line.c 97/02/07 */ +/* + * Copyright (c) 2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + #include "X.h" #include "gcstruct.h" @@ -1480,7 +1527,7 @@ { body body; } - if (len & 1) + if (len == -1) body; IMPORTANT_END; Index: xc/programs/Xserver/cfb/cfbbitblt.c diff -u xc/programs/Xserver/cfb/cfbbitblt.c:1.20 xc/programs/Xserver/cfb/cfbbitblt.c:1.21 --- xc/programs/Xserver/cfb/cfbbitblt.c:1.20 Mon Nov 10 13:21:44 2003 +++ xc/programs/Xserver/cfb/cfbbitblt.c Sun Apr 11 16:33:48 2004 @@ -2,7 +2,7 @@ * cfb copy area */ -/* $XFree86: xc/programs/Xserver/cfb/cfbbitblt.c,v 1.20 2003/11/10 18:21:44 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/cfb/cfbbitblt.c,v 1.21 2004/04/11 20:33:48 tsi Exp $ */ /* @@ -53,7 +53,9 @@ #define cfbCopyPlane1toN cfbCopyPlane1to8 #define cfbCopyPlaneNto1 cfbCopyPlane8to1 #else +#if IMAGE_BYTE_ORDER == LSBFirst static unsigned int FgPixel, BgPixel; +#endif # if PSZ == 16 #define cfbCopyPlane1toN cfbCopyPlane1to16 #define cfbCopyPlaneNto1 cfbCopyPlane16to1 @@ -998,6 +1000,8 @@ /******************************************************************/ +#if IMAGE_BYTE_ORDER == LSBFirst + static void #if PSZ == 16 cfbCopyPlane1to16 @@ -1337,6 +1341,8 @@ } } +#endif /* IMAGE_BYTE_ORDER == LSBFirst */ + #endif /* PSZ == 8 */ /* shared among all different cfb depths through linker magic */ Index: xc/programs/Xserver/cfb/cfbteblt8.c diff -u xc/programs/Xserver/cfb/cfbteblt8.c:1.6 xc/programs/Xserver/cfb/cfbteblt8.c:1.7 --- xc/programs/Xserver/cfb/cfbteblt8.c:1.6 Fri Dec 14 14:59:25 2001 +++ xc/programs/Xserver/cfb/cfbteblt8.c Thu Dec 30 21:56:03 2004 @@ -3,7 +3,7 @@ * 8 bit displays, in Copy mode with no clipping. */ -/* $XFree86: xc/programs/Xserver/cfb/cfbteblt8.c,v 1.6 2001/12/14 19:59:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/cfb/cfbteblt8.c,v 1.7 2004/12/31 02:56:03 tsi Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -300,7 +300,7 @@ #define StorePixels(o,p) dst[o] = p #define Loop dst += widthDst; #else -#define StorePixels(o,p) *dst++ = (p) +#define StorePixels(o,p) *dst = (p); dst++ #define Loop dst += widthLeft; #endif Index: xc/programs/Xserver/dbe/module/Imakefile diff -u xc/programs/Xserver/dbe/module/Imakefile:1.2 xc/programs/Xserver/dbe/module/Imakefile:1.4 --- xc/programs/Xserver/dbe/module/Imakefile:1.2 Mon Dec 17 15:00:39 2001 +++ xc/programs/Xserver/dbe/module/Imakefile Mon May 31 20:16:59 2004 @@ -1,6 +1,50 @@ -XCOMM $XConsortium: Imakefile /main/2 1996/09/28 17:06:40 rws $ - -XCOMM $XFree86: xc/programs/Xserver/dbe/module/Imakefile,v 1.2 2001/12/17 20:00:39 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/dbe/module/Imakefile,v 1.4 2004/06/01 00:16:59 dawes Exp $ +/* + * Copyright (c) 1994-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #define IHaveModules #include @@ -21,7 +65,7 @@ ModuleObjectRule() -LibraryModuleTarget(dbe,$(OBJS)) +LibraryModuleTarget(dbe,$(OBJS),extensions) LintLibraryTarget(dbe,$(SRCS)) NormalLintTarget($(SRCS)) Index: xc/programs/Xserver/dix/Imakefile diff -u xc/programs/Xserver/dix/Imakefile:3.18 xc/programs/Xserver/dix/Imakefile:3.20 --- xc/programs/Xserver/dix/Imakefile:3.18 Fri Nov 14 18:52:50 2003 +++ xc/programs/Xserver/dix/Imakefile Tue Sep 21 14:37:48 2004 @@ -1,9 +1,58 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:48:16 cpqbld Exp $ +XCOMM $XFree86: xc/programs/Xserver/dix/Imakefile,v 3.20 2004/09/21 18:37:48 torrey Exp $ +/* + * Copyright (c) 1994-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ -XCOMM $XFree86: xc/programs/Xserver/dix/Imakefile,v 3.18 2003/11/14 23:52:50 torrey Exp $ +#if BuildSeparateTinyDIX && !BuildTinyDIX +#define IHaveSubdirs +SUBDIRS = tiny +#endif #include @@ -26,8 +75,9 @@ main.o property.o resource.o swaprep.o swapreq.o \ tables.o window.o initatoms.o dixfonts.o privates.o pixmap.o $(FFS_OBJ) - INCLUDES = -I../include -I$(XINCLUDESRC) -I$(FONTINCSRC) -I$(EXTINCSRC) \ - -I$(SERVERSRC)/Xext -I$(SERVERSRC)/lbx + INCLUDES = -I$(SERVERSRC)/dix -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(FONTINCSRC) -I$(EXTINCSRC) -I$(SERVERSRC)/Xext \ + -I$(SERVERSRC)/lbx LINTLIBS = ../os/llib-los.ln /* @@ -81,6 +131,12 @@ VENDOR_DEFINES = $(VENDOR_STRING) $(VENDOR_RELEASE) $(QUARTZ_DEFINES) +#if BuildTinyDIX +TINY_DEFINES = TinyDIXDefines +#endif + +DEFINES = $(TINY_DEFINES) + NormalLibraryObjectRule() NormalLibraryTarget(dix,$(OBJS)) LintLibraryTarget(dix,$(SRCS) $(XPSRC)) @@ -92,9 +148,44 @@ SpecialCObjectRule(main,$(ICONFIGFILES),$(VENDOR_DEFINES)) SpecialCObjectRule(pixmap,$(ICONFIGFILES),$(_NOOP_)) SpecialCObjectRule(privates,$(ICONFIGFILES),$(_NOOP_)) +SpecialCObjectRule(window,$(ICONFIGFILES),$(QUARTZ_DEFINES)) #if PrintOnlyServer NormalLibraryTarget(xpstubs,$(XPOBJ)) #endif DependTarget() + +#ifdef IHaveSubdirs +MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) +#endif + +#ifdef LinkDirectory +LinkSourceFile(atom.c,LinkDirectory) +LinkSourceFile(colormap.c,LinkDirectory) +LinkSourceFile(cursor.c,LinkDirectory) +LinkSourceFile(devices.c,LinkDirectory) +LinkSourceFile(dispatch.c,LinkDirectory) +LinkSourceFile(dixfonts.c,LinkDirectory) +LinkSourceFile(dixutils.c,LinkDirectory) +LinkSourceFile(events.c,LinkDirectory) +LinkSourceFile(extension.c,LinkDirectory) +LinkSourceFile(ffs.c,LinkDirectory) +LinkSourceFile(gc.c,LinkDirectory) +LinkSourceFile(globals.c,LinkDirectory) +LinkSourceFile(glyphcurs.c,LinkDirectory) +LinkSourceFile(grabs.c,LinkDirectory) +LinkSourceFile(initatoms.c,LinkDirectory) +LinkSourceFile(main.c,LinkDirectory) +LinkSourceFile(pixmap.c,LinkDirectory) +LinkSourceFile(privates.c,LinkDirectory) +LinkSourceFile(property.c,LinkDirectory) +LinkSourceFile(resource.c,LinkDirectory) +LinkSourceFile(swaprep.c,LinkDirectory) +LinkSourceFile(swapreq.c,LinkDirectory) +LinkSourceFile(tables.c,LinkDirectory) +LinkSourceFile(window.c,LinkDirectory) +LinkSourceFile(xpstubs.c,LinkDirectory) +#endif + Index: xc/programs/Xserver/dix/dispatch.c diff -u xc/programs/Xserver/dix/dispatch.c:3.33 xc/programs/Xserver/dix/dispatch.c:3.34 --- xc/programs/Xserver/dix/dispatch.c:3.33 Mon Nov 17 17:20:33 2003 +++ xc/programs/Xserver/dix/dispatch.c Wed Jun 23 15:40:15 2004 @@ -68,7 +68,7 @@ * * *****************************************************************/ -/* $XFree86: xc/programs/Xserver/dix/dispatch.c,v 3.33 2003/11/17 22:20:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/dix/dispatch.c,v 3.34 2004/06/23 19:40:15 tsi Exp $ */ #ifdef PANORAMIX_DEBUG #include @@ -2106,7 +2106,9 @@ Mask plane = 0; char *pBuf; xGetImageReply xgi; +#ifdef XCSECURITY RegionPtr pVisibleRegion = NULL; +#endif if ((format != XYPixmap) && (format != ZPixmap)) { Index: xc/programs/Xserver/dix/dixfonts.c diff -u xc/programs/Xserver/dix/dixfonts.c:3.29 xc/programs/Xserver/dix/dixfonts.c:3.31 --- xc/programs/Xserver/dix/dixfonts.c:3.29 Mon Nov 17 17:20:34 2003 +++ xc/programs/Xserver/dix/dixfonts.c Mon Feb 14 20:09:36 2005 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/dix/dixfonts.c,v 3.29 2003/11/17 22:20:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/dix/dixfonts.c,v 3.31 2005/02/15 01:09:36 dawes Exp $ */ /************************************************************************ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,8 +21,53 @@ SOFTWARE. ************************************************************************/ +/* + * Copyright (c) 1994-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ -/* $Xorg: dixfonts.c,v 1.4 2000/08/17 19:48:18 cpqbld Exp $ */ #define NEED_REPLIES #include "X.h" @@ -1921,15 +1966,17 @@ { patternCache = MakeFontPatternCache(); -#ifndef KDRIVESERVER +#ifdef NO_PRINTER_FONTS if (screenInfo.numScreens > screenInfo.numVideoScreens) { PrinterFontRegisterFpeFunctions(); FontFileCheckRegisterFpeFunctions(); +#ifndef NOFONTSERVERACCESS check_fs_register_fpe_functions(); - } else +#endif + } else #endif { -#ifdef KDRIVESERVER +#ifdef REGISTER_BUILTIN_FONTS BuiltinRegisterFpeFunctions(); #endif FontFileRegisterFpeFunctions(); @@ -2088,6 +2135,7 @@ return 0; } +#ifndef NOFONTSERVERACCESS static int fs_handlers_installed = 0; static unsigned int last_server_gen; @@ -2136,6 +2184,7 @@ } RemoveFontWakeup(fpe); } +#endif #ifdef DEBUG #define GLWIDTHBYTESPADDED(bits,nbytes) \ Index: xc/programs/Xserver/dix/events.c diff -u xc/programs/Xserver/dix/events.c:3.52 xc/programs/Xserver/dix/events.c:3.54 --- xc/programs/Xserver/dix/events.c:3.52 Fri Jan 23 02:23:34 2004 +++ xc/programs/Xserver/dix/events.c Wed Aug 4 12:33:34 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/dix/events.c,v 3.52 2004/01/23 07:23:34 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/dix/events.c,v 3.54 2004/08/04 16:33:34 tsi Exp $ */ /************************************************************ Copyright 1987, 1998 The Open Group @@ -2028,6 +2028,45 @@ (void) CheckMotion((xEvent *)NULL); } +#ifdef PANORAMIX +/* This was added to support reconfiguration under Xdmx. The problem is + * that if the 0th screen (i.e., WindowTable[0]) is moved to an origin + * other than 0,0, the information in the private sprite structure must + * be updated accordingly, or XYToWindow (and other routines) will not + * compute correctly. */ +void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff) +{ + GrabPtr grab; + + if (noPanoramiXExtension) return; + + sprite.hot.x -= xoff; + sprite.hot.y -= yoff; + + sprite.hotPhys.x -= xoff; + sprite.hotPhys.y -= yoff; + + sprite.hotLimits.x1 -= xoff; + sprite.hotLimits.y1 -= yoff; + sprite.hotLimits.x2 -= xoff; + sprite.hotLimits.y2 -= yoff; + + if (REGION_NOTEMPTY(sprite.screen, &sprite.Reg1)) + REGION_TRANSLATE(sprite.screen, &sprite.Reg1, xoff, yoff); + if (REGION_NOTEMPTY(sprite.screen, &sprite.Reg2)) + REGION_TRANSLATE(sprite.screen, &sprite.Reg2, xoff, yoff); + + /* FIXME: if we call ConfineCursorToWindow, must we do anything else? */ + if ((grab = inputInfo.pointer->grab) && grab->confineTo) { + if (grab->confineTo->drawable.pScreen != sprite.hotPhys.pScreen) + sprite.hotPhys.x = sprite.hotPhys.y = 0; + ConfineCursorToWindow(grab->confineTo, TRUE, TRUE); + } else + ConfineCursorToWindow(WindowTable[sprite.hotPhys.pScreen->myNum], + TRUE, FALSE); +} +#endif + void DefineInitialRootWindow(win) register WindowPtr win; Index: xc/programs/Xserver/dix/main.c diff -u xc/programs/Xserver/dix/main.c:3.44 xc/programs/Xserver/dix/main.c:3.45 --- xc/programs/Xserver/dix/main.c:3.44 Mon Nov 17 17:20:34 2003 +++ xc/programs/Xserver/dix/main.c Wed Jun 30 16:21:38 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/dix/main.c,v 3.44 2003/11/17 22:20:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/dix/main.c,v 3.45 2004/06/30 20:21:38 martin Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -490,6 +490,21 @@ return(0); } +static int VendorRelease = VENDOR_RELEASE; +static char *VendorString = VENDOR_STRING; + +void +SetVendorRelease(int release) +{ + VendorRelease = release; +} + +void +SetVendorString(char *string) +{ + VendorString = string; +} + static int padlength[4] = {0, 3, 2, 1}; #ifndef PANORAMIX @@ -513,7 +528,7 @@ /* Leave off the ridBase and ridMask, these must be sent with connection */ - setup.release = VENDOR_RELEASE; + setup.release = VendorRelease; /* * per-server image and bitmap parameters are defined in Xmd.h */ @@ -525,7 +540,7 @@ setup.bitmapBitOrder = screenInfo.bitmapBitOrder; setup.motionBufferSize = NumMotionEvents(); setup.numRoots = screenInfo.numScreens; - setup.nbytesVendor = strlen(VENDOR_STRING); + setup.nbytesVendor = strlen(VendorString); setup.numFormats = screenInfo.numPixmapFormats; setup.maxRequestSize = MAX_REQUEST_SIZE; QueryMinMaxKeyCodes(&setup.minKeyCode, &setup.maxKeyCode); @@ -542,7 +557,7 @@ sizesofar = sizeof(xConnSetup); pBuf = ConnectionInfo + sizeof(xConnSetup); - memmove(pBuf, VENDOR_STRING, (int)setup.nbytesVendor); + memmove(pBuf, VendorString, (int)setup.nbytesVendor); sizesofar += setup.nbytesVendor; pBuf += setup.nbytesVendor; i = padlength[setup.nbytesVendor & 3]; Index: xc/programs/Xserver/dix/property.c diff -u xc/programs/Xserver/dix/property.c:3.13 xc/programs/Xserver/dix/property.c:3.14 --- xc/programs/Xserver/dix/property.c:3.13 Tue Jul 15 21:38:37 2003 +++ xc/programs/Xserver/dix/property.c Sat Oct 23 11:29:27 2004 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/dix/property.c,v 3.13 2003/07/16 01:38:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/dix/property.c,v 3.14 2004/10/23 15:29:27 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -554,7 +554,7 @@ { case SecurityErrorOperation: client->errorValue = stuff->property; - return BadAtom;; + return BadAtom; case SecurityIgnoreOperation: return NullPropertyReply(client, pProp->type, pProp->format, &reply); @@ -724,7 +724,7 @@ { case SecurityErrorOperation: client->errorValue = stuff->property; - return BadAtom;; + return BadAtom; case SecurityIgnoreOperation: return Success; } Index: xc/programs/Xserver/dix/tiny/Imakefile diff -u /dev/null xc/programs/Xserver/dix/tiny/Imakefile:1.2 --- /dev/null Wed Mar 16 21:06:38 2005 +++ xc/programs/Xserver/dix/tiny/Imakefile Thu Aug 5 16:37:42 2004 @@ -0,0 +1,66 @@ +XCOMM $XFree86: xc/programs/Xserver/dix/tiny/Imakefile,v 1.2 2004/08/05 20:37:42 tsi Exp $ +/* + * Copyright (c) 1996-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#undef XF86Server +#define XF86Server NO +#undef DoLoadableServer +#define DoLoadableServer NO +#undef BuildTinyDIX +#define BuildTinyDIX YES +#define LinkDirectory .. + +/* + * The above doesn't really work because rules that depend on the symbols being + * over-ridden above have already been #define'd. Catch this at the Makefiles + * stage. + */ +IMAKE_DEFINES=-DXF86Server=NO -DBuildTinyDIX=YES + +#include "../Imakefile" + +Makefiles:: Makefile Index: xc/programs/Xserver/fb/Imakefile diff -u xc/programs/Xserver/fb/Imakefile:1.17 xc/programs/Xserver/fb/Imakefile:1.20 --- xc/programs/Xserver/fb/Imakefile:1.17 Sat Jun 1 21:21:17 2002 +++ xc/programs/Xserver/fb/Imakefile Wed Jun 30 16:21:38 2004 @@ -1,7 +1,50 @@ -XCOMM $XFree86: xc/programs/Xserver/fb/Imakefile,v 1.17 2002/06/02 01:21:17 dawes Exp $ -XCOMM -XCOMM -XCOMM Id: Imakefile,v 1.1 1999/11/02 03:54:44 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/fb/Imakefile,v 1.20 2004/06/30 20:21:38 martin Exp $ +/* + * Copyright (c) 1994-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #if DoLoadableServer #if !BuildModuleInSubdir @@ -17,12 +60,17 @@ #ifdef FbNoPixelAddrCode DEFINES=-DFBNOPIXADDR -DFBNO24BIT #endif - + #if defined(IHaveModules) XFMODSRC = fbmodule.c XFMODOBJ = fbmodule.o #endif +#if BuildRender +RENDERSRC = fbcompose.c +RENDEROBJ = fbcompose.o +#endif + SRCS = $(XFMODSRC) \ fballpriv.c \ fbbits.c \ @@ -30,7 +78,7 @@ fbbltone.c \ fbbstore.c \ fbcmap.c \ - fbcompose.c \ + $(RENDERSRC) \ fbcopy.c \ fbfill.c \ fbfillrect.c \ @@ -64,7 +112,7 @@ fbbltone.o \ fbbstore.o \ fbcmap.o \ - fbcompose.o \ + $(RENDEROBJ) \ fbcopy.o \ fbfill.o \ fbfillrect.o \ @@ -89,7 +137,7 @@ fbwindow.o \ fb24_32.o \ fbpict.o - + INCLUDES = -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) \ -I$(FONTINCSRC) -I$(XF86SRC)/common $(EXTRAINCLUDES) \ @@ -99,7 +147,7 @@ #ifdef IHaveModules ModuleObjectRule() -LibraryModuleTarget(fb,$(OBJS)) +LibraryModuleTarget(fb,$(OBJS),.) #else NormalLibraryObjectRule() NormalLibraryTarget(fb,$(OBJS)) @@ -129,7 +177,9 @@ LinkSourceFile(fbbltone.c,LinkDirectory) LinkSourceFile(fbbstore.c,LinkDirectory) LinkSourceFile(fbcmap.c,LinkDirectory) +#if BuildRender LinkSourceFile(fbcompose.c,LinkDirectory) +#endif LinkSourceFile(fbcopy.c,LinkDirectory) LinkSourceFile(fbfill.c,LinkDirectory) LinkSourceFile(fbfillrect.c,LinkDirectory) Index: xc/programs/Xserver/fb/fb.h diff -u xc/programs/Xserver/fb/fb.h:1.37 xc/programs/Xserver/fb/fb.h:1.39 --- xc/programs/Xserver/fb/fb.h:1.37 Mon Nov 3 00:11:00 2003 +++ xc/programs/Xserver/fb/fb.h Thu Jun 10 13:28:10 2004 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/fb/fb.h,v 1.37 2003/11/03 05:11:00 tsi Exp $ + * $XFree86: xc/programs/Xserver/fb/fb.h,v 1.39 2004/06/10 17:28:10 tsi Exp $ * * Copyright © 1998 Keith Packard * @@ -42,6 +42,7 @@ #include "picturestr.h" #else #include "picture.h" +#include "render.h" #endif /* @@ -101,7 +102,8 @@ # ifdef WIN32 typedef unsigned __int64 FbBits; # else -# if defined(__alpha__) || defined(__alpha) || \ +# if defined(_LP64) || \ + defined(__alpha__) || defined(__alpha) || \ defined(ia64) || defined(__ia64__) || \ defined(__sparc64__) || \ defined(__s390x__) || \ @@ -1564,6 +1566,13 @@ PictFormatPtr formats, int nformats); +Bool +fbPictureSetSubpixelOrder(ScreenPtr pScreen, + int subpixel); + +int +fbPictureGetSubpixelOrder(ScreenPtr pScreen); + /* * fbpixmap.c */ Index: xc/programs/Xserver/fb/fbcmap.c diff -u xc/programs/Xserver/fb/fbcmap.c:1.6 xc/programs/Xserver/fb/fbcmap.c:1.7 --- xc/programs/Xserver/fb/fbcmap.c:1.6 Sat Oct 27 23:33:08 2001 +++ xc/programs/Xserver/fb/fbcmap.c Wed Jun 2 18:42:56 2004 @@ -1,5 +1,4 @@ -/* $XConsortium: fbcmap.c,v 4.19 94/04/17 20:28:46 dpw Exp $ */ -/* $XFree86: xc/programs/Xserver/fb/fbcmap.c,v 1.6 2001/10/28 03:33:08 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/fb/fbcmap.c,v 1.7 2004/06/02 22:42:56 dawes Exp $ */ /************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. @@ -28,6 +27,52 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* + * Copyright (c) 1996-2004 by The XFree86 Project, Inc. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject + * to the following conditions: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution, and in the same place and form as other copyright, + * license and disclaimer information. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: "This product + * includes software developed by The XFree86 Project, Inc + * (http://www.xfree86.org/) and its contributors", in the same + * place and form as other third-party acknowledgments. Alternately, + * this acknowledgment may appear in the software itself, in the + * same form and location as other such third-party acknowledgments. + * + * 4. Except as contained in this notice, the name of The XFree86 + * Project, Inc shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from The XFree86 Project, Inc. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #include "X.h" @@ -646,6 +691,14 @@ return miSetVisualTypes(depth, visuals, bitsPerRGB, -1); } +Bool +fbSetVisualTypesAndMasks (int depth, int visuals, int bitsPerRGB, + Pixel redMask, Pixel greenMask, Pixel blueMask) +{ + return miSetVisualTypesAndMasks(depth, visuals, bitsPerRGB, -1, + redMask, greenMask, blueMask); +} + /* * Given a list of formats for a screen, create a list * of visuals and depths for the screen which coorespond to Index: xc/programs/Xserver/fb/fbpict.c diff -u xc/programs/Xserver/fb/fbpict.c:1.16 xc/programs/Xserver/fb/fbpict.c:1.17 --- xc/programs/Xserver/fb/fbpict.c:1.16 Fri Dec 13 20:46:02 2002 +++ xc/programs/Xserver/fb/fbpict.c Thu Jun 10 13:28:10 2004 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/fb/fbpict.c,v 1.16 2002/12/14 01:46:02 dawes Exp $ + * $XFree86: xc/programs/Xserver/fb/fbpict.c,v 1.17 2004/06/10 17:28:10 tsi Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -1165,3 +1165,35 @@ return TRUE; } + +Bool +fbPictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel) +{ + +#ifdef RENDER + + return PictureSetSubpixelOrder (pScreen, subpixel); + +#else + + return FALSE; + +#endif + +} + +int +fbPictureGetSubpixelOrder (ScreenPtr pScreen) +{ + +#ifdef RENDER + + return PictureGetSubpixelOrder (pScreen); + +#else + + return 0; + +#endif + +} Index: xc/programs/Xserver/hw/Imakefile diff -u xc/programs/Xserver/hw/Imakefile:1.1.1.2 xc/programs/Xserver/hw/Imakefile:1.2 --- xc/programs/Xserver/hw/Imakefile:1.1.1.2 Tue Jan 16 17:42:51 2001 +++ xc/programs/Xserver/hw/Imakefile Wed Jun 30 16:21:38 2004 @@ -14,7 +14,11 @@ XVFBDIR = vfb #endif -SUBDIRS= $(XNESTDIR) $(XVFBDIR) +#if XdmxServer +XDMXDIR = xdmx +#endif + +SUBDIRS= $(XNESTDIR) $(XVFBDIR) $(XDMXDIR) MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) Index: xc/programs/Xserver/hw/darwin/Imakefile diff -u xc/programs/Xserver/hw/darwin/Imakefile:1.20 xc/programs/Xserver/hw/darwin/Imakefile:1.21 --- xc/programs/Xserver/hw/darwin/Imakefile:1.20 Mon Nov 10 20:29:47 2003 +++ xc/programs/Xserver/hw/darwin/Imakefile Fri May 28 03:44:00 2004 @@ -1,22 +1,36 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/darwin/Imakefile,v 1.20 2003/11/11 01:29:47 torrey Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/darwin/Imakefile,v 1.21 2004/05/28 07:44:00 torrey Exp $ #include #define IHaveSubdirs LinkSourceFile(XFree86.man,../xfree86) +/* The version of miinitext.c in mi is built with many extensions off. */ +LinkSourceFile(miinitext.c,$(SERVERSRC)/mi) +SpecialCObjectRule(miinitext,$(ICONFIGFILES),$(EXT_DEFINES)) + +#if BuildXInputExt +XINPUTSRCS = darwinXinput.c +XINPUTOBJS = darwinXinput.o +#endif + SRCS = darwin.c \ darwinEvents.c \ - darwinKeyboard.c + darwinKeyboard.c \ + miinitext.c \ + $(XINPUTSRCS) OBJS = darwin.o \ darwinEvents.o \ - darwinKeyboard.o + darwinKeyboard.o \ + miinitext.o \ + $(XINPUTOBJS) INCLUDES = -I. -I$(SERVERSRC)/mi -I$(SERVERSRC)/fb -I$(EXTINCSRC) \ -I$(SERVERSRC)/render -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(SERVERSRC)/os -I$(INCLUDESRC) -I$(FONTINCSRC) \ - -I$(SERVERSRC)/miext/shadow -I$(SERVERSRC)/hw/xfree86 + -I$(SERVERSRC)/miext/shadow -I$(SERVERSRC)/hw/xfree86 \ + -I$(SERVERSRC)/Xi OSNAME = OSName OSVENDOR = OSVendor Index: xc/programs/Xserver/hw/darwin/darwin.c diff -u xc/programs/Xserver/hw/darwin/darwin.c:1.56 xc/programs/Xserver/hw/darwin/darwin.c:1.58 --- xc/programs/Xserver/hw/darwin/darwin.c:1.56 Mon Nov 24 00:39:01 2003 +++ xc/programs/Xserver/hw/darwin/darwin.c Wed Jun 2 18:42:56 2004 @@ -29,7 +29,7 @@ * holders shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written authorization. */ -/* $XFree86: xc/programs/Xserver/hw/darwin/darwin.c,v 1.56 2003/11/24 05:39:01 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/darwin.c,v 1.58 2004/06/02 22:42:56 dawes Exp $ */ #include "X.h" #include "Xproto.h" @@ -47,6 +47,13 @@ #include "xf86Date.h" #include "dix.h" +#ifdef XINPUT +# include "XI.h" +# include "XIproto.h" +# include "exevents.h" +# include "extinit.h" +#endif + #include #include #include @@ -363,6 +370,22 @@ miPointerGetMotionEvents, DarwinChangePointerControl, 0 ); +#ifdef XINPUT + InitValuatorAxisStruct( pPointer, + 0, // X axis + 0, // min value + 16000, // max value (fixme screen size?) + 1, // resolution (fixme ?) + 1, // min resolution + 1 ); // max resolution + InitValuatorAxisStruct( pPointer, + 1, // X axis + 0, // min value + 16000, // max value (fixme screen size?) + 1, // resolution (fixme ?) + 1, // min resolution + 1 ); // max resolution +#endif break; case DEVICE_ON: @@ -631,6 +654,13 @@ /* + * OsVendorPreInit + */ +void OsVendorPreInit(void) +{ +} + +/* * OsVendorInit * Initialization of Darwin OS support. */ Index: xc/programs/Xserver/hw/darwin/darwinEvents.c diff -u xc/programs/Xserver/hw/darwin/darwinEvents.c:1.5 xc/programs/Xserver/hw/darwin/darwinEvents.c:1.6 --- xc/programs/Xserver/hw/darwin/darwinEvents.c:1.5 Mon Nov 3 00:36:30 2003 +++ xc/programs/Xserver/hw/darwin/darwinEvents.c Wed Mar 31 17:29:09 2004 @@ -3,6 +3,7 @@ */ /* Copyright (c) 2002 Torrey T. Lyons. All Rights Reserved. +Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved. This file is based on mieq.c by Keith Packard, which contains the following copyright: @@ -28,7 +29,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/hw/darwin/darwinEvents.c,v 1.5 2003/11/03 05:36:30 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/darwinEvents.c,v 1.6 2004/03/31 22:29:09 torrey Exp $ */ #define NEED_EVENTS #include "X.h" @@ -50,24 +51,24 @@ #include /* Fake button press/release for scroll wheel move. */ -#define SCROLLWHEELUPFAKE 4 -#define SCROLLWHEELDOWNFAKE 5 +#define SCROLLWHEELUPFAKE 4 +#define SCROLLWHEELDOWNFAKE 5 #define QUEUE_SIZE 256 typedef struct _Event { - xEvent event; - ScreenPtr pScreen; + xEvent event; + ScreenPtr pScreen; } EventRec, *EventPtr; typedef struct _EventQueue { - HWEventQueueType head, tail; /* long for SetInputCheck */ - CARD32 lastEventTime; /* to avoid time running backwards */ - Bool lastMotion; - EventRec events[QUEUE_SIZE]; /* static allocation for signals */ - DevicePtr pKbd, pPtr; /* device pointer, to get funcs */ - ScreenPtr pEnqueueScreen; /* screen events are being delivered to */ - ScreenPtr pDequeueScreen; /* screen events are being dispatched to */ + HWEventQueueType head, tail; /* long for SetInputCheck */ + CARD32 lastEventTime; /* to avoid time running backwards */ + Bool lastMotion; + EventRec events[QUEUE_SIZE]; /* static allocation for signals */ + DevicePtr pKbd, pPtr; /* device pointer, to get funcs */ + ScreenPtr pEnqueueScreen; /* screen events are being delivered to */ + ScreenPtr pDequeueScreen; /* screen events are being dispatched to */ } EventQueueRec, *EventQueuePtr; static EventQueueRec darwinEventQueue; @@ -78,7 +79,7 @@ * Press or release the given modifier key, specified by its mask. */ static void DarwinPressModifierMask( - xEvent *xe, // must already have type, time and mouse location + xEvent *xe, // must already have type, time and mouse location int mask) // one of NX_*MASK constants { int key = DarwinModifierNXMaskToNXKey(mask); @@ -93,6 +94,29 @@ } } +#ifdef NX_DEVICELCTLKEYMASK +#define CONTROL_MASK(flags) (flags & (NX_DEVICELCTLKEYMASK|NX_DEVICERCTLKEYMASK)) +#else +#define CONTROL_MASK(flags) (NX_CONTROLMASK) +#endif /* NX_DEVICELCTLKEYMASK */ + +#ifdef NX_DEVICELSHIFTKEYMASK +#define SHIFT_MASK(flags) (flags & (NX_DEVICELSHIFTKEYMASK|NX_DEVICERSHIFTKEYMASK)) +#else +#define SHIFT_MASK(flags) (NX_SHIFTMASK) +#endif /* NX_DEVICELSHIFTKEYMASK */ + +#ifdef NX_DEVICELCMDKEYMASK +#define COMMAND_MASK(flags) (flags & (NX_DEVICELCMDKEYMASK|NX_DEVICERCMDKEYMASK)) +#else +#define COMMAND_MASK(flags) (NX_COMMANDMASK) +#endif /* NX_DEVICELCMDKEYMASK */ + +#ifdef NX_DEVICELALTKEYMASK +#define ALTERNATE_MASK(flags) (flags & (NX_DEVICELALTKEYMASK|NX_DEVICERALTKEYMASK)) +#else +#define ALTERNATE_MASK(flags) (NX_ALTERNATEMASK) +#endif /* NX_DEVICELALTKEYMASK */ /* * DarwinUpdateModifiers @@ -108,16 +132,16 @@ DarwinPressModifierMask(xe, NX_ALPHASHIFTMASK); } if (flags & NX_COMMANDMASK) { - DarwinPressModifierMask(xe, NX_COMMANDMASK); + DarwinPressModifierMask(xe, COMMAND_MASK(flags)); } if (flags & NX_CONTROLMASK) { - DarwinPressModifierMask(xe, NX_CONTROLMASK); + DarwinPressModifierMask(xe, CONTROL_MASK(flags)); } if (flags & NX_ALTERNATEMASK) { - DarwinPressModifierMask(xe, NX_ALTERNATEMASK); + DarwinPressModifierMask(xe, ALTERNATE_MASK(flags)); } if (flags & NX_SHIFTMASK) { - DarwinPressModifierMask(xe, NX_SHIFTMASK); + DarwinPressModifierMask(xe, SHIFT_MASK(flags)); } if (flags & NX_SECONDARYFNMASK) { DarwinPressModifierMask(xe, NX_SECONDARYFNMASK); @@ -201,10 +225,10 @@ * is "unnecessary", but very useful */ if (e->u.keyButtonPointer.time < darwinEventQueue.lastEventTime && - darwinEventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000) + darwinEventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000) { - darwinEventQueue.events[oldtail].event.u.keyButtonPointer.time = - darwinEventQueue.lastEventTime; + darwinEventQueue.events[oldtail].event.u.keyButtonPointer.time = + darwinEventQueue.lastEventTime; } darwinEventQueue.events[oldtail].pScreen = darwinEventQueue.pEnqueueScreen; @@ -236,7 +260,7 @@ { darwinEventQueue.pEnqueueScreen = pScreen; if (fromDIX) - darwinEventQueue.pDequeueScreen = pScreen; + darwinEventQueue.pDequeueScreen = pScreen; } @@ -246,10 +270,10 @@ */ void ProcessInputEvents(void) { - EventRec *e; - int x, y; - xEvent xe; - static int old_flags = 0; // last known modifier state + EventRec *e; + int x, y; + xEvent xe; + static int old_flags = 0; // last known modifier state // button number and modifier mask of currently pressed fake button static int darwinFakeMouseButtonDown = 0; static int darwinFakeMouseButtonMask = 0; @@ -262,10 +286,10 @@ while (darwinEventQueue.head != darwinEventQueue.tail) { - if (screenIsSaved == SCREEN_SAVER_ON) - SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset); + if (screenIsSaved == SCREEN_SAVER_ON) + SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset); - e = &darwinEventQueue.events[darwinEventQueue.head]; + e = &darwinEventQueue.events[darwinEventQueue.head]; xe = e->event; // Shift from global screen coordinates to coordinates relative to @@ -275,36 +299,36 @@ xe.u.keyButtonPointer.rootY -= darwinMainScreenY + dixScreenOrigins[miPointerCurrentScreen()->myNum].y; - /* - * Assumption - screen switching can only occur on motion events - */ - if (e->pScreen != darwinEventQueue.pDequeueScreen) - { - darwinEventQueue.pDequeueScreen = e->pScreen; - x = xe.u.keyButtonPointer.rootX; - y = xe.u.keyButtonPointer.rootY; - if (darwinEventQueue.head == QUEUE_SIZE - 1) - darwinEventQueue.head = 0; - else - ++darwinEventQueue.head; - NewCurrentScreen (darwinEventQueue.pDequeueScreen, x, y); - } - else - { - if (darwinEventQueue.head == QUEUE_SIZE - 1) - darwinEventQueue.head = 0; - else - ++darwinEventQueue.head; - switch (xe.u.u.type) - { - case KeyPress: - case KeyRelease: + /* + * Assumption - screen switching can only occur on motion events + */ + if (e->pScreen != darwinEventQueue.pDequeueScreen) + { + darwinEventQueue.pDequeueScreen = e->pScreen; + x = xe.u.keyButtonPointer.rootX; + y = xe.u.keyButtonPointer.rootY; + if (darwinEventQueue.head == QUEUE_SIZE - 1) + darwinEventQueue.head = 0; + else + ++darwinEventQueue.head; + NewCurrentScreen (darwinEventQueue.pDequeueScreen, x, y); + } + else + { + if (darwinEventQueue.head == QUEUE_SIZE - 1) + darwinEventQueue.head = 0; + else + ++darwinEventQueue.head; + switch (xe.u.u.type) + { + case KeyPress: + case KeyRelease: xe.u.u.detail += MIN_KEYCODE; - (*darwinEventQueue.pKbd->processInputProc) - (&xe, (DeviceIntPtr)darwinEventQueue.pKbd, 1); - break; + (*darwinEventQueue.pKbd->processInputProc) + (&xe, (DeviceIntPtr)darwinEventQueue.pKbd, 1); + break; - case ButtonPress: + case ButtonPress: miPointerAbsoluteCursor(xe.u.keyButtonPointer.rootX, xe.u.keyButtonPointer.rootY, xe.u.keyButtonPointer.time); @@ -362,7 +386,7 @@ miPointerAbsoluteCursor(xe.u.keyButtonPointer.rootX, xe.u.keyButtonPointer.rootY, xe.u.keyButtonPointer.time); - break; + break; case kXDarwinUpdateModifiers: { @@ -400,7 +424,7 @@ xe.u.u.type = ButtonRelease; } (*darwinEventQueue.pPtr->processInputProc) - (&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1); + (&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1); } } break; @@ -431,8 +455,8 @@ default: // Check for mode specific event DarwinModeProcessEvent(&xe); - } - } + } + } } miPointerUpdate(); Index: xc/programs/Xserver/hw/darwin/darwinKeyboard.c diff -u xc/programs/Xserver/hw/darwin/darwinKeyboard.c:1.19 xc/programs/Xserver/hw/darwin/darwinKeyboard.c:1.21 --- xc/programs/Xserver/hw/darwin/darwinKeyboard.c:1.19 Sat Nov 1 03:13:08 2003 +++ xc/programs/Xserver/hw/darwin/darwinKeyboard.c Wed Mar 31 19:05:22 2004 @@ -4,6 +4,7 @@ // // Copyright (c) 2001-2003 Torrey T. Lyons. All Rights Reserved. // Copyright (c) 2003 Apple Computer, Inc. All Rights Reserved. +// Copyright 2004 Kaleb S. KEITHLEY. All Rights Reserved. // // The code to parse the Darwin keymap is derived from dumpkeymap.c // by Eric Sunshine, which includes the following copyright: @@ -37,7 +38,7 @@ // //============================================================================= -/* $XFree86: xc/programs/Xserver/hw/darwin/darwinKeyboard.c,v 1.19 2003/11/01 08:13:08 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/darwinKeyboard.c,v 1.21 2004/04/01 00:05:22 torrey Exp $ */ /* =========================================================================== @@ -80,7 +81,7 @@ // FIXME: It would be nice to support some of the extra keys in XF86keysym.h, // at least the volume controls that now ship on every Apple keyboard. -#define UK(a) NoSymbol // unknown symbol +#define UK(a) NoSymbol // unknown symbol static KeySym const next_to_x[256] = { NoSymbol, NoSymbol, NoSymbol, XK_KP_Enter, @@ -169,13 +170,13 @@ XK_thorn, XK_ydiaeresis, NoSymbol, NoSymbol, }; -#define MIN_SYMBOL 0xAC +#define MIN_SYMBOL 0xAC static KeySym const symbol_to_x[] = { XK_Left, XK_Up, XK_Right, XK_Down }; int const NUM_SYMBOL = sizeof(symbol_to_x) / sizeof(symbol_to_x[0]); -#define MIN_FUNCKEY 0x20 +#define MIN_FUNCKEY 0x20 static KeySym const funckey_to_x[] = { XK_F1, XK_F2, XK_F3, XK_F4, XK_F5, XK_F6, XK_F7, XK_F8, @@ -187,8 +188,8 @@ int const NUM_FUNCKEY = sizeof(funckey_to_x) / sizeof(funckey_to_x[0]); typedef struct { - KeySym normalSym; - KeySym keypadSym; + KeySym normalSym; + KeySym keypadSym; } darwinKeyPad_t; static darwinKeyPad_t const normal_to_keypad[] = { @@ -549,36 +550,36 @@ // If AlphaLock and Shift modifiers produce different codes, // we record the Shift case since X handles AlphaLock. - if (charGenMask & 0x01) { // AlphaLock + if (charGenMask & 0x01) { // AlphaLock parse_next_char_code( keyMapStream, k+1 ); numKeyCodes--; } - if (charGenMask & 0x02) { // Shift + if (charGenMask & 0x02) { // Shift parse_next_char_code( keyMapStream, k+1 ); numKeyCodes--; - if (charGenMask & 0x01) { // Shift-AlphaLock + if (charGenMask & 0x01) { // Shift-AlphaLock get_number(keyMapStream); get_number(keyMapStream); numKeyCodes--; } } // Skip the Control cases - if (charGenMask & 0x04) { // Control + if (charGenMask & 0x04) { // Control get_number(keyMapStream); get_number(keyMapStream); numKeyCodes--; - if (charGenMask & 0x01) { // Control-AlphaLock + if (charGenMask & 0x01) { // Control-AlphaLock get_number(keyMapStream); get_number(keyMapStream); numKeyCodes--; } - if (charGenMask & 0x02) { // Control-Shift + if (charGenMask & 0x02) { // Control-Shift get_number(keyMapStream); get_number(keyMapStream); numKeyCodes--; - if (charGenMask & 0x01) { // Shift-Control-AlphaLock + if (charGenMask & 0x01) { // Shift-Control-AlphaLock get_number(keyMapStream); get_number(keyMapStream); numKeyCodes--; } @@ -586,20 +587,20 @@ } // Process Alt cases - if (charGenMask & 0x08) { // Alt + if (charGenMask & 0x08) { // Alt parse_next_char_code( keyMapStream, k+2 ); numKeyCodes--; - if (charGenMask & 0x01) { // Alt-AlphaLock + if (charGenMask & 0x01) { // Alt-AlphaLock parse_next_char_code( keyMapStream, k+3 ); numKeyCodes--; } - if (charGenMask & 0x02) { // Alt-Shift + if (charGenMask & 0x02) { // Alt-Shift parse_next_char_code( keyMapStream, k+3 ); numKeyCodes--; - if (charGenMask & 0x01) { // Alt-Shift-AlphaLock + if (charGenMask & 0x01) { // Alt-Shift-AlphaLock get_number(keyMapStream); get_number(keyMapStream); numKeyCodes--; } @@ -675,7 +676,7 @@ for (i = 0; i < NUM_KEYCODES; i++) { - k = info->keyMap + i * GLYPHS_PER_KEY; + k = info->keyMap + i * GLYPHS_PER_KEY; switch (k[0]) { case XK_Shift_L: @@ -684,7 +685,11 @@ break; case XK_Shift_R: - info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][1] = i; +#ifdef NX_MODIFIERKEY_RSHIFT + info->modifierKeycodes[NX_MODIFIERKEY_RSHIFT][0] = i; +#else + info->modifierKeycodes[NX_MODIFIERKEY_SHIFT][0] = i; +#endif info->modMap[MIN_KEYCODE + i] = ShiftMask; break; @@ -694,7 +699,11 @@ break; case XK_Control_R: - info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][1] = i; +#ifdef NX_MODIFIERKEY_RCONTROL + info->modifierKeycodes[NX_MODIFIERKEY_RCONTROL][0] = i; +#else + info->modifierKeycodes[NX_MODIFIERKEY_CONTROL][0] = i; +#endif info->modMap[MIN_KEYCODE + i] = ControlMask; break; @@ -709,7 +718,11 @@ break; case XK_Alt_R: - info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][1] = i; +#ifdef NX_MODIFIERKEY_RALTERNATE + info->modifierKeycodes[NX_MODIFIERKEY_RALTERNATE][0] = i; +#else + info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i; +#endif info->modMap[MIN_KEYCODE + i] = Mod1Mask; break; @@ -723,37 +736,41 @@ break; case XK_Meta_R: - info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][1] = i; +#ifdef NX_MODIFIERKEY_RCOMMAND + info->modifierKeycodes[NX_MODIFIERKEY_RCOMMAND][0] = i; +#else + info->modifierKeycodes[NX_MODIFIERKEY_COMMAND][0] = i; +#endif info->modMap[MIN_KEYCODE + i] = Mod2Mask; break; case XK_Num_Lock: info->modMap[MIN_KEYCODE + i] = Mod3Mask; break; - } + } if (darwinSwapAltMeta) { - switch (k[0]) - { - case XK_Alt_L: - k[0] = XK_Meta_L; + switch (k[0]) + { + case XK_Alt_L: + k[0] = XK_Meta_L; break; - case XK_Alt_R: - k[0] = XK_Meta_R; + case XK_Alt_R: + k[0] = XK_Meta_R; break; - case XK_Meta_L: - k[0] = XK_Alt_L; + case XK_Meta_L: + k[0] = XK_Alt_L; break; - case XK_Meta_R: - k[0] = XK_Alt_R; + case XK_Meta_R: + k[0] = XK_Alt_R; break; - } + } } #if ALT_IS_MODE_SWITCH - if (k[0] == XK_Alt_L || k[0] == XK_Alt_R) - k[0] = XK_Mode_switch; + if (k[0] == XK_Alt_L) + k[0] = XK_Mode_switch; #endif } } @@ -844,14 +861,30 @@ int DarwinModifierNXMaskToNXKey(int mask) { switch (mask) { - case NX_ALPHASHIFTMASK: return NX_MODIFIERKEY_ALPHALOCK; - case NX_SHIFTMASK: return NX_MODIFIERKEY_SHIFT; - case NX_CONTROLMASK: return NX_MODIFIERKEY_CONTROL; - case NX_ALTERNATEMASK: return NX_MODIFIERKEY_ALTERNATE; - case NX_COMMANDMASK: return NX_MODIFIERKEY_COMMAND; - case NX_NUMERICPADMASK: return NX_MODIFIERKEY_NUMERICPAD; - case NX_HELPMASK: return NX_MODIFIERKEY_HELP; - case NX_SECONDARYFNMASK: return NX_MODIFIERKEY_SECONDARYFN; + case NX_ALPHASHIFTMASK: return NX_MODIFIERKEY_ALPHALOCK; + case NX_SHIFTMASK: return NX_MODIFIERKEY_SHIFT; +#ifdef NX_DEVICELSHIFTKEYMASK + case NX_DEVICELSHIFTKEYMASK: return NX_MODIFIERKEY_SHIFT; + case NX_DEVICERSHIFTKEYMASK: return NX_MODIFIERKEY_RSHIFT; +#endif + case NX_CONTROLMASK: return NX_MODIFIERKEY_CONTROL; +#ifdef NX_DEVICELCTLKEYMASK + case NX_DEVICELCTLKEYMASK: return NX_MODIFIERKEY_CONTROL; + case NX_DEVICERCTLKEYMASK: return NX_MODIFIERKEY_RCONTROL; +#endif + case NX_ALTERNATEMASK: return NX_MODIFIERKEY_ALTERNATE; +#ifdef NX_DEVICELALTKEYMASK + case NX_DEVICELALTKEYMASK: return NX_MODIFIERKEY_ALTERNATE; + case NX_DEVICERALTKEYMASK: return NX_MODIFIERKEY_RALTERNATE; +#endif + case NX_COMMANDMASK: return NX_MODIFIERKEY_COMMAND; +#ifdef NX_DEVICELCMDKEYMASK + case NX_DEVICELCMDKEYMASK: return NX_MODIFIERKEY_COMMAND; + case NX_DEVICERCMDKEYMASK: return NX_MODIFIERKEY_RCOMMAND; +#endif + case NX_NUMERICPADMASK: return NX_MODIFIERKEY_NUMERICPAD; + case NX_HELPMASK: return NX_MODIFIERKEY_HELP; + case NX_SECONDARYFNMASK: return NX_MODIFIERKEY_SECONDARYFN; } return -1; } @@ -865,9 +898,21 @@ switch (key) { case NX_MODIFIERKEY_ALPHALOCK: return NX_ALPHASHIFTMASK; case NX_MODIFIERKEY_SHIFT: return NX_SHIFTMASK; +#ifdef NX_MODIFIERKEY_RSHIFT + case NX_MODIFIERKEY_RSHIFT: return NX_SHIFTMASK; +#endif case NX_MODIFIERKEY_CONTROL: return NX_CONTROLMASK; +#ifdef NX_MODIFIERKEY_RCONTROL + case NX_MODIFIERKEY_RCONTROL: return NX_CONTROLMASK; +#endif case NX_MODIFIERKEY_ALTERNATE: return NX_ALTERNATEMASK; +#ifdef NX_MODIFIERKEY_RALTERNATE + case NX_MODIFIERKEY_RALTERNATE: return NX_ALTERNATEMASK; +#endif case NX_MODIFIERKEY_COMMAND: return NX_COMMANDMASK; +#ifdef NX_MODIFIERKEY_RCOMMAND + case NX_MODIFIERKEY_RCOMMAND: return NX_COMMANDMASK; +#endif case NX_MODIFIERKEY_NUMERICPAD: return NX_NUMERICPADMASK; case NX_MODIFIERKEY_HELP: return NX_HELPMASK; case NX_MODIFIERKEY_SECONDARYFN: return NX_SECONDARYFNMASK; Index: xc/programs/Xserver/hw/darwin/darwinXinput.c diff -u /dev/null xc/programs/Xserver/hw/darwin/darwinXinput.c:1.1 --- /dev/null Wed Mar 16 21:06:39 2005 +++ xc/programs/Xserver/hw/darwin/darwinXinput.c Fri May 28 03:44:00 2004 @@ -0,0 +1,310 @@ +/* $Xorg: stubs.c,v 1.4 2001/02/09 02:04:35 xorgcvs Exp $ */ + +/* + * X server support of the XINPUT extension for Darwin + * + * This is currently a copy of mi/stubs.c, but eventually this + * should include more complete XINPUT support. + */ + +/************************************************************ + +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. + +Copyright 1989 by Hewlett-Packard Company, Palo Alto, California. + + 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 name of Hewlett-Packard not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +********************************************************/ +/* $XFree86: xc/programs/Xserver/hw/darwin/darwinXinput.c,v 1.1 2004/05/28 07:44:00 torrey Exp $ */ + +#define NEED_EVENTS +#include "X.h" +#include "Xproto.h" +#include "inputstr.h" +#include "XI.h" +#include "XIproto.h" +#include "XIstubs.h" + +/*********************************************************************** + * + * Caller: ProcXChangeKeyboardDevice + * + * This procedure does the implementation-dependent portion of the work + * needed to change the keyboard device. + * + * The X keyboard device has a FocusRec. If the device that has been + * made into the new X keyboard did not have a FocusRec, + * ProcXChangeKeyboardDevice will allocate one for it. + * + * If you do not want clients to be able to focus the old X keyboard + * device, call DeleteFocusClassDeviceStruct to free the FocusRec. + * + * If you support input devices with keys that you do not want to be + * used as the X keyboard, you need to check for them here and return + * a BadDevice error. + * + * The default implementation is to do nothing (assume you do want + * clients to be able to focus the old X keyboard). The commented-out + * sample code shows what you might do if you don't want the default. + * + */ + +int +ChangeKeyboardDevice (old_dev, new_dev) + DeviceIntPtr old_dev; + DeviceIntPtr new_dev; + { + /*********************************************************************** + DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c * + **********************************************************************/ + return BadMatch; + } + + +/*********************************************************************** + * + * Caller: ProcXChangePointerDevice + * + * This procedure does the implementation-dependent portion of the work + * needed to change the pointer device. + * + * The X pointer device does not have a FocusRec. If the device that + * has been made into the new X pointer had a FocusRec, + * ProcXChangePointerDevice will free it. + * + * If you want clients to be able to focus the old pointer device that + * has now become accessible through the input extension, you need to + * add a FocusRec to it here. + * + * The XChangePointerDevice protocol request also allows the client + * to choose which axes of the new pointer device are used to move + * the X cursor in the X- and Y- directions. If the axes are different + * than the default ones, you need to keep track of that here. + * + * If you support input devices with valuators that you do not want to be + * used as the X pointer, you need to check for them here and return a + * BadDevice error. + * + * The default implementation is to do nothing (assume you don't want + * clients to be able to focus the old X pointer). The commented-out + * sample code shows what you might do if you don't want the default. + * + */ + +int +ChangePointerDevice ( + DeviceIntPtr old_dev, + DeviceIntPtr new_dev, + unsigned char x, + unsigned char y) + { + /*********************************************************************** + InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr* + + x_axis = x; * keep track of new x-axis* + y_axis = y; * keep track of new y-axis* + if (x_axis != 0 || y_axis != 1) + axes_changed = TRUE; * remember axes have changed* + else + axes_changed = FALSE; + *************************************************************************/ + return BadMatch; + } + +/*********************************************************************** + * + * Caller: ProcXCloseDevice + * + * Take care of implementation-dependent details of closing a device. + * Some implementations may actually close the device, others may just + * remove this clients interest in that device. + * + * The default implementation is to do nothing (assume all input devices + * are initialized during X server initialization and kept open). + * + */ + +void +CloseInputDevice (d, client) + DeviceIntPtr d; + ClientPtr client; + { + } + +/*********************************************************************** + * + * Caller: ProcXListInputDevices + * + * This is the implementation-dependent routine to initialize an input + * device to the point that information about it can be listed. + * Some implementations open all input devices when the server is first + * initialized, and never close them. Other implementations open only + * the X pointer and keyboard devices during server initialization, + * and only open other input devices when some client makes an + * XOpenDevice request. If some other process has the device open, the + * server may not be able to get information about the device to list it. + * + * This procedure should be used by implementations that do not initialize + * all input devices at server startup. It should do device-dependent + * initialization for any devices not previously initialized, and call + * AddInputDevice for each of those devices so that a DeviceIntRec will be + * created for them. + * + * The default implementation is to do nothing (assume all input devices + * are initialized during X server initialization and kept open). + * The commented-out sample code shows what you might do if you don't want + * the default. + * + */ + +void +AddOtherInputDevices () + { + /********************************************************************** + for each uninitialized device, do something like: + + DeviceIntPtr dev; + DeviceProc deviceProc; + pointer private; + + dev = (DeviceIntPtr) AddInputDevice(deviceProc, TRUE); + dev->public.devicePrivate = private; + RegisterOtherDevice(dev); + dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success); + ************************************************************************/ + + } + +/*********************************************************************** + * + * Caller: ProcXOpenDevice + * + * This is the implementation-dependent routine to open an input device. + * Some implementations open all input devices when the server is first + * initialized, and never close them. Other implementations open only + * the X pointer and keyboard devices during server initialization, + * and only open other input devices when some client makes an + * XOpenDevice request. This entry point is for the latter type of + * implementation. + * + * If the physical device is not already open, do it here. In this case, + * you need to keep track of the fact that one or more clients has the + * device open, and physically close it when the last client that has + * it open does an XCloseDevice. + * + * The default implementation is to do nothing (assume all input devices + * are opened during X server initialization and kept open). + * + */ + +void +OpenInputDevice (dev, client, status) + DeviceIntPtr dev; + ClientPtr client; + int *status; + { + } + +/**************************************************************************** + * + * Caller: ProcXSetDeviceMode + * + * Change the mode of an extension device. + * This function is used to change the mode of a device from reporting + * relative motion to reporting absolute positional information, and + * vice versa. + * The default implementation below is that no such devices are supported. + * + */ + +int +SetDeviceMode (client, dev, mode) + register ClientPtr client; + DeviceIntPtr dev; + int mode; + { + return BadMatch; + } + +/**************************************************************************** + * + * Caller: ProcXSetDeviceValuators + * + * Set the value of valuators on an extension input device. + * This function is used to set the initial value of valuators on + * those input devices that are capable of reporting either relative + * motion or an absolute position, and allow an initial position to be set. + * The default implementation below is that no such devices are supported. + * + */ + +int +SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators) + register ClientPtr client; + DeviceIntPtr dev; + int *valuators; + int first_valuator; + int num_valuators; + { + return BadMatch; + } + +/**************************************************************************** + * + * Caller: ProcXChangeDeviceControl + * + * Change the specified device controls on an extension input device. + * + */ + +int +ChangeDeviceControl (client, dev, control) + register ClientPtr client; + DeviceIntPtr dev; + xDeviceCtl *control; + { + switch (control->control) + { + case DEVICE_RESOLUTION: + return (BadMatch); + default: + return (BadMatch); + } + } Index: xc/programs/Xserver/hw/darwin/iokit/xfIOKit.c diff -u xc/programs/Xserver/hw/darwin/iokit/xfIOKit.c:1.3 xc/programs/Xserver/hw/darwin/iokit/xfIOKit.c:1.4 --- xc/programs/Xserver/hw/darwin/iokit/xfIOKit.c:1.3 Mon Dec 8 23:42:36 2003 +++ xc/programs/Xserver/hw/darwin/iokit/xfIOKit.c Thu Jun 17 19:27:41 2004 @@ -9,7 +9,7 @@ * **************************************************************/ /* - * Copyright (c) 2001-2002 Torrey T. Lyons. All Rights Reserved. + * Copyright (c) 2001-2004 Torrey T. Lyons. 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"), @@ -33,7 +33,7 @@ * holders shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written authorization. */ -/* $XFree86: xc/programs/Xserver/hw/darwin/iokit/xfIOKit.c,v 1.3 2003/12/09 04:42:36 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/iokit/xfIOKit.c,v 1.4 2004/06/17 23:27:41 torrey Exp $ */ #include "X.h" #include "Xproto.h" @@ -268,7 +268,7 @@ default: continue; } - + DarwinEQEnqueue(&xe); } } @@ -465,7 +465,9 @@ #ifdef __i386__ /* x86 in 8bit mode currently needs fixed color map... */ - if( pixelInfo.bitsPerComponent == 8 ) { + if (pixelInfo.bitsPerComponent == 8 && + pixelInfo.componentCount == 1) + { pixelInfo.pixelType = kIOFixedCLUTPixels; } #endif @@ -573,7 +575,7 @@ * XFIOKitShadowUpdate * Update the damaged regions of the shadow framebuffer on the screen. */ -static void XFIOKitShadowUpdate(ScreenPtr pScreen, +static void XFIOKitShadowUpdate(ScreenPtr pScreen, shadowBufPtr pBuf) { DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen); Index: xc/programs/Xserver/hw/darwin/quartz/Preferences.h diff -u xc/programs/Xserver/hw/darwin/quartz/Preferences.h:1.3 xc/programs/Xserver/hw/darwin/quartz/Preferences.h:1.4 --- xc/programs/Xserver/hw/darwin/quartz/Preferences.h:1.3 Mon Sep 15 20:36:12 2003 +++ xc/programs/Xserver/hw/darwin/quartz/Preferences.h Tue Jun 8 18:58:10 2004 @@ -25,7 +25,7 @@ * sale, use or other dealings in this Software without prior written * authorization. */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/Preferences.h,v 1.3 2003/09/16 00:36:12 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/Preferences.h,v 1.4 2004/06/08 22:58:10 torrey Exp $ */ #import @@ -84,6 +84,7 @@ + (void)setModeWindow:(BOOL)newModeWindow; + (void)setStartupHelp:(BOOL)newStartupHelp; + (void)setSystemBeep:(BOOL)newSystemBeep; ++ (void)setEnableKeyEquivalents:(BOOL)newKeyEquivs; + (void)setXinerama:(BOOL)newXinerama; + (void)setAddToPath:(BOOL)newAddToPath; + (void)setAddToPathString:(NSString *)newAddToPathString; @@ -110,6 +111,7 @@ + (BOOL)modeWindow; + (BOOL)startupHelp; + (BOOL)systemBeep; ++ (BOOL)enableKeyEquivalents; + (BOOL)xinerama; + (BOOL)addToPath; + (NSString *)addToPathString; Index: xc/programs/Xserver/hw/darwin/quartz/Preferences.m diff -u xc/programs/Xserver/hw/darwin/quartz/Preferences.m:1.4 xc/programs/Xserver/hw/darwin/quartz/Preferences.m:1.5 --- xc/programs/Xserver/hw/darwin/quartz/Preferences.m:1.4 Mon Sep 15 20:36:12 2003 +++ xc/programs/Xserver/hw/darwin/quartz/Preferences.m Tue Jun 8 18:58:10 2004 @@ -4,7 +4,7 @@ // This class keeps track of the user preferences. // /* - * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved. + * Copyright (c) 2002-2004 Torrey T. Lyons. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the @@ -30,7 +30,7 @@ * sale, use or other dealings in this Software without prior written * authorization. */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/Preferences.m,v 1.4 2003/09/16 00:36:12 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/Preferences.m,v 1.5 2004/06/08 22:58:10 torrey Exp $ */ #import "quartzCommon.h" @@ -49,6 +49,9 @@ #define STR(s) #s #define XSTRPATH(s) STR(s) +// Keys for user defaults dictionary +static NSString *X11EnableKeyEquivalentsKey = @"EnableKeyEquivalents"; + @implementation Preferences @@ -70,6 +73,7 @@ [NSNumber numberWithInt:0], @"SwitchKeyCode", [NSNumber numberWithInt:(NSCommandKeyMask | NSAlternateKeyMask)], @"SwitchModifiers", @"NO", @"UseSystemBeep", + @"YES", X11EnableKeyEquivalentsKey, @"YES", @"DockSwitch", @"NO", @"AllowMouseAccelChange", [NSNumber numberWithInt:qdCursor_Not8Bit], @"UseQDCursor", @@ -391,6 +395,14 @@ quartzUseSysBeep = newSystemBeep; } ++ (void)setEnableKeyEquivalents:(BOOL)newKeyEquivs +{ + [[NSUserDefaults standardUserDefaults] setBool:newKeyEquivs + forKey:X11EnableKeyEquivalentsKey]; + // Update the setting used by the X server thread + quartzEnableKeyEquivalents = newKeyEquivs; +} + + (void)setXinerama:(BOOL)newXinerama { [[NSUserDefaults standardUserDefaults] setBool:newXinerama @@ -537,6 +549,11 @@ return [[NSUserDefaults standardUserDefaults] boolForKey:@"UseSystemBeep"]; } ++ (BOOL)enableKeyEquivalents +{ + return [[NSUserDefaults standardUserDefaults] boolForKey:X11EnableKeyEquivalentsKey]; +} + + (BOOL)xinerama { return [[NSUserDefaults standardUserDefaults] boolForKey:@"Xinerama"]; Index: xc/programs/Xserver/hw/darwin/quartz/XServer.h diff -u xc/programs/Xserver/hw/darwin/quartz/XServer.h:1.17 xc/programs/Xserver/hw/darwin/quartz/XServer.h:1.19 --- xc/programs/Xserver/hw/darwin/quartz/XServer.h:1.17 Mon Nov 24 00:39:01 2003 +++ xc/programs/Xserver/hw/darwin/quartz/XServer.h Tue Jun 8 18:58:10 2004 @@ -29,7 +29,7 @@ * sale, use or other dealings in this Software without prior written * authorization. */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/XServer.h,v 1.17 2003/11/24 05:39:01 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/XServer.h,v 1.19 2004/06/08 22:58:10 torrey Exp $ */ #define BOOL xBOOL #include "Xproto.h" @@ -38,7 +38,7 @@ #import @interface XServer : NSObject { - // server state + // Server state int serverState; NSRecursiveLock *serverLock; NSMutableArray *pendingClients; @@ -48,6 +48,7 @@ BOOL quitWithoutQuery; BOOL pendingAppQuitReply; UInt32 mouseState; + unsigned short swallowedKey; BOOL sendServerEvents; BOOL x11Active; @@ -72,7 +73,7 @@ - (BOOL)translateEvent:(NSEvent *)anEvent; - (BOOL)getMousePosition:(xEvent *)xe fromEvent:(NSEvent *)anEvent; -+ (void)append:(NSString *)value toEnv:(NSString *)name; +- (NSString *)makeSafePath:(NSString *)path; - (BOOL)loadDisplayBundle; - (void)startX; Index: xc/programs/Xserver/hw/darwin/quartz/XServer.m diff -u xc/programs/Xserver/hw/darwin/quartz/XServer.m:1.20 xc/programs/Xserver/hw/darwin/quartz/XServer.m:1.24 --- xc/programs/Xserver/hw/darwin/quartz/XServer.m:1.20 Wed Nov 26 20:59:53 2003 +++ xc/programs/Xserver/hw/darwin/quartz/XServer.m Thu Jul 15 14:53:25 2004 @@ -34,7 +34,7 @@ * sale, use or other dealings in this Software without prior written * authorization. */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/XServer.m,v 1.20 2003/11/27 01:59:53 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/XServer.m,v 1.24 2004/07/15 18:53:25 torrey Exp $ */ #include "quartzCommon.h" @@ -82,11 +82,11 @@ } shellList_t; static shellList_t const shellList[] = { - { "csh", shell_C }, // standard C shell - { "tcsh", shell_C }, // ... needs no introduction - { "sh", shell_Bourne }, // standard Bourne shell - { "zsh", shell_Bourne }, // Z shell - { "bash", shell_Bourne }, // GNU Bourne again shell + { "csh", shell_C }, // standard C shell + { "tcsh", shell_C }, // ... needs no introduction + { "sh", shell_Bourne }, // standard Bourne shell + { "zsh", shell_Bourne }, // Z shell + { "bash", shell_Bourne }, // GNU Bourne again shell { NULL, shell_Unknown } }; @@ -266,6 +266,7 @@ xe.u.u.type = ButtonRelease; xe.u.u.detail = 1; break; + case NSLeftMouseDown: [self getMousePosition:&xe fromEvent:anEvent]; if (quartzRootless) { @@ -285,6 +286,7 @@ xe.u.u.type = ButtonPress; xe.u.u.detail = 1; break; + case NSMouseMoved: case NSLeftMouseDragged: case NSRightMouseDragged: @@ -292,6 +294,7 @@ [self getMousePosition:&xe fromEvent:anEvent]; xe.u.u.type = MotionNotify; break; + case NSSystemDefined: { long hwButtons = [anEvent data2]; @@ -308,36 +311,56 @@ xe.u.clientMessage.u.l.longs1 =[anEvent data2]; break; } + case NSScrollWheel: [self getMousePosition:&xe fromEvent:anEvent]; xe.u.u.type = kXDarwinScrollWheel; - xe.u.clientMessage.u.s.shorts0 = [anEvent deltaY]; + xe.u.clientMessage.u.s.shorts0 = [anEvent deltaX] + + [anEvent deltaY]; break; + case NSKeyDown: case NSKeyUp: - if (!x11Active) + if (!x11Active) { + swallowedKey = 0; return NO; - // If the mouse is not on the valid X display area, - // we don't send the X server key events. - if (![self getMousePosition:&xe fromEvent:nil]) - return NO; - if (type == NSKeyDown) - xe.u.u.type = KeyPress; - else - xe.u.u.type = KeyRelease; + } + + if (type == NSKeyDown) { + // If the mouse is not on the valid X display area, + // don't send the X server key events. + if (![self getMousePosition:&xe fromEvent:nil]) { + swallowedKey = [anEvent keyCode]; + return NO; + } + + // See if there are any global shortcuts for this key combo. + if (quartzEnableKeyEquivalents + && [[NSApp mainMenu] performKeyEquivalent:anEvent]) + { + swallowedKey = [anEvent keyCode]; + return YES; + } + } else { + // If the down key event was a valid key combo, + // don't pass the up event to X11. + if (swallowedKey != 0 && [anEvent keyCode] == swallowedKey) { + swallowedKey = 0; + return NO; + } + } + + xe.u.u.type = (type == NSKeyDown) ? KeyPress : KeyRelease; xe.u.u.detail = [anEvent keyCode]; break; + case NSFlagsChanged: if (!x11Active) return NO; - [self getMousePosition:&xe fromEvent:nil]; xe.u.u.type = kXDarwinUpdateModifiers; xe.u.clientMessage.u.l.longs0 = flags; break; - case NSOtherMouseDown: // undocumented MouseDown - case NSOtherMouseUp: // undocumented MouseUp - // Hide these from AppKit to avoid its log messages - return YES; + default: return NO; } @@ -394,14 +417,33 @@ } } -// Append a string to the given enviroment variable -+ (void)append:(NSString*)value toEnv:(NSString*)name + +// Make a safe path +// +// Return the path in single quotes in case there are problematic characters in it. +// We still have to worry about there being single quotes in the path. So, replace +// all instances of the ' character in the path with '\''. +- (NSString *)makeSafePath:(NSString *)path { - setenv([name cString], - [[[NSString stringWithCString:getenv([name cString])] - stringByAppendingString:value] cString],1); + NSMutableString *safePath = [NSMutableString stringWithString:path]; + NSRange aRange = NSMakeRange(0, [safePath length]); + + while (aRange.length) { + aRange = [safePath rangeOfString:@"'" options:0 range:aRange]; + if (!aRange.length) + break; + [safePath replaceCharactersInRange:aRange + withString:@"\'\\'\'"]; + aRange.location += 4; + aRange.length = [safePath length] - aRange.location; + } + + safePath = [NSMutableString stringWithFormat:@"'%@'", safePath]; + + return safePath; } + - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Block SIGPIPE @@ -487,13 +529,21 @@ if (![self loadDisplayBundle]) [NSApp terminate:nil]; - // In rootless mode register to receive notification of key window changes if (quartzRootless) { + // We need to track whether the key window is an X11 window [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowBecameKey:) name:NSWindowDidBecomeKeyNotification object:nil]; + + // Request notification of screen layout changes even when this + // is not the active application + [[NSDistributedNotificationCenter defaultCenter] + addObserver:self + selector:@selector(applicationDidChangeScreenParameters:) + name:NSApplicationDidChangeScreenParametersNotification + object:nil]; } // Start the X server thread @@ -580,8 +630,7 @@ { struct passwd *passwdUser; NSString *shellPath, *dashShellName, *commandStr, *startXPath; - NSMutableString *safeStartXPath; - NSRange aRange; + NSString *safeStartXPath; NSBundle *thisBundle; const char *shellPathStr, *newargv[3], *shellNameStr; int fd[2], outFD, length, shellType, i; @@ -644,11 +693,11 @@ // Inside the new process: if (fd[0] != STDIN_FILENO) { - dup2(fd[0], STDIN_FILENO); // Take stdin from pipe + dup2(fd[0], STDIN_FILENO); // Take stdin from pipe close(fd[0]); } - close(fd[1]); // Close write end of pipe - if (outFD == STDOUT_FILENO) { // Setup stdout and stderr + close(fd[1]); // Close write end of pipe + if (outFD == STDOUT_FILENO) { // Setup stdout and stderr dup2(outFD, STDERR_FILENO); } else if (outFD == STDERR_FILENO) { dup2(outFD, STDOUT_FILENO); @@ -684,28 +733,14 @@ return NO; } - // We will run the startXClients script with the path in single quotes - // in case there are problematic characters in the path. We still have - // to worry about there being single quotes in the path. So, replace - // all instances of the ' character in startXPath with '\''. - safeStartXPath = [NSMutableString stringWithString:startXPath]; - aRange = NSMakeRange(0, [safeStartXPath length]); - while (aRange.length) { - aRange = [safeStartXPath rangeOfString:@"'" options:0 range:aRange]; - if (!aRange.length) - break; - [safeStartXPath replaceCharactersInRange:aRange - withString:@"\'\\'\'"]; - aRange.location += 4; - aRange.length = [safeStartXPath length] - aRange.location; - } + safeStartXPath = [self makeSafePath:startXPath]; if ([Preferences addToPath]) { - commandStr = [NSString stringWithFormat:@"'%@' :%d %@\n", + commandStr = [NSString stringWithFormat:@"%@ :%d %@\n", safeStartXPath, [Preferences display], [Preferences addToPathString]]; } else { - commandStr = [NSString stringWithFormat:@"'%@' :%d\n", + commandStr = [NSString stringWithFormat:@"%@ :%d\n", safeStartXPath, [Preferences display]]; } @@ -725,7 +760,7 @@ // FIXME: This should be unified with startXClients - (void)runClient:(NSString *)filename { - const char *command = [filename UTF8String]; + const char *command = [[self makeSafePath:filename] UTF8String]; const char *shell; const char *argv[5]; int child1, child2 = 0; @@ -1176,10 +1211,10 @@ - (void)activateX11:(BOOL)state { if (state) { - QuartzMessageServerThread(kXDarwinActivate, 0); + QuartzMessageServerThread(kXDarwinActivate, 0); } else { - QuartzMessageServerThread(kXDarwinDeactivate, 0); + QuartzMessageServerThread(kXDarwinDeactivate, 0); } x11Active = state; @@ -1310,6 +1345,12 @@ * Application Delegate Methods */ +- (void)applicationDidChangeScreenParameters:(NSNotification *)aNotification +{ + if (quartzProcs->ScreenChanged) + quartzProcs->ScreenChanged(); +} + - (void)applicationDidHide:(NSNotification *)aNotification { if ((AppleWMSelectedEvents() & AppleWMControllerNotifyMask) != 0) { Index: xc/programs/Xserver/hw/darwin/quartz/pseudoramiX.c diff -u xc/programs/Xserver/hw/darwin/quartz/pseudoramiX.c:1.3 xc/programs/Xserver/hw/darwin/quartz/pseudoramiX.c:1.4 --- xc/programs/Xserver/hw/darwin/quartz/pseudoramiX.c:1.3 Wed Apr 30 19:15:39 2003 +++ xc/programs/Xserver/hw/darwin/quartz/pseudoramiX.c Thu Jul 1 21:30:33 2004 @@ -32,7 +32,7 @@ dealings in this Software without prior written authorization from Digital Equipment Corporation. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/pseudoramiX.c,v 1.3 2003/04/30 23:15:39 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/pseudoramiX.c,v 1.4 2004/07/02 01:30:33 torrey Exp $ */ #include "pseudoramiX.h" @@ -111,11 +111,15 @@ if (noPseudoramiXExtension) return; + /* Even with only one screen we need to enable PseudoramiX to allow + dynamic screen configuration changes. */ +#if 0 if (pseudoramiXNumScreens == 1) { // Only one screen - disable Xinerama extension. noPseudoramiXExtension = TRUE; return; } +#endif // The server must not run the PanoramiX operations. noPanoramiXExtension = TRUE; @@ -142,12 +146,18 @@ } -static void PseudoramiXResetProc(ExtensionEntry *extEntry) +void PseudoramiXResetScreens(void) { pseudoramiXNumScreens = 0; } +static void PseudoramiXResetProc(ExtensionEntry *extEntry) +{ + PseudoramiXResetScreens(); +} + + // was PanoramiX static int ProcPseudoramiXQueryVersion(ClientPtr client) { Index: xc/programs/Xserver/hw/darwin/quartz/pseudoramiX.h diff -u xc/programs/Xserver/hw/darwin/quartz/pseudoramiX.h:1.2 xc/programs/Xserver/hw/darwin/quartz/pseudoramiX.h:1.3 --- xc/programs/Xserver/hw/darwin/quartz/pseudoramiX.h:1.2 Wed Apr 30 19:15:39 2003 +++ xc/programs/Xserver/hw/darwin/quartz/pseudoramiX.h Thu Jul 1 21:30:33 2004 @@ -1,9 +1,10 @@ /* * Minimal implementation of PanoramiX/Xinerama */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/pseudoramiX.h,v 1.2 2003/04/30 23:15:39 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/pseudoramiX.h,v 1.3 2004/07/02 01:30:33 torrey Exp $ */ extern int noPseudoramiXExtension; void PseudoramiXAddScreen(int x, int y, int w, int h); void PseudoramiXExtensionInit(int argc, char *argv[]); +void PseudoramiXResetScreens(void); Index: xc/programs/Xserver/hw/darwin/quartz/quartz.c diff -u xc/programs/Xserver/hw/darwin/quartz/quartz.c:1.14 xc/programs/Xserver/hw/darwin/quartz/quartz.c:1.16 --- xc/programs/Xserver/hw/darwin/quartz/quartz.c:1.14 Mon Nov 24 00:39:02 2003 +++ xc/programs/Xserver/hw/darwin/quartz/quartz.c Thu Jul 1 21:30:33 2004 @@ -4,7 +4,7 @@ * **************************************************************/ /* - * Copyright (c) 2001-2003 Greg Parker and Torrey T. Lyons. + * Copyright (c) 2001-2004 Greg Parker and Torrey T. Lyons. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -29,7 +29,7 @@ * holders shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written authorization. */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/quartz.c,v 1.14 2003/11/24 05:39:02 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/quartz.c,v 1.16 2004/07/02 01:30:33 torrey Exp $ */ #include "quartzCommon.h" #include "quartz.h" @@ -42,7 +42,9 @@ // X headers #include "scrnintstr.h" +#include "windowstr.h" #include "colormapst.h" +#include "globals.h" // System headers #include @@ -56,6 +58,7 @@ int quartzRootless = -1; int quartzUseSysBeep = 0; int quartzUseAGL = 1; +int quartzEnableKeyEquivalents = 1; int quartzServerVisible = TRUE; int quartzServerQuitting = FALSE; int quartzScreenIndex = 0; @@ -165,13 +168,78 @@ /* + * QuartzUpdateScreens + * Adjust for screen arrangement changes. + */ +static void QuartzUpdateScreens(void) +{ + ScreenPtr pScreen; + WindowPtr pRoot; + int x, y, width, height, sx, sy; + xEvent e; + + if (noPseudoramiXExtension || screenInfo.numScreens != 1) + { + /* FIXME: if not using Xinerama, we have multiple screens, and + to do this properly may need to add or remove screens. Which + isn't possible. So don't do anything. Another reason why + we default to running with Xinerama. */ + + return; + } + + pScreen = screenInfo.screens[0]; + + PseudoramiXResetScreens(); + quartzProcs->AddPseudoramiXScreens(&x, &y, &width, &height); + + dixScreenOrigins[pScreen->myNum].x = x; + dixScreenOrigins[pScreen->myNum].y = y; + pScreen->mmWidth = pScreen->mmWidth * ((double) width / pScreen->width); + pScreen->mmHeight = pScreen->mmHeight * ((double) height / pScreen->height); + pScreen->width = width; + pScreen->height = height; + + /* FIXME: should probably do something with RandR here. */ + + DarwinAdjustScreenOrigins(&screenInfo); + quartzProcs->UpdateScreen(pScreen); + + sx = dixScreenOrigins[pScreen->myNum].x + darwinMainScreenX; + sy = dixScreenOrigins[pScreen->myNum].y + darwinMainScreenY; + + /* Adjust the root window. */ + pRoot = WindowTable[pScreen->myNum]; + AppleWMSetScreenOrigin(pRoot); + pScreen->ResizeWindow(pRoot, x - sx, y - sy, width, height, NULL); + pScreen->PaintWindowBackground(pRoot, &pRoot->borderClip, PW_BACKGROUND); +// QuartzIgnoreNextWarpCursor(); + DefineInitialRootWindow(pRoot); + + /* Send an event for the root reconfigure */ + e.u.u.type = ConfigureNotify; + e.u.configureNotify.window = pRoot->drawable.id; + e.u.configureNotify.aboveSibling = None; + e.u.configureNotify.x = x - sx; + e.u.configureNotify.y = y - sy; + e.u.configureNotify.width = width; + e.u.configureNotify.height = height; + e.u.configureNotify.borderWidth = wBorderWidth(pRoot); + e.u.configureNotify.override = pRoot->overrideRedirect; + DeliverEvents(pRoot, &e, 1, NullWindow); + + /* FIXME: Should we use RREditConnectionInfo(pScreen)? */ +} + + +/* * QuartzShow * Show the X server on screen. Does nothing if already shown. * Calls mode specific screen resume to restore the X clip regions * (if needed) and the X server cursor state. */ static void QuartzShow( - int x, // cursor location + int x, // cursor location int y ) { int i; @@ -251,10 +319,10 @@ max_args = 4; if (argc > 0 && argc <= max_args) { - va_start (args, argc); - for (i = 0; i < argc; i++) - argv[i] = (int) va_arg (args, int); - va_end (args); + va_start (args, argc); + for (i = 0; i < argc; i++) + argv[i] = (int) va_arg (args, int); + va_end (args); } DarwinEQEnqueue(&xe); @@ -307,8 +375,8 @@ case kXDarwinControllerNotify: AppleWMSendEvent(AppleWMControllerNotify, AppleWMControllerNotifyMask, - xe->u.clientMessage.u.l.longs0, - xe->u.clientMessage.u.l.longs1); + xe->u.clientMessage.u.l.longs0, + xe->u.clientMessage.u.l.longs1); break; case kXDarwinPasteboardNotify: @@ -319,6 +387,9 @@ break; case kXDarwinDisplayChanged: + QuartzUpdateScreens(); + break; + case kXDarwinWindowState: case kXDarwinWindowMoved: // FIXME: Not implemented yet Index: xc/programs/Xserver/hw/darwin/quartz/quartz.h diff -u xc/programs/Xserver/hw/darwin/quartz/quartz.h:1.8 xc/programs/Xserver/hw/darwin/quartz/quartz.h:1.10 --- xc/programs/Xserver/hw/darwin/quartz/quartz.h:1.8 Wed Nov 26 20:59:53 2003 +++ xc/programs/Xserver/hw/darwin/quartz/quartz.h Thu Jul 15 14:53:25 2004 @@ -30,7 +30,7 @@ * holders shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written authorization. */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/quartz.h,v 1.8 2003/11/27 01:59:53 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/quartz.h,v 1.10 2004/07/15 18:53:25 torrey Exp $ */ #ifndef _QUARTZ_H #define _QUARTZ_H @@ -67,6 +67,13 @@ typedef void (*ReleaseScreensProc)(void); /* + * Screen state change support + */ +typedef void (*ScreenChangedProc)(void); +typedef void (*AddPseudoramiXScreensProc)(int *x, int *y, int *width, int *height); +typedef void (*UpdateScreenProc)(ScreenPtr pScreen); + +/* * Rootless helper functions */ typedef Bool (*IsX11WindowProc)(void *nsWindow, int windowNumber); @@ -103,6 +110,10 @@ CaptureScreensProc CaptureScreens; // Only called in fullscreen ReleaseScreensProc ReleaseScreens; // Only called in fullscreen + ScreenChangedProc ScreenChanged; + AddPseudoramiXScreensProc AddPseudoramiXScreens; + UpdateScreenProc UpdateScreen; + IsX11WindowProc IsX11Window; HideWindowsProc HideWindows; Index: xc/programs/Xserver/hw/darwin/quartz/quartzCocoa.m diff -u xc/programs/Xserver/hw/darwin/quartz/quartzCocoa.m:1.4 xc/programs/Xserver/hw/darwin/quartz/quartzCocoa.m:1.5 --- xc/programs/Xserver/hw/darwin/quartz/quartzCocoa.m:1.4 Wed May 14 01:27:56 2003 +++ xc/programs/Xserver/hw/darwin/quartz/quartzCocoa.m Tue Jun 8 18:58:10 2004 @@ -8,7 +8,7 @@ * **************************************************************/ /* - * Copyright (c) 2001-2003 Torrey T. Lyons and Greg Parker. + * Copyright (c) 2001-2004 Torrey T. Lyons and Greg Parker. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -33,7 +33,7 @@ * holders shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written authorization. */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/quartzCocoa.m,v 1.4 2003/05/14 05:27:56 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/quartzCocoa.m,v 1.5 2004/06/08 22:58:10 torrey Exp $ */ #include "quartzCommon.h" @@ -64,6 +64,7 @@ darwinFakeMouse3Mask = [Preferences button3Mask]; darwinMouseAccelChange = [Preferences mouseAccelChange]; quartzUseSysBeep = [Preferences systemBeep]; + quartzEnableKeyEquivalents = [Preferences enableKeyEquivalents]; // quartzRootless has already been set if (quartzRootless) { Index: xc/programs/Xserver/hw/darwin/quartz/quartzCommon.h diff -u xc/programs/Xserver/hw/darwin/quartz/quartzCommon.h:1.14 xc/programs/Xserver/hw/darwin/quartz/quartzCommon.h:1.15 --- xc/programs/Xserver/hw/darwin/quartz/quartzCommon.h:1.14 Wed Nov 12 15:21:51 2003 +++ xc/programs/Xserver/hw/darwin/quartz/quartzCommon.h Tue Jun 8 18:58:10 2004 @@ -6,7 +6,7 @@ * This file should be included before any X11 or IOKit headers * so that it can avoid symbol conflicts. * - * Copyright (c) 2001-2003 Torrey T. Lyons and Greg Parker. + * Copyright (c) 2001-2004 Torrey T. Lyons and Greg Parker. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -31,7 +31,7 @@ * holders shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written authorization. */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/quartzCommon.h,v 1.14 2003/11/12 20:21:51 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/quartzCommon.h,v 1.15 2004/06/08 22:58:10 torrey Exp $ */ #ifndef _QUARTZCOMMON_H #define _QUARTZCOMMON_H @@ -69,6 +69,7 @@ extern int quartzRootless; extern int quartzUseSysBeep; extern int quartzUseAGL; +extern int quartzEnableKeyEquivalents; // Other shared data extern int quartzServerVisible; @@ -103,4 +104,4 @@ kQuartzSetCanQuit }; -#endif /* _QUARTZCOMMON_H */ +#endif /* _QUARTZCOMMON_H */ Index: xc/programs/Xserver/hw/darwin/quartz/quartzKeyboard.c diff -u xc/programs/Xserver/hw/darwin/quartz/quartzKeyboard.c:1.2 xc/programs/Xserver/hw/darwin/quartz/quartzKeyboard.c:1.3 --- xc/programs/Xserver/hw/darwin/quartz/quartzKeyboard.c:1.2 Sun Jan 18 20:22:47 2004 +++ xc/programs/Xserver/hw/darwin/quartz/quartzKeyboard.c Wed Mar 31 17:29:10 2004 @@ -32,7 +32,7 @@ promote the sale, use or other dealings in this Software without prior written authorization. */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/quartzKeyboard.c,v 1.2 2004/01/19 01:22:47 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/quartzKeyboard.c,v 1.3 2004/03/31 22:29:10 torrey Exp $ */ #include "quartzCommon.h" @@ -72,6 +72,7 @@ {60, XK_Shift_R}, {61, XK_Alt_R}, {62, XK_Control_R}, + {63, XK_Meta_R}, {122, XK_F1}, {120, XK_F2}, Index: xc/programs/Xserver/hw/darwin/quartz/rootlessAqua.h diff -u xc/programs/Xserver/hw/darwin/quartz/rootlessAqua.h:1.2 xc/programs/Xserver/hw/darwin/quartz/rootlessAqua.h:removed --- xc/programs/Xserver/hw/darwin/quartz/rootlessAqua.h:1.2 Wed Apr 30 19:15:39 2003 +++ xc/programs/Xserver/hw/darwin/quartz/rootlessAqua.h Wed Mar 16 21:06:41 2005 @@ -1,16 +0,0 @@ -/* - * Rootless setup for Aqua - * - * Greg Parker gparker@cs.stanford.edu - */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/rootlessAqua.h,v 1.2 2003/04/30 23:15:39 torrey Exp $ */ - -#ifndef _ROOTLESSAQUA_H -#define _ROOTLESSAQUA_H - -Bool AquaAddScreen(int index, ScreenPtr pScreen); -Bool AquaSetupScreen(int index, ScreenPtr pScreen); -void AquaDisplayInit(void); -void AquaInitInput(int argc, char **argv); - -#endif /* _ROOTLESSAQUA_H */ Index: xc/programs/Xserver/hw/darwin/quartz/XDarwin.pbproj/project.pbxproj diff -u xc/programs/Xserver/hw/darwin/quartz/XDarwin.pbproj/project.pbxproj:1.23 xc/programs/Xserver/hw/darwin/quartz/XDarwin.pbproj/project.pbxproj:1.24 --- xc/programs/Xserver/hw/darwin/quartz/XDarwin.pbproj/project.pbxproj:1.23 Tue Dec 9 00:20:23 2003 +++ xc/programs/Xserver/hw/darwin/quartz/XDarwin.pbproj/project.pbxproj Tue Jun 8 18:51:23 2004 @@ -3,30 +3,38 @@ archiveVersion = 1; classes = { }; - objectVersion = 38; + objectVersion = 39; objects = { 01279092000747AA0A000002 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; path = XServer.m; refType = 4; + sourceTree = ""; }; 0127909600074AF60A000002 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; path = XApplication.m; refType = 4; + sourceTree = ""; }; 0127909800074B1A0A000002 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = XApplication.h; refType = 4; + sourceTree = ""; }; 015698ED003DF345CE6F79C2 = { isa = PBXFileReference; + lastKnownFileType = image.icns; path = XDarwin.icns; refType = 4; + sourceTree = ""; }; 0157A37D002CF6D7CE6F79C2 = { children = ( @@ -44,18 +52,24 @@ name = Credits.rtf; path = ""; refType = 4; + sourceTree = ""; }; 0157A37E002CF6D7CE6F79C2 = { isa = PBXFileReference; + lastKnownFileType = text.rtf; name = English; path = English.lproj/Credits.rtf; refType = 4; + sourceTree = ""; }; 015EDCEA004203A8CE6F79C2 = { + fallbackIsa = PBXFileReference; isa = PBXFrameworkReference; + lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; refType = 0; + sourceTree = ""; }; 018F40F2003E1902CE6F79C2 = { children = ( @@ -70,48 +84,63 @@ name = "X Server"; path = ..; refType = 4; + sourceTree = ""; }; 018F40F3003E1916CE6F79C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = darwin.c; refType = 4; + sourceTree = ""; }; 018F40F6003E1974CE6F79C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = darwinKeyboard.c; refType = 4; + sourceTree = ""; }; 018F40F8003E1979CE6F79C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = quartz.c; refType = 4; + sourceTree = ""; }; 018F40FA003E197ECE6F79C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = quartz.h; refType = 4; + sourceTree = ""; }; 018F40FC003E1983CE6F79C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = xfIOKit.c; refType = 4; + sourceTree = ""; }; 018F40FE003E1988CE6F79C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = xfIOKit.h; refType = 4; + sourceTree = ""; }; 018F4100003E19E4CE6F79C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = xfIOKitCursor.c; refType = 4; + sourceTree = ""; }; //010 //011 @@ -126,20 +155,26 @@ 021D6BA9003E1BACCE6F79C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = darwin.h; refType = 4; + sourceTree = ""; }; 02A1FEA6006D34BE416877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = xfIOKitStartup.c; refType = 4; + sourceTree = ""; }; 02A1FEA8006D38F0416877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = quartzStartup.c; refType = 4; + sourceTree = ""; }; 02E03CA000348209CE6F79C2 = { children = ( @@ -157,13 +192,16 @@ name = XDarwinHelp.html; path = ""; refType = 4; + sourceTree = ""; }; 02E03CA100348209CE6F79C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = English; path = English.lproj/XDarwinHelp.html; refType = 4; + sourceTree = ""; }; //020 //021 @@ -178,8 +216,10 @@ 0338412F0083BFE57F000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = quartzCursor.h; refType = 4; + sourceTree = ""; }; //030 //031 @@ -194,14 +234,18 @@ 04329610000763920A000002 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; path = Preferences.m; refType = 4; + sourceTree = ""; }; 04329611000763920A000002 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = Preferences.h; refType = 4; + sourceTree = ""; }; //040 //041 @@ -225,6 +269,7 @@ isa = PBXGroup; name = Classes; refType = 4; + sourceTree = ""; }; 089C165CFE840E0CC02AAC07 = { children = ( @@ -241,13 +286,16 @@ isa = PBXVariantGroup; name = InfoPlist.strings; refType = 4; + sourceTree = ""; }; 089C165DFE840E0CC02AAC07 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = English; path = English.lproj/InfoPlist.strings; refType = 4; + sourceTree = ""; }; //080 //081 @@ -260,9 +308,12 @@ //0A3 //0A4 0A79E19E004499A1CE6F79C2 = { + explicitFileType = wrapper.application; + fallbackIsa = PBXFileReference; isa = PBXApplicationReference; path = XDarwin.app; refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; }; 0A79E19F004499A1CE6F79C2 = { buildPhases = ( @@ -334,7 +385,7 @@ CFBundleExecutable XDarwin CFBundleGetInfoString - XDarwin 1.3.0, ©2001-2003 XFree86 Project, Inc. + XDarwin 1.4a1, ©2001-2004 XFree86 Project, Inc. CFBundleIconFile XDarwin.icns CFBundleIdentifier @@ -346,7 +397,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - XDarwin 1.3.0 + XDarwin 1.4a1 CFBundleSignature ???? CFBundleVersion @@ -454,12 +505,16 @@ isa = PBXGroup; name = "Linked Frameworks"; refType = 4; + sourceTree = ""; }; 1058C7A1FEA54F0111CA2CBB = { + fallbackIsa = PBXFileReference; isa = PBXFrameworkReference; + lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; refType = 0; + sourceTree = ""; }; 1058C7A2FEA54F0111CA2CBB = { children = ( @@ -469,6 +524,7 @@ isa = PBXGroup; name = "Other Frameworks"; refType = 4; + sourceTree = ""; }; //100 //101 @@ -496,13 +552,16 @@ name = Localizable.strings; path = ""; refType = 4; + sourceTree = ""; }; 1220774400712D2D416877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; refType = 4; + sourceTree = ""; }; 1220774500712D2D416877C2 = { fileRef = 1220774300712D2D416877C2; @@ -513,9 +572,11 @@ 1220774600712D75416877C2 = { fileEncoding = 10; isa = PBXFileReference; + lastKnownFileType = text.plist.strings; name = Japanese; path = Japanese.lproj/Localizable.strings; refType = 4; + sourceTree = ""; }; //120 //121 @@ -530,8 +591,10 @@ 170DFAFF00729A35416877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = XDarwinStartup.c; refType = 4; + sourceTree = ""; }; 170DFB0000729C86416877C2 = { children = ( @@ -544,6 +607,7 @@ name = IOKit; path = ../iokit; refType = 4; + sourceTree = ""; }; //170 //171 @@ -566,6 +630,7 @@ isa = PBXGroup; name = Products; refType = 4; + sourceTree = ""; }; //190 //191 @@ -593,13 +658,16 @@ name = InfoPlist.strings.cpp; path = ""; refType = 4; + sourceTree = ""; }; 1BD8DE4300B8A3567F000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; name = English; path = English.lproj/InfoPlist.strings.cpp; refType = 4; + sourceTree = ""; }; 1BD8DE4400B8A38E7F000001 = { children = ( @@ -617,33 +685,43 @@ name = XDarwinHelp.html.cpp; path = ""; refType = 4; + sourceTree = ""; }; 1BD8DE4500B8A38E7F000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; name = English; path = English.lproj/XDarwinHelp.html.cpp; refType = 4; + sourceTree = ""; }; 1BD8DE4700B8A3C77F000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = Japanese; path = Japanese.lproj/InfoPlist.strings.cpp; refType = 4; + sourceTree = ""; }; 1BD8DE4800B8A4167F000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; name = Japanese; path = Japanese.lproj/XDarwinHelp.html.cpp; refType = 4; + sourceTree = ""; }; 1BE4F84D0006C9890A000002 = { + fallbackIsa = PBXFileReference; isa = PBXFrameworkReference; + lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; refType = 0; + sourceTree = ""; }; //1B0 //1B1 @@ -658,8 +736,10 @@ 1C4A3109004D8F24CE6F79C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = XServer.h; refType = 4; + sourceTree = ""; }; //1C0 //1C1 @@ -674,15 +754,22 @@ 237A34C10076E37E7F000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = quartzAudio.c; refType = 4; + sourceTree = ""; }; 237A34C20076E37E7F000001 = { buildRules = ( ); buildSettings = { COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; OPTIMIZATION_CFLAGS = "-O0"; + ZERO_LINK = YES; }; isa = PBXBuildStyle; name = Development; @@ -692,6 +779,8 @@ ); buildSettings = { COPY_PHASE_STRIP = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + ZERO_LINK = NO; }; isa = PBXBuildStyle; name = Deployment; @@ -699,8 +788,10 @@ 237A34C40076F4F07F000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = quartzAudio.h; refType = 4; + sourceTree = ""; }; //230 //231 @@ -713,6 +804,8 @@ //293 //294 29B97313FDCFA39411CA2CEA = { + buildSettings = { + }; buildStyles = ( 237A34C20076E37E7F000001, 237A34C30076E37E7F000001, @@ -760,6 +853,7 @@ name = "Xmaster-Cocoa"; path = ""; refType = 4; + sourceTree = ""; }; 29B97315FDCFA39411CA2CEA = { children = ( @@ -769,6 +863,7 @@ name = "Other Sources"; path = ""; refType = 2; + sourceTree = SOURCE_ROOT; }; 29B97317FDCFA39411CA2CEA = { children = ( @@ -787,6 +882,7 @@ name = Resources; path = ../bundle; refType = 4; + sourceTree = ""; }; 29B97318FDCFA39411CA2CEA = { children = ( @@ -804,12 +900,15 @@ name = MainMenu.nib; path = ""; refType = 4; + sourceTree = ""; }; 29B97319FDCFA39411CA2CEA = { isa = PBXFileReference; + lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; refType = 4; + sourceTree = ""; }; 29B97323FDCFA39411CA2CEA = { children = ( @@ -820,18 +919,25 @@ name = Frameworks; path = ""; refType = 4; + sourceTree = ""; }; 29B97324FDCFA39411CA2CEA = { + fallbackIsa = PBXFileReference; isa = PBXFrameworkReference; + lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; refType = 0; + sourceTree = ""; }; 29B97325FDCFA39411CA2CEA = { + fallbackIsa = PBXFileReference; isa = PBXFrameworkReference; + lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; refType = 0; + sourceTree = ""; }; //290 //291 @@ -852,6 +958,7 @@ name = "Old Cocoa Imp"; path = ""; refType = 4; + sourceTree = ""; }; //320 //321 @@ -866,8 +973,10 @@ 3576829A0077B8F17F000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = quartzCursor.c; refType = 4; + sourceTree = ""; }; //350 //351 @@ -882,8 +991,10 @@ 3E74E03600863F047F000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = darwinClut8.h; refType = 4; + sourceTree = ""; }; //3E0 //3E1 @@ -916,50 +1027,65 @@ name = Quartz; path = ""; refType = 4; + sourceTree = ""; }; 43B962CF00617089416877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; path = quartzCocoa.m; refType = 4; + sourceTree = ""; }; 43B962D000617089416877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = quartzPasteboard.c; refType = 4; + sourceTree = ""; }; 43B962D100617089416877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = quartzPasteboard.h; refType = 4; + sourceTree = ""; }; 43B962E000617B49416877C2 = { isa = PBXFileReference; + lastKnownFileType = wrapper.nib; name = Japanese; path = Japanese.lproj/MainMenu.nib; refType = 4; + sourceTree = ""; }; 43B962E100617B49416877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = Japanese; path = Japanese.lproj/InfoPlist.strings; refType = 4; + sourceTree = ""; }; 43B962E200617B93416877C2 = { isa = PBXFileReference; + lastKnownFileType = text.rtf; name = Japanese; path = Japanese.lproj/Credits.rtf; refType = 4; + sourceTree = ""; }; 43B962E300617B93416877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = Japanese; path = Japanese.lproj/XDarwinHelp.html; refType = 4; + sourceTree = ""; }; //430 //431 @@ -1061,73 +1187,97 @@ "; }; 6E11A985048BDFEE006877C2 = { + explicitFileType = wrapper.cfbundle; + fallbackIsa = PBXFileReference; isa = PBXBundleReference; path = glxCGL.bundle; refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; }; 6E11A986048BDFFB006877C2 = { isa = PBXTargetDependency; target = 6E11A984048BDFEE006877C2; + targetProxy = 6EF7158A0676791C00556977; }; 6E5F5F0005537A1A008FEAD7 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = darwinKeyboard.h; refType = 4; + sourceTree = ""; }; 6E5F5F0105537A5F008FEAD7 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = quartzKeyboard.c; refType = 4; + sourceTree = ""; }; 6E5F5F030553815A008FEAD7 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = keysym2ucs.c; refType = 4; + sourceTree = ""; }; 6E5F5F040553815A008FEAD7 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = keysym2ucs.h; refType = 4; + sourceTree = ""; }; 6E6656EC048832CF006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = "x-hook.c"; refType = 4; + sourceTree = ""; }; 6E6656ED048832CF006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = "x-hook.h"; refType = 4; + sourceTree = ""; }; 6E6656F0048832EC006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = dri.c; refType = 4; + sourceTree = ""; }; 6E6656F1048832EC006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = dri.h; refType = 4; + sourceTree = ""; }; 6E6656F2048832EC006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = dristruct.h; refType = 4; + sourceTree = ""; }; 6E6656F3048832F9006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = appledri.c; refType = 4; + sourceTree = ""; }; 6E79040104FD5ED900EEC080 = { children = ( @@ -1139,24 +1289,31 @@ name = "Safe Alpha"; path = safeAlpha; refType = 4; + sourceTree = ""; }; 6E79040204FD5EDA00EEC080 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = safeAlpha.h; refType = 4; + sourceTree = ""; }; 6E79040304FD5EDA00EEC080 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = safeAlphaPicture.c; refType = 4; + sourceTree = ""; }; 6E79040404FD5EDA00EEC080 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = safeAlphaWindow.c; refType = 4; + sourceTree = ""; }; 6E79040A0500F05600EEC080 = { buildActionMask = 2147483647; @@ -1248,31 +1405,41 @@ "; }; 6E7904100500F05600EEC080 = { + explicitFileType = wrapper.cfbundle; + fallbackIsa = PBXFileReference; isa = PBXBundleReference; path = xpr.bundle; refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; }; 6E7904110500F33B00EEC080 = { isa = PBXTargetDependency; target = 6E79040F0500F05600EEC080; + targetProxy = 6EF715890676791C00556977; }; 6E97A0F2050798B100B8294C = { fileEncoding = 4; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = xprAppleWM.c; refType = 4; + sourceTree = ""; }; 6E97A0F305079B6500B8294C = { fileEncoding = 4; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; path = crAppleWM.m; refType = 4; + sourceTree = ""; }; 6E97A0F505079F9100B8294C = { fileEncoding = 4; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = applewmExt.h; refType = 4; + sourceTree = ""; }; 6EA0B3AF0544A9CC006877C2 = { children = ( @@ -1289,60 +1456,79 @@ name = Acceleration; path = accel; refType = 4; + sourceTree = ""; }; 6EA0B3B00544A9CC006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = rlAccel.h; refType = 4; + sourceTree = ""; }; 6EA0B3B10544A9CC006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = rlBlt.c; refType = 4; + sourceTree = ""; }; 6EA0B3B20544A9CC006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = rlCopy.c; refType = 4; + sourceTree = ""; }; 6EA0B3B30544A9CC006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = rlFill.c; refType = 4; + sourceTree = ""; }; 6EA0B3B40544A9CC006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = rlFillRect.c; refType = 4; + sourceTree = ""; }; 6EA0B3B50544A9CC006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = rlFillSpans.c; refType = 4; + sourceTree = ""; }; 6EA0B3B60544A9CC006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = rlGlyph.c; refType = 4; + sourceTree = ""; }; 6EA0B3B70544A9CC006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = rlSolid.c; refType = 4; + sourceTree = ""; }; 6EA8EEC80445E25C006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = rootlessConfig.h; refType = 4; + sourceTree = ""; }; 6EC4A64C042A9597006877C2 = { children = ( @@ -1362,54 +1548,71 @@ name = Rootless; path = ../../../miext/rootless; refType = 2; + sourceTree = SOURCE_ROOT; }; 6EC4A65D042A9654006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = rootless.h; refType = 4; + sourceTree = ""; }; 6EC4A65E042A9654006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = rootlessCommon.c; refType = 4; + sourceTree = ""; }; 6EC4A65F042A9654006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = rootlessCommon.h; refType = 4; + sourceTree = ""; }; 6EC4A660042A9654006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = rootlessWindow.h; refType = 4; + sourceTree = ""; }; 6EC4A661042A9654006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = rootlessScreen.c; refType = 4; + sourceTree = ""; }; 6EC4A662042A9654006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = rootlessWindow.c; refType = 4; + sourceTree = ""; }; 6EC4A663042A9654006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = rootlessGC.c; refType = 4; + sourceTree = ""; }; 6EC4A664042A9654006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = rootlessValTree.c; refType = 4; + sourceTree = ""; }; 6EC4A66D042A97FC006877C2 = { children = ( @@ -1433,24 +1636,31 @@ isa = PBXGroup; path = xpr; refType = 4; + sourceTree = ""; }; 6ECF218404589E4D006877C2 = { fileEncoding = 4; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = xpr.h; refType = 4; + sourceTree = ""; }; 6ECF218604589F40006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = xprCursor.c; refType = 4; + sourceTree = ""; }; 6EDDB2DF04508B2C006877C2 = { fileEncoding = 4; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = xprScreen.c; refType = 4; + sourceTree = ""; }; 6EE1214104968658006877C2 = { children = ( @@ -1464,42 +1674,55 @@ isa = PBXGroup; path = cr; refType = 4; + sourceTree = ""; }; 6EE1214204968692006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = cr.h; refType = 4; + sourceTree = ""; }; 6EE1214304968692006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; path = XView.m; refType = 4; + sourceTree = ""; }; 6EE1214404968692006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = XView.h; refType = 4; + sourceTree = ""; }; 6EE1214504968692006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; path = crFrame.m; refType = 4; + sourceTree = ""; }; 6EE1214604968692006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; path = crScreen.m; refType = 4; + sourceTree = ""; }; 6EE9B21604E859C200CA7FEA = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = applewm.c; refType = 4; + sourceTree = ""; }; 6EF065C003D4EE19006877C2 = { buildActionMask = 2147483647; @@ -1591,53 +1814,98 @@ "; }; 6EF065C603D4EE19006877C2 = { + explicitFileType = wrapper.cfbundle; + fallbackIsa = PBXFileReference; isa = PBXBundleReference; path = glxMesa.bundle; refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; }; 6EF065C703D4EE19006877C2 = { isa = PBXTargetDependency; target = 6EF065C503D4EE19006877C2; + targetProxy = 6EF7158B0676791C00556977; }; 6EF065C903D4F0CA006877C2 = { isa = PBXTargetDependency; target = 6EF7C58603D3BC6D00000104; + targetProxy = 6EF715880676791C00556977; }; 6EF4719E04478B08006877C2 = { fileEncoding = 4; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = xprFrame.c; refType = 4; + sourceTree = ""; }; 6EF471A004478DE0006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = Xplugin.h; refType = 4; + sourceTree = ""; }; 6EF471A204479263006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = "x-hash.c"; refType = 4; + sourceTree = ""; }; 6EF471A304479263006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = "x-list.h"; refType = 4; + sourceTree = ""; }; 6EF471A404479263006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = "x-hash.h"; refType = 4; + sourceTree = ""; }; 6EF471A504479263006877C2 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = "x-list.c"; refType = 4; + sourceTree = ""; + }; + 6EF715880676791C00556977 = { + containerPortal = 29B97313FDCFA39411CA2CEA; + isa = PBXContainerItemProxy; + proxyType = 1; + remoteGlobalIDString = 6EF7C58603D3BC6D00000104; + remoteInfo = glxAGL; + }; + 6EF715890676791C00556977 = { + containerPortal = 29B97313FDCFA39411CA2CEA; + isa = PBXContainerItemProxy; + proxyType = 1; + remoteGlobalIDString = 6E79040F0500F05600EEC080; + remoteInfo = xpr; + }; + 6EF7158A0676791C00556977 = { + containerPortal = 29B97313FDCFA39411CA2CEA; + isa = PBXContainerItemProxy; + proxyType = 1; + remoteGlobalIDString = 6E11A984048BDFEE006877C2; + remoteInfo = glxCGL; + }; + 6EF7158B0676791C00556977 = { + containerPortal = 29B97313FDCFA39411CA2CEA; + isa = PBXContainerItemProxy; + proxyType = 1; + remoteGlobalIDString = 6EF065C503D4EE19006877C2; + remoteInfo = glxMesa; }; 6EF7C58103D3BC6D00000104 = { buildActionMask = 2147483647; @@ -1728,9 +1996,12 @@ "; }; 6EF7C58703D3BC6D00000104 = { + explicitFileType = wrapper.cfbundle; + fallbackIsa = PBXFileReference; isa = PBXBundleReference; path = glxAGL.bundle; refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; }; //6E0 //6E1 @@ -1744,179 +2015,235 @@ //F54 F51BF62A02026DAF01000001 = { isa = PBXFileReference; + lastKnownFileType = wrapper.nib; name = Portuguese; path = Portuguese.lproj/MainMenu.nib; refType = 4; + sourceTree = ""; }; F51BF62B02026DDA01000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = Portuguese; path = Portuguese.lproj/InfoPlist.strings; refType = 4; + sourceTree = ""; }; F51BF62C02026E0601000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = Portuguese; path = Portuguese.lproj/InfoPlist.strings.cpp; refType = 4; + sourceTree = ""; }; F51BF62D02026E1C01000001 = { fileEncoding = 10; isa = PBXFileReference; + lastKnownFileType = text.plist.strings; name = Portuguese; path = Portuguese.lproj/Localizable.strings; refType = 4; + sourceTree = ""; }; F51BF62E02026E3501000001 = { isa = PBXFileReference; + lastKnownFileType = text.rtf; name = Portuguese; path = Portuguese.lproj/Credits.rtf; refType = 4; + sourceTree = ""; }; F51BF62F02026E5C01000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = Portuguese; path = Portuguese.lproj/XDarwinHelp.html; refType = 4; + sourceTree = ""; }; F51BF63002026E8D01000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; name = Portuguese; path = Portuguese.lproj/XDarwinHelp.html.cpp; refType = 4; + sourceTree = ""; }; F5269C2D01D5BC3501000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = pseudoramiX.c; refType = 4; + sourceTree = ""; }; F5269C2E01D5BC3501000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = pseudoramiX.h; refType = 4; + sourceTree = ""; }; F53321390193CB6A01000001 = { isa = PBXFileReference; + lastKnownFileType = wrapper.nib; name = German; path = German.lproj/MainMenu.nib; refType = 4; + sourceTree = ""; }; F533213A0193CBA201000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = German; path = German.lproj/InfoPlist.strings; refType = 4; + sourceTree = ""; }; F533213B0193CBB401000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = German; path = German.lproj/InfoPlist.strings.cpp; refType = 4; + sourceTree = ""; }; F533213C0193CBC901000001 = { fileEncoding = 10; isa = PBXFileReference; + lastKnownFileType = text.plist.strings; name = German; path = German.lproj/Localizable.strings; refType = 4; + sourceTree = ""; }; F533213D0193CBE001000001 = { isa = PBXFileReference; + lastKnownFileType = text.rtf; name = German; path = German.lproj/Credits.rtf; refType = 4; + sourceTree = ""; }; F533213E0193CBF401000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = German; path = German.lproj/XDarwinHelp.html; refType = 4; + sourceTree = ""; }; F533213F0193CC2501000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; name = German; path = German.lproj/XDarwinHelp.html.cpp; refType = 4; + sourceTree = ""; }; F53321400193CCF001000001 = { + fallbackIsa = PBXFileReference; isa = PBXFrameworkReference; + lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; refType = 0; + sourceTree = ""; }; F53321410193CCF001000001 = { + fallbackIsa = PBXFileReference; isa = PBXFrameworkReference; + lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; refType = 0; + sourceTree = ""; }; F533214201A4B3CE01000001 = { isa = PBXFileReference; + lastKnownFileType = wrapper.nib; name = Dutch; path = Dutch.lproj/MainMenu.nib; refType = 4; + sourceTree = ""; }; F533214301A4B3F001000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = Dutch; path = Dutch.lproj/InfoPlist.strings; refType = 4; + sourceTree = ""; }; F533214401A4B40F01000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = Dutch; path = Dutch.lproj/InfoPlist.strings.cpp; refType = 4; + sourceTree = ""; }; F533214501A4B42501000001 = { fileEncoding = 10; isa = PBXFileReference; + lastKnownFileType = text.plist.strings; name = Dutch; path = Dutch.lproj/Localizable.strings; refType = 4; + sourceTree = ""; }; F533214601A4B45401000001 = { isa = PBXFileReference; + lastKnownFileType = text.rtf; name = Dutch; path = Dutch.lproj/Credits.rtf; refType = 4; + sourceTree = ""; }; F533214701A4B48301000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = Dutch; path = Dutch.lproj/XDarwinHelp.html; refType = 4; + sourceTree = ""; }; F533214801A4B4D701000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; name = Dutch; path = Dutch.lproj/XDarwinHelp.html.cpp; refType = 4; + sourceTree = ""; }; F54BF6EA017D500901000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; path = startXClients.cpp; refType = 4; + sourceTree = ""; }; F54BF6EC017D506E01000001 = { isa = PBXFileReference; + lastKnownFileType = file; path = startXClients; refType = 4; + sourceTree = ""; }; F54BF6ED017D506E01000001 = { fileRef = F54BF6EC017D506E01000001; @@ -1927,14 +2254,18 @@ F5582948015DAD3B01000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; path = quartzCommon.h; refType = 4; + sourceTree = ""; }; F5614B3B0251124C01000114 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = fullscreen.c; refType = 4; + sourceTree = ""; }; F5614B3D025112D901000114 = { children = ( @@ -1945,200 +2276,259 @@ isa = PBXGroup; path = fullscreen; refType = 4; + sourceTree = ""; }; F587E16001924C1D01000001 = { isa = PBXFileReference; + lastKnownFileType = wrapper.nib; name = Swedish; path = Swedish.lproj/MainMenu.nib; refType = 4; + sourceTree = ""; }; F587E16101924C2F01000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = Swedish; path = Swedish.lproj/InfoPlist.strings; refType = 4; + sourceTree = ""; }; F587E16201924C5301000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = Swedish; path = Swedish.lproj/InfoPlist.strings.cpp; refType = 4; + sourceTree = ""; }; F587E16301924C5E01000001 = { fileEncoding = 10; isa = PBXFileReference; + lastKnownFileType = text.plist.strings; name = Swedish; path = Swedish.lproj/Localizable.strings; refType = 4; + sourceTree = ""; }; F587E16401924C6901000001 = { isa = PBXFileReference; + lastKnownFileType = text.rtf; name = Swedish; path = Swedish.lproj/Credits.rtf; refType = 4; + sourceTree = ""; }; F587E16501924C7401000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = Swedish; path = Swedish.lproj/XDarwinHelp.html; refType = 4; + sourceTree = ""; }; F587E16601924C9D01000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; name = Swedish; path = Swedish.lproj/XDarwinHelp.html.cpp; refType = 4; + sourceTree = ""; }; F58D65DB018F793801000001 = { isa = PBXFileReference; + lastKnownFileType = wrapper.nib; name = French; path = French.lproj/MainMenu.nib; refType = 4; + sourceTree = ""; }; F58D65DC018F794D01000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = French; path = French.lproj/InfoPlist.strings.cpp; refType = 4; + sourceTree = ""; }; F58D65DD018F798F01000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = French; path = French.lproj/InfoPlist.strings; refType = 4; + sourceTree = ""; }; F58D65DE018F79A001000001 = { fileEncoding = 10; isa = PBXFileReference; + lastKnownFileType = text.plist.strings; name = French; path = French.lproj/Localizable.strings; refType = 4; + sourceTree = ""; }; F58D65DF018F79B101000001 = { isa = PBXFileReference; + lastKnownFileType = text.rtf; name = French; path = French.lproj/Credits.rtf; refType = 4; + sourceTree = ""; }; F58D65E0018F79C001000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = French; path = French.lproj/XDarwinHelp.html; refType = 4; + sourceTree = ""; }; F58D65E1018F79E001000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; name = French; path = French.lproj/XDarwinHelp.html.cpp; refType = 4; + sourceTree = ""; }; F5A94EF10314BAC70100011B = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; path = darwinEvents.c; refType = 4; + sourceTree = ""; }; F5ACD25CC5B5E96601000001 = { isa = PBXFileReference; + lastKnownFileType = text.rtf; name = Spanish; path = Spanish.lproj/Credits.rtf; refType = 4; + sourceTree = ""; }; F5ACD25DC5B5E97701000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = Spanish; path = Spanish.lproj/InfoPlist.strings.cpp; refType = 4; + sourceTree = ""; }; F5ACD25EC5B5E98D01000001 = { isa = PBXFileReference; + lastKnownFileType = wrapper.nib; name = Spanish; path = Spanish.lproj/MainMenu.nib; refType = 4; + sourceTree = ""; }; F5ACD25FC5B5E9AA01000001 = { fileEncoding = 10; isa = PBXFileReference; + lastKnownFileType = text.plist.strings; name = Spanish; path = Spanish.lproj/Localizable.strings; refType = 4; + sourceTree = ""; }; F5ACD260C5B5E9DF01000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; name = Spanish; path = Spanish.lproj/XDarwinHelp.html.cpp; refType = 4; + sourceTree = ""; }; F5ACD261C5B5EA2001000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = Spanish; path = Spanish.lproj/XDarwinHelp.html; refType = 4; + sourceTree = ""; }; F5ACD262C5B5EA4D01000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = Spanish; path = Spanish.lproj/InfoPlist.strings; refType = 4; + sourceTree = ""; }; F5ACD263C5BE031F01000001 = { isa = PBXFileReference; + lastKnownFileType = text.rtf; name = ko; path = ko.lproj/Credits.rtf; refType = 4; + sourceTree = ""; }; F5ACD264C5BE035B01000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = ko; path = ko.lproj/InfoPlist.strings.cpp; refType = 4; + sourceTree = ""; }; F5ACD265C5BE038601000001 = { isa = PBXFileReference; + lastKnownFileType = wrapper.nib; name = ko; path = ko.lproj/MainMenu.nib; refType = 4; + sourceTree = ""; }; F5ACD266C5BE03C501000001 = { fileEncoding = 10; isa = PBXFileReference; + lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/Localizable.strings; refType = 4; + sourceTree = ""; }; F5ACD267C5BE03FC01000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = sourcecode.cpp.cpp; name = ko; path = ko.lproj/XDarwinHelp.html.cpp; refType = 4; + sourceTree = ""; }; F5ACD268C5BE046401000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = ko; path = ko.lproj/XDarwinHelp.html; refType = 4; + sourceTree = ""; }; F5ACD269C5BE049301000001 = { fileEncoding = 30; isa = PBXFileReference; + lastKnownFileType = file; name = ko; path = ko.lproj/InfoPlist.strings; refType = 4; + sourceTree = ""; }; }; rootObject = 29B97313FDCFA39411CA2CEA; Index: xc/programs/Xserver/hw/darwin/quartz/cr/Imakefile diff -u xc/programs/Xserver/hw/darwin/quartz/cr/Imakefile:1.2 xc/programs/Xserver/hw/darwin/quartz/cr/Imakefile:1.3 --- xc/programs/Xserver/hw/darwin/quartz/cr/Imakefile:1.2 Mon Sep 15 20:36:14 2003 +++ xc/programs/Xserver/hw/darwin/quartz/cr/Imakefile Thu Mar 18 21:05:29 2004 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/darwin/quartz/cr/Imakefile,v 1.2 2003/09/16 00:36:14 torrey Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/darwin/quartz/cr/Imakefile,v 1.3 2004/03/19 02:05:29 torrey Exp $ #include @@ -23,6 +23,10 @@ -I$(SERVERSRC)/miext/rootless/safeAlpha -I$(SERVERSRC)/Xext \ -I$(APPLEWMLIBSRC) +#if OSMajorVersion < 6 +DEFINES = -DDEFER_NSWINDOW +#endif + NormalLibraryObjectRule() NormalLibraryTarget(cr,$(OBJS)) Index: xc/programs/Xserver/hw/darwin/quartz/cr/crFrame.m diff -u xc/programs/Xserver/hw/darwin/quartz/cr/crFrame.m:1.8 xc/programs/Xserver/hw/darwin/quartz/cr/crFrame.m:1.9 --- xc/programs/Xserver/hw/darwin/quartz/cr/crFrame.m:1.8 Fri Dec 5 02:00:10 2003 +++ xc/programs/Xserver/hw/darwin/quartz/cr/crFrame.m Thu Mar 18 21:05:29 2004 @@ -27,7 +27,7 @@ * holders shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written authorization. */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/cr/crFrame.m,v 1.8 2003/12/05 07:00:10 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/cr/crFrame.m,v 1.9 2004/03/19 02:05:29 torrey Exp $ */ #include "quartzCommon.h" #include "cr.h" @@ -35,6 +35,7 @@ #undef BOOL #define BOOL xBOOL #include "rootless.h" +#include "windowstr.h" #undef BOOL WindowPtr nextWindowToFrame = NULL; @@ -78,7 +79,12 @@ theWindow = [[NSWindow alloc] initWithContentRect:bounds styleMask:theStyleMask backing:NSBackingStoreBuffered +#ifdef DEFER_NSWINDOW + defer:YES]; +#else defer:NO]; +#endif + if (!theWindow) return FALSE; [theWindow setBackgroundColor:[NSColor clearColor]]; // erase transparent @@ -95,6 +101,21 @@ [theWindow setContentView:theView]; [theWindow setInitialFirstResponder:theView]; +#ifdef DEFER_NSWINDOW + // We need the NSWindow to actually be created now. + // If we had to defer creating it, we have to order it + // onto the screen to force it to be created. + + if (pFrame->win->prevSib) { + CRWindowPtr crWinPtr = (CRWindowPtr) RootlessFrameForWindow( + pFrame->win->prevSib, FALSE); + int upperNum = [crWinPtr->window windowNumber]; + [theWindow orderWindow:NSWindowBelow relativeTo:upperNum]; + } else { + [theWindow orderFront:nil]; + } +#endif + [theWindow setAcceptsMouseMovedEvents:YES]; crWinPtr->window = theWindow; Index: xc/programs/Xserver/hw/darwin/quartz/cr/crScreen.m diff -u xc/programs/Xserver/hw/darwin/quartz/cr/crScreen.m:1.6 xc/programs/Xserver/hw/darwin/quartz/cr/crScreen.m:1.8 --- xc/programs/Xserver/hw/darwin/quartz/cr/crScreen.m:1.6 Wed Nov 26 20:59:53 2003 +++ xc/programs/Xserver/hw/darwin/quartz/cr/crScreen.m Thu Jul 15 14:53:25 2004 @@ -3,7 +3,7 @@ */ /* * Copyright (c) 2001 Greg Parker. All Rights Reserved. - * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved. + * Copyright (c) 2002-2004 Torrey T. Lyons. 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"), @@ -27,7 +27,7 @@ * holders shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written authorization. */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/cr/crScreen.m,v 1.6 2003/11/27 01:59:53 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/cr/crScreen.m,v 1.8 2004/07/15 18:53:25 torrey Exp $ */ #include "quartzCommon.h" #include "cr.h" @@ -78,6 +78,79 @@ /* + * CRAddPseudoramiXScreens + * Add a single virtual screen encompassing all the physical screens + * with PseudoramiX. + */ +static void +CRAddPseudoramiXScreens(int *x, int *y, int *width, int *height) +{ + int i; + NSRect unionRect = NSMakeRect(0, 0, 0, 0); + NSArray *screens = [NSScreen screens]; + + // Get the union of all screens (minus the menu bar on main screen) + for (i = 0; i < [screens count]; i++) { + NSScreen *screen = [screens objectAtIndex:i]; + NSRect frame = [screen frame]; + frame.origin.y = [[NSScreen mainScreen] frame].size.height - + frame.size.height - frame.origin.y; + if (NSEqualRects([screen frame], [[NSScreen mainScreen] frame])) { + frame.origin.y += aquaMenuBarHeight; + frame.size.height -= aquaMenuBarHeight; + } + unionRect = NSUnionRect(unionRect, frame); + } + + // Use unionRect as the screen size for the X server. + *x = unionRect.origin.x; + *y = unionRect.origin.y; + *width = unionRect.size.width; + *height = unionRect.size.height; + + // Tell PseudoramiX about the real screens. + // InitOutput() will move the big screen to (0,0), + // so compensate for that here. + for (i = 0; i < [screens count]; i++) { + NSScreen *screen = [screens objectAtIndex:i]; + NSRect frame = [screen frame]; + int j; + + // Skip this screen if it's a mirrored copy of an earlier screen. + for (j = 0; j < i; j++) { + if (NSEqualRects(frame, [[screens objectAtIndex:j] frame])) { + ErrorF("PseudoramiX screen %d is a mirror of screen %d.\n", + i, j); + break; + } + } + if (j < i) continue; // this screen is a mirrored copy + + frame.origin.y = [[NSScreen mainScreen] frame].size.height - + frame.size.height - frame.origin.y; + + if (NSEqualRects([screen frame], [[NSScreen mainScreen] frame])) { + frame.origin.y += aquaMenuBarHeight; + frame.size.height -= aquaMenuBarHeight; + } + + ErrorF("PseudoramiX screen %d added: %dx%d @ (%d,%d).\n", i, + (int)frame.size.width, (int)frame.size.height, + (int)frame.origin.x, (int)frame.origin.y); + + frame.origin.x -= unionRect.origin.x; + frame.origin.y -= unionRect.origin.y; + + ErrorF("PseudoramiX screen %d placed at X11 coordinate (%d,%d).\n", + i, (int)frame.origin.x, (int)frame.origin.y); + + PseudoramiXAddScreen(frame.origin.x, frame.origin.y, + frame.size.width, frame.size.height); + } +} + + +/* * CRScreenParams * Set the basic screen parameters. */ @@ -99,7 +172,6 @@ dfb->width = NSWidth(frame); dfb->height = NSHeight(frame); - dfb->pitch = (dfb->width) * (dfb->bitsPerPixel) / 8; // Shift the usable part of main screen down to avoid the menu bar. if (NSEqualRects(frame, [[NSScreen mainScreen] frame])) { @@ -108,69 +180,7 @@ } } else { - int i; - NSRect unionRect = NSMakeRect(0, 0, 0, 0); - NSArray *screens = [NSScreen screens]; - - // Get the union of all screens (minus the menu bar on main screen) - for (i = 0; i < [screens count]; i++) { - NSScreen *screen = [screens objectAtIndex:i]; - NSRect frame = [screen frame]; - frame.origin.y = [[NSScreen mainScreen] frame].size.height - - frame.size.height - frame.origin.y; - if (NSEqualRects([screen frame], [[NSScreen mainScreen] frame])) { - frame.origin.y += aquaMenuBarHeight; - frame.size.height -= aquaMenuBarHeight; - } - unionRect = NSUnionRect(unionRect, frame); - } - - // Use unionRect as the screen size for the X server. - dfb->x = unionRect.origin.x; - dfb->y = unionRect.origin.y; - dfb->width = unionRect.size.width; - dfb->height = unionRect.size.height; - dfb->pitch = (dfb->width) * (dfb->bitsPerPixel) / 8; - - // Tell PseudoramiX about the real screens. - // InitOutput() will move the big screen to (0,0), - // so compensate for that here. - for (i = 0; i < [screens count]; i++) { - NSScreen *screen = [screens objectAtIndex:i]; - NSRect frame = [screen frame]; - int j; - - // Skip this screen if it's a mirrored copy of an earlier screen. - for (j = 0; j < i; j++) { - if (NSEqualRects(frame, [[screens objectAtIndex:j] frame])) { - ErrorF("PseudoramiX screen %d is a mirror of screen %d.\n", - i, j); - break; - } - } - if (j < i) continue; // this screen is a mirrored copy - - frame.origin.y = [[NSScreen mainScreen] frame].size.height - - frame.size.height - frame.origin.y; - - if (NSEqualRects([screen frame], [[NSScreen mainScreen] frame])) { - frame.origin.y += aquaMenuBarHeight; - frame.size.height -= aquaMenuBarHeight; - } - - ErrorF("PseudoramiX screen %d added: %dx%d @ (%d,%d).\n", i, - (int)frame.size.width, (int)frame.size.height, - (int)frame.origin.x, (int)frame.origin.y); - - frame.origin.x -= unionRect.origin.x; - frame.origin.y -= unionRect.origin.y; - - ErrorF("PseudoramiX screen %d placed at X11 coordinate (%d,%d).\n", - i, (int)frame.origin.x, (int)frame.origin.y); - - PseudoramiXAddScreen(frame.origin.x, frame.origin.y, - frame.size.width, frame.size.height); - } + CRAddPseudoramiXScreens(&dfb->x, &dfb->y, &dfb->width, &dfb->height); } } @@ -194,8 +204,11 @@ dfb->colorType = TrueColor; - // No frame buffer - it's all in window pixmaps. - dfb->framebuffer = NULL; // malloc(dfb.pitch * dfb.height); + /* Passing zero width (pitch) makes miCreateScreenResources set the + screen pixmap to the framebuffer pointer, i.e. NULL. The generic + rootless code takes care of making this work. */ + dfb->pitch = 0; + dfb->framebuffer = NULL; // Get all CoreGraphics displays covered by this X11 display. cgRect = CGRectMake(dfb->x, dfb->y, dfb->width, dfb->height); @@ -250,6 +263,34 @@ /* + * CRScreenChanged + * Configuration of displays has changed. + */ +static void +CRScreenChanged(void) +{ + QuartzMessageServerThread(kXDarwinDisplayChanged, 0); +} + + +/* + * CRUpdateScreen + * Update screen after configuation change. + */ +static void +CRUpdateScreen(ScreenPtr pScreen) +{ + rootlessGlobalOffsetX = darwinMainScreenX; + rootlessGlobalOffsetY = darwinMainScreenY; + + AppleWMSetScreenOrigin(WindowTable[pScreen->myNum]); + + RootlessRepositionWindows(pScreen); + RootlessUpdateScreenPixmap(pScreen); +} + + +/* * CRInitInput * Finalize CR specific setup. */ @@ -299,11 +340,14 @@ QuartzResumeXCursor, NULL, // No capture or release in rootless mode NULL, + CRScreenChanged, + CRAddPseudoramiXScreens, + CRUpdateScreen, CRIsX11Window, NULL, // Cocoa NSWindows hide themselves RootlessFrameForWindow, TopLevelParent, - NULL, // No support for DRI surfaces + NULL, // No support for DRI surfaces NULL }; Index: xc/programs/Xserver/hw/darwin/quartz/fullscreen/fullscreen.c diff -u xc/programs/Xserver/hw/darwin/quartz/fullscreen/fullscreen.c:1.4 xc/programs/Xserver/hw/darwin/quartz/fullscreen/fullscreen.c:1.6 --- xc/programs/Xserver/hw/darwin/quartz/fullscreen/fullscreen.c:1.4 Mon Dec 8 23:41:27 2003 +++ xc/programs/Xserver/hw/darwin/quartz/fullscreen/fullscreen.c Thu Jul 15 14:53:25 2004 @@ -25,7 +25,7 @@ * holders shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written authorization. */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/fullscreen/fullscreen.c,v 1.4 2003/12/09 04:41:27 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/fullscreen/fullscreen.c,v 1.6 2004/07/15 18:53:25 torrey Exp $ */ #include "quartzCommon.h" #include "darwin.h" @@ -260,7 +260,7 @@ */ static void FSResumeScreen( ScreenPtr pScreen, - int x, // cursor location + int x, // cursor location int y ) { QuartzResumeXCursor(pScreen, x, y); @@ -536,18 +536,21 @@ FSDisplayInit, FSAddScreen, FSSetupScreen, - NULL, // Not needed + NULL, // Not needed QuartzInitCursor, QuartzReallySetCursor, FSSuspendScreen, FSResumeScreen, FSCapture, FSRelease, - NULL, // No rootless code in fullscreen + NULL, // No dynamic screen change support NULL, NULL, + NULL, // No rootless code in fullscreen NULL, - NULL, // No support for DRI surfaces + NULL, + NULL, + NULL, // No support for DRI surfaces NULL }; @@ -560,6 +563,6 @@ QuartzModeBundleInit(void) { quartzProcs = &fsModeProcs; - quartzOpenGLBundle = NULL; // Only Mesa support for now + quartzOpenGLBundle = NULL; // Only Mesa support for now return TRUE; } Index: xc/programs/Xserver/hw/darwin/quartz/xpr/xprScreen.c diff -u xc/programs/Xserver/hw/darwin/quartz/xpr/xprScreen.c:1.9 xc/programs/Xserver/hw/darwin/quartz/xpr/xprScreen.c:1.11 --- xc/programs/Xserver/hw/darwin/quartz/xpr/xprScreen.c:1.9 Wed Nov 26 20:59:53 2003 +++ xc/programs/Xserver/hw/darwin/quartz/xpr/xprScreen.c Thu Jul 15 14:53:25 2004 @@ -3,7 +3,7 @@ */ /* * Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved. - * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. + * Copyright (c) 2004 Torrey T. Lyons. 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"), @@ -27,7 +27,7 @@ * holders shall not be used in advertising or otherwise to promote the sale, * use or other dealings in this Software without prior written authorization. */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/xpr/xprScreen.c,v 1.9 2003/11/27 01:59:53 torrey Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/darwin/quartz/xpr/xprScreen.c,v 1.11 2004/07/15 18:53:25 torrey Exp $ */ #include "quartzCommon.h" #include "quartz.h" @@ -56,41 +56,42 @@ switch (type) { case XP_EVENT_DISPLAY_CHANGED: - QuartzMessageServerThread(kXDarwinDisplayChanged, 0); - break; + QuartzMessageServerThread(kXDarwinDisplayChanged, 0); + break; case XP_EVENT_WINDOW_STATE_CHANGED: - if (arg_size >= sizeof(xp_window_state_event)) + if (arg_size >= sizeof(xp_window_state_event)) { - const xp_window_state_event *ws_arg = arg; - QuartzMessageServerThread(kXDarwinWindowState, 2, + const xp_window_state_event *ws_arg = arg; + + QuartzMessageServerThread(kXDarwinWindowState, 2, ws_arg->id, ws_arg->state); - } - break; + } + break; case XP_EVENT_WINDOW_MOVED: - if (arg_size == sizeof(xp_window_id)) - { - xp_window_id id = * (xp_window_id *) arg; - - QuartzMessageServerThread(kXDarwinWindowMoved, 1, id); - } - break; + if (arg_size == sizeof(xp_window_id)) + { + xp_window_id id = * (xp_window_id *) arg; + + QuartzMessageServerThread(kXDarwinWindowMoved, 1, id); + } + break; case XP_EVENT_SURFACE_DESTROYED: case XP_EVENT_SURFACE_CHANGED: - if (arg_size == sizeof(xp_surface_id)) - { - int kind; - - if (type == XP_EVENT_SURFACE_DESTROYED) - kind = AppleDRISurfaceNotifyDestroyed; - else - kind = AppleDRISurfaceNotifyChanged; - - DRISurfaceNotify(*(xp_surface_id *) arg, kind); - } - break; + if (arg_size == sizeof(xp_surface_id)) + { + int kind; + + if (type == XP_EVENT_SURFACE_DESTROYED) + kind = AppleDRISurfaceNotifyDestroyed; + else + kind = AppleDRISurfaceNotifyChanged; + + DRISurfaceNotify(*(xp_surface_id *) arg, kind); + } + break; } } @@ -138,11 +139,12 @@ /* - * addPseudoramiXScreens - * Add a physical screen with PseudoramiX. + * xprAddPseudoramiXScreens + * Add a single virtual screen encompassing all the physical screens + * with PseudoramiX. */ static void -addPseudoramiXScreens(int *x, int *y, int *width, int *height) +xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height) { CGDisplayCount i, displayCount; CGDirectDisplayID *displayList = NULL; @@ -285,7 +287,7 @@ } else { - addPseudoramiXScreens(&dfb->x, &dfb->y, &dfb->width, &dfb->height); + xprAddPseudoramiXScreens(&dfb->x, &dfb->y, &dfb->width, &dfb->height); } /* Passing zero width (pitch) makes miCreateScreenResources set the @@ -327,6 +329,23 @@ /* + * xprUpdateScreen + * Update screen after configuation change. + */ +static void +xprUpdateScreen(ScreenPtr pScreen) +{ + rootlessGlobalOffsetX = darwinMainScreenX; + rootlessGlobalOffsetY = darwinMainScreenY; + + AppleWMSetScreenOrigin(WindowTable[pScreen->myNum]); + + RootlessRepositionWindows(pScreen); + RootlessUpdateScreenPixmap(pScreen); +} + + +/* * xprInitInput * Finalize xpr specific setup. */ @@ -357,6 +376,9 @@ QuartzResumeXCursor, NULL, // No capture or release in rootless mode NULL, + NULL, // Xplugin sends screen change events directly + xprAddPseudoramiXScreens, + xprUpdateScreen, xprIsX11Window, xprHideWindows, RootlessFrameForWindow, Index: xc/programs/Xserver/hw/darwin/quartz_1.3/Imakefile diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/Imakefile:1.1 xc/programs/Xserver/hw/darwin/quartz_1.3/Imakefile:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/Imakefile:1.1 Wed Mar 27 21:21:20 2002 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/Imakefile Wed Mar 16 21:06:42 2005 @@ -1,127 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/Imakefile,v 1.1 2002/03/28 02:21:20 torrey Exp $ - -#include - -LinkSourceFile(Preferences.m,../quartz) -LinkSourceFile(Preferences.h,../quartz) -LinkSourceFile(XApplication.m,../quartz) -LinkSourceFile(XApplication.h,../quartz) -LinkSourceFile(fakeBoxRec.h,../quartz) -LinkSourceFile(fullscreen.c,../quartz) -LinkSourceFile(fullscreen.h,../quartz) -LinkSourceFile(quartz.c,../quartz) -LinkSourceFile(quartz.h,../quartz) -LinkSourceFile(quartzAudio.c,../quartz) -LinkSourceFile(quartzAudio.h,../quartz) -LinkSourceFile(quartzCocoa.m,../quartz) -LinkSourceFile(quartzCommon.h,../quartz) -LinkSourceFile(quartzCursor.c,../quartz) -LinkSourceFile(quartzCursor.h,../quartz) -LinkSourceFile(quartzPasteboard.c,../quartz) -LinkSourceFile(quartzPasteboard.h,../quartz) -LinkSourceFile(quartzShared.h,../quartz) -LinkSourceFile(pseudoramiX.c,../quartz) -LinkSourceFile(pseudoramiX.h,../quartz) -LinkSourceFile(quartzStartup.c,../quartz) -LinkSourceFile(XDarwinStartup.c,../quartz) -LinkSourceFile(XDarwinStartup.man,../quartz) - -SRCS = Preferences.m \ - XApplication.m \ - XServer.m \ - XView.m \ - XWindow.m \ - fullscreen.c \ - quartz.c \ - quartzAudio.c \ - quartzCocoa.m \ - quartzCursor.c \ - quartzPasteboard.c \ - rootlessAquaGlue.c \ - rootlessAquaImp.m \ - rootlessCommon.c \ - rootlessGC.c \ - rootlessScreen.c \ - rootlessValTree.c \ - rootlessWindow.c \ - pseudoramiX.c - -OBJS = Preferences.o \ - XApplication.o \ - XServer.o \ - XView.o \ - XWindow.o \ - fullscreen.o \ - quartz.o \ - quartzAudio.o \ - quartzCocoa.o \ - quartzCursor.o \ - quartzPasteboard.o \ - rootlessAquaGlue.o \ - rootlessAquaImp.o \ - rootlessCommon.o \ - rootlessGC.o \ - rootlessScreen.o \ - rootlessValTree.o \ - rootlessWindow.o \ - pseudoramiX.o - -INCLUDES = -I. -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) -I$(FONTINCSRC) -I$(SERVERSRC)/render \ - -I$(EXTINCSRC) -I.. -I$(SERVERSRC)/Xext - -#if defined(XFree86CustomVersion) -CUSTOMVERSION = XFree86CustomVersion -CUSTOMVERDEF = -DXF86_CUSTOM_VERSION='$(CUSTOMVERSION)' -#endif -#if HasCGMachPort -QUARTZDEFINES = -DHAS_CG_MACH_PORT -#endif - -#if XFree86Devel -PBXBUILDSTYLE = -buildstyle Development -DEBUGDEFINES = -DROOTLESSDEBUG -#else -PBXBUILDSTYLE = -buildstyle Deployment -#endif - -DEFINES = $(CUSTOMVERDEF) -DXBINDIR=$(BINDIR) -DXINITDIR=$(XINITDIR) \ - $(QUARTZDEFINES) $(DEBUGDEFINES) -EXTRAMANDEFS = -D__XBinDir__=$(BINDIR) -#if NothingOutsideProjectRoot -XDARWINROOT = $(BINDIR) -#else -XDARWINROOT = /Applications -#endif - -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) - -NormalLibraryObjectRule() -NormalLibraryTarget(XQuartz,$(OBJS)) - -AllTarget(quartzStartup.o) - -AllTarget(XDarwinStartup) -NormalProgramTarget(XDarwinStartup,XDarwinStartup.o, \ - NullParameter,NullParameter, \ - -framework CoreFoundation -framework ApplicationServices) -InstallProgram(XDarwinStartup,$(BINDIR)) -install:: - -(cd $(DESTDIR)$(BINDIR); $(RM) X; $(LN) XDarwinStartup X) - -AllTarget(XDarwin) -XDarwin: - pbxbuild -target XDarwin $(PBXBUILDSTYLE) - -install:: - pbxbuild install -target XDarwin $(PBXBUILDSTYLE) \ - DSTROOT=$(DESTDIR)$(XDARWINROOT) - -InstallManPage(XDarwinStartup,$(MANDIR)) - -clean:: - pbxbuild "clean" -target XDarwin $(PBXBUILDSTYLE) - -DependTarget() - Index: xc/programs/Xserver/hw/darwin/quartz_1.3/XServer.h diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/XServer.h:1.2 xc/programs/Xserver/hw/darwin/quartz_1.3/XServer.h:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/XServer.h:1.2 Wed Jun 19 14:12:02 2002 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/XServer.h Wed Mar 16 21:06:42 2005 @@ -1,72 +0,0 @@ -// -// XServer.h -// -// Created by Andreas Monitzer on January 6, 2001. -// -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/XServer.h,v 1.2 2002/06/19 18:12:02 torrey Exp $ */ - -#import - -#include // for NXEvent - -@interface XServer : NSObject { - // server state - NSRecursiveLock *serverLock; - NSPort *signalPort; - BOOL serverVisible; - BOOL rootlessMenuBarVisible; - BOOL appQuitting; - UInt32 mouseState; - Class windowClass; - - // server event queue - BOOL sendServerEvents; - int eventWriteFD; - - // Aqua interface - IBOutlet NSWindow *modeWindow; - IBOutlet NSButton *startupModeButton; - IBOutlet NSButton *startFullScreenButton; - IBOutlet NSButton *startRootlessButton; - IBOutlet NSWindow *helpWindow; - IBOutlet NSButton *startupHelpButton; - IBOutlet NSPanel *switchWindow; -} - -- (id)init; - -- (BOOL)translateEvent:(NSEvent *)anEvent; -- (BOOL)getNXMouse:(NXEvent*)ev; - -+ (void)append:(NSString*)value toEnv:(NSString*)name; - -- (void)startX; -- (BOOL)startXClients; -- (void)run; -- (void)toggle; -- (void)show; -- (void)hide; -- (void)killServer; -- (void)readPasteboard; -- (void)writePasteboard; -- (void)sendNXEvent:(NXEvent*)ev; -- (void)sendShowHide:(BOOL)show; - -// Aqua interface actions -- (IBAction)startFullScreen:(id)sender; -- (IBAction)startRootless:(id)sender; -- (IBAction)closeHelpAndShow:(id)sender; -- (IBAction)showAction:(id)sender; - -// NSApplication delegate -- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification; -- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag; -- (void)applicationWillResignActive:(NSNotification *)aNotification; -- (void)applicationWillBecomeActive:(NSNotification *)aNotification; - -// NSPort delegate -- (void)handlePortMessage:(NSPortMessage *)portMessage; - -@end - Index: xc/programs/Xserver/hw/darwin/quartz_1.3/XServer.m diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/XServer.m:1.2 xc/programs/Xserver/hw/darwin/quartz_1.3/XServer.m:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/XServer.m:1.2 Wed Jun 19 14:12:02 2002 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/XServer.m Wed Mar 16 21:06:42 2005 @@ -1,832 +0,0 @@ -// -// XServer.m -// -// This class handles the interaction between the Cocoa front-end -// and the Darwin X server thread. -// -// Created by Andreas Monitzer on January 6, 2001. -// -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/XServer.m,v 1.2 2002/06/19 18:12:02 torrey Exp $ */ - -#import "XServer.h" -#import "Preferences.h" -#import "XWindow.h" -#include "quartzCommon.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -// Types of shells -enum { - shell_Unknown, - shell_Bourne, - shell_C -}; - -typedef struct { - char *name; - int type; -} shellList_t; - -static shellList_t const shellList[] = { - { "csh", shell_C }, // standard C shell - { "tcsh", shell_C }, // ... needs no introduction - { "sh", shell_Bourne }, // standard Bourne shell - { "zsh", shell_Bourne }, // Z shell - { "bash", shell_Bourne }, // GNU Bourne again shell - { NULL, shell_Unknown } -}; - -extern int argcGlobal; -extern char **argvGlobal; -extern char **envpGlobal; -extern int main(int argc, char *argv[], char *envp[]); -extern void HideMenuBar(void); -extern void ShowMenuBar(void); -static void childDone(int sig); - -static NSPortMessage *signalMessage; -static pid_t clientPID; -static XServer *oneXServer; -static NSRect aquaMenuBarBox; - - -@implementation XServer - -- (id)init -{ - self = [super init]; - oneXServer = self; - - serverLock = [[NSRecursiveLock alloc] init]; - clientPID = 0; - sendServerEvents = NO; - serverVisible = NO; - rootlessMenuBarVisible = YES; - appQuitting = NO; - mouseState = 0; - eventWriteFD = quartzEventWriteFD; - windowClass = [XWindow class]; - - // set up a port to safely send messages to main thread from server thread - signalPort = [[NSPort port] retain]; - signalMessage = [[NSPortMessage alloc] initWithSendPort:signalPort - receivePort:signalPort components:nil]; - - // set up receiving end - [signalPort setDelegate:self]; - [[NSRunLoop currentRunLoop] addPort:signalPort - forMode:NSDefaultRunLoopMode]; - [[NSRunLoop currentRunLoop] addPort:signalPort - forMode:NSModalPanelRunLoopMode]; - - return self; -} - -- (NSApplicationTerminateReply) - applicationShouldTerminate:(NSApplication *)sender -{ - // Quit if the X server is not running - if ([serverLock tryLock]) { - appQuitting = YES; - if (clientPID != 0) - kill(clientPID, SIGINT); - return NSTerminateNow; - } - - if (clientPID != 0 || !quartzStartClients) { - int but; - - // Hide the X server and stop sending it events - [self hide]; - sendServerEvents = NO; - - but = NSRunAlertPanel(NSLocalizedString(@"Quit X server?",@""), - NSLocalizedString(@"Quitting the X server will terminate any running X Window System programs.",@""), - NSLocalizedString(@"Quit",@""), - NSLocalizedString(@"Cancel",@""), - nil); - - switch (but) { - case NSAlertDefaultReturn: // quit - break; - case NSAlertAlternateReturn: // cancel - sendServerEvents = YES; - return NSTerminateCancel; - } - } - - appQuitting = YES; - if (clientPID != 0) - kill(clientPID, SIGINT); - [self killServer]; - return NSTerminateNow; -} - -// Ensure that everything has quit cleanly -- (void)applicationWillTerminate:(NSNotification *)aNotification -{ - // Make sure the client process has finished - if (clientPID != 0) { - NSLog(@"Waiting on client process..."); - sleep(2); - - // If the client process hasn't finished yet, kill it off - if (clientPID != 0) { - int clientStatus; - NSLog(@"Killing client process..."); - killpg(clientPID, SIGKILL); - waitpid(clientPID, &clientStatus, 0); - } - } - - // Wait until the X server thread quits - [serverLock lock]; -} - -// returns YES when event was handled -- (BOOL)translateEvent:(NSEvent *)anEvent -{ - NXEvent ev; - static BOOL mouse1Pressed = NO; - BOOL onScreen; - - if (!sendServerEvents) { - return NO; - } - - ev.type = [anEvent type]; - ev.flags = [anEvent modifierFlags]; - - if (!quartzRootless) { - // Check for switch keypress - if ((ev.type == NSKeyDown) && (![anEvent isARepeat]) && - ([anEvent keyCode] == [Preferences keyCode])) - { - unsigned int switchFlags = [Preferences modifiers]; - - // Switch if all the switch modifiers are pressed, while none are - // pressed that should not be, except for caps lock. - if (((ev.flags & switchFlags) == switchFlags) && - ((ev.flags & ~(switchFlags | NSAlphaShiftKeyMask)) == 0)) - { - [self toggle]; - return YES; - } - } - - if (!serverVisible) - return NO; - } - - // If the mouse is not on the valid X display area, - // we don't send the X server key events. - onScreen = [self getNXMouse:&ev]; - - switch (ev.type) { - case NSLeftMouseUp: - if (quartzRootless && !mouse1Pressed) { - // MouseUp after MouseDown in menu - ignore - return NO; - } - mouse1Pressed = NO; - break; - case NSLeftMouseDown: - if (quartzRootless && - ! ([anEvent window] && - [[anEvent window] isKindOfClass:windowClass])) { - // Click in non X window - ignore - return NO; - } - mouse1Pressed = YES; - case NSMouseMoved: - break; - case NSLeftMouseDragged: - case NSRightMouseDragged: - case 27: // undocumented high button MouseDragged event - ev.type=NSMouseMoved; - break; - case NSSystemDefined: - if (![anEvent subtype]==7) - return NO; // we only use multibutton mouse events - if ([anEvent data1] & 1) - return NO; // skip mouse button 1 events - if (mouseState==[anEvent data2]) - return NO; // ignore double events - ev.data.compound.subType=[anEvent subtype]; - ev.data.compound.misc.L[0]=[anEvent data1]; - ev.data.compound.misc.L[1]=mouseState=[anEvent data2]; - break; - case NSScrollWheel: - ev.data.scrollWheel.deltaAxis1=[anEvent deltaY]; - break; - case NSKeyDown: - case NSKeyUp: - if (!onScreen) - return NO; - ev.data.key.keyCode = [anEvent keyCode]; - ev.data.key.repeat = [anEvent isARepeat]; - break; - case NSFlagsChanged: - ev.data.key.keyCode = [anEvent keyCode]; - break; - case 25: // undocumented MouseDown - case 26: // undocumented MouseUp - // Hide these from AppKit to avoid its log messages - return YES; - default: - return NO; - } - - [self sendNXEvent:&ev]; - - // Rootless: Send first NSLeftMouseDown to windows and views so window - // ordering can be suppressed. - // Don't pass further events - they (incorrectly?) bring the window - // forward no matter what. - if (quartzRootless && - (ev.type == NSLeftMouseDown || ev.type == NSLeftMouseUp) && - [anEvent clickCount] == 1 && - [[anEvent window] isKindOfClass:windowClass]) - { - return NO; - } - - return YES; -} - -// Fill in NXEvent with mouse coordinates, inverting y coordinate. -// For rootless mode, the menu bar is treated as not part of the usable -// X display area and the cursor position is adjusted accordingly. -// Returns YES if the cursor is not in the menu bar. -- (BOOL)getNXMouse:(NXEvent*)ev -{ - NSPoint pt = [NSEvent mouseLocation]; - - ev->location.x = (int)(pt.x); - - if (quartzRootless && NSMouseInRect(pt, aquaMenuBarBox, NO)) { - // mouse in menu bar - tell X11 that it's just below instead - ev->location.y = aquaMenuBarHeight; - return NO; - } else { - ev->location.y = NSHeight([[NSScreen mainScreen] frame]) - (int)(pt.y); - return YES; - } -} - -// Append a string to the given enviroment variable -+ (void)append:(NSString*)value toEnv:(NSString*)name -{ - setenv([name cString], - [[[NSString stringWithCString:getenv([name cString])] - stringByAppendingString:value] cString],1); -} - -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification -{ - // Block SIGPIPE - // SIGPIPE repeatably killed the (rootless) server when closing a - // dozen xterms in rapid succession. Those SIGPIPEs should have been - // sent to the X server thread, which ignores them, but somehow they - // ended up in this thread instead. - { - sigset_t set; - sigemptyset(&set); - sigaddset(&set, SIGPIPE); - // pthread_sigmask not implemented yet - // pthread_sigmask(SIG_BLOCK, &set, NULL); - sigprocmask(SIG_BLOCK, &set, NULL); - } - - if (quartzRootless == -1) { - // The display mode was not set from the command line. - // Show mode pick panel? - if ([Preferences modeWindow]) { - if ([Preferences rootless]) - [startRootlessButton setKeyEquivalent:@"\r"]; - else - [startFullScreenButton setKeyEquivalent:@"\r"]; - [modeWindow makeKeyAndOrderFront:nil]; - } else { - // Otherwise use default mode - quartzRootless = [Preferences rootless]; - [self startX]; - } - } else { - [self startX]; - } -} - -// Start the X server thread and the client process -- (void)startX -{ - NSDictionary *appDictionary; - NSString *appVersion; - - [modeWindow close]; - - // Calculate the height of the menu bar so rootless mode can avoid it - if (quartzRootless) { - aquaMenuBarHeight = NSHeight([[NSScreen mainScreen] frame]) - - NSMaxY([[NSScreen mainScreen] visibleFrame]) - 1; - aquaMenuBarBox = - NSMakeRect(0, NSMaxY([[NSScreen mainScreen] visibleFrame]) + 1, - NSWidth([[NSScreen mainScreen] frame]), - aquaMenuBarHeight); - } - - // Write the XDarwin version to the console log - appDictionary = [[NSBundle mainBundle] infoDictionary]; - appVersion = [appDictionary objectForKey:@"CFBundleShortVersionString"]; - if (appVersion) - NSLog(@"\n%@", appVersion); - else - NSLog(@"No version"); - - // Start the X server thread - [NSThread detachNewThreadSelector:@selector(run) toTarget:self - withObject:nil]; - sendServerEvents = YES; - - // Start the X clients if started from GUI - if (quartzStartClients) { - [self startXClients]; - } - - if (quartzRootless) { - // There is no help window for rootless; just start - [helpWindow close]; - helpWindow = nil; - if ([NSApp isActive]) - [self sendShowHide:YES]; - else - [self sendShowHide:NO]; - } else { - // Show the X switch window if not using dock icon switching - if (![Preferences dockSwitch]) - [switchWindow orderFront:nil]; - - if ([Preferences startupHelp]) { - // display the full screen mode help - [self sendShowHide:NO]; - [helpWindow makeKeyAndOrderFront:nil]; - } else { - // start running full screen and make sure X is visible - ShowMenuBar(); - [self closeHelpAndShow:nil]; - } - } -} - -// Start the first X clients in a separate process -- (BOOL)startXClients -{ - struct passwd *passwdUser; - NSString *shellPath, *dashShellName, *commandStr, *startXPath; - NSMutableString *safeStartXPath; - NSRange aRange; - NSBundle *thisBundle; - const char *shellPathStr, *newargv[3], *shellNameStr; - int fd[2], outFD, length, shellType, i; - - // Register to catch the signal when the client processs finishes - signal(SIGCHLD, childDone); - - // Get user's password database entry - passwdUser = getpwuid(getuid()); - - // Find the shell to use - if ([Preferences useDefaultShell]) - shellPath = [NSString stringWithCString:passwdUser->pw_shell]; - else - shellPath = [Preferences shellString]; - - dashShellName = [NSString stringWithFormat:@"-%@", - [shellPath lastPathComponent]]; - shellPathStr = [shellPath cString]; - shellNameStr = [[shellPath lastPathComponent] cString]; - - if (access(shellPathStr, X_OK)) { - NSLog(@"Shell %s is not valid!", shellPathStr); - return NO; - } - - // Find the type of shell - for (i = 0; shellList[i].name; i++) { - if (!strcmp(shellNameStr, shellList[i].name)) - break; - } - shellType = shellList[i].type; - - newargv[0] = [dashShellName cString]; - if (shellType == shell_Bourne) { - // Bourne shells need to be told they are interactive to make - // sure they read all their initialization files. - newargv[1] = "-i"; - newargv[2] = NULL; - } else { - newargv[1] = NULL; - } - - // Create a pipe to communicate with the X client process - NSAssert(pipe(fd) == 0, @"Could not create new pipe."); - - // Open a file descriptor for writing to stdout and stderr - outFD = open("/dev/console", O_WRONLY, 0); - if (outFD == -1) { - outFD = open("/dev/null", O_WRONLY, 0); - NSAssert(outFD != -1, @"Could not open shell output."); - } - - // Fork process to start X clients in user's default shell - // Sadly we can't use NSTask because we need to start a login shell. - // Login shells are started by passing "-" as the first character of - // argument 0. NSTask forces argument 0 to be the shell's name. - clientPID = vfork(); - if (clientPID == 0) { - - // Inside the new process: - if (fd[0] != STDIN_FILENO) { - dup2(fd[0], STDIN_FILENO); // Take stdin from pipe - close(fd[0]); - } - close(fd[1]); // Close write end of pipe - if (outFD == STDOUT_FILENO) { // Setup stdout and stderr - dup2(outFD, STDERR_FILENO); - } else if (outFD == STDERR_FILENO) { - dup2(outFD, STDOUT_FILENO); - } else { - dup2(outFD, STDERR_FILENO); - dup2(outFD, STDOUT_FILENO); - close(outFD); - } - - // Setup environment - setenv("HOME", passwdUser->pw_dir, 1); - setenv("SHELL", shellPathStr, 1); - setenv("LOGNAME", passwdUser->pw_name, 1); - setenv("USER", passwdUser->pw_name, 1); - setenv("TERM", "unknown", 1); - if (chdir(passwdUser->pw_dir)) // Change to user's home dir - NSLog(@"Could not change to user's home directory."); - - execv(shellPathStr, newargv); // Start user's shell - - NSLog(@"Could not start X client process with errno = %i.", errno); - _exit(127); - } - - // In parent process: - close(fd[0]); // Close read end of pipe - close(outFD); // Close output file descriptor - - thisBundle = [NSBundle bundleForClass:[self class]]; - startXPath = [thisBundle pathForResource:@"startXClients" ofType:nil]; - if (!startXPath) { - NSLog(@"Could not find startXClients in application bundle!"); - return NO; - } - - // We will run the startXClients script with the path in single quotes - // in case there are problematic characters in the path. We still have - // to worry about there being single quotes in the path. So, replace - // all instances of the ' character in startXPath with '\''. - safeStartXPath = [NSMutableString stringWithString:startXPath]; - aRange = NSMakeRange(0, [safeStartXPath length]); - while (aRange.length) { - aRange = [safeStartXPath rangeOfString:@"'" options:0 range:aRange]; - if (!aRange.length) - break; - [safeStartXPath replaceCharactersInRange:aRange - withString:@"\'\\'\'"]; - aRange.location += 4; - aRange.length = [safeStartXPath length] - aRange.location; - } - - if ([Preferences addToPath]) { - commandStr = [NSString stringWithFormat:@"'%@' :%d %@\n", - safeStartXPath, [Preferences display], - [Preferences addToPathString]]; - } else { - commandStr = [NSString stringWithFormat:@"'%@' :%d\n", - safeStartXPath, [Preferences display]]; - } - - length = [commandStr cStringLength]; - if (write(fd[1], [commandStr cString], length) != length) { - NSLog(@"Write to X client process failed."); - return NO; - } - - // Close the pipe so that shell will terminate when xinit quits - close(fd[1]); - - return YES; -} - -// Run the X server thread -- (void)run -{ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - [serverLock lock]; - main(argcGlobal, argvGlobal, envpGlobal); - serverVisible = NO; - [pool release]; - [serverLock unlock]; - QuartzMessageMainThread(kQuartzServerDied); -} - -// Full screen mode was picked in the mode pick panel -- (IBAction)startFullScreen:(id)sender -{ - [Preferences setModeWindow:[startupModeButton intValue]]; - [Preferences saveToDisk]; - quartzRootless = FALSE; - [self startX]; -} - -// Rootless mode was picked in the mode pick panel -- (IBAction)startRootless:(id)sender -{ - [Preferences setModeWindow:[startupModeButton intValue]]; - [Preferences saveToDisk]; - quartzRootless = TRUE; - [self startX]; -} - -// Close the help splash screen and show the X server -- (IBAction)closeHelpAndShow:(id)sender -{ - if (sender) { - int helpVal = [startupHelpButton intValue]; - [Preferences setStartupHelp:helpVal]; - [Preferences saveToDisk]; - } - [helpWindow close]; - helpWindow = nil; - - serverVisible = YES; - [self sendShowHide:YES]; - [NSApp activateIgnoringOtherApps:YES]; -} - -// Show the X server when sent message from GUI -- (IBAction)showAction:(id)sender -{ - if (sendServerEvents) - [self sendShowHide:YES]; -} - -// Show or hide the X server or menu bar in rootless mode -- (void)toggle -{ - if (quartzRootless) { -#if 0 - // FIXME: Remove or add option to not dodge menubar - if (rootlessMenuBarVisible) - HideMenuBar(); - else - ShowMenuBar(); - rootlessMenuBarVisible = !rootlessMenuBarVisible; -#endif - } else { - if (serverVisible) - [self hide]; - else - [self show]; - } -} - -// Show the X server on screen -- (void)show -{ - if (!serverVisible && sendServerEvents) { - [self sendShowHide:YES]; - } -} - -// Hide the X server from the screen -- (void)hide -{ - if (serverVisible && sendServerEvents) { - [self sendShowHide:NO]; - } -} - -// Kill the X server thread -- (void)killServer -{ - NXEvent ev; - - if (serverVisible) - [self hide]; - - ev.type = NX_APPDEFINED; - ev.data.compound.subType = kXDarwinQuit; - [self sendNXEvent:&ev]; -} - -// Tell the X server to show or hide itself. -// This ignores the current X server visible state. -// -// In full screen mode, the order we do things is important and must be -// preserved between the threads. X drawing operations have to be performed -// in the X server thread. It appears that we have the additional -// constraint that we must hide and show the menu bar in the main thread. -// -// To show the X server: -// 1. Capture the displays. (Main thread) -// 2. Hide the menu bar. (Must be in main thread) -// 3. Send event to X server thread to redraw X screen. -// 4. Redraw the X screen. (Must be in X server thread) -// -// To hide the X server: -// 1. Send event to X server thread to stop drawing. -// 2. Stop drawing to the X screen. (Must be in X server thread) -// 3. Message main thread that drawing is stopped. -// 4. If main thread still wants X server hidden: -// a. Release the displays. (Main thread) -// b. Unhide the menu bar. (Must be in main thread) -// Otherwise we have already queued an event to start drawing again. -// -- (void)sendShowHide:(BOOL)show -{ - NXEvent ev; - - [self getNXMouse:&ev]; - ev.type = NX_APPDEFINED; - - if (show) { - if (!quartzRootless) { - QuartzFSCapture(); - HideMenuBar(); - } - ev.data.compound.subType = kXDarwinShow; - [self sendNXEvent:&ev]; - - // inform the X server of the current modifier state - ev.flags = [[NSApp currentEvent] modifierFlags]; - ev.data.compound.subType = kXDarwinUpdateModifiers; - [self sendNXEvent:&ev]; - - // put the pasteboard into the X cut buffer - [self readPasteboard]; - } else { - // put the X cut buffer on the pasteboard - [self writePasteboard]; - - ev.data.compound.subType = kXDarwinHide; - [self sendNXEvent:&ev]; - } - - serverVisible = show; -} - -// Tell the X server to read from the pasteboard into the X cut buffer -- (void)readPasteboard -{ - NXEvent ev; - - ev.type = NX_APPDEFINED; - ev.data.compound.subType = kXDarwinReadPasteboard; - [self sendNXEvent:&ev]; -} - -// Tell the X server to write the X cut buffer into the pasteboard -- (void)writePasteboard -{ - NXEvent ev; - - ev.type = NX_APPDEFINED; - ev.data.compound.subType = kXDarwinWritePasteboard; - [self sendNXEvent:&ev]; -} - -- (void)sendNXEvent:(NXEvent*)ev -{ - int bytesWritten; - - if (quartzRootless && - (ev->type == NSLeftMouseDown || ev->type == NSLeftMouseUp || - (ev->type == NSSystemDefined && ev->data.compound.subType == 7))) - { - // mouse button event - send mouseMoved to this position too - // X gets confused if it gets a click that isn't at the last - // reported mouse position. - NXEvent moveEvent = *ev; - moveEvent.type = NSMouseMoved; - [self sendNXEvent:&moveEvent]; - } - - bytesWritten = write(eventWriteFD, ev, sizeof(*ev)); - if (bytesWritten == sizeof(*ev)) - return; - NSLog(@"Bad write to event pipe."); - // FIXME: handle bad writes better? -} - -// Handle messages from the X server thread -- (void)handlePortMessage:(NSPortMessage *)portMessage -{ - unsigned msg = [portMessage msgid]; - - switch(msg) { - case kQuartzServerHidden: - // Make sure the X server wasn't queued to be shown again while - // the hide was pending. - if (!quartzRootless && !serverVisible) { - QuartzFSRelease(); - ShowMenuBar(); - } - - // FIXME: This hack is necessary (but not completely effective) - // since Mac OS X 10.0.2 - [NSCursor unhide]; - break; - - case kQuartzServerDied: - sendServerEvents = NO; - if (!appQuitting) { - [NSApp terminate:nil]; // quit if we aren't already - } - break; - - default: - NSLog(@"Unknown message from server thread."); - } -} - -// Quit the X server when the X client process finishes -- (void)clientProcessDone:(int)clientStatus -{ - if (WIFEXITED(clientStatus)) { - int exitStatus = WEXITSTATUS(clientStatus); - if (exitStatus != 0) - NSLog(@"X client process terminated with status %i.", exitStatus); - } else { - NSLog(@"X client process terminated abnormally."); - } - - if (!appQuitting) { - [NSApp terminate:nil]; // quit if we aren't already - } -} - -// Called when the user clicks the application icon, -// but not when Cmd-Tab is used. -// Rootless: Don't switch until applicationWillBecomeActive. -- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication - hasVisibleWindows:(BOOL)flag -{ - if ([Preferences dockSwitch] && !quartzRootless) { - [self show]; - } - return NO; -} - -- (void)applicationWillResignActive:(NSNotification *)aNotification -{ - [self hide]; -} - -- (void)applicationWillBecomeActive:(NSNotification *)aNotification -{ - if (quartzRootless) - [self show]; -} - -@end - -// Send a message to the main thread, which calls handlePortMessage in -// response. Must only be called from the X server thread because -// NSPort is not thread safe. -void QuartzMessageMainThread(unsigned msg) -{ - [signalMessage setMsgid:msg]; - [signalMessage sendBeforeDate:[NSDate distantPast]]; -} - -// Handle SIGCHLD signals -static void childDone(int sig) -{ - int clientStatus; - - if (clientPID == 0) - return; - - // Make sure it was the client task that finished - if (waitpid(clientPID, &clientStatus, WNOHANG) == clientPID) { - if (WIFSTOPPED(clientStatus)) - return; - clientPID = 0; - [oneXServer clientProcessDone:clientStatus]; - } -} Index: xc/programs/Xserver/hw/darwin/quartz_1.3/XView.h diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/XView.h:1.1 xc/programs/Xserver/hw/darwin/quartz_1.3/XView.h:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/XView.h:1.1 Wed Mar 27 21:21:20 2002 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/XView.h Wed Mar 16 21:06:42 2005 @@ -1,50 +0,0 @@ -/* - * NSView subclass for Mac OS X rootless X server - */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/XView.h,v 1.1 2002/03/28 02:21:20 torrey Exp $ */ - -#import - -#include -#include "fakeBoxRec.h" - -@interface XView : NSView -{ - char *mBits; - int mBytesPerRow; - int mBitsPerSample; - int mSamplesPerPixel; - int mBitsPerPixel; - int mDepth; - BOOL mShaped; -} - -- (id)initWithFrame:(NSRect)aRect; -- (void)dealloc; - -- (void)drawRect:(NSRect)aRect; -- (BOOL)isFlipped; -- (BOOL)acceptsFirstResponder; -- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent; -- (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent *)theEvent; - -- (void)mouseDown:(NSEvent *)anEvent; - -- (void)setFrameSize:(NSSize)newSize; - -- (void)allocBitsForSize:(NSSize)newSize; -- (char *)bits; -- (void)getBits:(char **)bits - rowBytes:(int *)rowBytes - depth:(int *)depth - bitsPerPixel:(int *)bpp; - -- (void)refreshRects:(fakeBoxRec *)rectList count:(int)count; -- (void)reshapeRects:(fakeBoxRec *)eraseRects count:(int)count; - -- (void)copyToScreen:(fakeBoxRec *)rectList count:(int)count - fromTemp:(BOOL)copyFromTemp; -- (void)copyToShapeBits:(fakeBoxRec *)rectList count:(int)count; -- (void)eraseFromShapeBits:(fakeBoxRec *)rectList count:(int)count; - -@end Index: xc/programs/Xserver/hw/darwin/quartz_1.3/XView.m diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/XView.m:1.1 xc/programs/Xserver/hw/darwin/quartz_1.3/XView.m:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/XView.m:1.1 Wed Mar 27 21:21:20 2002 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/XView.m Wed Mar 16 21:06:42 2005 @@ -1,330 +0,0 @@ -/* - * NSView subclass for Mac OS X rootless X server - */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/XView.m,v 1.1 2002/03/28 02:21:20 torrey Exp $ */ - -#include - -#import "XView.h" -#include "fakeBoxRec.h" - -static const void *infobytes(void *info) -{ - return info; -} - - -static unsigned long *shapeBits = NULL; -static int shapeWidth = 0; -static int shapeHeight = 0; - -static void reallocShapeBits(NSSize minSize) -{ - if (shapeWidth < minSize.width || shapeHeight < minSize.height) { - shapeWidth = minSize.width; - shapeHeight = minSize.height; - if (shapeBits) free(shapeBits); - shapeBits = (unsigned long *) malloc(4 * shapeWidth * shapeHeight); - } -} - - -@implementation XView - -- (id)initWithFrame:(NSRect)aRect -{ - self = [super initWithFrame:aRect]; - if (!self) return nil; - - mShaped = NO; - mBitsPerSample = 8; - mSamplesPerPixel = 3; - mDepth = mBitsPerSample * mSamplesPerPixel; - mBitsPerPixel = 32; - mBits = nil; - [self allocBitsForSize:aRect.size]; - - return self; -} - -- (void)dealloc -{ - if (mBits) free(mBits); - [super dealloc]; -} - -- (void)drawRect:(NSRect)aRect -{ - // Never draw here. -} - -- (BOOL)isFlipped -{ - return NO; -} - -- (BOOL)isOpaque -{ - return !mShaped; -} - -- (BOOL)acceptsFirstResponder -{ - return YES; -} - -- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent -{ - return YES; -} - -- (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent *)theEvent -{ - return YES; -} - - -- (void)mouseDown:(NSEvent *)anEvent -{ - // Only X is allowed to restack windows. - [NSApp preventWindowOrdering]; - [[self nextResponder] mouseDown:anEvent]; -} - -- (void)mouseUp:(NSEvent *)anEvent -{ - // Bring app to front if necessary - // Don't bring app to front in mouseDown; mousedown-mouseup is too - // long and X gets what looks like a mouse drag. - if (! [NSApp isActive]) { - [NSApp activateIgnoringOtherApps:YES]; - [NSApp arrangeInFront:nil]; // fixme only bring some windows forward? - } - - [[self nextResponder] mouseDown:anEvent]; -} - - -// Reallocate bits. -// setFrame goes through here too. -- (void)setFrameSize:(NSSize)newSize -{ - [self allocBitsForSize:newSize]; - [super setFrameSize:newSize]; -} - -- (void)allocBitsForSize:(NSSize)newSize -{ - if (mBits) free(mBits); - mBytesPerRow = newSize.width * mBitsPerPixel / 8; - mBits = calloc(mBytesPerRow * newSize.height, 1); -} - -- (char *)bits -{ - return mBits; -} - -- (void)getBits:(char **)bits - rowBytes:(int *)rowBytes - depth:(int *)depth - bitsPerPixel:(int *)bpp -{ - *bits = mBits; - *rowBytes = mBytesPerRow; - *depth = mDepth; - *bpp = mBitsPerPixel; -} - -- (void)refreshRects:(fakeBoxRec *)rectList count:(int)count -{ - if (!mShaped) { - [self lockFocus]; - [self copyToScreen:rectList count:count fromTemp:NO]; - } else { - [self copyToShapeBits:rectList count:count]; - [self lockFocus]; - [self copyToScreen:rectList count:count fromTemp:YES]; - } - [[NSGraphicsContext currentContext] flushGraphics]; - [self unlockFocus]; -} - -// eraseRects are OUTSIDE the new shape -- (void)reshapeRects:(fakeBoxRec *)eraseRects count:(int)count -{ - fakeBoxRec bounds = {0, 0, [self frame].size.width, - [self frame].size.height}; - - if (count == 0 && !mShaped) { - [self refreshRects:&bounds count:1]; - } else { - // View is shaped, or used to be shaped. - // Shaped windows never become unshaped. - // (Mac OS X 10.0.4 does not allow transparent windows - // to become opaque.) - - mShaped = YES; - - // Magic. 10.0.4 and 10.1 both require the alpha channel to be - // cleared explicitly. 10.0.4 additionally requires the view to - // be unlocked between this and the drawing code below. - [self lockFocus]; - [[NSColor clearColor] set]; - NSRectFill([self frame]); - [self unlockFocus]; - - // copy everything from X11 to temp - // erase eraseRects from temp - // copy everything from temp to screen - [self lockFocus]; - [self copyToShapeBits:&bounds count:1]; - [self eraseFromShapeBits:eraseRects count:count]; - [self copyToScreen:&bounds count:1 fromTemp:YES]; - [[NSGraphicsContext currentContext] flushGraphics]; - [self unlockFocus]; - } -} - - -- (void)eraseFromShapeBits:(fakeBoxRec *)rectList count:(int)count -{ - unsigned long *dst = NULL; // don't assign yet - int dstWidth = 0; // don't assign yet - fakeBoxRec *r; - fakeBoxRec *end; - - assert(mBitsPerPixel == 32); - reallocShapeBits([self frame].size); - dst = shapeBits; - dstWidth = shapeWidth; - - for (r = rectList, end = rectList + count; r < end; r++) { - unsigned long *dstline = dst + dstWidth*r->y1 + r->x1; - int h = r->y2 - r->y1; - - while (h--) { - unsigned long *dstp = dstline; - int w = r->x2 - r->x1; - - while (w--) { - *dstp++ = 0x00000000; - } - dstline += dstWidth; - } - } -} - -// assumes X11 bits and temp bits are 32-bit -- (void)copyToShapeBits:(fakeBoxRec *)rectList count:(int)count -{ - unsigned long *src = (unsigned long *) mBits; - unsigned long *dst = NULL; // don't assign yet - int srcWidth = mBytesPerRow / 4; - int dstWidth = 0; // don't assign yet - fakeBoxRec *r; - fakeBoxRec *end; - - assert(mBitsPerPixel == 32); - reallocShapeBits([self frame].size); - dst = shapeBits; - dstWidth = shapeWidth; - - for (r = rectList, end = rectList + count; r < end; r++) { - unsigned long *srcline = src + srcWidth*r->y1 + r->x1; - unsigned long *dstline = dst + dstWidth*r->y1 + r->x1; - int h = r->y2 - r->y1; - - while (h--) { - unsigned long *srcp = srcline; - unsigned long *dstp = dstline; - int w = r->x2 - r->x1; - - while (w--) { - *dstp++ = *srcp++ | 0xff000000; - } - srcline += srcWidth; - dstline += dstWidth; - } - } -} - - -// Copy boxes to the screen from the per-window pixmaps where X draws. -// rectList is in local, X-flipped coordinates. -- (void)copyToScreen:(fakeBoxRec *)rectList count:(int)count - fromTemp:(BOOL)copyFromTemp -{ - unsigned char *offsetbits; - fakeBoxRec *r; - fakeBoxRec *end; - NSRect bounds; - char *srcBits; - int bytesPerRow; - int bitsPerPixel; - int bitsPerSample; - CGImageAlphaInfo alpha; - CGContextRef destCtx = (CGContextRef)[[NSGraphicsContext currentContext] - graphicsPort]; - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - // fixme colorspace leaks? - const CGDataProviderDirectAccessCallbacks cb = { - infobytes, NULL, NULL, NULL - }; - - if (copyFromTemp) { - // shapeBits assumed to be 32-bit - srcBits = (char *)shapeBits; - bytesPerRow = 4 * shapeWidth; - bitsPerPixel = 32; - bitsPerSample = 8; - alpha = kCGImageAlphaPremultipliedFirst; // premultiplied ARGB - } else { - srcBits = mBits; - bytesPerRow = mBytesPerRow; - bitsPerPixel = mBitsPerPixel; - bitsPerSample = mBitsPerSample; - alpha = kCGImageAlphaNoneSkipFirst; // xRGB - } - - bounds = [self frame]; - bounds.origin.x = bounds.origin.y = 0; - - for (r = rectList, end = rectList + count; r < end; r++) { - NSRect nsr = {{r->x1, r->y1}, {r->x2-r->x1, r->y2-r->y1}}; - CGRect destRect; - CGDataProviderRef dataProviderRef; - CGImageRef imageRef; - - // Clip to window - // (bounds origin is (0,0) so it can be used in either flip) - // fixme is this necessary with pixmap-per-window? - nsr = NSIntersectionRect(nsr, bounds); - - // Disallow empty rects - if (nsr.size.width <= 0 || nsr.size.height <= 0) continue; - - offsetbits = srcBits + (int)(nsr.origin.y * bytesPerRow + - nsr.origin.x * bitsPerPixel/8); - - // Flip r to Cocoa-flipped - nsr.origin.y = bounds.size.height - nsr.origin.y - nsr.size.height; - destRect = CGRectMake(nsr.origin.x, nsr.origin.y, - nsr.size.width, nsr.size.height); - - dataProviderRef = CGDataProviderCreateDirectAccess(offsetbits, - destRect.size.height * bytesPerRow, &cb); - - imageRef = CGImageCreate(destRect.size.width, destRect.size.height, - bitsPerSample, bitsPerPixel, bytesPerRow, - colorSpace, alpha, dataProviderRef, NULL, - 1, kCGRenderingIntentDefault); - - CGContextDrawImage(destCtx, destRect, imageRef); - CGImageRelease(imageRef); - CGDataProviderRelease(dataProviderRef); - } -} - - -@end Index: xc/programs/Xserver/hw/darwin/quartz_1.3/XWindow.h diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/XWindow.h:1.1 xc/programs/Xserver/hw/darwin/quartz_1.3/XWindow.h:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/XWindow.h:1.1 Wed Mar 27 21:21:20 2002 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/XWindow.h Wed Mar 16 21:06:42 2005 @@ -1,36 +0,0 @@ -/* - * NSWindow subclass for Mac OS X rootless X server - */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/XWindow.h,v 1.1 2002/03/28 02:21:20 torrey Exp $ */ - -#import -#import "XView.h" - -#include "fakeBoxRec.h" - -@interface XWindow : NSWindow -{ - XView *mView; -} - -- (id)initWithContentRect:(NSRect)aRect - isRoot:(BOOL)isRoot; -- (void)dealloc; - -- (char *)bits; -- (void)getBits:(char **)bits - rowBytes:(int *)rowBytes - depth:(int *)depth - bitsPerPixel:(int *)bpp; - -- (void)refreshRects:(fakeBoxRec *)rectList - count:(int)count; - -- (void)orderWindow:(NSWindowOrderingMode)place - relativeTo:(int)otherWindowNumber; - -- (void)sendEvent:(NSEvent *)anEvent; -- (BOOL)canBecomeMainWindow; -- (BOOL)canBecomeKeyWindow; - -@end Index: xc/programs/Xserver/hw/darwin/quartz_1.3/XWindow.m diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/XWindow.m:1.1 xc/programs/Xserver/hw/darwin/quartz_1.3/XWindow.m:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/XWindow.m:1.1 Wed Mar 27 21:21:20 2002 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/XWindow.m Wed Mar 16 21:06:42 2005 @@ -1,104 +0,0 @@ -/* - * NSWindow subclass for Mac OS X rootless X server - */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/XWindow.m,v 1.1 2002/03/28 02:21:20 torrey Exp $ */ - -#import "XWindow.h" - - -@implementation XWindow - -// XWindow MUST NOT autodisplay! Autodisplay can cause a deadlock. -// event thread - autodisplay: locks view hierarchy, then window -// X Server thread - window resize: locks window, then view hierarchy -// Deadlock occurs if each thread gets one lock and waits for the other. - -// XWindow MUST defer! Otherwise an assertion fails in -// NSViewHierarchyLock sometimes. - -- (id)initWithContentRect:(NSRect)aRect - isRoot:(BOOL)isRoot -{ - int style; - NSRect viewRect = {{0, 0}, {aRect.size.width, aRect.size.height}}; - style = NSBorderlessWindowMask; - - self = [super initWithContentRect: aRect - styleMask: style - backing: NSBackingStoreBuffered - defer: YES]; - if (! self) return NULL; - - [self setBackgroundColor:[NSColor clearColor]]; // erase transparent - [self setAlphaValue:1.0]; // draw opaque - [self setOpaque:YES]; // changed when window is shaped - - [self useOptimizedDrawing:YES]; // Has no overlapping sub-views - [self setAutodisplay:NO]; // MUST NOT autodisplay! See comment above - [self disableFlushWindow]; // We do all the flushing manually - [self setHasShadow: !isRoot]; // All windows have shadows except root - - // [self setAcceptsMouseMovedEvents:YES]; // MUST be AFTER orderFront? - - mView = [[XView alloc] initWithFrame: viewRect]; - [self setContentView:mView]; - [self setInitialFirstResponder:mView]; - - return self; -} - -- (void)dealloc -{ - [mView release]; - [super dealloc]; -} - -- (char *)bits -{ - return [mView bits]; -} - -- (void)getBits:(char **)bits - rowBytes:(int *)rowBytes - depth:(int *)depth - bitsPerPixel:(int *)bpp -{ - [mView getBits:bits rowBytes:rowBytes depth:depth bitsPerPixel:bpp]; -} - - -// rects are X-flip and LOCAL coords -- (void)refreshRects:(fakeBoxRec *)rectList count:(int)count; -{ - [mView refreshRects:rectList count:count]; -} - - -// Deferred windows don't handle mouse moved events very well. -- (void)orderWindow:(NSWindowOrderingMode)place - relativeTo:(int)otherWindowNumber -{ - [super orderWindow:place relativeTo:otherWindowNumber]; - [self setAcceptsMouseMovedEvents:YES]; -} - -- (void)sendEvent:(NSEvent *)anEvent -{ - [super sendEvent:anEvent]; - [self setAcceptsMouseMovedEvents:YES]; -} - -// XWindow may be frameless, and frameless windows default to -// NO key and NO main. -// update: we *don't* want main or key status after all -- (BOOL)canBecomeMainWindow -{ - return NO; -} - -- (BOOL)canBecomeKeyWindow -{ - return NO; -} - -@end Index: xc/programs/Xserver/hw/darwin/quartz_1.3/rootless.h diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/rootless.h:1.1 xc/programs/Xserver/hw/darwin/quartz_1.3/rootless.h:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/rootless.h:1.1 Wed Mar 27 21:21:20 2002 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/rootless.h Wed Mar 16 21:06:42 2005 @@ -1,127 +0,0 @@ -/* - * External interface to generic rootless mode - * - * Greg Parker gparker@cs.stanford.edu March 3, 2001 - */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/rootless.h,v 1.1 2002/03/28 02:21:20 torrey Exp $ */ - -#ifndef _ROOTLESS_H -#define _ROOTLESS_H - -#include "mi.h" -#include "gcstruct.h" - -// RootlessFrameRec -// Describes a single rootless window (aka frame). -// The rootless mode keeps track of window position, and the -// rootless implementation is responsible for the pixmap. -// Multiple screens: all coordinates are SCREEN-LOCAL, not global. - - -typedef struct RootlessFrameRec { - /* Data maintained by rootless mode */ - /* position and size, including window border, in screen coordinates */ - int x; - int y; - unsigned int w; - unsigned int h; - WindowPtr win; /* the top-level window drawn in this frame */ - int isRoot; /* TRUE if this is the root window */ - - /* Data maintained by rootless implementation */ - char *pixelData; - int depth; // color bits per pixel; depth <= bitsPerPixel - int bitsPerPixel; - int bytesPerRow; - - void *devPrivate; /* for caller's use */ -} RootlessFrameRec, *RootlessFramePtr; - - -// Create a new frame. -// pUpper is the window above the new frame, or NULL if the new -// frame will be on top. -// pFrame is completely initialized. devPrivate is NULL -// The pixmap must be valid when this is done. -typedef void (*RootlessCreateFrameProc) - (ScreenPtr pScreen, RootlessFramePtr pFrame, RootlessFramePtr pUpper); - -// Destroy a frame. Caller must free any private data and the pixmap. -// All drawing is stopped and all updates are flushed before this is called. -typedef void (*RootlessDestroyFrameProc) - (ScreenPtr pScreen, RootlessFramePtr pFrame); - -// Move a frame on screen. -// The frame changes position and nothing else. -// pFrame and pFrame->win already contain the information about the -// new position. oldX and oldY are the old position. -// All updates are flushed before this is called. -// The pixmap may change during this function. -typedef void (*RootlessMoveFrameProc) - (ScreenPtr pScreen, RootlessFramePtr pFrame, int oldX, int oldY); - -// Change frame ordering (aka stacking, layering) -// pFrame->win already has its new siblings. -// pOldNext is the window that was below this one, or NULL if this was -// at the bottom. -// pNewNext is the window that is now below this one, or NULL if this is -// now at the bottom. -typedef void (*RootlessRestackFrameProc) - (ScreenPtr pScreen, RootlessFramePtr pFrame, - RootlessFramePtr pOldNext, RootlessFramePtr pNewNext); - -// Flush drawing updates to the screen. -// pDamage contains all changed pixels. -// pDamage is in frame-local coordinates. -// pDamage is clipped to the frame bounds and the frame shape. -typedef void (*RootlessUpdateRegionProc) - (ScreenPtr pScreen, RootlessFramePtr pFrame, RegionPtr pDamage); - -// Change the frame's shape. -// pNewShape is in frame-local coordinates. -// Everything outside pNewShape is no longer part of the frame. -// pNewShape is {0, 0, width, height} for a plain-shaped frame. -// fixme can the pixmap change here? -// fixme reimplement shape -typedef void (*RootlessReshapeFrameProc) - (ScreenPtr pScreen, RootlessFramePtr pFrame, RegionPtr pNewShape); - -// Frame is about to resize. -// The frame has its new position and size already. -// postconditions: -// The pixmap MUST point to a pixmap with the new size. -// The pixmap data is undefined. -// The old pixmap may be destroyed here. -typedef void (*RootlessStartResizeFrameProc) - (ScreenPtr pScreen, RootlessFramePtr pFrame, - int oldX, int oldY, unsigned int oldW, unsigned int oldH); - -// Frame is done resizing. -// Destroy the old pixmap if you haven't already. -typedef void (*RootlessFinishResizeFrameProc) - (ScreenPtr pScreen, RootlessFramePtr pFrame, - int oldX, int oldY, unsigned int oldW, unsigned int oldH); - - -// The callback function list. -// Any of these may be NULL. -typedef struct RootlessFrameProcs { - RootlessCreateFrameProc CreateFrame; - RootlessDestroyFrameProc DestroyFrame; - - RootlessMoveFrameProc MoveFrame; - RootlessStartResizeFrameProc StartResizeFrame; - RootlessFinishResizeFrameProc FinishResizeFrame; - RootlessRestackFrameProc RestackFrame; - RootlessReshapeFrameProc ReshapeFrame; - - RootlessUpdateRegionProc UpdateRegion; - - // RootlessStartDrawingProc StartDrawing; - // RootlessStopDrawingProc StopDrawing; -} RootlessFrameProcs; - -// Initialize rootless mode on the given screen. -Bool RootlessInit(ScreenPtr pScreen, RootlessFrameProcs *procs); - -#endif /* _ROOTLESS_H */ Index: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAqua.h diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAqua.h:1.1 xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAqua.h:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAqua.h:1.1 Wed Mar 27 21:21:20 2002 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAqua.h Wed Mar 16 21:06:42 2005 @@ -1,15 +0,0 @@ -/* - * Rootless setup for Aqua - * - * Greg Parker gparker@cs.stanford.edu - */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAqua.h,v 1.1 2002/03/28 02:21:20 torrey Exp $ */ - -#ifndef _ROOTLESSAQUA_H -#define _ROOTLESSAQUA_H - -Bool AquaAddScreen(int index, ScreenPtr pScreen); -Bool AquaSetupScreen(int index, ScreenPtr pScreen); -void AquaDisplayInit(void); - -#endif /* _ROOTLESSAQUA_H */ Index: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAquaGlue.c diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAquaGlue.c:1.1 xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAquaGlue.c:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAquaGlue.c:1.1 Wed Mar 27 21:21:20 2002 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAquaGlue.c Wed Mar 16 21:06:42 2005 @@ -1,226 +0,0 @@ -/* - * Generic rootless to Aqua specific glue code - * - * This code acts as a glue between the generic rootless X server code - * and the Aqua specific implementation, which includes definitions that - * conflict with stardard X types. - * - * Greg Parker gparker@cs.stanford.edu - */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAquaGlue.c,v 1.1 2002/03/28 02:21:20 torrey Exp $ */ - -#include "quartzCommon.h" -#include "darwin.h" -#include "rootlessAqua.h" -#include "rootlessAquaImp.h" -#include "rootless.h" - -#include "regionstr.h" -#include "scrnintstr.h" -#include "globals.h" // dixScreenOrigins[] - - -///////////////////////////////////////// -// Rootless mode callback glue - -static void -AquaGlueCreateFrame(ScreenPtr pScreen, RootlessFramePtr pFrame, - RootlessFramePtr pUpper) -{ - int sx = dixScreenOrigins[pScreen->myNum].x + darwinMainScreenX; - int sy = dixScreenOrigins[pScreen->myNum].y + darwinMainScreenY; - - pFrame->devPrivate = AquaNewWindow(pUpper ? pUpper->devPrivate : NULL, - pFrame->x + sx, pFrame->y + sy, - pFrame->w, pFrame->h, - pFrame->isRoot); - AquaGetPixmap(pFrame->devPrivate, &pFrame->pixelData, - &pFrame->bytesPerRow, &pFrame->depth, - &pFrame->bitsPerPixel); -} - - -static void -AquaGlueDestroyFrame(ScreenPtr pScreen, RootlessFramePtr pFrame) -{ - AquaDestroyWindow(pFrame->devPrivate); -} - -static void -AquaGlueMoveFrame(ScreenPtr pScreen, RootlessFramePtr pFrame, - int oldX, int oldY) -{ - int sx = dixScreenOrigins[pScreen->myNum].x + darwinMainScreenX; - int sy = dixScreenOrigins[pScreen->myNum].y + darwinMainScreenY; - - AquaMoveWindow(pFrame->devPrivate, pFrame->x + sx, pFrame->y + sy); -} - - -static void -AquaGlueStartResizeFrame(ScreenPtr pScreen, RootlessFramePtr pFrame, - int oldX, int oldY, - unsigned int oldW, unsigned int oldH) -{ - int sx = dixScreenOrigins[pScreen->myNum].x + darwinMainScreenX; - int sy = dixScreenOrigins[pScreen->myNum].y + darwinMainScreenY; - - AquaStartResizeWindow(pFrame->devPrivate, - pFrame->x + sx, pFrame->y + sy, pFrame->w, pFrame->h); - AquaGetPixmap(pFrame->devPrivate, &pFrame->pixelData, - &pFrame->bytesPerRow, &pFrame->depth, - &pFrame->bitsPerPixel); -} - -static void -AquaGlueFinishResizeFrame(ScreenPtr pScreen, RootlessFramePtr pFrame, - int oldX, int oldY, - unsigned int oldW, unsigned int oldH) -{ - int sx = dixScreenOrigins[pScreen->myNum].x + darwinMainScreenX; - int sy = dixScreenOrigins[pScreen->myNum].y + darwinMainScreenY; - - AquaFinishResizeWindow(pFrame->devPrivate, - pFrame->x + sx, pFrame->y + sy, - pFrame->w, pFrame->h); -} - - -static void -AquaGlueRestackFrame(ScreenPtr pScreen, RootlessFramePtr pFrame, - RootlessFramePtr pOldPrev, - RootlessFramePtr pNewPrev) -{ - AquaRestackWindow(pFrame->devPrivate, - pNewPrev ? pNewPrev->devPrivate : NULL); -} - -static void -AquaGlueReshapeFrame(ScreenPtr pScreen, RootlessFramePtr pFrame, - RegionPtr pNewShape) -{ - // Don't correct for dixScreenOrigins here. - // pNewShape is in window-local coordinates. - BoxRec shapeBox = {0, 0, pFrame->w, pFrame->h}; - if (pFrame->isRoot) return; // shouldn't happen; mi or dix covers this - - REGION_INVERSE(pScreen, pNewShape, pNewShape, &shapeBox); - AquaReshapeWindow(pFrame->devPrivate, - (fakeBoxRec *) REGION_RECTS(pNewShape), - REGION_NUM_RECTS(pNewShape)); -} - -static void -AquaGlueUpdateRegion(ScreenPtr pScreen, RootlessFramePtr pFrame, - RegionPtr pDamage) -{ - AquaUpdateRects(pFrame->devPrivate, - (fakeBoxRec *) REGION_RECTS(pDamage), - REGION_NUM_RECTS(pDamage)); -} - -#if 0 -static void -AquaGlueStartDrawing(ScreenPtr pScreen, RootlessFramePtr pFrame) -{ - AquaStartDrawing(pFrame->devPrivate, &pFrame->pixelData, - &pFrame->bytesPerRow, &pFrame->depth, - &pFrame->bitsPerPixel); -} - -static void -AquaGlueStopDrawing(ScreenPtr pScreen, RootlessFramePtr pFrame) -{ - AquaStopDrawing(pFrame->devPrivate); -} -#endif - -static RootlessFrameProcs aquaRootlessProcs = { - AquaGlueCreateFrame, - AquaGlueDestroyFrame, - AquaGlueMoveFrame, - AquaGlueStartResizeFrame, - AquaGlueFinishResizeFrame, - AquaGlueRestackFrame, - AquaGlueReshapeFrame, - AquaGlueUpdateRegion -}; - - -/////////////////////////////////////// -// Rootless mode initialization. -// Exported by rootlessAqua.h - -/* - * AquaDisplayInit - * Find all Aqua screens. - */ -void -AquaDisplayInit(void) -{ - darwinScreensFound = AquaDisplayCount(); -} - - -/* - * AquaAddScreen - * Init the framebuffer and record pixmap parameters for the screen. - */ -Bool -AquaAddScreen(int index, ScreenPtr pScreen) -{ - DarwinFramebufferPtr dfb = SCREEN_PRIV(pScreen); - QuartzScreenPtr displayInfo = QUARTZ_PRIV(pScreen); - CGRect cgRect; - CGDisplayCount numDisplays; - CGDisplayCount allocatedDisplays = 0; - CGDirectDisplayID *displays = NULL; - CGDisplayErr cgErr; - - dfb->pixelInfo.pixelType = kIORGBDirectPixels; - AquaScreenInit(index, &dfb->x, &dfb->y, &dfb->width, &dfb->height, - &dfb->pitch, &dfb->pixelInfo.bitsPerComponent, - &dfb->pixelInfo.componentCount, &dfb->bitsPerPixel); - dfb->colorBitsPerPixel = dfb->pixelInfo.bitsPerComponent * - dfb->pixelInfo.componentCount; - - // No frame buffer - it's all in window pixmaps. - dfb->framebuffer = NULL; // malloc(dfb.pitch * dfb.height); - - // Get all CoreGraphics displays covered by this X11 display. - cgRect = CGRectMake(dfb->x, dfb->y, dfb->width, dfb->height); - do { - cgErr = CGGetDisplaysWithRect(cgRect, 0, NULL, &numDisplays); - if (cgErr) break; - allocatedDisplays = numDisplays; - displays = xrealloc(displays, - numDisplays * sizeof(CGDirectDisplayID)); - cgErr = CGGetDisplaysWithRect(cgRect, allocatedDisplays, displays, - &numDisplays); - if (cgErr != CGDisplayNoErr) break; - } while (numDisplays > allocatedDisplays); - - if (cgErr != CGDisplayNoErr || numDisplays == 0) { - ErrorF("Could not find CGDirectDisplayID(s) for X11 screen %d: %dx%d @ %d,%d.\n", - index, dfb->width, dfb->height, dfb->x, dfb->y); - return FALSE; - } - - // This X11 screen covers all CoreGraphics displays we just found. - // If there's more than one CG display, then video mirroring is on - // or PseudoramiX is on. - displayInfo->displayCount = allocatedDisplays; - displayInfo->displayIDs = displays; - - return TRUE; -} - -/* - * AquaSetupScreen - * Setup the screen for rootless access. - */ -Bool -AquaSetupScreen(int index, ScreenPtr pScreen) -{ - return RootlessInit(pScreen, &aquaRootlessProcs); -} Index: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAquaImp.h diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAquaImp.h:1.1 xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAquaImp.h:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAquaImp.h:1.1 Wed Mar 27 21:21:20 2002 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAquaImp.h Wed Mar 16 21:06:42 2005 @@ -1,38 +0,0 @@ -/* - * Rootless implementation for Mac OS X Aqua environment - * - * Greg Parker gparker@cs.stanford.edu - */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAquaImp.h,v 1.1 2002/03/28 02:21:20 torrey Exp $ */ - -#ifndef _ROOTLESSAQUAIMP_H -#define _ROOTLESSAQUAIMP_H - -#include "fakeBoxRec.h" - -int AquaDisplayCount(); - -void AquaScreenInit(int index, int *x, int *y, int *width, int *height, - int *rowBytes, unsigned long *bps, unsigned long *spp, - int *bpp); - -void *AquaNewWindow(void *upperw, int x, int y, int w, int h, int isRoot); - -void AquaDestroyWindow(void *rw); - -void AquaMoveWindow(void *rw, int x, int y); - -void AquaStartResizeWindow(void *rw, int x, int y, int w, int h); - -void AquaFinishResizeWindow(void *rw, int x, int y, int w, int h); - -void AquaUpdateRects(void *rw, fakeBoxRec *rects, int count); - -void AquaRestackWindow(void *rw, void *lowerw); - -void AquaReshapeWindow(void *rw, fakeBoxRec *rects, int count); - -void AquaGetPixmap(void *rw, char **bits, - int *rowBytes, int *depth, int *bpp); - -#endif /* _ROOTLESSAQUAIMP_H */ Index: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAquaImp.m diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAquaImp.m:1.1 xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAquaImp.m:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAquaImp.m:1.1 Wed Mar 27 21:21:20 2002 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAquaImp.m Wed Mar 16 21:06:42 2005 @@ -1,237 +0,0 @@ -/* - * Rootless implementation for Mac OS X Aqua environment - */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessAquaImp.m,v 1.1 2002/03/28 02:21:20 torrey Exp $ */ - -#include "rootlessAquaImp.h" -#include "XWindow.h" -#include "fakeBoxRec.h" -#include "quartzCommon.h" -#include "pseudoramiX.h" - -extern void ErrorF(const char *, ...); - -typedef struct { - XWindow *window; -} AquaWindowRec; - - -#define WINREC(rw) ((AquaWindowRec *)rw) - - -// Multihead note: When rootless mode uses PseudoramiX, the -// X server only sees one screen; only PseudoramiX itself knows -// about all of the screens. - -int AquaDisplayCount() -{ - aquaNumScreens = [[NSScreen screens] count]; - - if (noPseudoramiXExtension) { - return aquaNumScreens; - } else { - return 1; // only PseudoramiX knows about the rest - } -} - -void AquaScreenInit(int index, int *x, int *y, int *width, int *height, - int *rowBytes, unsigned long *bps, unsigned long *spp, - int *bpp) -{ - *bps = 8; - *spp = 3; - *bpp = 32; - - if (noPseudoramiXExtension) { - NSScreen *screen = [[NSScreen screens] objectAtIndex:index]; - NSRect frame = [screen frame]; - - // set x, y so (0,0) is top left of main screen - *x = NSMinX(frame); - *y = NSHeight([[NSScreen mainScreen] frame]) - NSHeight(frame) - - NSMinY(frame); - - *width = NSWidth(frame); - *height = NSHeight(frame); - *rowBytes = (*width) * (*bpp) / 8; - - // Shift the usable part of main screen down to avoid the menu bar. - if (NSEqualRects(frame, [[NSScreen mainScreen] frame])) { - *y += aquaMenuBarHeight; - *height -= aquaMenuBarHeight; - } - - } else { - int i; - NSRect unionRect = NSMakeRect(0, 0, 0, 0); - NSArray *screens = [NSScreen screens]; - - // Get the union of all screens (minus the menu bar on main screen) - for (i = 0; i < [screens count]; i++) { - NSScreen *screen = [screens objectAtIndex:i]; - NSRect frame = [screen frame]; - frame.origin.y = [[NSScreen mainScreen] frame].size.height - - frame.size.height - frame.origin.y; - if (NSEqualRects([screen frame], [[NSScreen mainScreen] frame])) { - frame.origin.y += aquaMenuBarHeight; - frame.size.height -= aquaMenuBarHeight; - } - unionRect = NSUnionRect(unionRect, frame); - } - - // Use unionRect as the screen size for the X server. - *x = unionRect.origin.x; - *y = unionRect.origin.y; - *width = unionRect.size.width; - *height = unionRect.size.height; - *rowBytes = (*width) * (*bpp) / 8; - - // Tell PseudoramiX about the real screens. - // InitOutput() will move the big screen to (0,0), - // so compensate for that here. - for (i = 0; i < [screens count]; i++) { - NSScreen *screen = [screens objectAtIndex:i]; - NSRect frame = [screen frame]; - int j; - - // Skip this screen if it's a mirrored copy of an earlier screen. - for (j = 0; j < i; j++) { - if (NSEqualRects(frame, [[screens objectAtIndex:j] frame])) { - ErrorF("PseudoramiX screen %d is a mirror of screen %d.\n", - i, j); - break; - } - } - if (j < i) continue; // this screen is a mirrored copy - - frame.origin.y = [[NSScreen mainScreen] frame].size.height - - frame.size.height - frame.origin.y; - - if (NSEqualRects([screen frame], [[NSScreen mainScreen] frame])) { - frame.origin.y += aquaMenuBarHeight; - frame.size.height -= aquaMenuBarHeight; - } - - ErrorF("PseudoramiX screen %d added: %dx%d @ (%d,%d).\n", i, - (int)frame.size.width, (int)frame.size.height, - (int)frame.origin.x, (int)frame.origin.y); - - frame.origin.x -= unionRect.origin.x; - frame.origin.y -= unionRect.origin.y; - - ErrorF("PseudoramiX screen %d placed at X11 coordinate (%d,%d).\n", - i, (int)frame.origin.x, (int)frame.origin.y); - - PseudoramiXAddScreen(frame.origin.x, frame.origin.y, - frame.size.width, frame.size.height); - } - } -} - -void *AquaNewWindow(void *upperw, int x, int y, int w, int h, int isRoot) -{ - AquaWindowRec *winRec = (AquaWindowRec *)malloc(sizeof(AquaWindowRec)); - NSRect frame = NSMakeRect(x, NSHeight([[NSScreen mainScreen] frame]) - - y - h, w, h); - - winRec->window = [[XWindow alloc] initWithContentRect:frame isRoot:isRoot]; - - if (upperw) { - AquaWindowRec *upperRec = WINREC(upperw); - int uppernum = [upperRec->window windowNumber]; - [winRec->window orderWindow:NSWindowBelow relativeTo:uppernum]; - } else { - [winRec->window orderFront:nil]; - } - - // fixme hide root for now - if (isRoot) [winRec->window orderOut:nil]; - - return winRec; -} - -void AquaDestroyWindow(void *rw) -{ - AquaWindowRec *winRec = WINREC(rw); - - [winRec->window release]; -} - -void AquaMoveWindow(void *rw, int x, int y) -{ - AquaWindowRec *winRec = WINREC(rw); - NSPoint topLeft = NSMakePoint(x, NSHeight([[NSScreen mainScreen] frame]) - - y); - - [winRec->window setFrameTopLeftPoint:topLeft]; -} - -void AquaStartResizeWindow(void *rw, int x, int y, int w, int h) -{ - AquaWindowRec *winRec = WINREC(rw); - NSRect frame = NSMakeRect(x, NSHeight([[NSScreen mainScreen] frame]) - - y - h, w, h); - - [winRec->window setFrame:frame display:NO]; -} - -void AquaFinishResizeWindow(void *rw, int x, int y, int w, int h) -{ - // refresh everything? fixme yes for testing - fakeBoxRec box = {0, 0, w, h}; - AquaWindowRec *winRec = WINREC(rw); - - [winRec->window refreshRects:&box count:1]; -} - -void AquaUpdateRects(void *rw, fakeBoxRec *rects, int count) -{ - AquaWindowRec *winRec = WINREC(rw); - - [winRec->window refreshRects:rects count:count]; -} - -// fixme is this upperw or lowerw? -void AquaRestackWindow(void *rw, void *upperw) -{ - AquaWindowRec *winRec = WINREC(rw); - - if (upperw) { - AquaWindowRec *upperRec = WINREC(upperw); - int uppernum = [upperRec->window windowNumber]; - [winRec->window orderWindow:NSWindowBelow relativeTo:uppernum]; - } else { - [winRec->window orderFront:nil]; - } - // [winRec->window setAcceptsMouseMovedEvents:YES]; - // fixme prefer to orderFront whenever possible - pass upperw, not lowerw -} - -// rects are the areas not part of the new shape -void AquaReshapeWindow(void *rw, fakeBoxRec *rects, int count) -{ - AquaWindowRec *winRec = WINREC(rw); - - // make transparent if window is now shaped - // transparent windows never go back to opaque - if (count > 0) { - [winRec->window setOpaque:NO]; - } - - [[winRec->window contentView] reshapeRects:rects count:count]; - - if (! [winRec->window isOpaque]) { - // force update of window shadow - [winRec->window setHasShadow:NO]; - [winRec->window setHasShadow:YES]; - } -} - -void AquaGetPixmap(void *rw, char **bits, - int *rowBytes, int *depth, int *bpp) -{ - AquaWindowRec *winRec = WINREC(rw); - - [winRec->window getBits:bits rowBytes:rowBytes depth:depth - bitsPerPixel:bpp]; -} Index: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessCommon.c diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessCommon.c:1.2 xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessCommon.c:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessCommon.c:1.2 Mon Nov 10 13:21:47 2003 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessCommon.c Wed Mar 16 21:06:42 2005 @@ -1,262 +0,0 @@ -/* - * Common rootless definitions and code - * - * Greg Parker gparker@cs.stanford.edu - */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessCommon.c,v 1.2 2003/11/10 18:21:47 tsi Exp $ */ - -#include "rootlessCommon.h" - - -RegionRec rootlessHugeRoot = {{-32767, -32767, 32767, 32767}, NULL}; - - -// Returns the top-level parent of pWindow. -// The root is the top-level parent of itself, even though the root is -// not otherwise considered to be a top-level window. -WindowPtr TopLevelParent(WindowPtr pWindow) -{ - WindowPtr top = pWindow; - - if (IsRoot(pWindow)) return pWindow; // root is top-level parent of itself - while (top && ! IsTopLevel(top)) top = top->parent; - return top; -} - - -// Returns TRUE if this window is visible inside a frame -// (e.g. it is visible and has a top-level or root parent) -Bool IsFramedWindow(WindowPtr pWin) -{ - WindowPtr top; - - if (! pWin->realized) return FALSE; - top = TopLevelParent(pWin); - return (top && WINREC(top)); -} - - -// Move the given pixmap's base address to where pixel (0, 0) -// would be if the pixmap's actual data started at (x, y) -void SetPixmapBaseToScreen(PixmapPtr pix, int x, int y) -{ - pix->devPrivate.ptr = (char *)(pix->devPrivate.ptr) - - (pix->drawable.bitsPerPixel/8 * x + y*pix->devKind); -} - - -// Update pWindow's pixmap. -// This needs to be called every time a window moves relative to -// its top-level parent, or the parent's pixmap data is reallocated. -// Three cases: -// * window is top-level with no existing pixmap: make one -// * window is top-level with existing pixmap: update it in place -// * window is descendant of top-level: point to top-level's pixmap -void UpdatePixmap(WindowPtr pWindow) -{ - WindowPtr top = TopLevelParent(pWindow); - RootlessWindowRec *winRec; - ScreenPtr pScreen = pWindow->drawable.pScreen; - PixmapPtr pix; - - RL_DEBUG_MSG("update pixmap (win 0x%x)", pWindow); - - // Don't use IsFramedWindow(); window is unrealized during RealizeWindow(). - - if (! top) { - RL_DEBUG_MSG("no parent\n"); - return; - } - winRec = WINREC(top); - if (!winRec) { - RL_DEBUG_MSG("not framed\n"); - return; - } - - if (pWindow == top) { - // This is the top window. Update its pixmap. - if (winRec->pixmap == NULL) { - // Allocate a new pixmap. - pix = GetScratchPixmapHeader(pScreen, - winRec->frame.w, winRec->frame.h, - winRec->frame.depth, - winRec->frame.bitsPerPixel, - winRec->frame.bytesPerRow, - winRec->frame.pixelData); - SetPixmapBaseToScreen(pix, winRec->frame.x, winRec->frame.y); - pScreen->SetWindowPixmap(pWindow, pix); - winRec->pixmap = pix; - } else { - // Update existing pixmap. Update in place so we don't have to - // change the children's pixmaps. - pix = winRec->pixmap; - pScreen->ModifyPixmapHeader(pix, - winRec->frame.w, winRec->frame.h, - winRec->frame.depth, - winRec->frame.bitsPerPixel, - winRec->frame.bytesPerRow, - winRec->frame.pixelData); - SetPixmapBaseToScreen(pix, winRec->frame.x, winRec->frame.y); - } - } else { - // This is not the top window. Point to the parent's pixmap. - pix = winRec->pixmap; - pScreen->SetWindowPixmap(pWindow, pix); - } - - RL_DEBUG_MSG("done\n"); -} - - -#ifdef SHAPE - -// boundingShape = outside border (like borderClip) -// clipShape = inside border (like clipList) -// Both are in window-local coordinates -// We only care about boundingShape (fixme true?) - -// RootlessReallySetShape is used in several places other than SetShape. -// Most importantly, SetShape is often called on unmapped windows, so we -// have to wait until the window is mapped to reshape the frame. -static void RootlessReallySetShape(WindowPtr pWin) -{ - RootlessWindowRec *winRec = WINREC(pWin); - ScreenPtr pScreen = pWin->drawable.pScreen; - RegionRec newShape; - - if (IsRoot(pWin)) return; - if (!IsTopLevel(pWin)) return; - if (!winRec) return; - - if (wBoundingShape(pWin)) { - // wBoundingShape is relative to *inner* origin of window. - // Translate by borderWidth to get the outside-relative position. - REGION_NULL(pScreen, &newShape); - REGION_COPY(pScreen, &newShape, wBoundingShape(pWin)); - REGION_TRANSLATE(pScreen, &newShape, pWin->borderWidth, - pWin->borderWidth); - } else { - newShape.data = NULL; - newShape.extents.x1 = 0; - newShape.extents.y1 = 0; - newShape.extents.x2 = winRec->frame.w; - newShape.extents.y2 = winRec->frame.h; - } - RL_DEBUG_MSG("reshaping..."); - RL_DEBUG_MSG("numrects %d, extents %d %d %d %d ", - REGION_NUM_RECTS(&newShape), - newShape.extents.x1, newShape.extents.y1, - newShape.extents.x2, newShape.extents.y2); - CallFrameProc(pScreen, ReshapeFrame,(pScreen, &winRec->frame, &newShape)); - REGION_UNINIT(pScreen, &newShape); -} - -#endif // SHAPE - - -// pRegion is GLOBAL -void -RootlessDamageRegion(WindowPtr pWindow, RegionPtr pRegion) -{ - pWindow = TopLevelParent(pWindow); - if (!pWindow) { - RL_DEBUG_MSG("RootlessDamageRegion: window is not framed\n"); - } else if (!WINREC(pWindow)) { - RL_DEBUG_MSG("RootlessDamageRegion: top-level window not a frame\n"); - } else { - REGION_UNION((pWindow)->drawable.pScreen, &WINREC(pWindow)->damage, - &WINREC(pWindow)->damage, (pRegion)); - } -} - - -// pBox is GLOBAL -void -RootlessDamageBox(WindowPtr pWindow, BoxPtr pBox) -{ - RegionRec region; - - REGION_INIT(pWindow->drawable.pScreen, ®ion, pBox, 1); - RootlessDamageRegion(pWindow, ®ion); -} - - -// (x, y, w, h) is in window-local coordinates. -void -RootlessDamageRect(WindowPtr pWindow, int x, int y, int w, int h) -{ - BoxRec box; - RegionRec region; - - x += pWindow->drawable.x; - y += pWindow->drawable.y; - box.x1 = x; - box.x2 = x + w; - box.y1 = y; - box.y2 = y + h; - REGION_INIT(pWindow->drawable.pScreen, ®ion, &box, 1); - RootlessDamageRegion(pWindow, ®ion); -} - -#ifdef SHAPE - -void -RootlessDamageShape(WindowPtr pWin) -{ - RootlessWindowRec *winRec = WINREC(pWin); - - // We only care about the shape of top-level framed windows. - if (IsRoot(pWin)) return; - if (!IsTopLevel(pWin)) return; - if (!winRec) return; - - winRec->shapeDamage = TRUE; -} - -#endif // SHAPE - -void -RootlessRedisplay(WindowPtr pWindow) -{ - RootlessWindowRec *winRec = WINREC(pWindow); - ScreenPtr pScreen = pWindow->drawable.pScreen; - -#ifdef SHAPE - if (winRec->shapeDamage) { - // Reshape the window. This will also update the entire window. - RootlessReallySetShape(pWindow); - REGION_EMPTY(pScreen, &winRec->damage); - winRec->shapeDamage = FALSE; - } - else -#endif // SHAPE - if (REGION_NOTEMPTY(pScreen, &winRec->damage)) { - REGION_INTERSECT(pScreen, &winRec->damage, &winRec->damage, - &pWindow->borderSize); - - // move region to window local coords - REGION_TRANSLATE(pScreen, &winRec->damage, - -winRec->frame.x, -winRec->frame.y); - CallFrameProc(pScreen, UpdateRegion, - (pScreen, &winRec->frame, &winRec->damage)); - REGION_EMPTY(pScreen, &winRec->damage); - } -} - - -void -RootlessRedisplayScreen(ScreenPtr pScreen) -{ - WindowPtr root = WindowTable[pScreen->myNum]; - - if (root) { - WindowPtr win; - - RootlessRedisplay(root); - for (win = root->firstChild; win; win = win->nextSib) { - if (WINREC(win)) { - RootlessRedisplay(win); - } - } - } -} Index: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessCommon.h diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessCommon.h:1.1 xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessCommon.h:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessCommon.h:1.1 Wed Mar 27 21:21:20 2002 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessCommon.h Wed Mar 16 21:06:42 2005 @@ -1,214 +0,0 @@ -/* - * Common internal rootless definitions and code - * - * Greg Parker gparker@cs.stanford.edu - */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessCommon.h,v 1.1 2002/03/28 02:21:20 torrey Exp $ */ - -#ifndef _ROOTLESSCOMMON_H -#define _ROOTLESSCOMMON_H - -#include "rootless.h" - -#include "pixmapstr.h" -#include "windowstr.h" - -#ifdef RENDER -#include "picturestr.h" -#endif - - -// Debug output, or not. -#ifdef ROOTLESSDEBUG -#define RL_DEBUG_MSG ErrorF -#else -#define RL_DEBUG_MSG(a, ...) -#endif - - -// Global variables -extern int rootlessGCPrivateIndex; -extern int rootlessScreenPrivateIndex; -extern int rootlessWindowPrivateIndex; - - -// RootlessGCRec: private per-gc data -typedef struct { - GCFuncs *originalFuncs; - GCOps *originalOps; -} RootlessGCRec; - - -// RootlessWindowRec: private per-window data -typedef struct RootlessWindowRec { - RootlessFrameRec frame; - RegionRec damage; - unsigned int borderWidth; // needed for MoveWindow(VTOther) (%$#@!!!) - PixmapPtr pixmap; -#ifdef SHAPE - BOOL shapeDamage; // TRUE if shape has changed -#endif -} RootlessWindowRec; - - -// RootlessScreenRec: per-screen private data -typedef struct { - ScreenPtr pScreen; - RootlessFrameProcs frameProcs; - - CloseScreenProcPtr CloseScreen; - - CreateWindowProcPtr CreateWindow; - DestroyWindowProcPtr DestroyWindow; - RealizeWindowProcPtr RealizeWindow; - UnrealizeWindowProcPtr UnrealizeWindow; - MoveWindowProcPtr MoveWindow; - ResizeWindowProcPtr ResizeWindow; - RestackWindowProcPtr RestackWindow; - ChangeBorderWidthProcPtr ChangeBorderWidth; - PositionWindowProcPtr PositionWindow; - ChangeWindowAttributesProcPtr ChangeWindowAttributes; - - CreateGCProcPtr CreateGC; - PaintWindowBackgroundProcPtr PaintWindowBackground; - PaintWindowBorderProcPtr PaintWindowBorder; - CopyWindowProcPtr CopyWindow; - GetImageProcPtr GetImage; - - MarkOverlappedWindowsProcPtr MarkOverlappedWindows; - ValidateTreeProcPtr ValidateTree; - -#ifdef SHAPE - SetShapeProcPtr SetShape; -#endif - -#ifdef RENDER - CompositeProcPtr Composite; - GlyphsProcPtr Glyphs; -#endif - -} RootlessScreenRec; - - -// "Definition of the Porting Layer for the X11 Sample Server" says -// unwrap and rewrap of screen functions is unnecessary, but -// screen->CreateGC changes after a call to cfbCreateGC. - -#define SCREEN_UNWRAP(screen, fn) \ - screen->fn = SCREENREC(screen)->fn; - -#define SCREEN_WRAP(screen, fn) \ - SCREENREC(screen)->fn = screen->fn; \ - screen->fn = Rootless##fn - - -// Accessors for screen and window privates - -#define SCREENREC(pScreen) \ - ((RootlessScreenRec*)(pScreen)->devPrivates[rootlessScreenPrivateIndex].ptr) - -#define WINREC(pWin) \ - ((RootlessWindowRec *)(pWin)->devPrivates[rootlessWindowPrivateIndex].ptr) - - -// Call a rootless implementation function. -// Many rootless implementation functions are allowed to be NULL. -#define CallFrameProc(pScreen, proc, params) \ - if (SCREENREC(pScreen)->frameProcs.proc) { \ - RL_DEBUG_MSG("calling frame proc " #proc " "); \ - SCREENREC(pScreen)->frameProcs.proc params; \ - } - - -// BoxRec manipulators -// Copied from shadowfb - -#define TRIM_BOX(box, pGC) { \ - BoxPtr extents = &pGC->pCompositeClip->extents;\ - if(box.x1 < extents->x1) box.x1 = extents->x1; \ - if(box.x2 > extents->x2) box.x2 = extents->x2; \ - if(box.y1 < extents->y1) box.y1 = extents->y1; \ - if(box.y2 > extents->y2) box.y2 = extents->y2; \ -} - -#define TRANSLATE_BOX(box, pDraw) { \ - box.x1 += pDraw->x; \ - box.x2 += pDraw->x; \ - box.y1 += pDraw->y; \ - box.y2 += pDraw->y; \ -} - -#define TRIM_AND_TRANSLATE_BOX(box, pDraw, pGC) { \ - TRANSLATE_BOX(box, pDraw); \ - TRIM_BOX(box, pGC); \ -} - -#define BOX_NOT_EMPTY(box) \ - (((box.x2 - box.x1) > 0) && ((box.y2 - box.y1) > 0)) - - -// HUGE_ROOT and NORMAL_ROOT -// We don't want to clip windows to the edge of the screen. -// HUGE_ROOT temporarily makes the root window really big. -// This is needed as a wrapper around any function that calls -// SetWinSize or SetBorderSize which clip a window against its -// parents, including the root. - -extern RegionRec rootlessHugeRoot; - -#define HUGE_ROOT(pWin) \ - { \ - WindowPtr w = pWin; \ - while (w->parent) w = w->parent; \ - saveRoot = w->winSize; \ - w->winSize = rootlessHugeRoot; \ - } - -#define NORMAL_ROOT(pWin) \ - { \ - WindowPtr w = pWin; \ - while (w->parent) w = w->parent; \ - w->winSize = saveRoot; \ - } - - -// Returns TRUE if this window is a top-level window (i.e. child of the root) -// The root is not a top-level window. -#define IsTopLevel(pWin) \ - ((pWin) && (pWin)->parent && !(pWin)->parent->parent) - -// Returns TRUE if this window is a root window -#define IsRoot(pWin) \ - ((pWin) == WindowTable[(pWin)->drawable.pScreen->myNum]) - -// Returns the top-level parent of pWindow. -// The root is the top-level parent of itself, even though the root is -// not otherwise considered to be a top-level window. -WindowPtr TopLevelParent(WindowPtr pWindow); - -// Returns TRUE if this window is visible inside a frame -// (e.g. it is visible and has a top-level or root parent) -Bool IsFramedWindow(WindowPtr pWin); - -// Move the given pixmap's base address to where pixel (0, 0) -// would be if the pixmap's actual data started at (x, y). -void SetPixmapBaseToScreen(PixmapPtr pix, int x, int y); - -// Update pWindow's pixmap. -// This needs to be called every time a window moves relative to -// its top-level parent, or the parent's pixmap data is reallocated. -void UpdatePixmap(WindowPtr pWindow); - -// Routines that cause regions to get redrawn. -// DamageRegion and DamageRect are in global coordinates. -// DamageBox is in window-local coordinates. -void RootlessDamageRegion(WindowPtr pWindow, RegionPtr pRegion); -void RootlessDamageRect(WindowPtr pWindow, int x, int y, int w, int h); -void RootlessDamageBox(WindowPtr pWindow, BoxPtr pBox); -void RootlessRedisplay(WindowPtr pWindow); -void RootlessRedisplayScreen(ScreenPtr pScreen); - -// Window reshape needs to be updated. The reshape also forces complete redraw. -void RootlessDamageShape(WindowPtr pWin); - -#endif // _ROOTLESSCOMMON_H Index: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessGC.c diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessGC.c:1.1 xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessGC.c:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessGC.c:1.1 Wed Mar 27 21:21:20 2002 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessGC.c Wed Mar 16 21:06:42 2005 @@ -1,1170 +0,0 @@ -/* - * Graphics Context support for Mac OS X rootless X server - * - * Greg Parker gparker@cs.stanford.edu - * - * February 2001 Created - * March 3, 2001 Restructured as generic rootless mode - */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessGC.c,v 1.1 2002/03/28 02:21:20 torrey Exp $ */ - -#include "mi.h" -#include "scrnintstr.h" -#include "gcstruct.h" -#include "pixmapstr.h" -#include "windowstr.h" -#include "dixfontstr.h" -#include "mivalidate.h" - -#include -#include -#include - -#include "rootlessCommon.h" - - -// GC functions -static void RootlessValidateGC(GCPtr pGC, unsigned long changes, - DrawablePtr pDrawable); -static void RootlessChangeGC(GCPtr pGC, unsigned long mask); -static void RootlessCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst); -static void RootlessDestroyGC(GCPtr pGC); -static void RootlessChangeClip(GCPtr pGC, int type, pointer pvalue, - int nrects); -static void RootlessDestroyClip(GCPtr pGC); -static void RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc); - -GCFuncs rootlessGCFuncs = { - RootlessValidateGC, - RootlessChangeGC, - RootlessCopyGC, - RootlessDestroyGC, - RootlessChangeClip, - RootlessDestroyClip, - RootlessCopyClip, -}; - -// GC operations -static void RootlessFillSpans(); -static void RootlessSetSpans(); -static void RootlessPutImage(); -static RegionPtr RootlessCopyArea(); -static RegionPtr RootlessCopyPlane(); -static void RootlessPolyPoint(); -static void RootlessPolylines(); -static void RootlessPolySegment(); -static void RootlessPolyRectangle(); -static void RootlessPolyArc(); -static void RootlessFillPolygon(); -static void RootlessPolyFillRect(); -static void RootlessPolyFillArc(); -static int RootlessPolyText8(); -static int RootlessPolyText16(); -static void RootlessImageText8(); -static void RootlessImageText16(); -static void RootlessImageGlyphBlt(); -static void RootlessPolyGlyphBlt(); -static void RootlessPushPixels(); - -static GCOps rootlessGCOps = { - RootlessFillSpans, - RootlessSetSpans, - RootlessPutImage, - RootlessCopyArea, - RootlessCopyPlane, - RootlessPolyPoint, - RootlessPolylines, - RootlessPolySegment, - RootlessPolyRectangle, - RootlessPolyArc, - RootlessFillPolygon, - RootlessPolyFillRect, - RootlessPolyFillArc, - RootlessPolyText8, - RootlessPolyText16, - RootlessImageText8, - RootlessImageText16, - RootlessImageGlyphBlt, - RootlessPolyGlyphBlt, - RootlessPushPixels -#ifdef NEED_LINEHELPER - , NULL -#endif -}; - - -Bool -RootlessCreateGC(GCPtr pGC) -{ - RootlessGCRec *gcrec; - RootlessScreenRec *s; - Bool result; - - SCREEN_UNWRAP(pGC->pScreen, CreateGC); - s = (RootlessScreenRec *) pGC->pScreen-> - devPrivates[rootlessScreenPrivateIndex].ptr; - result = s->CreateGC(pGC); - gcrec = (RootlessGCRec *) pGC->devPrivates[rootlessGCPrivateIndex].ptr; - gcrec->originalOps = NULL; // don't wrap ops yet - gcrec->originalFuncs = pGC->funcs; - pGC->funcs = &rootlessGCFuncs; - - SCREEN_WRAP(pGC->pScreen, CreateGC); - return result; -} - - -// GC func wrapping -// ValidateGC wraps gcOps iff dest is viewable. All others just unwrap&call. - -// GCFUN_UNRAP assumes funcs have been wrapped and -// does not assume ops have been wrapped -#define GCFUNC_UNWRAP(pGC) \ - RootlessGCRec *gcrec = (RootlessGCRec *) \ - (pGC)->devPrivates[rootlessGCPrivateIndex].ptr; \ - (pGC)->funcs = gcrec->originalFuncs; \ - if (gcrec->originalOps) { \ - (pGC)->ops = gcrec->originalOps; \ -} - -#define GCFUNC_WRAP(pGC) \ - gcrec->originalFuncs = (pGC)->funcs; \ - (pGC)->funcs = &rootlessGCFuncs; \ - if (gcrec->originalOps) { \ - gcrec->originalOps = (pGC)->ops; \ - (pGC)->ops = &rootlessGCOps; \ -} - - -static void -RootlessValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) -{ - GCFUNC_UNWRAP(pGC); - - pGC->funcs->ValidateGC(pGC, changes, pDrawable); - - gcrec->originalOps = NULL; - - if (pDrawable->type == DRAWABLE_WINDOW) { - WindowPtr pWin = (WindowPtr) pDrawable; - - if (pWin->viewable) { - gcrec->originalOps = pGC->ops; - } - } - - GCFUNC_WRAP(pGC); -} - -static void RootlessChangeGC(GCPtr pGC, unsigned long mask) -{ - GCFUNC_UNWRAP(pGC); - pGC->funcs->ChangeGC(pGC, mask); - GCFUNC_WRAP(pGC); -} - -static void RootlessCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) -{ - GCFUNC_UNWRAP(pGCDst); - pGCDst->funcs->CopyGC(pGCSrc, mask, pGCDst); - GCFUNC_WRAP(pGCDst); -} - -static void RootlessDestroyGC(GCPtr pGC) -{ - GCFUNC_UNWRAP(pGC); - pGC->funcs->DestroyGC(pGC); - GCFUNC_WRAP(pGC); -} - -static void RootlessChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects) -{ - GCFUNC_UNWRAP(pGC); - pGC->funcs->ChangeClip(pGC, type, pvalue, nrects); - GCFUNC_WRAP(pGC); -} - -static void RootlessDestroyClip(GCPtr pGC) -{ - GCFUNC_UNWRAP(pGC); - pGC->funcs->DestroyClip(pGC); - GCFUNC_WRAP(pGC); -} - -static void RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc) -{ - GCFUNC_UNWRAP(pgcDst); - pgcDst->funcs->CopyClip(pgcDst, pgcSrc); - GCFUNC_WRAP(pgcDst); -} - - -// GC ops -// We can't use shadowfb because shadowfb assumes one pixmap -// and our root window is a special case. -// So much of this code is copied from shadowfb. - -// assumes both funcs and ops are wrapped -#define GCOP_UNWRAP(pGC) \ - RootlessGCRec *gcrec = (RootlessGCRec *) \ - (pGC)->devPrivates[rootlessGCPrivateIndex].ptr; \ - GCFuncs *saveFuncs = pGC->funcs; \ - (pGC)->funcs = gcrec->originalFuncs; \ - (pGC)->ops = gcrec->originalOps; - -#define GCOP_WRAP(pGC) \ - gcrec->originalOps = (pGC)->ops; \ - (pGC)->funcs = saveFuncs; \ - (pGC)->ops = &rootlessGCOps; - - -static void -RootlessFillSpans(DrawablePtr dst, GCPtr pGC, int nInit, - DDXPointPtr pptInit, int *pwidthInit, int sorted) -{ - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("fill spans start "); - - if (nInit <= 0) { - pGC->ops->FillSpans(dst, pGC, nInit, pptInit, pwidthInit, sorted); - } else { - DDXPointPtr ppt = pptInit; - int *pwidth = pwidthInit; - int i = nInit; - BoxRec box; - - box.x1 = ppt->x; - box.x2 = box.x1 + *pwidth; - box.y2 = box.y1 = ppt->y; - - while(--i) { - ppt++; - pwidthInit++; - if(box.x1 > ppt->x) - box.x1 = ppt->x; - if(box.x2 < (ppt->x + *pwidth)) - box.x2 = ppt->x + *pwidth; - if(box.y1 > ppt->y) - box.y1 = ppt->y; - else if(box.y2 < ppt->y) - box.y2 = ppt->y; - } - - box.y2++; - - pGC->ops->FillSpans(dst, pGC, nInit, pptInit, pwidthInit, sorted); - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("fill spans end\n"); -} - -static void -RootlessSetSpans(DrawablePtr dst, GCPtr pGC, char *pSrc, - DDXPointPtr pptInit, int *pwidthInit, - int nspans, int sorted) -{ - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("set spans start "); - - if (nspans <= 0) { - pGC->ops->SetSpans(dst, pGC, pSrc, pptInit, pwidthInit, - nspans, sorted); - } else { - DDXPointPtr ppt = pptInit; - int *pwidth = pwidthInit; - int i = nspans; - BoxRec box; - - box.x1 = ppt->x; - box.x2 = box.x1 + *pwidth; - box.y2 = box.y1 = ppt->y; - - while(--i) { - ppt++; - pwidth++; - if(box.x1 > ppt->x) - box.x1 = ppt->x; - if(box.x2 < (ppt->x + *pwidth)) - box.x2 = ppt->x + *pwidth; - if(box.y1 > ppt->y) - box.y1 = ppt->y; - else if(box.y2 < ppt->y) - box.y2 = ppt->y; - } - - box.y2++; - - pGC->ops->SetSpans(dst, pGC, pSrc, pptInit, pwidthInit, - nspans, sorted); - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - } - GCOP_WRAP(pGC); - RL_DEBUG_MSG("set spans end\n"); -} - -static void -RootlessPutImage(DrawablePtr dst, GCPtr pGC, - int depth, int x, int y, int w, int h, - int leftPad, int format, char *pBits) -{ - BoxRec box; - - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("put image start "); - - pGC->ops->PutImage(dst, pGC, depth, x,y,w,h, leftPad, format, pBits); - - box.x1 = x + dst->x; - box.x2 = box.x1 + w; - box.y1 = y + dst->y; - box.y2 = box.y1 + h; - - TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("put image end\n"); -} - -/* changed area is *dest* rect */ -/* If this code ever goes back go StartDrawing/StopDrawing: - * start and stop dst always - * start and stop src if src->type is DRAWABLE_WINDOW and src is framed - */ -static RegionPtr -RootlessCopyArea(DrawablePtr pSrc, DrawablePtr dst, GCPtr pGC, - int srcx, int srcy, int w, int h, - int dstx, int dsty) -{ - RegionPtr result; - BoxRec box; - - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("copy area start (src 0x%x, dst 0x%x)", pSrc, dst); - - result = pGC->ops->CopyArea(pSrc, dst, pGC, srcx, srcy, w, h, dstx, dsty); - - box.x1 = dstx + dst->x; - box.x2 = box.x1 + w; - box.y1 = dsty + dst->y; - box.y2 = box.y1 + h; - - TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("copy area end\n"); - return result; -} - -/* changed area is *dest* rect */ -/* If this code ever goes back go StartDrawing/StopDrawing: - * start and stop dst always - * start and stop src if src->type is DRAWABLE_WINDOW and src is framed - */ -static RegionPtr RootlessCopyPlane(DrawablePtr pSrc, DrawablePtr dst, - GCPtr pGC, int srcx, int srcy, - int w, int h, int dstx, int dsty, - unsigned long plane) -{ - RegionPtr result; - BoxRec box; - - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("copy plane start "); - - result = pGC->ops->CopyPlane(pSrc, dst, pGC, srcx, srcy, w, h, - dstx, dsty, plane); - - box.x1 = dstx + dst->x; - box.x2 = box.x1 + w; - box.y1 = dsty + dst->y; - box.y2 = box.y1 + h; - - TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("copy plane end\n"); - return result; -} - -// Options for size of changed area: -// 0 = box per point -// 1 = big box around all points -// 2 = accumulate point in 20 pixel radius -#define ROOTLESS_CHANGED_AREA 1 -#define abs(a) ((a) > 0 ? (a) : -(a)) - -/* changed area is box around all points */ -static void RootlessPolyPoint(DrawablePtr dst, GCPtr pGC, - int mode, int npt, DDXPointPtr pptInit) -{ - GCOP_UNWRAP(pGC); - - RL_DEBUG_MSG("polypoint start "); - - pGC->ops->PolyPoint(dst, pGC, mode, npt, pptInit); - - if (npt > 0) { -#if ROOTLESS_CHANGED_AREA==0 - // box per point - BoxRec box; - - while (npt) { - box.x1 = pptInit->x; - box.y1 = pptInit->y; - box.x2 = box.x1 + 1; - box.y2 = box.y1 + 1; - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - - npt--; - pptInit++; - } - -#elif ROOTLESS_CHANGED_AREA==1 - // one big box - BoxRec box; - - box.x2 = box.x1 = pptInit->x; - box.y2 = box.y1 = pptInit->y; - while(--npt) { - pptInit++; - if(box.x1 > pptInit->x) - box.x1 = pptInit->x; - else if(box.x2 < pptInit->x) - box.x2 = pptInit->x; - if(box.y1 > pptInit->y) - box.y1 = pptInit->y; - else if(box.y2 < pptInit->y) - box.y2 = pptInit->y; - } - - box.x2++; - box.y2++; - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - -#elif ROOTLESS_CHANGED_AREA==2 - // clever(?) method: accumulate point in 20-pixel radius - BoxRec box; - int firstx, firsty; - - box.x2 = box.x1 = firstx = pptInit->x; - box.y2 = box.y1 = firsty = pptInit->y; - while(--npt) { - pptInit++; - if (abs(pptInit->x - firstx) > 20 || - abs(pptInit->y - firsty) > 20) { - box.x2++; - box.y2++; - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - box.x2 = box.x1 = firstx = pptInit->x; - box.y2 = box.y1 = firsty = pptInit->y; - } else { - if (box.x1 > pptInit->x) box.x1 = pptInit->x; - else if (box.x2 < pptInit->x) box.x2 = pptInit->x; - if (box.y1 > pptInit->y) box.y1 = pptInit->y; - else if (box.y2 < pptInit->y) box.y2 = pptInit->y; - } - } - box.x2++; - box.y2++; - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); -#endif /* ROOTLESS_CHANGED_AREA */ - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("polypoint end\n"); -} - -#undef ROOTLESS_CHANGED_AREA - -/* changed area is box around each line */ -static void RootlessPolylines(DrawablePtr dst, GCPtr pGC, - int mode, int npt, DDXPointPtr pptInit) -{ - GCOP_UNWRAP(pGC); - - RL_DEBUG_MSG("poly lines start "); - - pGC->ops->Polylines(dst, pGC, mode, npt, pptInit); - - if (npt > 0) { - BoxRec box; - int extra = pGC->lineWidth >> 1; - - box.x2 = box.x1 = pptInit->x; - box.y2 = box.y1 = pptInit->y; - - if(npt > 1) { - if(pGC->joinStyle == JoinMiter) - extra = 6 * pGC->lineWidth; - else if(pGC->capStyle == CapProjecting) - extra = pGC->lineWidth; - } - - if(mode == CoordModePrevious) { - int x = box.x1; - int y = box.y1; - - while(--npt) { - pptInit++; - x += pptInit->x; - y += pptInit->y; - if(box.x1 > x) - box.x1 = x; - else if(box.x2 < x) - box.x2 = x; - if(box.y1 > y) - box.y1 = y; - else if(box.y2 < y) - box.y2 = y; - } - } else { - while(--npt) { - pptInit++; - if(box.x1 > pptInit->x) - box.x1 = pptInit->x; - else if(box.x2 < pptInit->x) - box.x2 = pptInit->x; - if(box.y1 > pptInit->y) - box.y1 = pptInit->y; - else if(box.y2 < pptInit->y) - box.y2 = pptInit->y; - } - } - - box.x2++; - box.y2++; - - if(extra) { - box.x1 -= extra; - box.x2 += extra; - box.y1 -= extra; - box.y2 += extra; - } - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("poly lines end\n"); -} - -/* changed area is box around each line segment */ -static void RootlessPolySegment(DrawablePtr dst, GCPtr pGC, - int nseg, xSegment *pSeg) -{ - GCOP_UNWRAP(pGC); - - RL_DEBUG_MSG("poly segment start (win 0x%x)", dst); - - pGC->ops->PolySegment(dst, pGC, nseg, pSeg); - - if (nseg > 0) { - BoxRec box; - int extra = pGC->lineWidth; - - if(pGC->capStyle != CapProjecting) - extra >>= 1; - - if(pSeg->x2 > pSeg->x1) { - box.x1 = pSeg->x1; - box.x2 = pSeg->x2; - } else { - box.x2 = pSeg->x1; - box.x1 = pSeg->x2; - } - - if(pSeg->y2 > pSeg->y1) { - box.y1 = pSeg->y1; - box.y2 = pSeg->y2; - } else { - box.y2 = pSeg->y1; - box.y1 = pSeg->y2; - } - - while(--nseg) { - pSeg++; - if(pSeg->x2 > pSeg->x1) { - if(pSeg->x1 < box.x1) box.x1 = pSeg->x1; - if(pSeg->x2 > box.x2) box.x2 = pSeg->x2; - } else { - if(pSeg->x2 < box.x1) box.x1 = pSeg->x2; - if(pSeg->x1 > box.x2) box.x2 = pSeg->x1; - } - if(pSeg->y2 > pSeg->y1) { - if(pSeg->y1 < box.y1) box.y1 = pSeg->y1; - if(pSeg->y2 > box.y2) box.y2 = pSeg->y2; - } else { - if(pSeg->y2 < box.y1) box.y1 = pSeg->y2; - if(pSeg->y1 > box.y2) box.y2 = pSeg->y1; - } - } - - box.x2++; - box.y2++; - - if(extra) { - box.x1 -= extra; - box.x2 += extra; - box.y1 -= extra; - box.y2 += extra; - } - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("poly segment end\n"); -} - -/* changed area is box around each line (not entire rects) */ -static void RootlessPolyRectangle(DrawablePtr dst, GCPtr pGC, - int nRects, xRectangle *pRects) -{ - GCOP_UNWRAP(pGC); - - RL_DEBUG_MSG("poly rectangle start "); - - pGC->ops->PolyRectangle(dst, pGC, nRects, pRects); - - if (nRects > 0) { - BoxRec box; - int offset1, offset2, offset3; - - offset2 = pGC->lineWidth; - if(!offset2) offset2 = 1; - offset1 = offset2 >> 1; - offset3 = offset2 - offset1; - - while(nRects--) { - box.x1 = pRects->x - offset1; - box.y1 = pRects->y - offset1; - box.x2 = box.x1 + pRects->width + offset2; - box.y2 = box.y1 + offset2; - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - - box.x1 = pRects->x - offset1; - box.y1 = pRects->y + offset3; - box.x2 = box.x1 + offset2; - box.y2 = box.y1 + pRects->height - offset2; - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - - box.x1 = pRects->x + pRects->width - offset1; - box.y1 = pRects->y + offset3; - box.x2 = box.x1 + offset2; - box.y2 = box.y1 + pRects->height - offset2; - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - - box.x1 = pRects->x - offset1; - box.y1 = pRects->y + pRects->height - offset1; - box.x2 = box.x1 + pRects->width + offset2; - box.y2 = box.y1 + offset2; - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - - pRects++; - } - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("poly rectangle end\n"); -} - - -/* changed area is box around each arc (assumes all arcs are 360 degrees) */ -static void RootlessPolyArc(DrawablePtr dst, GCPtr pGC, int narcs, xArc *parcs) -{ - GCOP_UNWRAP(pGC); - - RL_DEBUG_MSG("poly arc start "); - - pGC->ops->PolyArc(dst, pGC, narcs, parcs); - - if (narcs > 0) { - int extra = pGC->lineWidth >> 1; - BoxRec box; - - box.x1 = parcs->x; - box.x2 = box.x1 + parcs->width; - box.y1 = parcs->y; - box.y2 = box.y1 + parcs->height; - - /* should I break these up instead ? */ - - while(--narcs) { - parcs++; - if(box.x1 > parcs->x) - box.x1 = parcs->x; - if(box.x2 < (parcs->x + parcs->width)) - box.x2 = parcs->x + parcs->width; - if(box.y1 > parcs->y) - box.y1 = parcs->y; - if(box.y2 < (parcs->y + parcs->height)) - box.y2 = parcs->y + parcs->height; - } - - if(extra) { - box.x1 -= extra; - box.x2 += extra; - box.y1 -= extra; - box.y2 += extra; - } - - box.x2++; - box.y2++; - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("poly arc end\n"); -} - - -/* changed area is box around each poly */ -static void RootlessFillPolygon(DrawablePtr dst, GCPtr pGC, - int shape, int mode, int count, - DDXPointPtr pptInit) -{ - GCOP_UNWRAP(pGC); - - RL_DEBUG_MSG("fill poly start "); - - if (count <= 2) { - pGC->ops->FillPolygon(dst, pGC, shape, mode, count, pptInit); - } else { - DDXPointPtr ppt = pptInit; - int i = count; - BoxRec box; - - box.x2 = box.x1 = ppt->x; - box.y2 = box.y1 = ppt->y; - - if(mode != CoordModeOrigin) { - int x = box.x1; - int y = box.y1; - - while(--i) { - ppt++; - x += ppt->x; - y += ppt->y; - if(box.x1 > x) - box.x1 = x; - else if(box.x2 < x) - box.x2 = x; - if(box.y1 > y) - box.y1 = y; - else if(box.y2 < y) - box.y2 = y; - } - } else { - while(--i) { - ppt++; - if(box.x1 > ppt->x) - box.x1 = ppt->x; - else if(box.x2 < ppt->x) - box.x2 = ppt->x; - if(box.y1 > ppt->y) - box.y1 = ppt->y; - else if(box.y2 < ppt->y) - box.y2 = ppt->y; - } - } - - box.x2++; - box.y2++; - - pGC->ops->FillPolygon(dst, pGC, shape, mode, count, pptInit); - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("fill poly end\n"); -} - -/* changed area is the rects */ -static void RootlessPolyFillRect(DrawablePtr dst, GCPtr pGC, - int nRectsInit, xRectangle *pRectsInit) -{ - GCOP_UNWRAP(pGC); - - RL_DEBUG_MSG("fill rect start (win 0x%x)", dst); - - if (nRectsInit <= 0) { - pGC->ops->PolyFillRect(dst, pGC, nRectsInit, pRectsInit); - } else { - BoxRec box; - xRectangle *pRects = pRectsInit; - int nRects = nRectsInit; - - box.x1 = pRects->x; - box.x2 = box.x1 + pRects->width; - box.y1 = pRects->y; - box.y2 = box.y1 + pRects->height; - - while(--nRects) { - pRects++; - if(box.x1 > pRects->x) - box.x1 = pRects->x; - if(box.x2 < (pRects->x + pRects->width)) - box.x2 = pRects->x + pRects->width; - if(box.y1 > pRects->y) - box.y1 = pRects->y; - if(box.y2 < (pRects->y + pRects->height)) - box.y2 = pRects->y + pRects->height; - } - - /* cfb messes with the pRectsInit so we have to do our - calculations first */ - - pGC->ops->PolyFillRect(dst, pGC, nRectsInit, pRectsInit); - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("fill rect end\n"); -} - - -/* changed area is box around each arc (assuming arcs are all 360 degrees) */ -static void RootlessPolyFillArc(DrawablePtr dst, GCPtr pGC, - int narcs, xArc *parcs) -{ - GCOP_UNWRAP(pGC); - - RL_DEBUG_MSG("fill arc start "); - - pGC->ops->PolyFillArc(dst, pGC, narcs, parcs); - - if (narcs > 0) { - BoxRec box; - - box.x1 = parcs->x; - box.x2 = box.x1 + parcs->width; - box.y1 = parcs->y; - box.y2 = box.y1 + parcs->height; - - /* should I break these up instead ? */ - - while(--narcs) { - parcs++; - if(box.x1 > parcs->x) - box.x1 = parcs->x; - if(box.x2 < (parcs->x + parcs->width)) - box.x2 = parcs->x + parcs->width; - if(box.y1 > parcs->y) - box.y1 = parcs->y; - if(box.y2 < (parcs->y + parcs->height)) - box.y2 = parcs->y + parcs->height; - } - - TRIM_AND_TRANSLATE_BOX(box, dst, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("fill arc end"); -} - - -static void RootlessImageText8(DrawablePtr dst, GCPtr pGC, - int x, int y, int count, char *chars) -{ - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("imagetext8 start "); - - pGC->ops->ImageText8(dst, pGC, x, y, count, chars); - - if (count > 0) { - int top, bot, Min, Max; - BoxRec box; - - top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font)); - bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font)); - - Min = count * FONTMINBOUNDS(pGC->font, characterWidth); - if(Min > 0) Min = 0; - Max = count * FONTMAXBOUNDS(pGC->font, characterWidth); - if(Max < 0) Max = 0; - - /* ugh */ - box.x1 = dst->x + x + Min + - FONTMINBOUNDS(pGC->font, leftSideBearing); - box.x2 = dst->x + x + Max + - FONTMAXBOUNDS(pGC->font, rightSideBearing); - - box.y1 = dst->y + y - top; - box.y2 = dst->y + y + bot; - - TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("imagetext8 end\n"); -} - -static int RootlessPolyText8(DrawablePtr dst, GCPtr pGC, - int x, int y, int count, char *chars) -{ - int width; // the result, sorta - - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("polytext8 start "); - - width = pGC->ops->PolyText8(dst, pGC, x, y, count, chars); - width -= x; - - if(width > 0) { - BoxRec box; - - /* ugh */ - box.x1 = dst->x + x + FONTMINBOUNDS(pGC->font, leftSideBearing); - box.x2 = dst->x + x + FONTMAXBOUNDS(pGC->font, rightSideBearing); - - if(count > 1) { - if(width > 0) box.x2 += width; - else box.x1 += width; - } - - box.y1 = dst->y + y - FONTMAXBOUNDS(pGC->font, ascent); - box.y2 = dst->y + y + FONTMAXBOUNDS(pGC->font, descent); - - TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("polytext8 end\n"); - return (width + x); -} - -static void RootlessImageText16(DrawablePtr dst, GCPtr pGC, - int x, int y, int count, unsigned short *chars) -{ - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("imagetext16 start "); - - pGC->ops->ImageText16(dst, pGC, x, y, count, chars); - - if (count > 0) { - int top, bot, Min, Max; - BoxRec box; - - top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font)); - bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font)); - - Min = count * FONTMINBOUNDS(pGC->font, characterWidth); - if(Min > 0) Min = 0; - Max = count * FONTMAXBOUNDS(pGC->font, characterWidth); - if(Max < 0) Max = 0; - - /* ugh */ - box.x1 = dst->x + x + Min + - FONTMINBOUNDS(pGC->font, leftSideBearing); - box.x2 = dst->x + x + Max + - FONTMAXBOUNDS(pGC->font, rightSideBearing); - - box.y1 = dst->y + y - top; - box.y2 = dst->y + y + bot; - - TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("imagetext16 end\n"); -} - -static int RootlessPolyText16(DrawablePtr dst, GCPtr pGC, - int x, int y, int count, unsigned short *chars) -{ - int width; // the result, sorta - - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("polytext16 start "); - - width = pGC->ops->PolyText16(dst, pGC, x, y, count, chars); - width -= x; - - if (width > 0) { - BoxRec box; - - /* ugh */ - box.x1 = dst->x + x + FONTMINBOUNDS(pGC->font, leftSideBearing); - box.x2 = dst->x + x + FONTMAXBOUNDS(pGC->font, rightSideBearing); - - if(count > 1) { - if(width > 0) box.x2 += width; - else box.x1 += width; - } - - box.y1 = dst->y + y - FONTMAXBOUNDS(pGC->font, ascent); - box.y2 = dst->y + y + FONTMAXBOUNDS(pGC->font, descent); - - TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("polytext16 end\n"); - return width + x; -} - -static void RootlessImageGlyphBlt(DrawablePtr dst, GCPtr pGC, - int x, int y, unsigned int nglyph, - CharInfoPtr *ppci, pointer unused) -{ - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("imageglyph start "); - - pGC->ops->ImageGlyphBlt(dst, pGC, x, y, nglyph, ppci, unused); - - if (nglyph > 0) { - int top, bot, width = 0; - BoxRec box; - - top = max(FONTMAXBOUNDS(pGC->font, ascent), FONTASCENT(pGC->font)); - bot = max(FONTMAXBOUNDS(pGC->font, descent), FONTDESCENT(pGC->font)); - - box.x1 = ppci[0]->metrics.leftSideBearing; - if(box.x1 > 0) box.x1 = 0; - box.x2 = ppci[nglyph - 1]->metrics.rightSideBearing - - ppci[nglyph - 1]->metrics.characterWidth; - if(box.x2 < 0) box.x2 = 0; - - box.x2 += dst->x + x; - box.x1 += dst->x + x; - - while(nglyph--) { - width += (*ppci)->metrics.characterWidth; - ppci++; - } - - if(width > 0) - box.x2 += width; - else - box.x1 += width; - - box.y1 = dst->y + y - top; - box.y2 = dst->y + y + bot; - - TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("imageglyph end\n"); -} - -static void RootlessPolyGlyphBlt(DrawablePtr dst, GCPtr pGC, - int x, int y, unsigned int nglyph, - CharInfoPtr *ppci, pointer pglyphBase) -{ - GCOP_UNWRAP(pGC); - RL_DEBUG_MSG("polyglyph start "); - - pGC->ops->PolyGlyphBlt(dst, pGC, x, y, nglyph, ppci, pglyphBase); - - if (nglyph > 0) { - BoxRec box; - - /* ugh */ - box.x1 = dst->x + x + ppci[0]->metrics.leftSideBearing; - box.x2 = dst->x + x + ppci[nglyph - 1]->metrics.rightSideBearing; - - if(nglyph > 1) { - int width = 0; - - while(--nglyph) { - width += (*ppci)->metrics.characterWidth; - ppci++; - } - - if(width > 0) box.x2 += width; - else box.x1 += width; - } - - box.y1 = dst->y + y - FONTMAXBOUNDS(pGC->font, ascent); - box.y2 = dst->y + y + FONTMAXBOUNDS(pGC->font, descent); - - TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - } - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("polyglyph end\n"); -} - - -/* changed area is in dest */ -static void -RootlessPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr dst, - int dx, int dy, int xOrg, int yOrg) -{ - BoxRec box; - GCOP_UNWRAP(pGC); - - pGC->ops->PushPixels(pGC, pBitMap, dst, dx, dy, xOrg, yOrg); - - box.x1 = xOrg + dst->x; - box.x2 = box.x1 + dx; - box.y1 = yOrg + dst->y; - box.y2 = box.y1 + dy; - - TRIM_BOX(box, pGC); - if(BOX_NOT_EMPTY(box)) - RootlessDamageBox ((WindowPtr) dst, &box); - - GCOP_WRAP(pGC); - RL_DEBUG_MSG("push pixels end\n"); -} Index: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessScreen.c diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessScreen.c:1.2 xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessScreen.c:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessScreen.c:1.2 Wed Oct 16 17:13:33 2002 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessScreen.c Wed Mar 16 21:06:42 2005 @@ -1,426 +0,0 @@ -/* - * Screen routines for Mac OS X rootless X server - * - * Greg Parker gparker@cs.stanford.edu - * - * February 2001 Created - * March 3, 2001 Restructured as generic rootless mode - */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessScreen.c,v 1.2 2002/10/16 21:13:33 dawes Exp $ */ - - -#include "mi.h" -#include "scrnintstr.h" -#include "gcstruct.h" -#include "pixmapstr.h" -#include "windowstr.h" -#include "propertyst.h" -#include "mivalidate.h" -#include "picturestr.h" - -#include -#include -#include - -#include "rootlessCommon.h" -#include "rootlessWindow.h" - -extern int -rootlessMiValidateTree(WindowPtr pRoot, WindowPtr pChild, VTKind kind); -extern Bool -RootlessCreateGC(GCPtr pGC); - -// Initialize globals -int rootlessGCPrivateIndex = -1; -int rootlessScreenPrivateIndex = -1; -int rootlessWindowPrivateIndex = -1; - - -static Bool -RootlessCloseScreen(int i, ScreenPtr pScreen) -{ - RootlessScreenRec *s; - - s = SCREENREC(pScreen); - - // fixme unwrap everything that was wrapped? - pScreen->CloseScreen = s->CloseScreen; - - xfree(s); - return pScreen->CloseScreen(i, pScreen); -} - - -static void -RootlessGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, - unsigned int format, unsigned long planeMask, char *pdstLine) -{ - ScreenPtr pScreen = pDrawable->pScreen; - SCREEN_UNWRAP(pScreen, GetImage); - - if (pDrawable->type == DRAWABLE_WINDOW) { - /* Many apps use GetImage to sync with the visible frame buffer */ - // fixme entire screen or just window or all screens? - RootlessRedisplayScreen(pScreen); - } - - pScreen->GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine); - - SCREEN_WRAP(pScreen, GetImage); -} - - -#ifdef RENDER - -static void -RootlessComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, - INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, - INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) -{ - ScreenPtr pScreen = pDst->pDrawable->pScreen; - PictureScreenPtr ps = GetPictureScreen(pScreen); - WindowPtr dstWin; - - dstWin = (pDst->pDrawable->type == DRAWABLE_WINDOW) ? - (WindowPtr)pDst->pDrawable : NULL; - - // SCREEN_UNWRAP(ps, Composite); - ps->Composite = SCREENREC(pScreen)->Composite; - - ps->Composite(op, pSrc, pMask, pDst, - xSrc, ySrc, xMask, yMask, - xDst, yDst, width, height); - - if (dstWin && IsFramedWindow(dstWin)) { - RootlessDamageRect(dstWin, xDst, yDst, width, height); - } - - ps->Composite = RootlessComposite; - // SCREEN_WRAP(ps, Composite); -} - - -static void -RootlessGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, - int nlist, GlyphListPtr list, GlyphPtr *glyphs) -{ - ScreenPtr pScreen = pDst->pDrawable->pScreen; - PictureScreenPtr ps = GetPictureScreen(pScreen); - int x, y; - int n; - GlyphPtr glyph; - WindowPtr dstWin; - - dstWin = (pDst->pDrawable->type == DRAWABLE_WINDOW) ? - (WindowPtr)pDst->pDrawable : NULL; - - //SCREEN_UNWRAP(ps, Glyphs); - ps->Glyphs = SCREENREC(pScreen)->Glyphs; - ps->Glyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs); - ps->Glyphs = RootlessGlyphs; - //SCREEN_WRAP(ps, Glyphs); - - if (dstWin && IsFramedWindow(dstWin)) { - x = xSrc; - y = ySrc; - while (nlist--) { - x += list->xOff; - y += list->yOff; - n = list->len; - while (n--) { - glyph = *glyphs++; - RootlessDamageRect(dstWin, - x - glyph->info.x, y - glyph->info.y, - glyph->info.width, glyph->info.height); - x += glyph->info.xOff; - y += glyph->info.yOff; - } - list++; - } - } -} - -#endif // RENDER - - -// RootlessValidateTree -// ValidateTree is modified in two ways: -// * top-level windows don't clip each other -// * windows aren't clipped against root. -// These only matter when validating from the root. -static int -RootlessValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind) -{ - int result; - RegionRec saveRoot; - ScreenPtr pScreen = pParent->drawable.pScreen; - - SCREEN_UNWRAP(pScreen, ValidateTree); - RL_DEBUG_MSG("VALIDATETREE start "); - - // Use our custom version to validate from root - if (IsRoot(pParent)) { - RL_DEBUG_MSG("custom "); - result = rootlessMiValidateTree(pParent, pChild, kind); - } else { - HUGE_ROOT(pParent); - result = pScreen->ValidateTree(pParent, pChild, kind); - NORMAL_ROOT(pParent); - } - - SCREEN_WRAP(pScreen, ValidateTree); - RL_DEBUG_MSG("VALIDATETREE end\n"); - - return result; -} - - -// RootlessMarkOverlappedWindows -// MarkOverlappedWindows is modified to ignore overlapping -// top-level windows. -static Bool -RootlessMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst, - WindowPtr *ppLayerWin) -{ - RegionRec saveRoot; - Bool result; - ScreenPtr pScreen = pWin->drawable.pScreen; - SCREEN_UNWRAP(pScreen, MarkOverlappedWindows); - RL_DEBUG_MSG("MARKOVERLAPPEDWINDOWS start "); - - HUGE_ROOT(pWin); - if (IsRoot(pWin)) { - // root - mark nothing - RL_DEBUG_MSG("is root not marking "); - result = FALSE; - } - else if (! IsTopLevel(pWin)) { - // not top-level window - mark normally - result = pScreen->MarkOverlappedWindows(pWin, pFirst, ppLayerWin); - } - else { - //top-level window - mark children ONLY - NO overlaps with sibs (?) - // This code copied from miMarkOverlappedWindows() - - register WindowPtr pChild; - Bool anyMarked = FALSE; - void (* MarkWindow)() = pScreen->MarkWindow; - - RL_DEBUG_MSG("is top level! "); - /* single layered systems are easy */ - if (ppLayerWin) *ppLayerWin = pWin; - - if (pWin == pFirst) { - /* Blindly mark pWin and all of its inferiors. This is a slight - * overkill if there are mapped windows that outside pWin's border, - * but it's better than wasting time on RectIn checks. - */ - pChild = pWin; - while (1) { - if (pChild->viewable) { - if (REGION_BROKEN (pScreen, &pChild->winSize)) - SetWinSize (pChild); - if (REGION_BROKEN (pScreen, &pChild->borderSize)) - SetBorderSize (pChild); - (* MarkWindow)(pChild); - if (pChild->firstChild) { - pChild = pChild->firstChild; - continue; - } - } - while (!pChild->nextSib && (pChild != pWin)) - pChild = pChild->parent; - if (pChild == pWin) - break; - pChild = pChild->nextSib; - } - anyMarked = TRUE; - pFirst = pFirst->nextSib; - } - if (anyMarked) - (* MarkWindow)(pWin->parent); - result = anyMarked; - } - NORMAL_ROOT(pWin); - SCREEN_WRAP(pScreen, MarkOverlappedWindows); - RL_DEBUG_MSG("MARKOVERLAPPEDWINDOWS end\n"); - return result; -} - - -static void -RootlessPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) -{ - int oldBackgroundState = 0; - PixUnion oldBackground; - ScreenPtr pScreen = pWin->drawable.pScreen; - - SCREEN_UNWRAP(pScreen, PaintWindowBackground); - RL_DEBUG_MSG("paintwindowbackground start (win 0x%x) ", pWin); - if (IsFramedWindow(pWin)) { - if (IsRoot(pWin)) { - // set root background to magic transparent color - oldBackgroundState = pWin->backgroundState; - oldBackground = pWin->background; - pWin->backgroundState = BackgroundPixel; - pWin->background.pixel = 0x00fffffe; - } - } - - pScreen->PaintWindowBackground(pWin, pRegion, what); - - if (IsFramedWindow(pWin)) { - RootlessDamageRegion(pWin, pRegion); - if (IsRoot(pWin)) { - pWin->backgroundState = oldBackgroundState; - pWin->background = oldBackground; - } - } - SCREEN_WRAP(pScreen, PaintWindowBackground); - RL_DEBUG_MSG("paintwindowbackground end\n"); -} - - -static void -RootlessPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) -{ - SCREEN_UNWRAP(pWin->drawable.pScreen, PaintWindowBorder); - RL_DEBUG_MSG("paintwindowborder start (win 0x%x) ", pWin); - pWin->drawable.pScreen->PaintWindowBorder(pWin, pRegion, what); - if (IsFramedWindow(pWin)) { - RootlessDamageRegion(pWin, pRegion); - } - SCREEN_WRAP(pWin->drawable.pScreen, PaintWindowBorder); - RL_DEBUG_MSG("paintwindowborder end\n"); -} - - -// Flush drawing before blocking on select(). -static void -RootlessBlockHandler(pointer pbdata, OSTimePtr pTimeout, pointer pReadmask) -{ - RootlessRedisplayScreen((ScreenPtr) pbdata); -} - - -static void -RootlessWakeupHandler(pointer data, int i, pointer LastSelectMask) -{ - // nothing here -} - - -static Bool -RootlessAllocatePrivates(ScreenPtr pScreen) -{ - RootlessScreenRec *s; - static unsigned long rootlessGeneration = 0; - - if (rootlessGeneration != serverGeneration) { - rootlessScreenPrivateIndex = AllocateScreenPrivateIndex(); - if (rootlessScreenPrivateIndex == -1) return FALSE; - rootlessGCPrivateIndex = AllocateGCPrivateIndex(); - if (rootlessGCPrivateIndex == -1) return FALSE; - rootlessWindowPrivateIndex = AllocateWindowPrivateIndex(); - if (rootlessWindowPrivateIndex == -1) return FALSE; - rootlessGeneration = serverGeneration; - } - - // no allocation needed for screen privates - if (!AllocateGCPrivate(pScreen, rootlessGCPrivateIndex, - sizeof(RootlessGCRec))) - return FALSE; - if (!AllocateWindowPrivate(pScreen, rootlessWindowPrivateIndex, 0)) - return FALSE; - - s = xalloc(sizeof(RootlessScreenRec)); - if (! s) return FALSE; - SCREENREC(pScreen) = s; - - return TRUE; -} - - -static void -RootlessWrap(ScreenPtr pScreen) -{ - RootlessScreenRec *s = (RootlessScreenRec*) - pScreen->devPrivates[rootlessScreenPrivateIndex].ptr; - -#define WRAP(a) \ - if (pScreen->a) { \ - s->a = pScreen->a; \ - } else { \ - RL_DEBUG_MSG("null screen fn " #a "\n"); \ - s->a = NULL; \ - } \ - pScreen->a = Rootless##a - - WRAP(CloseScreen); - WRAP(CreateGC); - WRAP(PaintWindowBackground); - WRAP(PaintWindowBorder); - WRAP(CopyWindow); - WRAP(GetImage); - WRAP(CreateWindow); - WRAP(DestroyWindow); - WRAP(RealizeWindow); - WRAP(UnrealizeWindow); - WRAP(MoveWindow); - WRAP(PositionWindow); - WRAP(ResizeWindow); - WRAP(RestackWindow); - WRAP(ChangeBorderWidth); - WRAP(MarkOverlappedWindows); - WRAP(ValidateTree); - WRAP(ChangeWindowAttributes); - -#ifdef SHAPE - WRAP(SetShape); -#endif - -#ifdef RENDER - { - // Composite and Glyphs don't use normal screen wrapping - PictureScreenPtr ps = GetPictureScreen(pScreen); - s->Composite = ps->Composite; - ps->Composite = RootlessComposite; - s->Glyphs = ps->Glyphs; - ps->Glyphs = RootlessGlyphs; - } -#endif - - // WRAP(ClearToBackground); fixme put this back? useful for shaped wins? - // WRAP(RestoreAreas); fixme put this back? - -#undef WRAP -} - - -/* - * RootlessInit - * Rootless wraps lots of stuff and needs a bunch of devPrivates. - */ -Bool RootlessInit(ScreenPtr pScreen, RootlessFrameProcs *procs) -{ - RootlessScreenRec *s; - - if (! RootlessAllocatePrivates(pScreen)) return FALSE; - s = (RootlessScreenRec*) - pScreen->devPrivates[rootlessScreenPrivateIndex].ptr; - - s->pScreen = pScreen; - s->frameProcs = *procs; - - RootlessWrap(pScreen); - - if (!RegisterBlockAndWakeupHandlers (RootlessBlockHandler, - RootlessWakeupHandler, - (pointer) pScreen)) - { - return FALSE; - } - - return TRUE; -} Index: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessValTree.c diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessValTree.c:1.2 xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessValTree.c:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessValTree.c:1.2 Mon Nov 10 13:21:48 2003 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessValTree.c Wed Mar 16 21:06:42 2005 @@ -1,742 +0,0 @@ -/* - * Calculate window clip lists for rootless mode - * - * This file is very closely based on mivaltree.c. - */ - /* $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessValTree.c,v 1.2 2003/11/10 18:21:48 tsi Exp $ */ - -/* - * mivaltree.c -- - * Functions for recalculating window clip lists. Main function - * is miValidateTree. - * - -Copyright 1987, 1988, 1989, 1998 The Open Group - -All Rights Reserved. - -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 1987, 1988, 1989 by - * Digital Equipment Corporation, Maynard, Massachusetts, - * - * 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 name of Digital not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * DIGITAL 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. - * - ******************************************************************/ - -/* The panoramix components contained the following notice */ -/**************************************************************** -* * -* Copyright (c) Digital Equipment Corporation, 1991, 1997 * -* * -* All Rights Reserved. Unpublished rights reserved under * -* the copyright laws of the United States. * -* * -* The software contained on this media is proprietary to * -* and embodies the confidential technology of Digital * -* Equipment Corporation. Possession, use, duplication or * -* dissemination of the software and media is authorized only * -* pursuant to a valid written license from Digital Equipment * -* Corporation. * -* * -* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure * -* by the U.S. Government is subject to restrictions as set * -* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, * -* or in FAR 52.227-19, as applicable. * -* * -*****************************************************************/ - - /* - * Aug '86: Susan Angebranndt -- original code - * July '87: Adam de Boor -- substantially modified and commented - * Summer '89: Joel McCormack -- so fast you wouldn't believe it possible. - * In particular, much improved code for window mapping and - * circulating. - * Bob Scheifler -- avoid miComputeClips for unmapped windows, - * valdata changes - */ -#include "X.h" -#include "scrnintstr.h" -#include "validate.h" -#include "windowstr.h" -#include "mi.h" -#include "regionstr.h" -#include "mivalidate.h" - -#include "globals.h" - -#ifdef SHAPE -/* - * Compute the visibility of a shaped window - */ -int -rootlessShapedWindowIn (pScreen, universe, bounding, rect, x, y) - ScreenPtr pScreen; - RegionPtr universe, bounding; - BoxPtr rect; - register int x, y; -{ - BoxRec box; - register BoxPtr boundBox; - int nbox; - Bool someIn, someOut; - register int t, x1, y1, x2, y2; - - nbox = REGION_NUM_RECTS (bounding); - boundBox = REGION_RECTS (bounding); - someIn = someOut = FALSE; - x1 = rect->x1; - y1 = rect->y1; - x2 = rect->x2; - y2 = rect->y2; - while (nbox--) - { - if ((t = boundBox->x1 + x) < x1) - t = x1; - box.x1 = t; - if ((t = boundBox->y1 + y) < y1) - t = y1; - box.y1 = t; - if ((t = boundBox->x2 + x) > x2) - t = x2; - box.x2 = t; - if ((t = boundBox->y2 + y) > y2) - t = y2; - box.y2 = t; - if (box.x1 > box.x2) - box.x2 = box.x1; - if (box.y1 > box.y2) - box.y2 = box.y1; - switch (RECT_IN_REGION(pScreen, universe, &box)) - { - case rgnIN: - if (someOut) - return rgnPART; - someIn = TRUE; - break; - case rgnOUT: - if (someIn) - return rgnPART; - someOut = TRUE; - break; - default: - return rgnPART; - } - boundBox++; - } - if (someIn) - return rgnIN; - return rgnOUT; -} -#endif - -#define HasParentRelativeBorder(w) (!(w)->borderIsPixel && \ - HasBorder(w) && \ - (w)->backgroundState == ParentRelative) - - -/* - *----------------------------------------------------------------------- - * miComputeClips -- - * Recompute the clipList, borderClip, exposed and borderExposed - * regions for pParent and its children. Only viewable windows are - * taken into account. - * - * Results: - * None. - * - * Side Effects: - * clipList, borderClip, exposed and borderExposed are altered. - * A VisibilityNotify event may be generated on the parent window. - * - *----------------------------------------------------------------------- - */ -static void -rootlessComputeClips (pParent, pScreen, universe, kind, exposed) - register WindowPtr pParent; - register ScreenPtr pScreen; - register RegionPtr universe; - VTKind kind; - RegionPtr exposed; /* for intermediate calculations */ -{ - int dx, - dy; - RegionRec childUniverse; - register WindowPtr pChild; - int oldVis, newVis; - BoxRec borderSize; - RegionRec childUnion; - Bool overlap; - RegionPtr borderVisible; - Bool resized; - /* - * Figure out the new visibility of this window. - * The extent of the universe should be the same as the extent of - * the borderSize region. If the window is unobscured, this rectangle - * will be completely inside the universe (the universe will cover it - * completely). If the window is completely obscured, none of the - * universe will cover the rectangle. - */ - borderSize.x1 = pParent->drawable.x - wBorderWidth(pParent); - borderSize.y1 = pParent->drawable.y - wBorderWidth(pParent); - dx = (int) pParent->drawable.x + (int) pParent->drawable.width + wBorderWidth(pParent); - if (dx > 32767) - dx = 32767; - borderSize.x2 = dx; - dy = (int) pParent->drawable.y + (int) pParent->drawable.height + wBorderWidth(pParent); - if (dy > 32767) - dy = 32767; - borderSize.y2 = dy; - - oldVis = pParent->visibility; - switch (RECT_IN_REGION( pScreen, universe, &borderSize)) - { - case rgnIN: - newVis = VisibilityUnobscured; - break; - case rgnPART: - newVis = VisibilityPartiallyObscured; -#ifdef SHAPE - { - RegionPtr pBounding; - - if ((pBounding = wBoundingShape (pParent))) - { - switch (rootlessShapedWindowIn (pScreen, universe, - pBounding, &borderSize, - pParent->drawable.x, - pParent->drawable.y)) - { - case rgnIN: - newVis = VisibilityUnobscured; - break; - case rgnOUT: - newVis = VisibilityFullyObscured; - break; - } - } - } -#endif - break; - default: - newVis = VisibilityFullyObscured; - break; - } - - pParent->visibility = newVis; - if (oldVis != newVis && - ((pParent->eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask)) - SendVisibilityNotify(pParent); - - dx = pParent->drawable.x - pParent->valdata->before.oldAbsCorner.x; - dy = pParent->drawable.y - pParent->valdata->before.oldAbsCorner.y; - - /* - * avoid computations when dealing with simple operations - */ - - switch (kind) { - case VTMap: - case VTStack: - case VTUnmap: - break; - case VTMove: - if ((oldVis == newVis) && - ((oldVis == VisibilityFullyObscured) || - (oldVis == VisibilityUnobscured))) - { - pChild = pParent; - while (1) - { - if (pChild->viewable) - { - if (pChild->visibility != VisibilityFullyObscured) - { - REGION_TRANSLATE( pScreen, &pChild->borderClip, - dx, dy); - REGION_TRANSLATE( pScreen, &pChild->clipList, - dx, dy); - pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER; - if (pScreen->ClipNotify) - (* pScreen->ClipNotify) (pChild, dx, dy); - - } - if (pChild->valdata) - { - REGION_NULL(pScreen, - &pChild->valdata->after.borderExposed); - if (HasParentRelativeBorder(pChild)) - { - REGION_SUBTRACT(pScreen, - &pChild->valdata->after.borderExposed, - &pChild->borderClip, - &pChild->winSize); - } - REGION_NULL(pScreen, &pChild->valdata->after.exposed); - } - if (pChild->firstChild) - { - pChild = pChild->firstChild; - continue; - } - } - while (!pChild->nextSib && (pChild != pParent)) - pChild = pChild->parent; - if (pChild == pParent) - break; - pChild = pChild->nextSib; - } - return; - } - /* fall through */ - default: - /* - * To calculate exposures correctly, we have to translate the old - * borderClip and clipList regions to the window's new location so there - * is a correspondence between pieces of the new and old clipping regions. - */ - if (dx || dy) - { - /* - * We translate the old clipList because that will be exposed or copied - * if gravity is right. - */ - REGION_TRANSLATE( pScreen, &pParent->borderClip, dx, dy); - REGION_TRANSLATE( pScreen, &pParent->clipList, dx, dy); - } - break; - case VTBroken: - REGION_EMPTY (pScreen, &pParent->borderClip); - REGION_EMPTY (pScreen, &pParent->clipList); - break; - } - - borderVisible = pParent->valdata->before.borderVisible; - resized = pParent->valdata->before.resized; - REGION_NULL(pScreen, &pParent->valdata->after.borderExposed); - REGION_NULL(pScreen, &pParent->valdata->after.exposed); - - /* - * Since the borderClip must not be clipped by the children, we do - * the border exposure first... - * - * 'universe' is the window's borderClip. To figure the exposures, remove - * the area that used to be exposed from the new. - * This leaves a region of pieces that weren't exposed before. - */ - - if (HasBorder (pParent)) - { - if (borderVisible) - { - /* - * when the border changes shape, the old visible portions - * of the border will be saved by DIX in borderVisible -- - * use that region and destroy it - */ - REGION_SUBTRACT( pScreen, exposed, universe, borderVisible); - REGION_DESTROY( pScreen, borderVisible); - } - else - { - REGION_SUBTRACT( pScreen, exposed, universe, &pParent->borderClip); - } - if (HasParentRelativeBorder(pParent) && (dx || dy)) { - REGION_SUBTRACT( pScreen, &pParent->valdata->after.borderExposed, - universe, - &pParent->winSize); - } else { - REGION_SUBTRACT( pScreen, &pParent->valdata->after.borderExposed, - exposed, &pParent->winSize); - } - - REGION_COPY( pScreen, &pParent->borderClip, universe); - - /* - * To get the right clipList for the parent, and to make doubly sure - * that no child overlaps the parent's border, we remove the parent's - * border from the universe before proceeding. - */ - - REGION_INTERSECT( pScreen, universe, universe, &pParent->winSize); - } - else - REGION_COPY( pScreen, &pParent->borderClip, universe); - - if ((pChild = pParent->firstChild) && pParent->mapped) - { - REGION_NULL(pScreen, &childUniverse); - REGION_NULL(pScreen, &childUnion); - if ((pChild->drawable.y < pParent->lastChild->drawable.y) || - ((pChild->drawable.y == pParent->lastChild->drawable.y) && - (pChild->drawable.x < pParent->lastChild->drawable.x))) - { - for (; pChild; pChild = pChild->nextSib) - { - if (pChild->viewable) - REGION_APPEND( pScreen, &childUnion, &pChild->borderSize); - } - } - else - { - for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib) - { - if (pChild->viewable) - REGION_APPEND( pScreen, &childUnion, &pChild->borderSize); - } - } - REGION_VALIDATE( pScreen, &childUnion, &overlap); - - for (pChild = pParent->firstChild; - pChild; - pChild = pChild->nextSib) - { - if (pChild->viewable) { - /* - * If the child is viewable, we want to remove its extents - * from the current universe, but we only re-clip it if - * it's been marked. - */ - if (pChild->valdata) { - /* - * Figure out the new universe from the child's - * perspective and recurse. - */ - REGION_INTERSECT( pScreen, &childUniverse, - universe, - &pChild->borderSize); - rootlessComputeClips (pChild, pScreen, &childUniverse, - kind, exposed); - } - /* - * Once the child has been processed, we remove its extents - * from the current universe, thus denying its space to any - * other sibling. - */ - if (overlap) - REGION_SUBTRACT( pScreen, universe, universe, - &pChild->borderSize); - } - } - if (!overlap) - REGION_SUBTRACT( pScreen, universe, universe, &childUnion); - REGION_UNINIT( pScreen, &childUnion); - REGION_UNINIT( pScreen, &childUniverse); - } /* if any children */ - - /* - * 'universe' now contains the new clipList for the parent window. - * - * To figure the exposure of the window we subtract the old clip from the - * new, just as for the border. - */ - - if (oldVis == VisibilityFullyObscured || - oldVis == VisibilityNotViewable) - { - REGION_COPY( pScreen, &pParent->valdata->after.exposed, universe); - } - else if (newVis != VisibilityFullyObscured && - newVis != VisibilityNotViewable) - { - REGION_SUBTRACT( pScreen, &pParent->valdata->after.exposed, - universe, &pParent->clipList); - } - - /* - * One last thing: backing storage. We have to try to save what parts of - * the window are about to be obscured. We can just subtract the universe - * from the old clipList and get the areas that were in the old but aren't - * in the new and, hence, are about to be obscured. - */ - if (pParent->backStorage && !resized) - { - REGION_SUBTRACT( pScreen, exposed, &pParent->clipList, universe); - (* pScreen->SaveDoomedAreas)(pParent, exposed, dx, dy); - } - - /* HACK ALERT - copying contents of regions, instead of regions */ - { - RegionRec tmp; - - tmp = pParent->clipList; - pParent->clipList = *universe; - *universe = tmp; - } - -#ifdef NOTDEF - REGION_COPY( pScreen, &pParent->clipList, universe); -#endif - - pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER; - - if (pScreen->ClipNotify) - (* pScreen->ClipNotify) (pParent, dx, dy); -} - -static void -rootlessTreeObscured(pParent) - register WindowPtr pParent; -{ - register WindowPtr pChild; - register int oldVis; - - pChild = pParent; - while (1) - { - if (pChild->viewable) - { - oldVis = pChild->visibility; - if (oldVis != (pChild->visibility = VisibilityFullyObscured) && - ((pChild->eventMask | wOtherEventMasks(pChild)) & VisibilityChangeMask)) - SendVisibilityNotify(pChild); - if (pChild->firstChild) - { - pChild = pChild->firstChild; - continue; - } - } - while (!pChild->nextSib && (pChild != pParent)) - pChild = pChild->parent; - if (pChild == pParent) - break; - pChild = pChild->nextSib; - } -} - -/* - *----------------------------------------------------------------------- - * miValidateTree -- - * Recomputes the clip list for pParent and all its inferiors. - * - * Results: - * Always returns 1. - * - * Side Effects: - * The clipList, borderClip, exposed, and borderExposed regions for - * each marked window are altered. - * - * Notes: - * This routine assumes that all affected windows have been marked - * (valdata created) and their winSize and borderSize regions - * adjusted to correspond to their new positions. The borderClip and - * clipList regions should not have been touched. - * - * The top-most level is treated differently from all lower levels - * because pParent is unchanged. For the top level, we merge the - * regions taken up by the marked children back into the clipList - * for pParent, thus forming a region from which the marked children - * can claim their areas. For lower levels, where the old clipList - * and borderClip are invalid, we can't do this and have to do the - * extra operations done in miComputeClips, but this is much faster - * e.g. when only one child has moved... - * - *----------------------------------------------------------------------- - */ -/* - Quartz version: used for validate from root in rootless mode. - We need to make sure top-level windows don't clip each other, - and that top-level windows aren't clipped to the root window. -*/ -/*ARGSUSED*/ -// fixme this is ugly -// Xprint/ValTree.c doesn't work, but maybe that method can? -int -rootlessMiValidateTree (pRoot, pChild, kind) - WindowPtr pRoot; /* Parent to validate */ - WindowPtr pChild; /* First child of pRoot that was - * affected */ - VTKind kind; /* What kind of configuration caused call */ -{ - RegionRec totalClip; /* Total clipping region available to - * the marked children. pRoot's clipList - * merged with the borderClips of all - * the marked children. */ - RegionRec childClip; /* The new borderClip for the current - * child */ - RegionRec childUnion; /* the space covered by borderSize for - * all marked children */ - RegionRec exposed; /* For intermediate calculations */ - register ScreenPtr pScreen; - register WindowPtr pWin; - Bool overlap; - int viewvals; - Bool forward; - - pScreen = pRoot->drawable.pScreen; - if (pChild == NullWindow) - pChild = pRoot->firstChild; - - REGION_NULL(pScreen, &childClip); - REGION_NULL(pScreen, &exposed); - - /* - * compute the area of the parent window occupied - * by the marked children + the parent itself. This - * is the area which can be divied up among the marked - * children in their new configuration. - */ - REGION_NULL(pScreen, &totalClip); - viewvals = 0; - if (REGION_BROKEN (pScreen, &pRoot->clipList) && - !REGION_BROKEN (pScreen, &pRoot->borderClip)) - { - kind = VTBroken; - /* - * When rebuilding clip lists after out of memory, - * assume everything is busted. - */ - forward = TRUE; - REGION_COPY (pScreen, &totalClip, &pRoot->borderClip); - REGION_INTERSECT (pScreen, &totalClip, &totalClip, &pRoot->winSize); - - for (pWin = pRoot->firstChild; pWin != pChild; pWin = pWin->nextSib) - { - if (pWin->viewable) - REGION_SUBTRACT (pScreen, &totalClip, &totalClip, &pWin->borderSize); - } - for (pWin = pChild; pWin; pWin = pWin->nextSib) - if (pWin->valdata && pWin->viewable) - viewvals++; - - REGION_EMPTY (pScreen, &pRoot->clipList); - ErrorF("ValidateTree: BUSTED!\n"); - } - else - { - if ((pChild->drawable.y < pRoot->lastChild->drawable.y) || - ((pChild->drawable.y == pRoot->lastChild->drawable.y) && - (pChild->drawable.x < pRoot->lastChild->drawable.x))) - { - forward = TRUE; - for (pWin = pChild; pWin; pWin = pWin->nextSib) - { - if (pWin->valdata) - { - REGION_APPEND( pScreen, &totalClip, &pWin->borderClip); - if (pWin->viewable) - viewvals++; - } - } - } - else - { - forward = FALSE; - pWin = pRoot->lastChild; - while (1) - { - if (pWin->valdata) - { - REGION_APPEND( pScreen, &totalClip, &pWin->borderClip); - if (pWin->viewable) - viewvals++; - } - if (pWin == pChild) - break; - pWin = pWin->prevSib; - } - } - REGION_VALIDATE( pScreen, &totalClip, &overlap); - } - - - // calculate childUnion so we can subtract it from totalClip later - REGION_NULL(pScreen, &childUnion); - if (kind != VTStack) { - if (forward) - { - for (pWin = pChild; pWin; pWin = pWin->nextSib) - if (pWin->valdata && pWin->viewable) - REGION_APPEND( pScreen, &childUnion, - &pWin->borderSize); - } - else - { - pWin = pRoot->lastChild; - while (1) - { - if (pWin->valdata && pWin->viewable) - REGION_APPEND( pScreen, &childUnion, - &pWin->borderSize); - if (pWin == pChild) - break; - pWin = pWin->prevSib; - } - } - REGION_VALIDATE(pScreen, &childUnion, &overlap); - } - - - /* - * Now go through the children of the root and figure their new - * borderClips from the totalClip, passing that off to miComputeClips - * to handle recursively. Once that's done, we remove the child - * from the totalClip to clip any siblings below it. - */ - - for (pWin = pChild; - pWin != NullWindow; - pWin = pWin->nextSib) - { - if (pWin->viewable) { - if (pWin->valdata) { - REGION_COPY( pScreen, &childClip, &pWin->borderSize); - rootlessComputeClips (pWin, pScreen, &childClip, kind, &exposed); - } else if (pWin->visibility == VisibilityNotViewable) { - rootlessTreeObscured(pWin); - } - } else { - if (pWin->valdata) { - REGION_EMPTY( pScreen, &pWin->clipList); - if (pScreen->ClipNotify) - (* pScreen->ClipNotify) (pWin, 0, 0); - REGION_EMPTY( pScreen, &pWin->borderClip); - pWin->valdata = (ValidatePtr)NULL; - } - } - } - - REGION_UNINIT( pScreen, &childClip); - - // REGION_SUBTRACT(pScreen, &totalClip, &totalClip, &childUnion); - REGION_UNINIT(pScreen, &childUnion); - - REGION_NULL(pScreen, &pRoot->valdata->after.exposed); - REGION_NULL(pScreen, &pRoot->valdata->after.borderExposed); - - - REGION_UNINIT( pScreen, &totalClip); - REGION_UNINIT( pScreen, &exposed); - //if (pScreen->ClipNotify) - //(*pScreen->ClipNotify) (pRoot, 0, 0); - return (1); -} Index: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessWindow.c diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessWindow.c:1.2 xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessWindow.c:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessWindow.c:1.2 Mon Nov 10 13:21:48 2003 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessWindow.c Wed Mar 16 21:06:42 2005 @@ -1,674 +0,0 @@ -/* - * Rootless window management - * - * Greg Parker gparker@cs.stanford.edu - */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessWindow.c,v 1.2 2003/11/10 18:21:48 tsi Exp $ */ - -#include "rootlessCommon.h" -#include "rootlessWindow.h" - -#include "fb.h" - - -// RootlessCreateWindow -// For now, don't create a frame until the window is realized. -// Do reset the window size so it's not clipped by the root window. -Bool -RootlessCreateWindow(WindowPtr pWin) -{ - Bool result; - RegionRec saveRoot; - - WINREC(pWin) = NULL; - SCREEN_UNWRAP(pWin->drawable.pScreen, CreateWindow); - if (!IsRoot(pWin)) { - // win/border size set by DIX, not by wrapped CreateWindow, so - // correct it here. - // Don't HUGE_ROOT when pWin is the root! - HUGE_ROOT(pWin); - SetWinSize(pWin); - SetBorderSize(pWin); - } - result = pWin->drawable.pScreen->CreateWindow(pWin); - if (pWin->parent) { - NORMAL_ROOT(pWin); - } - SCREEN_WRAP(pWin->drawable.pScreen, CreateWindow); - return result; -} - - -// RootlessDestroyWindow -// For now, all window destruction takes place in UnrealizeWindow -Bool -RootlessDestroyWindow(WindowPtr pWin) -{ - Bool result; - - SCREEN_UNWRAP(pWin->drawable.pScreen, DestroyWindow); - result = pWin->drawable.pScreen->DestroyWindow(pWin); - SCREEN_WRAP(pWin->drawable.pScreen, DestroyWindow); - return result; -} - - -#ifdef SHAPE - -// RootlessSetShape -// Shape is usually set before the window is mapped, but (for now) we -// don't keep track of frames before they're mapped. So we just record -// that the shape needs to updated later. -void -RootlessSetShape(WindowPtr pWin) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - - RootlessDamageShape(pWin); - SCREEN_UNWRAP(pScreen, SetShape); - pScreen->SetShape(pWin); - SCREEN_WRAP(pScreen, SetShape); -} - -#endif // SHAPE - - -// Disallow ParentRelative background on top-level windows -// because the root window doesn't really have the right background -// and cfb will try to draw on the root instead of on the window. -// fixme what about fb? -// fixme implement ParentRelative with real transparency? -// ParentRelative prevention is also in RealizeWindow() -Bool -RootlessChangeWindowAttributes(WindowPtr pWin, unsigned long vmask) -{ - Bool result; - ScreenPtr pScreen = pWin->drawable.pScreen; - - RL_DEBUG_MSG("change window attributes start "); - - SCREEN_UNWRAP(pScreen, ChangeWindowAttributes); - result = pScreen->ChangeWindowAttributes(pWin, vmask); - SCREEN_WRAP(pScreen, ChangeWindowAttributes); - - if (WINREC(pWin)) { - // disallow ParentRelative background state - if (pWin->backgroundState == ParentRelative) { - XID pixel = 0; - ChangeWindowAttributes(pWin, CWBackPixel, &pixel, serverClient); - } - } - - RL_DEBUG_MSG("change window attributes end\n"); - return result; -} - - -// Update the frame position now. -// (x, y) are *inside* position! -// After this, mi and fb are expecting the pixmap to be at the new location. -Bool -RootlessPositionWindow(WindowPtr pWin, int x, int y) -{ - RootlessWindowRec *winRec = WINREC(pWin); - ScreenPtr pScreen = pWin->drawable.pScreen; - Bool result; - - RL_DEBUG_MSG("positionwindow start\n"); - if (winRec) { - winRec->frame.x = x - pWin->borderWidth; - winRec->frame.y = y - pWin->borderWidth; - } - - UpdatePixmap(pWin); - - SCREEN_UNWRAP(pScreen, PositionWindow); - result = pScreen->PositionWindow(pWin, x, y); - SCREEN_WRAP(pScreen, PositionWindow); - - RL_DEBUG_MSG("positionwindow end\n"); - return result; -} - - -// RootlessRealizeWindow -// The frame is created here and not in CreateWindow. -// fixme change this? probably not - would be faster, but eat more memory -Bool -RootlessRealizeWindow(WindowPtr pWin) -{ - Bool result = FALSE; - RegionRec saveRoot; - ScreenPtr pScreen = pWin->drawable.pScreen; - - RL_DEBUG_MSG("realizewindow start "); - - if (IsTopLevel(pWin) || IsRoot(pWin)) { - DrawablePtr d = &pWin->drawable; - RootlessWindowRec *winRec = xalloc(sizeof(RootlessWindowRec)); - - if (! winRec) goto windowcreatebad; - - winRec->frame.isRoot = (pWin == WindowTable[pScreen->myNum]); - winRec->frame.x = d->x - pWin->borderWidth; - winRec->frame.y = d->y - pWin->borderWidth; - winRec->frame.w = d->width + 2*pWin->borderWidth; - winRec->frame.h = d->height + 2*pWin->borderWidth; - winRec->frame.win = pWin; - winRec->frame.devPrivate = NULL; - - REGION_NULL(pScreen, &winRec->damage); - winRec->borderWidth = pWin->borderWidth; - - winRec->pixmap = NULL; - // UpdatePixmap() called below - - WINREC(pWin) = winRec; - - RL_DEBUG_MSG("creating frame "); - CallFrameProc(pScreen, CreateFrame, - (pScreen, &WINREC(pWin)->frame, - pWin->prevSib ? &WINREC(pWin->prevSib)->frame : NULL)); - - // fixme implement ParentRelative with transparency? - // need non-interfering fb first - // Disallow ParentRelative background state - // This might have been set before the window was mapped - if (pWin->backgroundState == ParentRelative) { - XID pixel = 0; - ChangeWindowAttributes(pWin, CWBackPixel, &pixel, serverClient); - } - -#ifdef SHAPE - // Shape is usually set before the window is mapped, but - // (for now) we don't keep track of frames before they're mapped. - winRec->shapeDamage = TRUE; -#endif - } - - UpdatePixmap(pWin); - - if (!IsRoot(pWin)) HUGE_ROOT(pWin); - SCREEN_UNWRAP(pScreen, RealizeWindow); - result = pScreen->RealizeWindow(pWin); - SCREEN_WRAP(pScreen, RealizeWindow); - if (!IsRoot(pWin)) NORMAL_ROOT(pWin); - - RL_DEBUG_MSG("realizewindow end\n"); - return result; - -windowcreatebad: - RL_DEBUG_MSG("window create bad! "); - RL_DEBUG_MSG("realizewindow end\n"); - return NULL; -} - - -Bool -RootlessUnrealizeWindow(WindowPtr pWin) -{ - Bool result; - ScreenPtr pScreen = pWin->drawable.pScreen; - - RL_DEBUG_MSG("unrealizewindow start "); - - if (IsTopLevel(pWin) || IsRoot(pWin)) { - RootlessWindowRec *winRec = WINREC(pWin); - - RootlessRedisplay(pWin); - CallFrameProc(pScreen, DestroyFrame, (pScreen, &winRec->frame)); - - REGION_UNINIT(pScreen, &winRec->damage); - - xfree(winRec); - WINREC(pWin) = NULL; - } - - SCREEN_UNWRAP(pScreen, UnrealizeWindow); - result = pScreen->UnrealizeWindow(pWin); - SCREEN_WRAP(pScreen, UnrealizeWindow); - RL_DEBUG_MSG("unrealizewindow end\n"); - return result; -} - - -void -RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib) -{ - RegionRec saveRoot; - RootlessWindowRec *winRec = WINREC(pWin); - ScreenPtr pScreen = pWin->drawable.pScreen; - - RL_DEBUG_MSG("restackwindow start "); - if (winRec) RL_DEBUG_MSG("restack top level \n"); - - HUGE_ROOT(pWin); - SCREEN_UNWRAP(pScreen, RestackWindow); - if (pScreen->RestackWindow) pScreen->RestackWindow(pWin, pOldNextSib); - SCREEN_WRAP(pScreen, RestackWindow); - NORMAL_ROOT(pWin); - - if (winRec) { - // fixme simplify the following - - WindowPtr oldNextW, newNextW, oldPrevW, newPrevW; - RootlessFramePtr oldNext, newNext, oldPrev, newPrev; - - oldNextW = pOldNextSib; - while (oldNextW && ! WINREC(oldNextW)) oldNextW = oldNextW->nextSib; - oldNext = oldNextW ? &WINREC(oldNextW)->frame : NULL; - - newNextW = pWin->nextSib; - while (newNextW && ! WINREC(newNextW)) newNextW = newNextW->nextSib; - newNext = newNextW ? &WINREC(newNextW)->frame : NULL; - - oldPrevW= pOldNextSib ? pOldNextSib->prevSib : pWin->parent->lastChild; - while (oldPrevW && ! WINREC(oldPrevW)) oldPrevW = oldPrevW->prevSib; - oldPrev = oldPrevW ? &WINREC(oldPrevW)->frame : NULL; - - newPrevW = pWin->prevSib; - while (newPrevW && ! WINREC(newPrevW)) newPrevW = newPrevW->prevSib; - newPrev = newPrevW ? &WINREC(newPrevW)->frame : NULL; - - if (pWin->prevSib) { - WindowPtr w = pWin->prevSib; - while (w) { - RL_DEBUG_MSG("w 0x%x\n", w); - w = w->parent; - } - } - - CallFrameProc(pScreen, RestackFrame, - (pScreen, &winRec->frame, oldPrev, newPrev)); - } - - RL_DEBUG_MSG("restackwindow end\n"); -} - - -/* - * Specialized window copy procedures - */ - -// Globals needed during window resize and move. -static PixmapPtr gResizeDeathPix = NULL; -static pointer gResizeDeathBits = NULL; -static PixmapPtr gResizeCopyWindowSource = NULL; -static CopyWindowProcPtr gResizeOldCopyWindowProc = NULL; - -// CopyWindow() that doesn't do anything. -// For MoveWindow() of top-level windows. -static void -RootlessNoCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, - RegionPtr prgnSrc) -{ - // some code expects the region to be translated - int dx = ptOldOrg.x - pWin->drawable.x; - int dy = ptOldOrg.y - pWin->drawable.y; - RL_DEBUG_MSG("ROOTLESSNOCOPYWINDOW "); - - REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); -} - - -// CopyWindow used during ResizeWindow for gravity moves. -// Cloned from fbCopyWindow -// The original always draws on the root pixmap (which we don't have). -// Instead, draw on the parent window's pixmap. -// Resize version: the old location's pixels are in gResizeCopyWindowSource -static void -RootlessResizeCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, - RegionPtr prgnSrc) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - SCREEN_UNWRAP(pScreen, CopyWindow); - RL_DEBUG_MSG("resizecopywindowFB start (win 0x%x) ", pWin); - - { - RegionRec rgnDst; - int dx, dy; - - dx = ptOldOrg.x - pWin->drawable.x; - dy = ptOldOrg.y - pWin->drawable.y; - REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy); - REGION_NULL(pScreen, &rgnDst); - REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, prgnSrc); - - fbCopyRegion (&gResizeCopyWindowSource->drawable, - &pScreen->GetWindowPixmap(pWin)->drawable, - 0, - &rgnDst, dx, dy, fbCopyWindowProc, 0, 0); - - // don't update - resize will update everything - // fixme DO update? - REGION_UNINIT(pScreen, &rgnDst); - fbValidateDrawable (&pWin->drawable); - } - - SCREEN_WRAP(pScreen, CopyWindow); - RL_DEBUG_MSG("resizecopywindowFB end\n"); -} - - -/* Update *new* location of window. Old location is redrawn with - * PaintWindowBackground/Border. - * Cloned from fbCopyWindow - * The original always draws on the root pixmap (which we don't have). - * Instead, draw on the parent window's pixmap. - */ -void -RootlessCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - SCREEN_UNWRAP(pScreen, CopyWindow); - RL_DEBUG_MSG("copywindowFB start (win 0x%x) ", pWin); - - { - RegionRec rgnDst; - int dx, dy; - - dx = ptOldOrg.x - pWin->drawable.x; - dy = ptOldOrg.y - pWin->drawable.y; - REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy); - - REGION_NULL(pScreen, &rgnDst); - REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, prgnSrc); - - fbCopyRegion ((DrawablePtr)pWin, (DrawablePtr)pWin, - 0, - &rgnDst, dx, dy, fbCopyWindowProc, 0, 0); - - // prgnSrc has been translated to dst position - RootlessDamageRegion(pWin, prgnSrc); - REGION_UNINIT(pScreen, &rgnDst); - fbValidateDrawable (&pWin->drawable); - } - - SCREEN_WRAP(pScreen, CopyWindow); - RL_DEBUG_MSG("copywindowFB end\n"); -} - - -/* - * Window resize procedures - */ - -// Prepare to resize a window. -// The old window's pixels are saved and the implementation is told -// to change the window size. -// (x,y,w,h) is outer frame of window (outside border) -static void -StartFrameResize(WindowPtr pWin, Bool gravity, - int oldX, int oldY, - unsigned int oldW, unsigned int oldH, unsigned int oldBW, - int newX, int newY, - unsigned int newW, unsigned int newH, unsigned int newBW) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - RootlessWindowRec *winRec = WINREC(pWin); - - RL_DEBUG_MSG("RESIZE TOPLEVEL WINDOW "); - RL_DEBUG_MSG("%d %d %d %d %d %d %d %d %d %d ", - oldX, oldY, oldW, oldH, oldBW, - newX, newY, newW, newH, newBW); - - RootlessRedisplay(pWin); - - // Make a copy of the current pixmap and all its data. - // The original will go away when we ask the frame manager to - // allocate the new pixmap. - - gResizeDeathBits = xalloc(winRec->frame.bytesPerRow * winRec->frame.h); - memcpy(gResizeDeathBits, winRec->frame.pixelData, - winRec->frame.bytesPerRow * winRec->frame.h); - gResizeDeathPix = - GetScratchPixmapHeader(pScreen, winRec->frame.w, winRec->frame.h, - winRec->frame.depth, winRec->frame.bitsPerPixel, - winRec->frame.bytesPerRow, gResizeDeathBits); - SetPixmapBaseToScreen(gResizeDeathPix, winRec->frame.x, winRec->frame.y); - - winRec->frame.x = newX; - winRec->frame.y = newY; - winRec->frame.w = newW; - winRec->frame.h = newH; - winRec->borderWidth = newBW; - - CallFrameProc(pScreen, StartResizeFrame, - (pScreen, &winRec->frame, oldX, oldY, oldW, oldH)); - UpdatePixmap(pWin); - - // Use custom CopyWindow when moving gravity bits around - // ResizeWindow assumes the old window contents are in the same - // pixmap, but here they're in deathPix instead. - if (gravity) { - gResizeCopyWindowSource = gResizeDeathPix; - gResizeOldCopyWindowProc = pScreen->CopyWindow; - pScreen->CopyWindow = RootlessResizeCopyWindow; - } - - // Copy pixels in intersection from src to dst. - // ResizeWindow assumes these pixels are already present when - // making gravity adjustments. - // pWin currently has new-sized pixmap but is in old position - // fixme border width change! - { - RegionRec r; - DrawablePtr src = &gResizeDeathPix->drawable; - DrawablePtr dst = &pScreen->GetWindowPixmap(pWin)->drawable; - // These vars are needed because implicit unsigned->signed fails - int oldX2 = (int)(oldX + oldW), newX2 = (int)(newX + newW); - int oldY2 = (int)(oldY + oldH), newY2 = (int)(newY + newH); - - r.data = NULL; - r.extents.x1 = max(oldX, newX); - r.extents.y1 = max(oldY, newY); - r.extents.x2 = min(oldX2, newX2); - r.extents.y2 = min(oldY2, newY2); - - // r is now intersection of of old location and new location - if (r.extents.x2 > r.extents.x1 && r.extents.y2 > r.extents.y1) { -#if 0 - DDXPointRec srcPt = {r.extents.x1, r.extents.y1}; - // Correct for border width change - // fixme need to correct for border width change - int dx = newX - oldX; - int dy = newY - oldY; - REGION_TRANSLATE(pScreen, &r, dx, dy); -#endif - fbCopyRegion(src, dst, NULL, &r, 0, 0, fbCopyWindowProc, 0, 0); - } - REGION_UNINIT(pScreen, &r); - } -} - - -static void -FinishFrameResize(WindowPtr pWin, Bool gravity, - int oldX, int oldY, - unsigned int oldW, unsigned int oldH, unsigned int oldBW, - int newX, int newY, - unsigned int newW, unsigned int newH, unsigned int newBW) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - RootlessWindowRec *winRec = WINREC(pWin); - - CallFrameProc(pScreen, FinishResizeFrame, - (pScreen, &winRec->frame, oldX, oldY, oldW, oldH)); - if (wBoundingShape(pWin)) { - RootlessDamageShape(pWin); - } - - // Destroy temp pixmap - FreeScratchPixmapHeader(gResizeDeathPix); - xfree(gResizeDeathBits); - gResizeDeathPix = gResizeDeathBits = NULL; - - if (gravity) { - pScreen->CopyWindow = gResizeOldCopyWindowProc; - gResizeCopyWindowSource = NULL; - } -} - - -// If kind==VTOther, window border is resizing (and borderWidth is -// already changed!!@#$) This case works like window resize, not move. -void -RootlessMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind) -{ - CopyWindowProcPtr oldCopyWindowProc = NULL; - RegionRec saveRoot; - RootlessWindowRec *winRec = WINREC(pWin); - ScreenPtr pScreen = pWin->drawable.pScreen; - int oldX = 0, oldY = 0, newX = 0, newY = 0; - unsigned int oldW = 0, oldH = 0, oldBW = 0, newW = 0, newH = 0, newBW = 0; - - RL_DEBUG_MSG("movewindow start \n"); - - if (winRec) { - if (kind == VTMove) { - oldX = winRec->frame.x; - oldY = winRec->frame.y; - RootlessRedisplay(pWin); - } else { - RL_DEBUG_MSG("movewindow border resizing "); - oldBW = winRec->borderWidth; - oldX = winRec->frame.x; - oldY = winRec->frame.y; - oldW = winRec->frame.w; - oldH = winRec->frame.h; - newBW = pWin->borderWidth; - newX = x; - newY = y; - newW = pWin->drawable.width + 2*newBW; - newH = pWin->drawable.height + 2*newBW; - StartFrameResize(pWin, FALSE, oldX, oldY, oldW, oldH, oldBW, - newX, newY, newW, newH, newBW); - } - } - - HUGE_ROOT(pWin); - SCREEN_UNWRAP(pScreen, MoveWindow); - if (winRec) { - oldCopyWindowProc = pScreen->CopyWindow; - pScreen->CopyWindow = RootlessNoCopyWindow; - } - pScreen->MoveWindow(pWin, x, y, pSib, kind); - if (winRec) { - pScreen->CopyWindow = oldCopyWindowProc; - } - NORMAL_ROOT(pWin); - SCREEN_WRAP(pScreen, MoveWindow); - - if (winRec) { - if (kind == VTMove) { - // PositionWindow has already set the new frame position. - CallFrameProc(pScreen, MoveFrame, - (pScreen, &winRec->frame, oldX, oldY)); - } else { - FinishFrameResize(pWin, FALSE, oldX, oldY, oldW, oldH, oldBW, - newX, newY, newW, newH, newBW); - } - } - - RL_DEBUG_MSG("movewindow end\n"); -} - - -// Note: (x, y, w, h) as passed to this procedure don't match -// the frame definition. -// (x,y) is corner of very outer edge, *outside* border -// w,h is width and height *inside8 border, *ignoring* border width -// The rect (x, y, w, h) doesn't mean anything. -// (x, y, w+2*bw, h+2*bw) is total rect -// (x+bw, y+bw, w, h) is inner rect - -void -RootlessResizeWindow(WindowPtr pWin, int x, int y, - unsigned int w, unsigned int h, WindowPtr pSib) -{ - RegionRec saveRoot; - RootlessWindowRec *winRec = WINREC(pWin); - ScreenPtr pScreen = pWin->drawable.pScreen; - int oldX = 0, oldY = 0, newX = 0, newY = 0; - unsigned int oldW = 0, oldH = 0, oldBW = 0, newW = 0, newH = 0, newBW = 0; - - RL_DEBUG_MSG("resizewindow start (win 0x%x) ", pWin); - - if (winRec) { - oldBW = winRec->borderWidth; - oldX = winRec->frame.x; - oldY = winRec->frame.y; - oldW = winRec->frame.w; - oldH = winRec->frame.h; - - newBW = oldBW; - newX = x; - newY = y; - newW = w + 2*newBW; - newH = h + 2*newBW; - - StartFrameResize(pWin, TRUE, oldX, oldY, oldW, oldH, oldBW, - newX, newY, newW, newH, newBW); - } - - HUGE_ROOT(pWin); - SCREEN_UNWRAP(pScreen, ResizeWindow); - pScreen->ResizeWindow(pWin, x, y, w, h, pSib); - SCREEN_WRAP(pScreen, ResizeWindow); - NORMAL_ROOT(pWin); - - if (winRec) { - FinishFrameResize(pWin, TRUE, oldX, oldY, oldW, oldH, oldBW, - newX, newY, newW, newH, newBW); - } - - RL_DEBUG_MSG("resizewindow end\n"); -} - - -// fixme untested! -// pWin inside corner stays the same -// pWin->drawable.[xy] stays the same -// frame moves and resizes -void -RootlessChangeBorderWidth(WindowPtr pWin, unsigned int width) -{ - RegionRec saveRoot; - - RL_DEBUG_MSG("change border width "); - if (width != pWin->borderWidth) { - RootlessWindowRec *winRec = WINREC(pWin); - int oldX = 0, oldY = 0, newX = 0, newY = 0; - unsigned int oldW = 0, oldH = 0, oldBW = 0; - unsigned int newW = 0, newH = 0, newBW = 0; - - if (winRec) { - oldBW = winRec->borderWidth; - oldX = winRec->frame.x; - oldY = winRec->frame.y; - oldW = winRec->frame.w; - oldH = winRec->frame.h; - - newBW = width; - newX = pWin->drawable.x - newBW; - newY = pWin->drawable.y - newBW; - newW = pWin->drawable.width + 2*newBW; - newH = pWin->drawable.height + 2*newBW; - - StartFrameResize(pWin, FALSE, oldX, oldY, oldW, oldH, oldBW, - newX, newY, newW, newH, newBW); - } - - HUGE_ROOT(pWin); - SCREEN_UNWRAP(pWin->drawable.pScreen, ChangeBorderWidth); - pWin->drawable.pScreen->ChangeBorderWidth(pWin, width); - SCREEN_WRAP(pWin->drawable.pScreen, ChangeBorderWidth); - NORMAL_ROOT(pWin); - - if (winRec) { - FinishFrameResize(pWin, FALSE, oldX, oldY, oldW, oldH, oldBW, - newX, newY, newW, newH, newBW); - } - } - RL_DEBUG_MSG("change border width end\n"); -} Index: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessWindow.h diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessWindow.h:1.1 xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessWindow.h:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessWindow.h:1.1 Wed Mar 27 21:21:20 2002 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessWindow.h Wed Mar 16 21:06:42 2005 @@ -1,32 +0,0 @@ -/* - * Rootless window management - * - * Greg Parker gparker@cs.stanford.edu - */ -/* $XFree86: xc/programs/Xserver/hw/darwin/quartz_1.3/rootlessWindow.h,v 1.1 2002/03/28 02:21:20 torrey Exp $ */ - -#ifndef _ROOTLESSWINDOW_H -#define _ROOTLESSWINDOW_H - -#include "rootlessCommon.h" - - -Bool RootlessCreateWindow(WindowPtr pWin); -Bool RootlessDestroyWindow(WindowPtr pWin); - -#ifdef SHAPE -void RootlessSetShape(WindowPtr pWin); -#endif // SHAPE - -Bool RootlessChangeWindowAttributes(WindowPtr pWin, unsigned long vmask); -Bool RootlessPositionWindow(WindowPtr pWin, int x, int y); -Bool RootlessRealizeWindow(WindowPtr pWin); -Bool RootlessUnrealizeWindow(WindowPtr pWin); -void RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib); -void RootlessCopyWindow(WindowPtr pWin,DDXPointRec ptOldOrg,RegionPtr prgnSrc); -void RootlessMoveWindow(WindowPtr pWin,int x,int y,WindowPtr pSib,VTKind kind); -void RootlessResizeWindow(WindowPtr pWin, int x, int y, - unsigned int w, unsigned int h, WindowPtr pSib); -void RootlessChangeBorderWidth(WindowPtr pWin, unsigned int width); - -#endif Index: xc/programs/Xserver/hw/darwin/quartz_1.3/XDarwin.pbproj/project.pbxproj diff -u xc/programs/Xserver/hw/darwin/quartz_1.3/XDarwin.pbproj/project.pbxproj:1.2 xc/programs/Xserver/hw/darwin/quartz_1.3/XDarwin.pbproj/project.pbxproj:removed --- xc/programs/Xserver/hw/darwin/quartz_1.3/XDarwin.pbproj/project.pbxproj:1.2 Thu Mar 28 20:25:11 2002 +++ xc/programs/Xserver/hw/darwin/quartz_1.3/XDarwin.pbproj/project.pbxproj Wed Mar 16 21:06:43 2005 @@ -1,1372 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 32; - objects = { - 01279092000747AA0A000002 = { - isa = PBXFileReference; - path = XServer.m; - refType = 4; - }; - 0127909600074AF60A000002 = { - isa = PBXFileReference; - name = XApplication.m; - path = ../quartz/XApplication.m; - refType = 4; - }; - 0127909800074B1A0A000002 = { - isa = PBXFileReference; - name = XApplication.h; - path = ../quartz/XApplication.h; - refType = 4; - }; - 014C68ED00ED6A9D7F000001 = { - isa = PBXFileReference; - path = XView.h; - refType = 4; - }; - 014C68EE00ED6A9D7F000001 = { - isa = PBXFileReference; - path = XView.m; - refType = 4; - }; - 014C68EF00ED6A9D7F000001 = { - isa = PBXFileReference; - path = XWindow.h; - refType = 4; - }; - 014C68F000ED6A9D7F000001 = { - isa = PBXFileReference; - path = XWindow.m; - refType = 4; - }; - 014C68F200ED7AD67F000001 = { - isa = PBXFileReference; - name = fakeBoxRec.h; - path = ../quartz/fakeBoxRec.h; - refType = 4; - }; - 014C68F300EE5AB97F000001 = { - isa = PBXFileReference; - path = rootlessCommon.c; - refType = 4; - }; - 014C68F400EE5AB97F000001 = { - isa = PBXFileReference; - path = rootlessCommon.h; - refType = 4; - }; - 014C68F700EE678F7F000001 = { - isa = PBXFileReference; - path = rootlessWindow.c; - refType = 4; - }; - 014C68F800EE678F7F000001 = { - isa = PBXFileReference; - path = rootlessWindow.h; - refType = 4; - }; - 015698ED003DF345CE6F79C2 = { - isa = PBXFileReference; - path = XDarwin.icns; - refType = 4; - }; - 0157A37D002CF6D7CE6F79C2 = { - children = ( - F533214601A4B45401000001, - 0157A37E002CF6D7CE6F79C2, - F58D65DF018F79B101000001, - F533213D0193CBE001000001, - 43B962E200617B93416877C2, - F5ACD263C5BE031F01000001, - F51BF62E02026E3501000001, - F5ACD25CC5B5E96601000001, - F587E16401924C6901000001, - ); - isa = PBXVariantGroup; - name = Credits.rtf; - path = ""; - refType = 4; - }; - 0157A37E002CF6D7CE6F79C2 = { - isa = PBXFileReference; - name = English; - path = English.lproj/Credits.rtf; - refType = 4; - }; - 015EDCEA004203A8CE6F79C2 = { - isa = PBXFrameworkReference; - name = IOKit.framework; - path = /System/Library/Frameworks/IOKit.framework; - refType = 0; - }; - 017D6F4400E861FB7F000001 = { - isa = PBXFileReference; - path = rootlessGC.c; - refType = 4; - }; - 017D6F4500E861FB7F000001 = { - isa = PBXFileReference; - path = rootlessScreen.c; - refType = 4; - }; - 018F40F2003E1902CE6F79C2 = { - children = ( - 018F40F3003E1916CE6F79C2, - 021D6BA9003E1BACCE6F79C2, - 3E74E03600863F047F000001, - 018F40F6003E1974CE6F79C2, - ); - isa = PBXGroup; - name = "X Server"; - path = ..; - refType = 4; - }; - 018F40F3003E1916CE6F79C2 = { - isa = PBXFileReference; - path = darwin.c; - refType = 4; - }; - 018F40F6003E1974CE6F79C2 = { - isa = PBXFileReference; - path = darwinKeyboard.c; - refType = 4; - }; - 018F40F8003E1979CE6F79C2 = { - isa = PBXFileReference; - path = quartz.c; - refType = 4; - }; - 018F40FA003E197ECE6F79C2 = { - isa = PBXFileReference; - path = quartz.h; - refType = 4; - }; - 018F40FC003E1983CE6F79C2 = { - isa = PBXFileReference; - path = xfIOKit.c; - refType = 4; - }; - 018F40FE003E1988CE6F79C2 = { - isa = PBXFileReference; - path = xfIOKit.h; - refType = 4; - }; - 018F4100003E19E4CE6F79C2 = { - isa = PBXFileReference; - path = xfIOKitCursor.c; - refType = 4; - }; -//010 -//011 -//012 -//013 -//014 -//020 -//021 -//022 -//023 -//024 - 021D6BA9003E1BACCE6F79C2 = { - isa = PBXFileReference; - path = darwin.h; - refType = 4; - }; - 02A1FEA6006D34BE416877C2 = { - isa = PBXFileReference; - path = xfIOKitStartup.c; - refType = 4; - }; - 02A1FEA8006D38F0416877C2 = { - isa = PBXFileReference; - path = quartzStartup.c; - refType = 4; - }; - 02E03CA000348209CE6F79C2 = { - children = ( - F533214701A4B48301000001, - 02E03CA100348209CE6F79C2, - F58D65E0018F79C001000001, - F533213E0193CBF401000001, - 43B962E300617B93416877C2, - F5ACD268C5BE046401000001, - F51BF62F02026E5C01000001, - F5ACD261C5B5EA2001000001, - F587E16501924C7401000001, - ); - isa = PBXVariantGroup; - name = XDarwinHelp.html; - path = ""; - refType = 4; - }; - 02E03CA100348209CE6F79C2 = { - isa = PBXFileReference; - name = English; - path = English.lproj/XDarwinHelp.html; - refType = 4; - }; -//020 -//021 -//022 -//023 -//024 -//030 -//031 -//032 -//033 -//034 - 0338412F0083BFE57F000001 = { - isa = PBXFileReference; - path = quartzCursor.h; - refType = 4; - }; -//030 -//031 -//032 -//033 -//034 -//040 -//041 -//042 -//043 -//044 - 04329610000763920A000002 = { - isa = PBXFileReference; - name = Preferences.m; - path = ../quartz/Preferences.m; - refType = 4; - }; - 04329611000763920A000002 = { - isa = PBXFileReference; - name = Preferences.h; - path = ../quartz/Preferences.h; - refType = 4; - }; -//040 -//041 -//042 -//043 -//044 -//060 -//061 -//062 -//063 -//064 - 06EB6C3B004099E7CE6F79C2 = { - isa = PBXFileReference; - path = quartzShared.h; - refType = 4; - }; -//060 -//061 -//062 -//063 -//064 -//080 -//081 -//082 -//083 -//084 - 080E96DDFE201D6D7F000001 = { - children = ( - 04329610000763920A000002, - 04329611000763920A000002, - 0127909600074AF60A000002, - 0127909800074B1A0A000002, - 01279092000747AA0A000002, - 1C4A3109004D8F24CE6F79C2, - 014C68EE00ED6A9D7F000001, - 014C68ED00ED6A9D7F000001, - 014C68F000ED6A9D7F000001, - 014C68EF00ED6A9D7F000001, - ); - isa = PBXGroup; - name = Classes; - refType = 4; - }; - 089C165CFE840E0CC02AAC07 = { - children = ( - F533214301A4B3F001000001, - 089C165DFE840E0CC02AAC07, - F58D65DD018F798F01000001, - F533213A0193CBA201000001, - 43B962E100617B49416877C2, - F5ACD269C5BE049301000001, - F51BF62B02026DDA01000001, - F5ACD262C5B5EA4D01000001, - F587E16101924C2F01000001, - ); - isa = PBXVariantGroup; - name = InfoPlist.strings; - refType = 4; - }; - 089C165DFE840E0CC02AAC07 = { - isa = PBXFileReference; - name = English; - path = English.lproj/InfoPlist.strings; - refType = 4; - }; -//080 -//081 -//082 -//083 -//084 -//0A0 -//0A1 -//0A2 -//0A3 -//0A4 - 0A79E19E004499A1CE6F79C2 = { - isa = PBXApplicationReference; - path = XDarwin.app; - refType = 3; - }; - 0A79E19F004499A1CE6F79C2 = { - buildPhases = ( - 0A79E1A0004499A1CE6F79C2, - 0A79E1A1004499A1CE6F79C2, - 0A79E1A2004499A1CE6F79C2, - 0A79E1A3004499A1CE6F79C2, - 0A79E1A4004499A1CE6F79C2, - ); - buildSettings = { - INSTALL_PATH = ""; - OPTIMIZATION_CFLAGS = ""; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = XDarwin; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; - WRAPPER_EXTENSION = app; - }; - dependencies = ( - ); - isa = PBXApplicationTarget; - name = XDarwin; - productInstallPath = ""; - productName = XDarwin; - productReference = 0A79E19E004499A1CE6F79C2; - productSettingsXML = " - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - XDarwin - CFBundleGetInfoString - XDarwin 1.1, ©2001-2002 XFree86 Project, Inc. - CFBundleIconFile - XDarwin.icns - CFBundleIdentifier - org.xfree86.XDarwin - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - XDarwin - CFBundlePackageType - APPL - CFBundleShortVersionString - XDarwin 1.1 - CFBundleSignature - ???? - CFBundleVersion - - NSHelpFile - XDarwinHelp.html - NSMainNibFile - MainMenu - NSPrincipalClass - XApplication - - -"; - shouldUseHeadermap = 0; - }; - 0A79E1A0004499A1CE6F79C2 = { - buildActionMask = 2147483647; - files = ( - ); - isa = PBXHeadersBuildPhase; - name = Headers; - }; - 0A79E1A1004499A1CE6F79C2 = { - buildActionMask = 2147483647; - files = ( - 0A79E1A600449EB2CE6F79C2, - 0A79E1A700449EB2CE6F79C2, - 0A79E1A800449EB2CE6F79C2, - 0A79E1A900449EB2CE6F79C2, - 0A79E1AA00449EB2CE6F79C2, - 1220774500712D2D416877C2, - F54BF6ED017D506E01000001, - ); - isa = PBXResourcesBuildPhase; - name = "Bundle Resources"; - }; - 0A79E1A2004499A1CE6F79C2 = { - buildActionMask = 2147483647; - files = ( - ); - isa = PBXSourcesBuildPhase; - name = Sources; - }; - 0A79E1A3004499A1CE6F79C2 = { - buildActionMask = 2147483647; - files = ( - ); - isa = PBXFrameworksBuildPhase; - name = "Frameworks & Libraries"; - }; - 0A79E1A4004499A1CE6F79C2 = { - buildActionMask = 2147483647; - files = ( - ); - isa = PBXRezBuildPhase; - name = "ResourceManager Resources"; - }; - 0A79E1A600449EB2CE6F79C2 = { - fileRef = 29B97318FDCFA39411CA2CEA; - isa = PBXBuildFile; - settings = { - }; - }; - 0A79E1A700449EB2CE6F79C2 = { - fileRef = 089C165CFE840E0CC02AAC07; - isa = PBXBuildFile; - settings = { - }; - }; - 0A79E1A800449EB2CE6F79C2 = { - fileRef = 0157A37D002CF6D7CE6F79C2; - isa = PBXBuildFile; - settings = { - }; - }; - 0A79E1A900449EB2CE6F79C2 = { - fileRef = 02E03CA000348209CE6F79C2; - isa = PBXBuildFile; - settings = { - }; - }; - 0A79E1AA00449EB2CE6F79C2 = { - fileRef = 015698ED003DF345CE6F79C2; - isa = PBXBuildFile; - settings = { - }; - }; -//0A0 -//0A1 -//0A2 -//0A3 -//0A4 -//100 -//101 -//102 -//103 -//104 - 1058C7A0FEA54F0111CA2CBB = { - children = ( - F53321400193CCF001000001, - 1BE4F84D0006C9890A000002, - 1058C7A1FEA54F0111CA2CBB, - F53321410193CCF001000001, - 015EDCEA004203A8CE6F79C2, - ); - isa = PBXGroup; - name = "Linked Frameworks"; - refType = 4; - }; - 1058C7A1FEA54F0111CA2CBB = { - isa = PBXFrameworkReference; - name = Cocoa.framework; - path = /System/Library/Frameworks/Cocoa.framework; - refType = 0; - }; - 1058C7A2FEA54F0111CA2CBB = { - children = ( - 29B97325FDCFA39411CA2CEA, - 29B97324FDCFA39411CA2CEA, - ); - isa = PBXGroup; - name = "Other Frameworks"; - refType = 4; - }; -//100 -//101 -//102 -//103 -//104 -//120 -//121 -//122 -//123 -//124 - 1220774300712D2D416877C2 = { - children = ( - F533214501A4B42501000001, - 1220774400712D2D416877C2, - F58D65DE018F79A001000001, - F533213C0193CBC901000001, - 1220774600712D75416877C2, - F5ACD266C5BE03C501000001, - F51BF62D02026E1C01000001, - F5ACD25FC5B5E9AA01000001, - F587E16301924C5E01000001, - ); - isa = PBXVariantGroup; - name = Localizable.strings; - path = ""; - refType = 4; - }; - 1220774400712D2D416877C2 = { - isa = PBXFileReference; - name = English; - path = English.lproj/Localizable.strings; - refType = 4; - }; - 1220774500712D2D416877C2 = { - fileRef = 1220774300712D2D416877C2; - isa = PBXBuildFile; - settings = { - }; - }; - 1220774600712D75416877C2 = { - isa = PBXFileReference; - name = Japanese; - path = Japanese.lproj/Localizable.strings; - refType = 4; - }; -//120 -//121 -//122 -//123 -//124 -//170 -//171 -//172 -//173 -//174 - 170DFAFF00729A35416877C2 = { - isa = PBXFileReference; - name = XDarwinStartup.c; - path = ../quartz/XDarwinStartup.c; - refType = 4; - }; - 170DFB0000729C86416877C2 = { - children = ( - 018F40FC003E1983CE6F79C2, - 018F40FE003E1988CE6F79C2, - 018F4100003E19E4CE6F79C2, - 02A1FEA6006D34BE416877C2, - ); - isa = PBXGroup; - name = IOKit; - path = ..; - refType = 4; - }; -//170 -//171 -//172 -//173 -//174 -//190 -//191 -//192 -//193 -//194 - 19C28FACFE9D520D11CA2CBB = { - children = ( - 0A79E19E004499A1CE6F79C2, - ); - isa = PBXGroup; - name = Products; - refType = 4; - }; -//190 -//191 -//192 -//193 -//194 -//1B0 -//1B1 -//1B2 -//1B3 -//1B4 - 1BD8DE4200B8A3567F000001 = { - children = ( - F533214401A4B40F01000001, - 1BD8DE4300B8A3567F000001, - F58D65DC018F794D01000001, - F533213B0193CBB401000001, - 1BD8DE4700B8A3C77F000001, - F5ACD264C5BE035B01000001, - F51BF62C02026E0601000001, - F5ACD25DC5B5E97701000001, - F587E16201924C5301000001, - ); - isa = PBXVariantGroup; - name = InfoPlist.strings.cpp; - path = ""; - refType = 4; - }; - 1BD8DE4300B8A3567F000001 = { - isa = PBXFileReference; - name = English; - path = English.lproj/InfoPlist.strings.cpp; - refType = 4; - }; - 1BD8DE4400B8A38E7F000001 = { - children = ( - F533214801A4B4D701000001, - 1BD8DE4500B8A38E7F000001, - F58D65E1018F79E001000001, - F533213F0193CC2501000001, - 1BD8DE4800B8A4167F000001, - F5ACD267C5BE03FC01000001, - F51BF63002026E8D01000001, - F5ACD260C5B5E9DF01000001, - F587E16601924C9D01000001, - ); - isa = PBXVariantGroup; - name = XDarwinHelp.html.cpp; - path = ""; - refType = 4; - }; - 1BD8DE4500B8A38E7F000001 = { - isa = PBXFileReference; - name = English; - path = English.lproj/XDarwinHelp.html.cpp; - refType = 4; - }; - 1BD8DE4700B8A3C77F000001 = { - isa = PBXFileReference; - name = Japanese; - path = Japanese.lproj/InfoPlist.strings.cpp; - refType = 4; - }; - 1BD8DE4800B8A4167F000001 = { - isa = PBXFileReference; - name = Japanese; - path = Japanese.lproj/XDarwinHelp.html.cpp; - refType = 4; - }; - 1BE4F84D0006C9890A000002 = { - isa = PBXFrameworkReference; - name = Carbon.framework; - path = /System/Library/Frameworks/Carbon.framework; - refType = 0; - }; -//1B0 -//1B1 -//1B2 -//1B3 -//1B4 -//1C0 -//1C1 -//1C2 -//1C3 -//1C4 - 1C4A3109004D8F24CE6F79C2 = { - isa = PBXFileReference; - path = XServer.h; - refType = 4; - }; -//1C0 -//1C1 -//1C2 -//1C3 -//1C4 -//230 -//231 -//232 -//233 -//234 - 237A34C10076E37E7F000001 = { - isa = PBXFileReference; - path = quartzAudio.c; - refType = 4; - }; - 237A34C20076E37E7F000001 = { - buildRules = ( - ); - buildSettings = { - COPY_PHASE_STRIP = NO; - }; - isa = PBXBuildStyle; - name = Development; - }; - 237A34C30076E37E7F000001 = { - buildRules = ( - ); - buildSettings = { - COPY_PHASE_STRIP = YES; - }; - isa = PBXBuildStyle; - name = Deployment; - }; - 237A34C40076F4F07F000001 = { - isa = PBXFileReference; - path = quartzAudio.h; - refType = 4; - }; -//230 -//231 -//232 -//233 -//234 -//290 -//291 -//292 -//293 -//294 - 29B97313FDCFA39411CA2CEA = { - buildStyles = ( - 237A34C20076E37E7F000001, - 237A34C30076E37E7F000001, - ); - isa = PBXProject; - knownRegions = ( - English, - Japanese, - French, - German, - Swedish, - Dutch, - Spanish, - ko, - Portuguese, - ); - mainGroup = 29B97314FDCFA39411CA2CEA; - projectDirPath = ""; - targets = ( - 0A79E19F004499A1CE6F79C2, - ); - }; - 29B97314FDCFA39411CA2CEA = { - children = ( - 080E96DDFE201D6D7F000001, - 018F40F2003E1902CE6F79C2, - 170DFB0000729C86416877C2, - 43B962CE00617089416877C2, - F51B53260253F84B01000001, - 32FEE13C00E07C3E7F000001, - 29B97315FDCFA39411CA2CEA, - 29B97317FDCFA39411CA2CEA, - 29B97323FDCFA39411CA2CEA, - 19C28FACFE9D520D11CA2CBB, - ); - isa = PBXGroup; - name = "Xmaster-Cocoa"; - path = ""; - refType = 4; - }; - 29B97315FDCFA39411CA2CEA = { - children = ( - 170DFAFF00729A35416877C2, - ); - isa = PBXGroup; - name = "Other Sources"; - path = ""; - refType = 2; - }; - 29B97317FDCFA39411CA2CEA = { - children = ( - 29B97318FDCFA39411CA2CEA, - 089C165CFE840E0CC02AAC07, - 1BD8DE4200B8A3567F000001, - 1220774300712D2D416877C2, - 0157A37D002CF6D7CE6F79C2, - 02E03CA000348209CE6F79C2, - 1BD8DE4400B8A38E7F000001, - 015698ED003DF345CE6F79C2, - F54BF6EA017D500901000001, - F54BF6EC017D506E01000001, - ); - isa = PBXGroup; - name = Resources; - path = ../bundle; - refType = 4; - }; - 29B97318FDCFA39411CA2CEA = { - children = ( - F533214201A4B3CE01000001, - 29B97319FDCFA39411CA2CEA, - F58D65DB018F793801000001, - F53321390193CB6A01000001, - 43B962E000617B49416877C2, - F5ACD265C5BE038601000001, - F51BF62A02026DAF01000001, - F5ACD25EC5B5E98D01000001, - F587E16001924C1D01000001, - ); - isa = PBXVariantGroup; - name = MainMenu.nib; - path = ""; - refType = 4; - }; - 29B97319FDCFA39411CA2CEA = { - isa = PBXFileReference; - name = English; - path = English.lproj/MainMenu.nib; - refType = 4; - }; - 29B97323FDCFA39411CA2CEA = { - children = ( - 1058C7A0FEA54F0111CA2CBB, - 1058C7A2FEA54F0111CA2CBB, - ); - isa = PBXGroup; - name = Frameworks; - path = ""; - refType = 4; - }; - 29B97324FDCFA39411CA2CEA = { - isa = PBXFrameworkReference; - name = AppKit.framework; - path = /System/Library/Frameworks/AppKit.framework; - refType = 0; - }; - 29B97325FDCFA39411CA2CEA = { - isa = PBXFrameworkReference; - name = Foundation.framework; - path = /System/Library/Frameworks/Foundation.framework; - refType = 0; - }; -//290 -//291 -//292 -//293 -//294 -//320 -//321 -//322 -//323 -//324 - 32FEE13C00E07C3E7F000001 = { - children = ( - 014C68F200ED7AD67F000001, - F5269C2D01D5BC3501000001, - F5269C2E01D5BC3501000001, - 32FEE13E00E07CBE7F000001, - 32FEE13F00E07CBE7F000001, - 32FEE14000E07CBE7F000001, - 32FEE14100E07CBE7F000001, - 32FEE14200E07CBE7F000001, - 014C68F300EE5AB97F000001, - 014C68F400EE5AB97F000001, - 017D6F4400E861FB7F000001, - 017D6F4500E861FB7F000001, - 014C68F700EE678F7F000001, - 014C68F800EE678F7F000001, - 32FEE14900E07D317F000001, - ); - isa = PBXGroup; - name = Rootless; - path = ""; - refType = 4; - }; - 32FEE13E00E07CBE7F000001 = { - isa = PBXFileReference; - path = rootless.h; - refType = 4; - }; - 32FEE13F00E07CBE7F000001 = { - isa = PBXFileReference; - path = rootlessAqua.h; - refType = 4; - }; - 32FEE14000E07CBE7F000001 = { - isa = PBXFileReference; - path = rootlessAquaGlue.c; - refType = 4; - }; - 32FEE14100E07CBE7F000001 = { - isa = PBXFileReference; - path = rootlessAquaImp.h; - refType = 4; - }; - 32FEE14200E07CBE7F000001 = { - isa = PBXFileReference; - path = rootlessAquaImp.m; - refType = 4; - }; - 32FEE14900E07D317F000001 = { - isa = PBXFileReference; - path = rootlessValTree.c; - refType = 4; - }; -//320 -//321 -//322 -//323 -//324 -//350 -//351 -//352 -//353 -//354 - 3576829A0077B8F17F000001 = { - isa = PBXFileReference; - path = quartzCursor.c; - refType = 4; - }; -//350 -//351 -//352 -//353 -//354 -//3E0 -//3E1 -//3E2 -//3E3 -//3E4 - 3E74E03600863F047F000001 = { - isa = PBXFileReference; - path = darwinClut8.h; - refType = 4; - }; -//3E0 -//3E1 -//3E2 -//3E3 -//3E4 -//430 -//431 -//432 -//433 -//434 - 43B962CE00617089416877C2 = { - children = ( - 018F40F8003E1979CE6F79C2, - 018F40FA003E197ECE6F79C2, - 237A34C10076E37E7F000001, - 237A34C40076F4F07F000001, - 3576829A0077B8F17F000001, - 0338412F0083BFE57F000001, - 43B962D000617089416877C2, - 43B962D100617089416877C2, - 43B962CF00617089416877C2, - F5582948015DAD3B01000001, - 06EB6C3B004099E7CE6F79C2, - 02A1FEA8006D38F0416877C2, - ); - isa = PBXGroup; - name = Quartz; - path = ../quartz; - refType = 4; - }; - 43B962CF00617089416877C2 = { - isa = PBXFileReference; - path = quartzCocoa.m; - refType = 4; - }; - 43B962D000617089416877C2 = { - isa = PBXFileReference; - path = quartzPasteboard.c; - refType = 4; - }; - 43B962D100617089416877C2 = { - isa = PBXFileReference; - path = quartzPasteboard.h; - refType = 4; - }; - 43B962E000617B49416877C2 = { - isa = PBXFileReference; - name = Japanese; - path = Japanese.lproj/MainMenu.nib; - refType = 4; - }; - 43B962E100617B49416877C2 = { - isa = PBXFileReference; - name = Japanese; - path = Japanese.lproj/InfoPlist.strings; - refType = 4; - }; - 43B962E200617B93416877C2 = { - isa = PBXFileReference; - name = Japanese; - path = Japanese.lproj/Credits.rtf; - refType = 4; - }; - 43B962E300617B93416877C2 = { - isa = PBXFileReference; - name = Japanese; - path = Japanese.lproj/XDarwinHelp.html; - refType = 4; - }; -//430 -//431 -//432 -//433 -//434 -//F50 -//F51 -//F52 -//F53 -//F54 - F51B53260253F84B01000001 = { - children = ( - F51B53270253F8B701000001, - F51B53280253F8B701000001, - ); - isa = PBXGroup; - name = "Full Screen"; - path = ../quartz; - refType = 4; - }; - F51B53270253F8B701000001 = { - isa = PBXFileReference; - path = fullscreen.c; - refType = 4; - }; - F51B53280253F8B701000001 = { - isa = PBXFileReference; - path = fullscreen.h; - refType = 4; - }; - F51BF62A02026DAF01000001 = { - isa = PBXFileReference; - name = Portuguese; - path = Portuguese.lproj/MainMenu.nib; - refType = 4; - }; - F51BF62B02026DDA01000001 = { - isa = PBXFileReference; - name = Portuguese; - path = Portuguese.lproj/InfoPlist.strings; - refType = 4; - }; - F51BF62C02026E0601000001 = { - isa = PBXFileReference; - name = Portuguese; - path = Portuguese.lproj/InfoPlist.strings.cpp; - refType = 4; - }; - F51BF62D02026E1C01000001 = { - isa = PBXFileReference; - name = Portuguese; - path = Portuguese.lproj/Localizable.strings; - refType = 4; - }; - F51BF62E02026E3501000001 = { - isa = PBXFileReference; - name = Portuguese; - path = Portuguese.lproj/Credits.rtf; - refType = 4; - }; - F51BF62F02026E5C01000001 = { - isa = PBXFileReference; - name = Portuguese; - path = Portuguese.lproj/XDarwinHelp.html; - refType = 4; - }; - F51BF63002026E8D01000001 = { - isa = PBXFileReference; - name = Portuguese; - path = Portuguese.lproj/XDarwinHelp.html.cpp; - refType = 4; - }; - F5269C2D01D5BC3501000001 = { - isa = PBXFileReference; - name = pseudoramiX.c; - path = ../quartz/pseudoramiX.c; - refType = 4; - }; - F5269C2E01D5BC3501000001 = { - isa = PBXFileReference; - name = pseudoramiX.h; - path = ../quartz/pseudoramiX.h; - refType = 4; - }; - F53321390193CB6A01000001 = { - isa = PBXFileReference; - name = German; - path = German.lproj/MainMenu.nib; - refType = 4; - }; - F533213A0193CBA201000001 = { - isa = PBXFileReference; - name = German; - path = German.lproj/InfoPlist.strings; - refType = 4; - }; - F533213B0193CBB401000001 = { - isa = PBXFileReference; - name = German; - path = German.lproj/InfoPlist.strings.cpp; - refType = 4; - }; - F533213C0193CBC901000001 = { - isa = PBXFileReference; - name = German; - path = German.lproj/Localizable.strings; - refType = 4; - }; - F533213D0193CBE001000001 = { - isa = PBXFileReference; - name = German; - path = German.lproj/Credits.rtf; - refType = 4; - }; - F533213E0193CBF401000001 = { - isa = PBXFileReference; - name = German; - path = German.lproj/XDarwinHelp.html; - refType = 4; - }; - F533213F0193CC2501000001 = { - isa = PBXFileReference; - name = German; - path = German.lproj/XDarwinHelp.html.cpp; - refType = 4; - }; - F53321400193CCF001000001 = { - isa = PBXFrameworkReference; - name = ApplicationServices.framework; - path = /System/Library/Frameworks/ApplicationServices.framework; - refType = 0; - }; - F53321410193CCF001000001 = { - isa = PBXFrameworkReference; - name = CoreAudio.framework; - path = /System/Library/Frameworks/CoreAudio.framework; - refType = 0; - }; - F533214201A4B3CE01000001 = { - isa = PBXFileReference; - name = Dutch; - path = Dutch.lproj/MainMenu.nib; - refType = 4; - }; - F533214301A4B3F001000001 = { - isa = PBXFileReference; - name = Dutch; - path = Dutch.lproj/InfoPlist.strings; - refType = 4; - }; - F533214401A4B40F01000001 = { - isa = PBXFileReference; - name = Dutch; - path = Dutch.lproj/InfoPlist.strings.cpp; - refType = 4; - }; - F533214501A4B42501000001 = { - isa = PBXFileReference; - name = Dutch; - path = Dutch.lproj/Localizable.strings; - refType = 4; - }; - F533214601A4B45401000001 = { - isa = PBXFileReference; - name = Dutch; - path = Dutch.lproj/Credits.rtf; - refType = 4; - }; - F533214701A4B48301000001 = { - isa = PBXFileReference; - name = Dutch; - path = Dutch.lproj/XDarwinHelp.html; - refType = 4; - }; - F533214801A4B4D701000001 = { - isa = PBXFileReference; - name = Dutch; - path = Dutch.lproj/XDarwinHelp.html.cpp; - refType = 4; - }; - F54BF6EA017D500901000001 = { - isa = PBXFileReference; - path = startXClients.cpp; - refType = 4; - }; - F54BF6EC017D506E01000001 = { - isa = PBXFileReference; - path = startXClients; - refType = 4; - }; - F54BF6ED017D506E01000001 = { - fileRef = F54BF6EC017D506E01000001; - isa = PBXBuildFile; - settings = { - }; - }; - F5582948015DAD3B01000001 = { - isa = PBXFileReference; - path = quartzCommon.h; - refType = 4; - }; - F587E16001924C1D01000001 = { - isa = PBXFileReference; - name = Swedish; - path = Swedish.lproj/MainMenu.nib; - refType = 4; - }; - F587E16101924C2F01000001 = { - isa = PBXFileReference; - name = Swedish; - path = Swedish.lproj/InfoPlist.strings; - refType = 4; - }; - F587E16201924C5301000001 = { - isa = PBXFileReference; - name = Swedish; - path = Swedish.lproj/InfoPlist.strings.cpp; - refType = 4; - }; - F587E16301924C5E01000001 = { - isa = PBXFileReference; - name = Swedish; - path = Swedish.lproj/Localizable.strings; - refType = 4; - }; - F587E16401924C6901000001 = { - isa = PBXFileReference; - name = Swedish; - path = Swedish.lproj/Credits.rtf; - refType = 4; - }; - F587E16501924C7401000001 = { - isa = PBXFileReference; - name = Swedish; - path = Swedish.lproj/XDarwinHelp.html; - refType = 4; - }; - F587E16601924C9D01000001 = { - isa = PBXFileReference; - name = Swedish; - path = Swedish.lproj/XDarwinHelp.html.cpp; - refType = 4; - }; - F58D65DB018F793801000001 = { - isa = PBXFileReference; - name = French; - path = French.lproj/MainMenu.nib; - refType = 4; - }; - F58D65DC018F794D01000001 = { - isa = PBXFileReference; - name = French; - path = French.lproj/InfoPlist.strings.cpp; - refType = 4; - }; - F58D65DD018F798F01000001 = { - isa = PBXFileReference; - name = French; - path = French.lproj/InfoPlist.strings; - refType = 4; - }; - F58D65DE018F79A001000001 = { - isa = PBXFileReference; - name = French; - path = French.lproj/Localizable.strings; - refType = 4; - }; - F58D65DF018F79B101000001 = { - isa = PBXFileReference; - name = French; - path = French.lproj/Credits.rtf; - refType = 4; - }; - F58D65E0018F79C001000001 = { - isa = PBXFileReference; - name = French; - path = French.lproj/XDarwinHelp.html; - refType = 4; - }; - F58D65E1018F79E001000001 = { - isa = PBXFileReference; - name = French; - path = French.lproj/XDarwinHelp.html.cpp; - refType = 4; - }; - F5ACD25CC5B5E96601000001 = { - isa = PBXFileReference; - name = Spanish; - path = Spanish.lproj/Credits.rtf; - refType = 4; - }; - F5ACD25DC5B5E97701000001 = { - isa = PBXFileReference; - name = Spanish; - path = Spanish.lproj/InfoPlist.strings.cpp; - refType = 4; - }; - F5ACD25EC5B5E98D01000001 = { - isa = PBXFileReference; - name = Spanish; - path = Spanish.lproj/MainMenu.nib; - refType = 4; - }; - F5ACD25FC5B5E9AA01000001 = { - isa = PBXFileReference; - name = Spanish; - path = Spanish.lproj/Localizable.strings; - refType = 4; - }; - F5ACD260C5B5E9DF01000001 = { - isa = PBXFileReference; - name = Spanish; - path = Spanish.lproj/XDarwinHelp.html.cpp; - refType = 4; - }; - F5ACD261C5B5EA2001000001 = { - isa = PBXFileReference; - name = Spanish; - path = Spanish.lproj/XDarwinHelp.html; - refType = 4; - }; - F5ACD262C5B5EA4D01000001 = { - isa = PBXFileReference; - name = Spanish; - path = Spanish.lproj/InfoPlist.strings; - refType = 4; - }; - F5ACD263C5BE031F01000001 = { - isa = PBXFileReference; - name = ko; - path = ko.lproj/Credits.rtf; - refType = 4; - }; - F5ACD264C5BE035B01000001 = { - isa = PBXFileReference; - name = ko; - path = ko.lproj/InfoPlist.strings.cpp; - refType = 4; - }; - F5ACD265C5BE038601000001 = { - isa = PBXFileReference; - name = ko; - path = ko.lproj/MainMenu.nib; - refType = 4; - }; - F5ACD266C5BE03C501000001 = { - isa = PBXFileReference; - name = ko; - path = ko.lproj/Localizable.strings; - refType = 4; - }; - F5ACD267C5BE03FC01000001 = { - isa = PBXFileReference; - name = ko; - path = ko.lproj/XDarwinHelp.html.cpp; - refType = 4; - }; - F5ACD268C5BE046401000001 = { - isa = PBXFileReference; - name = ko; - path = ko.lproj/XDarwinHelp.html; - refType = 4; - }; - F5ACD269C5BE049301000001 = { - isa = PBXFileReference; - name = ko; - path = ko.lproj/InfoPlist.strings; - refType = 4; - }; - }; - rootObject = 29B97313FDCFA39411CA2CEA; -} Index: xc/programs/Xserver/hw/dmx/Imakefile diff -u /dev/null xc/programs/Xserver/hw/dmx/Imakefile:1.9 --- /dev/null Wed Mar 16 21:06:43 2005 +++ xc/programs/Xserver/hw/dmx/Imakefile Sun Feb 6 20:38:24 2005 @@ -0,0 +1,138 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/dmx/Imakefile,v 1.9 2005/02/07 01:38:24 tsi Exp $ + +#include +#include + +#if BuildGlxInDmx +#if BuildXinerama +PANORAMIX_SRCS = panoramiX.c +PANORAMIX_OBJS = panoramiX.o +#endif +GLX_SRCS = dmx_glxvisuals.c $(PANORAMIX_SRCS) +GLX_OBJS = dmx_glxvisuals.o $(PANORAMIX_OBJS) +DMX_GLX_DEFINES = $(GLX_DEFINES) -DGLXPROXY +GLXPROXY_SUBDIR = glxProxy +#else +DMX_GLX_DEFINES = -UGLXEXT +#endif + +#define IHaveSubdirs + +#if !BuildServersOnly || BuildDmxDevelTools +EXAMPLEDIR = examples +#if BuildSgmlDocs +DMXDOCDIR = doc +#endif +#endif + +SUBDIRS = input config $(DMXDOCDIR) $(EXAMPLEDIR) $(GLXPROXY_SUBDIR) + +#if BuildRender +RENDER_SRCS = dmxpict.c +RENDER_OBJS = dmxpict.o +#endif + +#ifdef OS2Architecture +SRCS1 = os2_stubs.c +OBJS1 = os2_stubs.o +#endif + +SRCS = dmxinit.c \ + dmxscrinit.c \ + dmxshadow.c \ + dmxcursor.c \ + dmxinput.c \ + dmxdpms.c \ + dmxgc.c \ + dmxgcops.c \ + dmxwindow.c \ + dmxpixmap.c \ + dmxfont.c \ + dmxcmap.c \ + dmxvisual.c \ + dmxlog.c \ + dmxcb.c \ + dmxprop.c \ + dmxstat.c \ + dmxsync.c \ + dmxextension.c \ + miinitext.c \ + $(GLX_SRCS) \ + $(RENDER_SRCS) \ + $(SRCS1) + +OBJS = dmxinit.o \ + dmxscrinit.o \ + dmxshadow.o \ + dmxcursor.o \ + dmxinput.o \ + dmxdpms.o \ + dmxgc.o \ + dmxgcops.o \ + dmxwindow.o \ + dmxpixmap.o \ + dmxfont.o \ + dmxcmap.o \ + dmxvisual.o \ + dmxlog.o \ + dmxcb.o \ + dmxprop.o \ + dmxstat.o \ + dmxsync.o \ + dmxextension.o \ + miinitext.o \ + $(GLX_OBJS) \ + $(RENDER_OBJS) \ + $(OBJS1) + +#include + +#ifdef XVendorString + VENDORSTRING = XVendorString + VENDOR_STRING = -DVENDOR_STRING=\"$(VENDORSTRING)\" +#endif + +#ifdef XVendorRelease + VENDORRELEASE = XVendorRelease + VENDOR_RELEASE = -DVENDOR_RELEASE="$(VENDORRELEASE)" +#endif + +VENDOR_DEFINES = $(VENDOR_STRING) $(VENDOR_RELEASE) + + OSNAME = OSName + OSVENDOR = OSVendor +OSNAME_DEFINES = -DOSNAME='"$(OSNAME)"' -DOSVENDOR='"$(OSVENDOR)"' + +INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) \ + -I../../mi -I../../include -I../../os \ + -I../../fb -I../../miext/shadow -I../../render \ + -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(SERVERSRC)/Xext + +DEFINES = $(OS_DEFINES) $(EXT_DEFINES) -DDMXEXT -DXTEST \ + $(DMX_GLX_DEFINES) $(DMX_DEFINES) $(VENDOR_DEFINES) \ + $(OSNAME_DEFINES) + +all:: $(OBJS) + +MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) + +LinkSourceFile(miinitext.c,$(SERVERSRC)/mi) +SpecialCObjectRule(miinitext,$(ICONFIGFILES),-DDMXSERVER) + +#if BuildGlxInDmx && BuildXinerama +LinkSourceFile(panoramiX.c,$(SERVERSRC)/Xext) +SpecialCObjectRule(panoramiX,$(ICONFIGFILES),$(_NOOP_)) +#endif + +#ifdef OS2Architecture +LinkSourceFile(os2_stubs.c,$(SERVERSRC)/hw/xfree86/os-support/os2) +SpecialCObjectRule(os2_stubs,$(ICONFIGFILES),-DOS2NULLSELECT) +#endif + +NormalLibraryObjectRule() +NormalLibraryTarget(dmxlib,$(OBJS)) + +InstallManPage(Xdmx,$(MANDIR)) + +DependTarget() Index: xc/programs/Xserver/hw/dmx/Xdmx.man diff -u /dev/null xc/programs/Xserver/hw/dmx/Xdmx.man:1.1 --- /dev/null Wed Mar 16 21:06:43 2005 +++ xc/programs/Xserver/hw/dmx/Xdmx.man Wed Jun 30 16:21:38 2004 @@ -0,0 +1,741 @@ +.\" $XFree86: xc/programs/Xserver/hw/dmx/Xdmx.man,v 1.1 2004/06/30 20:21:38 martin Exp $ +.\" +.\" Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. +.\" All Rights Reserved. +.\" +.\" Permission is hereby granted, free of charge, to any person obtaining +.\" a copy of this software and associated documentation files (the +.\" "Software"), to deal in the Software without restriction, including +.\" without limitation on the rights to use, copy, modify, merge, +.\" publish, distribute, sublicense, and/or sell copies of the Software, +.\" and to permit persons to whom the Software is furnished to do so, +.\" subject to the following conditions: +.\" +.\" he above copyright notice and this permission notice (including the +.\" next paragraph) shall be included in all copies or substantial +.\" portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +.\" NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS +.\" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +.\" ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +.\" CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" SOFTWARE. +.TH Xdmx 1 __vendorversion__ +.SH NAME +Xdmx - Distributed Multi-head X server +.SH SYNOPSIS +.B Xdmx +[:display] [option ...] +.SH DESCRIPTION +.I Xdmx +is a proxy X server that uses one or more other X servers as its display +devices. It provides multi-head X functionality for displays that might +be located on different machines. +.I Xdmx +functions as a front-end X server that acts as a proxy to a set of +back-end X servers. All of the visible rendering is passed to the +back-end X servers. Clients connect to the +.I Xdmx +front-end, and everything appears as it would in a regular multi-head +configuration. If Xinerama is enabled (e.g., with +.B +xinerama +on the command line), the clients see a single large screen. +.PP +.I Xdmx +communicates to the back-end X servers using the standard X11 protocol, +and standard and/or commonly available X server extensions. +.SH OPTIONS +In addition to the normal X server options described in the +.I Xserver(1) +manual page, +.I Xdmx +accepts the following command line switches: +.TP 8 +.BI "\-display " display-name +This specifies the name(s) of the back-end X server display(s) to connect +to. This option may be specified multiple times to connect to more than +one back-end display. The first is used as screen 0, the second as screen 1, +etc. If this option is omitted, the +.B $DISPLAY +environment variable is used as the single back-end X server display. +.sp +.TP 8 +.BI "\-xinput " input-source +This specifies the source to use for XInput extension devices. The +choices are the same as for +.BR "\-input " , +described below, except that core devices on backend servers cannot be +treated as XInput extension devices. (Although extension devices on +backend and console servers are supported as extension devices under +.IR Xdmx ). +.sp +.TP 8 +.BI "\-input " input-source +This specifies the source to use for the core input devices. The choices are: +.RS +.TP 4 +.B dummy +A set of dummy core input drivers are used. These never generate any +input events. +.sp +.TP 4 +.B local +The raw keyboard and pointer from the local computer are used. A +comma-separated list of driver names can be appended. For example, to +select the example Linux keyboard and PS/2 mouse driver use: +.BR "-input local,kbd,ps2" . +The following drivers have been implemented for Linux: kbd, ms (a +two-button Microsoft mouse driver), ps2 (a PS/2 mouse driver), usb-mou +(a USB mouse driver), usb-kbd (a USB keyboard driver), and usb-oth (a +USB non-keyboard, non-mouse driver). Additional drivers may be +implemented in the future. Appropriate defaults will be used if no +comma-separated list is provided. +.sp +.TP 4 +.I display-name +If the display-name is a back-end server, then core input events are +taken from the server specified. Otherwise, a console window will be +opened on the specified display. +.sp +If the +.I display-name +is followed by ",xi" then XInput extension devices on the display will +be used as +.I Xdmx +XInput extension devices. If the +.I display-name +is followed by ",noxi" then XInput extension devices on the display will +.B not +be used as +.I Xdmx +XInput extension devices. Currently, the default is ",xi". +.sp +If the +.I display-name +is followed by ",console" and the +.I display-name +refers to a display that is used as a backend display, then a console +window will be opened on that display +.B and +that display will be treated as a backend display. Otherwise (or if +",noconsole" is used), the display will be treated purely as a backend +or a console display, as described above. +.sp +If the +.I display-name +is followed by ",windows", then outlines of the windows on the backend +will be displayed inside the console window. Otherwise (or if +",nowindows" is used), the console window will not display the outlines +of backend windows. (This option only applies to console input.) +.sp +If the +.I display-name +is followed by ",xkb", then the next 1 to 3 comma-separated parameters +will specify the keycodes, symbols, and geometry of the keyboard for +this input device. For example, ",xkb,xfree86,pc104" will specify that +the "xfree86" keycodes and the "pc104" symbols should be used to +initialize the keyboard. For an SGI keyboard, ",xkb,sgi/indy(pc102)" +might be useful. A list of keycodes, symbols, and geometries can be +found in +.IR /usr/X11R6/lib/X11/xkb . +If this option is not specified, the input device will be queried, +perhaps using the XKEYBOARD extension. +.RE +.sp +.RS +If this option isn't specified, the default input source is the first +back-end server (the one used for screen 0). The console window shows +the layout of the back-end display(s) and pointer movements and key +presses within the console window will be used as core input devices. +.sp +Several special function keys are active, depending on the input +source: +.sp +.RS +.B Ctrl-Alt-q +will terminate the +.I Xdmx +server in all modes. +.sp +.B Ctrl-Alt-g +will toggle a +server grab in console mode (a special cursor, currently a spider, is +used to indicate an active server grab). +.sp +.B Ctrl-Alt-f +will toggle fine-grain motion in console mode (a special cursor, +currently a cross hair, is used to indicate this mode). If this mode is +combined with a server grab, then the cursor will have 4 lines instead +of only 2. +.sp +.BR Ctrl-Alt-F1 " through " Ctrl-Alt-F12 +will switch to another VC in local (raw) mode. +.RE +.RE +.sp +.TP 8 +.BI "-shadowfb" +This option turns on (legacy) support for the shadow frame buffer. +.sp +.TP 8 +.BI "-noshadowfb" +This option turns off (legacy) support for the shadow frame buffer. +Note that this option has been deprecated and will be removed in the +next release. +.sp +.TP 8 +.BI "-nomulticursor" +This option turns off support for displaying multiple cursors on +overlapped back-end displays. This option is available for testing and +benchmarking purposes. +.sp +.TP 8 +.BI "-fontpath" +This option sets the +.I Xdmx +server's default font path. This option can be specified multiple times +to accommodate multiple font paths. See the +.B "FONT PATHS" +section below for very important information regarding setting the +default font path. +.sp +.TP 8 +.BI "-configfile " filename +Specify the configuration file that should be read. Note that if the +.B \-display +command-line option is used, then the configuration file will be +ignored. +.sp +.TP 8 +.BI "-config " name +Specify a configuration to use. The +.I name +will be the name following the +.B virtual +keyword in the configuration file. +.sp +.TP 8 +.BI "-stat " "interval screens" +This option enables the display of performance statistics. The interval +is in seconds. The screens is a count of the number of back-end screens +for which data is printed each interval. Specifying 0 for screens will +display data for all screens. +.sp +For each screen, the following information is printed: the screen +number, an absolute count of the number of XSync() calls made +(SyncCount), the rate of these calls during the previous interval +(Sync/s), the average round-trip time (in microseconds) of the last 10 +XSync() calls (avSync), the maximum round-trip time (in microseconds) of +the last 10 XSync calls (mxSync), the average number of XSync() requests +that were pending but not yet processed for each of the last 10 +processed XSync() calls, the maximum number of XSync() requests that +were pending but not yet processed for each of the last 10 processed +XSync() calls, and a histogram showing the distribution of the times of +all of the XSync() calls that were made during the previous interval. +.sp +(The length of the moving average and the number and value of histogram +bins are configurable at compile time in the +.B dmxstat.h +header file.) +.sp +.TP 8 +.BI "-syncbatch " interval +This option sets the +.I interval +in milliseconds for XSync() batching. An +.I interval +less than or equal to 0 will disable XSync() batching. The default +.I interval +is 100 ms. +.sp +.TP 8 +.BI "-nooffscreenopt" +This option disables the offscreen optimization. Since the lazy window +creation optimization requires the offscreen optimization to be enabled, +this option will also disable the lazy window creation optimization. +.sp +.TP 8 +.BI "-nowindowopt" +This option disables the lazy window creation optimization. +.sp +.TP 8 +.BI "-nosubdivprims" +This option disables the primitive subdivision optimization. +.sp +.TP 8 +.BI "-noxkb" +Disable use of the XKB extension for communication with the back end +displays. (Combine with +.B "-kb" +to disable all use of XKB.) +.sp +.TP 8 +.BI "-depth " int +This option sets the root window's default depth. When choosing a +default visual from those available on the back-end X server, the first +visual with that matches the depth specified is used. +.sp +This option can be combined with the +.BI "-cc" +option, which specifies the default color visual class, to force the use +of a specific depth and color class for the root window. +.sp +.TP 8 +.BI "-norender" +This option disables the RENDER extension. +.sp +.TP 8 +.BI "-noglxproxy" +This option disables GLX proxy -- the build-in GLX extension +implementation that is DMX aware. +.sp +.TP 8 +.BI "-noglxswapgroup" +This option disables the swap group and swap barrier extensions in GLX +proxy. +.sp +.TP 8 +.BI "-glxsyncswap" +This option enables synchronization after a swap buffers call by waiting +until all X protocol has been processed. When a client issues a +glXSwapBuffers request, Xdmx relays that request to each back-end X +server, and those requests are buffered along with all other protocol +requests. However, in systems that have large network buffers, this +buffering can lead to the set of back-end X servers handling the swap +buffers request asynchronously. With this option, an XSync() request is +issued to each back-end X server after sending the swap buffers request. +The XSync() requests will flush all buffered protocol (including the +swap buffers requests) and wait until the back-end X servers have +processed those requests before continuing. This option does not wait +until all GL commands have been processed so there might be previously +issued commands that are still being processed in the GL pipe when the +XSync() request returns. See the +.BI "-glxfinishswap" +option below if Xdmx should wait until the GL commands have been +processed. +.sp +.TP 8 +.BI "-glxfinishswap" +This option enables synchronization after a swap buffers call by waiting +until all GL commands have been completed. It is similar to the +.BI "-glxsyncswap" +option above; however, instead of issuing an XSync(), it issues a +glFinish() request to each back-end X server after sending the swap +buffers requests. The glFinish() request will flush all buffered +protocol requests, process both X and GL requests, and wait until all +previously called GL commands are complete before returning. +.sp +.TP 8 +.BI "-ignorebadfontpaths" +This option ignores font paths that are not available on all back-end +servers by removing the bad font path(s) from the default font path +list. If no valid font paths are left after removing the bad paths, an +error to that effect is printed in the log. +.sp +.TP 8 +.BI "-addremovescreens" +This option enables the dynamic addition and removal of screens, which +is disabled by default. Note that GLXProxy and Render do not yet +support dynamic addition and removal of screens, and must be disabled +via the +.BI "-noglxproxy" +and +.BI "-norender" +command line options described above. +.sp +.TP 8 +.BI "-param" +This option specifies parameters on the command line. Currently, only +parameters dealing with XKEYBOARD configuration are supported. These +parameters apply only to the core keyboard. Parameter values are +installation-dependent. Please see +.I /usr/X11R6/lib/X11/xkb +or a similar directory for complete information. +.RS +.TP 8 +.B XkbRules +Defaults to "xfree86". Other values may include "sgi" and "sun". +.sp +.TP 8 +.B XkbModel +Defaults to "pc101". When used with "xfree86" rules, other values may +include "pc102", "pc104", "pc105", "microsoft", and many others. When +used with "sun" rules, other values may include "type4" and "type5". +.sp +.TP 8 +.B XkbLayout +Defaults to "us". Other country codes and "dvorak" are usually +available. +.sp +.TP 8 +.B XkbVariant +Defaults to "". +.sp +.TP 8 +.B XkbOptions +Defaults to "". +.RE +.SH "CONFIGURATION FILE GRAMMAR" +The following words and tokens are reserved: +.RS +.B virtual +.B display +.B wall +.B option +.B param +.B { +.B } +.B ; +.B # +.RE +.PP +Comments start with a +.B # +mark and extend to the end of the line. They may appear anywhere. If a +configuration file is read into +.BR xdmxconfig , +the comments in that file will be preserved, but will not be editable. +.PP +The grammar is as follows: +.RS +virtual-list ::= [ virtual-list ] | virtual + +virtual ::= +.B virtual +[ name ] [ dim ] +.B { +dw-list +.B } + +dw-list ::= [ dw-list ] | dw + +dw ::= display | wall | option + +display ::= +.B display +name [ geometry ] [ / geometry ] [ origin ] +.B ; + +wall ::= +.B wall +[ dim ] [ dim ] name-list +.B ; + +option ::= +.B option +name-list +.B ; + +param ::= +.B param +name-list +.B ; + +param ::= +.B param { +param-list +.B } + +param-list ::= [ param-list ] | name-list +.B ; + +name-list ::= [ name-list ] | name + +name ::= string | double-quoted-string + +dim ::= integer +.B x +integer + +geometry ::= [ integer +.B x +integer ] [ signed-integer signed-integer ] + +origin ::= +.B @ +integer +.B x +integer +.RE +.PP +The name following +.B virtual +is used as an identifier for the configuration, and may be passed to +.B Xdmx +using the +.B \-config +command line option. The name of a display should be standard X display +name, although no checking is performed (e.g., "machine:0"). +.PP +For names, double quotes are optional unless the name is reserved or +contains spaces. +.PP +The first dimension following +.B wall +is the dimension for tiling (e.g., 2x4 or 4x4). The second dimension +following +.B wall +is the dimension of each display in the wall (e.g., 1280x1024). +.PP +The first geometry following +.B display +is the geometry of the screen window on the backend server. The second +geometry, which is always preceeded by a slash, is the geometry of the +root window. By default, the root window has the same geometry as the +screen window. +.PP +The +.B option +line can be used to specify any command-line options (e.g., +.BR \-input ). +(It cannot be used to specify the name of the front-end display.) The +option line is processed once at server startup, just line command line +options. This behavior may be unexpected. +.SH "CONFIGURATION FILE EXAMPLES" +Two displays being used for a desktop may be specified in any of the +following formats: +.RS +.nf +virtual example0 { + display d0:0 1280x1024 @0x0; + display d1:0 1280x1024 @1280x0; +} +.sp +virtual example1 { + display d0:0 1280x1024; + display d1:0 @1280x0; +} +.sp +virtual example2 { + display "d0:0"; + display "d1:0" @1280x0; +} +.sp +virtual example3 { wall 2x1 d0:0 d1:0; } +.fi +.RE +A 4x4 wall of 16 total displays could be specified as follows (if no +tiling dimension is specified, an approximate square is used): +.RS +.nf +virtual example4 { + wall d0:0 d1:0 d2:0 d3:0 + d4:0 d5:0 d6:0 d7:0 + d8:0 d9:0 da:0 db:0 + dc:0 dd:0 de:0 df:0; +} +.fi +.RE +.SH "FONT PATHS" +The font path used by the +.I Xdmx +front-end server will be propagated to each back-end server,which +requires that each back-end server have access to the exact same font +paths as the front-end server. This can be most easily handled by +either using a font server (e.g., xfs) or by remotely mounting the font +paths on each back-end server, and then setting the +.I Xdmx +server's default font path with the +-I "-fontpath" +command line option described above. +.PP +For example, if you specify a font path with the following command line: +.RS +Xdmx :1 -display d0:0 -fontpath /usr/fonts/75dpi/ -fontpath /usr/fonts/Type1/ +xinerama +.RE +Then, /usr/fonts/75dpi/ and /usr/fonts/Type1/ must be valid font paths +on the +.I Xdmx +server and all back-end server, which is d0 in this example. +.PP +Font servers can also be specified with the +.I "-fontpath" +option. For example, let's assume that a properly configured font +server is running on host d0. Then, the following command line +.RS +Xdmx :1 -display d0:0 -display d1:0 -fontpath tcp/d0:7100 +xinerama +.RE +will initialize the front-end +.I Xdmx +server and each of the back-end servers to use the font server on d0. +.PP +Some fonts might not be supported by either the front-end or the +back-end servers. For example, let's assume the front-end +.I Xdmx +server includes support Type1 fonts, but one of the back-end servers +does not. Let's also assume that the default font path for +.I Xdmx +includes Type1 fonts in its font path. Then, when +.I Xdmx +initializes the default font path to load the default font, the font +path that includes Type1 fonts (along with the other default font paths +that are used by the +.I Xdmx +server) is sent to the back-end server that cannot handle Type1 fonts. +That back-end server then rejects the font path and sends an error back +to the +.I Xdmx +server. +.I Xdmx +then prints an error message and exits because it failed to set the +default font path and was unable load the default font. +.PP +To fix this error, the offending font path must be removed from the +default font path by using a different +.I "-fontpath" +command line option. +.PP +The +.I "-fontpath" +option can also be added to the configuration file as described above. +.SH "COMMAND-LINE EXAMPLES" +The back-end machines are d0 and d1, core input is from the pointer and +keyboard attached to d0, clients will refer to :1 when opening windows: +.RS +Xdmx :1 -display d0:0 -display d1:0 +xinerama +.RE +.PP +As above, except with core input from d1: +.RS +Xdmx :1 -display d0:0 -display d1:0 -input d1:0 +xinerama +.RE +.PP +As above, except with core input from a console window on the local +display: +.RS +Xdmx :1 -display d0:0 -display d1:0 -input :0 +xinerama +.RE +.PP +As above, except with core input from the local keyboard and mouse: +.RS +Xdmx :1 -display d0:0 -display d1:0 -input local,kbd,ps2 +xinerama +.RE +Note that local input can be used under Linux while another X session is +running on :0 (assuming the user can access the Linux console tty and +mouse devices): a new (blank) VC will be used for keyboard input on the +local machine and the Ctrl-Alt-F* sequence will be available to change +to another VC (possibly back to another X session running on the local +machine). Using Ctrl-Alt-Backspace on the blank VC will terminate the +Xdmx session and return to the original VC. +.PP +This example uses the configuration file shown in the previous section: +.RS +Xdmx :1 -input :0 +xinerama -configfile filename -config example2 +.RE +With this configuration file line: +.RS +option -input :0 +xinerama; +.RE +the command line can be shortened to: +.RS +Xdmx :1 -configfile filename -config example2 +.RE +.SH "USING THE USB DEVICE DRIVERS" +.P +The USB device drivers use the devices called +.IR /dev/input/event0 ", " /dev/input/event1 ", etc." +under Linux. These devices are driven using the +.I evdev +Linux kernel module, which is part of the hid suite. Please note that +if you load the +.I mousedev +or +.I kbddev +Linux kernel modules, then USB devices will appear as core Linux input +devices and you will not be able to select between using the device only +as an +.I Xdmx +core device or an +.I Xdmx +XInput extension device. Further, you may be unable to unload the +.I mousedev +Linux kernel module if +.I XFree86 +is configured to use +.I /dev/input/mice +as an input device (this is quite helpful for laptop users and is set up +by default under some Linux distributions, but should be changed if USB +devices are to be used with +.IR Xdmx ). +.PP +The USB device drivers search through the Linux devices for the first +mouse, keyboard, or non-mouse-non-keyboard Linux device and use that +device. +.SH "KEYBOARD INITIALIZATION" +.PP +If +.I Xdmx +was invoked with +.I \-xkb +or was +.B not +compiled to use the XKEYBOARD extension, then a keyboard on a backend or +console will be initialized using the map that the host X server +provides. +.PP +If the XKEYBOARD extension is used for both +.I Xdmx +and the host X server for the keyboard (i.e., the backend or console X +server), then the type of the keyboard will +be obtained from the host X server and the keyboard under +.I Xdmx +will be initialized with that information. Otherwise, the default type +of keyboard will be initialized. In both cases, the map from the host X +server will +.B not +be used. This means that different initial behavior may be noted with +and without XKEYBOARD. Consistent and expected results will be obtained +by running XKEYBOARD on all servers and by avoiding the use of +.I xmodmap +on the backend or console X servers prior to starting +.IR Xdmx . +.PP +If +.I \-xkbmap +is specified on the +.I Xdmx +command line, then that map will currently be used for all keyboards. +.SH "MULTIPLE CORE KEYBOARDS" +X was not designed to support multiple core keyboards. However, +.I Xdmx +provides some support for multiple core keyboards. Best results will be +obtained if all of the keyboards are of the same type and are using the +same keyboard map. Because the X server passes raw key code information +to the X client, key symbols for keyboards with different key maps would +be different if the key code for each keyboard was sent without +translation to the client. Therefore, +.I Xdmx +will attempt to translate the key code from a core keyboard to the key +code for the key with the same key symbol of the +.B first +core keyboard that was loaded. If the key symbol appears in both maps, +the results will be expected. Otherwise, the second core keyboard will +return a NoSymbol key symbol for some keys that would have been +translated if it was the first core keyboard. +.ig +.SH ENVIRONMENT +.. +.ig +.SH FILES +.. +.SH "SEE ALSO" +.BR DMX "(3X), " X "(__miscmansuffix__), " Xserver "(1), " xdmxconfig "(1), " +.BR vdltodmx "(1), " xfs "(1), " xkbcomp (1) +.SH AUTHORS +Kevin E. Martin +.I , +David H. Dawes +.I , +and +Rickard E. (Rik) Faith +.IR . +.PP +Portions of +.I Xdmx +are based on code from The XFree86 Project +.RI ( http://www.xfree86.org ) +and X.Org +.RI ( http://www.x.org ). Index: xc/programs/Xserver/hw/dmx/dmx.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmx.h:1.2 --- /dev/null Wed Mar 16 21:06:43 2005 +++ xc/programs/Xserver/hw/dmx/dmx.h Sat Jan 22 11:01:01 2005 @@ -0,0 +1,377 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmx.h,v 1.2 2005/01/22 16:01:01 tsi Exp $ */ +/* + * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * David H. Dawes + * Rickard E. (Rik) Faith + * + */ + +/** \file + * Main header file included by all other DMX-related files. + */ + +/** \mainpage + * - DMX Home Page + * - DMX Project Page (on + * Source Forge) + * - Distributed Multihead + * X design, the design document for DMX + * - Client-to-Server + * DMX Extension to the X Protocol + */ + +#ifndef DMX_H +#define DMX_H + +#include "gcstruct.h" + +/* Handle client-side include files in one place. */ +#include "dmxclient.h" + +#include "globals.h" +#include "scrnintstr.h" + +#ifdef RENDER +#include "picturestr.h" +#endif + +#ifdef GLXPROXY +#include +#include +#endif + +typedef enum { + PosNone = -1, + PosAbsolute = 0, + PosRightOf, + PosLeftOf, + PosAbove, + PosBelow, + PosRelative +} PositionType; + +/** Provide the typedef globally, but keep the contents opaque outside + * of the input routines. \see dmxinput.h */ +typedef struct _DMXInputInfo DMXInputInfo; + +/** Provide the typedef globally, but keep the contents opaque outside + * of the XSync statistic routines. \see dmxstat.c */ +typedef struct _DMXStatInfo DMXStatInfo; + +/** Global structure containing information about each backend screen. */ +typedef struct _DMXScreenInfo { + const char *name; /**< Name from command line or config file */ + int index; /**< Index into dmxScreens global */ + + /*---------- Back-end X server information ----------*/ + + Display *beDisplay; /**< Back-end X server's display */ + int beWidth; /**< Width of BE display */ + int beHeight; /**< Height of BE display */ + int beDepth; /**< Depth of BE display */ + int beBPP; /**< Bits per pixel of BE display */ + int beXDPI; /**< Horizontal dots per inch of BE */ + int beYDPI; /**< Vertical dots per inch of BE */ + + int beNumDepths; /**< Number of depths on BE server */ + int *beDepths; /**< Depths from BE server */ + + int beNumPixmapFormats; /**< Number of pixmap formats on BE */ + XPixmapFormatValues *bePixmapFormats; /**< Pixmap formats on BE */ + + int beNumVisuals; /**< Number of visuals on BE */ + XVisualInfo *beVisuals; /**< Visuals from BE server */ + int beDefVisualIndex; /**< Default visual index of BE */ + + int beNumDefColormaps; /**< Number of default colormaps */ + Colormap *beDefColormaps; /**< Default colormaps for DMX server */ + + Pixel beBlackPixel; /**< Default black pixel for BE */ + Pixel beWhitePixel; /**< Default white pixel for BE */ + + /*---------- Screen window information ----------*/ + + Window scrnWin; /**< "Screen" window on backend display */ + int scrnX; /**< X offset of "screen" WRT BE display */ + int scrnY; /**< Y offset of "screen" WRT BE display */ + int scrnWidth; /**< Width of "screen" */ + int scrnHeight; /**< Height of "screen" */ + int scrnXSign; /**< X offset sign of "screen" */ + int scrnYSign; /**< Y offset sign of "screen" */ + + /** Default drawables for "screen" */ + Drawable scrnDefDrawables[MAXFORMATS]; + + struct _DMXScreenInfo *next; /**< List of "screens" on same display */ + struct _DMXScreenInfo *over; /**< List of "screens" that overlap */ + + /*---------- Root window information ----------*/ + + Window rootWin; /**< "Root" window on backend display */ + int rootX; /**< X offset of "root" window WRT "screen"*/ + int rootY; /**< Y offset of "root" window WRT "screen"*/ + int rootWidth; /**< Width of "root" window */ + int rootHeight; /**< Height of "root" window */ + + int rootXOrigin; /**< Global X origin of "root" window */ + int rootYOrigin; /**< Global Y origin of "root" window */ + + /*---------- Shadow framebuffer information ----------*/ + + void *shadow; /**< Shadow framebuffer data (if enabled) */ + XlibGC shadowGC; /**< Default GC used by shadow FB code */ + XImage *shadowFBImage; /**< Screen image used by shadow FB code */ + + /*---------- Other related information ----------*/ + + int shared; /**< Non-zero if another Xdmx is running */ + + Bool WMRunningOnBE; + + Cursor noCursor; + Cursor curCursor; + /* Support for cursors on overlapped + * backend displays. */ + CursorPtr cursor; + int cursorVisible; + int cursorNotShared; /* for overlapping screens on a backend */ + + PositionType where; /**< Relative layout information */ + int whereX; /**< Relative layout information */ + int whereY; /**< Relative layout information */ + int whereRefScreen; /**< Relative layout information */ + + int savedTimeout; /**< Original screen saver timeout */ + int dpmsCapable; /**< Non-zero if backend is DPMS capable */ + int dpmsEnabled; /**< Non-zero if DPMS enabled */ + int dpmsStandby; /**< Original DPMS standby value */ + int dpmsSuspend; /**< Original DPMS suspend value */ + int dpmsOff; /**< Original DPMS off value */ + + DMXStatInfo *stat; /**< Statistics about XSync */ + Bool needsSync; /**< True if an XSync is pending */ + +#ifdef GLXPROXY + /** Visual information for glxProxy */ + int numGlxVisuals; + __GLXvisualConfig *glxVisuals; + int glxMajorOpcode; + int glxErrorBase; + + /** FB config information for glxProxy */ + __GLXFBConfig *fbconfigs; + int numFBConfigs; +#endif + + /** Function pointers to wrapped screen + * functions */ + CloseScreenProcPtr CloseScreen; + SaveScreenProcPtr SaveScreen; + + CreateGCProcPtr CreateGC; + + CreateWindowProcPtr CreateWindow; + DestroyWindowProcPtr DestroyWindow; + PositionWindowProcPtr PositionWindow; + ChangeWindowAttributesProcPtr ChangeWindowAttributes; + RealizeWindowProcPtr RealizeWindow; + UnrealizeWindowProcPtr UnrealizeWindow; + RestackWindowProcPtr RestackWindow; + WindowExposuresProcPtr WindowExposures; + PaintWindowBackgroundProcPtr PaintWindowBackground; + PaintWindowBorderProcPtr PaintWindowBorder; + CopyWindowProcPtr CopyWindow; + + ResizeWindowProcPtr ResizeWindow; + ReparentWindowProcPtr ReparentWindow; + + ChangeBorderWidthProcPtr ChangeBorderWidth; + + GetImageProcPtr GetImage; + GetSpansProcPtr GetSpans; + + CreatePixmapProcPtr CreatePixmap; + DestroyPixmapProcPtr DestroyPixmap; + BitmapToRegionProcPtr BitmapToRegion; + + RealizeFontProcPtr RealizeFont; + UnrealizeFontProcPtr UnrealizeFont; + + CreateColormapProcPtr CreateColormap; + DestroyColormapProcPtr DestroyColormap; + InstallColormapProcPtr InstallColormap; + StoreColorsProcPtr StoreColors; + +#ifdef SHAPE + SetShapeProcPtr SetShape; +#endif + +#ifdef RENDER + CreatePictureProcPtr CreatePicture; + DestroyPictureProcPtr DestroyPicture; + ChangePictureClipProcPtr ChangePictureClip; + DestroyPictureClipProcPtr DestroyPictureClip; + + ChangePictureProcPtr ChangePicture; + ValidatePictureProcPtr ValidatePicture; + + CompositeProcPtr Composite; + GlyphsProcPtr Glyphs; + CompositeRectsProcPtr CompositeRects; + + InitIndexedProcPtr InitIndexed; + CloseIndexedProcPtr CloseIndexed; + UpdateIndexedProcPtr UpdateIndexed; + + TrapezoidsProcPtr Trapezoids; + TrianglesProcPtr Triangles; + TriStripProcPtr TriStrip; + TriFanProcPtr TriFan; +#endif +} DMXScreenInfo; + +/* Global variables available to all Xserver/hw/dmx routines. */ +extern int dmxNumScreens; /**< Number of dmxScreens */ +extern DMXScreenInfo *dmxScreens; /**< List of outputs */ +extern int dmxShadowFB; /**< Non-zero if using + * shadow frame-buffer + * (deprecated) */ +extern XErrorEvent dmxLastErrorEvent; /**< Last error that + * occurred */ +extern Bool dmxErrorOccurred; /**< True if an error + * occurred */ +extern Bool dmxOffScreenOpt; /**< True if using off + * screen + * optimizations */ +extern Bool dmxSubdividePrimitives; /**< True if using the + * primitive subdivision + * optimization */ +extern Bool dmxLazyWindowCreation; /**< True if using the + * lazy window creation + * optimization */ +extern Bool dmxUseXKB; /**< True if the XKB + * extension should be + * used with the backend + * servers */ +extern int dmxDepth; /**< Requested depth if + * non-zero */ +extern Bool dmxNoRender; /**< True if the RENDER + * extension should be + * disabled */ +#ifdef GLXPROXY +extern Bool dmxGLXProxy; /**< True if glxProxy + * support is enabled */ +extern Bool dmxGLXSwapGroupSupport; /**< True if glxProxy + * support for swap + * groups and barriers + * is enabled */ +extern Bool dmxGLXSyncSwap; /**< True if glxProxy + * should force an XSync + * request after each + * swap buffers call */ +extern Bool dmxGLXFinishSwap; /**< True if glxProxy + * should force a + * glFinish request + * after each swap + * buffers call */ +#endif +extern char *dmxFontPath; /**< NULL if no font + * path is set on the + * command line; + * otherwise, a string + * of comma separated + * paths built from the + * command line + * specified font + * paths */ +extern Bool dmxIgnoreBadFontPaths; /**< True if bad font + * paths should be + * ignored during server + * init */ +extern Bool dmxAddRemoveScreens; /**< True if add and + * remove screens support + * is enabled */ + +/** Wrap screen or GC function pointer */ +#define DMX_WRAP(_entry, _newfunc, _saved, _actual) \ +do { \ + (_saved)->_entry = (_actual)->_entry; \ + (_actual)->_entry = (_newfunc); \ +} while (0) + +/** Unwrap screen or GC function pointer */ +#define DMX_UNWRAP(_entry, _saved, _actual) \ +do { \ + (_actual)->_entry = (_saved)->_entry; \ +} while (0) + +/* Define the MAXSCREENSALLOC/FREE macros, when MAXSCREENS patch has not + * been applied to sources. */ +#ifdef MAXSCREENS +#define MAXSCREEN_MAKECONSTSTR1(x) #x +#define MAXSCREEN_MAKECONSTSTR2(x) MAXSCREEN_MAKECONSTSTR1(x) + +#define MAXSCREEN_FAILED_TXT "Failed at [" \ + MAXSCREEN_MAKECONSTSTR2(__LINE__) ":" __FILE__ "] to allocate object: " + +#define _MAXSCREENSALLOCF(o,size,fatal) \ + do { \ + if (!o) { \ + o = xalloc((size) * sizeof(*(o))); \ + if (o) memset(o, 0, (size) * sizeof(*(o))); \ + if (!o && fatal) FatalError(MAXSCREEN_FAILED_TXT #o); \ + } \ + } while (0) +#define _MAXSCREENSALLOCR(o,size,retval) \ + do { \ + if (!o) { \ + o = xalloc((size) * sizeof(*(o))); \ + if (o) memset(o, 0, (size) * sizeof(*(o))); \ + if (!o) return retval; \ + } \ + } while (0) + +#define MAXSCREENSFREE(o) \ + do { \ + if (o) xfree(o); \ + o = NULL; \ + } while (0) + +#define MAXSCREENSALLOC(o) _MAXSCREENSALLOCF(o,MAXSCREENS, 0) +#define MAXSCREENSALLOC_FATAL(o) _MAXSCREENSALLOCF(o,MAXSCREENS, 1) +#define MAXSCREENSALLOC_RETURN(o,r) _MAXSCREENSALLOCR(o,MAXSCREENS, (r)) +#define MAXSCREENSALLOCPLUSONE(o) _MAXSCREENSALLOCF(o,MAXSCREENS+1,0) +#define MAXSCREENSALLOCPLUSONE_FATAL(o) _MAXSCREENSALLOCF(o,MAXSCREENS+1,1) +#define MAXSCREENSCALLOC(o,m) _MAXSCREENSALLOCF(o,MAXSCREENS*(m),0) +#define MAXSCREENSCALLOC_FATAL(o,m) _MAXSCREENSALLOCF(o,MAXSCREENS*(m),1) +#endif + +#endif /* DMX_H */ Index: xc/programs/Xserver/hw/dmx/dmx_glxvisuals.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmx_glxvisuals.c:1.2 --- /dev/null Wed Mar 16 21:06:43 2005 +++ xc/programs/Xserver/hw/dmx/dmx_glxvisuals.c Fri Jan 21 16:22:45 2005 @@ -0,0 +1,609 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmx_glxvisuals.c,v 1.2 2005/01/21 21:22:45 tsi Exp $ */ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +#include "dmx.h" +#include +#include +#include "Xext.h" +#include "extutil.h" + +#include "dmx_glxvisuals.h" + +__GLXvisualConfig *GetGLXVisualConfigs(Display *dpy, int screen, int *nconfigs) +{ + xGLXGetVisualConfigsReq *req; + xGLXGetVisualConfigsReply reply; + __GLXvisualConfig *config, *configs; + GLint i, j, nvisuals, nprops; + INT32 *props, *p; + int majorOpcode, dummy; + int num_good_visuals; + + if (!XQueryExtension(dpy, "GLX", &majorOpcode, &dummy, &dummy)) { + return(NULL); + } + + /* Send the glXGetVisualConfigs request */ + LockDisplay(dpy); + GetReq(GLXGetVisualConfigs,req); + req->reqType = majorOpcode; + req->glxCode = X_GLXGetVisualConfigs; + req->screen = screen; + if (!_XReply(dpy, (xReply*) &reply, 0, False)) { + /* Something is busted. Punt. */ + UnlockDisplay(dpy); + SyncHandle(); + return NULL; + } + + nvisuals = (int)reply.numVisuals; + if (!nvisuals) { + /* This screen does not support GL rendering */ + UnlockDisplay(dpy); + SyncHandle(); + return NULL; + } + + /* Check number of properties per visual */ + nprops = (int)reply.numProps; + if (nprops < __GLX_MIN_CONFIG_PROPS) { + /* Huh? Not in protocol defined limits. Punt */ + UnlockDisplay(dpy); + SyncHandle(); + return NULL; + } + props = (INT32*) Xmalloc(nprops * __GLX_SIZE_CARD32); + if (!props) { + UnlockDisplay(dpy); + SyncHandle(); + return NULL; + } + + /* Allocate memory for our config structure */ + config = (__GLXvisualConfig*) + Xmalloc(nvisuals * sizeof(__GLXvisualConfig)); + if (!config) { + Xfree(props); + UnlockDisplay(dpy); + SyncHandle(); + return NULL; + } + memset(config, 0, nvisuals * sizeof(__GLXvisualConfig)); + configs = config; + num_good_visuals = 0; + + /* Convert config structure into our format */ + for (i=0; ivisualRating = GLX_NONE_EXT; + config->transparentPixel = GLX_NONE_EXT; + + /* Copy in the first set of properties */ + config->vid = props[0]; + config->class = props[1]; + + config->rgba = (Bool) props[2]; + + config->redSize = props[3]; + config->greenSize = props[4]; + config->blueSize = props[5]; + config->alphaSize = props[6]; + + config->accumRedSize = props[7]; + config->accumGreenSize = props[8]; + config->accumBlueSize = props[9]; + config->accumAlphaSize = props[10]; + + config->doubleBuffer = (Bool) props[11]; + config->stereo = (Bool) props[12]; + + config->bufferSize = props[13]; + config->depthSize = props[14]; + config->stencilSize = props[15]; + + config->auxBuffers = props[16]; + config->level = props[17]; + + /* Process remaining properties */ + p = &props[18]; + for (j=__GLX_MIN_CONFIG_PROPS; jmultiSampleSize = value; + break; + case GLX_SAMPLE_BUFFERS_SGIS: + config->nMultiSampleBuffers = value; + break; +#endif + + case GLX_TRANSPARENT_TYPE_EXT: + config->transparentPixel = value; + break; + case GLX_TRANSPARENT_INDEX_VALUE_EXT: + config->transparentIndex = value; + break; + case GLX_TRANSPARENT_RED_VALUE_EXT: + config->transparentRed = value; + break; + case GLX_TRANSPARENT_GREEN_VALUE_EXT: + config->transparentGreen = value; + break; + case GLX_TRANSPARENT_BLUE_VALUE_EXT: + config->transparentBlue = value; + break; + case GLX_TRANSPARENT_ALPHA_VALUE_EXT: + config->transparentAlpha = value; + break; + + case GLX_VISUAL_CAVEAT_EXT: + config->visualRating = value; + break; + +#if 0 + /* visualSelectGroup is an internal used property */ + case GLX_VISUAL_SELECT_GROUP_SGIX: + config->visualSelectGroup = value; + break; +#endif + + default : + /* Ignore properties we don't recognize */ + break; + } + } /* for j */ + + /* + // filter out overlay visuals (dmx does not support overlays) + */ + if (config->level == 0) { + config++; + num_good_visuals++; + } + + } /* for i */ + + UnlockDisplay(dpy); + + nvisuals = num_good_visuals; + + config = configs; + for (i=0; ivid; + vis = XGetVisualInfo(dpy, VisualScreenMask|VisualIDMask, + &template, &n); + + if (vis != NULL) { + config->redMask = vis->red_mask; + config->greenMask = vis->green_mask; + config->blueMask = vis->blue_mask; + config->alphaMask = 0; /* XXX */ + free(vis); + } + } + config++; + } /* for i */ + + XFree(props); + SyncHandle(); + + *nconfigs = nvisuals; + return( configs ); +} + + +__GLXFBConfig *GetGLXFBConfigs(Display *dpy, int glxMajorOpcode, int *nconfigs) +{ + xGLXGetFBConfigsReq *req; + xGLXGetFBConfigsReply reply; + __GLXFBConfig *config, *fbconfigs; + GLint i, j, numFBConfigs, numAttribs; + INT32 *attrs, *p; + int screen = DefaultScreen( dpy ); + int numValidConfigs = 0; + + /* Send the glXGetFBConfigs request */ + LockDisplay(dpy); + GetReq(GLXGetFBConfigs, req); + req->reqType = glxMajorOpcode; + req->glxCode = X_GLXGetFBConfigs; + req->screen = screen; + + *nconfigs = 0; + + if (!_XReply(dpy, (xReply*) &reply, 0, False)) { + /* Something is busted. Punt. */ + UnlockDisplay(dpy); + SyncHandle(); + return NULL; + } + + numFBConfigs = (int)reply.numFBConfigs; + if (!numFBConfigs) { + /* This screen does not support GL rendering */ + UnlockDisplay(dpy); + SyncHandle(); + return NULL; + } + + numAttribs = (int)reply.numAttribs; + if (!numAttribs) { + UnlockDisplay(dpy); + SyncHandle(); + return NULL; + } + + attrs = (INT32*) Xmalloc(2*numAttribs * __GLX_SIZE_CARD32); + if (!attrs) { + UnlockDisplay(dpy); + SyncHandle(); + return NULL; + } + + /* Allocate memory for our config structure */ + config = (__GLXFBConfig*) + Xmalloc(numFBConfigs * sizeof(__GLXFBConfig)); + if (!config) { + Xfree(attrs); + UnlockDisplay(dpy); + SyncHandle(); + return NULL; + } + memset(config, 0, numFBConfigs * sizeof(__GLXFBConfig)); + fbconfigs = config; + + /* Convert attribute list into our format */ + for (i=0; itransparentType = GLX_NONE_EXT; + config->visualCaveat = GLX_NONE_EXT; + config->minRed = 0.; + config->maxRed = 1.; + config->minGreen = 0.; + config->maxGreen = 1.; + config->minBlue = 0.; + config->maxBlue = 1.; + config->minAlpha = 0.; + config->maxAlpha = 1.; + + /* Read attribute list */ + _XRead(dpy, (char *)attrs, (2*numAttribs * __GLX_SIZE_CARD32)); + + p = attrs; + for (j=0; jid = value; + break; + case GLX_BUFFER_SIZE: + config->indexBits = value; + break; + case GLX_LEVEL: + config->level = value; + break; + case GLX_DOUBLEBUFFER: + config->doubleBufferMode = value; + break; + case GLX_STEREO: + config->stereoMode = value; + break; + case GLX_AUX_BUFFERS: + config->maxAuxBuffers = value; + break; + case GLX_RED_SIZE: + config->redBits = value; + break; + case GLX_GREEN_SIZE: + config->greenBits = value; + break; + case GLX_BLUE_SIZE: + config->blueBits = value; + break; + case GLX_ALPHA_SIZE: + config->alphaBits = value; + break; + case GLX_DEPTH_SIZE: + config->depthBits = value; + break; + case GLX_STENCIL_SIZE: + config->stencilBits = value; + break; + case GLX_ACCUM_RED_SIZE: + config->accumRedBits = value; + break; + case GLX_ACCUM_GREEN_SIZE: + config->accumGreenBits = value; + break; + case GLX_ACCUM_BLUE_SIZE: + config->accumBlueBits = value; + break; + case GLX_ACCUM_ALPHA_SIZE: + config->accumAlphaBits = value; + break; + case GLX_RENDER_TYPE: + config->renderType = value; + break; + case GLX_DRAWABLE_TYPE: + config->drawableType = value; + break; + case GLX_X_VISUAL_TYPE: + config->visualType = value; + break; + case GLX_CONFIG_CAVEAT: + config->visualCaveat = value; + break; + case GLX_TRANSPARENT_TYPE: + config->transparentType = value; + break; + case GLX_TRANSPARENT_INDEX_VALUE: + config->transparentIndex = value; + break; + case GLX_TRANSPARENT_RED_VALUE: + config->transparentRed = value; + break; + case GLX_TRANSPARENT_GREEN_VALUE: + config->transparentGreen = value; + break; + case GLX_TRANSPARENT_BLUE_VALUE: + config->transparentBlue = value; + break; + case GLX_TRANSPARENT_ALPHA_VALUE: + config->transparentAlpha = value; + break; + case GLX_MAX_PBUFFER_WIDTH: + config->maxPbufferWidth = value; + break; + case GLX_MAX_PBUFFER_HEIGHT: + config->maxPbufferHeight = value; + break; + case GLX_MAX_PBUFFER_PIXELS: + config->maxPbufferPixels = value; + break; + case GLX_VISUAL_ID: + config->associatedVisualId = value; + break; + + /* visualSelectGroup is an internal used property */ + case GLX_VISUAL_SELECT_GROUP_SGIX: + config->visualSelectGroup = value; + break; + + /* SGIS_multisample attributes */ + case GLX_SAMPLES_SGIS: + config->multiSampleSize = value; + break; + case GLX_SAMPLE_BUFFERS_SGIS: + config->nMultiSampleBuffers = value; + break; + + /* SGIX_pbuffer specific attributes */ + case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX: + config->optimalPbufferWidth = value; + break; + case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX: + config->optimalPbufferHeight = value; + break; + + default: + /* Ignore attributes we don't recognize */ + break; + } + } /* for j */ + + /* Fill in derived values */ + config->screen = screen; + + config->rgbMode = config->renderType & GLX_RGBA_BIT; + config->colorIndexMode = !config->rgbMode; + + config->haveAccumBuffer = + config->accumRedBits > 0 || + config->accumGreenBits > 0 || + config->accumBlueBits > 0; + /* Can't have alpha without color */ + + config->haveDepthBuffer = config->depthBits > 0; + config->haveStencilBuffer = config->stencilBits > 0; + + /* overlay visuals are not valid for now */ + if (!config->level) { + config++; + numValidConfigs++; + } + + } /* for i */ + UnlockDisplay(dpy); + + config = fbconfigs; + for (i=0; iassociatedVisualId != 0) { + XVisualInfo *vis, template; + int n; + + template.screen = screen; + template.visualid = config->associatedVisualId; + vis = XGetVisualInfo(dpy, VisualScreenMask|VisualIDMask, + &template, &n); + + if (vis != NULL) { + config->redMask = (GLuint)vis->red_mask; + config->greenMask = (GLuint)vis->green_mask; + config->blueMask = (GLuint)vis->blue_mask; + config->alphaMask = 0; /* XXX */ + free(vis); + } + } + + config++; + } /* for i */ + + XFree(attrs); + SyncHandle(); + + *nconfigs = numValidConfigs; + return fbconfigs; +} + +__GLXvisualConfig * +GetGLXVisualConfigsFromFBConfigs(__GLXFBConfig *fbconfigs, int nfbconfigs, + XVisualInfo *visuals, int nvisuals, + __GLXvisualConfig *glxConfigs, int nGlxConfigs, + int *nconfigs) +{ + __GLXvisualConfig *configs = NULL; + int i; + + if (!fbconfigs || !nfbconfigs || !nconfigs) return(NULL); + *nconfigs = 0; + + /* Allocate memory for our config structure */ + configs = (__GLXvisualConfig*) + Xmalloc(nfbconfigs * sizeof(__GLXvisualConfig)); + if (!configs) { + return NULL; + } + memset(configs, 0, nfbconfigs * sizeof(__GLXvisualConfig)); + + for (i=0; iassociatedVisualId > 0) { + __GLXvisualConfig *cfg = configs + (*nconfigs); + int j; + XVisualInfo *vinfo = NULL; + + for (j=0; jassociatedVisualId) { + vinfo = &visuals[j]; + break; + } + } + if (!vinfo) continue; + + /* skip 16 bit colormap visuals */ + if (vinfo->depth == 16 && + vinfo->class != TrueColor && + vinfo->class != DirectColor ) { + continue; + } + + (*nconfigs)++; + + /* + * if the same visualid exists in the glx configs, + * copy the glx attributes from the glx config + */ + for (j=0; jvisualid) + break; + } + if (j < nGlxConfigs) { + memcpy(cfg, &glxConfigs[j], sizeof(__GLXvisualConfig) ); + continue; + } + + /* + * make glx attributes from the FB config attributes + */ + cfg->vid = fbcfg->associatedVisualId; + cfg->class = vinfo->class; + cfg->rgba = !(fbcfg->renderType & GLX_COLOR_INDEX_BIT_SGIX); + cfg->redSize = fbcfg->redBits; + cfg->greenSize = fbcfg->greenBits; + cfg->blueSize = fbcfg->blueBits; + cfg->alphaSize = fbcfg->alphaBits; + cfg->redMask = fbcfg->redMask; + cfg->greenMask = fbcfg->greenMask; + cfg->blueMask = fbcfg->blueMask; + cfg->alphaMask = fbcfg->alphaMask; + cfg->accumRedSize = fbcfg->accumRedBits; + cfg->accumGreenSize = fbcfg->accumGreenBits; + cfg->accumBlueSize = fbcfg->accumBlueBits; + cfg->accumAlphaSize = fbcfg->accumAlphaBits; + cfg->doubleBuffer = fbcfg->doubleBufferMode; + cfg->stereo = fbcfg->stereoMode; + if (vinfo->class == TrueColor || vinfo->class == DirectColor) { + cfg->bufferSize = (fbcfg->rgbMode ? (fbcfg->redBits + + fbcfg->greenBits + + fbcfg->blueBits + + fbcfg->alphaBits) + : fbcfg->indexBits ); + } + else { + cfg->bufferSize = vinfo->depth; + } + cfg->depthSize = fbcfg->depthBits; + cfg->stencilSize = fbcfg->stencilBits; + cfg->auxBuffers = fbcfg->maxAuxBuffers; + cfg->level = fbcfg->level; + cfg->visualRating = fbcfg->visualCaveat; + cfg->transparentPixel = fbcfg->transparentType; + cfg->transparentRed = fbcfg->transparentRed; + cfg->transparentGreen = fbcfg->transparentGreen; + cfg->transparentBlue = fbcfg->transparentBlue; + cfg->transparentAlpha = fbcfg->transparentAlpha; + cfg->transparentIndex = fbcfg->transparentIndex; +#if 0 + cfg->multiSampleSize = fbcfg->multiSampleSize; + cfg->nMultiSampleBuffers = fbcfg->nMultiSampleBuffers; + cfg->visualSelectGroup = fbcfg->visualSelectGroup; +#endif + } + } + + return( configs ); +} + Index: xc/programs/Xserver/hw/dmx/dmx_glxvisuals.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmx_glxvisuals.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmx_glxvisuals.h Wed Jun 30 16:21:38 2004 @@ -0,0 +1,64 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ + +#ifndef _GLXVISUALS_H +#define _GLXVISUALS_H + +#include + +/** GLX Visual private area. */ +typedef struct { + int x_visual_depth; + int x_visual_class; +} dmxGlxVisualPrivate; + +__GLXvisualConfig *GetGLXVisualConfigs(Display *dpy, + int screen, + int *nconfigs); + +__GLXFBConfig *GetGLXFBConfigs(Display *dpy, + int glxMajorOpcode, + int *nconfigs); + +__GLXvisualConfig *GetGLXVisualConfigsFromFBConfigs(__GLXFBConfig *fbconfigs, + int nfbconfigs, + XVisualInfo *visuals, + int nvisuals, + __GLXvisualConfig + *glxConfigs, + int nGlxConfigs, + int *nconfigs); + +#endif Index: xc/programs/Xserver/hw/dmx/dmxcb.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxcb.c:1.2 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxcb.c Tue Jul 6 23:46:22 2004 @@ -0,0 +1,220 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxcb.c,v 1.2 2004/07/07 03:46:22 martin Exp $ */ +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * This code queries and modifies the connection block. */ + +#include "dmx.h" +#include "dmxcb.h" +#include "dmxinput.h" +#include "dmxlog.h" + +extern char *ConnectionInfo; +extern int connBlockScreenStart; + +#ifdef PANORAMIX +extern int PanoramiXPixWidth; +extern int PanoramiXPixHeight; +extern int PanoramiXNumScreens; +#endif + + int dmxGlobalWidth, dmxGlobalHeight; + +/** We may want the wall dimensions to be different from the bounding + * box dimensions that Xinerama computes, so save those and update them + * here. + */ +void dmxSetWidthHeight(int width, int height) +{ + dmxGlobalWidth = width; + dmxGlobalHeight = height; +} + +/** Computes the global bounding box for DMX. This may be larger than + * the one computed by Xinerama because of the DMX configuration + * file. */ +void dmxComputeWidthHeight(DMXRecomputeFlag flag) +{ + int i; + DMXScreenInfo *dmxScreen; + int w = 0; + int h = 0; + + for (i = 0; i < dmxNumScreens; i++) { + /* Don't use root* here because this is + * the global bounding box. */ + dmxScreen = &dmxScreens[i]; + if (w < dmxScreen->scrnWidth + dmxScreen->rootXOrigin) + w = dmxScreen->scrnWidth + dmxScreen->rootXOrigin; + if (h < dmxScreen->scrnHeight + dmxScreen->rootYOrigin) + h = dmxScreen->scrnHeight + dmxScreen->rootYOrigin; + } + if (!dmxGlobalWidth && !dmxGlobalHeight) { + dmxLog(dmxInfo, "Using %dx%d as global bounding box\n", w, h); + } else { + switch (flag) { + case DMX_NO_RECOMPUTE_BOUNDING_BOX: + dmxLog(dmxInfo, + "Using old bounding box (%dx%d) instead of new (%dx%d)\n", + dmxGlobalWidth, dmxGlobalHeight, w, h); + w = dmxGlobalWidth; + h = dmxGlobalHeight; + break; + case DMX_RECOMPUTE_BOUNDING_BOX: + dmxLog(dmxInfo, + "Using %dx%d as global bounding box, instead of %dx%d\n", + w, h, dmxGlobalWidth, dmxGlobalHeight); + break; + } + } + + dmxGlobalWidth = w; + dmxGlobalHeight = h; +} + +/** A callback routine that hooks into Xinerama and provides a + * convenient place to print summary log information during server + * startup. This routine does not modify any values. */ +void dmxConnectionBlockCallback(void) +{ + xWindowRoot *root = (xWindowRoot *)(ConnectionInfo+connBlockScreenStart); + int offset = connBlockScreenStart + sizeof(xWindowRoot); + int i; + Bool *found = NULL; + + MAXSCREENSALLOC(found); + if (!found) + dmxLog(dmxFatal, "dmxConnectionBlockCallback: out of memory\n"); + + dmxLog(dmxInfo, "===== Start of Summary =====\n"); +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + if (dmxGlobalWidth && dmxGlobalHeight + && (dmxGlobalWidth != PanoramiXPixWidth + || dmxGlobalHeight != PanoramiXPixHeight)) { + dmxLog(dmxInfo, + "Changing Xinerama dimensions from %d %d to %d %d\n", + PanoramiXPixWidth, PanoramiXPixHeight, + dmxGlobalWidth, dmxGlobalHeight); + PanoramiXPixWidth = root->pixWidth = dmxGlobalWidth; + PanoramiXPixHeight = root->pixHeight = dmxGlobalHeight; + } else { + dmxGlobalWidth = PanoramiXPixWidth; + dmxGlobalHeight = PanoramiXPixHeight; + } + dmxLog(dmxInfo, "%d screens configured with Xinerama (%d %d)\n", + PanoramiXNumScreens, PanoramiXPixWidth, PanoramiXPixHeight); + for (i = 0; i < PanoramiXNumScreens; i++) found[i] = FALSE; + } else { +#endif + /* This never happens because we're + * either called from a Xinerama + * callback or during reconfiguration + * (which only works with Xinerama on). + * In any case, be reasonable. */ + dmxLog(dmxInfo, "%d screens configured (%d %d)\n", + screenInfo.numScreens, root->pixWidth, root->pixHeight); +#ifdef PANORAMIX + } +#endif + + for (i = 0; i < root->nDepths; i++) { + xDepth *depth = (xDepth *)(ConnectionInfo + offset); + int voffset = offset + sizeof(xDepth); + xVisualType *visual = (xVisualType *)(ConnectionInfo + voffset); + int j; + + dmxLog(dmxInfo, "%d visuals at depth %d:\n", + depth->nVisuals, depth->depth); + for (j = 0; j < depth->nVisuals; j++, visual++) { + XVisualInfo vi; + + vi.visual = NULL; + vi.visualid = visual->visualID; + vi.screen = 0; + vi.depth = depth->depth; + vi.class = visual->class; + vi.red_mask = visual->redMask; + vi.green_mask = visual->greenMask; + vi.blue_mask = visual->blueMask; + vi.colormap_size = visual->colormapEntries; + vi.bits_per_rgb = visual->bitsPerRGB; + dmxLogVisual(NULL, &vi, 0); + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + int k; + for (k = 0; k < PanoramiXNumScreens; k++) { + DMXScreenInfo *dmxScreen = &dmxScreens[k]; + + if (dmxScreen->beDisplay) { + XVisualInfo *pvi = + &dmxScreen->beVisuals[dmxScreen->beDefVisualIndex]; + if (pvi->depth == depth->depth && + pvi->class == visual->class) + found[k] = TRUE; + } else { + /* Screen #k is detatched, so it always succeeds */ + found[k] = TRUE; + } + } + } +#endif + } + offset = voffset + depth->nVisuals * sizeof(xVisualType); + } + + dmxInputLogDevices(); + dmxLog(dmxInfo, "===== End of Summary =====\n"); + +#ifdef PANORAMIX + if (!noPanoramiXExtension) { + Bool fatal = FALSE; + for (i = 0; i < PanoramiXNumScreens; i++) { + fatal |= !found[i]; + if (!found[i]) { + dmxLog(dmxError, + "The default visual for screen #%d does not match " + "any of the\n", i); + dmxLog(dmxError, + "consolidated visuals from Xinerama (listed above)\n"); + } + } + if (fatal) + dmxLog(dmxFatal, + "dmxConnectionBlockCallback: invalid screen(s) found"); + } +#endif + MAXSCREENSFREE(found); +} Index: xc/programs/Xserver/hw/dmx/dmxcb.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxcb.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxcb.h Wed Jun 30 16:21:38 2004 @@ -0,0 +1,54 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxcb.h,v 1.1 2004/06/30 20:21:38 martin Exp $ */ +/* + * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * Header file for connection block functions. \see dmxcb.c. + */ + +#ifndef _DMXCB_H_ +#define _DMXCB_H_ +/** The cursor position, in global coordinates. */ +extern int dmxGlobalWidth, dmxGlobalHeight; + +/** #dmxComputeWidthHeight can either recompute the global bounding box + * or not. */ +typedef enum { + DMX_RECOMPUTE_BOUNDING_BOX, + DMX_NO_RECOMPUTE_BOUNDING_BOX +} DMXRecomputeFlag; + +extern void dmxSetWidthHeight(int width, int height); +extern void dmxComputeWidthHeight(DMXRecomputeFlag flag); +extern void dmxConnectionBlockCallback(void); +#endif Index: xc/programs/Xserver/hw/dmx/dmxclient.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxclient.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxclient.h Wed Jun 30 16:21:38 2004 @@ -0,0 +1,150 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxclient.h,v 1.1 2004/06/30 20:21:38 martin Exp $ */ +/* + * Copyright (c) 1995 X Consortium + * Copyright 2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT, THE X CONSORTIUM, + * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * 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 dealings in this Software without prior written + * authorization from the X Consortium. + */ + +/* + * Derived from hw/xnest/Xnest.h by Rickard E. (Rik) Faith + */ + +/** \file + * This file includes all client-side include files with proper wrapping. + */ + +#ifndef _DMXCLIENT_H_ +#define _DMXCLIENT_H_ + +#define GC XlibGC + +#ifdef _XSERVER64 +#define DMX64 +#undef _XSERVER64 +typedef unsigned long XID64; +typedef unsigned long Mask64; +typedef unsigned long Atom64; +typedef unsigned long VisualID64; +typedef unsigned long Time64; +#define XID XID64 +#define Mask Mask64 +#define Atom Atom64 +#define VisualID VisualID64 +#define Time Time64 +typedef XID Window64; +typedef XID Drawable64; +typedef XID Font64; +typedef XID Pixmap64; +typedef XID Cursor64; +typedef XID Colormap64; +typedef XID GContext64; +typedef XID KeySym64; +#define Window Window64 +#define Drawable Drawable64 +#define Font Font64 +#define Pixmap Pixmap64 +#define Cursor Cursor64 +#define Colormap Colormap64 +#define GContext GContext64 +#define KeySym KeySym64 +#endif + +#include +#include /* For _XExtension */ +#include /* from glxserver.h */ +#include /* from glxserver.h */ +#include +#include +#include +#include +#include /* For XmuSnprintf */ + +#ifdef SHAPE +#include +#endif + +#ifdef RENDER +#include +#undef PictFormatType +#endif + +#ifdef XKB +#include +#include +#endif + +#ifdef XINPUT +#include +#endif + +/* Always include these, since we query them even if we don't export XINPUT. */ +#include /* For XDevice */ +#include + +#undef GC + +#ifdef DMX64 +#define _XSERVER64 +#undef XID +#undef Mask +#undef Atom +#undef VisualID +#undef Time +#undef Window +#undef Drawable +#undef Font +#undef Pixmap +#undef Cursor +#undef Colormap +#undef GContext +#undef KeySym +#endif + +/* These are in exglobals.h, but that conflicts with X11/extensions/XKBsrv.h */ +extern int ProximityIn; +extern int ProximityOut; +extern int DeviceValuator; +extern int DeviceMotionNotify; +extern int DeviceFocusIn; +extern int DeviceFocusOut; +extern int DeviceStateNotify; +extern int DeviceMappingNotify; +extern int ChangeDeviceNotify; + +/* Some protocol gets included last, after undefines. */ +#include +#ifdef XKB +#include +#define XKB_IN_SERVER +#include +#undef XPointer +#endif +#include + +#endif Index: xc/programs/Xserver/hw/dmx/dmxcmap.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxcmap.c:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxcmap.c Wed Jun 30 16:21:38 2004 @@ -0,0 +1,216 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxcmap.c,v 1.1 2004/06/30 20:21:38 martin Exp $ */ +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +/** \file + * Colormap support. */ + +#include "dmx.h" +#include "dmxsync.h" +#include "dmxcmap.h" +#include "dmxvisual.h" + +#include "micmap.h" + +static int dmxInitColormapPrivateFunc(ColormapPtr pColormap) +{ + return TRUE; +} + +static Bool dmxAllocateColormapPrivates(ColormapPtr pColormap) +{ + static unsigned long dmxColormapGeneration; + dmxColormapPrivPtr pCmapPriv; + + if (dmxColormapGeneration != serverGeneration) { + if ((dmxColormapPrivateIndex + = AllocateColormapPrivateIndex(dmxInitColormapPrivateFunc)) < 0) + return FALSE; + + dmxColormapGeneration = serverGeneration; + } + + pCmapPriv = (dmxColormapPrivPtr)xalloc(sizeof(*pCmapPriv)); + if (!pCmapPriv) + return FALSE; + pCmapPriv->cmap = (Colormap)0; + + DMX_SET_COLORMAP_PRIV(pColormap, pCmapPriv); + + return TRUE; +} + +/** Create \a pColormap on the back-end server. */ +Bool dmxBECreateColormap(ColormapPtr pColormap) +{ + ScreenPtr pScreen = pColormap->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap); + VisualPtr pVisual = pColormap->pVisual; + Visual *visual = dmxLookupVisual(pScreen, pVisual); + + pCmapPriv->cmap = XCreateColormap(dmxScreen->beDisplay, + dmxScreen->scrnWin, + visual, + (pVisual->class & DynamicClass ? + AllocAll : AllocNone)); + return (pCmapPriv->cmap != 0); +} + +/** Create colormap on back-end server associated with \a pColormap's + * screen. */ +Bool dmxCreateColormap(ColormapPtr pColormap) +{ + ScreenPtr pScreen = pColormap->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + Bool ret = TRUE; + + if (!dmxAllocateColormapPrivates(pColormap)) + return FALSE; + + if (dmxScreen->beDisplay) { + if (!dmxBECreateColormap(pColormap)) + return FALSE; + } + + DMX_UNWRAP(CreateColormap, dmxScreen, pScreen); + if (pScreen->CreateColormap) + ret = pScreen->CreateColormap(pColormap); + DMX_WRAP(CreateColormap, dmxCreateColormap, dmxScreen, pScreen); + + return ret; +} + +/** Destroy \a pColormap on the back-end server. */ +Bool dmxBEFreeColormap(ColormapPtr pColormap) +{ + ScreenPtr pScreen = pColormap->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap); + + if (pCmapPriv->cmap) { + XFreeColormap(dmxScreen->beDisplay, pCmapPriv->cmap); + pCmapPriv->cmap = (Colormap)0; + return TRUE; + } + + return FALSE; +} + +/** Destroy colormap on back-end server associated with \a pColormap's + * screen. */ +void dmxDestroyColormap(ColormapPtr pColormap) +{ + ScreenPtr pScreen = pColormap->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap); + + if (dmxScreen->beDisplay) + dmxBEFreeColormap(pColormap); + xfree(pCmapPriv); + DMX_SET_COLORMAP_PRIV(pColormap, NULL); + + DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen); + if (pScreen->DestroyColormap) + pScreen->DestroyColormap(pColormap); + DMX_WRAP(DestroyColormap, dmxDestroyColormap, dmxScreen, pScreen); +} + +/** Install colormap on back-end server associated with \a pColormap's + * screen. */ +void dmxInstallColormap(ColormapPtr pColormap) +{ + ScreenPtr pScreen = pColormap->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap); + + DMX_UNWRAP(InstallColormap, dmxScreen, pScreen); + if (pScreen->InstallColormap) + pScreen->InstallColormap(pColormap); + DMX_WRAP(InstallColormap, dmxInstallColormap, dmxScreen, pScreen); + + if (dmxScreen->beDisplay) { + XInstallColormap(dmxScreen->beDisplay, pCmapPriv->cmap); + dmxSync(dmxScreen, FALSE); + } +} + +/** Store colors in \a pColormap on back-end server associated with \a + * pColormap's screen. */ +void dmxStoreColors(ColormapPtr pColormap, int ndef, xColorItem *pdef) +{ + ScreenPtr pScreen = pColormap->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap); + + if (dmxScreen->beDisplay && (pColormap->pVisual->class & DynamicClass)) { + XColor *color = xalloc(sizeof(*color) * ndef); + int i; + + if (color) { + for (i = 0; i < ndef; i++) { + color[i].pixel = pdef[i].pixel; + color[i].red = pdef[i].red; + color[i].blue = pdef[i].blue; + color[i].green = pdef[i].green; + color[i].flags = pdef[i].flags; + color[i].pad = pdef[i].pad; + } + XStoreColors(dmxScreen->beDisplay, pCmapPriv->cmap, color, ndef); + xfree(color); + } else { /* xalloc failed, so fallback */ + XColor c; + for (i = 0; i < ndef; i++) { + c.pixel = pdef[i].pixel; + c.red = pdef[i].red; + c.blue = pdef[i].blue; + c.green = pdef[i].green; + c.flags = pdef[i].flags; + c.pad = pdef[i].pad; + XStoreColor(dmxScreen->beDisplay, pCmapPriv->cmap, &c); + } + } + dmxSync(dmxScreen, FALSE); + } + + DMX_UNWRAP(StoreColors, dmxScreen, pScreen); + if (pScreen->StoreColors) + pScreen->StoreColors(pColormap, ndef, pdef); + DMX_WRAP(StoreColors, dmxStoreColors, dmxScreen, pScreen); +} + +/** Create the DMX server's default colormap. */ +Bool dmxCreateDefColormap(ScreenPtr pScreen) +{ + return miCreateDefColormap(pScreen); +} Index: xc/programs/Xserver/hw/dmx/dmxcmap.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxcmap.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxcmap.h Wed Jun 30 16:21:38 2004 @@ -0,0 +1,71 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxcmap.h,v 1.1 2004/06/30 20:21:38 martin Exp $ */ +/* + * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +/** \file + * Header file for colormap support. \see dmxcmap.c. */ + +#ifndef DMXCMAP_H +#define DMXCMAP_H + +#include "colormapst.h" + +/** Colormap private area. */ +typedef struct _dmxColormapPriv { + Colormap cmap; +} dmxColormapPrivRec, *dmxColormapPrivPtr; + + +extern Bool dmxCreateColormap(ColormapPtr pColormap); +extern void dmxDestroyColormap(ColormapPtr pColormap); +extern void dmxInstallColormap(ColormapPtr pColormap); +extern void dmxStoreColors(ColormapPtr pColormap, int ndef, xColorItem *pdef); + +extern Bool dmxCreateDefColormap(ScreenPtr pScreen); + +extern Bool dmxBECreateColormap(ColormapPtr pColormap); +extern Bool dmxBEFreeColormap(ColormapPtr pColormap); + +/** Private index. \see dmxcmap.c \see dmxscrinit.c \see dmxwindow.c */ +extern int dmxColormapPrivateIndex; + +/** Set colormap private structure. */ +#define DMX_SET_COLORMAP_PRIV(_pCMap, _pCMapPriv) \ + (_pCMap)->devPrivates[dmxColormapPrivateIndex].ptr \ + = (pointer)(_pCMapPriv); + +/** Get colormap private structure. */ +#define DMX_GET_COLORMAP_PRIV(_pCMap) \ + (dmxColormapPrivPtr)(_pCMap)->devPrivates[dmxColormapPrivateIndex].ptr + +#endif /* DMXCMAP_H */ Index: xc/programs/Xserver/hw/dmx/dmxcursor.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxcursor.c:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxcursor.c Wed Jun 30 16:21:38 2004 @@ -0,0 +1,922 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxcursor.c,v 1.1 2004/06/30 20:21:38 martin Exp $ */ +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * David H. Dawes + * Kevin E. Martin + * Rickard E. (Rik) Faith + * + */ + +/** \file + * This file contains code than supports cursor movement, including the + * code that initializes and reinitializes the screen positions and + * computes screen overlap. + * + * "This code is based very closely on the XFree86 equivalent + * (xfree86/common/xf86Cursor.c)." --David Dawes. + * + * "This code was then extensively re-written, as explained here." + * --Rik Faith + * + * The code in xf86Cursor.c used edge lists to implement the + * CursorOffScreen function. The edge list computation was complex + * (especially in the face of arbitrarily overlapping screens) compared + * with the speed savings in the CursorOffScreen function. The new + * implementation has erred on the side of correctness, readability, and + * maintainability over efficiency. For the common (non-edge) case, the + * dmxCursorOffScreen function does avoid a loop over all the screens. + * When the cursor has left the screen, all the screens are searched, + * and the first screen (in dmxScreens order) containing the cursor will + * be returned. If run-time profiling shows that this routing is a + * performance bottle-neck, then an edge list may have to be + * reimplemented. An edge list algorithm is O(edges) whereas the new + * algorithm is O(dmxNumScreens). Since edges is usually 1-3 and + * dmxNumScreens may be 30-60 for large backend walls, this trade off + * may be compelling. + * + * The xf86InitOrigins routine uses bit masks during the computation and + * is therefore limited to the length of a word (e.g., 32 or 64 bits) + * screens. Because Xdmx is expected to be used with a large number of + * backend displays, this limitation was removed. The new + * implementation has erred on the side of readability over efficiency, + * using the dmxSL* routines to manage a screen list instead of a + * bitmap, and a function call to decrease the length of the main + * routine. Both algorithms are of the same order, and both are called + * only at server generation time, so trading clarity and long-term + * maintainability for efficiency does not seem justified in this case. + */ + +#define DMX_CURSOR_DEBUG 0 + +#include "dmx.h" +#include "dmxsync.h" +#include "dmxcursor.h" +#include "dmxlog.h" +#include "dmxprop.h" +#include "dmxinput.h" + +#include "mipointer.h" +#include "windowstr.h" +#include "globals.h" +#include "cursorstr.h" +#include "dixevents.h" /* For GetSpriteCursor() */ + +#if DMX_CURSOR_DEBUG +#define DMXDBG0(f) dmxLog(dmxDebug,f) +#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a) +#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b) +#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) +#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d) +#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e) +#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g) +#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h) +#else +#define DMXDBG0(f) +#define DMXDBG1(f,a) +#define DMXDBG2(f,a,b) +#define DMXDBG3(f,a,b,c) +#define DMXDBG4(f,a,b,c,d) +#define DMXDBG5(f,a,b,c,d,e) +#define DMXDBG6(f,a,b,c,d,e,g) +#define DMXDBG7(f,a,b,c,d,e,g,h) +#endif + +static int dmxCursorDoMultiCursors = 1; + +/** Turn off support for displaying multiple cursors on overlapped + back-end displays. See #dmxCursorDoMultiCursors. */ +void dmxCursorNoMulti(void) +{ + dmxCursorDoMultiCursors = 0; +} + +static Bool dmxCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) +{ + DMXScreenInfo *dmxScreen; + int i; + int localX = *x; + int localY = *y; + int globalX; + int globalY; + + if (screenInfo.numScreens == 1) return FALSE; + + /* On current screen? */ + dmxScreen = &dmxScreens[(*ppScreen)->myNum]; + if (localX >= 0 + && localX < dmxScreen->rootWidth + && localY >= 0 + && localY < dmxScreen->rootHeight) return FALSE; + + /* Convert to global coordinate space */ + globalX = dmxScreen->rootXOrigin + localX; + globalY = dmxScreen->rootYOrigin + localY; + + /* Is cursor on the current screen? + * This efficiently exits this routine + * for the most common case. */ + if (ppScreen && *ppScreen) { + dmxScreen = &dmxScreens[(*ppScreen)->myNum]; + if (globalX >= dmxScreen->rootXOrigin + && globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth + && globalY >= dmxScreen->rootYOrigin + && globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight) + return FALSE; + } + + /* Find first screen cursor is on */ + for (i = 0; i < dmxNumScreens; i++) { + dmxScreen = &dmxScreens[i]; + if (globalX >= dmxScreen->rootXOrigin + && globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth + && globalY >= dmxScreen->rootYOrigin + && globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight) { + if (dmxScreen->index == (*ppScreen)->myNum) return FALSE; + *ppScreen = screenInfo.screens[dmxScreen->index]; + *x = globalX - dmxScreen->rootXOrigin; + *y = globalY - dmxScreen->rootYOrigin; + return TRUE; + } + } + return FALSE; +} + +static void dmxCrossScreen(ScreenPtr pScreen, Bool entering) +{ +} + +static void dmxWarpCursor(ScreenPtr pScreen, int x, int y) +{ + DMXDBG3("dmxWarpCursor(%d,%d,%d)\n", pScreen->myNum, x, y); + miPointerWarpCursor(pScreen, x, y); +} + +miPointerScreenFuncRec dmxPointerCursorFuncs = +{ + dmxCursorOffScreen, + dmxCrossScreen, + dmxWarpCursor, + dmxeqEnqueue, + dmxeqSwitchScreen +}; + + +/** Create a list of screens that we'll manipulate. */ +static int *dmxSLCreate(void) +{ + int *list = malloc(dmxNumScreens * sizeof(*list)); + int i; + + for (i = 0; i < dmxNumScreens; i++) list[i] = 1; + return list; +} + +/** Free list. */ +static void dmxSLFree(int *list) +{ + free(list); +} + +/** Find next uninitialized entry in list. */ +static int dmxSLFindNext(int *list) +{ + int i; + for (i = 0; i < dmxNumScreens; i++) if (list[i]) return i; + return -1; +} + +/** Make one pass over all the screens and return the number updated. */ +static int dmxTryComputeScreenOrigins(int *screensLeft) +{ + ScreenPtr pScreen; + DMXScreenInfo *screen; + int i, ref; + int changed = 0; + + for (i = 0; i < dmxNumScreens; i++) { + if (!screensLeft[i]) continue; + screen = &dmxScreens[i]; + switch (screen->where) { + case PosAbsolute: + dixScreenOrigins[i].x = screen->whereX; + dixScreenOrigins[i].y = screen->whereY; + ++changed, screensLeft[i] = 0; + break; + case PosRelative: + ref = screen->whereRefScreen; + if (screensLeft[ref]) break; + dixScreenOrigins[i].x = dixScreenOrigins[ref].x + screen->whereX; + dixScreenOrigins[i].y = dixScreenOrigins[ref].y + screen->whereY; + ++changed, screensLeft[i] = 0; + break; + case PosRightOf: + ref = screen->whereRefScreen; + if (screensLeft[ref]) break; + pScreen = screenInfo.screens[ref]; + dixScreenOrigins[i].x = dixScreenOrigins[ref].x + pScreen->width; + dixScreenOrigins[i].y = dixScreenOrigins[ref].y; + ++changed, screensLeft[i] = 0; + break; + case PosLeftOf: + ref = screen->whereRefScreen; + if (screensLeft[ref]) break; + pScreen = screenInfo.screens[i]; + dixScreenOrigins[i].x = dixScreenOrigins[ref].x - pScreen->width; + dixScreenOrigins[i].y = dixScreenOrigins[ref].y; + ++changed, screensLeft[i] = 0; + break; + case PosBelow: + ref = screen->whereRefScreen; + if (screensLeft[ref]) break; + pScreen = screenInfo.screens[ref]; + dixScreenOrigins[i].x = dixScreenOrigins[ref].x; + dixScreenOrigins[i].y = dixScreenOrigins[ref].y + pScreen->height; + ++changed, screensLeft[i] = 0; + break; + case PosAbove: + ref = screen->whereRefScreen; + if (screensLeft[ref]) break; + pScreen = screenInfo.screens[i]; + dixScreenOrigins[i].x = dixScreenOrigins[ref].x; + dixScreenOrigins[i].y = dixScreenOrigins[ref].y - pScreen->height; + ++changed, screensLeft[i] = 0; + break; + case PosNone: + dmxLog(dmxFatal, "No position information for screen %d\n", i); + } + } + return changed; +} + +static void dmxComputeScreenOrigins(void) +{ + int *screensLeft; + int i, ref; + int minX, minY; + + /* Compute origins based on + * configuration information. */ + screensLeft = dmxSLCreate(); + while ((i = dmxSLFindNext(screensLeft)) >= 0) { + while (dmxTryComputeScreenOrigins(screensLeft)); + if ((i = dmxSLFindNext(screensLeft)) >= 0) { + /* All of the remaining screens are referencing each other. + * Assign a value to one of them and go through again. This + * guarantees that we will eventually terminate. + */ + ref = dmxScreens[i].whereRefScreen; + dixScreenOrigins[ref].x = dixScreenOrigins[ref].y = 0; + screensLeft[ref] = 0; + } + } + dmxSLFree(screensLeft); + + + /* Justify the topmost and leftmost to + * (0,0). */ + minX = dixScreenOrigins[0].x; + minY = dixScreenOrigins[0].y; + for (i = 1; i < dmxNumScreens; i++) { /* Compute minX, minY */ + if (dixScreenOrigins[i].x < minX) minX = dixScreenOrigins[i].x; + if (dixScreenOrigins[i].y < minY) minY = dixScreenOrigins[i].y; + } + if (minX || minY) { + for (i = 0; i < dmxNumScreens; i++) { + dixScreenOrigins[i].x -= minX; + dixScreenOrigins[i].y -= minY; + } + } +} + +/** Recompute origin information in the #dmxScreens list. This is + * either called from #dmxInitOrigins() or from #dmxReconfig(). */ +void dmxReInitOrigins(void) +{ + int i; + + if (dmxNumScreens > MAXSCREENS) + dmxLog(dmxFatal, "dmxNumScreens = %d > MAXSCREENS = %d\n", + dmxNumScreens, MAXSCREENS); + + for (i = 0; i < dmxNumScreens; i++) { + DMXScreenInfo *dmxScreen = &dmxScreens[i]; + dmxLogOutput(dmxScreen, + "s=%dx%d%+d%+d r=%dx%d%+d%+d @%d,%d" + " (be=%dx%d depth=%d bpp=%d)\n", + dmxScreen->scrnWidth, dmxScreen->scrnHeight, + dmxScreen->scrnX, dmxScreen->scrnY, + + dmxScreen->rootWidth, dmxScreen->rootHeight, + dmxScreen->rootX, dmxScreen->rootY, + + dmxScreen->rootXOrigin, dmxScreen->rootYOrigin, + dmxScreen->beWidth, dmxScreen->beHeight, + dmxScreen->beDepth, dmxScreen->beBPP); + } +} + +/** Initialize screen origins (and relative position). This is called + * for each server generation. For dynamic reconfiguration, use + * #dmxReInitOrigins() instead. */ +void dmxInitOrigins(void) +{ + int i; + + if (dmxNumScreens > MAXSCREENS) + dmxLog(dmxFatal, "dmxNumScreens = %d > MAXSCREENS = %d\n", + dmxNumScreens, MAXSCREENS); + + for (i = 0; i < dmxNumScreens; i++) { + DMXScreenInfo *dmxScreen = &dmxScreens[i]; + dmxLogOutput(dmxScreen, + "(request) s=%dx%d%+d%+d r=%dx%d%+d%+d @%d,%d (%d)" + " (be=%dx%d depth=%d bpp=%d)\n", + dmxScreen->scrnWidth, dmxScreen->scrnHeight, + dmxScreen->scrnX, dmxScreen->scrnY, + + dmxScreen->rootWidth, dmxScreen->rootHeight, + dmxScreen->rootX, dmxScreen->rootY, + + dmxScreen->whereX, dmxScreen->whereY, + dmxScreen->where, + + dmxScreen->beWidth, dmxScreen->beHeight, + dmxScreen->beDepth, dmxScreen->beBPP); + } + + dmxComputeScreenOrigins(); + + for (i = 0; i < dmxNumScreens; i++) { + DMXScreenInfo *dmxScreen = &dmxScreens[i]; + dmxScreen->rootXOrigin = dixScreenOrigins[i].x; + dmxScreen->rootYOrigin = dixScreenOrigins[i].y; + } + + dmxReInitOrigins(); +} + +/** Returns non-zero if the global \a x, \a y coordinate is on the + * screen window of the \a dmxScreen. */ +int dmxOnScreen(int x, int y, DMXScreenInfo *dmxScreen) +{ +#if DMX_CURSOR_DEBUG > 1 + dmxLog(dmxDebug, + "dmxOnScreen %d %d,%d (r=%dx%d%+d%+d@%d,%d s=%dx%d%+d%+d)\n", + dmxScreen->index, x, y, + dmxScreen->rootWidth, dmxScreen->rootHeight, + dmxScreen->rootX, dmxScreen->rootY, + dmxScreen->rootXOrigin, dmxScreen->rootYOrigin, + dmxScreen->scrnWidth, dmxScreen->scrnHeight, + dmxScreen->scrnX, dmxScreen->scrnY); +#endif + if (x >= dmxScreen->rootXOrigin + && x < dmxScreen->rootXOrigin + dmxScreen->rootWidth + && y >= dmxScreen->rootYOrigin + && y < dmxScreen->rootYOrigin + dmxScreen->rootHeight) return 1; + return 0; +} + +/** Returns non-zero if \a a overlaps \a b. */ +static int dmxDoesOverlap(DMXScreenInfo *a, DMXScreenInfo *b) +{ + if (dmxOnScreen(a->rootXOrigin, + a->rootYOrigin, b)) return 1; + + if (dmxOnScreen(a->rootXOrigin, + a->rootYOrigin + a->scrnWidth, b)) return 1; + + if (dmxOnScreen(a->rootXOrigin + a->scrnHeight, + a->rootYOrigin, b)) return 1; + + if (dmxOnScreen(a->rootXOrigin + a->scrnHeight, + a->rootYOrigin + a->scrnWidth, b)) return 1; + + if (dmxOnScreen(b->rootXOrigin, + b->rootYOrigin, a)) return 1; + + if (dmxOnScreen(b->rootXOrigin, + b->rootYOrigin + b->scrnWidth, a)) return 1; + + if (dmxOnScreen(b->rootXOrigin + b->scrnHeight, + b->rootYOrigin, a)) return 1; + + if (dmxOnScreen(b->rootXOrigin + b->scrnHeight, + b->rootYOrigin + b->scrnWidth, a)) return 1; + + return 0; +} + +/** Used with #dmxInterateOverlap to print out a list of screens which + * overlap each other. */ +static void *dmxPrintOverlap(DMXScreenInfo *dmxScreen, void *closure) +{ + DMXScreenInfo *a = closure; + if (dmxScreen != a) { + if (dmxScreen->cursorNotShared) + dmxLogOutputCont(a, " [%d/%s]", dmxScreen->index, dmxScreen->name); + else + dmxLogOutputCont(a, " %d/%s", dmxScreen->index, dmxScreen->name); + } + return NULL; +} + +/** Iterate over the screens which overlap with the \a start screen, + * calling \a f with the \a closure for each argument. Often used with + * #dmxPrintOverlap. */ +static void *dmxIterateOverlap(DMXScreenInfo *start, + void *(*f)(DMXScreenInfo *dmxScreen, void *), + void *closure) +{ + DMXScreenInfo *pt; + + if (!start->over) return f(start, closure); + + for (pt = start->over; /* condition at end of loop */; pt = pt->over) { + void *retval; + if ((retval = f(pt, closure))) return retval; + if (pt == start) break; + } + return NULL; +} + +/** Used with #dmxPropertyIterate to determine if screen \a a is the + * same as the screen \a closure. */ +static void *dmxTestSameDisplay(DMXScreenInfo *a, void *closure) +{ + DMXScreenInfo *b = closure; + + if (a == b) return a; + return NULL; +} + +/** Detects overlapping dmxScreens and creates circular lists. This + * uses an O(dmxNumScreens^2) algorithm, but dmxNumScreens is < 100 and + * the computation only needs to be performed for every server + * generation or dynamic reconfiguration . */ +void dmxInitOverlap(void) +{ + int i, j; + DMXScreenInfo *a, *b, *pt; + + for (i = 0; i < dmxNumScreens; i++) dmxScreens[i].over = NULL; + + for (i = 0; i < dmxNumScreens; i++) { + a = &dmxScreens[i]; + + for (j = i+1; j < dmxNumScreens; j++) { + b = &dmxScreens[j]; + if (b->over) continue; + + if (dmxDoesOverlap(a, b)) { + DMXDBG6("%d overlaps %d: a=%p %p b=%p %p\n", + a->index, b->index, a, a->over, b, b->over); + b->over = (a->over ? a->over : a); + a->over = b; + } + } + } + + for (i = 0; i < dmxNumScreens; i++) { + a = &dmxScreens[i]; + + if (!a->over) continue; + + /* Flag all pairs that are on same display */ + for (pt = a->over; pt != a; pt = pt->over) { + if (dmxPropertyIterate(a, dmxTestSameDisplay, pt)) { + /* The ->over sets contain the transitive set of screens + * that overlap. For screens that are on the same + * backend display, we only want to exclude pairs of + * screens that mutually overlap on the backend display, + * so we call dmxDoesOverlap, which is stricter than the + * ->over set. */ + if (!dmxDoesOverlap(a, pt)) continue; + a->cursorNotShared = 1; + pt->cursorNotShared = 1; + dmxLog(dmxInfo, + "Screen %d and %d overlap on %s\n", + a->index, pt->index, a->name); + } + } + } + + for (i = 0; i < dmxNumScreens; i++) { + a = &dmxScreens[i]; + + if (a->over) { + dmxLogOutput(a, "Overlaps"); + dmxIterateOverlap(a, dmxPrintOverlap, a); + dmxLogOutputCont(a, "\n"); + } + } +} + +/** Create \a pCursor on the back-end associated with \a pScreen. */ +void dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen); + CursorBitsPtr pBits = pCursor->bits; + Pixmap src, msk; + XColor fg, bg; + XImage *img; + XlibGC gc = NULL; + XGCValues v; + unsigned long m; + int i; + + if (!pCursorPriv) + return; + + m = GCFunction | GCPlaneMask | GCForeground | GCBackground | GCClipMask; + v.function = GXcopy; + v.plane_mask = AllPlanes; + v.foreground = 1L; + v.background = 0L; + v.clip_mask = None; + + for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) { + if (dmxScreen->bePixmapFormats[i].depth == 1) { + /* Create GC in the back-end servers */ + gc = XCreateGC(dmxScreen->beDisplay, dmxScreen->scrnDefDrawables[i], + m, &v); + break; + } + } + if (!gc) + dmxLog(dmxFatal, "dmxRealizeCursor: gc not initialized\n"); + + src = XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin, + pBits->width, pBits->height, 1); + msk = XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin, + pBits->width, pBits->height, 1); + + img = XCreateImage(dmxScreen->beDisplay, + dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual, + 1, XYBitmap, 0, (char *)pBits->source, + pBits->width, pBits->height, + BitmapPad(dmxScreen->beDisplay), 0); + + XPutImage(dmxScreen->beDisplay, src, gc, img, 0, 0, 0, 0, + pBits->width, pBits->height); + + XFree(img); + + img = XCreateImage(dmxScreen->beDisplay, + dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual, + 1, XYBitmap, 0, (char *)pBits->mask, + pBits->width, pBits->height, + BitmapPad(dmxScreen->beDisplay), 0); + + XPutImage(dmxScreen->beDisplay, msk, gc, img, 0, 0, 0, 0, + pBits->width, pBits->height); + + XFree(img); + + fg.red = pCursor->foreRed; + fg.green = pCursor->foreGreen; + fg.blue = pCursor->foreBlue; + + bg.red = pCursor->backRed; + bg.green = pCursor->backGreen; + bg.blue = pCursor->backBlue; + + pCursorPriv->cursor = XCreatePixmapCursor(dmxScreen->beDisplay, + src, msk, + &fg, &bg, + pBits->xhot, pBits->yhot); + + XFreePixmap(dmxScreen->beDisplay, src); + XFreePixmap(dmxScreen->beDisplay, msk); + XFreeGC(dmxScreen->beDisplay, gc); + + dmxSync(dmxScreen, FALSE); +} + +static Bool _dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxCursorPrivPtr pCursorPriv; + + DMXDBG2("_dmxRealizeCursor(%d,%p)\n", pScreen->myNum, pCursor); + + pCursor->devPriv[pScreen->myNum] = xalloc(sizeof(*pCursorPriv)); + if (!pCursor->devPriv[pScreen->myNum]) + return FALSE; + + pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen); + pCursorPriv->cursor = (Cursor)0; + + if (!dmxScreen->beDisplay) + return TRUE; + + dmxBECreateCursor(pScreen, pCursor); + return TRUE; +} + +/** Free \a pCursor on the back-end associated with \a pScreen. */ +Bool dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen); + + if (pCursorPriv) { + XFreeCursor(dmxScreen->beDisplay, pCursorPriv->cursor); + pCursorPriv->cursor = (Cursor)0; + return TRUE; + } + + return FALSE; +} + +static Bool _dmxUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + + DMXDBG3("_dmxUnrealizeCursor(%d,%p) %p\n", + pScreen->myNum, pCursor, pCursorPriv); + + if (dmxScreen->beDisplay) { + if (dmxBEFreeCursor(pScreen, pCursor)) + xfree(pCursor->devPriv[pScreen->myNum]); + } + pCursor->devPriv[pScreen->myNum] = NULL; + + return TRUE; +} + +static void _dmxMoveCursor(ScreenPtr pScreen, int x, int y) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + int newX = x + dmxScreen->rootX; + int newY = y + dmxScreen->rootY; + + if (newX < 0) newX = 0; + if (newY < 0) newY = 0; + + DMXDBG5("_dmxMoveCursor(%d,%d,%d) -> %d,%d\n", + pScreen->myNum, x, y, newX, newY); + if (dmxScreen->beDisplay) { + XWarpPointer(dmxScreen->beDisplay, None, dmxScreen->scrnWin, + 0, 0, 0, 0, newX, newY); + dmxSync(dmxScreen, TRUE); + } +} + +static void _dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + + DMXDBG4("_dmxSetCursor(%d,%p,%d,%d)\n", pScreen->myNum, pCursor, x, y); + + if (pCursor) { + dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen); + if (dmxScreen->curCursor != pCursorPriv->cursor) { + if (dmxScreen->beDisplay) + XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin, + pCursorPriv->cursor); + dmxScreen->cursor = pCursor; + dmxScreen->curCursor = pCursorPriv->cursor; + dmxScreen->cursorVisible = 1; + } + _dmxMoveCursor(pScreen, x, y); + } else { + if (dmxScreen->beDisplay) + XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin, + dmxScreen->noCursor); + dmxScreen->cursor = NULL; + dmxScreen->curCursor = (Cursor)0; + dmxScreen->cursorVisible = 0; + } + if (dmxScreen->beDisplay) dmxSync(dmxScreen, TRUE); +} + +static Bool dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) +{ + DMXScreenInfo *start = &dmxScreens[pScreen->myNum]; + DMXScreenInfo *pt; + + if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) + return _dmxRealizeCursor(pScreen, pCursor); + + for (pt = start->over; /* condition at end of loop */; pt = pt->over) { + if (pt->cursorNotShared) continue; + _dmxRealizeCursor(screenInfo.screens[pt->index], pCursor); + if (pt == start) break; + } + return TRUE; +} + +static Bool dmxUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) +{ + DMXScreenInfo *start = &dmxScreens[pScreen->myNum]; + DMXScreenInfo *pt; + + if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) + return _dmxUnrealizeCursor(pScreen, pCursor); + + for (pt = start->over; /* condition at end of loop */; pt = pt->over) { + if (pt->cursorNotShared) continue; + _dmxUnrealizeCursor(screenInfo.screens[pt->index], pCursor); + if (pt == start) break; + } + return TRUE; +} + +static CursorPtr dmxFindCursor(DMXScreenInfo *start) +{ + DMXScreenInfo *pt; + + if (!start || !start->over) return GetSpriteCursor(); + for (pt = start->over; /* condition at end of loop */; pt = pt->over) { + if (pt->cursor) return pt->cursor; + if (pt == start) break; + } + return GetSpriteCursor(); +} + +/** Move the cursor to coordinates (\a x, \a y)on \a pScreen. This + * function is usually called via #dmxPointerSpriteFuncs, except during + * reconfiguration when the cursor is repositioned to force an update on + * newley overlapping screens and on screens that no longer overlap. */ +void dmxMoveCursor(ScreenPtr pScreen, int x, int y) +{ + DMXScreenInfo *start = &dmxScreens[pScreen->myNum]; + DMXScreenInfo *pt; + + DMXDBG3("dmxMoveCursor(%d,%d,%d)\n", pScreen->myNum, x, y); + + if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) { + _dmxMoveCursor(pScreen, x, y); + return; + } + + for (pt = start->over; /* condition at end of loop */; pt = pt->over) { + if (pt->cursorNotShared) continue; + if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) { + if (/* pt != start && */ !pt->cursorVisible) { + if (!pt->cursor) { + /* This only happens during + * reconfiguration when a new overlap + * occurs. */ + CursorPtr pCursor; + + if ((pCursor = dmxFindCursor(start))) + _dmxRealizeCursor(screenInfo.screens[pt->index], + pt->cursor = pCursor); + + } + _dmxSetCursor(screenInfo.screens[pt->index], + pt->cursor, + x + start->rootXOrigin - pt->rootXOrigin, + y + start->rootYOrigin - pt->rootYOrigin); + } + _dmxMoveCursor(screenInfo.screens[pt->index], + x + start->rootXOrigin - pt->rootXOrigin, + y + start->rootYOrigin - pt->rootYOrigin); + } else if (/* pt != start && */ pt->cursorVisible) { + _dmxSetCursor(screenInfo.screens[pt->index], + NULL, + x + start->rootXOrigin - pt->rootXOrigin, + y + start->rootYOrigin - pt->rootYOrigin); + } + if (pt == start) break; + } +} + +static void dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +{ + DMXScreenInfo *start = &dmxScreens[pScreen->myNum]; + DMXScreenInfo *pt; + int GX, GY, gx, gy; + + DMXDBG5("dmxSetCursor(%d %p, %p,%d,%d)\n", + pScreen->myNum, start, pCursor, x, y); + + /* We do this check here because of two cases: + * + * 1) if a client calls XWarpPointer() + * and Xinerama is not running, we can + * have mi's notion of the pointer + * position out of phase with DMX's + * notion. + * + * 2) if a down button is held while the + * cursor moves outside the root window, + * mi's notion of the pointer position + * is out of phase with DMX's notion and + * the cursor can remain visible when it + * shouldn't be. */ + + dmxGetGlobalPosition(&GX, &GY); + gx = start->rootXOrigin + x; + gy = start->rootYOrigin + y; + if (x && y && (GX != gx || GY != gy)) + dmxCoreMotion(gx, gy, 0, DMX_NO_BLOCK); + + if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) { + _dmxSetCursor(pScreen, pCursor, x, y); + return; + } + + for (pt = start->over; /* condition at end of loop */; pt = pt->over) { + if (pt->cursorNotShared) continue; + if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) { + _dmxSetCursor(screenInfo.screens[pt->index], pCursor, + x + start->rootXOrigin - pt->rootXOrigin, + y + start->rootYOrigin - pt->rootYOrigin); + } else { + _dmxSetCursor(screenInfo.screens[pt->index], NULL, + x + start->rootXOrigin - pt->rootXOrigin, + y + start->rootYOrigin - pt->rootYOrigin); + } + if (pt == start) break; + } +} + + +/** This routine is used by the backend input routines to hide the + * cursor on a screen that is being used for relative input. \see + * dmxbackend.c */ +void dmxHideCursor(DMXScreenInfo *dmxScreen) +{ + int x, y; + ScreenPtr pScreen = screenInfo.screens[dmxScreen->index]; + + dmxGetGlobalPosition(&x, &y); + _dmxSetCursor(pScreen, NULL, x, y); +} + +/** This routine is called during reconfiguration to make sure the + * cursor is visible. */ +void dmxCheckCursor(void) +{ + int i; + int x, y; + ScreenPtr pScreen; + DMXScreenInfo *firstScreen; + + dmxGetGlobalPosition(&x, &y); + firstScreen = dmxFindFirstScreen(x, y); + + DMXDBG2("dmxCheckCursor %d %d\n", x, y); + for (i = 0; i < dmxNumScreens; i++) { + DMXScreenInfo *dmxScreen = &dmxScreens[i]; + pScreen = screenInfo.screens[dmxScreen->index]; + + if (!dmxOnScreen(x, y, dmxScreen)) { + if (firstScreen && i == miPointerCurrentScreen()->myNum) + miPointerSetNewScreen(firstScreen->index, x, y); + _dmxSetCursor(pScreen, NULL, + x - dmxScreen->rootXOrigin, + y - dmxScreen->rootYOrigin); + } else { + if (!dmxScreen->cursor) { + CursorPtr pCursor; + + if ((pCursor = dmxFindCursor(dmxScreen))) { + _dmxRealizeCursor(pScreen, dmxScreen->cursor = pCursor); + } + } + _dmxSetCursor(pScreen, dmxScreen->cursor, + x - dmxScreen->rootXOrigin, + y - dmxScreen->rootYOrigin); + } + } + DMXDBG2(" leave dmxCheckCursor %d %d\n", x, y); +} + +miPointerSpriteFuncRec dmxPointerSpriteFuncs = +{ + dmxRealizeCursor, + dmxUnrealizeCursor, + dmxSetCursor, + dmxMoveCursor, +}; Index: xc/programs/Xserver/hw/dmx/dmxcursor.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxcursor.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxcursor.h Wed Jun 30 16:21:38 2004 @@ -0,0 +1,70 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxcursor.h,v 1.1 2004/06/30 20:21:38 martin Exp $ */ +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * David H. Dawes + * Kevin E. Martin + * Rickard E. (Rik) Faith + * + */ + +/** \file + * Interface for cursor support. \see dmxcursor.c. */ + +#ifndef DMXCURSOR_H +#define DMXCURSOR_H + +#include "mipointer.h" + +/** Cursor private area. */ +typedef struct _dmxCursorPriv { + Cursor cursor; +} dmxCursorPrivRec, *dmxCursorPrivPtr; + +/** Cursor functions for mi layer. \see dmxcursor.c \see dmxscrinit.c */ +extern miPointerScreenFuncRec dmxPointerCursorFuncs; +/** Sprite functions for mi layer. \see dmxcursor.c \see dmxscrinit.c */ +extern miPointerSpriteFuncRec dmxPointerSpriteFuncs; + +extern void dmxReInitOrigins(void); +extern void dmxInitOrigins(void); +extern void dmxInitOverlap(void); +extern void dmxCursorNoMulti(void); +extern void dmxMoveCursor(ScreenPtr pScreen, int x, int y); +extern void dmxCheckCursor(void); +extern int dmxOnScreen(int x, int y, DMXScreenInfo *dmxScreen); +extern void dmxHideCursor(DMXScreenInfo *dmxScreen); + +extern void dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor); +extern Bool dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor); + +#define DMX_GET_CURSOR_PRIV(_pCursor, _pScreen) \ + (dmxCursorPrivPtr)(_pCursor)->devPriv[(_pScreen)->myNum] + +#endif /* DMXCURSOR_H */ Index: xc/programs/Xserver/hw/dmx/dmxdpms.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxdpms.c:1.2 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxdpms.c Fri Feb 4 21:01:39 2005 @@ -0,0 +1,210 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxdpms.c,v 1.2 2005/02/05 02:01:39 dawes Exp $ */ +/* + * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Author: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * Provides DPMS support and unifies all DPMS and other screen-saver + * support in one file. If -dpms is given on the command line, or the + * Xdmx server is not compiled with DPMS support, then the DPMS extension + * does not work for clients, but DPMS on the backends is still disables + * (and restored at Xdmx server shutdown time). + */ + +#include "dmx.h" +#include "dmxdpms.h" +#include "dmxlog.h" +#include "dmxsync.h" +#include "dpmsproc.h" +#include "windowstr.h" /* For screenIsSaved */ +#include "X11/extensions/dpms.h" + +static unsigned long dpmsGeneration = 0; +static Bool dpmsSupported = TRUE; + +static void _dmxDPMSInit(DMXScreenInfo *dmxScreen) +{ + int event_base, error_base; + int major, minor; + CARD16 level, standby, suspend, off; + BOOL state; + const char *monitor; + + if (dpmsGeneration != serverGeneration) { + dpmsSupported = TRUE; /* On unless a backend doesn't support it */ + dpmsGeneration = serverGeneration; + } + +#ifdef DPMSExtension + if (DPMSDisabledSwitch) dpmsSupported = FALSE; /* -dpms turns off */ +#else + dpmsSupported = FALSE; +#endif + + + dmxScreen->dpmsCapable = 0; + + if (!dmxScreen->beDisplay) { + dmxLogOutput(dmxScreen, + "Cannot determine if DPMS supported (detached screen)\n"); + dpmsSupported = FALSE; + return; + } + + if (!DPMSQueryExtension(dmxScreen->beDisplay, + &event_base, &error_base)) { + dmxLogOutput(dmxScreen, "DPMS not supported\n"); + dpmsSupported = FALSE; + return; + } + if (!DPMSGetVersion(dmxScreen->beDisplay, &major, &minor)) { + dmxLogOutput(dmxScreen, "DPMS not supported\n"); + dpmsSupported = FALSE; + return; + } + if (!DPMSCapable(dmxScreen->beDisplay)) { + dmxLogOutput(dmxScreen, "DPMS %d.%d (not DPMS capable)\n", + major, minor); + dpmsSupported = FALSE; + return; + } + + DPMSInfo(dmxScreen->beDisplay, &level, &state); + DPMSGetTimeouts(dmxScreen->beDisplay, &standby, &suspend, &off); + DPMSSetTimeouts(dmxScreen->beDisplay, 0, 0, 0); + DPMSEnable(dmxScreen->beDisplay); + DPMSForceLevel(dmxScreen->beDisplay, DPMSModeOn); + dmxScreen->dpmsCapable = 1; + dmxScreen->dpmsEnabled = !!state; + dmxScreen->dpmsStandby = standby; + dmxScreen->dpmsSuspend = suspend; + dmxScreen->dpmsOff = off; + + switch (level) { + case DPMSModeOn: monitor = "on"; break; + case DPMSModeStandby: monitor = "standby"; break; + case DPMSModeSuspend: monitor = "suspend"; break; + case DPMSModeOff: monitor = "off"; break; + default: monitor = "unknown"; break; + } + + dmxLogOutput(dmxScreen, + "DPMS %d.%d (%s, %s, %d %d %d)\n", + major, minor, monitor, state ? "enabled" : "disabled", + standby, suspend, off); +} + +/** Initialize DPMS support. We save the current settings and turn off + * DPMS. The settings are restored in #dmxDPMSTerm. */ +void dmxDPMSInit(DMXScreenInfo *dmxScreen) +{ + int interval, preferBlanking, allowExposures; + + /* Turn off DPMS */ + _dmxDPMSInit(dmxScreen); + + if (!dmxScreen->beDisplay) + return; + + /* Turn off screen saver */ + XGetScreenSaver(dmxScreen->beDisplay, &dmxScreen->savedTimeout, &interval, + &preferBlanking, &allowExposures); + XSetScreenSaver(dmxScreen->beDisplay, 0, interval, + preferBlanking, allowExposures); + XResetScreenSaver(dmxScreen->beDisplay); + dmxSync(dmxScreen, FALSE); +} + +/** Terminate DPMS support on \a dmxScreen. We restore the settings + * saved in #dmxDPMSInit. */ +void dmxDPMSTerm(DMXScreenInfo *dmxScreen) +{ + int timeout, interval, preferBlanking, allowExposures; + + if (!dmxScreen->beDisplay) + return; + + XGetScreenSaver(dmxScreen->beDisplay, &timeout, &interval, + &preferBlanking, &allowExposures); + XSetScreenSaver(dmxScreen->beDisplay, dmxScreen->savedTimeout, interval, + preferBlanking, allowExposures); + if (dmxScreen->dpmsCapable) { + /* Restore saved state */ + DPMSForceLevel(dmxScreen->beDisplay, DPMSModeOn); + DPMSSetTimeouts(dmxScreen->beDisplay, dmxScreen->dpmsStandby, + dmxScreen->dpmsSuspend, dmxScreen->dpmsOff); + if (dmxScreen->dpmsEnabled) DPMSEnable(dmxScreen->beDisplay); + else DPMSDisable(dmxScreen->beDisplay); + } + dmxSync(dmxScreen, FALSE); +} + +/** Called when activity is detected so that DPMS power-saving mode can + * be deactivated. */ +void dmxDPMSWakeup(void) +{ + if (screenIsSaved == SCREEN_SAVER_ON) + SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset); +#ifdef DPMSExtension + if (DPMSPowerLevel) DPMSSet(0); +#endif +} + +#ifdef DPMSExtension +/** This is called on each server generation. It should determine if + * DPMS is supported on all of the backends and, if so, return TRUE. */ +Bool DPMSSupported(void) +{ + return dpmsSupported; +} + +/** This is used by clients (e.g., xset) to set the DPMS level. */ +void DPMSSet(int level) +{ + int i; + + if (!dpmsSupported) return; + + if (level < 0) level = DPMSModeOn; + if (level > 3) level = DPMSModeOff; + + DPMSPowerLevel = level; + + for (i = 0; i < dmxNumScreens; i++) { + DMXScreenInfo *dmxScreen = &dmxScreens[i]; + if (dmxScreen->beDisplay) { + DPMSForceLevel(dmxScreen->beDisplay, level); + dmxSync(dmxScreen, FALSE); + } + } +} +#endif Index: xc/programs/Xserver/hw/dmx/dmxdpms.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxdpms.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxdpms.h Wed Jun 30 16:21:38 2004 @@ -0,0 +1,43 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxdpms.h,v 1.1 2004/06/30 20:21:38 martin Exp $ */ +/* + * Copyright 2003 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Author: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * Interface for DPMS extension support. \see dmxdpms.c */ + +#ifndef _DMXDPMS_H_ +#define _DMXDPMS_H_ +extern void dmxDPMSInit(DMXScreenInfo *dmxScreen); +extern void dmxDPMSTerm(DMXScreenInfo *dmxScreen); +extern void dmxDPMSWakeup(void); /* Call when input is processed */ +#endif Index: xc/programs/Xserver/hw/dmx/dmxextension.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxextension.c:1.5 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxextension.c Sun Jan 30 12:48:43 2005 @@ -0,0 +1,1492 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxextension.c,v 1.5 2005/01/30 17:48:43 tsi Exp $ */ +/* + * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Author: + * Rickard E. (Rik) Faith + * Kevin E. Martin + * + */ + +/** \file + * This file provides the only interface to the X server extension support + * in programs/Xserver/Xext. Those programs should only include dmxext.h + */ + +#include "dmx.h" +#include "dmxinit.h" +#include "dmxextension.h" +#include "dmxwindow.h" +#include "dmxcb.h" +#include "dmxcursor.h" +#include "dmxpixmap.h" +#include "dmxgc.h" +#include "dmxfont.h" +#include "dmxcmap.h" +#ifdef RENDER +#include "dmxpict.h" +#endif +#include "dmxinput.h" +#include "dmxsync.h" +#include "dmxscrinit.h" +#include "input/dmxinputinit.h" + +#include "windowstr.h" +#include "inputstr.h" /* For DeviceIntRec */ +#include "dmxproto.h" /* For DMX_BAD_* */ +#include "cursorstr.h" + +/* The default font is declared in dix/globals.c, but is not included in + * _any_ header files. */ +extern FontPtr defaultFont; + +/** This routine provides information to the DMX protocol extension + * about a particular screen. */ +Bool dmxGetScreenAttributes(int physical, DMXScreenAttributesPtr attr) +{ + DMXScreenInfo *dmxScreen; + + if (physical < 0 || physical >= dmxNumScreens) return FALSE; + + dmxScreen = &dmxScreens[physical]; + attr->displayName = dmxScreen->name; +#ifdef PANORAMIX + attr->logicalScreen = noPanoramiXExtension ? dmxScreen->index : 0; +#else + attr->logicalScreen = dmxScreen->index; +#endif + + attr->screenWindowWidth = dmxScreen->scrnWidth; + attr->screenWindowHeight = dmxScreen->scrnHeight; + attr->screenWindowXoffset = dmxScreen->scrnX; + attr->screenWindowYoffset = dmxScreen->scrnY; + + attr->rootWindowWidth = dmxScreen->rootWidth; + attr->rootWindowHeight = dmxScreen->rootHeight; + attr->rootWindowXoffset = dmxScreen->rootX; + attr->rootWindowYoffset = dmxScreen->rootY; + + attr->rootWindowXorigin = dmxScreen->rootXOrigin; + attr->rootWindowYorigin = dmxScreen->rootYOrigin; + + return TRUE; +} + +/** This routine provides information to the DMX protocol extension + * about a particular window. */ +Bool dmxGetWindowAttributes(WindowPtr pWindow, DMXWindowAttributesPtr attr) +{ + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + + attr->screen = pWindow->drawable.pScreen->myNum; + attr->window = pWinPriv->window; + + attr->pos.x = pWindow->drawable.x; + attr->pos.y = pWindow->drawable.y; + attr->pos.width = pWindow->drawable.width; + attr->pos.height = pWindow->drawable.height; + + if (!pWinPriv->window || pWinPriv->offscreen) { + attr->vis.x = 0; + attr->vis.y = 0; + attr->vis.height = 0; + attr->vis.width = 0; + return pWinPriv->window ? TRUE : FALSE; + } + + /* Compute display-relative coordinates */ + attr->vis.x = pWindow->drawable.x; + attr->vis.y = pWindow->drawable.y; + attr->vis.width = pWindow->drawable.width; + attr->vis.height = pWindow->drawable.height; + + if (attr->pos.x < 0) { + attr->vis.x -= attr->pos.x; + attr->vis.width = attr->pos.x + attr->pos.width - attr->vis.x; + } + if (attr->pos.x + attr->pos.width > pWindow->drawable.pScreen->width) { + if (attr->pos.x < 0) + attr->vis.width = pWindow->drawable.pScreen->width; + else + attr->vis.width = pWindow->drawable.pScreen->width - attr->pos.x; + } + if (attr->pos.y < 0) { + attr->vis.y -= attr->pos.y; + attr->vis.height = attr->pos.y + attr->pos.height - attr->vis.y; + } + if (attr->pos.y + attr->pos.height > pWindow->drawable.pScreen->height) { + if (attr->pos.y < 0) + attr->vis.height = pWindow->drawable.pScreen->height; + else + attr->vis.height = pWindow->drawable.pScreen->height - attr->pos.y; + } + + /* Convert to window-relative coordinates */ + attr->vis.x -= attr->pos.x; + attr->vis.y -= attr->pos.y; + + return TRUE; +} + +void dmxGetDesktopAttributes(DMXDesktopAttributesPtr attr) +{ + attr->width = dmxGlobalWidth; + attr->height = dmxGlobalHeight; + attr->shiftX = 0; /* NOTE: The upper left hand corner of */ + attr->shiftY = 0; /* the desktop is always <0,0>. */ +} + +/** Return the total number of devices, not just #dmxNumInputs. The + * number returned should be the same as that returned by + * XListInputDevices. */ +int dmxGetInputCount(void) +{ + int i, total; + + for (total = i = 0; i < dmxNumInputs; i++) total += dmxInputs[i].numDevs; + return total; +} + +/** Return information about the device with id = \a deviceId. This + * information is primarily for the #ProcDMXGetInputAttributes() + * function, which does not have access to the appropriate data + * structure. */ +int dmxGetInputAttributes(int deviceId, DMXInputAttributesPtr attr) +{ + int i, j; + DMXInputInfo *dmxInput; + + if (deviceId < 0) return -1; + for (i = 0; i < dmxNumInputs; i++) { + dmxInput = &dmxInputs[i]; + for (j = 0; j < dmxInput->numDevs; j++) { + DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j]; + if (deviceId != dmxLocal->pDevice->id) continue; + attr->isCore = !!dmxLocal->isCore; + attr->sendsCore = !!dmxLocal->sendsCore; + attr->detached = !!dmxInput->detached; + attr->physicalScreen = -1; + attr->physicalId = -1; + attr->name = NULL; + switch (dmxLocal->extType) { + case DMX_LOCAL_TYPE_LOCAL: + attr->inputType = 0; + break; + case DMX_LOCAL_TYPE_CONSOLE: + attr->inputType = 1; + attr->name = dmxInput->name; + attr->physicalId = dmxLocal->deviceId; + break; + case DMX_LOCAL_TYPE_BACKEND: + case DMX_LOCAL_TYPE_COMMON: + attr->inputType = 2; + attr->physicalScreen = dmxInput->scrnIdx; + attr->name = dmxInput->name; + attr->physicalId = dmxLocal->deviceId; + break; + } + return 0; /* Success */ + } + } + return -1; /* Failure */ +} + +/** Reinitialized the cursor boundaries. */ +static void dmxAdjustCursorBoundaries(void) +{ + int i; + + dmxReInitOrigins(); + dmxInitOverlap(); + dmxComputeWidthHeight(DMX_NO_RECOMPUTE_BOUNDING_BOX); + dmxConnectionBlockCallback(); + for (i = 0; i < dmxNumInputs; i++) { + DMXInputInfo *dmxInput = &dmxInputs[i]; + dmxInputReInit(dmxInput); + } + + dmxCheckCursor(); + + for (i = 0; i < dmxNumInputs; i++) { + DMXInputInfo *dmxInput = &dmxInputs[i]; + dmxInputLateReInit(dmxInput); + } +} + +/** Add an input with the specified attributes. If the input is added, + * the physical id is returned in \a deviceId. */ +int dmxAddInput(DMXInputAttributesPtr attr, int *id) +{ + int retcode = BadValue; + + if (attr->inputType == 1) /* console */ + retcode = dmxInputAttachConsole(attr->name, attr->sendsCore, id); + else if (attr->inputType == 2) /* backend */ + retcode = dmxInputAttachBackend(attr->physicalScreen, + attr->sendsCore,id); + + if (retcode == Success) { + /* Adjust the cursor boundaries */ + dmxAdjustCursorBoundaries(); + + /* Force completion of the changes */ + dmxSync(NULL, TRUE); + } + + return retcode; +} + +/** Remove the input with physical id \a id. */ +int dmxRemoveInput(int id) +{ + return dmxInputDetachId(id); +} + +/** Return the value of #dmxNumScreens -- the total number of backend + * screens in use (these are logical screens and may be larger than the + * number of backend displays). */ +unsigned long dmxGetNumScreens(void) +{ + return dmxNumScreens; +} + +/** Make sure that #dmxCreateAndRealizeWindow has been called for \a + * pWindow. */ +void dmxForceWindowCreation(WindowPtr pWindow) +{ + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + if (!pWinPriv->window) dmxCreateAndRealizeWindow(pWindow, TRUE); +} + +/** Flush pending syncs for all screens. */ +void dmxFlushPendingSyncs(void) +{ + dmxSync(NULL, TRUE); +} + +/** Update DMX's screen resources to match those of the newly moved + * and/or resized "root" window. */ +void dmxUpdateScreenResources(ScreenPtr pScreen, int x, int y, int w, int h) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + WindowPtr pRoot = WindowTable[pScreen->myNum]; + WindowPtr pChild; + Bool anyMarked = FALSE; + + /* Handle special case where width and/or height are zero */ + if (w == 0 || h == 0) { + w = 1; + h = 1; + } + + /* Change screen size */ + pScreen->width = w; + pScreen->height = h; + + /* Reset the root window's drawable's size */ + pRoot->drawable.width = w; + pRoot->drawable.height = h; + + /* Set the root window's new winSize and borderSize */ + pRoot->winSize.extents.x1 = 0; + pRoot->winSize.extents.y1 = 0; + pRoot->winSize.extents.x2 = w; + pRoot->winSize.extents.y2 = h; + + pRoot->borderSize.extents.x1 = 0; + pRoot->borderSize.extents.y1 = 0; + pRoot->borderSize.extents.x2 = w; + pRoot->borderSize.extents.y2 = h; + + /* Recompute this screen's mmWidth & mmHeight */ + pScreen->mmWidth = + (w * 254 + dmxScreen->beXDPI * 5) / (dmxScreen->beXDPI * 10); + pScreen->mmHeight = + (h * 254 + dmxScreen->beYDPI * 5) / (dmxScreen->beYDPI * 10); + + /* Recompute this screen's window's clip rects as follows: */ + /* 1. Mark all of root's children's windows */ + for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib) + anyMarked |= pScreen->MarkOverlappedWindows(pChild, pChild, + (WindowPtr *)NULL); + + /* 2. Set the root window's borderClip */ + pRoot->borderClip.extents.x1 = 0; + pRoot->borderClip.extents.y1 = 0; + pRoot->borderClip.extents.x2 = w; + pRoot->borderClip.extents.y2 = h; + + /* 3. Set the root window's clipList */ + if (anyMarked) { + /* If any windows have been marked, set the root window's + * clipList to be broken since it will be recalculated in + * ValidateTree() + */ + REGION_BREAK(pScreen, &pRoot->clipList); + } else { + /* Otherwise, we just set it directly since there are no + * windows visible on this screen + */ + pRoot->clipList.extents.x1 = 0; + pRoot->clipList.extents.y1 = 0; + pRoot->clipList.extents.x2 = w; + pRoot->clipList.extents.y2 = h; + } + + /* 4. Revalidate all clip rects and generate expose events */ + if (anyMarked) { + pScreen->ValidateTree(pRoot, NULL, VTBroken); + pScreen->HandleExposures(pRoot); + if (pScreen->PostValidateTree) + pScreen->PostValidateTree(pRoot, NULL, VTBroken); + } +} + +#ifdef PANORAMIX +#include "panoramiXsrv.h" + +/* Defined in dix/events.c */ +extern void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff); + +/** Change the "screen" window attributes by resizing the actual window + * on the back-end display (if necessary). */ +static void dmxConfigureScreenWindow(int idx, + int x, int y, int w, int h) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + ScreenPtr pScreen = screenInfo.screens[idx]; + + /* Resize "screen" window */ + if (dmxScreen->scrnX != x || + dmxScreen->scrnY != y || + dmxScreen->scrnWidth != w || + dmxScreen->scrnHeight != h) { + dmxResizeScreenWindow(pScreen, x, y, w, h); + } + + /* Change "screen" window values */ + dmxScreen->scrnX = x; + dmxScreen->scrnY = y; + dmxScreen->scrnWidth = w; + dmxScreen->scrnHeight = h; +} + +/** Change the "root" window position and size by resizing the actual + * window on the back-end display (if necessary) and updating all of + * DMX's resources by calling #dmxUpdateScreenResources. */ +static void dmxConfigureRootWindow(int idx, int x, int y, int w, int h) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + WindowPtr pRoot = WindowTable[idx]; + + /* NOTE: Either this function or the ones that it calls must handle + * the case where w == 0 || h == 0. Currently, the functions that + * this one calls handle that case. */ + + /* 1. Resize "root" window */ + if (dmxScreen->rootX != x || + dmxScreen->rootY != y || + dmxScreen->rootWidth != w || + dmxScreen->rootHeight != h) { + dmxResizeRootWindow(pRoot, x, y, w, h); + } + + /* 2. Update all of the screen's resources associated with this root + * window */ + if (dmxScreen->rootWidth != w || + dmxScreen->rootHeight != h) { + dmxUpdateScreenResources(screenInfo.screens[idx], x, y, w, h); + } + + /* Change "root" window values */ + dmxScreen->rootX = x; + dmxScreen->rootY = y; + dmxScreen->rootWidth = w; + dmxScreen->rootHeight = h; +} + +/** Change the "root" window's origin by updating DMX's internal data + * structures (dix and Xinerama) to use the new origin and adjust the + * positions of windows that overlap this "root" window. */ +static void dmxSetRootWindowOrigin(int idx, int x, int y) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + ScreenPtr pScreen = screenInfo.screens[idx]; + WindowPtr pRoot = WindowTable[idx]; + WindowPtr pChild; + int xoff; + int yoff; + + /* Change "root" window's origin */ + dmxScreen->rootXOrigin = x; + dmxScreen->rootYOrigin = y; + + /* Compute offsets here in case has been changed above */ + xoff = x - dixScreenOrigins[idx].x; + yoff = y - dixScreenOrigins[idx].y; + + /* Adjust the root window's position in dixScreenOrigins */ + dixScreenOrigins[idx].x = dmxScreen->rootXOrigin; + dixScreenOrigins[idx].y = dmxScreen->rootYOrigin; + + /* Recalculate the Xinerama regions and data structs */ + XineramaReinitData(pScreen); + + /* Adjust each of the root window's children */ + if (!idx) ReinitializeRootWindow(WindowTable[0], xoff, yoff); + pChild = pRoot->firstChild; + while (pChild) { + /* Adjust child window's position */ + pScreen->MoveWindow(pChild, + pChild->origin.x - wBorderWidth(pChild) - xoff, + pChild->origin.y - wBorderWidth(pChild) - yoff, + pChild->nextSib, + VTMove); + + /* Note that the call to MoveWindow will eventually call + * dmxPositionWindow which will automatically create a + * window if it is now exposed on screen (for lazy window + * creation optimization) and it will properly set the + * offscreen flag. + */ + + pChild = pChild->nextSib; + } +} + +/** Configure the attributes of each "screen" and "root" window. */ +int dmxConfigureScreenWindows(int nscreens, + CARD32 *screens, + DMXScreenAttributesPtr attribs, + int *errorScreen) +{ + int i; + + for (i = 0; i < nscreens; i++) { + DMXScreenAttributesPtr attr = &attribs[i]; + int idx = screens[i]; + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + + if (errorScreen) *errorScreen = i; + + if (!dmxScreen->beDisplay) return DMX_BAD_VALUE; + + /* Check for illegal values */ + if (idx < 0 || idx >= dmxNumScreens) return BadValue; + + /* The "screen" and "root" windows must have valid sizes */ + if (attr->screenWindowWidth <= 0 || attr->screenWindowHeight <= 0 || + attr->rootWindowWidth <= 0 || attr->rootWindowHeight <= 0) + return DMX_BAD_VALUE; + + /* The "screen" window must fit entirely within the BE display */ + if (attr->screenWindowXoffset < 0 || + attr->screenWindowYoffset < 0 || + attr->screenWindowXoffset + + attr->screenWindowWidth > (unsigned)dmxScreen->beWidth || + attr->screenWindowYoffset + + attr->screenWindowHeight > (unsigned)dmxScreen->beHeight) + return DMX_BAD_VALUE; + + /* The "root" window must fit entirely within the "screen" window */ + if (attr->rootWindowXoffset < 0 || + attr->rootWindowYoffset < 0 || + attr->rootWindowXoffset + + attr->rootWindowWidth > attr->screenWindowWidth || + attr->rootWindowYoffset + + attr->rootWindowHeight > attr->screenWindowHeight) + return DMX_BAD_VALUE; + + /* The "root" window must not expose unaddressable coordinates */ + if (attr->rootWindowXorigin < 0 || + attr->rootWindowYorigin < 0 || + attr->rootWindowXorigin + attr->rootWindowWidth > 32767 || + attr->rootWindowYorigin + attr->rootWindowHeight > 32767) + return DMX_BAD_VALUE; + + /* The "root" window must fit within the global bounding box */ + if (attr->rootWindowXorigin + + attr->rootWindowWidth > (unsigned)dmxGlobalWidth || + attr->rootWindowYorigin + + attr->rootWindowHeight > (unsigned)dmxGlobalHeight) + return DMX_BAD_VALUE; + + /* FIXME: Handle the rest of the illegal value checking */ + } + + /* No illegal values found */ + if (errorScreen) *errorScreen = 0; + + for (i = 0; i < nscreens; i++) { + DMXScreenAttributesPtr attr = &attribs[i]; + int idx = screens[i]; + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + + dmxLog(dmxInfo, "Changing screen #%d attributes " + "from %dx%d+%d+%d %dx%d+%d+%d +%d+%d " + "to %dx%d+%d+%d %dx%d+%d+%d +%d+%d\n", + idx, + dmxScreen->scrnWidth, dmxScreen->scrnHeight, + dmxScreen->scrnX, dmxScreen->scrnY, + dmxScreen->rootWidth, dmxScreen->rootHeight, + dmxScreen->rootX, dmxScreen->rootY, + dmxScreen->rootXOrigin, dmxScreen->rootYOrigin, + attr->screenWindowWidth, attr->screenWindowHeight, + attr->screenWindowXoffset, attr->screenWindowYoffset, + attr->rootWindowWidth, attr->rootWindowHeight, + attr->rootWindowXoffset, attr->rootWindowYoffset, + attr->rootWindowXorigin, attr->rootWindowYorigin); + + /* Configure "screen" window */ + dmxConfigureScreenWindow(idx, + attr->screenWindowXoffset, + attr->screenWindowYoffset, + attr->screenWindowWidth, + attr->screenWindowHeight); + + /* Configure "root" window */ + dmxConfigureRootWindow(idx, + attr->rootWindowXoffset, + attr->rootWindowYoffset, + attr->rootWindowWidth, + attr->rootWindowHeight); + + + /* Set "root" window's origin */ + dmxSetRootWindowOrigin(idx, + attr->rootWindowXorigin, + attr->rootWindowYorigin); + } + + /* Adjust the cursor boundaries */ + dmxAdjustCursorBoundaries(); + + /* Force completion of the changes */ + dmxSync(NULL, TRUE); + + return Success; +} + +/** Configure the attributes of the global desktop. */ +int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs) +{ + if (attribs->width <= 0 || attribs->width >= 32767 || + attribs->height <= 0 || attribs->height >= 32767) + return DMX_BAD_VALUE; + + /* If the desktop is shrinking, adjust the "root" windows on each + * "screen" window to only show the visible desktop. Also, handle + * the special case where the desktop shrinks such that the it no + * longer overlaps an portion of a "screen" window. */ + if (attribs->width < dmxGlobalWidth || attribs->height < dmxGlobalHeight) { + int i; + for (i = 0; i < dmxNumScreens; i++) { + DMXScreenInfo *dmxScreen = &dmxScreens[i]; + if (dmxScreen->rootXOrigin + + dmxScreen->rootWidth > attribs->width || + dmxScreen->rootYOrigin + + dmxScreen->rootHeight > attribs->height) { + int w, h; + if ((w = attribs->width - dmxScreen->rootXOrigin) < 0) w = 0; + if ((h = attribs->height - dmxScreen->rootYOrigin) < 0) h = 0; + if (w > dmxScreen->scrnWidth) w = dmxScreen->scrnWidth; + if (h > dmxScreen->scrnHeight) h = dmxScreen->scrnHeight; + if (w > dmxScreen->rootWidth) w = dmxScreen->rootWidth; + if (h > dmxScreen->rootHeight) h = dmxScreen->rootHeight; + dmxConfigureRootWindow(i, + dmxScreen->rootX, + dmxScreen->rootY, + w, h); + } + } + } + + /* Set the global width/height */ + dmxSetWidthHeight(attribs->width, attribs->height); + + /* Handle shift[XY] changes */ + if (attribs->shiftX || attribs->shiftY) { + int i; + for (i = 0; i < dmxNumScreens; i++) { + ScreenPtr pScreen = screenInfo.screens[i]; + WindowPtr pChild = WindowTable[i]->firstChild; + while (pChild) { + /* Adjust child window's position */ + pScreen->MoveWindow(pChild, + pChild->origin.x - wBorderWidth(pChild) + - attribs->shiftX, + pChild->origin.y - wBorderWidth(pChild) + - attribs->shiftY, + pChild->nextSib, + VTMove); + + /* Note that the call to MoveWindow will eventually call + * dmxPositionWindow which will automatically create a + * window if it is now exposed on screen (for lazy + * window creation optimization) and it will properly + * set the offscreen flag. + */ + + pChild = pChild->nextSib; + } + } + } + + /* Update connection block, Xinerama, etc. -- these appears to + * already be handled in dmxConnectionBlockCallback(), which is + * called from dmxAdjustCursorBoundaries() [below]. */ + + /* Adjust the cursor boundaries */ + dmxAdjustCursorBoundaries(); + + /* Force completion of the changes */ + dmxSync(NULL, TRUE); + + return Success; +} +#endif + +/** Create the scratch GCs per depth. */ +static void dmxBECreateScratchGCs(int scrnNum) +{ + ScreenPtr pScreen = screenInfo.screens[scrnNum]; + GCPtr *ppGC = pScreen->GCperDepth; + int i; + + for (i = 0; i <= pScreen->numDepths; i++) + dmxBECreateGC(pScreen, ppGC[i]); +} + +#ifdef PANORAMIX +static Bool FoundPixImage; + +/** Search the Xinerama XRT_PIXMAP resources for the pixmap that needs + * to have its image restored. When it is found, see if there is + * another screen with the same image. If so, copy the pixmap image + * from the existing screen to the newly created pixmap. */ +static void dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type, + pointer p) +{ + if ((type & TypeMask) == (XRT_PIXMAP & TypeMask)) { + PixmapPtr pDst = (PixmapPtr)p; + int idx = pDst->drawable.pScreen->myNum; + PanoramiXRes *pXinPix = (PanoramiXRes *)value; + PixmapPtr pPix; + int i; + + pPix = (PixmapPtr)LookupIDByType(pXinPix->info[idx].id, RT_PIXMAP); + if (pPix != pDst) return; /* Not a match.... Next! */ + + for (i = 0; i < PanoramiXNumScreens; i++) { + PixmapPtr pSrc; + dmxPixPrivPtr pSrcPriv = NULL; + + if (i == idx) continue; /* Self replication is bad */ + + pSrc = + (PixmapPtr)LookupIDByType(pXinPix->info[i].id, RT_PIXMAP); + pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc); + if (pSrcPriv->pixmap) { + DMXScreenInfo *dmxSrcScreen = &dmxScreens[i]; + DMXScreenInfo *dmxDstScreen = &dmxScreens[idx]; + dmxPixPrivPtr pDstPriv = DMX_GET_PIXMAP_PRIV(pDst); + XImage *img; + int j; + XlibGC gc = NULL; + + /* This should never happen, but just in case.... */ + if (pSrc->drawable.width != pDst->drawable.width || + pSrc->drawable.height != pDst->drawable.height) + return; + + /* Copy from src pixmap to dst pixmap */ + img = XGetImage(dmxSrcScreen->beDisplay, + pSrcPriv->pixmap, + 0, 0, + pSrc->drawable.width, pSrc->drawable.height, + -1, + ZPixmap); + + for (j = 0; j < dmxDstScreen->beNumPixmapFormats; j++) { + if (dmxDstScreen->bePixmapFormats[j].depth == img->depth) { + unsigned long m; + XGCValues v; + + m = GCFunction | GCPlaneMask | GCClipMask; + v.function = GXcopy; + v.plane_mask = AllPlanes; + v.clip_mask = None; + + gc = XCreateGC(dmxDstScreen->beDisplay, + dmxDstScreen->scrnDefDrawables[j], + m, &v); + break; + } + } + + if (gc) { + XPutImage(dmxDstScreen->beDisplay, + pDstPriv->pixmap, + gc, img, 0, 0, 0, 0, + pDst->drawable.width, pDst->drawable.height); + XFreeGC(dmxDstScreen->beDisplay, gc); + FoundPixImage = True; + } else { + dmxLog(dmxWarning, "Could not create GC\n"); + } + + XDestroyImage(img); + return; + } + } + } +} +#endif + +/** Restore the pixmap image either from another screen or from an image + * that was saved when the screen was previously detached. */ +static void dmxBERestorePixmap(PixmapPtr pPixmap) +{ +#ifdef PANORAMIX + int i; + + /* If Xinerama is not active, there's nothing we can do (see comment + * in #else below for more info). */ + if (noPanoramiXExtension) { + dmxLog(dmxWarning, "Cannot restore pixmap image\n"); + return; + } + + FoundPixImage = False; + for (i = currentMaxClients; --i >= 0; ) + if (clients[i]) + FindAllClientResources(clients[i], dmxBERestorePixmapImage, + (pointer)pPixmap); + + /* No corresponding pixmap image was found on other screens, so we + * need to copy it from the saved image when the screen was detached + * (if available). */ + if (!FoundPixImage) { + dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap); + + if (pPixPriv->detachedImage) { + ScreenPtr pScreen = pPixmap->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + XlibGC gc = NULL; + + for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) { + if (dmxScreen->bePixmapFormats[i].depth == + pPixPriv->detachedImage->depth) { + unsigned long m; + XGCValues v; + + m = GCFunction | GCPlaneMask | GCClipMask; + v.function = GXcopy; + v.plane_mask = AllPlanes; + v.clip_mask = None; + + gc = XCreateGC(dmxScreen->beDisplay, + dmxScreen->scrnDefDrawables[i], + m, &v); + break; + } + } + + if (gc) { + XPutImage(dmxScreen->beDisplay, + pPixPriv->pixmap, + gc, + pPixPriv->detachedImage, + 0, 0, 0, 0, + pPixmap->drawable.width, pPixmap->drawable.height); + XFreeGC(dmxScreen->beDisplay, gc); + } else { + dmxLog(dmxWarning, "Cannot restore pixmap image\n"); + } + + XDestroyImage(pPixPriv->detachedImage); + pPixPriv->detachedImage = NULL; + } else { + dmxLog(dmxWarning, "Cannot restore pixmap image\n"); + } + } +#else + /* If Xinerama is not enabled, then there is no other copy of the + * pixmap image that we can restore. Saving all pixmap data is not + * a feasible option since there is no mechanism for updating pixmap + * data when a screen is detached, which means that the data that + * was previously saved would most likely be out of date. */ + dmxLog(dmxWarning, "Cannot restore pixmap image\n"); + return; +#endif +} + +/** Create resources on the back-end server. This function is called + * from #dmxAttachScreen() via the dix layer's FindAllResources + * function. It walks all resources, compares them to the screen + * number passed in as \a n and calls the appropriate DMX function to + * create the associated resource on the back-end server. */ +static void dmxBECreateResources(pointer value, XID id, RESTYPE type, + pointer n) +{ + int scrnNum = (long)n; + ScreenPtr pScreen = screenInfo.screens[scrnNum]; + + if ((type & TypeMask) == (RT_WINDOW & TypeMask)) { + /* Window resources are created below in dmxBECreateWindowTree */ + } else if ((type & TypeMask) == (RT_PIXMAP & TypeMask)) { + PixmapPtr pPix = value; + if (pPix->drawable.pScreen->myNum == scrnNum) { + dmxBECreatePixmap(pPix); + dmxBERestorePixmap(pPix); + } + } else if ((type & TypeMask) == (RT_GC & TypeMask)) { + GCPtr pGC = value; + if (pGC->pScreen->myNum == scrnNum) { + /* Create the GC on the back-end server */ + dmxBECreateGC(pScreen, pGC); + /* Create any pixmaps associated with this GC */ + if (!pGC->tileIsPixel) { + dmxBECreatePixmap(pGC->tile.pixmap); + dmxBERestorePixmap(pGC->tile.pixmap); + } + if (pGC->stipple != pScreen->PixmapPerDepth[0]) { + dmxBECreatePixmap(pGC->stipple); + dmxBERestorePixmap(pGC->stipple); + } + if (pGC->font != defaultFont) { + (void)dmxBELoadFont(pScreen, pGC->font); + } + /* Update the GC on the back-end server */ + dmxChangeGC(pGC, -1L); + } + } else if ((type & TypeMask) == (RT_FONT & TypeMask)) { + (void)dmxBELoadFont(pScreen, (FontPtr)value); + } else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) { + dmxBECreateCursor(pScreen, (CursorPtr)value); + } else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) { + ColormapPtr pCmap = value; + if (pCmap->pScreen->myNum == scrnNum) + (void)dmxBECreateColormap((ColormapPtr)value); +#if 0 +#ifdef RENDER + /* TODO: Recreate Picture and GlyphSet resources */ + } else if ((type & TypeMask) == (PictureType & TypeMask)) { + /* Picture resources are created when windows are created */ + } else if ((type & TypeMask) == (GlyphSetType & TypeMask)) { + dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value); +#endif +#endif + } else { + /* Other resource types??? */ + } +} + +/** Create window hierachy on back-end server. The window tree is + * created in a special order (bottom most subwindow first) so that the + * #dmxCreateNonRootWindow() function does not need to recursively call + * itself to create each window's parents. This is required so that we + * have the opportunity to create each window's border and background + * pixmaps (where appropriate) before the window is created. */ +static void dmxBECreateWindowTree(int idx) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + WindowPtr pRoot = WindowTable[idx]; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pRoot); + WindowPtr pWin; + + /* Create the pixmaps associated with the root window */ + if (!pRoot->borderIsPixel) { + dmxBECreatePixmap(pRoot->border.pixmap); + dmxBERestorePixmap(pRoot->border.pixmap); + } + if (pRoot->backgroundState == BackgroundPixmap) { + dmxBECreatePixmap(pRoot->background.pixmap); + dmxBERestorePixmap(pRoot->background.pixmap); + } + + /* Create root window first */ + dmxScreen->rootWin = pWinPriv->window = dmxCreateRootWindow(pRoot); + XMapWindow(dmxScreen->beDisplay, dmxScreen->rootWin); + + pWin = pRoot->lastChild; + while (pWin) { + pWinPriv = DMX_GET_WINDOW_PRIV(pWin); + + /* Create the pixmaps regardless of whether or not the + * window is created or not due to lazy window creation. + */ + if (!pWin->borderIsPixel) { + dmxBECreatePixmap(pWin->border.pixmap); + dmxBERestorePixmap(pWin->border.pixmap); + } + if (pWin->backgroundState == BackgroundPixmap) { + dmxBECreatePixmap(pWin->background.pixmap); + dmxBERestorePixmap(pWin->background.pixmap); + } + + /* Reset the window attributes */ + dmxGetDefaultWindowAttributes(pWin, + &pWinPriv->cmap, + &pWinPriv->visual); + + /* Create the window */ + if (pWinPriv->mapped && !pWinPriv->offscreen) + dmxCreateAndRealizeWindow(pWin, TRUE); + + /* Next, create the bottom-most child */ + if (pWin->lastChild) { + pWin = pWin->lastChild; + continue; + } + + /* If the window has no children, move on to the next higher window */ + while (!pWin->prevSib && (pWin != pRoot)) + pWin = pWin->parent; + + if (pWin->prevSib) { + pWin = pWin->prevSib; + continue; + } + + /* When we reach the root window, we are finished */ + if (pWin == pRoot) + break; + } +} + +/* Refresh screen by generating exposure events for all windows */ +static void dmxForceExposures(int idx) +{ + ScreenPtr pScreen = screenInfo.screens[idx]; + WindowPtr pRoot = WindowTable[idx]; + Bool anyMarked = FALSE; + WindowPtr pChild; + + for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib) + anyMarked |= pScreen->MarkOverlappedWindows(pChild, pChild, + (WindowPtr *)NULL); + if (anyMarked) { + /* If any windows have been marked, set the root window's + * clipList to be broken since it will be recalculated in + * ValidateTree() + */ + REGION_BREAK(pScreen, &pRoot->clipList); + pScreen->ValidateTree(pRoot, NULL, VTBroken); + pScreen->HandleExposures(pRoot); + if (pScreen->PostValidateTree) + pScreen->PostValidateTree(pRoot, NULL, VTBroken); + } +} + +/** Compare the new and old screens to see if they are compatible. */ +static Bool dmxCompareScreens(DMXScreenInfo *new, DMXScreenInfo *old) +{ + int i; + + if (new->beWidth != old->beWidth) return FALSE; + if (new->beHeight != old->beHeight) return FALSE; + if (new->beDepth != old->beDepth) return FALSE; + if (new->beBPP != old->beBPP) return FALSE; + + if (new->beNumDepths != old->beNumDepths) return FALSE; + for (i = 0; i < old->beNumDepths; i++) + if (new->beDepths[i] != old->beDepths[i]) return FALSE; + + if (new->beNumPixmapFormats != old->beNumPixmapFormats) return FALSE; + for (i = 0; i < old->beNumPixmapFormats; i++) { + if (new->bePixmapFormats[i].depth != + old->bePixmapFormats[i].depth) return FALSE; + if (new->bePixmapFormats[i].bits_per_pixel != + old->bePixmapFormats[i].bits_per_pixel) return FALSE; + if (new->bePixmapFormats[i].scanline_pad != + old->bePixmapFormats[i].scanline_pad) return FALSE; + } + + if (new->beNumVisuals != old->beNumVisuals) return FALSE; + for (i = 0; i < old->beNumVisuals; i++) { + if (new->beVisuals[i].visualid != + old->beVisuals[i].visualid) return FALSE; + if (new->beVisuals[i].screen != + old->beVisuals[i].screen) return FALSE; + if (new->beVisuals[i].depth != + old->beVisuals[i].depth) return FALSE; + if (new->beVisuals[i].class != + old->beVisuals[i].class) return FALSE; + if (new->beVisuals[i].red_mask != + old->beVisuals[i].red_mask) return FALSE; + if (new->beVisuals[i].green_mask != + old->beVisuals[i].green_mask) return FALSE; + if (new->beVisuals[i].blue_mask != + old->beVisuals[i].blue_mask) return FALSE; + if (new->beVisuals[i].colormap_size != + old->beVisuals[i].colormap_size) return FALSE; + if (new->beVisuals[i].bits_per_rgb != + old->beVisuals[i].bits_per_rgb) return FALSE; + } + + if (new->beDefVisualIndex != old->beDefVisualIndex) return FALSE; + + return TRUE; +} + +/** Reattach previously detached back-end screen. */ +int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr) +{ + ScreenPtr pScreen = screenInfo.screens[idx]; + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; +#ifdef PANORAMIX + CARD32 scrnNum = idx; +#endif + DMXScreenInfo oldDMXScreen; + int i; + + /* Return failure if dynamic addition/removal of screens is disabled */ + if (!dmxAddRemoveScreens) { + dmxLog(dmxWarning, + "Attempting to add a screen, but the AddRemoveScreen\n"); + dmxLog(dmxWarning, + "extension has not been enabled. To enable this extension\n"); + dmxLog(dmxWarning, + "add the \"-addremovescreens\" option either to the command\n"); + dmxLog(dmxWarning, + "line or in the configuration file.\n"); + return 1; + } + + /* Cannot add a screen that does not exist */ + if (idx < 0 || idx >= dmxNumScreens) return 1; + + /* Cannot attach to a screen that is already opened */ + if (dmxScreen->beDisplay) { + dmxLog(dmxWarning, + "Attempting to add screen #%d but a screen already exists\n", + idx); + return 1; + } + + dmxLogOutput(dmxScreen, "Attaching screen #%d\n", idx); + + /* Save old info */ + oldDMXScreen = *dmxScreen; + + /* Copy the name to the new screen */ + dmxScreen->name = strdup(attr->displayName); + + /* Open display and get all of the screen info */ + if (!dmxOpenDisplay(dmxScreen)) { + dmxLog(dmxWarning, + "dmxOpenDisplay: Unable to open display %s\n", + dmxScreen->name); + + /* Restore the old screen */ + *dmxScreen = oldDMXScreen; + return 1; + } + + dmxSetErrorHandler(dmxScreen); + dmxCheckForWM(dmxScreen); + dmxGetScreenAttribs(dmxScreen); + + if (!dmxGetVisualInfo(dmxScreen)) { + dmxLog(dmxWarning, "dmxGetVisualInfo: No matching visuals found\n"); + XFree(dmxScreen->beVisuals); + XCloseDisplay(dmxScreen->beDisplay); + + /* Restore the old screen */ + *dmxScreen = oldDMXScreen; + return 1; + } + + dmxGetColormaps(dmxScreen); + dmxGetPixmapFormats(dmxScreen); + + /* Verify that the screen to be added has the same info as the + * previously added screen. */ + if (!dmxCompareScreens(dmxScreen, &oldDMXScreen)) { + dmxLog(dmxWarning, + "New screen data (%s) does not match previously\n", + dmxScreen->name); + dmxLog(dmxWarning, + "attached screen data (%s)\n", + oldDMXScreen.name); + dmxLog(dmxWarning, + "All data must match in order to attach to screen #%d\n", + idx); + XFree(dmxScreen->beVisuals); + XFree(dmxScreen->beDepths); + XFree(dmxScreen->bePixmapFormats); + XCloseDisplay(dmxScreen->beDisplay); + + /* Restore the old screen */ + *dmxScreen = oldDMXScreen; + return 1; + } + + /* Initialize the BE screen resources */ + dmxBEScreenInit(idx, screenInfo.screens[idx]); + + /* TODO: Handle GLX visual initialization. GLXProxy needs to be + * updated to handle dynamic addition/removal of screens. */ + + /* Create default stipple */ + dmxBECreatePixmap(pScreen->PixmapPerDepth[0]); + dmxBERestorePixmap(pScreen->PixmapPerDepth[0]); + + /* Create the scratch GCs */ + dmxBECreateScratchGCs(idx); + + /* Create the default font */ + (void)dmxBELoadFont(pScreen, defaultFont); + + /* Create all resources that don't depend on windows */ + for (i = currentMaxClients; --i >= 0; ) + if (clients[i]) + FindAllClientResources(clients[i], dmxBECreateResources, + (pointer)(long)idx); + + /* Create window hierarchy (top down) */ + dmxBECreateWindowTree(idx); + + /* Refresh screen by generating exposure events for all windows */ + dmxForceExposures(idx); + + dmxSync(&dmxScreens[idx], TRUE); + + /* We used these to compare the old and new screens. They are no + * longer needed since we have a newly attached screen, so we can + * now free the old screen's resources. */ + XFree(oldDMXScreen.beVisuals); + XFree(oldDMXScreen.beDepths); + XFree(oldDMXScreen.bePixmapFormats); + /* TODO: should oldDMXScreen.name be freed?? */ + +#ifdef PANORAMIX + if (!noPanoramiXExtension) + return dmxConfigureScreenWindows(1, &scrnNum, attr, NULL); + else +#endif + return 0; /* Success */ +} + +/* + * Resources that may have state on the BE server and need to be freed: + * + * RT_NONE + * RT_WINDOW + * RT_PIXMAP + * RT_GC + * RT_FONT + * RT_CURSOR + * RT_COLORMAP + * RT_CMAPENTRY + * RT_OTHERCLIENT + * RT_PASSIVEGRAB + * XRT_WINDOW + * XRT_PIXMAP + * XRT_GC + * XRT_COLORMAP + * XRT_PICTURE + * PictureType + * PictFormatType + * GlyphSetType + * ClientType + * EventType + * RT_INPUTCLIENT + * XETrapType + * RTCounter + * RTAwait + * RTAlarmClient + * RT_XKBCLIENT + * RTContext + * TagResType + * StalledResType + * RT_APPGROUP + * SecurityAuthorizationResType + * RTEventClient + * __glXContextRes + * __glXClientRes + * __glXPixmapRes + * __glXWindowRes + * __glXPbufferRes + */ + +#ifdef PANORAMIX +/** Search the Xinerama XRT_PIXMAP resources for the pixmap that needs + * to have its image saved. */ +static void dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type, + pointer p) +{ + if ((type & TypeMask) == (XRT_PIXMAP & TypeMask)) { + PixmapPtr pDst = (PixmapPtr)p; + int idx = pDst->drawable.pScreen->myNum; + PanoramiXRes *pXinPix = (PanoramiXRes *)value; + PixmapPtr pPix; + int i; + + pPix = (PixmapPtr)LookupIDByType(pXinPix->info[idx].id, RT_PIXMAP); + if (pPix != pDst) return; /* Not a match.... Next! */ + + for (i = 0; i < PanoramiXNumScreens; i++) { + PixmapPtr pSrc; + dmxPixPrivPtr pSrcPriv = NULL; + + if (i == idx) continue; /* Self replication is bad */ + + pSrc = + (PixmapPtr)LookupIDByType(pXinPix->info[i].id, RT_PIXMAP); + pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc); + if (pSrcPriv->pixmap) { + FoundPixImage = True; + return; + } + } + } +} +#endif + +/** Save the pixmap image only when there is not another screen with + * that pixmap from which the image can be read when the screen is + * reattached. To do this, we first try to find a pixmap on another + * screen corresponding to the one we are trying to save. If we find + * one, then we do not need to save the image data since during + * reattachment, the image data can be read from that other pixmap. + * However, if we do not find one, then we need to save the image data. + * The common case for these are for the default stipple and root + * tile. */ +static void dmxBESavePixmap(PixmapPtr pPixmap) +{ +#ifdef PANORAMIX + int i; + + /* If Xinerama is not active, there's nothing we can do (see comment + * in #else below for more info). */ + if (noPanoramiXExtension) return; + + FoundPixImage = False; + for (i = currentMaxClients; --i >= 0; ) + if (clients[i]) + FindAllClientResources(clients[i], dmxBEFindPixmapImage, + (pointer)pPixmap); + + /* Save the image only if there is no other screens that have a + * pixmap that corresponds to the one we are trying to save. */ + if (!FoundPixImage) { + dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap); + + if (!pPixPriv->detachedImage) { + ScreenPtr pScreen = pPixmap->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + + pPixPriv->detachedImage = XGetImage(dmxScreen->beDisplay, + pPixPriv->pixmap, + 0, 0, + pPixmap->drawable.width, + pPixmap->drawable.height, + -1, + ZPixmap); + if (!pPixPriv->detachedImage) + dmxLog(dmxWarning, "Cannot save pixmap image\n"); + } + } +#else + /* NOTE: The only time there is a pixmap on another screen that + * corresponds to the one we are trying to save is when Xinerama is + * active. Otherwise, the pixmap image data is only stored on a + * single screen, which means that once it is detached, that data is + * lost. We could save the data here, but then that would require + * us to implement the ability for Xdmx to keep the pixmap up to + * date while the screen is detached, which is beyond the scope of + * the current project. */ + return; +#endif +} + +/** Destroy resources on the back-end server. This function is called + * from #dmxDetachScreen() via the dix layer's FindAllResources + * function. It walks all resources, compares them to the screen + * number passed in as \a n and calls the appropriate DMX function to + * free the associated resource on the back-end server. */ +static void dmxBEDestroyResources(pointer value, XID id, RESTYPE type, + pointer n) +{ + int scrnNum = (long)n; + ScreenPtr pScreen = screenInfo.screens[scrnNum]; + + if ((type & TypeMask) == (RT_WINDOW & TypeMask)) { + /* Window resources are destroyed below in dmxBEDestroyWindowTree */ + } else if ((type & TypeMask) == (RT_PIXMAP & TypeMask)) { + PixmapPtr pPix = value; + if (pPix->drawable.pScreen->myNum == scrnNum) { + dmxBESavePixmap(pPix); + dmxBEFreePixmap(pPix); + } + } else if ((type & TypeMask) == (RT_GC & TypeMask)) { + GCPtr pGC = value; + if (pGC->pScreen->myNum == scrnNum) + dmxBEFreeGC(pGC); + } else if ((type & TypeMask) == (RT_FONT & TypeMask)) { + dmxBEFreeFont(pScreen, (FontPtr)value); + } else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) { + dmxBEFreeCursor(pScreen, (CursorPtr)value); + } else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) { + ColormapPtr pCmap = value; + if (pCmap->pScreen->myNum == scrnNum) + dmxBEFreeColormap((ColormapPtr)value); +#ifdef RENDER + } else if ((type & TypeMask) == (PictureType & TypeMask)) { + PicturePtr pPict = value; + if (pPict->pDrawable->pScreen->myNum == scrnNum) + dmxBEFreePicture((PicturePtr)value); + } else if ((type & TypeMask) == (GlyphSetType & TypeMask)) { + dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr)value); +#endif + } else { + /* Other resource types??? */ + } +} + +/** Destroy the scratch GCs that are created per depth. */ +static void dmxBEDestroyScratchGCs(int scrnNum) +{ + ScreenPtr pScreen = screenInfo.screens[scrnNum]; + GCPtr *ppGC = pScreen->GCperDepth; + int i; + + for (i = 0; i <= pScreen->numDepths; i++) + dmxBEFreeGC(ppGC[i]); +} + +/** Destroy window hierachy on back-end server. To ensure that all + * XDestroyWindow() calls succeed, they must be performed in a bottom + * up order so that windows are not destroyed before their children. + * XDestroyWindow(), which is called from #dmxBEDestrowWindow(), will + * destroy a window as well as all of it's children. */ +static void dmxBEDestroyWindowTree(int idx) +{ + WindowPtr pWin = WindowTable[idx]; + WindowPtr pChild = pWin; + + while (1) { + if (pChild->firstChild) { + pChild = pChild->firstChild; + continue; + } + + /* Destroy the window */ + dmxBEDestroyWindow(pChild); + + /* Make sure we destroy the window's border and background + * pixmaps if they exist */ + if (!pChild->borderIsPixel) { + dmxBESavePixmap(pChild->border.pixmap); + dmxBEFreePixmap(pChild->border.pixmap); + } + if (pChild->backgroundState == BackgroundPixmap) { + dmxBESavePixmap(pChild->background.pixmap); + dmxBEFreePixmap(pChild->background.pixmap); + } + + while (!pChild->nextSib && (pChild != pWin)) { + pChild = pChild->parent; + dmxBEDestroyWindow(pChild); + if (!pChild->borderIsPixel) { + dmxBESavePixmap(pChild->border.pixmap); + dmxBEFreePixmap(pChild->border.pixmap); + } + if (pChild->backgroundState == BackgroundPixmap) { + dmxBESavePixmap(pChild->background.pixmap); + dmxBEFreePixmap(pChild->background.pixmap); + } + } + + if (pChild == pWin) + break; + + pChild = pChild->nextSib; + } +} + +/** Detach back-end screen. */ +int dmxDetachScreen(int idx) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + int i; + + /* Return failure if dynamic addition/removal of screens is disabled */ + if (!dmxAddRemoveScreens) { + dmxLog(dmxWarning, + "Attempting to remove a screen, but the AddRemoveScreen\n"); + dmxLog(dmxWarning, + "extension has not been enabled. To enable this extension\n"); + dmxLog(dmxWarning, + "add the \"-addremovescreens\" option either to the command\n"); + dmxLog(dmxWarning, + "line or in the configuration file.\n"); + return 1; + } + + /* Cannot remove a screen that does not exist */ + if (idx < 0 || idx >= dmxNumScreens) return 1; + + /* Cannot detach from a screen that is not opened */ + if (!dmxScreen->beDisplay) { + dmxLog(dmxWarning, + "Attempting to remove screen #%d but it has not been opened\n", + idx); + return 1; + } + + dmxLogOutput(dmxScreen, "Detaching screen #%d\n", idx); + + /* Detach input */ + dmxInputDetachAll(dmxScreen); + + /* Save all relevant state (TODO) */ + + /* Free all non-window resources related to this screen */ + for (i = currentMaxClients; --i >= 0; ) + if (clients[i]) + FindAllClientResources(clients[i], dmxBEDestroyResources, + (pointer)(long)idx); + + /* Free scratch GCs */ + dmxBEDestroyScratchGCs(idx); + + /* Free window resources related to this screen */ + dmxBEDestroyWindowTree(idx); + + /* Free default stipple */ + dmxBESavePixmap(screenInfo.screens[idx]->PixmapPerDepth[0]); + dmxBEFreePixmap(screenInfo.screens[idx]->PixmapPerDepth[0]); + + /* Free the remaining screen resources and close the screen */ + dmxBECloseScreen(screenInfo.screens[idx]); + + return 0; /* Success */ +} Index: xc/programs/Xserver/hw/dmx/dmxextension.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxextension.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxextension.h Wed Jun 30 16:21:38 2004 @@ -0,0 +1,119 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxextension.h,v 1.1 2004/06/30 20:21:38 martin Exp $ */ +/* + * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Author: + * Rickard E. (Rik) Faith + * Kevin E. Martin + * + */ + +/** \file + * Interface for DMX extension support. These routines are called by + * function in Xserver/Xext/dmx.c. \see dmxextension.c */ + +#ifndef _DMXEXTENSION_H_ +#define _DMXEXTENSION_H_ + +/** Screen attributes. Used by #ProcDMXGetScreenAttributes and + * #ProcDMXChangeScreenAttributes. */ +typedef struct { + const char *displayName; + int logicalScreen; + + unsigned int screenWindowWidth; /* displayName's coordinate system */ + unsigned int screenWindowHeight; /* displayName's coordinate system */ + int screenWindowXoffset; /* displayName's coordinate system */ + int screenWindowYoffset; /* displayName's coordinate system */ + + unsigned int rootWindowWidth; /* screenWindow's coordinate system */ + unsigned int rootWindowHeight; /* screenWindow's coordinate system */ + int rootWindowXoffset; /* screenWindow's coordinate system */ + int rootWindowYoffset; /* screenWindow's coordinate system */ + + int rootWindowXorigin; /* global coordinate system */ + int rootWindowYorigin; /* global coordinate system */ +} DMXScreenAttributesRec, *DMXScreenAttributesPtr; + +/** Window attributes. Used by #ProcDMXGetWidowAttributes. */ +typedef struct { + int screen; + Window window; + xRectangle pos; + xRectangle vis; +} DMXWindowAttributesRec, *DMXWindowAttributesPtr; + +/** Desktop attributes. Used by #ProcDMXGetDesktopAttributes and + * #ProcDMXChangeDesktopAttributes. */ +typedef struct { + int width; + int height; + int shiftX; + int shiftY; +} DMXDesktopAttributesRec, *DMXDesktopAttributesPtr; + +/** Input attributes. Used by #ProcDMXGetInputAttributes. */ +typedef struct { + const char *name; + int inputType; + int physicalScreen; + int physicalId; + int isCore; + int sendsCore; + int detached; +} DMXInputAttributesRec, *DMXInputAttributesPtr; + + +extern unsigned long dmxGetNumScreens(void); +extern void dmxForceWindowCreation(WindowPtr pWindow); +extern void dmxFlushPendingSyncs(void); +extern Bool dmxGetScreenAttributes(int physical, + DMXScreenAttributesPtr attr); +extern Bool dmxGetWindowAttributes(WindowPtr pWindow, + DMXWindowAttributesPtr attr); +extern void dmxGetDesktopAttributes(DMXDesktopAttributesPtr attr); +extern int dmxGetInputCount(void); +extern int dmxGetInputAttributes(int deviceId, + DMXInputAttributesPtr attr); +extern int dmxAddInput(DMXInputAttributesPtr attr, int *deviceId); +extern int dmxRemoveInput(int deviceId); + +extern int dmxConfigureScreenWindows(int nscreens, + CARD32 *screens, + DMXScreenAttributesPtr attribs, + int *errorScreen); + +extern int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs); + +/* dmxUpdateScreenResources exposed for dmxCreateWindow in dmxwindow.c */ +extern void dmxUpdateScreenResources(ScreenPtr pScreen, + int x, int y, int w, int h); + +extern int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr); +extern int dmxDetachScreen(int idx); +#endif Index: xc/programs/Xserver/hw/dmx/dmxfont.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxfont.c:1.2 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxfont.c Sun Jan 30 12:48:43 2005 @@ -0,0 +1,554 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxfont.c,v 1.2 2005/01/30 17:48:43 tsi Exp $ */ +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +/** \file + * This file provides support for fonts. */ + +#define DMX_FONTPATH_DEBUG 0 + +#include "dmx.h" +#include "dmxsync.h" +#include "dmxfont.h" +#include "dmxlog.h" + +#include "fontstruct.h" +#include "dixfont.h" +#include "dixstruct.h" + +static int (*dmxSaveProcVector[256])(ClientPtr); +static int dmxFontLastError; + +static int dmxFontErrorHandler(Display *dpy, XErrorEvent *ev) +{ + dmxFontLastError = ev->error_code; + + return 0; +} + +static char **dmxGetFontPath(int *npaths) +{ + char **fp; + unsigned char *c, *paths; + char *newfp; + int len, l, i; + + paths = GetFontPath(npaths, &len); + + newfp = xalloc(*npaths + len); + c = (unsigned char *)newfp; + fp = xalloc(*npaths * sizeof(*fp)); + + memmove(newfp, paths+1, *npaths + len - 1); + l = *paths; + for (i = 0; i < *npaths; i++) { + fp[i] = (char *)c; + c += l; + l = *c; + *c++ = '\0'; + } + +#if DMX_FONTPATH_DEBUG + for (i = 0; i < *npaths; i++) + dmxLog(dmxDebug, "FontPath[%d] = %s\n", i, fp[i]); +#endif + + return fp; +} + +static void dmxFreeFontPath(char **fp) +{ + xfree(fp[0]); + xfree(fp); +} + +static Bool dmxCheckFontPathElement(DMXScreenInfo *dmxScreen, char *fp) +{ + int (*oldErrorHandler)(Display *, XErrorEvent *); + + if (!dmxScreen->beDisplay) + return TRUE; + + dmxFontLastError = 0; + oldErrorHandler = XSetErrorHandler(dmxFontErrorHandler); + XSetFontPath(dmxScreen->beDisplay, &fp, 1); + dmxSync(dmxScreen, TRUE); /* Must complete before removing handler */ + XSetErrorHandler(oldErrorHandler); + + return (dmxFontLastError == 0); +} + +static int dmxSetFontPath(DMXScreenInfo *dmxScreen) +{ + int (*oldErrorHandler)(Display *, XErrorEvent *); + char **fp; + int result = Success; + int npaths; + + if (!dmxScreen->beDisplay) + return result; + + fp = dmxGetFontPath(&npaths); + if (!fp) return BadAlloc; + + dmxFontLastError = 0; + oldErrorHandler = XSetErrorHandler(dmxFontErrorHandler); + XSetFontPath(dmxScreen->beDisplay, fp, npaths); + dmxSync(dmxScreen, TRUE); /* Must complete before removing handler */ + XSetErrorHandler(oldErrorHandler); + + if (dmxFontLastError) { + result = dmxFontLastError; + /* We could set *error here to the offending path, but it is + * ignored, so we don't bother figuring out which path is bad. + * If we do add this support in the future, we'll need to add + * error to the function's argument list. + */ + } + + dmxFreeFontPath(fp); + + return result; +} + +static int dmxCheckFontPath(DMXScreenInfo *dmxScreen, int *error) +{ + char **oldFontPath; + int nOldPaths; + int result = Success; + + if (!dmxScreen->beDisplay) + return result; + + /* Save old font path */ + oldFontPath = XGetFontPath(dmxScreen->beDisplay, &nOldPaths); + + result = dmxSetFontPath(dmxScreen); + + /* Restore old font path */ + XSetFontPath(dmxScreen->beDisplay, oldFontPath, nOldPaths); + XFreeFontPath(oldFontPath); + dmxSync(dmxScreen, FALSE); + + return result; +} + +static int dmxProcSetFontPath(ClientPtr client) +{ + unsigned char *ptr; + unsigned long nbytes, total, n; + long nfonts; + int i, result; + int error; + unsigned char *oldFontPath, *tmpFontPath; + int nOldPaths; + int lenOldPaths; + REQUEST(xSetFontPathReq); + + REQUEST_AT_LEAST_SIZE(xSetFontPathReq); + + nbytes = (client->req_len << 2) - sizeof(xSetFontPathReq); + total = nbytes; + ptr = (unsigned char *)&stuff[1]; + nfonts = stuff->nFonts; + + while (--nfonts >= 0) { + if ((total == 0) || (total < (n = (*ptr + 1)))) + return BadLength; + total -= n; + ptr += n; + } + if (total >= 4) + return BadLength; + + tmpFontPath = GetFontPath(&nOldPaths, &lenOldPaths); + oldFontPath = xalloc(nOldPaths + lenOldPaths); + memmove(oldFontPath, tmpFontPath, nOldPaths + lenOldPaths); + + result = SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1], + &error); + if (!result) { + for (i = 0; i < dmxNumScreens; i++) + if ((result = dmxCheckFontPath(&dmxScreens[i], &error))) + break; + + if (result) { + int ignoreerror; + + /* Restore old fontpath in the DMX server */ + SetFontPath(client, nOldPaths, oldFontPath, &ignoreerror); + } else { + result = client->noClientException; + client->errorValue = error; + } + } + + xfree(oldFontPath); + return result; +} + +/** Initialize font support. In addition to the screen function call + * pointers, DMX also hooks in at the ProcVector[] level. Here the old + * ProcVector function pointers are saved and the new ProcVector + * function pointers are initialized. */ +void dmxInitFonts(void) +{ + int i; + + for (i = 0; i < 256; i++) + dmxSaveProcVector[i] = ProcVector[i]; + + ProcVector[X_SetFontPath] = dmxProcSetFontPath; +} + +/** Reset font support by restoring the original ProcVector function + * pointers. */ +void dmxResetFonts(void) +{ + int i; + + for (i = 0; i < 256; i++) + ProcVector[i] = dmxSaveProcVector[i]; +} + +/** Load the font, \a pFont, on the back-end server associated with \a + * pScreen. When a font is loaded, the font path on back-end server is + * first initialized to that specified on the command line with the + * -fontpath options, and then the font is loaded. */ +Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxFontPrivPtr pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex); + char *name; + char **oldFontPath = NULL; + int nOldPaths; + Atom name_atom, value_atom; + int i; + + /* Make sure we have a font private struct to work with */ + if (!pFontPriv) + return FALSE; + + /* Don't load a font over top of itself */ + if (pFontPriv->font[pScreen->myNum]) { + return TRUE; /* Already loaded font */ + } + + /* Save old font path */ + oldFontPath = XGetFontPath(dmxScreen->beDisplay, &nOldPaths); + + /* Set the font path for the font about to be loaded on the back-end */ + if (dmxSetFontPath(dmxScreen)) { + char **fp; + int npaths; + Bool *goodfps; + + /* This could fail only when first starting the X server and + * loading the default font. If it fails here, then the default + * font path is invalid, no default font path will be set, the + * DMX server will fail to load the default font, and it will + * exit with an error unless we remove the offending font paths + * with the -ignorebadfontpaths command line option. + */ + + fp = dmxGetFontPath(&npaths); + if (!fp) { + dmxLog(dmxError, + "No default font path set.\n"); + dmxLog(dmxError, + "Please see the Xdmx man page for information on how to\n"); + dmxLog(dmxError, + "initialize the DMX server's default font path.\n"); + XFreeFontPath(oldFontPath); + return FALSE; + } + + if (!dmxFontPath) + dmxLog(dmxWarning, "No default font path is set.\n"); + + goodfps = xalloc(npaths * sizeof(*goodfps)); + + dmxLog(dmxError, + "The DMX server failed to set the following font paths on " + "screen #%d:\n", pScreen->myNum); + + for (i = 0; i < npaths; i++) + if (!(goodfps[i] = dmxCheckFontPathElement(dmxScreen, fp[i]))) + dmxLog(dmxError, " %s\n", fp[i]); + + if (dmxIgnoreBadFontPaths) { + char *newfp; + int newnpaths = 0; + int len = 0; + int j = 0; + int error; + + dmxLog(dmxError, + "These font paths will not be used because the " + "\"-ignorebadfontpaths\"\n"); + dmxLog(dmxError, + "option is set.\n"); + + for (i = 0; i < npaths; i++) + if (goodfps[i]) { + len += strlen(fp[i]) + 1; + newnpaths++; + } + + if (!newnpaths) { + /* No valid font paths were found */ + dmxLog(dmxError, + "After removing the font paths above, no valid font " + "paths were\n"); + dmxLog(dmxError, + "available. Please check that the font paths set on " + "the command\n"); + dmxLog(dmxError, + "line or in the configuration file via the " + "\"-fontpath\" option\n"); + dmxLog(dmxError, + "are valid on all back-end servers. See the Xdmx man " + "page for\n"); + dmxLog(dmxError, + "more information on font paths.\n"); + dmxFreeFontPath(fp); + XFreeFontPath(oldFontPath); + xfree(goodfps); + return FALSE; + } + + newfp = xalloc(len * sizeof(*newfp)); + for (i = 0; i < npaths; i++) { + if (goodfps[i]) { + int n = strlen(fp[i]); + newfp[j++] = n; + strncpy(&newfp[j], fp[i], n); + j += n; + } + } + + if (SetFontPath(NULL, newnpaths, (unsigned char *)newfp, &error)) { + /* Note that this should never happen since all of the + * FPEs were previously valid. */ + dmxLog(dmxError, "Cannot reset the default font path.\n"); + } + } else if (dmxFontPath) { + dmxLog(dmxError, + "Please remove these font paths from the command line " + "or\n"); + dmxLog(dmxError, + "configuration file, or set the \"-ignorebadfontpaths\" " + "option to\n"); + dmxLog(dmxError, + "ignore them. For more information on these options, see " + "the\n"); + dmxLog(dmxError, + "Xdmx man page.\n"); + } else { + dmxLog(dmxError, + "Please specify the font paths that are available on all " + "back-end\n"); + dmxLog(dmxError, + "servers with the \"-fontpath\" option, or use the " + "\"-ignorebadfontpaths\"\n"); + dmxLog(dmxError, + "to ignore bad defaults. For more information on " + "these and other\n"); + dmxLog(dmxError, + "font-path-related options, see the Xdmx man page.\n"); + } + + if (!dmxIgnoreBadFontPaths || + (dmxIgnoreBadFontPaths && dmxSetFontPath(dmxScreen))) { + /* We still have errors so return with error */ + dmxFreeFontPath(fp); + XFreeFontPath(oldFontPath); + xfree(goodfps); + return FALSE; + } + } + + /* Find requested font on back-end server */ + name_atom = MakeAtom("FONT", 4, TRUE); + value_atom = 0L; + + for (i = 0; i < pFont->info.nprops; i++) { + if ((Atom)pFont->info.props[i].name == name_atom) { + value_atom = pFont->info.props[i].value; + break; + } + } + if (!value_atom) return FALSE; + + name = (char *)NameForAtom(value_atom); + if (!name) return FALSE; + + pFontPriv->font[pScreen->myNum] = + XLoadQueryFont(dmxScreen->beDisplay, name); + + /* Restore old font path */ + XSetFontPath(dmxScreen->beDisplay, oldFontPath, nOldPaths); + XFreeFontPath(oldFontPath); + dmxSync(dmxScreen, FALSE); + + if (!pFontPriv->font[pScreen->myNum]) return FALSE; + + return TRUE; +} + +/** Realize the font, \a pFont, on the back-end server associated with + * \a pScreen. */ +Bool dmxRealizeFont(ScreenPtr pScreen, FontPtr pFont) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxFontPrivPtr pFontPriv; + + if (!(pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex))) { + FontSetPrivate(pFont, dmxFontPrivateIndex, NULL); + pFontPriv = xalloc(sizeof(dmxFontPrivRec)); + if (!pFontPriv) return FALSE; + pFontPriv->font = NULL; + MAXSCREENSALLOC(pFontPriv->font); + if (!pFontPriv->font) { + xfree(pFontPriv); + return FALSE; + } + pFontPriv->refcnt = 0; + } + + FontSetPrivate(pFont, dmxFontPrivateIndex, (pointer)pFontPriv); + + if (dmxScreen->beDisplay) { + if (!dmxBELoadFont(pScreen, pFont)) + return FALSE; + + pFontPriv->refcnt++; + } else { + pFontPriv->font[pScreen->myNum] = NULL; + } + + return TRUE; +} + +/** Free \a pFont on the back-end associated with \a pScreen. */ +Bool dmxBEFreeFont(ScreenPtr pScreen, FontPtr pFont) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxFontPrivPtr pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex); + + if (pFontPriv && pFontPriv->font[pScreen->myNum]) { + XFreeFont(dmxScreen->beDisplay, pFontPriv->font[pScreen->myNum]); + pFontPriv->font[pScreen->myNum] = NULL; + return TRUE; + } + + return FALSE; +} + +/** Unrealize the font, \a pFont, on the back-end server associated with + * \a pScreen. */ +Bool dmxUnrealizeFont(ScreenPtr pScreen, FontPtr pFont) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxFontPrivPtr pFontPriv; + + if ((pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex))) { + /* In case the font failed to load properly */ + if (!pFontPriv->refcnt) { + MAXSCREENSFREE(pFontPriv->font); + xfree(pFontPriv); + FontSetPrivate(pFont, dmxFontPrivateIndex, NULL); + } else if (pFontPriv->font[pScreen->myNum]) { + if (dmxScreen->beDisplay) + dmxBEFreeFont(pScreen, pFont); + + /* The code below is non-obvious, so here's an explanation... + * + * When creating the default GC, the server opens up the + * default font once for each screen, which in turn calls + * the RealizeFont function pointer once for each screen. + * During this process both dix's font refcnt and DMX's font + * refcnt are incremented once for each screen. + * + * Later, when shutting down the X server, dix shuts down + * each screen in reverse order. During this shutdown + * procedure, each screen's default GC is freed and then + * that screen is closed by calling the CloseScreen function + * pointer. screenInfo.numScreens is then decremented after + * closing each screen. This procedure means that the dix's + * font refcnt for the font used by the default GC's is + * decremented once for each screen # greater than 0. + * However, since dix's refcnt for the default font is not + * yet 0 for each screen greater than 0, no call to the + * UnrealizeFont function pointer is made for those screens. + * Then, when screen 0 is being closed, dix's font refcnt + * for the default GC's font is finally 0 and the font is + * unrealized. However, since screenInfo.numScreens has + * been decremented already down to 1, only one call to + * UnrealizeFont is made (for screen 0). Thus, even though + * RealizeFont was called once for each screen, + * UnrealizeFont is only called for screen 0. + * + * This is a bug in dix. + * + * To avoid the memory leak of pFontPriv for each server + * generation, we can also free pFontPriv if the refcnt is + * not yet 0 but the # of screens is 1 -- i.e., the case + * described in the dix bug above. This is only a temporary + * workaround until the bug in dix is solved. + * + * The other problem is that the font structure allocated by + * XLoadQueryFont() above is not freed for screens > 0. + * This problem cannot be worked around here since the back- + * end displays for screens > 0 have already been closed by + * the time this code is called from dix. + * + * When the bug in dix described above is fixed, then we can + * remove the "|| screenInfo.numScreens == 1" code below and + * the memory leaks will be eliminated. + */ + if (--pFontPriv->refcnt == 0 +#if 1 + /* Remove this code when the dix bug is fixed */ + || screenInfo.numScreens == 1 +#endif + ) { + MAXSCREENSFREE(pFontPriv->font); + xfree(pFontPriv); + FontSetPrivate(pFont, dmxFontPrivateIndex, NULL); + } + } + } + + return TRUE; +} Index: xc/programs/Xserver/hw/dmx/dmxfont.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxfont.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxfont.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,60 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxfont.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +/** \file + * Interface for font-related functions. \see dmxfont.c */ + +#ifndef DMXFONT_H +#define DMXFONT_H + +#include "fontstruct.h" + +/** Font private area. */ +typedef struct _dmxFontPriv { + int refcnt; + XFontStruct **font; +} dmxFontPrivRec, *dmxFontPrivPtr; + +extern void dmxInitFonts(void); +extern void dmxResetFonts(void); + +extern Bool dmxRealizeFont(ScreenPtr pScreen, FontPtr pFont); +extern Bool dmxUnrealizeFont(ScreenPtr pScreen, FontPtr pFont); + +extern Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont); +extern Bool dmxBEFreeFont(ScreenPtr pScreen, FontPtr pFont); + +extern int dmxFontPrivateIndex; + +#endif /* DMXFONT_H */ Index: xc/programs/Xserver/hw/dmx/dmxgc.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxgc.c:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxgc.c Wed Jun 30 16:21:39 2004 @@ -0,0 +1,420 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxgc.c,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +/** \file + * This file provides support for GCs. */ + +#include "dmx.h" +#include "dmxsync.h" +#include "dmxgc.h" +#include "dmxgcops.h" +#include "dmxpixmap.h" +#include "dmxfont.h" + +#include "gcstruct.h" +#include "pixmapstr.h" +#include "migc.h" + +static GCFuncs dmxGCFuncs = { + dmxValidateGC, + dmxChangeGC, + dmxCopyGC, + dmxDestroyGC, + dmxChangeClip, + dmxDestroyClip, + dmxCopyClip, +}; + +static GCOps dmxGCOps = { + dmxFillSpans, + dmxSetSpans, + dmxPutImage, + dmxCopyArea, + dmxCopyPlane, + dmxPolyPoint, + dmxPolylines, + dmxPolySegment, + dmxPolyRectangle, + dmxPolyArc, + dmxFillPolygon, + dmxPolyFillRect, + dmxPolyFillArc, + dmxPolyText8, + dmxPolyText16, + dmxImageText8, + dmxImageText16, + dmxImageGlyphBlt, + dmxPolyGlyphBlt, + dmxPushPixels +}; + +/** Initialize the GC on \a pScreen, which currently involves allocating + * the GC private associated with this screen. */ +Bool dmxInitGC(ScreenPtr pScreen) +{ + if (!AllocateGCPrivate(pScreen, dmxGCPrivateIndex, sizeof(dmxGCPrivRec))) + return FALSE; + + return TRUE; +} + +/** Create the GC on the back-end server. */ +void dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + int i; + + for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) { + if (pGC->depth == dmxScreen->bePixmapFormats[i].depth) { + unsigned long mask; + XGCValues gcvals; + + mask = GCGraphicsExposures; + gcvals.graphics_exposures = FALSE; + + /* Create GC in the back-end servers */ + pGCPriv->gc = XCreateGC(dmxScreen->beDisplay, + dmxScreen->scrnDefDrawables[i], + mask, &gcvals); + break; + } + } +} + +/** Create a graphics context on the back-end server associated /a pGC's + * screen. */ +Bool dmxCreateGC(GCPtr pGC) +{ + ScreenPtr pScreen = pGC->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + Bool ret; + + DMX_UNWRAP(CreateGC, dmxScreen, pScreen); + if ((ret = pScreen->CreateGC(pGC))) { + /* Save the old funcs */ + pGCPriv->funcs = pGC->funcs; + pGCPriv->ops = NULL; + + pGC->funcs = &dmxGCFuncs; + + if (dmxScreen->beDisplay) { + dmxBECreateGC(pScreen, pGC); + } else { + pGCPriv->gc = NULL; + } + + /* Check for "magic special case" + * 1. see CreateGC in dix/gc.c for more info + * 2. see dmxChangeGC for more info + */ + pGCPriv->msc = (!pGC->tileIsPixel && !pGC->tile.pixmap); + } + DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen); + + return ret; +} + +/** Validate a graphics context, \a pGC, locally in the DMX server and + * recompute the composite clip, if necessary. */ +void dmxValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) +{ + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + + DMX_GC_FUNC_PROLOGUE(pGC); +#if 0 + pGC->funcs->ValidateGC(pGC, changes, pDrawable); +#endif + + if (pDrawable->type == DRAWABLE_WINDOW || + pDrawable->type == DRAWABLE_PIXMAP) { + /* Save the old ops, since we're about to change the ops in the + * epilogue. + */ + pGCPriv->ops = pGC->ops; + } else { + pGCPriv->ops = NULL; + } + + /* If the client clip is different or moved OR the subwindowMode has + * changed OR the window's clip has changed since the last + * validation, then we need to recompute the composite clip. + */ + if ((changes & (GCClipXOrigin | + GCClipYOrigin | + GCClipMask | + GCSubwindowMode)) || + (pDrawable->serialNumber != + (pGC->serialNumber & DRAWABLE_SERIAL_BITS))) { + miComputeCompositeClip(pGC, pDrawable); + } + + DMX_GC_FUNC_EPILOGUE(pGC); +} + +/** Set the values in the graphics context on the back-end server + * associated with \a pGC's screen. */ +void dmxChangeGC(GCPtr pGC, unsigned long mask) +{ + ScreenPtr pScreen = pGC->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + XGCValues v; + + DMX_GC_FUNC_PROLOGUE(pGC); +#if 0 + pGC->funcs->ChangeGC(pGC, mask); +#endif + + /* Handle "magic special case" from CreateGC */ + if (pGCPriv->msc) { + /* The "magic special case" is used to handle the case where a + * foreground pixel is set when the GC is created so that a + * "pseudo default-tile" can be created and used in case the + * fillstyle was set to FillTiled. This specific case is tested + * in xtest (XCreateGC test #3). What has happened in dix by + * the time it reaches here is (1) the pGC->tile.pixel has been + * set to pGC->fgPixel and pGC->tileIsPixel is set, (2) if a + * tile has also been set, then pGC->tileIsPixel is unset and + * pGC->tile.pixmap is initialized; else, the default tile is + * created and pGC->tileIsPixel is unset and pGC->tile.pixmap is + * initialized to the "pseudo default-tile". In either case, + * pGC->tile.pixmap is set; however, in the "magic special case" + * the mask is not updated to allow us to detect that we should + * initialize the GCTile in the back-end server. Thus, we catch + * this case in dmxCreateGC and add GCTile to the mask here. + * Are there any cases that I've missed? + */ + + /* Make sure that the tile.pixmap is set, just in case the user + * set GCTile in the mask but forgot to set vals.pixmap + */ + if (pGC->tile.pixmap) mask |= GCTile; + + /* This only happens once when the GC is created */ + pGCPriv->msc = FALSE; + } + + /* Update back-end server's gc */ + if (mask & GCFunction) v.function = pGC->alu; + if (mask & GCPlaneMask) v.plane_mask = pGC->planemask; + if (mask & GCForeground) v.foreground = pGC->fgPixel; + if (mask & GCBackground) v.background = pGC->bgPixel; + if (mask & GCLineWidth) v.line_width = pGC->lineWidth; + if (mask & GCLineStyle) v.line_style = pGC->lineStyle; + if (mask & GCCapStyle) v.cap_style = pGC->capStyle; + if (mask & GCJoinStyle) v.join_style = pGC->joinStyle; + if (mask & GCFillStyle) v.fill_style = pGC->fillStyle; + if (mask & GCFillRule) v.fill_rule = pGC->fillRule; + if (mask & GCTile) { + if (pGC->tileIsPixel) { + mask &= ~GCTile; + } else { + dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->tile.pixmap); + v.tile = (Drawable)pPixPriv->pixmap; + } + } + if (mask & GCStipple) { + dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->stipple); + v.stipple = (Drawable)pPixPriv->pixmap; + } + if (mask & GCTileStipXOrigin) v.ts_x_origin = pGC->patOrg.x; + if (mask & GCTileStipYOrigin) v.ts_y_origin = pGC->patOrg.y; + if (mask & GCFont) { + if (dmxScreen->beDisplay) { + dmxFontPrivPtr pFontPriv; + pFontPriv = FontGetPrivate(pGC->font, dmxFontPrivateIndex); + v.font = pFontPriv->font[pScreen->myNum]->fid; + } else { + mask &= ~GCFont; + } + } + if (mask & GCSubwindowMode) v.subwindow_mode = pGC->subWindowMode; + + /* Graphics exposures are not needed on the back-ends since they can + be generated on the front-end thereby saving bandwidth. */ + if (mask & GCGraphicsExposures) mask &= ~GCGraphicsExposures; + + if (mask & GCClipXOrigin) v.clip_x_origin = pGC->clipOrg.x; + if (mask & GCClipYOrigin) v.clip_y_origin = pGC->clipOrg.y; + if (mask & GCClipMask) mask &= ~GCClipMask; /* See ChangeClip */ + if (mask & GCDashOffset) v.dash_offset = pGC->dashOffset; + if (mask & GCDashList) { + mask &= ~GCDashList; + if (dmxScreen->beDisplay) + XSetDashes(dmxScreen->beDisplay, pGCPriv->gc, + pGC->dashOffset, (char *)pGC->dash, + pGC->numInDashList); + } + if (mask & GCArcMode) v.arc_mode = pGC->arcMode; + + if (mask && dmxScreen->beDisplay) { + XChangeGC(dmxScreen->beDisplay, pGCPriv->gc, mask, &v); + dmxSync(dmxScreen, FALSE); + } + + DMX_GC_FUNC_EPILOGUE(pGC); +} + +/** Copy \a pGCSrc to \a pGCDst on the back-end server associated with + * \a pGCSrc's screen. */ +void dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst) +{ + ScreenPtr pScreen = pGCSrc->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxGCPrivPtr pGCSrcPriv = DMX_GET_GC_PRIV(pGCSrc); + dmxGCPrivPtr pGCDstPriv = DMX_GET_GC_PRIV(pGCDst); + + DMX_GC_FUNC_PROLOGUE(pGCDst); + pGCDst->funcs->CopyGC(pGCSrc, changes, pGCDst); + + /* Copy the GC on the back-end server */ + if (dmxScreen->beDisplay) + XCopyGC(dmxScreen->beDisplay, pGCSrcPriv->gc, changes, pGCDstPriv->gc); + + DMX_GC_FUNC_EPILOGUE(pGCDst); +} + +/** Free the \a pGC on the back-end server. */ +Bool dmxBEFreeGC(GCPtr pGC) +{ + ScreenPtr pScreen = pGC->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + + if (pGCPriv->gc) { + XFreeGC(dmxScreen->beDisplay, pGCPriv->gc); + pGCPriv->gc = NULL; + return TRUE; + } + + return FALSE; +} + +/** Destroy the graphics context, \a pGC and free the corresponding GC + * on the back-end server. */ +void dmxDestroyGC(GCPtr pGC) +{ + ScreenPtr pScreen = pGC->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + + DMX_GC_FUNC_PROLOGUE(pGC); + + /* Free the GC on the back-end server */ + if (dmxScreen->beDisplay) + dmxBEFreeGC(pGC); + + pGC->funcs->DestroyGC(pGC); + DMX_GC_FUNC_EPILOGUE(pGC); +} + +/** Change the clip rects for a GC. */ +void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects) +{ + ScreenPtr pScreen = pGC->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + XRectangle *pRects; + BoxPtr pBox; + int i, nRects; + + DMX_GC_FUNC_PROLOGUE(pGC); + pGC->funcs->ChangeClip(pGC, type, pvalue, nrects); + + /* Set the client clip on the back-end server */ + switch (pGC->clientClipType) { + case CT_NONE: + if (dmxScreen->beDisplay) + XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None); + break; + + case CT_REGION: + if (dmxScreen->beDisplay) { + nRects = REGION_NUM_RECTS((RegionPtr)pGC->clientClip); + pRects = xalloc(nRects * sizeof(*pRects)); + pBox = REGION_RECTS((RegionPtr)pGC->clientClip); + + for (i = 0; i < nRects; i++) { + pRects[i].x = pBox[i].x1; + pRects[i].y = pBox[i].y1; + pRects[i].width = pBox[i].x2 - pBox[i].x1; + pRects[i].height = pBox[i].y2 - pBox[i].y1; + } + + XSetClipRectangles(dmxScreen->beDisplay, pGCPriv->gc, + pGC->clipOrg.x, pGC->clipOrg.y, + pRects, nRects, Unsorted); + + xfree(pRects); + } + break; + + case CT_PIXMAP: + case CT_UNSORTED: + case CT_YSORTED: + case CT_YXSORTED: + case CT_YXBANDED: + /* These clip types are condensed down to either NONE or REGION + in the mi code */ + break; + } + + DMX_GC_FUNC_EPILOGUE(pGC); +} + +/** Destroy a GC's clip rects. */ +void dmxDestroyClip(GCPtr pGC) +{ + ScreenPtr pScreen = pGC->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + + DMX_GC_FUNC_PROLOGUE(pGC); + pGC->funcs->DestroyClip(pGC); + + /* Set the client clip on the back-end server to None */ + if (dmxScreen->beDisplay) + XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None); + + DMX_GC_FUNC_EPILOGUE(pGC); +} + +/** Copy a GC's clip rects. */ +void dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc) +{ + DMX_GC_FUNC_PROLOGUE(pGCDst); + pGCDst->funcs->CopyClip(pGCDst, pGCSrc); + DMX_GC_FUNC_EPILOGUE(pGCDst); +} Index: xc/programs/Xserver/hw/dmx/dmxgc.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxgc.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxgc.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,90 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxgc.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +/** \file + * Interface for GC support. \see dmxgc.c */ + +#ifndef DMXGC_H +#define DMXGC_H + +#include "gcstruct.h" + +/** GC private area. */ +typedef struct _dmxGCPriv { + GCOps *ops; + GCFuncs *funcs; + XlibGC gc; + Bool msc; +} dmxGCPrivRec, *dmxGCPrivPtr; + + +extern Bool dmxInitGC(ScreenPtr pScreen); + +extern Bool dmxCreateGC(GCPtr pGC); +extern void dmxValidateGC(GCPtr pGC, unsigned long changes, + DrawablePtr pDrawable); +extern void dmxChangeGC(GCPtr pGC, unsigned long mask); +extern void dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst); +extern void dmxDestroyGC(GCPtr pGC); +extern void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects); +extern void dmxDestroyClip(GCPtr pGC); +extern void dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc); + +extern void dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC); +extern Bool dmxBEFreeGC(GCPtr pGC); + +/** Private index. \see dmxgc.c \see dmxscrinit.c */ +extern int dmxGCPrivateIndex; + +/** Get private. */ +#define DMX_GET_GC_PRIV(_pGC) \ + (dmxGCPrivPtr)(_pGC)->devPrivates[dmxGCPrivateIndex].ptr + +#define DMX_GC_FUNC_PROLOGUE(_pGC) \ +do { \ + dmxGCPrivPtr _pGCPriv = DMX_GET_GC_PRIV(_pGC); \ + DMX_UNWRAP(funcs, _pGCPriv, (_pGC)); \ + if (_pGCPriv->ops) \ + DMX_UNWRAP(ops, _pGCPriv, (_pGC)); \ +} while (0) + +#define DMX_GC_FUNC_EPILOGUE(_pGC) \ +do { \ + dmxGCPrivPtr _pGCPriv = DMX_GET_GC_PRIV(_pGC); \ + DMX_WRAP(funcs, &dmxGCFuncs, _pGCPriv, (_pGC)); \ + if (_pGCPriv->ops) \ + DMX_WRAP(ops, &dmxGCOps, _pGCPriv, (_pGC)); \ +} while (0) + +#endif /* DMXGC_H */ Index: xc/programs/Xserver/hw/dmx/dmxgcops.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxgcops.c:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxgcops.c Wed Jun 30 16:21:39 2004 @@ -0,0 +1,557 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxgcops.c,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +/** \file + * This file provides support for GC operations. */ + +#include "dmx.h" +#include "dmxsync.h" +#include "dmxgc.h" +#include "dmxgcops.h" +#include "dmxwindow.h" +#include "dmxpixmap.h" + +#include "mi.h" +#include "gcstruct.h" +#include "pixmapstr.h" +#include "dixfontstr.h" + +#define DMX_GCOPS_SET_DRAWABLE(_pDraw, _draw) \ +do { \ + if ((_pDraw)->type == DRAWABLE_WINDOW) { \ + dmxWinPrivPtr pWinPriv = \ + DMX_GET_WINDOW_PRIV((WindowPtr)(_pDraw)); \ + (_draw) = (Drawable)pWinPriv->window; \ + } else { \ + dmxPixPrivPtr pPixPriv = \ + DMX_GET_PIXMAP_PRIV((PixmapPtr)(_pDraw)); \ + (_draw) = (Drawable)pPixPriv->pixmap; \ + } \ +} while (0) + +#define DMX_GCOPS_OFFSCREEN(_pDraw) \ + (!dmxScreens[(_pDraw)->pScreen->myNum].beDisplay || \ + (dmxOffScreenOpt && \ + (_pDraw)->type == DRAWABLE_WINDOW && \ + (DMX_GET_WINDOW_PRIV((WindowPtr)(_pDraw))->offscreen || \ + !DMX_GET_WINDOW_PRIV((WindowPtr)(_pDraw))->window))) + +/** Fill spans -- this function should never be called. */ +void dmxFillSpans(DrawablePtr pDrawable, GCPtr pGC, + int nInit, DDXPointPtr pptInit, int *pwidthInit, + int fSorted) +{ + /* Error -- this should never happen! */ +} + +/** Set spans -- this function should never be called. */ +void dmxSetSpans(DrawablePtr pDrawable, GCPtr pGC, + char *psrc, DDXPointPtr ppt, int *pwidth, int nspans, + int fSorted) +{ + /* Error -- this should never happen! */ +} + +/** Transfer \a pBits image to back-end server associated with \a + * pDrawable's screen. If primitive subdivision optimization is + * enabled, then only transfer the sections of \a pBits that are + * visible (i.e., not-clipped) to the back-end server. */ +void dmxPutImage(DrawablePtr pDrawable, GCPtr pGC, + int depth, int x, int y, int w, int h, + int leftPad, int format, char *pBits) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + XImage *img; + + if (DMX_GCOPS_OFFSCREEN(pDrawable)) return; + + img = XCreateImage(dmxScreen->beDisplay, + dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual, + depth, format, leftPad, pBits, w, h, + BitmapPad(dmxScreen->beDisplay), + (format == ZPixmap) ? + PixmapBytePad(w, depth) : BitmapBytePad(w+leftPad)); + + if (img) { + Drawable draw; + + DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); + + if (dmxSubdividePrimitives && pGC->pCompositeClip) { + RegionPtr pSubImages; + RegionPtr pClip; + BoxRec box; + BoxPtr pBox; + int nBox; + + box.x1 = x; + box.y1 = y; + box.x2 = x + w; + box.y2 = y + h; + pSubImages = REGION_CREATE(pGC->pScreen, &box, 1); + + pClip = REGION_CREATE(pGC->pScreen, NullBox, 1); + REGION_COPY(pGC->pScreen, pClip, pGC->pCompositeClip); + REGION_TRANSLATE(pGC->pScreen, pClip, + -pDrawable->x, -pDrawable->y); + REGION_INTERSECT(pGC->pScreen, pSubImages, pSubImages, pClip); + + nBox = REGION_NUM_RECTS(pSubImages); + pBox = REGION_RECTS(pSubImages); + + while (nBox--) { + XPutImage(dmxScreen->beDisplay, draw, pGCPriv->gc, img, + pBox->x1 - box.x1, + pBox->y1 - box.y1, + pBox->x1, + pBox->y1, + pBox->x2 - pBox->x1, + pBox->y2 - pBox->y1); + pBox++; + } + REGION_DESTROY(pGC->pScreen, pClip); + REGION_DESTROY(pGC->pScreen, pSubImages); + } else { + XPutImage(dmxScreen->beDisplay, draw, pGCPriv->gc, + img, 0, 0, x, y, w, h); + } + XFree(img); /* Use XFree instead of XDestroyImage + * because pBits is passed in from the + * caller. */ + + dmxSync(dmxScreen, FALSE); + } else { + /* Error -- this should not happen! */ + } +} + +/** Copy area from \a pSrc drawable to \a pDst drawable on the back-end + * server associated with \a pSrc drawable's screen. If the offscreen + * optimization is enabled, only copy when both \a pSrc and \a pDst are + * at least partially visible. */ +RegionPtr dmxCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + int srcx, int srcy, int w, int h, int dstx, int dsty) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pSrc->pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + Drawable srcDraw, dstDraw; + + if (DMX_GCOPS_OFFSCREEN(pSrc) || DMX_GCOPS_OFFSCREEN(pDst)) + return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, w, h, + dstx, dsty, 0L); + + DMX_GCOPS_SET_DRAWABLE(pSrc, srcDraw); + DMX_GCOPS_SET_DRAWABLE(pDst, dstDraw); + + XCopyArea(dmxScreen->beDisplay, srcDraw, dstDraw, pGCPriv->gc, + srcx, srcy, w, h, dstx, dsty); + dmxSync(dmxScreen, FALSE); + + return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, w, h, + dstx, dsty, 0L); +} + +/** Copy plane number \a bitPlane from \a pSrc drawable to \a pDst + * drawable on the back-end server associated with \a pSrc drawable's + * screen. If the offscreen optimization is enabled, only copy when + * both \a pSrc and \a pDst are at least partially visible. */ +RegionPtr dmxCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + int srcx, int srcy, int width, int height, + int dstx, int dsty, unsigned long bitPlane) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pSrc->pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + Drawable srcDraw, dstDraw; + + if (DMX_GCOPS_OFFSCREEN(pSrc) || DMX_GCOPS_OFFSCREEN(pDst)) + return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, width, height, + dstx, dsty, bitPlane); + + DMX_GCOPS_SET_DRAWABLE(pSrc, srcDraw); + DMX_GCOPS_SET_DRAWABLE(pDst, dstDraw); + + XCopyPlane(dmxScreen->beDisplay, srcDraw, dstDraw, pGCPriv->gc, + srcx, srcy, width, height, dstx, dsty, bitPlane); + dmxSync(dmxScreen, FALSE); + + return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, width, height, + dstx, dsty, bitPlane); +} + +/** Render list of points, \a pptInit in \a pDrawable on the back-end + * server associated with \a pDrawable's screen. If the offscreen + * optimization is enabled, only draw when \a pDrawable is at least + * partially visible. */ +void dmxPolyPoint(DrawablePtr pDrawable, GCPtr pGC, + int mode, int npt, DDXPointPtr pptInit) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + Drawable draw; + + if (DMX_GCOPS_OFFSCREEN(pDrawable)) return; + + DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); + + XDrawPoints(dmxScreen->beDisplay, draw, pGCPriv->gc, + (XPoint *)pptInit, npt, mode); + dmxSync(dmxScreen, FALSE); +} + +/** Render list of connected lines, \a pptInit in \a pDrawable on the + * back-end server associated with \a pDrawable's screen. If the + * offscreen optimization is enabled, only draw when \a pDrawable is at + * least partially visible. */ +void dmxPolylines(DrawablePtr pDrawable, GCPtr pGC, + int mode, int npt, DDXPointPtr pptInit) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + Drawable draw; + + if (DMX_GCOPS_OFFSCREEN(pDrawable)) return; + + DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); + + XDrawLines(dmxScreen->beDisplay, draw, pGCPriv->gc, + (XPoint *)pptInit, npt, mode); + dmxSync(dmxScreen, FALSE); +} + +/** Render list of disjoint segments, \a pSegs in \a pDrawable on the + * back-end server associated with \a pDrawable's screen. If the + * offscreen optimization is enabled, only draw when \a pDrawable is at + * least partially visible. */ +void dmxPolySegment(DrawablePtr pDrawable, GCPtr pGC, + int nseg, xSegment *pSegs) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + Drawable draw; + + if (DMX_GCOPS_OFFSCREEN(pDrawable)) return; + + DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); + + XDrawSegments(dmxScreen->beDisplay, draw, pGCPriv->gc, + (XSegment *)pSegs, nseg); + dmxSync(dmxScreen, FALSE); +} + +/** Render list of rectangle outlines, \a pRects in \a pDrawable on the + * back-end server associated with \a pDrawable's screen. If the + * offscreen optimization is enabled, only draw when \a pDrawable is at + * least partially visible. */ +void dmxPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, + int nrects, xRectangle *pRects) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + Drawable draw; + + if (DMX_GCOPS_OFFSCREEN(pDrawable)) return; + + DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); + + XDrawRectangles(dmxScreen->beDisplay, draw, pGCPriv->gc, + (XRectangle *)pRects, nrects); + + dmxSync(dmxScreen, FALSE); +} + +/** Render list of arc outlines, \a parcs in \a pDrawable on the + * back-end server associated with \a pDrawable's screen. If the + * offscreen optimization is enabled, only draw when \a pDrawable is at + * least partially visible. */ +void dmxPolyArc(DrawablePtr pDrawable, GCPtr pGC, + int narcs, xArc *parcs) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + Drawable draw; + + if (DMX_GCOPS_OFFSCREEN(pDrawable)) return; + + DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); + + XDrawArcs(dmxScreen->beDisplay, draw, pGCPriv->gc, + (XArc *)parcs, narcs); + dmxSync(dmxScreen, FALSE); +} + +/** Render a filled polygons in \a pDrawable on the back-end server + * associated with \a pDrawable's screen. If the offscreen + * optimization is enabled, only draw when \a pDrawable is at least + * partially visible. */ +void dmxFillPolygon(DrawablePtr pDrawable, GCPtr pGC, + int shape, int mode, int count, DDXPointPtr pPts) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + Drawable draw; + + if (DMX_GCOPS_OFFSCREEN(pDrawable)) return; + + DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); + + XFillPolygon(dmxScreen->beDisplay, draw, pGCPriv->gc, + (XPoint *)pPts, count, shape, mode); + dmxSync(dmxScreen, FALSE); +} + +/** Render list of filled rectangles, \a prectInit in \a pDrawable on + * the back-end server associated with \a pDrawable's screen. If the + * offscreen optimization is enabled, only draw when \a pDrawable is at + * least partially visible. */ +void dmxPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, + int nrectFill, xRectangle *prectInit) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + Drawable draw; + + if (DMX_GCOPS_OFFSCREEN(pDrawable)) return; + + DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); + + XFillRectangles(dmxScreen->beDisplay, draw, pGCPriv->gc, + (XRectangle *)prectInit, nrectFill); + dmxSync(dmxScreen, FALSE); +} + +/** Render list of filled arcs, \a parcs in \a pDrawable on the back-end + * server associated with \a pDrawable's screen. If the offscreen + * optimization is enabled, only draw when \a pDrawable is at least + * partially visible. */ +void dmxPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, + int narcs, xArc *parcs) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + Drawable draw; + + if (DMX_GCOPS_OFFSCREEN(pDrawable)) return; + + DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); + + XFillArcs(dmxScreen->beDisplay, draw, pGCPriv->gc, + (XArc *)parcs, narcs); + dmxSync(dmxScreen, FALSE); +} + +/** Render string of 8-bit \a chars (foreground only) in \a pDrawable on + * the back-end server associated with \a pDrawable's screen. If the + * offscreen optimization is enabled, only draw when \a pDrawable is at + * least partially visible. */ +int dmxPolyText8(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, char *chars) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + unsigned long n, i; + int w; + CharInfoPtr charinfo[255]; + Drawable draw; + + GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars, + Linear8Bit, &n, charinfo); + + /* Calculate text width */ + w = 0; + for (i = 0; i < n; i++) w += charinfo[i]->metrics.characterWidth; + + if (n != 0 && !DMX_GCOPS_OFFSCREEN(pDrawable)) { + DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); + + XDrawString(dmxScreen->beDisplay, draw, pGCPriv->gc, + x, y, chars, count); + dmxSync(dmxScreen, FALSE); + } + + return x+w; +} + +/** Render string of 16-bit \a chars (foreground only) in \a pDrawable + * on the back-end server associated with \a pDrawable's screen. If + * the offscreen optimization is enabled, only draw when \a pDrawable + * is at least partially visible. */ +int dmxPolyText16(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, unsigned short *chars) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + unsigned long n, i; + int w; + CharInfoPtr charinfo[255]; + Drawable draw; + + GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)chars, + (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit, + &n, charinfo); + + /* Calculate text width */ + w = 0; + for (i = 0; i < n; i++) w += charinfo[i]->metrics.characterWidth; + + if (n != 0 && !DMX_GCOPS_OFFSCREEN(pDrawable)) { + DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); + + XDrawString16(dmxScreen->beDisplay, draw, pGCPriv->gc, + x, y, (XChar2b *)chars, count); + dmxSync(dmxScreen, FALSE); + } + + return x+w; +} + +/** Render string of 8-bit \a chars (both foreground and background) in + * \a pDrawable on the back-end server associated with \a pDrawable's + * screen. If the offscreen optimization is enabled, only draw when \a + * pDrawable is at least partially visible. */ +void dmxImageText8(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, char *chars) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + Drawable draw; + + if (DMX_GCOPS_OFFSCREEN(pDrawable)) return; + + DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); + + XDrawImageString(dmxScreen->beDisplay, draw, pGCPriv->gc, + x, y, chars, count); + dmxSync(dmxScreen, FALSE); +} + +/** Render string of 16-bit \a chars (both foreground and background) in + * \a pDrawable on the back-end server associated with \a pDrawable's + * screen. If the offscreen optimization is enabled, only draw when \a + * pDrawable is at least partially visible. */ +void dmxImageText16(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, unsigned short *chars) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); + Drawable draw; + + if (DMX_GCOPS_OFFSCREEN(pDrawable)) return; + + DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); + + XDrawImageString16(dmxScreen->beDisplay, draw, pGCPriv->gc, + x, y, (XChar2b *)chars, count); + dmxSync(dmxScreen, FALSE); +} + +/** Image Glyph Blt -- this function should never be called. */ +void dmxImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, unsigned int nglyph, + CharInfoPtr *ppci, pointer pglyphBase) +{ + /* Error -- this should never happen! */ +} + +/** Poly Glyph Blt -- this function should never be called. */ +void dmxPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, unsigned int nglyph, + CharInfoPtr *ppci, pointer pglyphBase) +{ + /* Error -- this should never happen! */ +} + +/** Push Pixels -- this function should never be called. */ +void dmxPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, + int w, int h, int x, int y) +{ + /* Error -- this should never happen! */ +} + +/********************************************************************** + * Miscellaneous drawing commands + */ + +/** Get an image from the back-end server associated with \a pDrawable's + * screen. If \a pDrawable is a window, it must be viewable to get an + * image from it. If it is not viewable, then get the image from the + * first ancestor of \a pDrawable that is viewable. If no viewable + * ancestor is found, then simply return without getting an image. */ +void dmxGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, + unsigned int format, unsigned long planeMask, char *pdstLine) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; + XImage *img; + Drawable draw; + + /* Cannot get image from unviewable window */ + if (pDrawable->type == DRAWABLE_WINDOW) { + WindowPtr pWindow = (WindowPtr)pDrawable; + if (!pWindow->viewable) { + while (!pWindow->viewable && pWindow->parent) { + sx += pWindow->origin.x - wBorderWidth(pWindow); + sx += pWindow->origin.y - wBorderWidth(pWindow); + pWindow = pWindow->parent; + } + if (!pWindow->viewable) { + return; + } + } + DMX_GCOPS_SET_DRAWABLE(&pWindow->drawable, draw); + if (DMX_GCOPS_OFFSCREEN(&pWindow->drawable)) + return; + } else { + DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); + if (DMX_GCOPS_OFFSCREEN(pDrawable)) + return; + } + + img = XGetImage(dmxScreen->beDisplay, draw, + sx, sy, w, h, planeMask, format); + if (img) { + int len = img->bytes_per_line * img->height; + memmove(pdstLine, img->data, len); + XDestroyImage(img); + } + + dmxSync(dmxScreen, FALSE); +} + +/** Get Spans -- this function should never be called. */ +void dmxGetSpans(DrawablePtr pDrawable, int wMax, + DDXPointPtr ppt, int *pwidth, int nspans, + char *pdstStart) +{ + /* Error -- this should never happen! */ +} Index: xc/programs/Xserver/hw/dmx/dmxgcops.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxgcops.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxgcops.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,96 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxgcops.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +/** \file + * Interface for gcops support. \see dmxgcops.c */ + +#ifndef DMXGCOPS_H +#define DMXGCOPS_H + +extern void dmxFillSpans(DrawablePtr pDrawable, GCPtr pGC, + int nInit, DDXPointPtr pptInit, int *pwidthInit, + int fSorted); +extern void dmxSetSpans(DrawablePtr pDrawable, GCPtr pGC, + char *psrc, DDXPointPtr ppt, int *pwidth, int nspans, + int fSorted); +extern void dmxPutImage(DrawablePtr pDrawable, GCPtr pGC, + int depth, int x, int y, int w, int h, + int leftPad, int format, char *pBits); +extern RegionPtr dmxCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + int srcx, int srcy, int w, int h, + int dstx, int dsty); +extern RegionPtr dmxCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + int srcx, int srcy, int width, int height, + int dstx, int dsty, unsigned long bitPlane); +extern void dmxPolyPoint(DrawablePtr pDrawable, GCPtr pGC, + int mode, int npt, DDXPointPtr pptInit); +extern void dmxPolylines(DrawablePtr pDrawable, GCPtr pGC, + int mode, int npt, DDXPointPtr pptInit); +extern void dmxPolySegment(DrawablePtr pDrawable, GCPtr pGC, + int nseg, xSegment *pSegs); +extern void dmxPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, + int nrects, xRectangle *pRects); +extern void dmxPolyArc(DrawablePtr pDrawable, GCPtr pGC, + int narcs, xArc *parcs); +extern void dmxFillPolygon(DrawablePtr pDrawable, GCPtr pGC, + int shape, int mode, int count, DDXPointPtr pPts); +extern void dmxPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, + int nrectFill, xRectangle *prectInit); +extern void dmxPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, + int narcs, xArc *parcs); +extern int dmxPolyText8(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, char *chars); +extern int dmxPolyText16(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, unsigned short *chars); +extern void dmxImageText8(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, char *chars); +extern void dmxImageText16(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, unsigned short *chars); +extern void dmxImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, unsigned int nglyph, + CharInfoPtr *ppci, pointer pglyphBase); +extern void dmxPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, unsigned int nglyph, + CharInfoPtr *ppci, pointer pglyphBase); +extern void dmxPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, + int w, int h, int x, int y); + +extern void dmxGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, + unsigned int format, unsigned long planeMask, + char *pdstLine); +extern void dmxGetSpans(DrawablePtr pDrawable, int wMax, + DDXPointPtr ppt, int *pwidth, int nspans, + char *pdstStart); + +#endif /* DMXGCOPS_H */ Index: xc/programs/Xserver/hw/dmx/dmxinit.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxinit.c:1.7 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxinit.c Mon Mar 7 11:39:17 2005 @@ -0,0 +1,1074 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxinit.c,v 1.7 2005/03/07 16:39:17 tsi Exp $ */ +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * David H. Dawes + * Rickard E. (Rik) Faith + * + */ + +/** \file + * Provide expected functions for initialization from the ddx layer and + * global variables for the DMX server. */ + +#include "dmx.h" +#include "dmxinit.h" +#include "dmxsync.h" +#include "dmxlog.h" +#include "dmxinput.h" +#include "dmxscrinit.h" +#include "dmxcursor.h" +#include "dmxfont.h" +#include "config/dmxconfig.h" +#include "dmxcb.h" +#include "dmxprop.h" +#include "dmxstat.h" +#ifdef RENDER +#include "dmxpict.h" +#endif + +#include "Xos.h" /* For gettimeofday */ +#include "dixstruct.h" +#include "panoramiXsrv.h" + +#include /* For SIGQUIT */ + +#ifdef GLXPROXY +#include +#include +#include "dmx_glxvisuals.h" +#include "Xext.h" +#include "extutil.h" + +extern void GlxSetVisualConfigs( + int nconfigs, + __GLXvisualConfig *configs, + void **configprivs +); +#endif /* GLXPROXY */ + +extern void SetVendorRelease(int release); /* in dix/main.c */ +extern void SetVendorString(char *string); /* in dix/main.c */ + +/* Global variables available to all Xserver/hw/dmx routines. */ +int dmxNumScreens; +DMXScreenInfo *dmxScreens; + +int dmxNumInputs; +DMXInputInfo *dmxInputs; + +int dmxShadowFB = FALSE; + +XErrorEvent dmxLastErrorEvent; +Bool dmxErrorOccurred = FALSE; + +char *dmxFontPath = NULL; + +Bool dmxOffScreenOpt = TRUE; + +Bool dmxSubdividePrimitives = TRUE; + +Bool dmxLazyWindowCreation = TRUE; + +Bool dmxUseXKB = TRUE; + +int dmxDepth = 0; + +Bool dmxNoRender = FALSE; + +#ifndef GLXPROXY +static Bool dmxGLXProxy = FALSE; +#else +Bool dmxGLXProxy = TRUE; + +Bool dmxGLXSwapGroupSupport = TRUE; + +Bool dmxGLXSyncSwap = FALSE; + +Bool dmxGLXFinishSwap = FALSE; +#endif + +Bool dmxIgnoreBadFontPaths = FALSE; + +Bool dmxAddRemoveScreens = FALSE; + +/* dmxErrorHandler catches errors that occur when calling one of the + * back-end servers. Some of this code is based on _XPrintDefaultError + * in xc/lib/X11/XlibInt.c */ +static int dmxErrorHandler(Display *dpy, XErrorEvent *ev) +{ +#define DMX_ERROR_BUF_SIZE 256 + /* RATS: these buffers are only used in + * length-limited calls. */ + char buf[DMX_ERROR_BUF_SIZE]; + char request[DMX_ERROR_BUF_SIZE]; + _XExtension *ext = NULL; + + dmxErrorOccurred = TRUE; + dmxLastErrorEvent = *ev; + + XGetErrorText(dpy, ev->error_code, buf, sizeof(buf)); + dmxLog(dmxWarning, "dmxErrorHandler: %s\n", buf); + + /* Find major opcode name */ + if (ev->request_code < 128) { + XmuSnprintf(request, sizeof(request), "%d", ev->request_code); + XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf)); + } else { + for (ext = dpy->ext_procs; + ext && ext->codes.major_opcode != ev->request_code; + ext = ext->next); + if (ext) strncpy(buf, ext->name, sizeof(buf)); + else buf[0] = '\0'; + } + dmxLog(dmxWarning, " Major opcode: %d (%s)\n", + ev->request_code, buf); + + /* Find minor opcode name */ + if (ev->request_code >= 128 && ext) { + XmuSnprintf(request, sizeof(request), "%d", ev->request_code); + XmuSnprintf(request, sizeof(request), "%s.%d", + ext->name, ev->minor_code); + XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf)); + dmxLog(dmxWarning, " Minor opcode: %d (%s)\n", + ev->minor_code, buf); + } + + /* Provide value information */ + switch (ev->error_code) { + case BadValue: + dmxLog(dmxWarning, " Value: 0x%x\n", + ev->resourceid); + break; + case BadAtom: + dmxLog(dmxWarning, " AtomID: 0x%x\n", + ev->resourceid); + break; + default: + dmxLog(dmxWarning, " ResourceID: 0x%x\n", + ev->resourceid); + break; + } + + /* Provide serial number information */ + dmxLog(dmxWarning, " Failed serial number: %d\n", + ev->serial); + dmxLog(dmxWarning, " Current serial number: %d\n", + dpy->request); + return 0; +} + +#ifdef GLXPROXY +static int dmxNOPErrorHandler(Display *dpy, XErrorEvent *ev) +{ + return 0; +} +#endif + +Bool dmxOpenDisplay(DMXScreenInfo *dmxScreen) +{ + if (!(dmxScreen->beDisplay = XOpenDisplay(dmxScreen->name))) + return FALSE; + + dmxPropertyDisplay(dmxScreen); + return TRUE; +} + +void dmxSetErrorHandler(DMXScreenInfo *dmxScreen) +{ + XSetErrorHandler(dmxErrorHandler); +} + +static void dmxPrintScreenInfo(DMXScreenInfo *dmxScreen) +{ + XWindowAttributes attribs; + int ndepths = 0, *depths = NULL; + int i; + Display *dpy = dmxScreen->beDisplay; + Screen *s = DefaultScreenOfDisplay(dpy); + int scr = DefaultScreen(dpy); + + XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs); + if (!(depths = XListDepths(dpy, scr, &ndepths))) ndepths = 0; + + dmxLogOutput(dmxScreen, "Name of display: %s\n", DisplayString(dpy)); + dmxLogOutput(dmxScreen, "Version number: %d.%d\n", + ProtocolVersion(dpy), ProtocolRevision(dpy)); + dmxLogOutput(dmxScreen, "Vendor string: %s\n", ServerVendor(dpy)); + if (!strstr(ServerVendor(dpy), "XFree86")) { + dmxLogOutput(dmxScreen, "Vendor release: %d\n", VendorRelease(dpy)); + } else { + /* This code based on xdpyinfo.c */ + int v = VendorRelease(dpy); + int major = -1, minor = -1, patch = -1, subpatch = -1; + + if (v < 336) + major = v / 100, minor = (v / 10) % 10, patch = v % 10; + else if (v < 3900) { + major = v / 1000; + minor = (v / 100) % 10; + if (((v / 10) % 10) || (v % 10)) { + patch = (v / 10) % 10; + if (v % 10) subpatch = v % 10; + } + } else if (v < 40000000) { + major = v / 1000; + minor = (v / 10) % 10; + if (v % 10) patch = v % 10; + } else { + major = v / 10000000; + minor = (v / 100000) % 100; + patch = (v / 1000) % 100; + if (v % 1000) subpatch = v % 1000; + } + dmxLogOutput(dmxScreen, "Vendor release: %d (XFree86 version: %d.%d", + v, major, minor); + if (patch > 0) dmxLogOutputCont(dmxScreen, ".%d", patch); + if (subpatch > 0) dmxLogOutputCont(dmxScreen, ".%d", subpatch); + dmxLogOutputCont(dmxScreen, ")\n"); + } + + + dmxLogOutput(dmxScreen, "Dimensions: %dx%d pixels\n", + attribs.width, attribs.height); + dmxLogOutput(dmxScreen, "%d depths on screen %d: ", ndepths, scr); + for (i = 0; i < ndepths; i++) + dmxLogOutputCont(dmxScreen, "%c%d", i ? ',' : ' ', depths[i]); + dmxLogOutputCont(dmxScreen, "\n"); + dmxLogOutput(dmxScreen, "Depth of root window: %d plane%s (%d)\n", + attribs.depth, attribs.depth == 1 ? "" : "s", + DisplayPlanes(dpy, scr)); + dmxLogOutput(dmxScreen, "Number of colormaps: %d min, %d max\n", + MinCmapsOfScreen(s), MaxCmapsOfScreen(s)); + dmxLogOutput(dmxScreen, "Options: backing-store %s, save-unders %s\n", + (DoesBackingStore (s) == NotUseful) ? "no" : + ((DoesBackingStore (s) == Always) ? "yes" : "when mapped"), + DoesSaveUnders (s) ? "yes" : "no"); + dmxLogOutput(dmxScreen, "Window Manager running: %s\n", + (dmxScreen->WMRunningOnBE) ? "yes" : "no"); + + if (dmxScreen->WMRunningOnBE) { + dmxLogOutputWarning(dmxScreen, + "Window manager running " + "-- colormaps not supported\n"); + } + XFree(depths); +} + +void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen) +{ + XWindowAttributes attribs; + Display *dpy = dmxScreen->beDisplay; +#ifdef GLXPROXY + int dummy; +#endif + + XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs); + + dmxScreen->beWidth = attribs.width; + dmxScreen->beHeight = attribs.height; + + /* Fill in missing geometry information */ + if (dmxScreen->scrnXSign < 0) { + if (dmxScreen->scrnWidth) { + dmxScreen->scrnX = (attribs.width - dmxScreen->scrnWidth + - dmxScreen->scrnX); + } else { + dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX; + dmxScreen->scrnX = 0; + } + } + if (dmxScreen->scrnYSign < 0) { + if (dmxScreen->scrnHeight) { + dmxScreen->scrnY = (attribs.height - dmxScreen->scrnHeight + - dmxScreen->scrnY); + } else { + dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY; + dmxScreen->scrnY = 0; + } + } + if (!dmxScreen->scrnWidth) + dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX; + if (!dmxScreen->scrnHeight) + dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY; + + if (!dmxScreen->rootWidth) dmxScreen->rootWidth = dmxScreen->scrnWidth; + if (!dmxScreen->rootHeight) dmxScreen->rootHeight = dmxScreen->scrnHeight; + if (dmxScreen->rootWidth + dmxScreen->rootX > dmxScreen->scrnWidth) + dmxScreen->rootWidth = dmxScreen->scrnWidth - dmxScreen->rootX; + if (dmxScreen->rootHeight + dmxScreen->rootY > dmxScreen->scrnHeight) + dmxScreen->rootHeight = dmxScreen->scrnHeight - dmxScreen->rootY; + + /* FIXME: Get these from the back-end server */ + dmxScreen->beXDPI = 75; + dmxScreen->beYDPI = 75; + + dmxScreen->beDepth = attribs.depth; /* FIXME: verify that this + * works always. In + * particular, this will work + * well for depth=16, will fail + * because of colormap issues + * at depth 8. More work needs + * to be done here. */ + + if (dmxScreen->beDepth <= 8) dmxScreen->beBPP = 8; + else if (dmxScreen->beDepth <= 16) dmxScreen->beBPP = 16; + else dmxScreen->beBPP = 32; + +#ifdef GLXPROXY + /* get the majorOpcode for the back-end GLX extension */ + XQueryExtension(dpy, "GLX", &dmxScreen->glxMajorOpcode, + &dummy, &dmxScreen->glxErrorBase); +#endif + + dmxPrintScreenInfo(dmxScreen); + dmxLogOutput(dmxScreen, "%dx%d+%d+%d on %dx%d at depth=%d, bpp=%d\n", + dmxScreen->scrnWidth, dmxScreen->scrnHeight, + dmxScreen->scrnX, dmxScreen->scrnY, + dmxScreen->beWidth, dmxScreen->beHeight, + dmxScreen->beDepth, dmxScreen->beBPP); + if (dmxScreen->beDepth == 8) + dmxLogOutputWarning(dmxScreen, + "Support for depth == 8 is not complete\n"); +} + +Bool dmxGetVisualInfo(DMXScreenInfo *dmxScreen) +{ + int i; + XVisualInfo visinfo; + + visinfo.screen = DefaultScreen(dmxScreen->beDisplay); + dmxScreen->beVisuals = XGetVisualInfo(dmxScreen->beDisplay, + VisualScreenMask, + &visinfo, + &dmxScreen->beNumVisuals); + + dmxScreen->beDefVisualIndex = -1; + + if (defaultColorVisualClass >= 0 || dmxDepth > 0) { + for (i = 0; i < dmxScreen->beNumVisuals; i++) + if (defaultColorVisualClass >= 0) { + if (dmxScreen->beVisuals[i].class == defaultColorVisualClass) { + if (dmxDepth > 0) { + if (dmxScreen->beVisuals[i].depth == dmxDepth) { + dmxScreen->beDefVisualIndex = i; + break; + } + } else { + dmxScreen->beDefVisualIndex = i; + break; + } + } + } else if (dmxScreen->beVisuals[i].depth == dmxDepth) { + dmxScreen->beDefVisualIndex = i; + break; + } + } else { + visinfo.visualid = + XVisualIDFromVisual(DefaultVisual(dmxScreen->beDisplay, + visinfo.screen)); + + for (i = 0; i < dmxScreen->beNumVisuals; i++) + if (visinfo.visualid == dmxScreen->beVisuals[i].visualid) { + dmxScreen->beDefVisualIndex = i; + break; + } + } + + for (i = 0; i < dmxScreen->beNumVisuals; i++) + dmxLogVisual(dmxScreen, &dmxScreen->beVisuals[i], + (i == dmxScreen->beDefVisualIndex)); + + return (dmxScreen->beDefVisualIndex >= 0); +} + +void dmxGetColormaps(DMXScreenInfo *dmxScreen) +{ + int i; + + dmxScreen->beNumDefColormaps = dmxScreen->beNumVisuals; + dmxScreen->beDefColormaps = xalloc(dmxScreen->beNumDefColormaps * + sizeof(*dmxScreen->beDefColormaps)); + + for (i = 0; i < dmxScreen->beNumDefColormaps; i++) + dmxScreen->beDefColormaps[i] = + XCreateColormap(dmxScreen->beDisplay, + DefaultRootWindow(dmxScreen->beDisplay), + dmxScreen->beVisuals[i].visual, + AllocNone); + + dmxScreen->beBlackPixel = BlackPixel(dmxScreen->beDisplay, + DefaultScreen(dmxScreen->beDisplay)); + dmxScreen->beWhitePixel = WhitePixel(dmxScreen->beDisplay, + DefaultScreen(dmxScreen->beDisplay)); +} + +void dmxGetPixmapFormats(DMXScreenInfo *dmxScreen) +{ + dmxScreen->beDepths = + XListDepths(dmxScreen->beDisplay, DefaultScreen(dmxScreen->beDisplay), + &dmxScreen->beNumDepths); + + dmxScreen->bePixmapFormats = + XListPixmapFormats(dmxScreen->beDisplay, + &dmxScreen->beNumPixmapFormats); +} + +static Bool dmxSetPixmapFormats(ScreenInfo *pScreenInfo, + DMXScreenInfo *dmxScreen) +{ + XPixmapFormatValues *bePixmapFormat; + PixmapFormatRec *format; + int i, j; + + pScreenInfo->imageByteOrder = ImageByteOrder(dmxScreen->beDisplay); + pScreenInfo->bitmapScanlineUnit = BitmapUnit(dmxScreen->beDisplay); + pScreenInfo->bitmapScanlinePad = BitmapPad(dmxScreen->beDisplay); + pScreenInfo->bitmapBitOrder = BitmapBitOrder(dmxScreen->beDisplay); + + pScreenInfo->numPixmapFormats = 0; + for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) { + bePixmapFormat = &dmxScreen->bePixmapFormats[i]; + for (j = 0; j < dmxScreen->beNumDepths; j++) + if ((bePixmapFormat->depth == 1) || + (bePixmapFormat->depth == dmxScreen->beDepths[j])) { + format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats]; + + format->depth = bePixmapFormat->depth; + format->bitsPerPixel = bePixmapFormat->bits_per_pixel; + format->scanlinePad = bePixmapFormat->scanline_pad; + + pScreenInfo->numPixmapFormats++; + break; + } + } + + return TRUE; +} + +void dmxCheckForWM(DMXScreenInfo *dmxScreen) +{ + Status status; + XWindowAttributes xwa; + + status = XGetWindowAttributes(dmxScreen->beDisplay, + DefaultRootWindow(dmxScreen->beDisplay), + &xwa); + dmxScreen->WMRunningOnBE = + (status && + ((xwa.all_event_masks & SubstructureRedirectMask) || + (xwa.all_event_masks & SubstructureNotifyMask))); +} + +/** Initialize the display and collect relevant information about the + * display properties */ +static void dmxDisplayInit(DMXScreenInfo *dmxScreen) +{ + if (!dmxOpenDisplay(dmxScreen)) + dmxLog(dmxFatal, + "dmxOpenDisplay: Unable to open display %s\n", + dmxScreen->name); + + dmxSetErrorHandler(dmxScreen); + dmxCheckForWM(dmxScreen); + dmxGetScreenAttribs(dmxScreen); + + if (!dmxGetVisualInfo(dmxScreen)) + dmxLog(dmxFatal, "dmxGetVisualInfo: No matching visuals found\n"); + + dmxGetColormaps(dmxScreen); + dmxGetPixmapFormats(dmxScreen); +} + +/* If this doesn't compile, just add || defined(yoursystem) to the line + * below. This information is to help with bug reports and is not + * critical. */ +#if !defined(_POSIX_SOURCE) && !defined(__sgi) && !defined(__UNIXOS2__) +static const char *dmxExecOS(void) { return ""; } +#else +#include +static const char *dmxExecOS(void) +{ + static char buffer[128]; + static int initialized = 0; + struct utsname u; + + if (!initialized++) { + memset(buffer, 0, sizeof(buffer)); + uname(&u); + XmuSnprintf(buffer, sizeof(buffer)-1, "%s %s %s", + u.sysname, u.release, u.version); + } + return buffer; +} +#endif + +static const char *dmxBuildCompiler(void) +{ + static char buffer[128]; + static int initialized = 0; + + if (!initialized++) { + memset(buffer, 0, sizeof(buffer)); +#if defined(__GNUC__) && defined(__GNUC_MINOR__) &&defined(__GNUC_PATCHLEVEL__) + XmuSnprintf(buffer, sizeof(buffer)-1, "gcc %d.%d.%d", + __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__); +#elif defined(__sgi) && defined(_COMPILER_VERSION) && !defined(__GNUC__) + { + int a = _COMPILER_VERSION / 100; + int b = (_COMPILER_VERSION - a * 100) / 10; + int c = _COMPILER_VERSION - a * 100 - b * 10; + XmuSnprintf(buffer, sizeof(buffer)-1, "SGI MIPSpro %d.%d.%d", + a, b, c); + } +#endif + } + return buffer; +} + +static const char *dmxExecHost(void) +{ + static char buffer[128]; + static int initialized = 0; + + if (!initialized++) { + memset(buffer, 0, sizeof(buffer)); + XmuGetHostname(buffer, sizeof(buffer) - 1); + } + return buffer; +} + +/** This routine is called in Xserver/dix/main.c from \a main(). */ +void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[]) +{ + int i; + static unsigned long dmxGeneration = 0; +#ifdef GLXPROXY + Bool glxSupported = TRUE; +#endif + + if (dmxGeneration != serverGeneration) { + int vendrel = VENDOR_RELEASE; + int major, minor, year, month, day; + + dmxGeneration = serverGeneration; + + major = vendrel / 100000000; + vendrel -= major * 100000000; + minor = vendrel / 1000000; + vendrel -= minor * 1000000; + year = vendrel / 10000; + vendrel -= year * 10000; + month = vendrel / 100; + vendrel -= month * 100; + day = vendrel; + + /* Add other epoch tests here */ + if (major > 0 && minor > 0) year += 2000; + + dmxLog(dmxInfo, "Generation: %d\n", dmxGeneration); + dmxLog(dmxInfo, "DMX version: %d.%d.%02d%02d%02d (%s)\n", + major, minor, year, month, day, VENDOR_STRING); + + SetVendorRelease(VENDOR_RELEASE); + SetVendorString(VENDOR_STRING); + + if (dmxGeneration == 1) { + dmxLog(dmxInfo, "DMX Build OS: %s (%s)\n", OSNAME, OSVENDOR); + dmxLog(dmxInfo, "DMX Build Compiler: %s\n", dmxBuildCompiler()); + dmxLog(dmxInfo, "DMX Execution OS: %s\n", dmxExecOS()); + dmxLog(dmxInfo, "DMX Execution Host: %s\n", dmxExecHost()); + } + dmxLog(dmxInfo, "MAXSCREENS: %d\n", MAXSCREENS); + + for (i = 0; i < dmxNumScreens; i++) { + if (dmxScreens[i].beDisplay) + dmxLog(dmxWarning, "Display \"%s\" still open\n", + dmxScreens[i].name); + dmxStatFree(dmxScreens[i].stat); + dmxScreens[i].stat = NULL; + } + for (i = 0; i < dmxNumInputs; i++) dmxInputFree(&dmxInputs[i]); + if (dmxScreens) free(dmxScreens); + if (dmxInputs) free(dmxInputs); + dmxScreens = NULL; + dmxInputs = NULL; + dmxNumScreens = 0; + dmxNumInputs = 0; + } + + /* Make sure that the command-line arguments are sane. */ + if (dmxAddRemoveScreens && (!dmxNoRender || dmxGLXProxy)) { + /* Currently it is not possible to support GLX and Render + * extensions with dynamic screen addition/removal due to the + * state that each extension keeps, which cannot be restored. */ + dmxLog(dmxWarning, + "GLX Proxy and Render extensions do not yet support dynamic\n"); + dmxLog(dmxWarning, + "screen addition and removal. Please specify -noglxproxy\n"); + dmxLog(dmxWarning, + "and -norender on the command line or in the configuration\n"); + dmxLog(dmxWarning, + "file to disable these two extensions if you wish to use\n"); + dmxLog(dmxWarning, + "the dynamic addition and removal of screens support.\n"); + dmxLog(dmxFatal, + "Dynamic screen addition/removal error (see above).\n"); + } + + /* ddxProcessArgument has been called at this point, but any data + * from the configuration file has not been applied. Do so, and be + * sure we have at least one back-end display. */ + dmxConfigConfigure(); + if (!dmxNumScreens) + dmxLog(dmxFatal, "InitOutput: no back-end displays found\n"); + if (!dmxNumInputs) + dmxLog(dmxInfo, "InitOutput: no inputs found\n"); + + /* Disable lazy window creation optimization if offscreen + * optimization is disabled */ + if (!dmxOffScreenOpt && dmxLazyWindowCreation) { + dmxLog(dmxInfo, + "InitOutput: Disabling lazy window creation optimization\n"); + dmxLog(dmxInfo, + " since it requires the offscreen optimization\n"); + dmxLog(dmxInfo, + " to function properly.\n"); + dmxLazyWindowCreation = FALSE; + } + + /* Open each display and gather information about it. */ + for (i = 0; i < dmxNumScreens; i++) + dmxDisplayInit(&dmxScreens[i]); + +#ifdef PANORAMIX + /* Register a Xinerama callback which will run from within + * PanoramiXCreateConnectionBlock. We can use the callback to + * determine if Xinerama is loaded and to check the visuals + * determined by PanoramiXConsolidate. */ + XineramaRegisterConnectionBlockCallback(dmxConnectionBlockCallback); +#endif + + /* Since we only have a single screen thus far, we only need to set + the pixmap formats to match that screen. FIXME: this isn't true.*/ + if (!dmxSetPixmapFormats(pScreenInfo, &dmxScreens[0])) return; + + /* Might want to install a signal handler to allow cleaning up after + * unexpected signals. The DIX/OS layer already handles SIGINT and + * SIGTERM, so everything is OK for expected signals. --DD + * + * SIGHUP, SIGINT, and SIGTERM are trapped in os/connection.c + * SIGQUIT is another common signal that is sent from the keyboard. + * Trap it here, to ensure that the keyboard modifier map and other + * state for the input devices are restored. (This makes the + * behavior of SIGQUIT somewhat unexpected, since it will be the + * same as the behavior of SIGINT. However, leaving the modifier + * map of the input devices empty is even more unexpected.) --RF + */ + OsSignal(SIGQUIT, GiveUp); + +#ifdef GLXPROXY + /* Check if GLX extension exists on all back-end servers */ + for (i = 0; i < dmxNumScreens; i++) + glxSupported &= (dmxScreens[i].glxMajorOpcode > 0); +#endif + + /* Tell dix layer about the backend displays */ + for (i = 0; i < dmxNumScreens; i++) { + +#ifdef GLXPROXY + if (glxSupported) { + /* + * Builds GLX configurations from the list of visuals + * supported by the back-end server, and give that + * configuration list to the glx layer - so that he will + * build the visuals accordingly. + */ + + DMXScreenInfo *dmxScreen = &dmxScreens[i]; + __GLXvisualConfig *configs = NULL; + dmxGlxVisualPrivate **configprivs = NULL; + int nconfigs = 0; + int (*oldErrorHandler)(Display *, XErrorEvent *); + int i; + + /* Catch errors if when using an older GLX w/o FBconfigs */ + oldErrorHandler = XSetErrorHandler(dmxNOPErrorHandler); + + /* Get FBConfigs of the back-end server */ + dmxScreen->fbconfigs = GetGLXFBConfigs(dmxScreen->beDisplay, + dmxScreen->glxMajorOpcode, + &dmxScreen->numFBConfigs); + + XSetErrorHandler(oldErrorHandler); + + dmxScreen->glxVisuals = + GetGLXVisualConfigs(dmxScreen->beDisplay, + DefaultScreen(dmxScreen->beDisplay), + &dmxScreen->numGlxVisuals); + + if (dmxScreen->fbconfigs) { + configs = + GetGLXVisualConfigsFromFBConfigs(dmxScreen->fbconfigs, + dmxScreen->numFBConfigs, + dmxScreen->beVisuals, + dmxScreen->beNumVisuals, + dmxScreen->glxVisuals, + dmxScreen->numGlxVisuals, + &nconfigs); + } else { + configs = dmxScreen->glxVisuals; + nconfigs = dmxScreen->numGlxVisuals; + } + + configprivs = xalloc(dmxScreen->beNumVisuals * + sizeof(dmxGlxVisualPrivate*)); + + if (configs != NULL && configprivs != NULL) { + + /* Initialize our private info for each visual + * (currently only x_visual_depth and x_visual_class) + */ + for (i = 0; i < nconfigs; i++) { + + configprivs[i] = (dmxGlxVisualPrivate *) + xalloc(sizeof(dmxGlxVisualPrivate)); + configprivs[i]->x_visual_depth = 0; + configprivs[i]->x_visual_class = 0; + + /* Find the visual depth */ + if (configs[i].vid > 0) { + int j; + for (j = 0; j < dmxScreen->beNumVisuals; j++) { + if (dmxScreen->beVisuals[j].visualid == + configs[i].vid) { + configprivs[i]->x_visual_depth = + dmxScreen->beVisuals[j].depth; + configprivs[i]->x_visual_class = + dmxScreen->beVisuals[j].class; + break; + } + } + } + } + + /* Hand out the glx configs to glx extension */ + GlxSetVisualConfigs(nconfigs, configs, (void**)configprivs); + } + } +#endif /* GLXPROXY */ + + AddScreen(dmxScreenInit, argc, argv); + } + + /* Compute origin information. */ + dmxInitOrigins(); + + /* Compute overlap information. */ + dmxInitOverlap(); + + /* Make sure there is a global width/height available */ + dmxComputeWidthHeight(DMX_NO_RECOMPUTE_BOUNDING_BOX); + + /* FIXME: The following is temporarily placed here. When the DMX + * extension is available, it will be move there. + */ + dmxInitFonts(); + +#ifdef RENDER + /* Initialize the render extension */ + if (!dmxNoRender) + dmxInitRender(); +#endif + + /* Initialized things that need timer hooks */ + dmxStatInit(); + dmxSyncInit(); /* Calls RegisterBlockAndWakeupHandlers */ + + dmxLog(dmxInfo, "Shadow framebuffer support %s\n", + dmxShadowFB ? "enabled" : "disabled"); +} + +/* RATS: Assuming the fp string (which comes from the command-line argv + vector) is NULL-terminated, the buffer is large enough for the + strcpy. */ +static void dmxSetDefaultFontPath(char *fp) +{ + int fplen = strlen(fp) + 1; + + if (dmxFontPath) { + int len; + + len = strlen(dmxFontPath); + dmxFontPath = xrealloc(dmxFontPath, len+fplen+1); + dmxFontPath[len] = ','; + strncpy(&dmxFontPath[len+1], fp, fplen); + } else { + dmxFontPath = xalloc(fplen); + strncpy(dmxFontPath, fp, fplen); + } + + defaultFontPath = dmxFontPath; +} + +/** This function is called in Xserver/os/utils.c from \a AbortServer(). + * We must ensure that backend and console state is restored in the + * event the server shutdown wasn't clean. */ +void AbortDDX(void) +{ + int i; + + for (i=0; i < dmxNumScreens; i++) { + DMXScreenInfo *dmxScreen = &dmxScreens[i]; + + if (dmxScreen->beDisplay) XCloseDisplay(dmxScreen->beDisplay); + dmxScreen->beDisplay = NULL; + } +} + +/** This function is called in Xserver/dix/main.c from \a main() when + * dispatchException & DE_TERMINATE (which is the only way to exit the + * main loop without an interruption. */ +void ddxGiveUp(void) +{ + AbortDDX(); +} + +/** This function is called in Xserver/os/osinit.c from \a OsInit(). */ +void OsVendorPreInit(void) +{ +} + +/** This function is called in Xserver/os/osinit.c from \a OsInit(). */ +void OsVendorInit(void) +{ +} + +/** This function is called in Xserver/os/utils.c from \a FatalError() + * and \a VFatalError(). (Note that setting the function pointer \a + * OsVendorVErrorFProc will cause \a VErrorF() (which is called by the + * two routines mentioned here, as well as by others) to use the + * referenced routine instead of \a vfprintf().) */ +void OsVendorFatalError(void) +{ +} + +#if 0 +/** This funciton is called by InitGlobals from Xserver/os/utils.c to + * initialize any ddx specific globals at a very early point in the + * server startup. */ +void ddxInitGlobals(void) +{ +} +#endif + +/** Process our command line arguments. */ +int ddxProcessArgument(int argc, char *argv[], int i) +{ + int retval = 0; + + if (!strcmp(argv[i], "-display")) { + if (++i < argc) dmxConfigStoreDisplay(argv[i]); + retval = 2; + } else if (!strcmp(argv[i], "-inputfrom") || !strcmp(argv[i], "-input")) { + if (++i < argc) dmxConfigStoreInput(argv[i]); + retval = 2; + } else if (!strcmp(argv[i], "-xinputfrom") || !strcmp(argv[i],"-xinput")) { + if (++i < argc) dmxConfigStoreXInput(argv[i]); + retval = 2; + } else if (!strcmp(argv[i], "-noshadowfb")) { + dmxLog(dmxWarning, + "-noshadowfb has been deprecated " + "since it is now the default\n"); + dmxShadowFB = FALSE; + retval = 1; + } else if (!strcmp(argv[i], "-nomulticursor")) { + dmxCursorNoMulti(); + retval = 1; + } else if (!strcmp(argv[i], "-shadowfb")) { + dmxShadowFB = TRUE; + retval = 1; + } else if (!strcmp(argv[i], "-configfile")) { + if (++i < argc) dmxConfigStoreFile(argv[i]); + retval = 2; + } else if (!strcmp(argv[i], "-config")) { + if (++i < argc) dmxConfigStoreConfig(argv[i]); + retval = 2; + } else if (!strcmp(argv[i], "-fontpath")) { + if (++i < argc) dmxSetDefaultFontPath(argv[i]); + retval = 2; + } else if (!strcmp(argv[i], "-stat")) { + if ((i += 2) < argc) dmxStatActivate(argv[i-1], argv[i]); + retval = 3; + } else if (!strcmp(argv[i], "-syncbatch")) { + if (++i < argc) dmxSyncActivate(argv[i]); + retval = 2; + } else if (!strcmp(argv[i], "-nooffscreenopt")) { + dmxOffScreenOpt = FALSE; + retval = 1; + } else if (!strcmp(argv[i], "-nosubdivprims")) { + dmxSubdividePrimitives = FALSE; + retval = 1; + } else if (!strcmp(argv[i], "-nowindowopt")) { + dmxLazyWindowCreation = FALSE; + retval = 1; + } else if (!strcmp(argv[i], "-noxkb")) { + dmxUseXKB = FALSE; + retval = 1; + } else if (!strcmp(argv[i], "-depth")) { + if (++i < argc) dmxDepth = atoi(argv[i]); + retval = 2; + } else if (!strcmp(argv[i], "-norender")) { + dmxNoRender = TRUE; + retval = 1; +#ifdef GLXPROXY + } else if (!strcmp(argv[i], "-noglxproxy")) { + dmxGLXProxy = FALSE; + retval = 1; + } else if (!strcmp(argv[i], "-noglxswapgroup")) { + dmxGLXSwapGroupSupport = FALSE; + retval = 1; + } else if (!strcmp(argv[i], "-glxsyncswap")) { + dmxGLXSyncSwap = TRUE; + retval = 1; + } else if (!strcmp(argv[i], "-glxfinishswap")) { + dmxGLXFinishSwap = TRUE; + retval = 1; +#endif + } else if (!strcmp(argv[i], "-ignorebadfontpaths")) { + dmxIgnoreBadFontPaths = TRUE; + retval = 1; + } else if (!strcmp(argv[i], "-addremovescreens")) { + dmxAddRemoveScreens = TRUE; + retval = 1; + } else if (!strcmp(argv[i], "-param")) { + if ((i += 2) < argc) { + if (!strcasecmp(argv[i-1], "xkbrules")) + dmxConfigSetXkbRules(argv[i]); + else if (!strcasecmp(argv[i-1], "xkbmodel")) + dmxConfigSetXkbModel(argv[i]); + else if (!strcasecmp(argv[i-1], "xkblayout")) + dmxConfigSetXkbLayout(argv[i]); + else if (!strcasecmp(argv[i-1], "xkbvariant")) + dmxConfigSetXkbVariant(argv[i]); + else if (!strcasecmp(argv[i-1], "xkboptions")) + dmxConfigSetXkbOptions(argv[i]); + else + dmxLog(dmxWarning, + "-param requires: XkbRules, XkbModel, XkbLayout," + " XkbVariant, or XkbOptions\n"); + } + retval = 3; + } + if (!serverGeneration) dmxConfigSetMaxScreens(); + return retval; +} + +/** Provide succinct usage information for the DMX server. */ +void ddxUseMsg(void) +{ + ErrorF("\n\nDevice Dependent Usage:\n"); + ErrorF("-display string Specify the back-end display(s)\n"); + ErrorF("-input string Specify input source for core device\n"); + ErrorF("-xinput string Specify input source for XInput device\n"); + ErrorF("-shadowfb Enable shadow frame buffer\n"); + ErrorF("-configfile file Read from a configuration file\n"); + ErrorF("-config config Select a specific configuration\n"); + ErrorF("-nomulticursor Turn of multiple cursor support\n"); + ErrorF("-fontpath Sets the default font path\n"); + ErrorF("-stat inter scrns Print out performance statistics\n"); + ErrorF("-syncbatch inter Set interval for XSync batching\n"); + ErrorF("-nooffscreenopt Disable offscreen optimization\n"); + ErrorF("-nosubdivprims Disable primitive subdivision\n"); + ErrorF(" optimization\n"); + ErrorF("-nowindowopt Disable lazy window creation optimization\n"); + ErrorF("-noxkb Disable use of the XKB extension with\n"); + ErrorF(" backend displays (cf. -kb).\n"); + ErrorF("-depth Specify the default root window depth\n"); + ErrorF("-norender Disable RENDER extension support\n"); +#ifdef GLXPROXY + ErrorF("-noglxproxy Disable GLX Proxy\n"); + ErrorF("-noglxswapgroup Disable swap group and swap barrier\n"); + ErrorF(" extensions in GLX proxy\n"); + ErrorF("-glxsyncswap Force XSync after swap buffers\n"); + ErrorF("-glxfinishswap Force glFinish after swap buffers\n"); +#endif + ErrorF("-ignorebadfontpaths Ignore bad font paths during initialization\n"); + ErrorF("-addremovescreens Enable dynamic screen addition/removal\n"); + ErrorF("-param ... Specify configuration parameters (e.g.,\n"); + ErrorF(" XkbRules, XkbModel, XkbLayout, etc.)\n"); + ErrorF("\n"); + ErrorF(" If the -input string matches a -display string, then input\n" + " is taken from that backend display. (XInput cannot be taken\n" + " from a backend display.) Placing \",console\" after the\n" + " display name will force a console window to be opened on\n" + " that display in addition to the backend input. This is\n" + " useful if the backend window does not cover the whole\n" + " physical display.\n\n"); + + ErrorF(" Otherwise, if the -input or -xinput string specifies another\n" + " X display, then a console window will be created on that\n" + " display. Placing \",windows\" or \",nowindows\" after the\n" + " display name will control the display of window outlines in\n" + " the console.\n\n"); + + ErrorF(" -input or -xinput dummy specifies no input.\n"); + ErrorF(" -input or -xinput local specifies the use of a raw keyboard,\n" + " mouse, or other (extension) device:\n" + " -input local,kbd,ps2 will use a ps2 mouse\n" + " -input local,kbd,ms will use a serial mouse\n" + " -input local,usb-kbd,usb-mou will use USB devices \n" + " -xinput local,usb-oth will use a non-mouse and\n" + " non-keyboard USB device with XInput\n\n"); + + ErrorF(" Special Keys:\n"); + ErrorF(" Ctrl-Alt-g Server grab/ungrab (console only)\n"); + ErrorF(" Ctrl-Alt-f Fine (1-pixel) mouse mode (console only)\n"); + ErrorF(" Ctrl-Alt-q Quit (core devices only)\n"); + ErrorF(" Ctrl-Alt-F* Switch to VC (local only)\n"); +} + +#ifdef DDXTIME +/** Return wall-clock time in milliseconds. */ +CARD32 GetTimeInMillis(void) +{ + struct timeval tp; + + gettimeofday(&tp, 0); + return tp.tv_sec * 1000 + tp.tv_usec / 1000; +} +#endif + +#ifdef __DARWIN__ +void +DarwinHandleGUI(int argc, char *argv[]) +{ +} +#endif Index: xc/programs/Xserver/hw/dmx/dmxinit.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxinit.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxinit.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,51 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxinit.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2004 Red Hat Inc., Raleigh, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +/** \file + * Interface for initialization. \see dmxinit.c */ + +#ifndef DMXINIT_H +#define DMXINIT_H + +#include "scrnintstr.h" + +extern Bool dmxOpenDisplay(DMXScreenInfo *dmxScreen); +extern void dmxSetErrorHandler(DMXScreenInfo *dmxScreen); +extern void dmxCheckForWM(DMXScreenInfo *dmxScreen); +extern void dmxGetScreenAttribs(DMXScreenInfo *dmxScreen); +extern Bool dmxGetVisualInfo(DMXScreenInfo *dmxScreen); +extern void dmxGetColormaps(DMXScreenInfo *dmxScreen); +extern void dmxGetPixmapFormats(DMXScreenInfo *dmxScreen); + +#endif /* DMXINIT_H */ Index: xc/programs/Xserver/hw/dmx/dmxinput.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxinput.c:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxinput.c Wed Jun 30 16:21:39 2004 @@ -0,0 +1,101 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxinput.c,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * David H. Dawes + * Kevin E. Martin + * Rickard E. (Rik) Faith + * + */ + +/** \file + * Provide the main entry points for input initialization and processing + * that arequired by the dix layer. + */ + +#include "dmx.h" +#include "dmxlog.h" +#include "dmxinput.h" + +#include "inputstr.h" +#include "input.h" + +/** Returns TRUE if the key is a valid modifier. For PC-class + * keyboards, all keys can be used as modifiers, so return TRUE + * always. */ +Bool LegalModifier(unsigned int key, DevicePtr pDev) +{ + return TRUE; +} + +/** Called from dix/main.c on each server generation to initialize + * inputs. All the work is done in dmxInputInit. \see + * dmxInputInit() */ +void InitInput(int argc, char **argv) +{ + int i; + DMXInputInfo *dmxInput; + + if (!dmxNumInputs) + dmxLog(dmxFatal, "InitInput: no inputs specified\n"); + + for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) + dmxInputInit(dmxInput); + if (!dmxeqInitialized()) { + dmxLog(dmxWarning, "Use keyboard/mouse pair with the first -input\n"); + dmxLog(dmxFatal, "At least one core keyboard/mouse pair required\n"); + } +} + +/** Called from dix/dispatch.c in Dispatch() whenever input events + * require processing. All the work is done in the lower level + * routines. */ +void ProcessInputEvents(void) +{ + int i; + DMXInputInfo *dmxInput; + + for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) + if (!dmxInput->detached && dmxInput->processInputEvents) + dmxInput->processInputEvents(dmxInput); +} + +/** This routine is called from #dmxwindow.c whenever the layout of + * windows on the display might have changed. This information is used + * by input drivers (currently only the console driver) that provide + * information about window layout to the user. */ +void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow) +{ + int i; + DMXInputInfo *dmxInput; + + for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) + if (!dmxInput->detached && dmxInput->updateWindowInfo) + dmxInput->updateWindowInfo(dmxInput, type, pWindow); +} Index: xc/programs/Xserver/hw/dmx/dmxinput.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxinput.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxinput.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,163 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxinput.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * David H. Dawes + * Kevin E. Martin + * Rickard E. (Rik) Faith + * + */ + +/** \file + * This file provides access to: + * - global variables available to all hw/dmx routines, and + * - enumerations and typedefs needed by input routines in hw/dmx (and + * hw/dmx/input). + * + * The goal is that no files in hw/dmx should include header files from + * hw/dmx/input -- the interface defined here should be the only + * interface exported to the hw/dmx layer. \see input/dmxinputinit.c. + */ + +#ifndef DMXINPUT_H +#define DMXINPUT_H + +/** Maximum number of file descriptors for SIGIO handling */ +#define DMX_MAX_SIGIO_FDS 4 + +struct _DMXInputInfo; + +/** Reason why window layout was updated. */ +typedef enum { + DMX_UPDATE_REALIZE, /**< Window realized */ + DMX_UPDATE_UNREALIZE, /**< Window unrealized */ + DMX_UPDATE_RESTACK, /**< Stacking order changed */ + DMX_UPDATE_COPY, /**< Window copied */ + DMX_UPDATE_RESIZE, /**< Window resized */ + DMX_UPDATE_REPARENT /**< Window reparented */ +} DMXUpdateType; + +typedef void (*ProcessInputEventsProc)(struct _DMXInputInfo *); +typedef void (*UpdateWindowInfoProc)(struct _DMXInputInfo *, + DMXUpdateType, WindowPtr); + +/** An opaque structure that is only exposed in the dmx/input layer. */ +typedef struct _DMXLocalInputInfo *DMXLocalInputInfoPtr; + +/** State of the SIGIO engine */ +typedef enum { + DMX_NOSIGIO = 0, /**< Device does not use SIGIO at all. */ + DMX_USESIGIO, /**< Device can use SIGIO, but is not + * (e.g., because the VT is switch + * away). */ + DMX_ACTIVESIGIO /**< Device is currently using SIGIO. */ +} dmxSigioState; + +/** DMXInputInfo is typedef'd in #dmx.h so that all routines can have + * access to the global pointers. However, the elements are only + * available to input-related routines. */ +struct _DMXInputInfo { + const char *name; /**< Name of input display or device + * (from command line or config + * file) */ + Bool freename; /**< If true, free name on destroy */ + Bool detached; /**< If true, input screen is detached */ + int inputIdx; /**< Index into #dmxInputs global */ + int scrnIdx; /**< Index into #dmxScreens global */ + Bool core; /**< If True, initialize these + * devices as devices that send core + * events */ + Bool console; /**< True if console and backend + * input share the same backend + * display */ + + Bool windows; /**< True if window outlines are + * draw in console */ + + ProcessInputEventsProc processInputEvents; + UpdateWindowInfoProc updateWindowInfo; + + /* Local input information */ + dmxSigioState sigioState; /**< Current stat */ + int sigioFdCount; /**< Number of fds in use */ + int sigioFd[DMX_MAX_SIGIO_FDS]; /**< List of fds */ + Bool sigioAdded[DMX_MAX_SIGIO_FDS]; /**< Active fds */ + + + /** True if a VT switch is pending, but has not yet happened. */ + int vt_switch_pending; + + /** True if a VT switch has happened. */ + int vt_switched; + + /** Number of devices handled in this _DMXInputInfo structure. */ + int numDevs; + + /** List of actual input devices. Each _DMXInputInfo structure can + * refer to more than one device. For example, the keyboard and the + * pointer of a backend display; or all of the XInput extension + * devices on a backend display. */ + DMXLocalInputInfoPtr *devs; + + char *keycodes; /**< XKB keycodes from command line */ + char *symbols; /**< XKB symbols from command line */ + char *geometry; /**< XKB geometry from command line */ +}; + +extern int dmxNumInputs; /**< Number of #dmxInputs */ +extern DMXInputInfo *dmxInputs; /**< List of inputs */ + +extern void dmxInputInit(DMXInputInfo *dmxInput); +extern void dmxInputReInit(DMXInputInfo *dmxInput); +extern void dmxInputLateReInit(DMXInputInfo *dmxInput); +extern void dmxInputFree(DMXInputInfo *dmxInput); +extern void dmxInputLogDevices(void); +extern void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow); + +/* These functions are defined in input/dmxeq.c */ +extern Bool dmxeqInitialized(void); +extern void dmxeqEnqueue(xEvent *e); +extern void dmxeqSwitchScreen(ScreenPtr pScreen, Bool fromDIX); + +/* This type is used in input/dmxevents.c. Also, these functions are + * defined in input/dmxevents.c */ +typedef enum { + DMX_NO_BLOCK = 0, + DMX_BLOCK = 1 +} DMXBlockType; + +extern void dmxGetGlobalPosition(int *x, int *y); +extern DMXScreenInfo *dmxFindFirstScreen(int x, int y); +extern void dmxCoreMotion(int x, int y, int delta, + DMXBlockType block); + +/* Support for dynamic addition of inputs. This functions is defined in + * config/dmxconfig.c */ +extern DMXInputInfo *dmxConfigAddInput(const char *name, int core); +#endif /* DMXINPUT_H */ Index: xc/programs/Xserver/hw/dmx/dmxlog.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxlog.c:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxlog.c Wed Jun 30 16:21:39 2004 @@ -0,0 +1,347 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxlog.c,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2001 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * This file encapsulated all of the logging functions that are used by + * DMX for informational, warning, and error messages. */ + +#include "dmx.h" +#include "dmxlog.h" +#include "dmxinput.h" +#ifdef XINPUT +#include "XI.h" +#include "XIproto.h" +#endif + +static dmxLogLevel dmxCurrentLogLevel = dmxDebug; + +/** Set the default level for logging to #dmxLogLevel. Returns the + * previous log level. */ +dmxLogLevel dmxSetLogLevel(dmxLogLevel newLevel) +{ + dmxLogLevel oldLevel = dmxCurrentLogLevel; + if (newLevel > dmxFatal) newLevel = dmxFatal; + dmxCurrentLogLevel = newLevel; + return oldLevel; +} + +/** Returns the log level set by #dmxLogLevel. */ +dmxLogLevel dmxGetLogLevel(void) +{ + return dmxCurrentLogLevel; +} + +#ifdef DMX_LOG_STANDALONE +/* When using this file as part of a stand-alone (i.e., non-X-Server + * program, then the ultimate output routines have to be defined. */ + +/** Provide an ErrorF function when used stand-alone. */ +void ErrorF(const char *format, ...) +{ + va_list args; + + va_start(args, format); + vfprintf(stderr, format, args); /* RATS: We assume the format string + * is trusted, since it is always + * from a log message in our code. */ + va_end(args); +} + +/** Provide an VFatalError function when used stand-alone. */ +static void VFatalError(const char *format, va_list args) +{ + vfprintf(stderr, format, args); /* RATS: We assume the format string + * is trusted, since it is always + * from a log message in our code. */ + exit(1); +} + +/** Provide an VErrorF function when used stand-alone. */ +void VErrorF(const char *format, va_list args) +{ + vfprintf(stderr, format, args); /* RATS: We assume the format string + * is trusted, since it is always + * from a log message in our code. */ +} +#else +/** This function was removed between XFree86 4.3.0 and XFree86 4.4.0. */ +extern void AbortServer(void); +static void VFatalError(const char *format, va_list args) +{ + VErrorF(format, args); + ErrorF("\n"); +#ifdef DDXOSFATALERROR + OsVendorFatalError(); +#endif + AbortServer(); + /*NOTREACHED*/ +} +#endif + +/* Prints a consistent header for each line. */ +static void dmxHeader(dmxLogLevel logLevel, DMXInputInfo *dmxInput, + DMXScreenInfo *dmxScreen) +{ + const char *type = "??"; + + switch (logLevel) { + case dmxDebug: type = ".."; break; + case dmxInfo: type = "II"; break; + case dmxWarning: type = "**"; break; + case dmxError: type = "!!"; break; + case dmxFatal: type = "Fatal Error"; break; + } + + if (dmxInput && dmxScreen) { + ErrorF("(%s) dmx[i%d/%s;o%d/%s]: ", type, + dmxInput->inputIdx, dmxInput->name, + dmxScreen->index, dmxScreen->name); + } else if (dmxScreen) { + ErrorF("(%s) dmx[o%d/%s]: ", type, + dmxScreen->index, dmxScreen->name); + } else if (dmxInput) { + const char *pt = strchr(dmxInput->name, ','); + int len = (pt + ? (size_t)(pt-dmxInput->name) + : strlen(dmxInput->name)); + + ErrorF("(%s) dmx[i%d/%*.*s]: ", type, + dmxInput->inputIdx, len, len, dmxInput->name); + } else { + ErrorF("(%s) dmx: ", type); + } +} + +/* Prints the error message with the appropriate low-level X output + * routine. */ +static void dmxMessage(dmxLogLevel logLevel, const char *format, va_list args) +{ + if (logLevel == dmxFatal || logLevel >= dmxCurrentLogLevel) { + if (logLevel == dmxFatal) VFatalError(format, args); + else VErrorF(format, args); + } +} + +/** Log the specified message at the specified \a logLevel. \a format + * can be a printf-like format expression. */ +void dmxLog(dmxLogLevel logLevel, const char *format, ...) +{ + va_list args; + + dmxHeader(logLevel, NULL, NULL); + va_start(args, format); + dmxMessage(logLevel, format, args); + va_end(args); +} + +/** Continue a log message without printing the message prefix. */ +void dmxLogCont(dmxLogLevel logLevel, const char *format, ...) +{ + va_list args; + + va_start(args, format); + dmxMessage(logLevel, format, args); + va_end(args); +} + +#ifndef DMX_LOG_STANDALONE +/** Log an informational message (at level #dmxInfo) related to ouput. + * The message prefix will contain backend information from \a + * dmxScreen. */ +void dmxLogOutput(DMXScreenInfo *dmxScreen, const char *format, ...) +{ + va_list args; + + dmxHeader(dmxInfo, NULL, dmxScreen); + va_start(args, format); + dmxMessage(dmxInfo, format, args); + va_end(args); +} + +/** Continue a message related to output without printing the message + * prefix. */ +void dmxLogOutputCont(DMXScreenInfo *dmxScreen, const char *format, ...) +{ + va_list args; + + va_start(args, format); + dmxMessage(dmxInfo, format, args); + va_end(args); +} + +/** Log a warning message (at level #dmxWarning) related to output. + * The message prefix will contain backend information from \a + * dmxScreen. */ +void dmxLogOutputWarning(DMXScreenInfo *dmxScreen, const char *format, ...) +{ + va_list args; + + dmxHeader(dmxWarning, NULL, dmxScreen); + va_start(args, format); + dmxMessage(dmxWarning, format, args); + va_end(args); +} + +/** Log an informational message (at level #dmxInfo) related to input. + * The message prefix will contain information from \a dmxInput. */ +void dmxLogInput(DMXInputInfo *dmxInput, const char *format, ...) +{ + va_list args; + + dmxHeader(dmxInfo, dmxInput, NULL); + va_start(args, format); + dmxMessage(dmxInfo, format, args); + va_end(args); +} + +/** Continue a message related to input without printing the message + * prefix. */ +void dmxLogInputCont(DMXInputInfo *dmxInput, const char *format, ...) +{ + va_list args; + + va_start(args, format); + dmxMessage(dmxInfo, format, args); + va_end(args); +} + +/** Print \a argc messages, each describing an element in \a argv. This + * is maingly for debugging purposes. */ +void dmxLogArgs(dmxLogLevel logLevel, int argc, char **argv) +{ + int i; + for (i = 0; i < argc; i++) + dmxLog(logLevel, " Arg[%d] = \"%s\"\n", i, argv[i]); +} + +/** Print messages at level #dmxInfo describing the visuals in \a vi. */ +void dmxLogVisual(DMXScreenInfo *dmxScreen, XVisualInfo *vi, int defaultVisual) +{ + const char *class = "Unknown"; + + switch (vi->class) { + case StaticGray: class = "StaticGray "; break; + case GrayScale: class = "GrayScale "; break; + case StaticColor: class = "StaticColor"; break; + case PseudoColor: class = "PseudoColor"; break; + case TrueColor: class = "TrueColor "; break; + case DirectColor: class = "DirectColor"; break; + } + + if (dmxScreen) { + dmxLogOutput(dmxScreen, + "0x%02x %s %2db %db/rgb %3d 0x%04x 0x%04x 0x%04x%s\n", + vi->visualid, class, vi->depth, vi->bits_per_rgb, + vi->colormap_size, + vi->red_mask, vi->green_mask, vi->blue_mask, + defaultVisual ? " *" : ""); + } else { + dmxLog(dmxInfo, + " 0x%02x %s %2db %db/rgb %3d 0x%04x 0x%04x 0x%04x%s\n", + vi->visualid, class, vi->depth, vi->bits_per_rgb, + vi->colormap_size, + vi->red_mask, vi->green_mask, vi->blue_mask, + defaultVisual ? " *" : ""); + } +} + +#ifdef XINPUT +/** Translate a (normalized) XInput event \a type into a human-readable + * string. */ +const char *dmxXInputEventName(int type) +{ + switch (type) { + case XI_DeviceValuator: return "XI_DeviceValuator"; + case XI_DeviceKeyPress: return "XI_DeviceKeyPress"; + case XI_DeviceKeyRelease: return "XI_DeviceKeyRelease"; + case XI_DeviceButtonPress: return "XI_DeviceButtonPress"; + case XI_DeviceButtonRelease: return "XI_DeviceButtonRelease"; + case XI_DeviceMotionNotify: return "XI_DeviceMotionNotify"; + case XI_DeviceFocusIn: return "XI_DeviceFocusIn"; + case XI_DeviceFocusOut: return "XI_DeviceFocusOut"; + case XI_ProximityIn: return "XI_ProximityIn"; + case XI_ProximityOut: return "XI_ProximityOut"; + case XI_DeviceStateNotify: return "XI_DeviceStateNotify"; + case XI_DeviceMappingNotify: return "XI_DeviceMappingNotify"; + case XI_ChangeDeviceNotify: return "XI_ChangeDeviceNotify"; + case XI_DeviceKeystateNotify: return "XI_DeviceKeystateNotify"; + case XI_DeviceButtonstateNotify: return "XI_DeviceButtonstateNotify"; + default: return "unknown"; + } +} + +#endif +#endif + +/** Translate an event \a type into a human-readable string. */ +const char *dmxEventName(int type) +{ + switch (type) { + case KeyPress: return "KeyPress"; + case KeyRelease: return "KeyRelease"; + case ButtonPress: return "ButtonPress"; + case ButtonRelease: return "ButtonRelease"; + case MotionNotify: return "MotionNotify"; + case EnterNotify: return "EnterNotify"; + case LeaveNotify: return "LeaveNotify"; + case FocusIn: return "FocusIn"; + case FocusOut: return "FocusOut"; + case KeymapNotify: return "KeymapNotify"; + case Expose: return "Expose"; + case GraphicsExpose: return "GraphicsExpose"; + case NoExpose: return "NoExpose"; + case VisibilityNotify: return "VisibilityNotify"; + case CreateNotify: return "CreateNotify"; + case DestroyNotify: return "DestroyNotify"; + case UnmapNotify: return "UnmapNotify"; + case MapNotify: return "MapNotify"; + case MapRequest: return "MapRequest"; + case ReparentNotify: return "ReparentNotify"; + case ConfigureNotify: return "ConfigureNotify"; + case ConfigureRequest: return "ConfigureRequest"; + case GravityNotify: return "GravityNotify"; + case ResizeRequest: return "ResizeRequest"; + case CirculateNotify: return "CirculateNotify"; + case CirculateRequest: return "CirculateRequest"; + case PropertyNotify: return "PropertyNotify"; + case SelectionClear: return "SelectionClear"; + case SelectionRequest: return "SelectionRequest"; + case SelectionNotify: return "SelectionNotify"; + case ColormapNotify: return "ColormapNotify"; + case ClientMessage: return "ClientMessage"; + case MappingNotify: return "MappingNotify"; + default: return ""; + } +} + Index: xc/programs/Xserver/hw/dmx/dmxlog.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxlog.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxlog.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,79 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxlog.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2001 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * This header is included by all files that need to use the DMX logging + * facilities. */ + +#ifndef _DMXLOG_H_ +#define _DMXLOG_H_ + +/** Logging levels -- output is tunable with #dmxSetLogLevel. */ +typedef enum { + dmxDebug, /**< Usually verbose debugging info */ + dmxInfo, /**< Non-warning information */ + dmxWarning, /**< A warning that may indicate DMX + * will not function as the user + * intends. */ + dmxError, /**< A non-fatal error that probably + * indicates DMX will not function as + * desired.*/ + dmxFatal /**< A fatal error that will cause DMX + * to shut down. */ +} dmxLogLevel; + +/* Logging functions used by Xserver/hw/dmx routines. */ +extern dmxLogLevel dmxSetLogLevel(dmxLogLevel newLevel); +extern dmxLogLevel dmxGetLogLevel(void); +extern void dmxLog(dmxLogLevel logLevel, const char *format, ...); +extern void dmxLogCont(dmxLogLevel logLevel, const char *format, ...); +extern const char *dmxEventName(int type); + +#ifndef DMX_LOG_STANDALONE +extern void dmxLogOutput(DMXScreenInfo *dmxScreen, const char *format, ...); +extern void dmxLogOutputCont(DMXScreenInfo *dmxScreen, const char *format, + ...); +extern void dmxLogOutputWarning(DMXScreenInfo *dmxScreen, const char *format, + ...); +extern void dmxLogInput(DMXInputInfo *dmxInput, const char *format, ...); +extern void dmxLogInputCont(DMXInputInfo *dmxInput, const char *format, ...); +extern void dmxLogArgs(dmxLogLevel logLevel, int argc, char **argv); +extern void dmxLogVisual(DMXScreenInfo *dmxScreen, XVisualInfo *vi, + int defaultVisual); +#ifdef XINPUT +extern const char *dmxXInputEventName(int type); +#endif +#endif + +#endif Index: xc/programs/Xserver/hw/dmx/dmxpict.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxpict.c:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxpict.c Wed Jun 30 16:21:39 2004 @@ -0,0 +1,1293 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxpict.c,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +/** \file + * Provide support for the RENDER extension (version 0.8). + */ + +#include "dmx.h" +#include "dmxsync.h" +#include "dmxpict.h" +#include "dmxwindow.h" +#include "dmxpixmap.h" + +#include "fb.h" +#include "pixmapstr.h" +#include "dixstruct.h" + +#include "render.h" +#include "renderproto.h" +#include "picture.h" +#include "picturestr.h" +#include "mipict.h" +#include "fbpict.h" + + +extern int RenderErrBase; +extern int (*ProcRenderVector[RenderNumberRequests])(ClientPtr); + +static int (*dmxSaveRenderVector[RenderNumberRequests])(ClientPtr); + + +static int dmxProcRenderCreateGlyphSet(ClientPtr client); +static int dmxProcRenderFreeGlyphSet(ClientPtr client); +static int dmxProcRenderAddGlyphs(ClientPtr client); +static int dmxProcRenderFreeGlyphs(ClientPtr client); +static int dmxProcRenderCompositeGlyphs(ClientPtr client); +static int dmxProcRenderSetPictureTransform(ClientPtr client); +static int dmxProcRenderSetPictureFilter(ClientPtr client); +#if 0 +/* FIXME: Not (yet) supported */ +static int dmxProcRenderCreateCursor(ClientPtr client); +static int dmxProcRenderCreateAnimCursor(ClientPtr client); +#endif + +/** Catch errors that might occur when allocating Glyph Sets. Errors + * are saved in dmxGlyphLastError for later handling. */ +static int dmxGlyphLastError; +static int dmxGlyphErrorHandler(Display *dpy, XErrorEvent *ev) +{ + dmxGlyphLastError = ev->error_code; + return 0; +} + + +/** Initialize the Proc Vector for the RENDER extension. The functions + * here cannot be handled by the mi layer RENDER hooks either because + * the required information is no longer available when it reaches the + * mi layer or no mi layer hooks exist. This function is called from + * InitOutput() since it should be initialized only once per server + * generation. */ +void dmxInitRender(void) +{ + int i; + + for (i = 0; i < RenderNumberRequests; i++) + dmxSaveRenderVector[i] = ProcRenderVector[i]; + + ProcRenderVector[X_RenderCreateGlyphSet] + = dmxProcRenderCreateGlyphSet; + ProcRenderVector[X_RenderFreeGlyphSet] + = dmxProcRenderFreeGlyphSet; + ProcRenderVector[X_RenderAddGlyphs] + = dmxProcRenderAddGlyphs; + ProcRenderVector[X_RenderFreeGlyphs] + = dmxProcRenderFreeGlyphs; + ProcRenderVector[X_RenderCompositeGlyphs8] + = dmxProcRenderCompositeGlyphs; + ProcRenderVector[X_RenderCompositeGlyphs16] + = dmxProcRenderCompositeGlyphs; + ProcRenderVector[X_RenderCompositeGlyphs32] + = dmxProcRenderCompositeGlyphs; + ProcRenderVector[X_RenderSetPictureTransform] + = dmxProcRenderSetPictureTransform; + ProcRenderVector[X_RenderSetPictureFilter] + = dmxProcRenderSetPictureFilter; +} + +/** Reset the Proc Vector for the RENDER extension back to the original + * functions. This function is called from dmxCloseScreen() during the + * server reset (only for screen #0). */ +void dmxResetRender(void) +{ + int i; + + for (i = 0; i < RenderNumberRequests; i++) + ProcRenderVector[i] = dmxSaveRenderVector[i]; +} + +/** Initialize the RENDER extension, allocate the picture privates and + * wrap mi function hooks. If the shadow frame buffer is used, then + * call the appropriate fb initialization function. */ +Bool dmxPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + PictureScreenPtr ps; + + /* The shadow framebuffer only relies on FB to be initialized */ + if (dmxShadowFB) return fbPictureInit(pScreen, formats, nformats); + + if (!miPictureInit(pScreen, formats, nformats)) + return FALSE; + + if (!AllocatePicturePrivate(pScreen, dmxPictPrivateIndex, + sizeof(dmxPictPrivRec))) + return FALSE; + + ps = GetPictureScreen(pScreen); + + DMX_WRAP(CreatePicture, dmxCreatePicture, dmxScreen, ps); + DMX_WRAP(DestroyPicture, dmxDestroyPicture, dmxScreen, ps); + + DMX_WRAP(ChangePictureClip, dmxChangePictureClip, dmxScreen, ps); + DMX_WRAP(DestroyPictureClip, dmxDestroyPictureClip, dmxScreen, ps); + + DMX_WRAP(ChangePicture, dmxChangePicture, dmxScreen, ps); + DMX_WRAP(ValidatePicture, dmxValidatePicture, dmxScreen, ps); + + DMX_WRAP(Composite, dmxComposite, dmxScreen, ps); + DMX_WRAP(Glyphs, dmxGlyphs, dmxScreen, ps); + DMX_WRAP(CompositeRects, dmxCompositeRects, dmxScreen, ps); + + DMX_WRAP(Trapezoids, dmxTrapezoids, dmxScreen, ps); + DMX_WRAP(Triangles, dmxTriangles, dmxScreen, ps); + DMX_WRAP(TriStrip, dmxTriStrip, dmxScreen, ps); + DMX_WRAP(TriFan, dmxTriFan, dmxScreen, ps); + + return TRUE; +} + + +/** Find the appropriate format on the requested screen given the + * internal format requested. The list of formats is searched + * sequentially as the XRenderFindFormat() function does not always + * find the appropriate format when a specific format is requested. */ +static XRenderPictFormat *dmxFindFormat(DMXScreenInfo *dmxScreen, + PictFormatPtr pFmt) +{ + XRenderPictFormat *pFormat = NULL; + int i = 0; + + if (!pFmt || !dmxScreen->beDisplay) return pFormat; + + while (1) { + pFormat = XRenderFindFormat(dmxScreen->beDisplay, 0, 0, i++); + if (!pFormat) break; + + if (pFormat->type != pFmt->type) continue; + if (pFormat->depth != pFmt->depth) continue; + if (pFormat->direct.red != pFmt->direct.red) continue; + if (pFormat->direct.redMask != pFmt->direct.redMask) continue; + if (pFormat->direct.green != pFmt->direct.green) continue; + if (pFormat->direct.greenMask != pFmt->direct.greenMask) continue; + if (pFormat->direct.blue != pFmt->direct.blue) continue; + if (pFormat->direct.blueMask != pFmt->direct.blueMask) continue; + if (pFormat->direct.alpha != pFmt->direct.alpha) continue; + if (pFormat->direct.alphaMask != pFmt->direct.alphaMask) continue; + + /* We have a match! */ + break; + } + + return pFormat; +} + +/** Free \a glyphSet on back-end screen number \a idx. */ +Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet) +{ + dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); + int idx = pScreen->myNum; + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + + if (glyphPriv->glyphSets[idx]) { + XRenderFreeGlyphSet(dmxScreen->beDisplay, glyphPriv->glyphSets[idx]); + glyphPriv->glyphSets[idx] = (GlyphSet)0; + return TRUE; + } + + return FALSE; +} + +/** Create a Glyph Set on each screen. Save the glyphset ID from each + * screen in the Glyph Set's private structure. Fail if the format + * requested is not available or if the Glyph Set cannot be created on + * the screen. */ +static int dmxProcRenderCreateGlyphSet(ClientPtr client) +{ + int ret; + REQUEST(xRenderCreateGlyphSetReq); + + ret = dmxSaveRenderVector[stuff->renderReqType](client); + + if (ret == Success) { + int (*oldErrorHandler)(Display *, XErrorEvent *); + GlyphSetPtr glyphSet; + dmxGlyphPrivPtr glyphPriv; + int i; + PictFormatPtr pFmt; + XRenderPictFormat *pFormat; + + /* Look up glyphSet that was just created ???? */ + /* Store glyphsets from backends in glyphSet->devPrivate ????? */ + /* Make sure we handle all errors here!! */ + + glyphSet = SecurityLookupIDByType(client, stuff->gsid, GlyphSetType, + SecurityDestroyAccess); + glyphPriv = xalloc(sizeof(dmxGlyphPrivRec)); + if (!glyphPriv) return BadAlloc; + glyphPriv->glyphSets = NULL; + MAXSCREENSALLOC_RETURN(glyphPriv->glyphSets, BadAlloc); + DMX_SET_GLYPH_PRIV(glyphSet, glyphPriv); + + pFmt = SecurityLookupIDByType(client, stuff->format, PictFormatType, + SecurityReadAccess); + + oldErrorHandler = XSetErrorHandler(dmxGlyphErrorHandler); + + for (i = 0; i < dmxNumScreens; i++) { + DMXScreenInfo *dmxScreen = &dmxScreens[i]; + + if (!dmxScreen->beDisplay) { + glyphPriv->glyphSets[i] = 0; + continue; + } + + pFormat = dmxFindFormat(dmxScreen, pFmt); + if (!pFormat) { + int j; + + /* Free the glyph sets we've allocated thus far */ + for (j = 0; j < i; j++) + dmxBEFreeGlyphSet(screenInfo.screens[j], glyphSet); + + /* Free the resource created by render */ + FreeResource(stuff->gsid, RT_NONE); + + ret = BadMatch; + break; + } + + /* Catch when this fails */ + glyphPriv->glyphSets[i] + = XRenderCreateGlyphSet(dmxScreen->beDisplay, pFormat); + + if (dmxGlyphLastError) { + int j; + + /* Free the glyph sets we've allocated thus far */ + for (j = 0; j < i; j++) + dmxBEFreeGlyphSet(screenInfo.screens[j], glyphSet); + + /* Free the resource created by render */ + FreeResource(stuff->gsid, RT_NONE); + + ret = dmxGlyphLastError; + break; + } + } + + XSetErrorHandler(oldErrorHandler); + } + + return ret; +} + +/** Free the previously allocated Glyph Sets for each screen. */ +static int dmxProcRenderFreeGlyphSet(ClientPtr client) +{ + GlyphSetPtr glyphSet; + REQUEST(xRenderFreeGlyphSetReq); + + REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq); + glyphSet = SecurityLookupIDByType(client, stuff->glyphset, GlyphSetType, + SecurityDestroyAccess); + + if (glyphSet && glyphSet->refcnt == 1) { + dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); + int i; + + for (i = 0; i < dmxNumScreens; i++) { + DMXScreenInfo *dmxScreen = &dmxScreens[i]; + + if (dmxScreen->beDisplay) { + if (dmxBEFreeGlyphSet(screenInfo.screens[i], glyphSet)) + dmxSync(dmxScreen, FALSE); + } + } + + MAXSCREENSFREE(glyphPriv->glyphSets); + xfree(glyphPriv); + DMX_SET_GLYPH_PRIV(glyphSet, NULL); + } + + return dmxSaveRenderVector[stuff->renderReqType](client); +} + +/** Add glyphs to the Glyph Set on each screen. */ +static int dmxProcRenderAddGlyphs(ClientPtr client) +{ + int ret; + REQUEST(xRenderAddGlyphsReq); + + ret = dmxSaveRenderVector[stuff->renderReqType](client); + + if (ret == Success) { + GlyphSetPtr glyphSet; + dmxGlyphPrivPtr glyphPriv; + int i; + int nglyphs; + CARD32 *gids; + Glyph *gidsCopy; + xGlyphInfo *gi; + CARD8 *bits; + int nbytes; + + glyphSet = SecurityLookupIDByType(client, stuff->glyphset, + GlyphSetType, SecurityReadAccess); + glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); + + nglyphs = stuff->nglyphs; + gids = (CARD32 *)(stuff + 1); + gi = (xGlyphInfo *)(gids + nglyphs); + bits = (CARD8 *)(gi + nglyphs); + nbytes = ((stuff->length << 2) - + sizeof(xRenderAddGlyphsReq) - + (sizeof(CARD32) + sizeof(xGlyphInfo)) * nglyphs); + + gidsCopy = xalloc(sizeof(*gidsCopy) * nglyphs); + for (i = 0; i < nglyphs; i++) gidsCopy[i] = gids[i]; + + /* FIXME: Will this ever fail? */ + for (i = 0; i < dmxNumScreens; i++) { + DMXScreenInfo *dmxScreen = &dmxScreens[i]; + + if (dmxScreen->beDisplay) { + XRenderAddGlyphs(dmxScreen->beDisplay, + glyphPriv->glyphSets[i], + gidsCopy, + (XGlyphInfo *)gi, + nglyphs, + (char *)bits, + nbytes); + dmxSync(dmxScreen, FALSE); + } + } + xfree(gidsCopy); + } + + return ret; +} + +/** Free glyphs from the Glyph Set for each screen. */ +static int dmxProcRenderFreeGlyphs(ClientPtr client) +{ + GlyphSetPtr glyphSet; + REQUEST(xRenderFreeGlyphsReq); + + REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq); + glyphSet = SecurityLookupIDByType(client, stuff->glyphset, GlyphSetType, + SecurityWriteAccess); + + if (glyphSet) { + dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); + int i; + int nglyphs; + Glyph *gids; + + nglyphs = ((client->req_len << 2) - sizeof(xRenderFreeGlyphsReq)) >> 2; + if (nglyphs) { + gids = xalloc(sizeof(*gids) * nglyphs); + for (i = 0; i < nglyphs; i++) + gids[i] = ((CARD32 *)(stuff + 1))[i]; + + for (i = 0; i < dmxNumScreens; i++) { + DMXScreenInfo *dmxScreen = &dmxScreens[i]; + + if (dmxScreen->beDisplay) { + XRenderFreeGlyphs(dmxScreen->beDisplay, + glyphPriv->glyphSets[i], gids, nglyphs); + dmxSync(dmxScreen, FALSE); + } + } + xfree(gids); + } + } + + return dmxSaveRenderVector[stuff->renderReqType](client); +} + +/** Composite glyphs on each screen into the requested picture. If + * either the src or dest picture has not been allocated due to lazy + * window creation, this request will gracefully return. */ +static int dmxProcRenderCompositeGlyphs(ClientPtr client) +{ + int ret; + REQUEST(xRenderCompositeGlyphsReq); + + ret = dmxSaveRenderVector[stuff->renderReqType](client); + + /* For the following to work with PanoramiX, it assumes that Render + * wraps the ProcRenderVector after dmxRenderInit has been called. + */ + if (ret == Success) { + PicturePtr pSrc; + dmxPictPrivPtr pSrcPriv; + PicturePtr pDst; + dmxPictPrivPtr pDstPriv; + PictFormatPtr pFmt; + XRenderPictFormat *pFormat; + int size; + + int scrnNum; + DMXScreenInfo *dmxScreen; + + CARD8 *buffer; + CARD8 *end; + int space; + + int nglyph; + char *glyphs; + char *curGlyph; + + xGlyphElt *elt; + int nelt; + XGlyphElt8 *elts; + XGlyphElt8 *curElt; + + GlyphSetPtr glyphSet; + dmxGlyphPrivPtr glyphPriv; + + pSrc = SecurityLookupIDByType(client, stuff->src, PictureType, + SecurityReadAccess); + pSrcPriv = DMX_GET_PICT_PRIV(pSrc); + if (!pSrcPriv->pict) + return ret; + + pDst = SecurityLookupIDByType(client, stuff->dst, PictureType, + SecurityWriteAccess); + pDstPriv = DMX_GET_PICT_PRIV(pDst); + if (!pDstPriv->pict) + return ret; + + scrnNum = pDst->pDrawable->pScreen->myNum; + dmxScreen = &dmxScreens[scrnNum]; + + /* Note: If the back-end display has been detached, then it + * should not be possible to reach here since the pSrcPriv->pict + * and pDstPriv->pict will have already been set to 0. + */ + if (!dmxScreen->beDisplay) + return ret; + + if (stuff->maskFormat) + pFmt = SecurityLookupIDByType(client, stuff->maskFormat, + PictFormatType, SecurityReadAccess); + else + pFmt = NULL; + + pFormat = dmxFindFormat(dmxScreen, pFmt); + + switch (stuff->renderReqType) { + case X_RenderCompositeGlyphs8: size = sizeof(CARD8); break; + case X_RenderCompositeGlyphs16: size = sizeof(CARD16); break; + case X_RenderCompositeGlyphs32: size = sizeof(CARD32); break; + default: return BadPictOp; /* Can't happen */ + } + + buffer = (CARD8 *)(stuff + 1); + end = (CARD8 *)stuff + (stuff->length << 2); + nelt = 0; + nglyph = 0; + while (buffer + sizeof(xGlyphElt) < end) { + elt = (xGlyphElt *)buffer; + buffer += sizeof(xGlyphElt); + + if (elt->len == 0xff) { + buffer += 4; + } else { + nelt++; + nglyph += elt->len; + space = size * elt->len; + if (space & 3) space += 4 - (space & 3); + buffer += space; + } + } + + /* The following only works for Render version > 0.2 */ + + /* All of the XGlyphElt* structure sizes are identical */ + elts = ALLOCATE_LOCAL(nelt * sizeof(XGlyphElt8)); + if (!elts) + return BadAlloc; + + glyphs = ALLOCATE_LOCAL(nglyph * size); + if (!glyphs) { + DEALLOCATE_LOCAL(elts); + return BadAlloc; + } + + buffer = (CARD8 *)(stuff + 1); + end = (CARD8 *)stuff + (stuff->length << 2); + curGlyph = glyphs; + curElt = elts; + + glyphSet = SecurityLookupIDByType(client, stuff->glyphset, + GlyphSetType, SecurityReadAccess); + glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); + + while (buffer + sizeof(xGlyphElt) < end) { + elt = (xGlyphElt *)buffer; + buffer += sizeof(xGlyphElt); + + if (elt->len == 0xff) { + glyphSet = SecurityLookupIDByType(client, + *((CARD32 *)buffer), + GlyphSetType, + SecurityReadAccess); + glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); + buffer += 4; + } else { + curElt->glyphset = glyphPriv->glyphSets[scrnNum]; + curElt->xOff = elt->deltax; + curElt->yOff = elt->deltay; + curElt->nchars = elt->len; + curElt->chars = curGlyph; + + memcpy(curGlyph, buffer, size*elt->len); + curGlyph += size * elt->len; + + curElt++; + + space = size * elt->len; + if (space & 3) space += 4 - (space & 3); + buffer += space; + } + } + + switch (stuff->renderReqType) { + case X_RenderCompositeGlyphs8: + XRenderCompositeText8(dmxScreen->beDisplay, stuff->op, + pSrcPriv->pict, pDstPriv->pict, + pFormat, + stuff->xSrc, stuff->ySrc, + 0, 0, elts, nelt); + break; + case X_RenderCompositeGlyphs16: + XRenderCompositeText16(dmxScreen->beDisplay, stuff->op, + pSrcPriv->pict, pDstPriv->pict, + pFormat, + stuff->xSrc, stuff->ySrc, + 0, 0, (XGlyphElt16 *)elts, nelt); + break; + case X_RenderCompositeGlyphs32: + XRenderCompositeText32(dmxScreen->beDisplay, stuff->op, + pSrcPriv->pict, pDstPriv->pict, + pFormat, + stuff->xSrc, stuff->ySrc, + 0, 0, (XGlyphElt32 *)elts, nelt); + break; + } + + dmxSync(dmxScreen, FALSE); + + DEALLOCATE_LOCAL(elts); + DEALLOCATE_LOCAL(glyphs); + } + + return ret; +} + +/** Set the picture transform on each screen. */ +static int dmxProcRenderSetPictureTransform(ClientPtr client) +{ + DMXScreenInfo *dmxScreen; + PicturePtr pPicture; + dmxPictPrivPtr pPictPriv; + XTransform xform; + REQUEST(xRenderSetPictureTransformReq); + + REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq); + VERIFY_PICTURE(pPicture, stuff->picture, client, SecurityWriteAccess, + RenderErrBase + BadPicture); + + /* For the following to work with PanoramiX, it assumes that Render + * wraps the ProcRenderVector after dmxRenderInit has been called. + */ + dmxScreen = &dmxScreens[pPicture->pDrawable->pScreen->myNum]; + pPictPriv = DMX_GET_PICT_PRIV(pPicture); + + if (pPictPriv->pict) { + xform.matrix[0][0] = stuff->transform.matrix11; + xform.matrix[0][1] = stuff->transform.matrix12; + xform.matrix[0][2] = stuff->transform.matrix13; + xform.matrix[1][0] = stuff->transform.matrix21; + xform.matrix[1][1] = stuff->transform.matrix22; + xform.matrix[1][2] = stuff->transform.matrix23; + xform.matrix[2][0] = stuff->transform.matrix31; + xform.matrix[2][1] = stuff->transform.matrix32; + xform.matrix[2][2] = stuff->transform.matrix33; + + XRenderSetPictureTransform(dmxScreen->beDisplay, + pPictPriv->pict, + &xform); + dmxSync(dmxScreen, FALSE); + } + + return dmxSaveRenderVector[stuff->renderReqType](client); +} + +/** Set the picture filter on each screen. */ +static int dmxProcRenderSetPictureFilter(ClientPtr client) +{ + DMXScreenInfo *dmxScreen; + PicturePtr pPicture; + dmxPictPrivPtr pPictPriv; + char *filter; + XFixed *params; + int nparams; + REQUEST(xRenderSetPictureFilterReq); + + REQUEST_SIZE_MATCH(xRenderSetPictureFilterReq); + VERIFY_PICTURE(pPicture, stuff->picture, client, SecurityWriteAccess, + RenderErrBase + BadPicture); + + /* For the following to work with PanoramiX, it assumes that Render + * wraps the ProcRenderVector after dmxRenderInit has been called. + */ + dmxScreen = &dmxScreens[pPicture->pDrawable->pScreen->myNum]; + pPictPriv = DMX_GET_PICT_PRIV(pPicture); + + if (pPictPriv->pict) { + filter = (char *)(stuff + 1); + params = (XFixed *)(filter + ((stuff->nbytes + 3) & ~3)); + nparams = ((XFixed *)stuff + client->req_len) - params; + + XRenderSetPictureFilter(dmxScreen->beDisplay, + pPictPriv->pict, + filter, + params, + nparams); + dmxSync(dmxScreen, FALSE); + } + + return dmxSaveRenderVector[stuff->renderReqType](client); +} + + +/** Create a picture on the appropriate screen. This is the actual + * function that creates the picture. However, if the associated + * window has not yet been created due to lazy window creation, then + * delay the picture creation until the window is mapped. */ +static Picture dmxDoCreatePicture(PicturePtr pPicture) +{ + DrawablePtr pDraw = pPicture->pDrawable; + ScreenPtr pScreen = pDraw->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + XRenderPictFormat *pFormat; + Drawable draw; + + if (pPicture->pDrawable->type == DRAWABLE_WINDOW) { + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV((WindowPtr)(pDraw)); + + if (!(draw = pWinPriv->window)) { + /* Window has not been created yet due to the window + * optimization. Delay picture creation until window is + * mapped. + */ + pWinPriv->hasPict = TRUE; + return 0; + } + } else { + dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV((PixmapPtr)(pDraw)); + + if (!(draw = pPixPriv->pixmap)) { + /* FIXME: Zero width/height pixmap?? */ + return 0; + } + } + + /* This should not be reached if the back-end display has been + * detached because the pWinPriv->window or the pPixPriv->pixmap + * will be NULL; however, we add it here for completeness + */ + if (!dmxScreen->beDisplay) + return 0; + + pFormat = dmxFindFormat(dmxScreen, pPicture->pFormat); + + return XRenderCreatePicture(dmxScreen->beDisplay, draw, pFormat, 0, 0); +} + +/** Create a list of pictures. This function is called by + * dmxCreateAndRealizeWindow() during the lazy window creation + * realization process. It creates the entire list of pictures that + * are associated with the given window. */ +void dmxCreatePictureList(WindowPtr pWindow) +{ + PicturePtr pPicture = GetPictureWindow(pWindow); + + while (pPicture) { + dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture); + + /* Create the picture for this window */ + pPictPriv->pict = dmxDoCreatePicture(pPicture); + + /* ValidatePicture takes care of the state changes */ + + pPicture = pPicture->pNext; + } +} + +/** Create a picture. This function handles the CreatePicture + * unwrapping/wrapping and calls dmxDoCreatePicture to actually create + * the picture on the appropriate screen. */ +int dmxCreatePicture(PicturePtr pPicture) +{ + ScreenPtr pScreen = pPicture->pDrawable->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + PictureScreenPtr ps = GetPictureScreen(pScreen); + dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture); + int ret = Success; + + DMX_UNWRAP(CreatePicture, dmxScreen, ps); +#if 1 + if (ps->CreatePicture) + ret = ps->CreatePicture(pPicture); +#endif + + /* Create picture on back-end server */ + pPictPriv->pict = dmxDoCreatePicture(pPicture); + pPictPriv->savedMask = 0; + + DMX_WRAP(CreatePicture, dmxCreatePicture, dmxScreen, ps); + + return ret; +} + +/** Destroy \a pPicture on the back-end server. */ +Bool dmxBEFreePicture(PicturePtr pPicture) +{ + ScreenPtr pScreen = pPicture->pDrawable->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture); + + if (pPictPriv->pict) { + XRenderFreePicture(dmxScreen->beDisplay, pPictPriv->pict); + pPictPriv->pict = (Picture)0; + return TRUE; + } + + return FALSE; +} + +/** Destroy a list of pictures that are associated with the window that + * is being destroyed. This function is called by #dmxDestroyWindow(). + * */ +Bool dmxDestroyPictureList(WindowPtr pWindow) +{ + PicturePtr pPicture = GetPictureWindow(pWindow); + Bool ret = FALSE; + + while (pPicture) { + ret |= dmxBEFreePicture(pPicture); + pPicture = pPicture->pNext; + } + + return ret; +} + +/** Destroy a picture. This function calls the wrapped function that + * frees the resources in the DMX server associated with this + * picture. */ +void dmxDestroyPicture(PicturePtr pPicture) +{ + ScreenPtr pScreen = pPicture->pDrawable->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + PictureScreenPtr ps = GetPictureScreen(pScreen); + + DMX_UNWRAP(DestroyPicture, dmxScreen, ps); + + /* Destroy picture on back-end server */ + if (dmxBEFreePicture(pPicture)) + dmxSync(dmxScreen, FALSE); + +#if 1 + if (ps->DestroyPicture) + ps->DestroyPicture(pPicture); +#endif + DMX_WRAP(DestroyPicture, dmxDestroyPicture, dmxScreen, ps); +} + +/** Change the picture's list of clip rectangles. */ +int dmxChangePictureClip(PicturePtr pPicture, int clipType, + pointer value, int n) +{ + ScreenPtr pScreen = pPicture->pDrawable->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + PictureScreenPtr ps = GetPictureScreen(pScreen); + dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture); + + DMX_UNWRAP(ChangePictureClip, dmxScreen, ps); +#if 1 + if (ps->ChangePictureClip) + ps->ChangePictureClip(pPicture, clipType, value, n); +#endif + + /* Change picture clip rects on back-end server */ + if (pPictPriv->pict) { + /* The clip has already been changed into a region by the mi + * routine called above. + */ + if (pPicture->clientClip) { + RegionPtr pClip = pPicture->clientClip; + BoxPtr pBox = REGION_RECTS(pClip); + int nBox = REGION_NUM_RECTS(pClip); + XRectangle *pRects; + XRectangle *pRect; + int nRects; + + nRects = nBox; + pRects = pRect = xalloc(nRects * sizeof(*pRect)); + + while (nBox--) { + pRect->x = pBox->x1; + pRect->y = pBox->y1; + pRect->width = pBox->x2 - pBox->x1; + pRect->height = pBox->y2 - pBox->y1; + pBox++; + pRect++; + } + + XRenderSetPictureClipRectangles(dmxScreen->beDisplay, + pPictPriv->pict, + 0, 0, + pRects, + nRects); + xfree(pRects); + } else { + XRenderSetPictureClipRectangles(dmxScreen->beDisplay, + pPictPriv->pict, + 0, 0, NULL, 0); + } + dmxSync(dmxScreen, FALSE); + } else { + /* FIXME: Handle saving clip region when offscreen */ + } + + DMX_WRAP(ChangePictureClip, dmxChangePictureClip, dmxScreen, ps); + + return Success; +} + +/** Destroy the picture's list of clip rectangles. */ +void dmxDestroyPictureClip(PicturePtr pPicture) +{ + ScreenPtr pScreen = pPicture->pDrawable->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + PictureScreenPtr ps = GetPictureScreen(pScreen); + dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture); + + DMX_UNWRAP(DestroyPictureClip, dmxScreen, ps); +#if 1 + if (ps->DestroyPictureClip) + ps->DestroyPictureClip(pPicture); +#endif + + /* Destroy picture clip rects on back-end server */ + if (pPictPriv->pict) { + XRenderSetPictureClipRectangles(dmxScreen->beDisplay, + pPictPriv->pict, + 0, 0, NULL, 0); + dmxSync(dmxScreen, FALSE); + } else { + /* FIXME: Handle destroying clip region when offscreen */ + } + + DMX_WRAP(DestroyPictureClip, dmxDestroyPictureClip, dmxScreen, ps); +} + +/** Change the attributes of the pictures. If the picture has not yet + * been created due to lazy window creation, save the mask so that it + * can be used to appropriately initialize the picture's attributes + * when it is created later. */ +void dmxChangePicture(PicturePtr pPicture, Mask mask) +{ + ScreenPtr pScreen = pPicture->pDrawable->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + PictureScreenPtr ps = GetPictureScreen(pScreen); + dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture); + + DMX_UNWRAP(ChangePicture, dmxScreen, ps); +#if 1 + if (ps->ChangePicture) + ps->ChangePicture(pPicture, mask); +#endif + + /* Picture attribute changes are handled in ValidatePicture */ + pPictPriv->savedMask |= mask; + + DMX_WRAP(ChangePicture, dmxChangePicture, dmxScreen, ps); +} + +/** Validate the picture's attributes before rendering to it. Update + * any picture attributes that have been changed by one of the higher + * layers. */ +void dmxValidatePicture(PicturePtr pPicture, Mask mask) +{ + ScreenPtr pScreen = pPicture->pDrawable->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + PictureScreenPtr ps = GetPictureScreen(pScreen); + dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture); + + DMX_UNWRAP(ValidatePicture, dmxScreen, ps); + + /* Change picture attributes on back-end server */ + if (pPictPriv->pict) { + XRenderPictureAttributes attribs; + + if (mask & CPRepeat) + attribs.repeat = pPicture->repeat; + if (mask & CPAlphaMap) { + if (pPicture->alphaMap) { + dmxPictPrivPtr pAlphaPriv; + pAlphaPriv = DMX_GET_PICT_PRIV(pPicture->alphaMap); + if (pAlphaPriv->pict) { + attribs.alpha_map = pAlphaPriv->pict; + } else { + /* FIXME: alpha picture drawable has not been created?? */ + return; /* or should this be: attribs.alpha_map = None; */ + } + } else { + attribs.alpha_map = None; + } + } + if (mask & CPAlphaXOrigin) + attribs.alpha_x_origin = pPicture->alphaOrigin.x; + if (mask & CPAlphaYOrigin) + attribs.alpha_y_origin = pPicture->alphaOrigin.y; + if (mask & CPClipXOrigin) + attribs.clip_x_origin = pPicture->clipOrigin.x; + if (mask & CPClipYOrigin) + attribs.clip_y_origin = pPicture->clipOrigin.y; + if (mask & CPClipMask) + mask &= ~CPClipMask; /* Handled in ChangePictureClip */ + if (mask & CPGraphicsExposure) + attribs.graphics_exposures = pPicture->graphicsExposures; + if (mask & CPSubwindowMode) + attribs.subwindow_mode = pPicture->subWindowMode; + if (mask & CPPolyEdge) + attribs.poly_edge = pPicture->polyEdge; + if (mask & CPPolyMode) + attribs.poly_mode = pPicture->polyMode; + if (mask & CPDither) + attribs.dither = pPicture->dither; + if (mask & CPComponentAlpha) + attribs.component_alpha = pPicture->componentAlpha; + + XRenderChangePicture(dmxScreen->beDisplay, pPictPriv->pict, + mask, &attribs); + dmxSync(dmxScreen, FALSE); + } else { + pPictPriv->savedMask |= mask; + } + +#if 1 + if (ps->ValidatePicture) + ps->ValidatePicture(pPicture, mask); +#endif + + DMX_WRAP(ValidatePicture, dmxValidatePicture, dmxScreen, ps); +} + +/** Composite a picture on the appropriate screen by combining the + * specified rectangle of the transformed src and mask operands with + * the specified rectangle of the dst using op as the compositing + * operator. For a complete description see the protocol document of + * the RENDER library. */ +void dmxComposite(CARD8 op, + PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, + INT16 xSrc, INT16 ySrc, + INT16 xMask, INT16 yMask, + INT16 xDst, INT16 yDst, + CARD16 width, CARD16 height) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + PictureScreenPtr ps = GetPictureScreen(pScreen); + dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc); + dmxPictPrivPtr pMaskPriv = NULL; + dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst); + + if (pMask) pMaskPriv = DMX_GET_PICT_PRIV(pMask); + + DMX_UNWRAP(Composite, dmxScreen, ps); +#if 0 + if (ps->Composite) + ps->Composite(op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); +#endif + + /* Composite on back-end server */ + if (pSrcPriv->pict && pDstPriv->pict && + ((pMaskPriv && pMaskPriv->pict) || !pMaskPriv)) { + XRenderComposite(dmxScreen->beDisplay, + op, + pSrcPriv->pict, + pMaskPriv ? pMaskPriv->pict : None, + pDstPriv->pict, + xSrc, ySrc, + xMask, yMask, + xDst, yDst, + width, height); + dmxSync(dmxScreen, FALSE); + } + + + DMX_WRAP(Composite, dmxComposite, dmxScreen, ps); +} + +/** Null function to catch when/if RENDER calls lower level mi hooks. + * Compositing glyphs is handled by dmxProcRenderCompositeGlyphs(). + * This function should never be called. */ +void dmxGlyphs(CARD8 op, + PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, + int nlists, GlyphListPtr lists, GlyphPtr *glyphs) +{ + /* This won't work, so we need to wrap ProcRenderCompositeGlyphs */ +} + +/** Fill a rectangle on the appropriate screen by combining the color + * with the dest picture in the area specified by the list of + * rectangles. For a complete description see the protocol document of + * the RENDER library. */ +void dmxCompositeRects(CARD8 op, + PicturePtr pDst, + xRenderColor *color, + int nRect, xRectangle *rects) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + PictureScreenPtr ps = GetPictureScreen(pScreen); + dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pDst); + + DMX_UNWRAP(CompositeRects, dmxScreen, ps); +#if 0 + if (ps->CompositeRects) + ps->CompositeRects(op, pDst, color, nRect, rects); +#endif + + /* CompositeRects on back-end server */ + if (pPictPriv->pict) { + XRenderFillRectangles(dmxScreen->beDisplay, + op, + pPictPriv->pict, + (XRenderColor *)color, + (XRectangle *)rects, + nRect); + dmxSync(dmxScreen, FALSE); + } + + DMX_WRAP(CompositeRects, dmxCompositeRects, dmxScreen, ps); +} + +/** Indexed color visuals are not yet supported. */ +Bool dmxInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat) +{ + return TRUE; +} + +/** Indexed color visuals are not yet supported. */ +void dmxCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat) +{ +} + +/** Indexed color visuals are not yet supported. */ +void dmxUpdateIndexed(ScreenPtr pScreen, PictFormatPtr pFormat, + int ndef, xColorItem *pdef) +{ +} + +/** Composite a list of trapezoids on the appropriate screen. For a + * complete description see the protocol document of the RENDER + * library. */ +void dmxTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, + int ntrap, xTrapezoid *traps) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + PictureScreenPtr ps = GetPictureScreen(pScreen); + dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc); + dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst); + + DMX_UNWRAP(Trapezoids, dmxScreen, ps); +#if 0 + if (ps->Trapezoids) + ps->Trapezoids(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntrap, *traps); +#endif + + /* Draw trapezoids on back-end server */ + if (pDstPriv->pict) { + XRenderPictFormat *pFormat; + + pFormat = dmxFindFormat(dmxScreen, maskFormat); + if (!pFormat) { + /* FIXME: Error! */ + } + + XRenderCompositeTrapezoids(dmxScreen->beDisplay, + op, + pSrcPriv->pict, + pDstPriv->pict, + pFormat, + xSrc, ySrc, + (XTrapezoid *)traps, + ntrap); + dmxSync(dmxScreen, FALSE); + } + + DMX_WRAP(Trapezoids, dmxTrapezoids, dmxScreen, ps); +} + +/** Composite a list of triangles on the appropriate screen. For a + * complete description see the protocol document of the RENDER + * library. */ +void dmxTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, + int ntri, xTriangle *tris) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + PictureScreenPtr ps = GetPictureScreen(pScreen); + dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc); + dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst); + + DMX_UNWRAP(Triangles, dmxScreen, ps); +#if 0 + if (ps->Triangles) + ps->Triangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, *tris); +#endif + + /* Draw trapezoids on back-end server */ + if (pDstPriv->pict) { + XRenderPictFormat *pFormat; + + pFormat = dmxFindFormat(dmxScreen, maskFormat); + if (!pFormat) { + /* FIXME: Error! */ + } + + XRenderCompositeTriangles(dmxScreen->beDisplay, + op, + pSrcPriv->pict, + pDstPriv->pict, + pFormat, + xSrc, ySrc, + (XTriangle *)tris, + ntri); + dmxSync(dmxScreen, FALSE); + } + + DMX_WRAP(Triangles, dmxTriangles, dmxScreen, ps); +} + +/** Composite a triangle strip on the appropriate screen. For a + * complete description see the protocol document of the RENDER + * library. */ +void dmxTriStrip(CARD8 op, PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, + int npoint, xPointFixed *points) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + PictureScreenPtr ps = GetPictureScreen(pScreen); + dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc); + dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst); + + DMX_UNWRAP(TriStrip, dmxScreen, ps); +#if 0 + if (ps->TriStrip) + ps->TriStrip(op, pSrc, pDst, maskFormat, xSrc, ySrc, npoint, *points); +#endif + + /* Draw trapezoids on back-end server */ + if (pDstPriv->pict) { + XRenderPictFormat *pFormat; + + pFormat = dmxFindFormat(dmxScreen, maskFormat); + if (!pFormat) { + /* FIXME: Error! */ + } + + XRenderCompositeTriStrip(dmxScreen->beDisplay, + op, + pSrcPriv->pict, + pDstPriv->pict, + pFormat, + xSrc, ySrc, + (XPointFixed *)points, + npoint); + dmxSync(dmxScreen, FALSE); + } + + DMX_WRAP(TriStrip, dmxTriStrip, dmxScreen, ps); +} + +/** Composite a triangle fan on the appropriate screen. For a complete + * description see the protocol document of the RENDER library. */ +void dmxTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, + int npoint, xPointFixed *points) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + PictureScreenPtr ps = GetPictureScreen(pScreen); + dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc); + dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst); + + DMX_UNWRAP(TriFan, dmxScreen, ps); +#if 0 + if (ps->TriFan) + ps->TriFan(op, pSrc, pDst, maskFormat, xSrc, ySrc, npoint, *points); +#endif + + /* Draw trapezoids on back-end server */ + if (pDstPriv->pict) { + XRenderPictFormat *pFormat; + + pFormat = dmxFindFormat(dmxScreen, maskFormat); + if (!pFormat) { + /* FIXME: Error! */ + } + + XRenderCompositeTriFan(dmxScreen->beDisplay, + op, + pSrcPriv->pict, + pDstPriv->pict, + pFormat, + xSrc, ySrc, + (XPointFixed *)points, + npoint); + dmxSync(dmxScreen, FALSE); + } + + DMX_WRAP(TriFan, dmxTriFan, dmxScreen, ps); +} Index: xc/programs/Xserver/hw/dmx/dmxpict.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxpict.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxpict.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,133 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxpict.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +/** \file + * This file provides access to the externally visible RENDER support + * functions, global variables and macros for DMX. + * + * FIXME: Move function definitions for non-externally visible function + * to .c file. */ + +#ifndef DMXPICT_H +#define DMXPICT_H + +/** Picture private structure */ +typedef struct _dmxPictPriv { + Picture pict; /**< Picture ID from back-end server */ + Mask savedMask; /**< Mask of picture attributes saved for + * lazy window creation. */ +} dmxPictPrivRec, *dmxPictPrivPtr; + + +/** Glyph Set private structure */ +typedef struct _dmxGlyphPriv { + GlyphSet *glyphSets; /**< Glyph Set IDs from back-end server */ +} dmxGlyphPrivRec, *dmxGlyphPrivPtr; + + +extern void dmxInitRender(void); +extern void dmxResetRender(void); + +extern Bool dmxPictureInit(ScreenPtr pScreen, + PictFormatPtr formats, int nformats); + +extern void dmxCreatePictureList(WindowPtr pWindow); +extern Bool dmxDestroyPictureList(WindowPtr pWindow); + +extern int dmxCreatePicture(PicturePtr pPicture); +extern void dmxDestroyPicture(PicturePtr pPicture); +extern int dmxChangePictureClip(PicturePtr pPicture, int clipType, + pointer value, int n); +extern void dmxDestroyPictureClip(PicturePtr pPicture); +extern void dmxChangePicture(PicturePtr pPicture, Mask mask); +extern void dmxValidatePicture(PicturePtr pPicture, Mask mask); +extern void dmxComposite(CARD8 op, + PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, + INT16 xSrc, INT16 ySrc, + INT16 xMask, INT16 yMask, + INT16 xDst, INT16 yDst, + CARD16 width, CARD16 height); +extern void dmxGlyphs(CARD8 op, + PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, + int nlists, GlyphListPtr lists, GlyphPtr *glyphs); +extern void dmxCompositeRects(CARD8 op, + PicturePtr pDst, + xRenderColor *color, + int nRect, xRectangle *rects); +extern Bool dmxInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat); +extern void dmxCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat); +extern void dmxUpdateIndexed(ScreenPtr pScreen, PictFormatPtr pFormat, + int ndef, xColorItem *pdef); +extern void dmxTrapezoids(CARD8 op, + PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, + int ntrap, xTrapezoid *traps); +extern void dmxTriangles(CARD8 op, + PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, + int ntri, xTriangle *tris); +extern void dmxTriStrip(CARD8 op, + PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, + int npoint, xPointFixed *points); +extern void dmxTriFan(CARD8 op, + PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, + int npoint, xPointFixed *points); + +extern Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet); +extern Bool dmxBEFreePicture(PicturePtr pPicture); + +extern int dmxPictPrivateIndex; /**< Index for picture private data */ +extern int dmxGlyphSetPrivateIndex; /**< Index for glyphset private data */ + + +/** Get the picture private data given a picture pointer */ +#define DMX_GET_PICT_PRIV(_pPict) \ + (dmxPictPrivPtr)(_pPict)->devPrivates[dmxPictPrivateIndex].ptr + +/** Set the glyphset private data given a glyphset pointer */ +#define DMX_SET_GLYPH_PRIV(_pGlyph, _pPriv) \ + GlyphSetSetPrivate((_pGlyph), dmxGlyphSetPrivateIndex, (_pPriv)) +/** Get the glyphset private data given a glyphset pointer */ +#define DMX_GET_GLYPH_PRIV(_pGlyph) \ + (dmxGlyphPrivPtr)GlyphSetGetPrivate((_pGlyph), dmxGlyphSetPrivateIndex) + +#endif /* DMXPICT_H */ Index: xc/programs/Xserver/hw/dmx/dmxpixmap.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxpixmap.c:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxpixmap.c Wed Jun 30 16:21:39 2004 @@ -0,0 +1,248 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxpixmap.c,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +/** \file + * Provides pixmap support. */ + +#include "dmx.h" +#include "dmxsync.h" +#include "dmxpixmap.h" + +#include "pixmapstr.h" +#include "servermd.h" + +/** Initialize a private area in \a pScreen for pixmap information. */ +Bool dmxInitPixmap(ScreenPtr pScreen) +{ +#ifdef PIXPRIV + if (!AllocatePixmapPrivate(pScreen, dmxPixPrivateIndex, + sizeof(dmxPixPrivRec))) + return FALSE; + + return TRUE; +#else +#error Must define PIXPRIV to compile DMX X server +#endif +} + +/** Create a pixmap on the back-end server. */ +void dmxBECreatePixmap(PixmapPtr pPixmap) +{ + ScreenPtr pScreen = pPixmap->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap); + + /* Make sure we haven't already created this pixmap. This can + * happen when the pixmap is used elsewhere (e.g., as a background + * or border for a window) and the refcnt > 1. + */ + if (pPixPriv->pixmap) + return; + + if (pPixmap->drawable.width && pPixmap->drawable.height) { + pPixPriv->pixmap = XCreatePixmap(dmxScreen->beDisplay, + dmxScreen->scrnWin, + pPixmap->drawable.width, + pPixmap->drawable.height, + pPixmap->drawable.depth); + dmxSync(dmxScreen, FALSE); + } +} + +/** Create a pixmap for \a pScreen with the specified \a width, \a + * height, and \a depth. */ +PixmapPtr dmxCreatePixmap(ScreenPtr pScreen, int width, int height, int depth) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + PixmapPtr pPixmap; + int bpp; + dmxPixPrivPtr pPixPriv; + +#if 0 + DMX_UNWRAP(CreatePixmap, dmxScreen, pScreen); + if (pScreen->CreatePixmap) + ret = pScreen->CreatePixmap(pPixmap); +#endif + + /* Create pixmap on back-end server */ + if (depth == 24) bpp = 32; + else bpp = depth; + + pPixmap = AllocatePixmap(pScreen, 0); + if (!pPixmap) + return NullPixmap; + + pPixmap->drawable.type = DRAWABLE_PIXMAP; + pPixmap->drawable.class = 0; + pPixmap->drawable.pScreen = pScreen; + pPixmap->drawable.depth = depth; + pPixmap->drawable.bitsPerPixel = bpp; + pPixmap->drawable.id = 0; + pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; + pPixmap->drawable.x = 0; + pPixmap->drawable.y = 0; + pPixmap->drawable.width = width; + pPixmap->drawable.height = height; + pPixmap->devKind = PixmapBytePad(width, bpp); + pPixmap->refcnt = 1; + + pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap); + pPixPriv->pixmap = (Pixmap)0; + pPixPriv->detachedImage = NULL; + + /* Create the pixmap on the back-end server */ + if (dmxScreen->beDisplay) { + dmxBECreatePixmap(pPixmap); + } + +#if 0 + DMX_WRAP(CreatePixmap, dmxCreatePixmap, dmxScreen, pScreen); +#endif + + return pPixmap; +} + +/** Destroy the pixmap on the back-end server. */ +Bool dmxBEFreePixmap(PixmapPtr pPixmap) +{ + ScreenPtr pScreen = pPixmap->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap); + + if (pPixPriv->pixmap) { + XFreePixmap(dmxScreen->beDisplay, pPixPriv->pixmap); + pPixPriv->pixmap = (Pixmap)0; + return TRUE; + } + + return FALSE; +} + +/** Destroy the pixmap pointed to by \a pPixmap. */ +Bool dmxDestroyPixmap(PixmapPtr pPixmap) +{ + ScreenPtr pScreen = pPixmap->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + Bool ret = TRUE; + +#if 0 + DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen); +#endif + + if (--pPixmap->refcnt) + return TRUE; + + /* Destroy pixmap on back-end server */ + if (dmxScreen->beDisplay) { + if (dmxBEFreePixmap(pPixmap)) { + /* Also make sure that we destroy any detached image */ + dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap); + if (pPixPriv->detachedImage) + XDestroyImage(pPixPriv->detachedImage); + dmxSync(dmxScreen, FALSE); + } + } + xfree(pPixmap); + +#if 0 + if (pScreen->DestroyPixmap) + ret = pScreen->DestroyPixmap(pPixmap); + DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen); +#endif + + return ret; +} + +/** Create and return a region based on the pixmap pointed to by \a + * pPixmap. */ +RegionPtr dmxBitmapToRegion(PixmapPtr pPixmap) +{ + ScreenPtr pScreen = pPixmap->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap); + XImage *ximage; + RegionPtr pReg, pTmpReg; + int x, y; + unsigned long previousPixel, currentPixel; + BoxRec Box; + Bool overlap; + + if (!dmxScreen->beDisplay) { + pReg = REGION_CREATE(pScreen, NullBox, 1); + return pReg; + } + + ximage = XGetImage(dmxScreen->beDisplay, pPixPriv->pixmap, 0, 0, + pPixmap->drawable.width, pPixmap->drawable.height, + 1, XYPixmap); + + pReg = REGION_CREATE(pScreen, NullBox, 1); + pTmpReg = REGION_CREATE(pScreen, NullBox, 1); + if(!pReg || !pTmpReg) return NullRegion; + + for (y = 0; y < pPixmap->drawable.height; y++) { + Box.y1 = y; + Box.y2 = y + 1; + previousPixel = 0L; + for (x = 0; x < pPixmap->drawable.width; x++) { + currentPixel = XGetPixel(ximage, x, y); + if (previousPixel != currentPixel) { + if (previousPixel == 0L) { + /* left edge */ + Box.x1 = x; + } else if (currentPixel == 0L) { + /* right edge */ + Box.x2 = x; + REGION_RESET(pScreen, pTmpReg, &Box); + REGION_APPEND(pScreen, pReg, pTmpReg); + } + previousPixel = currentPixel; + } + } + if (previousPixel != 0L) { + /* right edge because of the end of pixmap */ + Box.x2 = pPixmap->drawable.width; + REGION_RESET(pScreen, pTmpReg, &Box); + REGION_APPEND(pScreen, pReg, pTmpReg); + } + } + + REGION_DESTROY(pScreen, pTmpReg); + XDestroyImage(ximage); + + REGION_VALIDATE(pScreen, pReg, &overlap); + + dmxSync(dmxScreen, FALSE); + return(pReg); +} Index: xc/programs/Xserver/hw/dmx/dmxpixmap.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxpixmap.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxpixmap.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,67 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxpixmap.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +/** \file + * Interface for pixmap support. \see dmxpixmap.c */ + +#ifndef DMXPIXMAP_H +#define DMXPIXMAP_H + +#include "pixmapstr.h" + +/** Pixmap private area. */ +typedef struct _dmxPixPriv { + Pixmap pixmap; + XImage *detachedImage; +} dmxPixPrivRec, *dmxPixPrivPtr; + + +extern Bool dmxInitPixmap(ScreenPtr pScreen); + +extern PixmapPtr dmxCreatePixmap(ScreenPtr pScreen, + int width, int height, int depth); +extern Bool dmxDestroyPixmap(PixmapPtr pPixmap); +extern RegionPtr dmxBitmapToRegion(PixmapPtr pPixmap); + +extern void dmxBECreatePixmap(PixmapPtr pPixmap); +extern Bool dmxBEFreePixmap(PixmapPtr pPixmap); + +/** Private index. \see dmxpicmap.h \see dmxscrinit.c */ +extern int dmxPixPrivateIndex; + +/** Get pixmap private pointer. */ +#define DMX_GET_PIXMAP_PRIV(_pPix) \ + (dmxPixPrivPtr)(_pPix)->devPrivates[dmxPixPrivateIndex].ptr + +#endif /* DMXPIXMAP_H */ Index: xc/programs/Xserver/hw/dmx/dmxprop.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxprop.c:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxprop.c Wed Jun 30 16:21:39 2004 @@ -0,0 +1,344 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxprop.c,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * + * It is possible for one of the DMX "backend displays" to actually be + * smaller than the dimensions of the backend X server. Therefore, it + * is possible for more than one of the DMX "backend displays" to be + * physically located on the same backend X server. This situation must + * be detected so that cursor motion can be handled in an expected + * fashion. + * + * We could analyze the names used for the DMX "backend displays" (e.g., + * the names passed to the -display command-line parameter), but there + * are many possible names for a single X display, and failing to detect + * sameness leads to very unexpected results. Therefore, whenever the + * DMX server opens a window on a backend X server, a property value is + * queried and set on that backend to detect when another window is + * already open on that server. + * + * Further, it is possible that two different DMX server instantiations + * both have windows on the same physical backend X server. This case + * is also detected so that pointer input is not taken from that + * particular backend X server. + * + * The routines in this file handle the property management. */ + +#include "dmx.h" +#include "dmxprop.h" +#include "dmxlog.h" + +/** Holds the window id of all DMX windows on the backend X server. */ +#define DMX_ATOMNAME "DMX_NAME" + +/** The identification string of this DMX server */ +#define DMX_IDENT "Xdmx" + +extern char *display; + +static int dmxPropertyErrorHandler(Display *dpy, XErrorEvent *ev) +{ + return 0; +} + +static const unsigned char *dmxPropertyIdentifier(void) +{ + /* RATS: These buffers are only used in + * length-limited calls. */ + char hostname[256]; + static char buf[128]; + static int initialized = 0; + + if (initialized++) return (unsigned char *)buf; + + XmuGetHostname(hostname, sizeof(hostname)); + XmuSnprintf(buf, sizeof(buf), "%s:%s:%s", DMX_IDENT, hostname, display); + return (unsigned char *)buf; +} + +/** Starting with the \a start screen, iterate over all of the screens + * on the same physical X server as \a start, calling \a f with the + * screen and the \a closure. (The common case is that \a start is the + * only DMX window on the backend X server.) */ +void *dmxPropertyIterate(DMXScreenInfo *start, + void *(*f)(DMXScreenInfo *dmxScreen, void *), + void *closure) +{ + DMXScreenInfo *pt; + + if (!start->next) { + if (!start->beDisplay) return NULL; + return f(start, closure); + } + + for (pt = start->next; /* condition at end of loop */; pt = pt->next) { + void *retval; + /* beDisplay ban be NULL if a screen was detached */ + dmxLog(dmxDebug, "pt = %p\n", pt); + dmxLog(dmxDebug, "pt->beDisplay = %p\n", pt->beDisplay); + if (pt->beDisplay && (retval = f(pt, closure))) return retval; + if (pt == start) break; + } + return NULL; +} + +/** Returns 0 if this is the only Xdmx session on the display; 1 + * otherwise. */ +static int dmxPropertyCheckOtherServers(DMXScreenInfo *dmxScreen, Atom atom) +{ + Display *dpy = dmxScreen->beDisplay; + XTextProperty tp; + XTextProperty tproot; + const char *pt; + int retcode = 0; + char **list = NULL; + int count = 0; + int i; + int (*dmxOldHandler)(Display *, XErrorEvent *); + + if (!dpy) + return 0; + + if (!XGetTextProperty(dpy, RootWindow(dpy,0), &tproot, atom) + || !tproot.nitems) return 0; + + /* Ignore BadWindow errors for this + * routine because the window id stored + * in the property might be old */ + dmxOldHandler = XSetErrorHandler(dmxPropertyErrorHandler); + for (pt = (const char *)tproot.value; pt && *pt; pt = pt ? pt + 1 : NULL) { + if ((pt = strchr(pt, ','))) { + Window win = strtol(pt+1, NULL, 10); + if (XGetTextProperty(dpy, win, &tp, atom) && tp.nitems) { + if (!strncmp((char *)tp.value, DMX_IDENT, strlen(DMX_IDENT))) { + int flag = 0; + for (i = 0; i < count; i++) + if (!strcmp(list[i], (char *)tp.value)) { + ++flag; + break; + } + if (flag) continue; + ++retcode; + dmxLogOutputWarning(dmxScreen, + "%s also running on %s\n", + tp.value, dmxScreen->name); + list = xrealloc(list, ++count * sizeof(*list)); + list[count-1] = xalloc(tp.nitems + 2); + strncpy(list[count-1], (char *)tp.value, tp.nitems + 1); + } + XFree(tp.value); + } + } + } + XSetErrorHandler(dmxOldHandler); + + for (i = 0; i < count; i++) xfree(list[i]); + xfree(list); + XFree(tproot.value); + if (!retcode) + dmxLogOutput(dmxScreen, "No Xdmx server running on backend\n"); + return retcode; +} + +/** Returns NULL if this is the only Xdmx window on the display. + * Otherwise, returns a pointer to the dmxScreen of the other windows on + * the display. */ +static DMXScreenInfo *dmxPropertyCheckOtherWindows(DMXScreenInfo *dmxScreen, + Atom atom) +{ + Display *dpy = dmxScreen->beDisplay; + const unsigned char *id = dmxPropertyIdentifier(); + XTextProperty tproot; + XTextProperty tp; + const char *pt; + int (*dmxOldHandler)(Display *, XErrorEvent *); + + if (!dpy) + return NULL; + + if (!XGetTextProperty(dpy, RootWindow(dpy,0), &tproot, atom) + || !tproot.nitems) return 0; + + /* Ignore BadWindow errors for this + * routine because the window id stored + * in the property might be old */ + dmxOldHandler = XSetErrorHandler(dmxPropertyErrorHandler); + for (pt = (const char *)tproot.value; pt && *pt; pt = pt ? pt + 1 : NULL) { + if ((pt = strchr(pt, ','))) { + Window win = strtol(pt+1, NULL, 10); + if (XGetTextProperty(dpy, win, &tp, atom) && tp.nitems) { + dmxLog(dmxDebug,"On %s/%lu: %s\n", + dmxScreen->name, win, tp.value); + if (!strncmp((char *)tp.value, (char *)id, + strlen((char *)id))) { + int idx; + + if (!(pt = strchr((char *)tp.value, ','))) continue; + idx = strtol(pt+1, NULL, 10); + if (idx < 0 || idx >= dmxNumScreens) continue; + if (dmxScreens[idx].scrnWin != win) continue; + XSetErrorHandler(dmxOldHandler); + return &dmxScreens[idx]; + } + XFree(tp.value); + } + } + } + XSetErrorHandler(dmxOldHandler); + XFree(tproot.value); + return 0; +} + +/** Returns 0 if this is the only Xdmx session on the display; 1 + * otherwise. */ +int dmxPropertyDisplay(DMXScreenInfo *dmxScreen) +{ + Atom atom; + const unsigned char *id = dmxPropertyIdentifier(); + Display *dpy = dmxScreen->beDisplay; + + if (!dpy) + return 0; + + atom = XInternAtom(dpy, DMX_ATOMNAME, False); + if (dmxPropertyCheckOtherServers(dmxScreen, atom)) { + dmxScreen->shared = 1; + return 1; + } + XChangeProperty(dpy, RootWindow(dpy,0), atom, XA_STRING, 8, + PropModeReplace, id, strlen((char *)id)); + return 0; +} + +/** Returns 1 if the dmxScreen and the display in \a name are on the + * same display, or 0 otherwise. We can't just compare the display + * names because there can be multiple synonyms for the same display, + * some of which cannot be determined without accessing the display + * itself (e.g., domain aliases or machines with multiple NICs). */ +int dmxPropertySameDisplay(DMXScreenInfo *dmxScreen, const char *name) +{ + Display *dpy0 = dmxScreen->beDisplay; + Atom atom0; + XTextProperty tp0; + Display *dpy1 = NULL; + Atom atom1; + XTextProperty tp1; + int retval = 0; + + if (!dpy0) + return 0; + + tp0.nitems = 0; + tp1.nitems = 0; + + if ((atom0 = XInternAtom(dpy0, DMX_ATOMNAME, True)) == None) { + dmxLog(dmxWarning, "No atom on %s\n", dmxScreen->name); + return 0; + } + if (!XGetTextProperty(dpy0, RootWindow(dpy0,0), &tp0, atom0) + || !tp0.nitems) { + dmxLog(dmxWarning, "No text property on %s\n", dmxScreen->name); + return 0; + } + + if (!(dpy1 = XOpenDisplay(name))) { + dmxLog(dmxWarning, "Cannot open %s\n", name); + goto cleanup; + } + atom1 = XInternAtom(dpy1, DMX_ATOMNAME, True); + if (atom1 == None) { + dmxLog(dmxDebug, "No atom on %s\n", name); + goto cleanup; + } + if (!XGetTextProperty(dpy1, RootWindow(dpy1,0), &tp1, atom1) + || !tp1.nitems) { + dmxLog(dmxDebug, "No text property on %s\n", name); + goto cleanup; + } + if (!strcmp((char *)tp0.value, (char *)tp1.value)) retval = 1; + + cleanup: + if (tp0.nitems) XFree(tp0.value); + if (tp1.nitems) XFree(tp1.value); + if (dpy1) XCloseDisplay(dpy1); + return retval; +} + +/** Prints a log message if \a dmxScreen is on the same backend X server + * as some other DMX backend (output) screen. Modifies the property + * (#DMX_ATOMNAME) on the backend X server to reflect the creation of \a + * dmxScreen. + * + * The root window of the backend X server holds a list of window ids + * for all DMX windows (on this DMX server or some other DMX server). + * + * This list can then be iterated, and the property for each window can + * be examined. This property contains the following tuple (no quotes): + * + * "#DMX_IDENT::," + */ +void dmxPropertyWindow(DMXScreenInfo *dmxScreen) +{ + Atom atom; + const unsigned char *id = dmxPropertyIdentifier(); + Display *dpy = dmxScreen->beDisplay; + Window win = dmxScreen->scrnWin; + DMXScreenInfo *other; + char buf[128]; /* RATS: only used with XmuSnprintf */ + + if (!dpy) + return; /* FIXME: What should be done here if Xdmx is started + * with this screen initially detached? + */ + + atom = XInternAtom(dpy, DMX_ATOMNAME, False); + if ((other = dmxPropertyCheckOtherWindows(dmxScreen, atom))) { + DMXScreenInfo *tmp = dmxScreen->next; + dmxScreen->next = (other->next ? other->next : other); + other->next = (tmp ? tmp : dmxScreen); + dmxLog(dmxDebug, "%d/%s/%lu and %d/%s/%lu are on the same backend\n", + dmxScreen->index, dmxScreen->name, dmxScreen->scrnWin, + other->index, other->name, other->scrnWin); + } + + XmuSnprintf(buf, sizeof(buf), ".%d,%lu", dmxScreen->index, + (long unsigned)win); + XChangeProperty(dpy, RootWindow(dpy,0), atom, XA_STRING, 8, + PropModeAppend, (unsigned char *)buf, strlen(buf)); + + XmuSnprintf(buf, sizeof(buf), "%s,%d", id, dmxScreen->index); + XChangeProperty(dpy, win, atom, XA_STRING, 8, + PropModeAppend, (unsigned char *)buf, strlen(buf)); +} Index: xc/programs/Xserver/hw/dmx/dmxprop.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxprop.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxprop.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,47 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxprop.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2002,2003 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * Interface for property support. \see dmxprop.c */ + +#ifndef _DMXPROP_H_ +#define _DMXPROP_H_ +extern int dmxPropertyDisplay(DMXScreenInfo *dmxScreen); +extern void dmxPropertyWindow(DMXScreenInfo *dmxScreen); +extern void *dmxPropertyIterate(DMXScreenInfo *start, + void *(*f)(DMXScreenInfo *dmxScreen, + void *closure), + void *closure); +extern int dmxPropertySameDisplay(DMXScreenInfo *dmxScreen, const char *name); +#endif Index: xc/programs/Xserver/hw/dmx/dmxscrinit.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxscrinit.c:1.2 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxscrinit.c Sat Jan 22 11:01:01 2005 @@ -0,0 +1,562 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxscrinit.c,v 1.2 2005/01/22 16:01:01 tsi Exp $ */ +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * David H. Dawes + * + */ + +/** \file + * This file provides support for screen initialization. */ + +#include "dmx.h" +#include "dmxsync.h" +#include "dmxshadow.h" +#include "dmxscrinit.h" +#include "dmxcursor.h" +#include "dmxgc.h" +#include "dmxgcops.h" +#include "dmxwindow.h" +#include "dmxpixmap.h" +#include "dmxfont.h" +#include "dmxcmap.h" +#include "dmxprop.h" +#include "dmxdpms.h" + +#ifdef RENDER +#include "dmxpict.h" +#endif + +#include "fb.h" +#include "mipointer.h" +#include "micmap.h" + +extern Bool dmxCloseScreen(int idx, ScreenPtr pScreen); +static Bool dmxSaveScreen(ScreenPtr pScreen, int what); + +static unsigned long dmxGeneration; +static unsigned long *dmxCursorGeneration; + +int dmxGCPrivateIndex; /**< Private index for GCs */ +int dmxWinPrivateIndex; /**< Private index for Windows */ +#ifdef PIXPRIV +int dmxPixPrivateIndex; /**< Private index for Pixmaps */ +#endif +int dmxFontPrivateIndex; /**< Private index for Fonts */ +int dmxScreenPrivateIndex; /**< Private index for Screens */ +int dmxColormapPrivateIndex; /**< Private index for Colormaps */ +#ifdef RENDER +int dmxPictPrivateIndex; /**< Private index for Picts */ +int dmxGlyphSetPrivateIndex; /**< Private index for GlyphSets */ +#endif + +/** Initialize the parts of screen \a idx that require access to the + * back-end server. */ +void dmxBEScreenInit(int idx, ScreenPtr pScreen) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + XSetWindowAttributes attribs; + XGCValues gcvals; + unsigned long mask; + int i, j; + + /* FIXME: The dmxScreenInit() code currently assumes that it will + * not be called if the Xdmx server is started with this screen + * detached -- i.e., it assumes that dmxScreen->beDisplay is always + * valid. This is not necessarily a valid assumption when full + * addition/removal of screens is implemented, but when this code is + * broken out for screen reattachment, then we will reevaluate this + * assumption. + */ + + pScreen->mmWidth = DisplayWidthMM(dmxScreen->beDisplay, + DefaultScreen(dmxScreen->beDisplay)); + pScreen->mmHeight = DisplayHeightMM(dmxScreen->beDisplay, + DefaultScreen(dmxScreen->beDisplay)); + + pScreen->whitePixel = dmxScreen->beWhitePixel; + pScreen->blackPixel = dmxScreen->beBlackPixel; + + /* Handle screen savers and DPMS on the backend */ + dmxDPMSInit(dmxScreen); + + /* Create root window for screen */ + mask = CWBackPixel | CWEventMask | CWColormap | CWOverrideRedirect; + attribs.background_pixel = dmxScreen->beBlackPixel; + attribs.event_mask = (KeyPressMask + | KeyReleaseMask + | ButtonPressMask + | ButtonReleaseMask + | EnterWindowMask + | LeaveWindowMask + | PointerMotionMask + | KeymapStateMask + | FocusChangeMask); + attribs.colormap = dmxScreen->beDefColormaps[dmxScreen->beDefVisualIndex]; + attribs.override_redirect = True; + + dmxScreen->scrnWin = + XCreateWindow(dmxScreen->beDisplay, + DefaultRootWindow(dmxScreen->beDisplay), + dmxScreen->scrnX, + dmxScreen->scrnY, + dmxScreen->scrnWidth, + dmxScreen->scrnHeight, + 0, + pScreen->rootDepth, + InputOutput, + dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual, + mask, + &attribs); + dmxPropertyWindow(dmxScreen); + + /* + * This turns off the cursor by defining a cursor with no visible + * components. + */ + { + char noCursorData[] = {0, 0, 0, 0, + 0, 0, 0, 0}; + Pixmap pixmap; + XColor color, tmp; + + pixmap = XCreateBitmapFromData(dmxScreen->beDisplay, dmxScreen->scrnWin, + noCursorData, 8, 8); + XAllocNamedColor(dmxScreen->beDisplay, dmxScreen->beDefColormaps[0], + "black", &color, &tmp); + dmxScreen->noCursor = XCreatePixmapCursor(dmxScreen->beDisplay, + pixmap, pixmap, + &color, &color, 0, 0); + XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin, + dmxScreen->noCursor); + + XFreePixmap(dmxScreen->beDisplay, pixmap); + } + + XMapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin); + + if (dmxShadowFB) { + mask = (GCFunction + | GCPlaneMask + | GCClipMask); + gcvals.function = GXcopy; + gcvals.plane_mask = AllPlanes; + gcvals.clip_mask = None; + + dmxScreen->shadowGC = XCreateGC(dmxScreen->beDisplay, + dmxScreen->scrnWin, + mask, &gcvals); + + dmxScreen->shadowFBImage = + XCreateImage(dmxScreen->beDisplay, + dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual, + dmxScreen->beDepth, + ZPixmap, + 0, + (char *)dmxScreen->shadow, + dmxScreen->scrnWidth, dmxScreen->scrnHeight, + dmxScreen->beBPP, + PixmapBytePad(dmxScreen->scrnWidth, + dmxScreen->beBPP)); + } else { + /* Create default drawables (used during GC creation) */ + for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) + for (j = 0; j < dmxScreen->beNumDepths; j++) + if ((dmxScreen->bePixmapFormats[i].depth == 1) || + (dmxScreen->bePixmapFormats[i].depth == + dmxScreen->beDepths[j])) { + dmxScreen->scrnDefDrawables[i] = (Drawable) + XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin, + 1, 1, dmxScreen->bePixmapFormats[i].depth); + break; + } + } +} + +/** Initialize screen number \a idx. */ +Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[]) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + int i, j; + + if (dmxGeneration != serverGeneration) { +#ifdef RENDER + /* Allocate picture private index */ + dmxPictPrivateIndex = AllocatePicturePrivateIndex(); + if (dmxPictPrivateIndex == -1) + return FALSE; + + /* Allocate glyph set private index */ + dmxGlyphSetPrivateIndex = AllocateGlyphSetPrivateIndex(); + if (dmxGlyphSetPrivateIndex == -1) + return FALSE; +#endif + + /* Allocate GC private index */ + dmxGCPrivateIndex = AllocateGCPrivateIndex(); + if (dmxGCPrivateIndex == -1) + return FALSE; + + /* Allocate window private index */ + dmxWinPrivateIndex = AllocateWindowPrivateIndex(); + if (dmxWinPrivateIndex == -1) + return FALSE; + +#ifdef PIXPRIV + /* Allocate pixmap private index */ + dmxPixPrivateIndex = AllocatePixmapPrivateIndex(); + if (dmxPixPrivateIndex == -1) + return FALSE; +#else +#error Must define PIXPRIV to compile DMX X server +#endif + + /* Allocate font private index */ + dmxFontPrivateIndex = AllocateFontPrivateIndex(); + if (dmxFontPrivateIndex == -1) + return FALSE; + + /* Allocate screen private index */ + dmxScreenPrivateIndex = AllocateScreenPrivateIndex(); + if (dmxScreenPrivateIndex == -1) + return FALSE; + + dmxGeneration = serverGeneration; + } + + if (dmxShadowFB) { + dmxScreen->shadow = shadowAlloc(dmxScreen->scrnWidth, + dmxScreen->scrnHeight, + dmxScreen->beBPP); + } else { + if (!dmxInitGC(pScreen)) return FALSE; + if (!dmxInitWindow(pScreen)) return FALSE; + if (!dmxInitPixmap(pScreen)) return FALSE; + } + + /* + * Initalise the visual types. miSetVisualTypesAndMasks() requires + * that all of the types for each depth be collected together. It's + * intended for slightly different usage to what we would like here. + * Maybe a miAddVisualTypeAndMask() function will be added to make + * things easier here. + */ + for (i = 0; i < dmxScreen->beNumDepths; i++) { + int depth; + int visuals = 0; + int bitsPerRgb = 0; + int preferredClass = -1; + Pixel redMask = 0; + Pixel greenMask = 0; + Pixel blueMask = 0; + + depth = dmxScreen->beDepths[i]; + for (j = 0; j < dmxScreen->beNumVisuals; j++) { + XVisualInfo *vi; + + vi = &dmxScreen->beVisuals[j]; + if (vi->depth == depth) { + /* Assume the masks are all the same. */ + visuals |= (1 << vi->class); + bitsPerRgb = vi->bits_per_rgb; + redMask = vi->red_mask; + greenMask = vi->green_mask; + blueMask = vi->blue_mask; + if (j == dmxScreen->beDefVisualIndex) { + preferredClass = vi->class; + } + } + } + miSetVisualTypesAndMasks(depth, visuals, bitsPerRgb, preferredClass, + redMask, greenMask, blueMask); + } + + fbScreenInit(pScreen, + dmxShadowFB ? dmxScreen->shadow : NULL, + dmxScreen->scrnWidth, + dmxScreen->scrnHeight, + dmxScreen->beXDPI, + dmxScreen->beXDPI, + dmxScreen->scrnWidth, + dmxScreen->beBPP); +#ifdef RENDER + (void)dmxPictureInit(pScreen, 0, 0); +#endif + + if (dmxShadowFB && !shadowInit(pScreen, dmxShadowUpdateProc, NULL)) + return FALSE; + + miInitializeBackingStore(pScreen); + + if (dmxShadowFB) { + miDCInitialize(pScreen, &dmxPointerCursorFuncs); + } else { + MAXSCREENSALLOC(dmxCursorGeneration); + if (dmxCursorGeneration[idx] != serverGeneration) { + if (!(miPointerInitialize(pScreen, + &dmxPointerSpriteFuncs, + &dmxPointerCursorFuncs, + FALSE))) + return FALSE; + + dmxCursorGeneration[idx] = serverGeneration; + } + } + + DMX_WRAP(CloseScreen, dmxCloseScreen, dmxScreen, pScreen); + DMX_WRAP(SaveScreen, dmxSaveScreen, dmxScreen, pScreen); + + dmxBEScreenInit(idx, pScreen); + + if (!dmxShadowFB) { + /* Wrap GC functions */ + DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen); + + /* Wrap Window functions */ + DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen); + DMX_WRAP(DestroyWindow, dmxDestroyWindow, dmxScreen, pScreen); + DMX_WRAP(PositionWindow, dmxPositionWindow, dmxScreen, pScreen); + DMX_WRAP(ChangeWindowAttributes, dmxChangeWindowAttributes, dmxScreen, + pScreen); + DMX_WRAP(RealizeWindow, dmxRealizeWindow, dmxScreen, pScreen); + DMX_WRAP(UnrealizeWindow, dmxUnrealizeWindow, dmxScreen, pScreen); + DMX_WRAP(RestackWindow, dmxRestackWindow, dmxScreen, pScreen); + DMX_WRAP(WindowExposures, dmxWindowExposures, dmxScreen, pScreen); + DMX_WRAP(PaintWindowBackground, dmxPaintWindowBackground, dmxScreen, + pScreen); + DMX_WRAP(PaintWindowBorder, dmxPaintWindowBorder, dmxScreen, pScreen); + DMX_WRAP(CopyWindow, dmxCopyWindow, dmxScreen, pScreen); + + DMX_WRAP(ResizeWindow, dmxResizeWindow, dmxScreen, pScreen); + DMX_WRAP(ReparentWindow, dmxReparentWindow, dmxScreen, pScreen); + + DMX_WRAP(ChangeBorderWidth, dmxChangeBorderWidth, dmxScreen, pScreen); + + /* Wrap Image functions */ + DMX_WRAP(GetImage, dmxGetImage, dmxScreen, pScreen); + DMX_WRAP(GetSpans, dmxGetSpans, dmxScreen, pScreen); + + /* Wrap Pixmap functions */ + DMX_WRAP(CreatePixmap, dmxCreatePixmap, dmxScreen, pScreen); + DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen); + DMX_WRAP(BitmapToRegion, dmxBitmapToRegion, dmxScreen, pScreen); + + /* Wrap Font functions */ + DMX_WRAP(RealizeFont, dmxRealizeFont, dmxScreen, pScreen); + DMX_WRAP(UnrealizeFont, dmxUnrealizeFont, dmxScreen, pScreen); + + /* Wrap Colormap functions */ + DMX_WRAP(CreateColormap, dmxCreateColormap, dmxScreen, pScreen); + DMX_WRAP(DestroyColormap, dmxDestroyColormap, dmxScreen, pScreen); + DMX_WRAP(InstallColormap, dmxInstallColormap, dmxScreen, pScreen); + DMX_WRAP(StoreColors, dmxStoreColors, dmxScreen, pScreen); + +#ifdef SHAPE + /* Wrap Shape functions */ + DMX_WRAP(SetShape, dmxSetShape, dmxScreen, pScreen); +#endif + } + + if (!dmxCreateDefColormap(pScreen)) + return FALSE; + + return TRUE; +} + +/** Close the \a pScreen resources on the back-end server. */ +void dmxBECloseScreen(ScreenPtr pScreen) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + int i; + + /* Restore the back-end screen-saver and DPMS state. */ + dmxDPMSTerm(dmxScreen); + + /* Free the screen resources */ + + XFreeCursor(dmxScreen->beDisplay, dmxScreen->noCursor); + dmxScreen->noCursor = (Cursor)0; + + XUnmapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin); + XDestroyWindow(dmxScreen->beDisplay, dmxScreen->scrnWin); + dmxScreen->scrnWin = (Window)0; + + if (dmxShadowFB) { + /* Free the shadow GC and image assocated with the back-end server */ + XFreeGC(dmxScreen->beDisplay, dmxScreen->shadowGC); + dmxScreen->shadowGC = NULL; + XFree(dmxScreen->shadowFBImage); + dmxScreen->shadowFBImage = NULL; + } else { + /* Free the default drawables */ + for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) { + XFreePixmap(dmxScreen->beDisplay, dmxScreen->scrnDefDrawables[i]); + dmxScreen->scrnDefDrawables[i] = (Drawable)0; + } + } + + /* Free resources allocated during initialization (in dmxinit.c) */ + for (i = 0; i < dmxScreen->beNumDefColormaps; i++) + XFreeColormap(dmxScreen->beDisplay, dmxScreen->beDefColormaps[i]); + xfree(dmxScreen->beDefColormaps); + dmxScreen->beDefColormaps = NULL; + +#if 0 + /* Do not free visuals, depths and pixmap formats here. Free them + * in dmxCloseScreen() instead -- see comment below. */ + XFree(dmxScreen->beVisuals); + dmxScreen->beVisuals = NULL; + + XFree(dmxScreen->beDepths); + dmxScreen->beDepths = NULL; + + XFree(dmxScreen->bePixmapFormats); + dmxScreen->bePixmapFormats = NULL; +#endif + +#ifdef GLXPROXY + if (dmxScreen->glxVisuals) { + XFree(dmxScreen->glxVisuals); + dmxScreen->glxVisuals = NULL; + dmxScreen->numGlxVisuals = 0; + } +#endif + + /* Close display */ + XCloseDisplay(dmxScreen->beDisplay); + dmxScreen->beDisplay = NULL; +} + +/** Close screen number \a idx. */ +Bool dmxCloseScreen(int idx, ScreenPtr pScreen) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[idx]; + + /* Reset the proc vectors */ + if (idx == 0) { +#ifdef RENDER + dmxResetRender(); +#endif + dmxResetFonts(); + } + + if (dmxShadowFB) { + /* Free the shadow framebuffer */ + xfree(dmxScreen->shadow); + } else { + +#ifdef SHAPE + /* Unwrap Shape functions */ + DMX_UNWRAP(SetShape, dmxScreen, pScreen); +#endif + + /* Unwrap the pScreen functions */ + DMX_UNWRAP(CreateGC, dmxScreen, pScreen); + + DMX_UNWRAP(CreateWindow, dmxScreen, pScreen); + DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen); + DMX_UNWRAP(PositionWindow, dmxScreen, pScreen); + DMX_UNWRAP(ChangeWindowAttributes, dmxScreen, pScreen); + DMX_UNWRAP(RealizeWindow, dmxScreen, pScreen); + DMX_UNWRAP(UnrealizeWindow, dmxScreen, pScreen); + DMX_UNWRAP(RestackWindow, dmxScreen, pScreen); + DMX_UNWRAP(WindowExposures, dmxScreen, pScreen); + DMX_UNWRAP(PaintWindowBackground, dmxScreen, pScreen); + DMX_UNWRAP(PaintWindowBorder, dmxScreen, pScreen); + DMX_UNWRAP(CopyWindow, dmxScreen, pScreen); + + DMX_UNWRAP(ResizeWindow, dmxScreen, pScreen); + DMX_UNWRAP(ReparentWindow, dmxScreen, pScreen); + + DMX_UNWRAP(ChangeBorderWidth, dmxScreen, pScreen); + + DMX_UNWRAP(GetImage, dmxScreen, pScreen); + DMX_UNWRAP(GetSpans, dmxScreen, pScreen); + + DMX_UNWRAP(CreatePixmap, dmxScreen, pScreen); + DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen); + DMX_UNWRAP(BitmapToRegion, dmxScreen, pScreen); + + DMX_UNWRAP(RealizeFont, dmxScreen, pScreen); + DMX_UNWRAP(UnrealizeFont, dmxScreen, pScreen); + + DMX_UNWRAP(CreateColormap, dmxScreen, pScreen); + DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen); + DMX_UNWRAP(InstallColormap, dmxScreen, pScreen); + DMX_UNWRAP(StoreColors, dmxScreen, pScreen); + } + + DMX_UNWRAP(SaveScreen, dmxScreen, pScreen); + + if (dmxScreen->beDisplay) { + dmxBECloseScreen(pScreen); + +#if 1 + /* Free visuals, depths and pixmap formats here so that they + * won't be freed when a screen is detached, thereby allowing + * the screen to be reattached to be compared to the one + * previously removed. + */ + XFree(dmxScreen->beVisuals); + dmxScreen->beVisuals = NULL; + + XFree(dmxScreen->beDepths); + dmxScreen->beDepths = NULL; + + XFree(dmxScreen->bePixmapFormats); + dmxScreen->bePixmapFormats = NULL; +#endif + } + + DMX_UNWRAP(CloseScreen, dmxScreen, pScreen); + return pScreen->CloseScreen(idx, pScreen); +} + +static Bool dmxSaveScreen(ScreenPtr pScreen, int what) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + + if (dmxScreen->beDisplay) { + switch (what) { + case SCREEN_SAVER_OFF: + case SCREEN_SAVER_FORCER: + XResetScreenSaver(dmxScreen->beDisplay); + dmxSync(dmxScreen, FALSE); + break; + case SCREEN_SAVER_ON: + case SCREEN_SAVER_CYCLE: + XActivateScreenSaver(dmxScreen->beDisplay); + dmxSync(dmxScreen, FALSE); + break; + } + } + + return TRUE; +} Index: xc/programs/Xserver/hw/dmx/dmxscrinit.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxscrinit.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxscrinit.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,52 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxscrinit.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * David H. Dawes + * + */ + +/** \file + * Interface for screen initialization. \see dmxscrinit.c */ + +#ifndef DMXSCRINIT_H +#define DMXSCRINIT_H + +#include "scrnintstr.h" + +/** Private index. \see dmxscrrinit.c \see input/dmxconcole.c */ +extern int dmxScreenPrivateIndex; + +extern Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[]); + +extern void dmxBEScreenInit(int idx, ScreenPtr pScreen); +extern void dmxBECloseScreen(ScreenPtr pScreen); + +#endif /* DMXSCRINIT_H */ Index: xc/programs/Xserver/hw/dmx/dmxshadow.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxshadow.c:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxshadow.c Wed Jun 30 16:21:39 2004 @@ -0,0 +1,68 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxshadow.c,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2001 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * David H. Dawes + * + */ + +#include "dmx.h" +#include "dmxsync.h" +#include "dmxshadow.h" + +/** \file + * This file provides support for the shadow frame buffer. */ + +/** Update the screen from the shadow frame buffer. */ +void dmxShadowUpdateProc(ScreenPtr pScreen, shadowBufPtr pBuf) +{ + RegionPtr damage = &pBuf->damage; + int nbox = REGION_NUM_RECTS(damage); + BoxPtr pbox = REGION_RECTS(damage); + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + + if (!dmxScreen->beDisplay) + return; + + while (nbox--) { + XPutImage(dmxScreen->beDisplay, + dmxScreen->scrnWin, + dmxScreen->shadowGC, + dmxScreen->shadowFBImage, + pbox->x1, pbox->y1, + pbox->x1, pbox->y1, + pbox->x2 - pbox->x1, + pbox->y2 - pbox->y1); + + pbox++; + } + + dmxSync(dmxScreen, FALSE); +} Index: xc/programs/Xserver/hw/dmx/dmxshadow.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxshadow.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxshadow.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,47 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxshadow.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2001 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * David H. Dawes + * + */ + +/** \file + * Interface for shadow framebuffer support. \see dmxshadow.c */ + +#ifndef DMXSHADOW_H +#define DMXSHADOW_H + +#include "shadow.h" +#include "scrnintstr.h" + +extern void dmxShadowUpdateProc(ScreenPtr pScreen, shadowBufPtr pBuf); + +#endif /* DMXSHADOW_H */ Index: xc/programs/Xserver/hw/dmx/dmxstat.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxstat.c:1.2 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxstat.c Sun Jan 30 12:48:44 2005 @@ -0,0 +1,217 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxstat.c,v 1.2 2005/01/30 17:48:44 tsi Exp $ */ +/* + * Copyright 2002, 2003 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * + * The DMX server code is written to call #dmxSync() whenever an XSync() + * might be necessary. However, since XSync() requires a two way + * communication with the other X server, eliminating unnecessary + * XSync() calls is a key performance optimization. Support for this + * optimization is provided in #dmxsync.c. This file provides routines + * that evaluate this optimization by counting the number of XSync() + * calls and monitoring their latency. This functionality can be turned + * on using the -stat command-line parameter. */ + +#include "dmx.h" +#include "dmxstat.h" +#include "dmxlog.h" +#include "Xos.h" /* For sys/time.h */ + +/** Used to compute a running average of value. */ +typedef struct _DMXStatAvg { + int pos; + int count; + unsigned long value[DMX_STAT_LENGTH]; +} DMXStatAvg; + +/** Statistical information about XSync calls. */ +struct _DMXStatInfo { + unsigned long syncCount; + unsigned long oldSyncCount; + + DMXStatAvg usec; + DMXStatAvg pending; + + unsigned long bins[DMX_STAT_BINS]; +}; + +/* Interval in mS between statistic message log entries. */ + int dmxStatInterval; +static int dmxStatDisplays; + +/** Return the number of microseconds as an unsigned long. + * Unfortunately, this is only useful for intervals < about 4 sec. */ +static unsigned long usec(struct timeval *stop, struct timeval *start) +{ + return (stop->tv_sec - start->tv_sec) * 1000000 + + stop->tv_usec - start->tv_usec; +} + +static unsigned long avg(DMXStatAvg *data, unsigned long *max) +{ + unsigned long sum; + int i; + + *max = 0; + if (!data->count) return 0; + + for (i = 0, sum = 0; i < data->count; i++) { + if (data->value[i] > *max) *max = data->value[i]; + sum += data->value[i]; + } + return sum / data->count; +} + +/** Turn on XSync statistic gathering and printing. Print every \a + * interval seconds, with lines for the first \a displays. If \a + * interval is NULL, 1 will be used. If \a displays is NULL, 0 will be + * used (meaning a line for every display will be printed). Note that + * this function takes string arguments because it will usually be + * called from #ddxProcessArgument in #dmxinit.c. */ +void dmxStatActivate(const char *interval, const char *displays) +{ + dmxStatInterval = (interval ? atoi(interval) : 1) * 1000; + dmxStatDisplays = (displays ? atoi(displays) : 0); + + if (dmxStatInterval < 1000) dmxStatInterval = 1000; + if (dmxStatDisplays < 0) dmxStatDisplays = 0; +} + +/** Allocate a \a DMXStatInfo structure. */ +DMXStatInfo *dmxStatAlloc(void) +{ + DMXStatInfo *pt = malloc(sizeof(*pt)); + memset(pt, 0, sizeof(*pt)); + return pt; +} + +/** Free the memory used by a \a DMXStatInfo structure. */ +void dmxStatFree(DMXStatInfo *pt) +{ + if (pt) free(pt); +} + +static void dmxStatValue(DMXStatAvg *data, unsigned long value) +{ + if (data->count != DMX_STAT_LENGTH) ++data->count; + if (data->pos >= DMX_STAT_LENGTH-1) data->pos = 0; + data->value[data->pos++] = value; +} + +/** Note that a XSync() was just done on \a dmxScreen with the \a start + * and \a stop times (from gettimeofday()) and the number of + * pending-but-not-yet-processed XSync requests. This routine is called + * from #dmxDoSync in #dmxsync.c */ +void dmxStatSync(DMXScreenInfo *dmxScreen, + struct timeval *stop, struct timeval *start, + unsigned long pending) +{ + DMXStatInfo *s = dmxScreen->stat; + unsigned long elapsed = usec(stop, start); + unsigned long thresh; + int i; + + ++s->syncCount; + dmxStatValue(&s->usec, elapsed); + dmxStatValue(&s->pending, pending); + + for (i = 0, thresh = DMX_STAT_BIN0; i < DMX_STAT_BINS-1; i++) { + if (elapsed < thresh) { + ++s->bins[i]; + break; + } + thresh *= DMX_STAT_BINMULT; + } + if (i == DMX_STAT_BINS-1) ++s->bins[i]; +} + +/* Actually do the work of printing out the human-readable message. */ +static CARD32 dmxStatCallback(OsTimerPtr timer, CARD32 t, pointer arg) +{ + int i, j; + static int header = 0; + int limit = dmxNumScreens; + + if (!dmxNumScreens) { + header = 0; + return DMX_STAT_INTERVAL; + } + + if (!header++ || !(header % 10)) { + dmxLog(dmxDebug, + " S SyncCount Sync/s avSync mxSync avPend mxPend | " + "<10ms <1s >1s\n"); + } + + if (dmxStatDisplays && dmxStatDisplays < limit) limit = dmxStatDisplays; + for (i = 0; i < limit; i++) { + DMXScreenInfo *dmxScreen = &dmxScreens[i]; + DMXStatInfo *s = dmxScreen->stat; + unsigned long aSync, mSync; + unsigned long aPend, mPend; + + if (!s) continue; + + aSync = avg(&s->usec, &mSync); + aPend = avg(&s->pending, &mPend); + dmxLog(dmxDebug, "%2d %9lu %7lu %6lu %6lu %6lu %6lu |", + i, /* S */ + s->syncCount, /* SyncCount */ + (s->syncCount + - s->oldSyncCount) * 1000 / dmxStatInterval, /* Sync/s */ + aSync, /* us/Sync */ + mSync, /* max/Sync */ + aPend, /* avgPend */ + mPend); /* maxPend */ + for (j = 0; j < DMX_STAT_BINS; j++) + dmxLogCont(dmxDebug, " %5lu", s->bins[j]); + dmxLogCont(dmxDebug, "\n"); + + /* Reset/clear */ + s->oldSyncCount = s->syncCount; + for (j = 0; j < DMX_STAT_BINS; j++) s->bins[j] = 0; + } + return DMX_STAT_INTERVAL; /* Place on queue again */ +} + +/** Try to initialize the statistic gathering and printing routines. + * Initialization only takes place if #dmxStatActivate has already been + * called. We don't need the same generation protection that we used in + * dmxSyncInit because our timer is always on a queue -- hence, server + * generation will always free it. */ +void dmxStatInit(void) +{ + if (dmxStatInterval) + TimerSet(NULL, 0, dmxStatInterval, dmxStatCallback, NULL); +} Index: xc/programs/Xserver/hw/dmx/dmxstat.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxstat.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxstat.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,56 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxstat.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * Interface for statistic gathering interface. \see dmxstat.c */ + +#ifndef _DMXSTAT_H_ +#define _DMXSTAT_H_ + +#define DMX_STAT_LENGTH 10 /**< number of events for moving average */ +#define DMX_STAT_INTERVAL 1000 /**< msec between printouts */ +#define DMX_STAT_BINS 3 /**< number of bins */ +#define DMX_STAT_BIN0 10000 /**< us for bin[0] */ +#define DMX_STAT_BINMULT 100 /**< multiplier for next bin[] */ + +extern int dmxStatInterval; /**< Only for dmxstat.c and dmxsync.c */ +extern void dmxStatActivate(const char *interval, const char *displays); +extern DMXStatInfo *dmxStatAlloc(void); +extern void dmxStatFree(DMXStatInfo *); +extern void dmxStatInit(void); +extern void dmxStatSync(DMXScreenInfo *dmxScreen, + struct timeval *stop, struct timeval *start, + unsigned long pending); + +#endif Index: xc/programs/Xserver/hw/dmx/dmxsync.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxsync.c:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxsync.c Wed Jun 30 16:21:39 2004 @@ -0,0 +1,190 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxsync.c,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * + * The DMX server code is written to call #dmxSync() whenever an XSync() + * might be necessary. However, since XSync() requires a two way + * communication with the other X server, eliminating unnecessary + * XSync() calls is a key performance optimization. Support for this + * optimization is provided here. Statistics about XSync() calls and + * latency are gathered in #dmxstat.c. + * + * During the initial conversion from calling XSync() immediately to the + * XSync() batching method implemented in this file, it was noted that, + * out of more than 300 \a x11perf tests, 8 tests became more than 100 + * times faster, with 68 more than 50X faster, 114 more than 10X faster, + * and 181 more than 2X faster. */ + +#include "dmx.h" +#include "dmxsync.h" +#include "dmxstat.h" +#include "dmxlog.h" +#include + +static int dmxSyncInterval = 100; /* Default interval in milliseconds */ +static OsTimerPtr dmxSyncTimer; +static int dmxSyncPending; + +static void dmxDoSync(DMXScreenInfo *dmxScreen) +{ + dmxScreen->needsSync = FALSE; + + if (!dmxScreen->beDisplay) + return; /* FIXME: Is this correct behavior for sync stats? */ + + if (!dmxStatInterval) { + XSync(dmxScreen->beDisplay, False); + } else { + struct timeval start, stop; + + gettimeofday(&start, 0); + XSync(dmxScreen->beDisplay, False); + gettimeofday(&stop, 0); + dmxStatSync(dmxScreen, &stop, &start, dmxSyncPending); + } +} + +static CARD32 dmxSyncCallback(OsTimerPtr timer, CARD32 time, pointer arg) +{ + int i; + + if (dmxSyncPending) { + for (i = 0; i < dmxNumScreens; i++) { + DMXScreenInfo *dmxScreen = &dmxScreens[i]; + if (dmxScreen->needsSync) dmxDoSync(dmxScreen); + } + } + dmxSyncPending = 0; + return 0; /* Do not place on queue again */ +} + +static void dmxSyncBlockHandler(pointer blockData, OSTimePtr pTimeout, + pointer pReadMask) +{ + TimerForce(dmxSyncTimer); +} + +static void dmxSyncWakeupHandler(pointer blockData, int result, + pointer pReadMask) +{ +} + +/** Request the XSync() batching optimization with the specified \a + * interval (in mS). If the \a interval is 0, 100mS is used. If the \a + * interval is less than 0, then the XSync() batching optimization is + * not requested (e.g., so the -syncbatch -1 command line option can + * turn off the default 100mS XSync() batching). + * + * Note that the parameter to this routine is a string, since it will + * usually be called from #ddxProcessArgument in #dmxinit.c */ +void dmxSyncActivate(const char *interval) +{ + dmxSyncInterval = (interval ? atoi(interval) : 100); + + if (dmxSyncInterval < 0) dmxSyncInterval = 0; +} + +/** Initialize the XSync() batching optimization, but only if + * #dmxSyncActivate was last called with a non-negative value. */ +void dmxSyncInit(void) +{ + if (dmxSyncInterval) { + RegisterBlockAndWakeupHandlers(dmxSyncBlockHandler, + dmxSyncWakeupHandler, + NULL); + dmxLog(dmxInfo, "XSync batching with %d ms interval\n", + dmxSyncInterval); + } else { + dmxLog(dmxInfo, "XSync batching disabled\n"); + } +} + +/** Request an XSync() to the display used by \a dmxScreen. If \a now + * is TRUE, call XSync() immediately instead of waiting for the next + * XSync() batching point. Note that if XSync() batching was deselected + * with #dmxSyncActivate() before #dmxSyncInit() was called, then no + * XSync() batching is performed and this function always calles XSync() + * immediately. + * + * (Note that this function uses TimerSet but works correctly in the + * face of a server generation. See the source for details.) + * + * If \a dmxScreen is \a NULL, then all pending syncs will be flushed + * immediately. + */ +void dmxSync(DMXScreenInfo *dmxScreen, Bool now) +{ + static unsigned long dmxGeneration = 0; + + if (dmxSyncInterval) { + if (dmxGeneration != serverGeneration) { + /* Server generation does a TimerInit, which frees all + * timers. So, at this point dmxSyncTimer is either: + * 1) NULL, iff dmxGeneration == 0, + * 2) freed, if it was on a queue (dmxSyncPending != 0), or + * 3) allocated, if it wasn't on a queue (dmxSyncPending == 0) + */ + if (dmxSyncTimer && !dmxSyncPending) xfree(dmxSyncTimer); + dmxSyncTimer = NULL; + now = TRUE; + dmxGeneration = serverGeneration; + } + /* Queue sync */ + if (dmxScreen) { + dmxScreen->needsSync = TRUE; + ++dmxSyncPending; + } + + /* Do sync or set time for later */ + if (now || !dmxScreen) { + if (!TimerForce(dmxSyncTimer)) dmxSyncCallback(NULL, 0, NULL); + /* At this point, dmxSyncPending == 0 because + * dmxSyncCallback must have been called. */ + if (dmxSyncPending) + dmxLog(dmxFatal, "dmxSync(%s,%d): dmxSyncPending = %d\n", + dmxScreen ? dmxScreen->name : "", now, dmxSyncPending); + } else { + dmxScreen->needsSync = TRUE; + if (dmxSyncPending == 1) + dmxSyncTimer = TimerSet(dmxSyncTimer, 0, dmxSyncInterval, + dmxSyncCallback, NULL); + } + } else { + /* If dmxSyncInterval is not being used, + * then all the backends are already + * up-to-date. */ + if (dmxScreen) dmxDoSync(dmxScreen); + } +} Index: xc/programs/Xserver/hw/dmx/dmxsync.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxsync.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxsync.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,44 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxsync.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * Interface for sync support. \see dmxsync.c */ + +#ifndef _DMXSYNC_H_ +#define _DMXSYNC_H_ + +extern void dmxSyncActivate(const char *interval); +extern void dmxSyncInit(void); +extern void dmxSync(DMXScreenInfo *dmxScreen, Bool now); +#endif Index: xc/programs/Xserver/hw/dmx/dmxvisual.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxvisual.c:1.2 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxvisual.c Sat Jan 22 11:01:01 2005 @@ -0,0 +1,137 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxvisual.c,v 1.2 2005/01/22 16:01:01 tsi Exp $ */ +/* + * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +/** \file + * This file provides support for visuals. */ + +#include "dmx.h" +#include "dmxvisual.h" + +#include "scrnintstr.h" + +#ifdef GLXPROXY + +#include + +extern VisualID glxMatchVisualInConfigList(ScreenPtr pScreen, + VisualPtr pVisual, + __GLXvisualConfig *configs, + int nconfigs); + +static Visual *dmxLookupGLXVisual(ScreenPtr pScreen, VisualPtr pVisual) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + int j; + VisualID vid; + + vid = glxMatchVisualInConfigList(pScreen, pVisual, + dmxScreen->glxVisuals, + dmxScreen->numGlxVisuals); + if (vid) { + /* Find the X visual of the matching GLX visual */ + for (j = 0; j < dmxScreen->beNumVisuals; j++) + if (vid == dmxScreen->beVisuals[j].visualid) + return dmxScreen->beVisuals[j].visual; + } + + /* No matching visual found */ + return NULL; +} +#endif + +/** Return the visual that matched \a pVisual. */ +Visual *dmxLookupVisual(ScreenPtr pScreen, VisualPtr pVisual) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + int i; +#ifdef GLXPROXY + Visual *retval; +#endif + + if (!dmxScreen->beDisplay) + return NULL; + +#ifdef GLXPROXY + if ((retval = dmxLookupGLXVisual(pScreen, pVisual))) + return retval; +#endif + + for (i = 0; i < dmxScreen->beNumVisuals; i++) { + if (pVisual->class == dmxScreen->beVisuals[i].class && + pVisual->bitsPerRGBValue == dmxScreen->beVisuals[i].bits_per_rgb && + pVisual->ColormapEntries == dmxScreen->beVisuals[i].colormap_size && + pVisual->nplanes == dmxScreen->beVisuals[i].depth && + pVisual->redMask == dmxScreen->beVisuals[i].red_mask && + pVisual->greenMask == dmxScreen->beVisuals[i].green_mask && + pVisual->blueMask == dmxScreen->beVisuals[i].blue_mask) { + return dmxScreen->beVisuals[i].visual; + } + } + + return NULL; +} + +/** Return the visual that matched the \a vid. */ +Visual *dmxLookupVisualFromID(ScreenPtr pScreen, VisualID vid) +{ + Visual *visual; + int i; + + if (!dmxScreens[pScreen->myNum].beDisplay) + return NULL; + + for (i = 0; i < pScreen->numVisuals; i++) { + if (pScreen->visuals[i].vid == vid) { + visual = dmxLookupVisual(pScreen, &pScreen->visuals[i]); + if (visual) return visual; + } + } + + return NULL; +} + +/** Return the colormap for the \a visual. */ +Colormap dmxColormapFromDefaultVisual(ScreenPtr pScreen, Visual *visual) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + int i; + + if (dmxScreen->beDisplay) { + for (i = 0; i < dmxScreen->beNumDefColormaps; i++) + if (visual == dmxScreen->beVisuals[i].visual) + return dmxScreen->beDefColormaps[i]; + } + + return None; +} Index: xc/programs/Xserver/hw/dmx/dmxvisual.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxvisual.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxvisual.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,48 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxvisual.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +/** \file + * Interface for visual support. \see dmxvisual.c */ + +#ifndef DMXVISUAL_H +#define DMXVISUAL_H + +#include "scrnintstr.h" + +extern Visual *dmxLookupVisual(ScreenPtr pScreen, VisualPtr pVisual); +extern Visual *dmxLookupVisualFromID(ScreenPtr pScreen, VisualID vid); +extern Colormap dmxColormapFromDefaultVisual(ScreenPtr pScreen, + Visual *visual); + +#endif /* DMXVISUAL_H */ Index: xc/programs/Xserver/hw/dmx/dmxwindow.c diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxwindow.c:1.3 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxwindow.c Sun Jan 30 12:48:44 2005 @@ -0,0 +1,1079 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxwindow.c,v 1.3 2005/01/30 17:48:44 tsi Exp $ */ +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +/** \file + * This file provides support for window-related functions. */ + +#include "dmx.h" +#include "dmxsync.h" +#include "dmxwindow.h" +#include "dmxpixmap.h" +#include "dmxcmap.h" +#include "dmxvisual.h" +#include "dmxinput.h" +#include "dmxextension.h" +#ifdef RENDER +#include "dmxpict.h" +#endif + +#include "windowstr.h" + +static void dmxDoRestackWindow(WindowPtr pWindow); +static void dmxDoChangeWindowAttributes(WindowPtr pWindow, + unsigned long *mask, + XSetWindowAttributes *attribs); + +#ifdef SHAPE +static void dmxDoSetShape(WindowPtr pWindow); +#endif + +/** Initialize the private area for the window functions. */ +Bool dmxInitWindow(ScreenPtr pScreen) +{ + if (!AllocateWindowPrivate(pScreen, dmxWinPrivateIndex, + sizeof(dmxWinPrivRec))) + return FALSE; + + return TRUE; +} + + +Window dmxCreateRootWindow(WindowPtr pWindow) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + Window parent; + Visual *visual; + unsigned long mask; + XSetWindowAttributes attribs; + ColormapPtr pCmap; + dmxColormapPrivPtr pCmapPriv; + + /* Create root window */ + + parent = dmxScreen->scrnWin; /* This is our "Screen" window */ + visual = dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual; + + pCmap = (ColormapPtr)LookupIDByType(wColormap(pWindow), RT_COLORMAP); + pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap); + + mask = CWEventMask | CWBackingStore | CWColormap | CWBorderPixel; + attribs.event_mask = ExposureMask; + attribs.backing_store = NotUseful; + attribs.colormap = pCmapPriv->cmap; + attribs.border_pixel = 0; + + /* Incorporate new attributes, if needed */ + if (pWinPriv->attribMask) { + dmxDoChangeWindowAttributes(pWindow, &pWinPriv->attribMask, &attribs); + mask |= pWinPriv->attribMask; + } + + return XCreateWindow(dmxScreen->beDisplay, + parent, + pWindow->origin.x - wBorderWidth(pWindow), + pWindow->origin.y - wBorderWidth(pWindow), + pWindow->drawable.width, + pWindow->drawable.height, + pWindow->borderWidth, + pWindow->drawable.depth, + pWindow->drawable.class, + visual, + mask, + &attribs); +} + +/** Change the location and size of the "screen" window. Called from + * #dmxReconfigureScreenWindow(). */ +void dmxResizeScreenWindow(ScreenPtr pScreen, + int x, int y, int w, int h) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + unsigned int m; + XWindowChanges c; + + if (!dmxScreen->beDisplay) + return; + + /* Handle resizing on back-end server */ + m = CWX | CWY | CWWidth | CWHeight; + c.x = x; + c.y = y; + c.width = w; + c.height = h; + + XConfigureWindow(dmxScreen->beDisplay, dmxScreen->scrnWin, m, &c); + dmxSync(dmxScreen, False); +} + +/** Change the location and size of the "root" window. Called from + * #dmxReconfigureRootWindow(). */ +void dmxResizeRootWindow(WindowPtr pRoot, + int x, int y, int w, int h) +{ + DMXScreenInfo *dmxScreen = &dmxScreens[pRoot->drawable.pScreen->myNum]; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pRoot); + unsigned int m; + XWindowChanges c; + + /* Handle resizing on back-end server */ + if (dmxScreen->beDisplay) { + m = CWX | CWY | CWWidth | CWHeight; + c.x = x; + c.y = y; + c.width = (w > 0) ? w : 1; + c.height = (h > 0) ? h : 1; + + XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); + } + + if (w == 0 || h == 0) { + if (pWinPriv->mapped) { + if (dmxScreen->beDisplay) + XUnmapWindow(dmxScreen->beDisplay, pWinPriv->window); + pWinPriv->mapped = FALSE; + } + } else if (!pWinPriv->mapped) { + if (dmxScreen->beDisplay) + XMapWindow(dmxScreen->beDisplay, pWinPriv->window); + pWinPriv->mapped = TRUE; + } + + if (dmxScreen->beDisplay) + dmxSync(dmxScreen, False); +} + +void dmxGetDefaultWindowAttributes(WindowPtr pWindow, + Colormap *cmap, + Visual **visual) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + + if (pWindow->drawable.class != InputOnly && + pWindow->optional && + pWindow->optional->visual != wVisual(pWindow->parent)) { + + /* Find the matching visual */ + *visual = dmxLookupVisualFromID(pScreen, wVisual(pWindow)); + + /* Handle optional colormaps */ + if (pWindow->optional->colormap) { + ColormapPtr pCmap; + dmxColormapPrivPtr pCmapPriv; + + pCmap = (ColormapPtr)LookupIDByType(wColormap(pWindow), + RT_COLORMAP); + pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap); + *cmap = pCmapPriv->cmap; + } else { + *cmap = dmxColormapFromDefaultVisual(pScreen, *visual); + } + } else { + *visual = CopyFromParent; + *cmap = (Colormap)0; + } +} + +static Window dmxCreateNonRootWindow(WindowPtr pWindow) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + Window parent; + unsigned long mask = 0L; + XSetWindowAttributes attribs; + dmxWinPrivPtr pParentPriv = DMX_GET_WINDOW_PRIV(pWindow->parent); + + /* Create window on back-end server */ + + parent = pParentPriv->window; + + /* The parent won't exist if this call to CreateNonRootWindow came + from ReparentWindow and the grandparent window has not yet been + created */ + if (!parent) { + dmxCreateAndRealizeWindow(pWindow->parent, FALSE); + parent = pParentPriv->window; + } + + /* Incorporate new attributes, if needed */ + if (pWinPriv->attribMask) { + dmxDoChangeWindowAttributes(pWindow, &pWinPriv->attribMask, &attribs); + mask |= pWinPriv->attribMask; + } + + /* Add in default attributes */ + if (pWindow->drawable.class != InputOnly) { + mask |= CWBackingStore; + attribs.backing_store = NotUseful; + + if (!(mask & CWColormap) && pWinPriv->cmap) { + mask |= CWColormap; + attribs.colormap = pWinPriv->cmap; + if (!(mask & CWBorderPixel)) { + mask |= CWBorderPixel; + attribs.border_pixel = 0; + } + } + } + + /* Handle case where subwindows are being mapped, but created out of + order -- if current window has a previous sibling, then it cannot + be created on top of the stack, so we must restack the windows */ + pWinPriv->restacked = (pWindow->prevSib != NullWindow); + + return XCreateWindow(dmxScreen->beDisplay, + parent, + pWindow->origin.x - wBorderWidth(pWindow), + pWindow->origin.y - wBorderWidth(pWindow), + pWindow->drawable.width, + pWindow->drawable.height, + pWindow->borderWidth, + pWindow->drawable.depth, + pWindow->drawable.class, + pWinPriv->visual, + mask, + &attribs); +} + +/** This function handles lazy window creation and realization. Window + * creation is handled by #dmxCreateNonRootWindow(). It also handles + * any stacking changes that have occured since the window was + * originally created by calling #dmxDoRestackWindow(). If the window + * is shaped, the shape is set on the back-end server by calling + * #dmxDoSetShape(), and if the window has pictures (from RENDER) + * associated with it, those pictures are created on the back-end + * server by calling #dmxCreatePictureList(). If \a doSync is TRUE, + * then #dmxSync() is called. */ +void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + + if (!dmxScreen->beDisplay) return; + + pWinPriv->window = dmxCreateNonRootWindow(pWindow); + if (pWinPriv->restacked) dmxDoRestackWindow(pWindow); +#ifdef SHAPE + if (pWinPriv->isShaped) dmxDoSetShape(pWindow); +#endif +#ifdef RENDER + if (pWinPriv->hasPict) dmxCreatePictureList(pWindow); +#endif + if (pWinPriv->mapped) XMapWindow(dmxScreen->beDisplay, + pWinPriv->window); + if (doSync) dmxSync(dmxScreen, False); +} + +/** Create \a pWindow on the back-end server. If the lazy window + * creation optimization is enabled, then the actual creation and + * realization of the window is handled by + * #dmxCreateAndRealizeWindow(). */ +Bool dmxCreateWindow(WindowPtr pWindow) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + Bool ret = TRUE; + + DMX_UNWRAP(CreateWindow, dmxScreen, pScreen); +#if 0 + if (pScreen->CreateWindow) + ret = pScreen->CreateWindow(pWindow); +#endif + + /* Set up the defaults */ + pWinPriv->window = (Window)0; + pWinPriv->offscreen = TRUE; + pWinPriv->mapped = FALSE; + pWinPriv->restacked = FALSE; + pWinPriv->attribMask = 0; +#ifdef SHAPE + pWinPriv->isShaped = FALSE; +#endif +#ifdef RENDER + pWinPriv->hasPict = FALSE; +#endif +#ifdef GLXPROXY + pWinPriv->swapGroup = NULL; + pWinPriv->barrier = 0; +#endif + + if (dmxScreen->beDisplay) { + /* Only create the root window at this stage -- non-root windows are + created when they are mapped and are on-screen */ + if (!pWindow->parent) { + dmxScreen->rootWin = pWinPriv->window + = dmxCreateRootWindow(pWindow); + if (dmxScreen->scrnX != dmxScreen->rootX + || dmxScreen->scrnY != dmxScreen->rootY + || dmxScreen->scrnWidth != dmxScreen->rootWidth + || dmxScreen->scrnHeight != dmxScreen->rootHeight) { + dmxResizeRootWindow(pWindow, + dmxScreen->rootX, + dmxScreen->rootY, + dmxScreen->rootWidth, + dmxScreen->rootHeight); + dmxUpdateScreenResources(screenInfo.screens[dmxScreen->index], + dmxScreen->rootX, + dmxScreen->rootY, + dmxScreen->rootWidth, + dmxScreen->rootHeight); + pWindow->origin.x = dmxScreen->rootX; + pWindow->origin.y = dmxScreen->rootY; + } + } else { + dmxGetDefaultWindowAttributes(pWindow, + &pWinPriv->cmap, + &pWinPriv->visual); + + if (dmxLazyWindowCreation) { + /* Save parent's visual for use later */ + if (pWinPriv->visual == CopyFromParent) + pWinPriv->visual = + dmxLookupVisualFromID(pScreen, + wVisual(pWindow->parent)); + } else { + pWinPriv->window = dmxCreateNonRootWindow(pWindow); + } + } + + dmxSync(dmxScreen, False); + } + + DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen); + + return ret; +} + +#ifndef RENDER +static Bool dmxDestroyPictureList(WindowPtr pWindow) +{ + return TRUE; +} +#endif + +/** Destroy \a pWindow on the back-end server. */ +Bool dmxBEDestroyWindow(WindowPtr pWindow) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + + if (pWinPriv->window) { + XDestroyWindow(dmxScreen->beDisplay, pWinPriv->window); + pWinPriv->window = (Window)0; + return TRUE; + } + + return FALSE; +} + +/** Destroy \a pWindow on the back-end server. If any RENDER pictures + were created, destroy them as well. */ +Bool dmxDestroyWindow(WindowPtr pWindow) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + Bool ret = TRUE; +#ifdef GLXPROXY + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); +#endif + + DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen); + + /* Destroy window on back-end server */ + if (dmxDestroyPictureList(pWindow) || dmxBEDestroyWindow(pWindow)) { + dmxSync(dmxScreen, FALSE); + } + +#ifdef GLXPROXY + if (pWinPriv->swapGroup && pWinPriv->windowDestroyed) + pWinPriv->windowDestroyed(pWindow); +#endif + +#if 0 + if (pScreen->DestroyWindow) + ret = pScreen->DestroyWindow(pWindow); +#endif + DMX_WRAP(DestroyWindow, dmxDestroyWindow, dmxScreen, pScreen); + + return ret; +} + +/** Change the position of \a pWindow to be \a x, \a y. */ +Bool dmxPositionWindow(WindowPtr pWindow, int x, int y) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + Bool ret = TRUE; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + unsigned int m; + XWindowChanges c; + + DMX_UNWRAP(PositionWindow, dmxScreen, pScreen); +#if 0 + if (pScreen->PositionWindow) + ret = pScreen->PositionWindow(pWindow, x, y); +#endif + + /* Determine if the window is completely off the visible portion of + the screen */ + pWinPriv->offscreen = DMX_WINDOW_OFFSCREEN(pWindow); + + /* If the window is now on-screen and it is mapped and it has not + been created yet, create it and map it */ + if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) { + dmxCreateAndRealizeWindow(pWindow, TRUE); + } else if (pWinPriv->window) { + /* Position window on back-end server */ + m = CWX | CWY | CWWidth | CWHeight; + c.x = pWindow->origin.x - wBorderWidth(pWindow); + c.y = pWindow->origin.y - wBorderWidth(pWindow); + c.width = pWindow->drawable.width; + c.height = pWindow->drawable.height; + if (pWindow->drawable.class != InputOnly) { + m |= CWBorderWidth; + c.border_width = pWindow->borderWidth; + } + + XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); + dmxSync(dmxScreen, False); + } + + DMX_WRAP(PositionWindow, dmxPositionWindow, dmxScreen, pScreen); + + return ret; +} + +static void dmxDoChangeWindowAttributes(WindowPtr pWindow, + unsigned long *mask, + XSetWindowAttributes *attribs) +{ + dmxPixPrivPtr pPixPriv; + + if (*mask & CWBackPixmap) { + switch (pWindow->backgroundState) { + case None: + attribs->background_pixmap = None; + break; + + case ParentRelative: + attribs->background_pixmap = ParentRelative; + break; + + case BackgroundPixmap: + pPixPriv = DMX_GET_PIXMAP_PRIV(pWindow->background.pixmap); + attribs->background_pixmap = pPixPriv->pixmap; + break; + + case BackgroundPixel: + *mask &= ~CWBackPixmap; + break; + } + } + + if (*mask & CWBackPixel) { + if (pWindow->backgroundState == BackgroundPixel) + attribs->background_pixel = pWindow->background.pixel; + else + *mask &= ~CWBackPixel; + } + + if (*mask & CWBorderPixmap) { + if (pWindow->borderIsPixel) + *mask &= ~CWBorderPixmap; + else { + pPixPriv = DMX_GET_PIXMAP_PRIV(pWindow->border.pixmap); + attribs->border_pixmap = pPixPriv->pixmap; + } + } + + if (*mask & CWBorderPixel) { + if (pWindow->borderIsPixel) + attribs->border_pixel = pWindow->border.pixel; + else + *mask &= ~CWBorderPixel; + } + + if (*mask & CWBitGravity) + attribs->bit_gravity = pWindow->bitGravity; + + if (*mask & CWWinGravity) + *mask &= ~CWWinGravity; /* Handled by dix */ + + if (*mask & CWBackingStore) + *mask &= ~CWBackingStore; /* Backing store not supported */ + + if (*mask & CWBackingPlanes) + *mask &= ~CWBackingPlanes; /* Backing store not supported */ + + if (*mask & CWBackingPixel) + *mask &= ~CWBackingPixel; /* Backing store not supported */ + + if (*mask & CWOverrideRedirect) + attribs->override_redirect = pWindow->overrideRedirect; + + if (*mask & CWSaveUnder) + *mask &= ~CWSaveUnder; /* Save unders not supported */ + + if (*mask & CWEventMask) + *mask &= ~CWEventMask; /* Events are handled by dix */ + + if (*mask & CWDontPropagate) + *mask &= ~CWDontPropagate; /* Events are handled by dix */ + + if (*mask & CWColormap) { + ColormapPtr pCmap; + dmxColormapPrivPtr pCmapPriv; + + pCmap = (ColormapPtr)LookupIDByType(wColormap(pWindow), RT_COLORMAP); + pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap); + attribs->colormap = pCmapPriv->cmap; + } + + if (*mask & CWCursor) + *mask &= ~CWCursor; /* Handled by the cursor code */ +} + +/** Change the window attributes of \a pWindow. */ +Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + Bool ret = TRUE; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + XSetWindowAttributes attribs; + + DMX_UNWRAP(ChangeWindowAttributes, dmxScreen, pScreen); +#if 0 + if (pScreen->ChangeWindowAttributes) + ret = pScreen->ChangeWindowAttributes(pWindow, mask); +#endif + + /* Change window attribs on back-end server */ + dmxDoChangeWindowAttributes(pWindow, &mask, &attribs); + + /* Save mask for lazy window creation optimization */ + pWinPriv->attribMask |= mask; + + if (mask && pWinPriv->window) { + XChangeWindowAttributes(dmxScreen->beDisplay, pWinPriv->window, + mask, &attribs); + dmxSync(dmxScreen, False); + } + + DMX_WRAP(ChangeWindowAttributes, dmxChangeWindowAttributes, dmxScreen, + pScreen); + + return ret; +} + +/** Realize \a pWindow on the back-end server. If the lazy window + * creation optimization is enabled, the window is only realized when + * it at least partially overlaps the screen. */ +Bool dmxRealizeWindow(WindowPtr pWindow) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + Bool ret = TRUE; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + + DMX_UNWRAP(RealizeWindow, dmxScreen, pScreen); +#if 0 + if (pScreen->RealizeWindow) + ret = pScreen->RealizeWindow(pWindow); +#endif + + /* Determine if the window is completely off the visible portion of + the screen */ + pWinPriv->offscreen = DMX_WINDOW_OFFSCREEN(pWindow); + + /* If the window hasn't been created and it's not offscreen, then + create it */ + if (!pWinPriv->window && !pWinPriv->offscreen) { + dmxCreateAndRealizeWindow(pWindow, FALSE); + } + + if (pWinPriv->window) { + /* Realize window on back-end server */ + XMapWindow(dmxScreen->beDisplay, pWinPriv->window); + dmxSync(dmxScreen, False); + } + + /* Let the other functions know that the window is now mapped */ + pWinPriv->mapped = TRUE; + + DMX_WRAP(RealizeWindow, dmxRealizeWindow, dmxScreen, pScreen); + + dmxUpdateWindowInfo(DMX_UPDATE_REALIZE, pWindow); + return ret; +} + +/** Unrealize \a pWindow on the back-end server. */ +Bool dmxUnrealizeWindow(WindowPtr pWindow) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + Bool ret = TRUE; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + + DMX_UNWRAP(UnrealizeWindow, dmxScreen, pScreen); +#if 0 + if (pScreen->UnrealizeWindow) + ret = pScreen->UnrealizeWindow(pWindow); +#endif + + if (pWinPriv->window) { + /* Unrealize window on back-end server */ + XUnmapWindow(dmxScreen->beDisplay, pWinPriv->window); + dmxSync(dmxScreen, False); + } + + /* When unrealized (i.e., unmapped), the window is always considered + off of the visible portion of the screen */ + pWinPriv->offscreen = TRUE; + pWinPriv->mapped = FALSE; + +#ifdef GLXPROXY + if (pWinPriv->swapGroup && pWinPriv->windowUnmapped) + pWinPriv->windowUnmapped(pWindow); +#endif + + DMX_WRAP(UnrealizeWindow, dmxUnrealizeWindow, dmxScreen, pScreen); + + dmxUpdateWindowInfo(DMX_UPDATE_UNREALIZE, pWindow); + return ret; +} + +static void dmxDoRestackWindow(WindowPtr pWindow) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + WindowPtr pNextSib = pWindow->nextSib; + unsigned int m; + XWindowChanges c; + + if (pNextSib == NullWindow) { + /* Window is at the bottom of the stack */ + m = CWStackMode; + c.sibling = (Window)0; + c.stack_mode = Below; + XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); + } else { + /* Window is not at the bottom of the stack */ + dmxWinPrivPtr pNextSibPriv = DMX_GET_WINDOW_PRIV(pNextSib); + + /* Handle case where siblings have not yet been created due to + lazy window creation optimization by first finding the next + sibling in the sibling list that has been created (if any) + and then putting the current window just above that sibling, + and if no next siblings have been created yet, then put it at + the bottom of the stack (since it might have a previous + sibling that should be above it). */ + while (!pNextSibPriv->window) { + pNextSib = pNextSib->nextSib; + if (pNextSib == NullWindow) { + /* Window is at the bottom of the stack */ + m = CWStackMode; + c.sibling = (Window)0; + c.stack_mode = Below; + XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); + return; + } + pNextSibPriv = DMX_GET_WINDOW_PRIV(pNextSib); + } + + m = CWStackMode | CWSibling; + c.sibling = pNextSibPriv->window; + c.stack_mode = Above; + XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); + } +} + +/** Handle window restacking. The actual restacking occurs in + * #dmxDoRestackWindow(). */ +void dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + + DMX_UNWRAP(RestackWindow, dmxScreen, pScreen); +#if 0 + if (pScreen->RestackWindow) + pScreen->RestackWindow(pWindow, pOldNextSib); +#endif + + if (pOldNextSib != pWindow->nextSib) { + /* Track restacking for lazy window creation optimization */ + pWinPriv->restacked = TRUE; + + /* Restack window on back-end server */ + if (pWinPriv->window) { + dmxDoRestackWindow(pWindow); + dmxSync(dmxScreen, False); + } + } + + DMX_WRAP(RestackWindow, dmxRestackWindow, dmxScreen, pScreen); + dmxUpdateWindowInfo(DMX_UPDATE_RESTACK, pWindow); +} + +static Bool dmxWindowExposurePredicate(Display *dpy, XEvent *ev, XPointer ptr) +{ + return (ev->type == Expose && ev->xexpose.window == *(Window *)ptr); +} + +/** Handle exposures on \a pWindow. Since window exposures are handled + * in DMX, the events that are generated by the back-end server are + * redundant, so we eat them here. */ +void dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn, + RegionPtr other_exposed) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + XEvent ev; + + DMX_UNWRAP(WindowExposures, dmxScreen, pScreen); + + dmxSync(dmxScreen, False); + + if (pWinPriv->window) { + while (XCheckIfEvent(dmxScreen->beDisplay, &ev, + dmxWindowExposurePredicate, + (XPointer)&pWinPriv->window)) { + /* Handle expose events -- this should not be necessary + since the base window in which the root window was + created is guaranteed to be on top (override_redirect), + so we should just swallow these events. If for some + reason the window is not on top, then we'd need to + collect these events and send them to the client later + (e.g., during the block handler as Xnest does). */ + } + } + +#if 1 + if (pScreen->WindowExposures) + pScreen->WindowExposures(pWindow, prgn, other_exposed); +#endif + DMX_WRAP(WindowExposures, dmxWindowExposures, dmxScreen, pScreen); +} + +/** Paint background of \a pWindow in \a pRegion. */ +void dmxPaintWindowBackground(WindowPtr pWindow, RegionPtr pRegion, int what) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + BoxPtr pBox; + int nBox; + + DMX_UNWRAP(PaintWindowBackground, dmxScreen, pScreen); +#if 0 + if (pScreen->PaintWindowBackground) + pScreen->PaintWindowBackground(pWindow, pRegion, what); +#endif + + if (pWinPriv->window) { + /* Paint window background on back-end server */ + pBox = REGION_RECTS(pRegion); + nBox = REGION_NUM_RECTS(pRegion); + while (nBox--) { + XClearArea(dmxScreen->beDisplay, pWinPriv->window, + pBox->x1 - pWindow->drawable.x, + pBox->y1 - pWindow->drawable.y, + pBox->x2 - pBox->x1, + pBox->y2 - pBox->y1, + False); + pBox++; + } + dmxSync(dmxScreen, False); + } + + DMX_WRAP(PaintWindowBackground, dmxPaintWindowBackground, dmxScreen, pScreen); +} + +/** Paint window border for \a pWindow in \a pRegion. */ +void dmxPaintWindowBorder(WindowPtr pWindow, RegionPtr pRegion, int what) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + + DMX_UNWRAP(PaintWindowBorder, dmxScreen, pScreen); +#if 0 + if (pScreen->PaintWindowBorder) + pScreen->PaintWindowBorder(pWindow, pRegion, what); +#endif + + /* Paint window border on back-end server */ + + DMX_WRAP(PaintWindowBorder, dmxPaintWindowBorder, dmxScreen, pScreen); +} + +/** Move \a pWindow on the back-end server. Determine whether or not it + * is on or offscreen, and realize it if it is newly on screen and the + * lazy window creation optimization is enabled. */ +void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + unsigned int m; + XWindowChanges c; + + DMX_UNWRAP(CopyWindow, dmxScreen, pScreen); +#if 0 + if (pScreen->CopyWindow) + pScreen->CopyWindow(pWindow, ptOldOrg, prgnSrc); +#endif + + /* Determine if the window is completely off the visible portion of + the screen */ + pWinPriv->offscreen = DMX_WINDOW_OFFSCREEN(pWindow); + + /* If the window is now on-screen and it is mapped and it has not + been created yet, create it and map it */ + if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) { + dmxCreateAndRealizeWindow(pWindow, TRUE); + } else if (pWinPriv->window) { + /* Move window on back-end server */ + m = CWX | CWY | CWWidth | CWHeight; + c.x = pWindow->origin.x - wBorderWidth(pWindow); + c.y = pWindow->origin.y - wBorderWidth(pWindow); + c.width = pWindow->drawable.width; + c.height = pWindow->drawable.height; + + XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); + dmxSync(dmxScreen, False); + } + + DMX_WRAP(CopyWindow, dmxCopyWindow, dmxScreen, pScreen); + dmxUpdateWindowInfo(DMX_UPDATE_COPY, pWindow); +} + +/** Resize \a pWindow on the back-end server. Determine whether or not + * it is on or offscreen, and realize it if it is newly on screen and + * the lazy window creation optimization is enabled. */ +void dmxResizeWindow(WindowPtr pWindow, int x, int y, + unsigned int w, unsigned int h, WindowPtr pSib) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + unsigned int m; + XWindowChanges c; + + DMX_UNWRAP(ResizeWindow, dmxScreen, pScreen); +#if 1 + if (pScreen->ResizeWindow) + pScreen->ResizeWindow(pWindow, x, y, w, h, pSib); +#endif + + /* Determine if the window is completely off the visible portion of + the screen */ + pWinPriv->offscreen = DMX_WINDOW_OFFSCREEN(pWindow); + + /* If the window is now on-screen and it is mapped and it has not + been created yet, create it and map it */ + if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) { + dmxCreateAndRealizeWindow(pWindow, TRUE); + } else if (pWinPriv->window) { + /* Handle resizing on back-end server */ + m = CWX | CWY | CWWidth | CWHeight; + c.x = pWindow->origin.x - wBorderWidth(pWindow); + c.y = pWindow->origin.y - wBorderWidth(pWindow); + c.width = pWindow->drawable.width; + c.height = pWindow->drawable.height; + + XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); + dmxSync(dmxScreen, False); + } + + DMX_WRAP(ResizeWindow, dmxResizeWindow, dmxScreen, pScreen); + dmxUpdateWindowInfo(DMX_UPDATE_RESIZE, pWindow); +} + +/** Reparent \a pWindow on the back-end server. */ +void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + dmxWinPrivPtr pParentPriv = DMX_GET_WINDOW_PRIV(pWindow->parent); + + DMX_UNWRAP(ReparentWindow, dmxScreen, pScreen); +#if 0 + if (pScreen->ReparentWindow) + pScreen->ReparentWindow(pWindow, pPriorParent); +#endif + + if (pWinPriv->window) { + if (!pParentPriv->window) { + dmxCreateAndRealizeWindow(pWindow->parent, FALSE); + } + + /* Handle reparenting on back-end server */ + XReparentWindow(dmxScreen->beDisplay, pWinPriv->window, + pParentPriv->window, + pWindow->origin.x - wBorderWidth(pWindow), + pWindow->origin.x - wBorderWidth(pWindow)); + dmxSync(dmxScreen, False); + } + + DMX_WRAP(ReparentWindow, dmxReparentWindow, dmxScreen, pScreen); + dmxUpdateWindowInfo(DMX_UPDATE_REPARENT, pWindow); +} + +/** Change border width for \a pWindow to \a width pixels. */ +void dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + unsigned int m; + XWindowChanges c; + + DMX_UNWRAP(ChangeBorderWidth, dmxScreen, pScreen); +#if 1 + if (pScreen->ChangeBorderWidth) + pScreen->ChangeBorderWidth(pWindow, width); +#endif + + /* NOTE: Do we need to check for on/off screen here? */ + + if (pWinPriv->window) { + /* Handle border width change on back-end server */ + m = CWBorderWidth; + c.border_width = width; + + XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); + dmxSync(dmxScreen, False); + } + + DMX_WRAP(ChangeBorderWidth, dmxChangeBorderWidth, dmxScreen, pScreen); +} + +#ifdef SHAPE +static void dmxDoSetShape(WindowPtr pWindow) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + int nBox; + BoxPtr pBox; + int nRect; + XRectangle *pRect; + XRectangle *pRectFirst; + + /* First, set the bounding shape */ + if (wBoundingShape(pWindow)) { + pBox = REGION_RECTS(wBoundingShape(pWindow)); + nRect = nBox = REGION_NUM_RECTS(wBoundingShape(pWindow)); + pRectFirst = pRect = xalloc(nRect * sizeof(*pRect)); + while (nBox--) { + pRect->x = pBox->x1; + pRect->y = pBox->y1; + pRect->width = pBox->x2 - pBox->x1; + pRect->height = pBox->y2 - pBox->y1; + pBox++; + pRect++; + } + XShapeCombineRectangles(dmxScreen->beDisplay, pWinPriv->window, + ShapeBounding, 0, 0, + pRectFirst, nRect, + ShapeSet, YXBanded); + xfree(pRectFirst); + } else { + XShapeCombineMask(dmxScreen->beDisplay, pWinPriv->window, + ShapeBounding, 0, 0, None, ShapeSet); + } + + /* Next, set the clip shape */ + if (wClipShape(pWindow)) { + pBox = REGION_RECTS(wClipShape(pWindow)); + nRect = nBox = REGION_NUM_RECTS(wClipShape(pWindow)); + pRectFirst = pRect = xalloc(nRect * sizeof(*pRect)); + while (nBox--) { + pRect->x = pBox->x1; + pRect->y = pBox->y1; + pRect->width = pBox->x2 - pBox->x1; + pRect->height = pBox->y2 - pBox->y1; + pBox++; + pRect++; + } + XShapeCombineRectangles(dmxScreen->beDisplay, pWinPriv->window, + ShapeClip, 0, 0, + pRectFirst, nRect, + ShapeSet, YXBanded); + xfree(pRectFirst); + } else { + XShapeCombineMask(dmxScreen->beDisplay, pWinPriv->window, + ShapeClip, 0, 0, None, ShapeSet); + } + + if (XShapeInputSelected(dmxScreen->beDisplay, pWinPriv->window)) { + ErrorF("Input selected for window %x on Screen %d\n", + (unsigned int)pWinPriv->window, pScreen->myNum); + } +} + +/** Set shape of \a pWindow on the back-end server. */ +void dmxSetShape(WindowPtr pWindow) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; + dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); + + DMX_UNWRAP(SetShape, dmxScreen, pScreen); +#if 1 + if (pScreen->SetShape) + pScreen->SetShape(pWindow); +#endif + + if (pWinPriv->window) { + /* Handle setting the current shape on the back-end server */ + dmxDoSetShape(pWindow); + dmxSync(dmxScreen, False); + } else { + pWinPriv->isShaped = TRUE; + } + + DMX_WRAP(SetShape, dmxSetShape, dmxScreen, pScreen); +} +#endif Index: xc/programs/Xserver/hw/dmx/dmxwindow.h diff -u /dev/null xc/programs/Xserver/hw/dmx/dmxwindow.h:1.2 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/dmxwindow.h Sat Jan 22 11:01:01 2005 @@ -0,0 +1,149 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/dmxwindow.h,v 1.2 2005/01/22 16:01:01 tsi Exp $ */ +/* + * Copyright 2001-2004 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin + * + */ + +/** \file + * Interface for window support. \see dmxwindow.c */ + +#ifndef DMXWINDOW_H +#define DMXWINDOW_H + +#include "windowstr.h" + +/** Window private area. */ +typedef struct _dmxWinPriv { + Window window; + Bool offscreen; + Bool mapped; + Bool restacked; + unsigned long attribMask; + Colormap cmap; + Visual *visual; +#ifdef SHAPE + Bool isShaped; +#endif +#ifdef RENDER + Bool hasPict; +#endif +#ifdef GLXPROXY + void *swapGroup; + int barrier; + void (*windowDestroyed)(WindowPtr); + void (*windowUnmapped)(WindowPtr); +#endif +} dmxWinPrivRec, *dmxWinPrivPtr; + + +extern Bool dmxInitWindow(ScreenPtr pScreen); + +extern Window dmxCreateRootWindow(WindowPtr pWindow); + +extern void dmxGetDefaultWindowAttributes(WindowPtr pWindow, + Colormap *cmap, + Visual **visual); +extern void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync); + +extern Bool dmxCreateWindow(WindowPtr pWindow); +extern Bool dmxDestroyWindow(WindowPtr pWindow); +extern Bool dmxPositionWindow(WindowPtr pWindow, int x, int y); +extern Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask); +extern Bool dmxRealizeWindow(WindowPtr pWindow); +extern Bool dmxUnrealizeWindow(WindowPtr pWindow); +extern void dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib); +extern void dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn, + RegionPtr other_exposed); +extern void dmxPaintWindowBackground(WindowPtr pWindow, RegionPtr pRegion, + int what); +extern void dmxPaintWindowBorder(WindowPtr pWindow, RegionPtr pRegion, + int what); +extern void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, + RegionPtr prgnSrc); + +extern void dmxResizeWindow(WindowPtr pWindow, int x, int y, + unsigned int w, unsigned int h, WindowPtr pSib); +extern void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent); + +extern void dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width); + +extern void dmxResizeScreenWindow(ScreenPtr pScreen, + int x, int y, int w, int h); +extern void dmxResizeRootWindow(WindowPtr pRoot, + int x, int y, int w, int h); + +extern Bool dmxBEDestroyWindow(WindowPtr pWindow); + +#ifdef SHAPE +/* Support for shape extension */ +extern void dmxSetShape(WindowPtr pWindow); +#endif + +/** Private index. \see dmxwindow.c \see dmxscrinit.c */ +extern int dmxWinPrivateIndex; + +/** Get window private pointer. */ +#define DMX_GET_WINDOW_PRIV(_pWin) \ + ((dmxWinPrivPtr)(_pWin)->devPrivates[dmxWinPrivateIndex].ptr) + +/* All of these macros are only used in dmxwindow.c */ +#define DMX_WINDOW_FUNC_PROLOGUE(_pGC) \ +do { \ + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \ + DMX_UNWRAP(funcs, pGCPriv, (_pGC)); \ + if (pGCPriv->ops) \ + DMX_UNWRAP(ops, pGCPriv, (_pGC)); \ +} while (0) + +#define DMX_WINDOW_FUNC_EPILOGUE(_pGC) \ +do { \ + dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \ + DMX_WRAP(funcs, &dmxGCFuncs, pGCPriv, (_pGC)); \ + if (pGCPriv->ops) \ + DMX_WRAP(ops, &dmxGCOps, pGCPriv, (_pGC)); \ +} while (0) + +#define DMX_WINDOW_X1(_pWin) \ + ((_pWin)->drawable.x - wBorderWidth(_pWin)) +#define DMX_WINDOW_Y1(_pWin) \ + ((_pWin)->drawable.y - wBorderWidth(_pWin)) +#define DMX_WINDOW_X2(_pWin) \ + ((_pWin)->drawable.x + wBorderWidth(_pWin) + (_pWin)->drawable.width) +#define DMX_WINDOW_Y2(_pWin) \ + ((_pWin)->drawable.y + wBorderWidth(_pWin) + (_pWin)->drawable.height) + +#define DMX_WINDOW_OFFSCREEN(_pWin) \ + (DMX_WINDOW_X1(_pWin) >= (_pWin)->drawable.pScreen->width || \ + DMX_WINDOW_Y1(_pWin) >= (_pWin)->drawable.pScreen->height || \ + DMX_WINDOW_X2(_pWin) <= 0 || \ + DMX_WINDOW_Y2(_pWin) <= 0) + +#endif /* DMXWINDOW_H */ Index: xc/programs/Xserver/hw/dmx/config/Canvas.c diff -u /dev/null xc/programs/Xserver/hw/dmx/config/Canvas.c:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/config/Canvas.c Wed Jun 30 16:21:39 2004 @@ -0,0 +1,160 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/config/Canvas.c,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 1987, 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 2002 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + * This file was originally taken from xc/lib/Xaw/Template.c + */ + +#include +#include +#include "CanvasP.h" + +static void CanvasInitialize(Widget request, Widget w, + ArgList args, Cardinal *num_args) +{ +} + +static void CanvasExpose(Widget w, XEvent *event, Region region) +{ + CanvasExposeDataRec data; + + data.w = w; + data.event = event; + data.region = region; + + if (!XtIsRealized(w)) return; + XtCallCallbacks(w, XtNcanvasExposeCallback, (XtPointer)&data); +} + +static void CanvasResize(Widget w) +{ + if (!XtIsRealized(w)) return; + XtCallCallbacks(w, XtNcanvasResizeCallback, (XtPointer)w); +} + +static void CanvasAction(Widget w, XEvent *event, + String *params, Cardinal *num_params) +{ + XtCallCallbacks(w, XtNcallback, (XtPointer)event); +} + +#define offset(field) XtOffsetOf(CanvasRec, canvas.field) +static XtResource resources[] = { + { XtNcallback, XtCCallback, XtRCallback, + sizeof(XtCallbackList), offset(input_callback), XtRCallback, NULL }, + { XtNcanvasExposeCallback, XtCcanvasExposeCallback, XtRCallback, + sizeof(XtCallbackList), offset(expose_callback), XtRCallback, NULL }, + { XtNcanvasResizeCallback, XtCcanvasResizeCallback, XtRCallback, + sizeof(XtCallbackList), offset(resize_callback), XtRCallback, NULL }, +}; +#undef offset + +static XtActionsRec actions[] = +{ + {"canvas", CanvasAction}, +}; + +static char translations[] = +": canvas()\n\ +: canvas()\n\ +: canvas()\n\ +: canvas()\n\ +" +; + +#define Superclass (&widgetClassRec) +CanvasClassRec canvasClassRec = { + /* core */ + { + (WidgetClass)Superclass, /* superclass */ + "Canvas", /* class_name */ + sizeof(CanvasRec), /* widget_size */ + NULL, /* class_initialize */ + NULL, /* class_part_initialize */ + False, /* class_inited */ + CanvasInitialize, /* initialize */ + NULL, /* initialize_hook */ + XtInheritRealize, /* realize */ + actions, /* actions */ + XtNumber(actions), /* num_actions */ + resources, /* resources */ + XtNumber(resources), /* num_resources */ + NULLQUARK, /* xrm_class */ + True, /* compress_motion */ + True, /* compress_exposure */ + True, /* compress_enterleave */ + False, /* visible_interest */ + NULL, /* destroy */ + CanvasResize, /* resize */ + CanvasExpose, /* expose */ + NULL, /* set_values */ + NULL, /* set_values_hook */ + XtInheritSetValuesAlmost, /* set_values_almost */ + NULL, /* get_values_hook */ + NULL, /* accept_focus */ + XtVersion, /* version */ + NULL, /* callback_private */ + translations, /* tm_table */ + XtInheritQueryGeometry, /* query_geometry */ + XtInheritDisplayAccelerator, /* display_accelerator */ + NULL, /* extension */ + }, + /* canvas */ + { + NULL, /* extension */ + } +}; + +WidgetClass canvasWidgetClass = (WidgetClass)&canvasClassRec; Index: xc/programs/Xserver/hw/dmx/config/Canvas.h diff -u /dev/null xc/programs/Xserver/hw/dmx/config/Canvas.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/config/Canvas.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,56 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/config/Canvas.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + +Copyright 1987, 1998 The Open Group +Copyright 2002 Red Hat Inc., Durham, North Carolina. + +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: + * Rickard E. (Rik) Faith + * + * This file was originally taken from xc/lib/Xaw/Template.h + */ + +#ifndef _Canvas_h +#define _Canvas_h + +#include + +#define XtNcanvasExposeCallback "canvasExposeCallback" +#define XtCcanvasExposeCallback "CanvasExposeCallback" +#define XtNcanvasResizeCallback "canvasResizeCallback" +#define XtCcanvasResizeCallback "CanvasResizeCallback" + +typedef struct _CanvasClassRec *CanvasWidgetClass; +typedef struct _CanvasRec *CanvasWidget; +extern WidgetClass canvasWidgetClass; + +typedef struct _CanvasExposeDataRec { + Widget w; + XEvent *event; + Region region; +} CanvasExposeDataRec, *CanvasExposeDataPtr; + +#endif /* _Canvas_h */ Index: xc/programs/Xserver/hw/dmx/config/CanvasP.h diff -u /dev/null xc/programs/Xserver/hw/dmx/config/CanvasP.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/config/CanvasP.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,66 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/config/CanvasP.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + +Copyright 1987, 1998 The Open Group +Copyright 2002 Red Hat Inc., Durham, North Carolina. + +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: + * Rickard E. (Rik) Faith + * + * This file was originally taken from xc/lib/Xaw/TemplateP.h + */ + +#ifndef _CanvasP_h +#define _CanvasP_h + +#include "Canvas.h" + +/* include superclass private header file */ +#include + +typedef struct { + XtPointer extension; +} CanvasClassPart; + +typedef struct _CanvasClassRec { + CoreClassPart core_class; + CanvasClassPart canvas_class; +} CanvasClassRec; + +extern CanvasClassRec canvasClassRec; + +typedef struct { + XtCallbackList input_callback; + XtCallbackList expose_callback; + XtCallbackList resize_callback; +} CanvasPart; + +typedef struct _CanvasRec { + CorePart core; + CanvasPart canvas; +} CanvasRec; + +#endif /* _CanvasP_h */ Index: xc/programs/Xserver/hw/dmx/config/Imakefile diff -u /dev/null xc/programs/Xserver/hw/dmx/config/Imakefile:1.3 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/config/Imakefile Sun Feb 6 20:38:24 2005 @@ -0,0 +1,82 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/dmx/config/Imakefile,v 1.3 2005/02/07 01:38:24 tsi Exp $ + +#include + +YFLAGS = -d + +LIBSRCS = parser.c scanner.c dmxparse.c dmxprint.c dmxcompat.c dmxconfig.c +LIBOBJS = parser.o scanner.o dmxparse.o dmxprint.o dmxcompat.o dmxconfig.o + +CONFIGSRCS = xdmxconfig.c dmxlog.c Canvas.c +CONFIGOBJS = xdmxconfig.o dmxlog.o Canvas.o + +COMPATSRCS = vdltodmx.c +COMPATOBJS = vdltodmx.o + +TESTSRCS = dmxtodmx.c +TESTOBJS = dmxtodmx.o + +SRCS = $(LIBSRCS) $(CONFIGSRCS) $(COMPATSRCS) $(TESTSRCS) +OBJS = $(LIBOBJS) $(CONFIGOBJS) $(COMPATOBJS) $(TESTOBJS) + +EXES = xdmxconfig vdltodmx dmxtodmx + +LOCAL_LIBRARIES = -L. -ldmxconfig + +#include + +INCLUDES = -I. -I.. -I$(XBUILDINCDIR) -I$(FONTINCSRC) -I../../../mi \ + -I../../../include -I../../../render -I$(EXTINCSRC) + +DEFINES = $(OS_DEFINES) $(EXT_DEFINES) -DDMX_LOG_STANDALONE $(DMX_DEFINES) + +all:: + +LexFile(scanner) +YaccFile(parser,$(YFLAGS)) + +NormalLibraryObjectRule() +NormalLibraryTarget(dmxconfig,$(LIBOBJS)) + +NormalProgramTarget(xdmxconfig,$(CONFIGOBJS),\ + libdmxconfig.a XawClientDepLibs $(DEPXTOOLLIB),\ + $(LOCAL_LIBRARIES) XawClientLibs $(XTOOLLIB),NullParameter) +AllTarget(ProgramTargetName(xdmxconfig)) +InstallProgram(xdmxconfig,$(BINDIR)) + +NormalProgramTarget(vdltodmx,$(COMPATOBJS),libdmxconfig.a,\ + $(LOCAL_LIBRARIES),NullParameter) +AllTarget(ProgramTargetName(vdltodmx)) +InstallProgram(vdltodmx,$(BINDIR)) + +NormalProgramTarget(dmxtodmx,$(TESTOBJS),libdmxconfig.a,\ + $(LOCAL_LIBRARIES),NullParameter) +AllTarget(ProgramTargetName(dmxtodmx)) +InstallProgram(dmxtodmx,$(BINDIR)) + +LinkSourceFile(dmxlog.c,..) + +InstallManPage(dmxtodmx,$(MANDIR)) +InstallManPage(vdltodmx,$(MANDIR)) +InstallManPage(xdmxconfig,$(MANDIR)) + +DependTarget() + +test: $(EXES) + @for i in test-*.in; do \ + b=`echo $$i | sed 's,.in$$,,'` \ + export b; \ + (./dmxtodmx < $$i > $$b.tmp 2>&1; exit 0); \ + if cmp -s ./$$b.out ./$$b.tmp; \ + then echo PASSED $$b; rm -f $$b.tmp; \ + else echo "FAILED $$b **********"; \ + fi \ + done + +test-update: + @for i in test-*.in; do \ + b=`echo $$i | sed 's,.in$$,,'` \ + export b; \ + echo Writing $$b.out; \ + (./dmxtodmx < $$i > $$b.out 2>&1; exit 0) \ + done Index: xc/programs/Xserver/hw/dmx/config/TODO diff -u /dev/null xc/programs/Xserver/hw/dmx/config/TODO:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/config/TODO Wed Jun 30 16:21:39 2004 @@ -0,0 +1,7 @@ +Fri May 31 13:20:17 2002 + +1) Sanitize values from input boxes. + +2) Add canvas colors to cavas widget resources or to command-line options. + +3) Add ability to edit option line(s) and wall. Index: xc/programs/Xserver/hw/dmx/config/dmxcompat.c diff -u /dev/null xc/programs/Xserver/hw/dmx/config/dmxcompat.c:1.2 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/config/dmxcompat.c Sun Jan 30 12:48:44 2005 @@ -0,0 +1,231 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/config/dmxcompat.c,v 1.2 2005/01/30 17:48:44 tsi Exp $ */ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + */ + +/** \file + * This file provides some compatibility support for reading VDL files + * that are used by xmovie + * (http://www.llnl.gov/icc/sdd/img/xmovie/xmovie.shtml). + * + * This file is not used by the DMX server. + */ + +#include "dmxconfig.h" +#include "dmxparse.h" +#include "dmxcompat.h" +#include "parser.h" +#include +#include +#include +#include + +static int dmxVDLReadLine(FILE *str, char *buf, int len) +{ + if (fgets(buf, len, str)) return strlen(buf); + return 0; +} + +static int dmxVDLCount(const char *buf) +{ + return strtol(buf, NULL, 10); +} + +static void dmxVDLVirtualEntry(const char *buf, + char *name, int *len, + int *x, int *y) +{ + char *end; + const char *s; + char *d; + int start; + + *x = strtol(buf, &end, 10); + *y = strtol(end, &end, 10); + + for (s = end, d = name, start = 1; *s && *s != '['; ++s) { + if (start && isspace(*s)) continue; + *d++ = *s; + start = 0; + } + *d = '\0'; + while (d > name && isspace(d[-1])) *--d = '\0'; /* remove trailing space */ + *len = strlen(name); +} + +static void dmxVDLDisplayEntry(const char *buf, + char *name, int *len, + int *x, int *y, + int *xoff, int *yoff, + int *xorig, int *yorig) +{ + const char *pt; + char *end; + + pt = strchr(buf, ' '); + strncpy(name, buf, pt-buf); + name[pt-buf] = '\0'; + *len = strlen(name); + + *x = strtol(pt, &end, 10); + *y = strtol(end, &end, 10); + *xorig = strtol(end, &end, 10); + *yorig = strtol(end, &end, 10); + *xoff = strtol(end, &end, 10); + *yoff = strtol(end, NULL, 10); +} + +/** Read from the VDL format \a filename and return a newly allocated \a + * DMXConfigEntryPtr */ +DMXConfigEntryPtr dmxVDLRead(const char *filename) +{ + FILE *str; + char buf[2048]; /* RATS: Use ok */ + char *pt; + int lineno = 0; + DMXConfigEntryPtr entry = NULL; + DMXConfigVirtualPtr virtual = NULL; + DMXConfigSubPtr sub = NULL; + DMXConfigDisplayPtr display = NULL; + DMXConfigFullDimPtr fdim = NULL; + int dcount = 0; + int icount = 0; + int x, y, xoff, yoff, xorig, yorig; + char name[2048]; /* RATS: Use ok */ + const char *tmp; + int len; + enum { + simulateFlag, + virtualCount, + virtualEntry, + displayCount, + displayEntry, + ignoreCount, + ignoreEntry + } state = simulateFlag; + + if (!filename) str = stdin; + else str = fopen(filename, "r"); + if (!str) return NULL; + + while (dmxVDLReadLine(str, buf, sizeof(buf))) { + DMXConfigCommentPtr comment = NULL; + + ++lineno; + for (pt = buf; *pt; pt++) + if (*pt == '\r' || *pt == '\n') { + *pt = '\0'; + break; + } + if (buf[0] == '#') { + tmp = dmxConfigCopyString(buf + 1, strlen(buf + 1)); + comment = dmxConfigCreateComment(T_COMMENT, lineno, tmp); + entry = dmxConfigAddEntry(entry, dmxConfigComment, comment, NULL); + continue; + } + switch (state) { + case simulateFlag: + state = virtualCount; + break; + case virtualCount: + state = virtualEntry; + break; + case virtualEntry: + len = sizeof(name); + dmxVDLVirtualEntry(buf, name, &len, &x, &y); + tmp = dmxConfigCopyString(name, len); + virtual = dmxConfigCreateVirtual(NULL, + dmxConfigCreateString(T_STRING, + lineno, + NULL, + tmp), + dmxConfigCreatePair(T_DIMENSION, + lineno, + NULL, + x, y, 0, 0), + NULL, NULL, NULL); + state = displayCount; + break; + case displayCount: + dcount = dmxVDLCount(buf); + state = displayEntry; + break; + case displayEntry: + dmxVDLDisplayEntry(buf, name, &len, &x, &y, &xoff, &yoff, + &xorig, &yorig); + tmp = dmxConfigCopyString(name, len); + fdim = dmxConfigCreateFullDim( + dmxConfigCreatePartDim( + dmxConfigCreatePair(T_DIMENSION, + lineno, + NULL, + x, y, 0, 0), + dmxConfigCreatePair(T_OFFSET, + lineno, + NULL, + xoff, yoff, + xoff, yoff)), + NULL); + display = dmxConfigCreateDisplay(NULL, + dmxConfigCreateString(T_STRING, + lineno, + NULL, + tmp), + fdim, + dmxConfigCreatePair(T_ORIGIN, + lineno, + NULL, + xorig, yorig, + 0, 0), + NULL); + sub = dmxConfigAddSub(sub, dmxConfigSubDisplay(display)); + if (!--dcount) { + state = ignoreCount; + virtual->subentry = sub; + entry = dmxConfigAddEntry(entry, + dmxConfigVirtual, + NULL, + virtual); + virtual = NULL; + sub = NULL; + } + break; + case ignoreCount: + icount = dmxVDLCount(buf); + state = ignoreEntry; + break; + case ignoreEntry: + if (!--icount) state = virtualEntry; + break; + } + } + return entry; +} Index: xc/programs/Xserver/hw/dmx/config/dmxcompat.h diff -u /dev/null xc/programs/Xserver/hw/dmx/config/dmxcompat.h:1.1 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/config/dmxcompat.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,45 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/config/dmxcompat.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * Interface to VDL compatibility support. \see dmxcompat.c + * + * This file is not used by the DMX server. + */ + +#ifndef _DMXCOMPAT_H_ +#define _DMXCOMPAT_H_ + +extern DMXConfigEntryPtr dmxVDLRead(const char *filename); +#endif Index: xc/programs/Xserver/hw/dmx/config/dmxconfig.c diff -u /dev/null xc/programs/Xserver/hw/dmx/config/dmxconfig.c:1.2 --- /dev/null Wed Mar 16 21:06:44 2005 +++ xc/programs/Xserver/hw/dmx/config/dmxconfig.c Sun Jan 30 12:48:44 2005 @@ -0,0 +1,495 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/config/dmxconfig.c,v 1.2 2005/01/30 17:48:44 tsi Exp $ */ +/* + * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * Provides interface for reading DMX configuration files and for + * combining that information with command-line configuration parameters. */ + + +#include "dmx.h" +#include "dmxinput.h" +#include "dmxconfig.h" +#include "dmxparse.h" +#include "dmxlog.h" +#include "dmxcb.h" +#include "dmxstat.h" +#include "parser.h" + +extern int yyparse(void); +extern FILE *yyin; + +static char *dmxXkbRules; +static char *dmxXkbModel; +static char *dmxXkbLayout; +static char *dmxXkbVariant; +static char *dmxXkbOptions; + +/** Stores lists of configuration information. */ +typedef struct DMXConfigListStruct { + const char *name; + struct DMXConfigListStruct *next; +} DMXConfigList, *DMXConfigListPtr; + +/** This stucture stores the parsed configuration information. */ +typedef struct DMXConfigCmdStruct { + const char *filename; + const char *config; + DMXConfigList *displays; + DMXConfigList *inputs; + DMXConfigList *xinputs; +} DMXConfigCmd, *DMXConfigCmdPtr; + +extern DMXConfigEntryPtr dmxConfigEntry; +static DMXConfigCmd dmxConfigCmd; + +static int dmxDisplaysFromCommandLine; + +/** Make a note that \a display is the name of an X11 display that + * should be initialized as a backend (output) display. Called from + * #ddxProcessArgument. */ +void dmxConfigStoreDisplay(const char *display) +{ + DMXConfigListPtr entry = malloc(sizeof(*entry)); + entry->name = strdup(display); + entry->next = NULL; + if (!dmxConfigCmd.displays) dmxConfigCmd.displays = entry; + else { + DMXConfigList *pt; + for (pt = dmxConfigCmd.displays; pt->next; pt = pt->next); + if (!pt) + dmxLog(dmxFatal, "dmxConfigStoreDisplay: end of list non-NULL\n"); + pt->next = entry; + } + ++dmxDisplaysFromCommandLine; +} + +/** Make a note that \a input is the name of an X11 display that should + * be used for input (either a backend or a console input device). */ +void dmxConfigStoreInput(const char *input) +{ + DMXConfigListPtr entry = malloc(sizeof(*entry)); + entry->name = strdup(input); + entry->next = NULL; + if (!dmxConfigCmd.inputs) dmxConfigCmd.inputs = entry; + else { + DMXConfigList *pt; + for (pt = dmxConfigCmd.inputs; pt->next; pt = pt->next); + if (!pt) + dmxLog(dmxFatal, "dmxConfigStoreInput: end of list non-NULL\n"); + pt->next = entry; + } +} + +/** Make a note that \a input is the name of an X11 display that should + * be used for input from XInput extension devices. */ +void dmxConfigStoreXInput(const char *input) +{ + DMXConfigListPtr entry = malloc(sizeof(*entry)); + entry->name = strdup(input); + entry->next = NULL; + if (!dmxConfigCmd.xinputs) dmxConfigCmd.xinputs = entry; + else { + DMXConfigList *pt; + for (pt = dmxConfigCmd.xinputs; pt->next; pt = pt->next); + if (!pt) + dmxLog(dmxFatal, "dmxConfigStoreXInput: end of list non-NULL\n"); + pt->next = entry; + } +} + +/** Make a note that \a file is the configuration file. */ +void dmxConfigStoreFile(const char *file) +{ + if (dmxConfigCmd.filename) + dmxLog(dmxFatal, "Only one -configfile allowed\n"); + dmxConfigCmd.filename = strdup(file); +} + +/** Make a note that \a config should be used as the configuration for + * current instantiation of the DMX server. */ +void dmxConfigStoreConfig(const char *config) +{ + if (dmxConfigCmd.config) dmxLog(dmxFatal, "Only one -config allowed\n"); + dmxConfigCmd.config = strdup(config); +} + +static int dmxConfigReadFile(const char *filename, int debug) +{ + FILE *str; + + if (!(str = fopen(filename, "r"))) return -1; + dmxLog(dmxInfo, "Reading configuration file \"%s\"\n", filename); + yyin = str; + yydebug = debug; + yyparse(); + fclose(str); + return 0; +} + +static const char *dmxConfigMatch(const char *target, DMXConfigEntryPtr entry) +{ + DMXConfigVirtualPtr v = entry->virtual; + const char *name = NULL; + + if (v && v->name) name = v->name; + + if (v && !dmxConfigCmd.config) return v->name ? v->name : ""; + if (!name) return NULL; + if (!strcmp(name, target)) return name; + return NULL; +} + +static DMXScreenInfo *dmxConfigAddDisplay(const char *name, + int scrnWidth, int scrnHeight, + int scrnX, int scrnY, + int scrnXSign, int scrnYSign, + int rootWidth, int rootHeight, + int rootX, int rootY, + int rootXSign, int rootYSign) +{ + DMXScreenInfo *dmxScreen; + + if (!(dmxScreens = realloc(dmxScreens, + (dmxNumScreens+1) * sizeof(*dmxScreens)))) + dmxLog(dmxFatal, + "dmxConfigAddDisplay: realloc failed for screen %d (%s)\n", + dmxNumScreens, name); + + dmxScreen = &dmxScreens[dmxNumScreens]; + memset(dmxScreen, 0, sizeof(*dmxScreen)); + dmxScreen->name = name; + dmxScreen->index = dmxNumScreens; + dmxScreen->scrnWidth = scrnWidth; + dmxScreen->scrnHeight = scrnHeight; + dmxScreen->scrnX = scrnX; + dmxScreen->scrnY = scrnY; + dmxScreen->scrnXSign = scrnXSign; + dmxScreen->scrnYSign = scrnYSign; + dmxScreen->rootWidth = rootWidth; + dmxScreen->rootHeight = rootHeight; + dmxScreen->rootX = rootX; + dmxScreen->rootY = rootY; + dmxScreen->stat = dmxStatAlloc(); + ++dmxNumScreens; + return dmxScreen; +} + +DMXInputInfo *dmxConfigAddInput(const char *name, int core) +{ + DMXInputInfo *dmxInput; + + if (!(dmxInputs = realloc(dmxInputs, + (dmxNumInputs+1) * sizeof(*dmxInputs)))) + dmxLog(dmxFatal, + "dmxConfigAddInput: realloc failed for input %d (%s)\n", + dmxNumInputs, name); + + dmxInput = &dmxInputs[dmxNumInputs]; + + memset(dmxInput, 0, sizeof(*dmxInput)); + dmxInput->name = name; + dmxInput->inputIdx = dmxNumInputs; + dmxInput->scrnIdx = -1; + dmxInput->core = core; + ++dmxNumInputs; + return dmxInput; +} + +static void dmxConfigCopyFromDisplay(DMXConfigDisplayPtr d) +{ + DMXScreenInfo *dmxScreen; + + dmxScreen = dmxConfigAddDisplay(d->name, + d->scrnWidth, d->scrnHeight, + d->scrnX, d->scrnY, + d->scrnXSign, d->scrnYSign, + d->rootWidth, d->rootHeight, + d->rootX, d->rootY, + d->rootXSign, d->rootXSign); + dmxScreen->where = PosAbsolute; + dmxScreen->whereX = d->rootXOrigin; + dmxScreen->whereY = d->rootYOrigin; +} + +static void dmxConfigCopyFromWall(DMXConfigWallPtr w) +{ + DMXConfigStringPtr pt; + DMXScreenInfo *dmxScreen; + int edge = dmxNumScreens; + int last = dmxNumScreens; + + if (!w->xwall && !w->ywall) { /* Try to make it square */ + int count; + for (pt = w->nameList, count = 0; pt; pt = pt->next) ++count; + w->xwall = sqrt(count) + .5; + } + + for (pt = w->nameList; pt; pt = pt->next) { + dmxScreen = dmxConfigAddDisplay(pt->string, w->width, w->height, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + if (pt == w->nameList) { /* Upper left */ + dmxScreen->where = PosAbsolute; + dmxScreen->whereX = 0; + dmxScreen->whereY = 0; + } else if (w->xwall) { /* Tile left to right, then top to bottom */ + if (!((dmxNumScreens-1) % w->xwall)) { + dmxScreen->where = PosBelow; + dmxScreen->whereRefScreen = edge; + edge = dmxNumScreens-1; + } else { + dmxScreen->where = PosRightOf; + dmxScreen->whereRefScreen = last; + } + } else { /* Tile top to bottom, then left to right */ + if (!((dmxNumScreens-1) % w->ywall)) { + dmxScreen->where = PosRightOf; + dmxScreen->whereRefScreen = edge; + edge = dmxNumScreens-1; + } else { + dmxScreen->where = PosBelow; + dmxScreen->whereRefScreen = last; + } + + } + last = dmxNumScreens-1; + if (dmxScreen->where == PosAbsolute) + dmxLog(dmxInfo, "Added %s at %d %d\n", + pt->string, dmxScreen->whereX, dmxScreen->whereY); + else + dmxLog(dmxInfo, "Added %s %s %s\n", + pt->string, + dmxScreen->where == PosBelow ? "below" : "right of", + dmxScreens[dmxScreen->whereRefScreen].name); + } +} + +static void dmxConfigCopyFromOption(DMXConfigOptionPtr o) +{ + DMXConfigStringPtr pt; + int argc = 0; + char **argv = NULL; + + if (serverGeneration != 1) return; /* FIXME: only do once, for now */ + if (!o || !o->string) return; + for (pt = o->option; pt; pt = pt->next) { + if (pt->string) { + ++argc; + argv = realloc(argv, (argc+1) * sizeof(*argv)); + argv[argc] = (char *)pt->string; + } + } + argv[0] = NULL; + ProcessCommandLine(argc+1, argv); + free(argv); +} + +static void dmxConfigCopyFromParam(DMXConfigParamPtr p) +{ + const char **argv; + int argc; + + if ((argv = dmxConfigLookupParam(p, "xkbrules", &argc)) && argc == 2) { + dmxConfigSetXkbRules(argv[1]); + } else if ((argv = dmxConfigLookupParam(p, "xkbmodel", &argc)) + && argc == 2) { + dmxConfigSetXkbModel(argv[1]); + } else if ((argv = dmxConfigLookupParam(p, "xkblayout", &argc)) + && argc == 2) { + dmxConfigSetXkbLayout(argv[1]); + } else if ((argv = dmxConfigLookupParam(p, "xkbvariant", &argc)) + && argc == 2) { + dmxConfigSetXkbVariant(argv[1]); + } else if ((argv = dmxConfigLookupParam(p, "xkboptions", &argc)) + && argc == 2) { + dmxConfigSetXkbOptions(argv[1]); + } +} + +static void dmxConfigCopyData(DMXConfigVirtualPtr v) +{ + DMXConfigSubPtr sub; + + if (v->dim) dmxSetWidthHeight(v->dim->x, v->dim->y); + else dmxSetWidthHeight(0, 0); + for (sub = v->subentry; sub; sub = sub->next) { + switch (sub->type) { + case dmxConfigDisplay: dmxConfigCopyFromDisplay(sub->display); break; + case dmxConfigWall: dmxConfigCopyFromWall(sub->wall); break; + case dmxConfigOption: dmxConfigCopyFromOption(sub->option); break; + case dmxConfigParam: dmxConfigCopyFromParam(sub->param); break; + default: + dmxLog(dmxFatal, + "dmxConfigCopyData: not a display, wall, or value\n"); + } + } +} + +static void dmxConfigFromCommandLine(void) +{ + DMXConfigListPtr pt; + + dmxLog(dmxInfo, "Using configuration from command line\n"); + for (pt = dmxConfigCmd.displays; pt; pt = pt->next) { + DMXScreenInfo *dmxScreen = dmxConfigAddDisplay(pt->name, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0); + if (dmxNumScreens == 1) { + dmxScreen->where = PosAbsolute; + dmxScreen->whereX = 0; + dmxScreen->whereY = 0; + dmxLog(dmxInfo, "Added %s at %d %d\n", + dmxScreen->name, dmxScreen->whereX, dmxScreen->whereY); + } else { + dmxScreen->where = PosRightOf; + dmxScreen->whereRefScreen = dmxNumScreens - 2; + if (dmxScreen->whereRefScreen < 0) dmxScreen->whereRefScreen = 0; + dmxLog(dmxInfo, "Added %s %s %s\n", + dmxScreen->name, + dmxScreen->where == PosBelow ? "below" : "right of", + dmxScreens[dmxScreen->whereRefScreen].name); + } + } +} + +static void dmxConfigFromConfigFile(void) +{ + DMXConfigEntryPtr pt; + const char *name; + + for (pt = dmxConfigEntry; pt; pt = pt->next) { + /* FIXME -- if an input is specified, use it */ + if (pt->type != dmxConfigVirtual) continue; + if ((name = dmxConfigMatch(dmxConfigCmd.config, pt))) { + dmxLog(dmxInfo, "Using configuration \"%s\"\n", name); + dmxConfigCopyData(pt->virtual); + return; + } + } + dmxLog(dmxFatal, "Could not find configuration \"%s\" in \"%s\"\n", + dmxConfigCmd.config, dmxConfigCmd.filename); +} + +static void dmxConfigConfigInputs(void) +{ + DMXConfigListPtr pt; + + if (dmxNumInputs) return; + + if (dmxConfigCmd.inputs) { /* Use command line */ + for (pt = dmxConfigCmd.inputs; pt; pt = pt->next) + dmxConfigAddInput(pt->name, TRUE); + } else if (dmxNumScreens) { /* Use first display */ + dmxConfigAddInput(dmxScreens[0].name, TRUE); + } else { /* Use dummy */ + dmxConfigAddInput("dummy", TRUE); + } + + if (dmxConfigCmd.xinputs) { /* Non-core devices from command line */ + for (pt = dmxConfigCmd.xinputs; pt; pt = pt->next) + dmxConfigAddInput(pt->name, FALSE); + } +} + +/** Set up the appropriate global variables so that the DMX server will + * be initialized using the configuration specified in the config file + * and on the command line. */ +void dmxConfigConfigure(void) +{ + if (dmxConfigEntry) { + dmxConfigFreeEntry(dmxConfigEntry); + dmxConfigEntry = NULL; + } + if (dmxConfigCmd.filename) { + if (dmxConfigCmd.displays) + dmxLog(dmxWarning, + "Using configuration file \"%s\" instead of command line\n", + dmxConfigCmd.filename); + dmxConfigReadFile(dmxConfigCmd.filename, 0); + dmxConfigFromConfigFile(); + } else { + if (dmxConfigCmd.config) + dmxLog(dmxWarning, + "Configuration name (%s) without configuration file\n", + dmxConfigCmd.config); + dmxConfigFromCommandLine(); + } + dmxConfigConfigInputs(); +} + +/** This function determines the number of displays we WILL have and + * sets MAXSCREENS to that value. This is difficult since the number + * depends on the command line (which is easy to count) or on the config + * file, which has to be parsed. */ +void dmxConfigSetMaxScreens(void) +{ + static int processing = 0; + + if (processing) return; /* Prevent reentry via ProcessCommandLine */ + processing = 1; + if (dmxConfigCmd.filename) { + if (!dmxNumScreens) + dmxConfigConfigure(); +#ifndef MAXSCREENS + SetMaxScreens(dmxNumScreens); +#endif + } else +#ifndef MAXSCREENS + SetMaxScreens(dmxDisplaysFromCommandLine); +#endif + processing = 0; +} + +/** This macro is used to generate the following access methods: + * - dmxConfig{Set,Get}rules + * - dmxConfig{Set,Get}model + * - dmxConfig{Set,Get}layout + * - dmxConfig{Set,Get}variant + * - dmxConfig{Set,Get}options + * These methods are used to read and write information about the keyboard. */ + +#define GEN(param,glob,def) \ + void dmxConfigSet##glob(const char *param) { \ + if (dmx##glob) free((void *)dmx##glob); \ + dmx##glob = strdup(param); \ + } \ + char *dmxConfigGet##glob(void) { \ + return (char *)(dmx##glob ? dmx##glob : def); \ + } + +GEN(rules, XkbRules, DMX_DEFAULT_XKB_RULES) +GEN(model, XkbModel, DMX_DEFAULT_XKB_MODEL) +GEN(layout, XkbLayout, DMX_DEFAULT_XKB_LAYOUT) +GEN(variant, XkbVariant, DMX_DEFAULT_XKB_VARIANT) +GEN(options, XkbOptions, DMX_DEFAULT_XKB_OPTIONS) + Index: xc/programs/Xserver/hw/dmx/config/dmxconfig.h diff -u /dev/null xc/programs/Xserver/hw/dmx/config/dmxconfig.h:1.1 --- /dev/null Wed Mar 16 21:06:45 2005 +++ xc/programs/Xserver/hw/dmx/config/dmxconfig.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,65 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/config/dmxconfig.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * Interface for DMX configuration file support. \see dmxconfig.c */ + +#ifndef _DMXCONFIG_H_ +#define _DMXCONFIG_H_ +#define DMX_DEFAULT_XKB_RULES "xfree86" +#define DMX_DEFAULT_XKB_MODEL "pc101" +#define DMX_DEFAULT_XKB_LAYOUT "us" +#define DMX_DEFAULT_XKB_VARIANT NULL +#define DMX_DEFAULT_XKB_OPTIONS NULL + +extern void dmxConfigStoreDisplay(const char *display); +extern void dmxConfigStoreInput(const char *input); /* Core devices */ +extern void dmxConfigStoreXInput(const char *input); /* Non-core devices */ +extern void dmxConfigStoreFile(const char *file); +extern void dmxConfigStoreConfig(const char *config); +extern void dmxConfigConfigure(void); +extern void dmxConfigSetMaxScreens(void); + +extern void dmxConfigSetXkbRules(const char *rules); +extern void dmxConfigSetXkbModel(const char *model); +extern void dmxConfigSetXkbLayout(const char *layout); +extern void dmxConfigSetXkbVariant(const char *variant); +extern void dmxConfigSetXkbOptions(const char *options); + +extern char *dmxConfigGetXkbRules(void); +extern char *dmxConfigGetXkbModel(void); +extern char *dmxConfigGetXkbLayout(void); +extern char *dmxConfigGetXkbVariant(void); +extern char *dmxConfigGetXkbOptions(void); +#endif Index: xc/programs/Xserver/hw/dmx/config/dmxparse.c diff -u /dev/null xc/programs/Xserver/hw/dmx/config/dmxparse.c:1.1 --- /dev/null Wed Mar 16 21:06:45 2005 +++ xc/programs/Xserver/hw/dmx/config/dmxparse.c Wed Jun 30 16:21:39 2004 @@ -0,0 +1,607 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/config/dmxparse.c,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * + * This file provides support routines and helper functions to be used + * by the DMX configuration file parser. + * + * Because the DMX configuration file parsing should be capable of being + * used in a stand-alone fashion (i.e., independent from the DMX server + * source tree), no dependencies on other DMX routines are made. */ + +#include +#include +#include +#include +#include "dmxparse.h" + +/** A general error logging routine that does not depend on the dmxLog + * functions. */ +void dmxConfigLog(const char *format, ...) +{ + va_list args; + + va_start(args, format); + vprintf(format, args); /* RATS: All calls to dmxConfigLog from + * dmxparse.c and dmxprint.c use a + * trusted format. */ + va_end(args); +} + +void *dmxConfigAlloc(unsigned long bytes) +{ + void *area = malloc(bytes); + if (!area) { + dmxConfigLog("dmxConfigAlloc: out of memory\n"); + return NULL; + } + memset(area, 0, bytes); + return area; +} + +void *dmxConfigRealloc(void *orig, unsigned long orig_bytes, + unsigned long bytes) +{ + unsigned char *area = realloc(orig, bytes); + if (!area) { + dmxConfigLog("dmxConfigRealloc: out of memory\n"); + return NULL; + } + memset(area + orig_bytes, 0, bytes - orig_bytes); + return area; +} + +const char *dmxConfigCopyString(const char *string, int length) +{ + char *copy; + + if (!length) length = strlen(string); + copy = dmxConfigAlloc(length + 1); + if (length) strncpy(copy, string, length); + copy[length] = '\0'; + return copy; +} + +void dmxConfigFree(void *area) +{ + if (area) free(area); +} + +DMXConfigTokenPtr dmxConfigCreateToken(int token, int line, + const char *comment) +{ + DMXConfigTokenPtr pToken = dmxConfigAlloc(sizeof(*pToken)); + pToken->token = token; + pToken->line = line; + pToken->comment = comment; + return pToken; +} + +void dmxConfigFreeToken(DMXConfigTokenPtr p) +{ + if (!p) return; + dmxConfigFree((void *)p->comment); + dmxConfigFree(p); +} + +DMXConfigStringPtr dmxConfigCreateString(int token, int line, + const char *comment, + const char *string) +{ + DMXConfigStringPtr pString = dmxConfigAlloc(sizeof(*pString)); + + pString->token = token; + pString->line = line; + pString->comment = comment; + pString->string = string; + return pString; +} + +void dmxConfigFreeString(DMXConfigStringPtr p) +{ + DMXConfigStringPtr next; + + if (!p) return; + do { + next = p->next; + dmxConfigFree((void *)p->comment); + dmxConfigFree((void *)p->string); + dmxConfigFree(p); + } while ((p = next)); +} + +DMXConfigNumberPtr dmxConfigCreateNumber(int token, int line, + const char *comment, + int number) +{ + DMXConfigNumberPtr pNumber = dmxConfigAlloc(sizeof(*pNumber)); + + pNumber->token = token; + pNumber->line = line; + pNumber->comment = comment; + pNumber->number = number; + return pNumber; +} + +void dmxConfigFreeNumber(DMXConfigNumberPtr p) +{ + if (!p) return; + dmxConfigFree((void *)p->comment); + dmxConfigFree(p); +} + +DMXConfigPairPtr dmxConfigCreatePair(int token, int line, + const char *comment, + int x, int y, + int xsign, int ysign) +{ + DMXConfigPairPtr pPair = dmxConfigAlloc(sizeof(*pPair)); + + pPair->token = token; + pPair->line = line; + pPair->comment = comment; + pPair->x = x; + pPair->y = y; + pPair->xsign = (xsign < 0) ? -1 : 1; + pPair->ysign = (ysign < 0) ? -1 : 1; + return pPair; +} + +void dmxConfigFreePair(DMXConfigPairPtr p) +{ + if (!p) return; + dmxConfigFree((void *)p->comment); + dmxConfigFree(p); +} + +DMXConfigCommentPtr dmxConfigCreateComment(int token, int line, + const char *comment) +{ + DMXConfigCommentPtr pComment = dmxConfigAlloc(sizeof(*pComment)); + + pComment->token = token; + pComment->line = line; + pComment->comment = comment; + return pComment; +} + +void dmxConfigFreeComment(DMXConfigCommentPtr p) +{ + if (!p) return; + dmxConfigFree((void *)p->comment); + dmxConfigFree(p); +} + +DMXConfigPartDimPtr dmxConfigCreatePartDim(DMXConfigPairPtr pDim, + DMXConfigPairPtr pOffset) +{ + DMXConfigPartDimPtr pPart = dmxConfigAlloc(sizeof(*pPart)); + pPart->dim = pDim; + pPart->offset = pOffset; + return pPart; +} + +void dmxConfigFreePartDim(DMXConfigPartDimPtr p) +{ + if (!p) return; + dmxConfigFreePair(p->dim); + dmxConfigFreePair(p->offset); + dmxConfigFree(p); +} + +DMXConfigFullDimPtr dmxConfigCreateFullDim(DMXConfigPartDimPtr pScrn, + DMXConfigPartDimPtr pRoot) +{ + DMXConfigFullDimPtr pFull = dmxConfigAlloc(sizeof(*pFull)); + pFull->scrn = pScrn; + pFull->root = pRoot; + return pFull; +} + +void dmxConfigFreeFullDim(DMXConfigFullDimPtr p) +{ + if (!p) return; + dmxConfigFreePartDim(p->scrn); + dmxConfigFreePartDim(p->root); + dmxConfigFree(p); +} + +DMXConfigDisplayPtr dmxConfigCreateDisplay(DMXConfigTokenPtr pStart, + DMXConfigStringPtr pName, + DMXConfigFullDimPtr pDim, + DMXConfigPairPtr pOrigin, + DMXConfigTokenPtr pEnd) +{ + DMXConfigDisplayPtr pDisplay = dmxConfigAlloc(sizeof(*pDisplay)); + + memset(pDisplay, 0, sizeof(*pDisplay)); + + pDisplay->start = pStart; + pDisplay->dname = pName; + pDisplay->dim = pDim; + pDisplay->origin = pOrigin; + pDisplay->end = pEnd; + + pDisplay->name = pName ? pName->string : NULL; + pDisplay->rootXOrigin = pOrigin ? pOrigin->x : 0; + pDisplay->rootYOrigin = pOrigin ? pOrigin->y : 0; + + if (pDim && pDim->scrn && pDim->scrn->dim) { + pDisplay->scrnWidth = pDim->scrn->dim->x; + pDisplay->scrnHeight = pDim->scrn->dim->y; + } + if (pDim && pDim->scrn && pDim->scrn->offset) { + pDisplay->scrnX = pDim->scrn->offset->x; + pDisplay->scrnY = pDim->scrn->offset->y; + pDisplay->scrnXSign = pDim->scrn->offset->xsign; + pDisplay->scrnYSign = pDim->scrn->offset->ysign; + } + + if (pDim && pDim->root) { + if (pDim->root->dim) { + pDisplay->rootWidth = pDim->root->dim->x; + pDisplay->rootHeight = pDim->root->dim->y; + } + if (pDim->root->offset) { + pDisplay->rootX = pDim->root->offset->x; + pDisplay->rootY = pDim->root->offset->y; + pDisplay->rootXSign = pDim->root->offset->xsign; + pDisplay->rootYSign = pDim->root->offset->ysign; + } + } else { /* If no root specification, copy width + * and height from scrn -- leave offset + * as zero, since it is relative to + * scrn. */ + pDisplay->rootWidth = pDisplay->scrnWidth; + pDisplay->rootHeight = pDisplay->scrnHeight; + } + + + return pDisplay; +} + +void dmxConfigFreeDisplay(DMXConfigDisplayPtr p) +{ + if (!p) return; + dmxConfigFreeToken(p->start); + dmxConfigFreeString(p->dname); + dmxConfigFreeFullDim(p->dim); + dmxConfigFreeToken(p->end); + dmxConfigFree(p); +} + +DMXConfigWallPtr dmxConfigCreateWall(DMXConfigTokenPtr pStart, + DMXConfigPairPtr pWallDim, + DMXConfigPairPtr pDisplayDim, + DMXConfigStringPtr pNameList, + DMXConfigTokenPtr pEnd) +{ + DMXConfigWallPtr pWall = dmxConfigAlloc(sizeof(*pWall)); + + pWall->start = pStart; + pWall->wallDim = pWallDim; + pWall->displayDim = pDisplayDim; + pWall->nameList = pNameList; + pWall->end = pEnd; + + pWall->width = pDisplayDim ? pDisplayDim->x : 0; + pWall->height = pDisplayDim ? pDisplayDim->y : 0; + pWall->xwall = pWallDim ? pWallDim->x : 0; + pWall->ywall = pWallDim ? pWallDim->y : 0; + + return pWall; +} + +void dmxConfigFreeWall(DMXConfigWallPtr p) +{ + if (!p) return; + dmxConfigFreeToken(p->start); + dmxConfigFreePair(p->wallDim); + dmxConfigFreePair(p->displayDim); + dmxConfigFreeString(p->nameList); + dmxConfigFreeToken(p->end); + dmxConfigFree(p); +} + +DMXConfigOptionPtr dmxConfigCreateOption(DMXConfigTokenPtr pStart, + DMXConfigStringPtr pOption, + DMXConfigTokenPtr pEnd) +{ + int length = 0; + int offset = 0; + DMXConfigStringPtr p; + DMXConfigOptionPtr option = dmxConfigAlloc(sizeof(*option)); + + for (p = pOption; p; p = p->next) { + if (p->string) length += strlen(p->string) + 1; + } + + option->string = dmxConfigAlloc(length + 1); + + for (p = pOption; p; p = p->next) { + if (p->string) { + int len = strlen(p->string); + strncpy(option->string + offset, p->string, len); + offset += len; + if (p->next) option->string[offset++] = ' '; + } + } + option->string[offset] = '\0'; + + option->start = pStart; + option->option = pOption; + option->end = pEnd; + + return option; +} + +void dmxConfigFreeOption(DMXConfigOptionPtr p) +{ + if (!p) return; + if (p->string) free(p->string); + dmxConfigFreeToken(p->start); + dmxConfigFreeString(p->option); + dmxConfigFreeToken(p->end); + dmxConfigFree(p); +} + +const char **dmxConfigLookupParam(DMXConfigParamPtr p, const char *key, + int *argc) +{ + DMXConfigParamPtr pt; + + for (pt = p; pt; pt = pt->next) { + if (pt->argv && !strcasecmp(pt->argv[0], key)) { + *argc = pt->argc; + return pt->argv; + } + } + *argc = 0; + return NULL; +} + +DMXConfigParamPtr dmxConfigCreateParam(DMXConfigTokenPtr pStart, + DMXConfigTokenPtr pOpen, + DMXConfigStringPtr pParam, + DMXConfigTokenPtr pClose, + DMXConfigTokenPtr pEnd) +{ + DMXConfigParamPtr param = dmxConfigAlloc(sizeof(*param)); + DMXConfigStringPtr pt; + + param->argc = 0; + param->argv = NULL; + for (pt = pParam; pt; pt = pt->next) { + if (pt->string) { + param->argv = realloc(param->argv, + (param->argc+2) * sizeof(*param->argv)); + param->argv[param->argc] = pt->string; + ++param->argc; + } + } + if (param->argv) param->argv[param->argc] = NULL; + + param->start = pStart; + param->open = pOpen; + param->param = pParam; + param->close = pClose; + param->end = pEnd; + + return param; +} + +void dmxConfigFreeParam(DMXConfigParamPtr p) +{ + DMXConfigParamPtr next; + + if (!p) return; + do { + next = p->next; + dmxConfigFreeToken(p->start); + dmxConfigFreeToken(p->open); + dmxConfigFreeString(p->param); + dmxConfigFreeToken(p->close); + dmxConfigFreeToken(p->end); + dmxConfigFree(p->argv); + dmxConfigFree(p); + } while ((p = next)); +} + +DMXConfigSubPtr dmxConfigCreateSub(DMXConfigType type, + DMXConfigCommentPtr comment, + DMXConfigDisplayPtr display, + DMXConfigWallPtr wall, + DMXConfigOptionPtr option, + DMXConfigParamPtr param) +{ + DMXConfigSubPtr pSub = dmxConfigAlloc(sizeof(*pSub)); + pSub->type = type; + switch (type) { + case dmxConfigComment: pSub->comment = comment; break; + case dmxConfigDisplay: pSub->display = display; break; + case dmxConfigWall: pSub->wall = wall; break; + case dmxConfigOption: pSub->option = option; break; + case dmxConfigParam: pSub->param = param; break; + default: dmxConfigLog("Type %d not supported in subentry\n", type); break; + } + return pSub; +} + +void dmxConfigFreeSub(DMXConfigSubPtr sub) +{ + DMXConfigSubPtr pt; + + for (pt = sub; pt; pt = pt->next) { + switch (pt->type) { + case dmxConfigComment: dmxConfigFreeComment(pt->comment); break; + case dmxConfigDisplay: dmxConfigFreeDisplay(pt->display); break; + case dmxConfigWall: dmxConfigFreeWall(pt->wall); break; + case dmxConfigOption: dmxConfigFreeOption(pt->option); break; + case dmxConfigParam: dmxConfigFreeParam(pt->param); break; + default: + dmxConfigLog("Type %d not supported in subentry\n", pt->type); + break; + } + } + dmxConfigFree(sub); +} + +DMXConfigSubPtr dmxConfigSubComment(DMXConfigCommentPtr comment) +{ + return dmxConfigCreateSub(dmxConfigComment, comment, NULL, NULL, NULL, + NULL); +} + +DMXConfigSubPtr dmxConfigSubDisplay(DMXConfigDisplayPtr display) +{ + return dmxConfigCreateSub(dmxConfigDisplay, NULL, display, NULL, NULL, + NULL); +} + +DMXConfigSubPtr dmxConfigSubWall(DMXConfigWallPtr wall) +{ + return dmxConfigCreateSub(dmxConfigWall, NULL, NULL, wall, NULL, NULL); +} + +DMXConfigSubPtr dmxConfigSubOption(DMXConfigOptionPtr option) +{ + return dmxConfigCreateSub(dmxConfigOption, NULL, NULL, NULL, option, NULL); +} + +DMXConfigSubPtr dmxConfigSubParam(DMXConfigParamPtr param) +{ + return dmxConfigCreateSub(dmxConfigParam, NULL, NULL, NULL, NULL, param); +} + +extern DMXConfigSubPtr dmxConfigAddSub(DMXConfigSubPtr head, + DMXConfigSubPtr sub) +{ + DMXConfigSubPtr pt; + + if (!head) return sub; + for (pt = head; pt->next; pt = pt->next); + pt->next = sub; + return head; +} + +DMXConfigVirtualPtr dmxConfigCreateVirtual(DMXConfigTokenPtr pStart, + DMXConfigStringPtr pName, + DMXConfigPairPtr pDim, + DMXConfigTokenPtr pOpen, + DMXConfigSubPtr pSubentry, + DMXConfigTokenPtr pClose) +{ + DMXConfigVirtualPtr pVirtual = dmxConfigAlloc(sizeof(*pVirtual)); + + pVirtual->start = pStart; + pVirtual->vname = pName; + pVirtual->dim = pDim; + pVirtual->open = pOpen; + pVirtual->subentry = pSubentry; + pVirtual->close = pClose; + + pVirtual->name = pName ? pName->string : NULL; + pVirtual->width = pDim ? pDim->x : 0; + pVirtual->height = pDim ? pDim->y : 0; + + return pVirtual; +} + +void dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual) +{ + dmxConfigFreeToken(virtual->start); + dmxConfigFreeString(virtual->vname); + dmxConfigFreePair(virtual->dim); + dmxConfigFreeToken(virtual->open); + dmxConfigFreeSub(virtual->subentry); + dmxConfigFreeToken(virtual->close); + dmxConfigFree(virtual); +} + +DMXConfigEntryPtr dmxConfigCreateEntry(DMXConfigType type, + DMXConfigCommentPtr comment, + DMXConfigVirtualPtr virtual) +{ + DMXConfigEntryPtr pEntry = dmxConfigAlloc(sizeof(*pEntry)); + pEntry->type = type; + switch (type) { + case dmxConfigComment: pEntry->comment = comment; break; + case dmxConfigVirtual: pEntry->virtual = virtual; break; + default: dmxConfigLog("Type %d not supported in entry\n", type); break; + } + return pEntry; +} + +void dmxConfigFreeEntry(DMXConfigEntryPtr entry) +{ + DMXConfigEntryPtr pt; + + for (pt = entry; pt; pt = pt->next) { + switch (pt->type) { + case dmxConfigComment: dmxConfigFreeComment(pt->comment); break; + case dmxConfigVirtual: dmxConfigFreeVirtual(pt->virtual); break; + default: + dmxConfigLog("Type %d not supported in entry\n", pt->type); + break; + } + } + dmxConfigFree(entry); +} + +DMXConfigEntryPtr dmxConfigAddEntry(DMXConfigEntryPtr head, + DMXConfigType type, + DMXConfigCommentPtr comment, + DMXConfigVirtualPtr virtual) +{ + DMXConfigEntryPtr child = dmxConfigCreateEntry(type, comment, virtual); + DMXConfigEntryPtr pt; + + if (!head) return child; + + for (pt = head; pt->next; pt = pt->next); + pt->next = child; + + return head; +} + +DMXConfigEntryPtr dmxConfigEntryComment(DMXConfigCommentPtr comment) +{ + return dmxConfigCreateEntry(dmxConfigComment, comment, NULL); +} + +DMXConfigEntryPtr dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual) +{ + return dmxConfigCreateEntry(dmxConfigVirtual, NULL, virtual); +} Index: xc/programs/Xserver/hw/dmx/config/dmxparse.h diff -u /dev/null xc/programs/Xserver/hw/dmx/config/dmxparse.h:1.1 --- /dev/null Wed Mar 16 21:06:45 2005 +++ xc/programs/Xserver/hw/dmx/config/dmxparse.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,298 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/config/dmxparse.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * Interface to DMX configuration file parser. \see dmxparse.c */ + +#ifndef _DMXPARSE_H_ +#define _DMXPARSE_H_ + +#include /* For FILE */ + +/** Stores tokens not stored in other structures (e.g., keywords and ;) */ +typedef struct _DMXConfigToken { + int token; + int line; + const char *comment; +} DMXConfigToken, *DMXConfigTokenPtr; + +/** Stores parsed strings. */ +typedef struct _DMXConfigString { + int token; + int line; + const char *comment; + const char *string; + struct _DMXConfigString *next; +} DMXConfigString, *DMXConfigStringPtr; + +/** Stores parsed numbers. */ +typedef struct _DMXConfigNumber { + int token; + int line; + const char *comment; + int number; +} DMXConfigNumber, *DMXConfigNumberPtr; + +/** Stores parsed pairs (e.g., x y) */ +typedef struct _DMXConfigPair { + int token; + int line; + const char *comment; + int x; + int y; + int xsign; + int ysign; +} DMXConfigPair, *DMXConfigPairPtr; + +/** Stores parsed comments not stored with a token. */ +typedef struct _DMXConfigComment { + int token; + int line; + const char *comment; +} DMXConfigComment, *DMXConfigCommentPtr; + +typedef enum { + dmxConfigComment, + dmxConfigVirtual, + dmxConfigDisplay, + dmxConfigWall, + dmxConfigOption, + dmxConfigParam +} DMXConfigType; + +/** Stores a geometry specification. */ +typedef struct _DMXConfigPartDim { + DMXConfigPairPtr dim; + DMXConfigPairPtr offset; +} DMXConfigPartDim, *DMXConfigPartDimPtr; + +/** Stores a pair of geometry specifications. */ +typedef struct _DMXConfigFullDim { + DMXConfigPartDimPtr scrn; + DMXConfigPartDimPtr root; +} DMXConfigFullDim, *DMXConfigFullDimPtr; + +/** Stores parsed display information. */ +typedef struct _DMXConfigDisplay { + /* Summary information */ + const char *name; + /* Screen Window Geometry */ + int scrnWidth, scrnHeight; + int scrnX, scrnY; + int scrnXSign, scrnYSign; + /* Root Window Geometry */ + int rootWidth, rootHeight; + int rootX, rootY; + int rootXSign, rootYSign; + /* Origin in global space */ + int rootXOrigin, rootYOrigin; + + /* Raw configuration information */ + DMXConfigTokenPtr start; + DMXConfigStringPtr dname; + DMXConfigFullDimPtr dim; + DMXConfigPairPtr origin; + DMXConfigTokenPtr end; +} DMXConfigDisplay, *DMXConfigDisplayPtr; + +/** Stores parsed wall information. */ +typedef struct _DMXConfigWall { + /* Summary information */ + int width, height; /* dimensions of displays */ + int xwall, ywall; /* dimensions of wall, in tiles */ + + + /* Raw configuration informaiton */ + DMXConfigTokenPtr start; + DMXConfigPairPtr wallDim; + DMXConfigPairPtr displayDim; + DMXConfigStringPtr nameList; + DMXConfigTokenPtr end; +} DMXConfigWall, *DMXConfigWallPtr; + +/** Stores parsed option information. */ +typedef struct _DMXConfigOption { + /* Summary information */ + char *string; + + /* Raw configuration informaiton */ + DMXConfigTokenPtr start; + DMXConfigStringPtr option; + DMXConfigTokenPtr end; +} DMXConfigOption, *DMXConfigOptionPtr; + +/** Stores parsed param information. */ +typedef struct _DMXConfigParam { + int argc; + const char **argv; + + DMXConfigTokenPtr start; + DMXConfigTokenPtr open; + DMXConfigStringPtr param; + DMXConfigTokenPtr close; + DMXConfigTokenPtr end; /* Either open/close OR end */ + struct _DMXConfigParam *next; +} DMXConfigParam, *DMXConfigParamPtr; + +/** Stores options under an entry (subentry). */ +typedef struct _DMXConfigSub { + DMXConfigType type; + DMXConfigCommentPtr comment; + DMXConfigDisplayPtr display; + DMXConfigWallPtr wall; + DMXConfigOptionPtr option; + DMXConfigParamPtr param; + struct _DMXConfigSub *next; +} DMXConfigSub, *DMXConfigSubPtr; + +/** Stores parsed virtual information. */ +typedef struct _DMXConfigVirtual { + /* Summary information */ + const char *name; + int width, height; + + /* Raw configuration information */ + DMXConfigTokenPtr start; + DMXConfigStringPtr vname; + DMXConfigPairPtr dim; + DMXConfigTokenPtr open; + DMXConfigSubPtr subentry; + DMXConfigTokenPtr close; +} DMXConfigVirtual, *DMXConfigVirtualPtr; + +/** Heads entry storage. */ +typedef struct _DMXConfigEntry { + DMXConfigType type; + DMXConfigCommentPtr comment; + DMXConfigVirtualPtr virtual; + struct _DMXConfigEntry *next; +} DMXConfigEntry, *DMXConfigEntryPtr; + +extern DMXConfigEntryPtr dmxConfigEntry; + +extern int yylex(void); +extern int yydebug; +extern void yyerror(const char *message); + +extern void dmxConfigLog(const char *format, ...); +extern void *dmxConfigAlloc(unsigned long bytes); +extern void *dmxConfigRealloc(void *orig, + unsigned long orig_bytes, + unsigned long bytes); +extern const char *dmxConfigCopyString(const char *string, + int length); +extern void dmxConfigFree(void *area); +extern DMXConfigTokenPtr dmxConfigCreateToken(int token, int line, + const char *comment); +extern void dmxConfigFreeToken(DMXConfigTokenPtr p); +extern DMXConfigStringPtr dmxConfigCreateString(int token, int line, + const char *comment, + const char *string); +extern void dmxConfigFreeString(DMXConfigStringPtr p); +extern DMXConfigNumberPtr dmxConfigCreateNumber(int token, int line, + const char *comment, + int number); +extern void dmxConfigFreeNumber(DMXConfigNumberPtr p); +extern DMXConfigPairPtr dmxConfigCreatePair(int token, int line, + const char *comment, + int x, int y, + int xsign, int ysign); +extern void dmxConfigFreePair(DMXConfigPairPtr p); +extern DMXConfigCommentPtr dmxConfigCreateComment(int token, int line, + const char *comment); +extern void dmxConfigFreeComment(DMXConfigCommentPtr p); +extern DMXConfigPartDimPtr dmxConfigCreatePartDim(DMXConfigPairPtr pDim, + DMXConfigPairPtr pOffset); +extern void dmxConfigFreePartDim(DMXConfigPartDimPtr p); +extern DMXConfigFullDimPtr dmxConfigCreateFullDim(DMXConfigPartDimPtr pScrn, + DMXConfigPartDimPtr pRoot); +extern void dmxConfigFreeFullDim(DMXConfigFullDimPtr p); +extern DMXConfigDisplayPtr dmxConfigCreateDisplay(DMXConfigTokenPtr pStart, + DMXConfigStringPtr pName, + DMXConfigFullDimPtr pDim, + DMXConfigPairPtr pOrigin, + DMXConfigTokenPtr pEnd); +extern void dmxConfigFreeDisplay(DMXConfigDisplayPtr p); +extern DMXConfigWallPtr dmxConfigCreateWall(DMXConfigTokenPtr pStart, + DMXConfigPairPtr pWallDim, + DMXConfigPairPtr pDisplayDim, + DMXConfigStringPtr pNameList, + DMXConfigTokenPtr pEnd); +extern void dmxConfigFreeWall(DMXConfigWallPtr p); +extern DMXConfigOptionPtr dmxConfigCreateOption(DMXConfigTokenPtr pStart, + DMXConfigStringPtr pOption, + DMXConfigTokenPtr pEnd); +extern void dmxConfigFreeOption(DMXConfigOptionPtr p); +extern DMXConfigParamPtr dmxConfigCreateParam(DMXConfigTokenPtr pStart, + DMXConfigTokenPtr pOpen, + DMXConfigStringPtr pParam, + DMXConfigTokenPtr pClose, + DMXConfigTokenPtr pEnd); +extern void dmxConfigFreeParam(DMXConfigParamPtr p); +extern const char **dmxConfigLookupParam(DMXConfigParamPtr p, + const char *key, + int *argc); +extern DMXConfigSubPtr dmxConfigCreateSub(DMXConfigType type, + DMXConfigCommentPtr comment, + DMXConfigDisplayPtr display, + DMXConfigWallPtr wall, + DMXConfigOptionPtr option, + DMXConfigParamPtr param); +extern void dmxConfigFreeSub(DMXConfigSubPtr sub); +extern DMXConfigSubPtr dmxConfigSubComment(DMXConfigCommentPtr comment); +extern DMXConfigSubPtr dmxConfigSubDisplay(DMXConfigDisplayPtr display); +extern DMXConfigSubPtr dmxConfigSubWall(DMXConfigWallPtr wall); +extern DMXConfigSubPtr dmxConfigSubOption(DMXConfigOptionPtr option); +extern DMXConfigSubPtr dmxConfigSubParam(DMXConfigParamPtr param); +extern DMXConfigSubPtr dmxConfigAddSub(DMXConfigSubPtr head, + DMXConfigSubPtr sub); +extern DMXConfigVirtualPtr dmxConfigCreateVirtual(DMXConfigTokenPtr pStart, + DMXConfigStringPtr pName, + DMXConfigPairPtr pDim, + DMXConfigTokenPtr pOpen, + DMXConfigSubPtr pSubentry, + DMXConfigTokenPtr pClose); +extern void dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual); +extern DMXConfigEntryPtr dmxConfigCreateEntry(DMXConfigType type, + DMXConfigCommentPtr comment, + DMXConfigVirtualPtr virtual); +extern void dmxConfigFreeEntry(DMXConfigEntryPtr entry); +extern DMXConfigEntryPtr dmxConfigAddEntry(DMXConfigEntryPtr head, + DMXConfigType type, + DMXConfigCommentPtr comment, + DMXConfigVirtualPtr virtual); +extern DMXConfigEntryPtr dmxConfigEntryComment(DMXConfigCommentPtr comment); +extern DMXConfigEntryPtr dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual); + +#endif Index: xc/programs/Xserver/hw/dmx/config/dmxprint.c diff -u /dev/null xc/programs/Xserver/hw/dmx/config/dmxprint.c:1.1 --- /dev/null Wed Mar 16 21:06:45 2005 +++ xc/programs/Xserver/hw/dmx/config/dmxprint.c Wed Jun 30 16:21:39 2004 @@ -0,0 +1,452 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/config/dmxprint.c,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * + * This file provides support routines and helper functions to be used + * to pretty-print DMX configurations. + * + * Because the DMX configuration file parsing should be capable of being + * used in a stand-alone fashion (i.e., independent from the DMX server + * source tree), no dependencies on other DMX routines are made. */ + +#include "dmxconfig.h" +#include "dmxparse.h" +#include "dmxprint.h" +#include "parser.h" +#include +#include +#include + +static FILE *str = NULL; +static int indent = 0; +static int pos = 0; + +/** Stack of indentation information used for pretty-printing + * configuration information. */ +static struct stack { + int base; + int comment; + int step; + struct stack *next; +} *stack, initialStack = { 0, 0, 4, NULL }; + +static void dmxConfigIndent(void) +{ + int i; + if (indent < 0) indent = 0; + if (indent > 40) indent = 40; + for (i = 0; i < indent; i++) fprintf(str, " "); +} + +static void dmxConfigNewline(void) +{ + if (pos) fprintf(str, "\n"); + pos = 0; +} + +static void dmxConfigPushState(int base, int comment, int step) +{ + struct stack *new = dmxConfigAlloc(sizeof(*new)); + new->base = base; + new->comment = comment; + new->step = step; + new->next = stack; + stack = new; + indent = base; + dmxConfigNewline(); +} + +static void dmxConfigPushComment(void) +{ + if (stack) indent = stack->comment; +} + +static void dmxConfigPushStep(void) +{ + if (stack) indent = stack->step; +} + +static void dmxConfigPopState(void) +{ + struct stack *old = stack; + + if (!stack) return; + indent = old->base; + stack = old->next; + if (!stack) dmxConfigLog("Stack underflow\n"); + dmxConfigFree(old); + dmxConfigNewline(); +} + +static void dmxConfigOutput(int addSpace, int doNewline, const char *comment, + const char *format, ...) +{ + va_list args; + + if (!pos) dmxConfigIndent(); + else if (addSpace) fprintf(str, " "); + + if (format) { + va_start(args, format); + /* RATS: This hasn't been audited -- it + * could probably result in a buffer + * overflow. */ + pos += vfprintf(str, format, args); /* assumes no newlines! */ + va_end(args); + } + + if (comment) { + if (pos) fprintf(str, " "); + pos += fprintf(str, "#%s", comment); + dmxConfigNewline(); + dmxConfigPushComment(); + } else if (doNewline) dmxConfigNewline(); +} + +static void dmxConfigPrintComment(DMXConfigCommentPtr p) +{ + dmxConfigOutput(1, 1, p->comment, NULL); +} + +static void dmxConfigPrintTokenFlag(DMXConfigTokenPtr p, int flag) +{ + if (!p) return; + switch (p->token) { + case T_VIRTUAL: + dmxConfigPushState(0, 4, 4); + dmxConfigOutput(0, 0, p->comment, "virtual"); + break; + case T_DISPLAY: + dmxConfigPushState(4, 12, 16); + dmxConfigOutput(0, 0, p->comment, "display"); + break; + case T_WALL: + dmxConfigPushState(4, 12, 16); + dmxConfigOutput(0, 0, p->comment, "wall"); + break; + case T_OPTION: + dmxConfigPushState(4, 12, 16); + dmxConfigOutput(0, 0, p->comment, "option"); + break; + case T_PARAM: + dmxConfigPushState(4, 8, 12); + dmxConfigOutput(0, 0, p->comment, "param"); + break; + case ';': + dmxConfigOutput(0, 1, p->comment, ";"); + if (flag) dmxConfigPopState(); + break; + case '{': + dmxConfigOutput(1, 1, p->comment, "{"); + dmxConfigPushStep(); + break; + case '}': + if (flag) dmxConfigPopState(); + dmxConfigOutput(0, 1, p->comment, "}"); + break; + case '/': + dmxConfigOutput(1, 0, NULL, "/"); + break; + default: + dmxConfigLog("unknown token %d on line %d\n", p->token, p->line); + } +} + +static void dmxConfigPrintToken(DMXConfigTokenPtr p) +{ + dmxConfigPrintTokenFlag(p, 1); +} + +static void dmxConfigPrintTokenNopop(DMXConfigTokenPtr p) +{ + dmxConfigPrintTokenFlag(p, 0); +} + +static int dmxConfigPrintQuotedString(const char *s) +{ + const char *pt; + + if (!s || !s[0]) return 1; /* Quote empty string */ + for (pt = s; *pt; ++pt) if (isspace(*pt)) return 1; + return 0; +} + +static void dmxConfigPrintString(DMXConfigStringPtr p, int quote) +{ + DMXConfigStringPtr pt; + + if (!p) return; + for (pt = p; pt; pt = pt->next) { + if (quote && dmxConfigPrintQuotedString(pt->string)) { + dmxConfigOutput(1, 0, pt->comment, "\"%s\"", + pt->string ? pt->string : ""); + } else + dmxConfigOutput(1, 0, pt->comment, "%s", + pt->string ? pt->string : ""); + } +} + +static int dmxConfigPrintPair(DMXConfigPairPtr p, int addSpace) +{ + const char *format = NULL; + + if (!p) return 0; + switch (p->token) { + case T_ORIGIN: format = "@%dx%d"; break; + case T_DIMENSION: format = "%dx%d"; break; + case T_OFFSET: format = "%c%d%c%d"; break; + } + if (p->token == T_OFFSET) { + if (!p->comment && !p->x && !p->y && p->xsign >= 0 && p->ysign >= 0) + return 0; + dmxConfigOutput(addSpace, 0, p->comment, format, + p->xsign < 0 ? '-' : '+', p->x, + p->ysign < 0 ? '-' : '+', p->y); + } else { + if (!p->comment && !p->x && !p->y) return 0; + dmxConfigOutput(addSpace, 0, p->comment, format, p->x, p->y); + } + return 1; +} + +static void dmxConfigPrintDisplay(DMXConfigDisplayPtr p) +{ + DMXConfigToken dummyStart = { T_DISPLAY, 0, NULL }; + DMXConfigToken dummyEnd = { ';', 0, NULL }; + DMXConfigToken dummySep = { '/', 0, NULL }; + DMXConfigString dummyName = { T_STRING, 0, NULL, NULL, NULL }; + DMXConfigPair dummySDim = { T_DIMENSION, 0, NULL, 0, 0, 0, 0 }; + DMXConfigPair dummySOffset = { T_OFFSET, 0, NULL, 0, 0, 0, 0 }; + DMXConfigPair dummyRDim = { T_DIMENSION, 0, NULL, 0, 0, 0, 0 }; + DMXConfigPair dummyROffset = { T_OFFSET, 0, NULL, 0, 0, 0, 0 }; + DMXConfigPair dummyOrigin = { T_ORIGIN, 0, NULL, 0, 0, 0, 0 }; + int output; + + if (p->dname) p->dname->string = p->name; + else dummyName.string = p->name; + + if (p->dim && p->dim->scrn && p->dim->scrn->dim) { + p->dim->scrn->dim->x = p->scrnWidth; + p->dim->scrn->dim->y = p->scrnHeight; + } else { + dummySDim.x = p->scrnWidth; + dummySDim.y = p->scrnHeight; + } + + if (p->dim && p->dim->scrn && p->dim->scrn->offset) { + p->dim->scrn->offset->x = p->scrnX; + p->dim->scrn->offset->y = p->scrnY; + } else { + dummySOffset.x = p->scrnX; + dummySOffset.y = p->scrnY; + } + + if (p->dim && p->dim->root && p->dim->root->dim) { + p->dim->root->dim->x = p->rootWidth; + p->dim->root->dim->y = p->rootHeight; + } else { + dummyRDim.x = p->rootWidth; + dummyRDim.y = p->rootHeight; + } + + if (p->dim && p->dim->root && p->dim->root->offset) { + p->dim->root->offset->x = p->rootX; + p->dim->root->offset->y = p->rootY; + } else { + dummyROffset.x = p->rootX; + dummyROffset.y = p->rootY; + } + + if (p->origin) { + p->origin->x = p->rootXOrigin, p->origin->y = p->rootYOrigin; + p->origin->xsign = p->rootXSign, p->origin->ysign = p->rootYSign; + } else { + dummyOrigin.x = p->rootXOrigin, dummyOrigin.y = p->rootYOrigin; + dummyOrigin.xsign = p->rootXSign, dummyOrigin.ysign = p->rootYSign; + } + + dmxConfigPrintToken(p->start ? p->start : &dummyStart); + dmxConfigPrintString(p->dname ? p->dname : &dummyName, 1); + + if (p->dim && p->dim->scrn && p->dim->scrn->dim) + output = dmxConfigPrintPair(p->dim->scrn->dim, 1); + else + output = dmxConfigPrintPair(&dummySDim, 1); + if (p->dim && p->dim->scrn && p->dim->scrn->offset) + dmxConfigPrintPair(p->dim->scrn->offset, !output); + else + dmxConfigPrintPair(&dummySOffset, !output); + + if (p->scrnWidth != p->rootWidth + || p->scrnHeight != p->rootHeight + || p->rootX + || p->rootY) { + dmxConfigPrintToken(&dummySep); + if (p->dim && p->dim->root && p->dim->root->dim) + output = dmxConfigPrintPair(p->dim->root->dim, 1); + else + output = dmxConfigPrintPair(&dummyRDim, 1); + if (p->dim && p->dim->root && p->dim->root->offset) + dmxConfigPrintPair(p->dim->root->offset, !output); + else + dmxConfigPrintPair(&dummyROffset, !output); + } + + dmxConfigPrintPair(p->origin ? p->origin : &dummyOrigin, 1); + dmxConfigPrintToken(p->end ? p->end : &dummyEnd); +} + +static void dmxConfigPrintWall(DMXConfigWallPtr p) +{ + dmxConfigPrintToken(p->start); + dmxConfigPrintPair(p->wallDim, 1); + dmxConfigPrintPair(p->displayDim, 1); + dmxConfigPrintString(p->nameList, 1); + dmxConfigPrintToken(p->end); +} + +static void dmxConfigPrintOption(DMXConfigOptionPtr p) +{ + DMXConfigToken dummyStart = { T_OPTION, 0, NULL }; + DMXConfigString dummyOption = { T_STRING, 0, NULL, NULL, NULL }; + DMXConfigToken dummyEnd = { ';', 0, NULL }; + + dummyOption.string = p->string; + + dmxConfigPrintToken(p->start ? p->start : &dummyStart); + dmxConfigPrintString(&dummyOption, 0); + dmxConfigPrintToken(p->end ? p->end : &dummyEnd); +} + +static void dmxConfigPrintParam(DMXConfigParamPtr p) +{ + if (!p) return; + if (p->start) { + if (p->open && p->close) { + dmxConfigPrintToken(p->start); + dmxConfigPrintToken(p->open); + dmxConfigPrintParam(p->next); + dmxConfigPrintToken(p->close); + } else if (p->end && p->param) { + dmxConfigPrintToken(p->start); + dmxConfigPrintString(p->param, 1); + dmxConfigPrintToken(p->end); + } else + dmxConfigLog("dmxConfigPrintParam: cannot handle format (a)\n"); + } else if (p->end && p->param) { + dmxConfigPrintString(p->param, 1); + dmxConfigPrintTokenNopop(p->end); + dmxConfigPrintParam(p->next); + } else + dmxConfigLog("dmxConfigPrintParam: cannot handle format (b)\n"); +} + +static void dmxConfigPrintSub(DMXConfigSubPtr p) +{ + DMXConfigSubPtr pt; + + if (!p) return; + for (pt = p; pt; pt = pt->next) { + switch (pt->type) { + case dmxConfigComment: dmxConfigPrintComment(pt->comment); break; + case dmxConfigDisplay: dmxConfigPrintDisplay(pt->display); break; + case dmxConfigWall: dmxConfigPrintWall(pt->wall); break; + case dmxConfigOption: dmxConfigPrintOption(pt->option); break; + case dmxConfigParam: dmxConfigPrintParam(pt->param); break; + default: + dmxConfigLog("dmxConfigPrintSub:" + " cannot handle type %d in subentry\n", pt->type); + } + } +} + +static void dmxConfigPrintVirtual(DMXConfigVirtualPtr p) +{ + DMXConfigToken dummyStart = { T_VIRTUAL, 0, NULL }; + DMXConfigToken dummyOpen = { '{', 0, NULL }; + DMXConfigToken dummyClose = { '}', 0, NULL }; + DMXConfigString dummyName = { T_STRING, 0, NULL, NULL, NULL }; + DMXConfigPair dummyDim = { T_DIMENSION, 0, NULL, 0, 0 }; + + if (p->vname) p->vname->string = p->name; + else dummyName.string = p->name; + + if (p->dim) p->dim->x = p->width, p->dim->y = p->height; + else dummyDim.x = p->width, dummyDim.y = p->height; + + + dmxConfigPrintToken(p->start ? p->start : &dummyStart); + dmxConfigPrintString(p->vname ? p->vname : &dummyName, 1); + dmxConfigPrintPair(p->dim ? p->dim : &dummyDim, 1); + dmxConfigPrintToken(p->open ? p->open : &dummyOpen); + dmxConfigPrintSub(p->subentry); + dmxConfigPrintToken(p->close ? p->close : &dummyClose); +} + +/** The configuration information in \a entry will be pretty-printed to + * the \a stream. If \a stream is NULL, then stdout will be used. */ +void dmxConfigPrint(FILE *stream, DMXConfigEntryPtr entry) +{ + DMXConfigEntryPtr pt; + + if (!stream) str = stdout; + else str = stream; + + stack = &initialStack; + + for (pt = entry; pt; pt = pt->next) { + switch (pt->type) { + case dmxConfigComment: dmxConfigPrintComment(pt->comment); break; + case dmxConfigVirtual: dmxConfigPrintVirtual(pt->virtual); break; + default: + dmxConfigLog("dmxConfigPrint: cannot handle type %d in entry\n", + pt->type); + } + } + if (pos) dmxConfigNewline(); +} + +/** The configuration information in \a p will be pretty-printed to the + * \a stream. If \a stream is NULL, then stdout will be used. */ +void dmxConfigVirtualPrint(FILE *stream, DMXConfigVirtualPtr p) +{ + if (!stream) str = stdout; + else str = stream; + + stack = &initialStack; + + dmxConfigPrintVirtual(p); + if (pos) dmxConfigNewline(); +} Index: xc/programs/Xserver/hw/dmx/config/dmxprint.h diff -u /dev/null xc/programs/Xserver/hw/dmx/config/dmxprint.h:1.1 --- /dev/null Wed Mar 16 21:06:45 2005 +++ xc/programs/Xserver/hw/dmx/config/dmxprint.h Wed Jun 30 16:21:39 2004 @@ -0,0 +1,44 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/config/dmxprint.h,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +/** \file + * Interface to DMX configuration file pretty-printer. \see dmxprint.c */ + +#ifndef _DMXPRINT_H_ +#define _DMXPRINT_H_ + +void dmxConfigPrint(FILE *str, DMXConfigEntryPtr entry); +void dmxConfigVirtualPrint(FILE *str, DMXConfigVirtualPtr p); + +#endif Index: xc/programs/Xserver/hw/dmx/config/dmxtodmx.c diff -u /dev/null xc/programs/Xserver/hw/dmx/config/dmxtodmx.c:1.1 --- /dev/null Wed Mar 16 21:06:45 2005 +++ xc/programs/Xserver/hw/dmx/config/dmxtodmx.c Wed Jun 30 16:21:39 2004 @@ -0,0 +1,50 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/config/dmxtodmx.c,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + * This is a simple filter for testing. + */ + +#include "dmxconfig.h" +#include "dmxparse.h" +#include "dmxprint.h" +#include "dmxcompat.h" + +extern int yyparse(void); +extern FILE *yyin; + +int main(int argc, char **argv) +{ + yydebug = 0; + yyparse(); + dmxConfigPrint(stdout, dmxConfigEntry); + return 0; +} Index: xc/programs/Xserver/hw/dmx/config/dmxtodmx.man diff -u /dev/null xc/programs/Xserver/hw/dmx/config/dmxtodmx.man:1.1 --- /dev/null Wed Mar 16 21:06:45 2005 +++ xc/programs/Xserver/hw/dmx/config/dmxtodmx.man Wed Jun 30 16:21:39 2004 @@ -0,0 +1,41 @@ +.\" $XFree86: xc/programs/Xserver/hw/dmx/config/dmxtodmx.man,v 1.1 2004/06/30 20:21:39 martin Exp $ +.\" Copyright 2002 Red Hat Inc., Durham, North Carolina. +.\" All Rights Reserved. +.\" +.\" Permission is hereby granted, free of charge, to any person obtaining +.\" a copy of this software and associated documentation files (the +.\" "Software"), to deal in the Software without restriction, including +.\" without limitation on the rights to use, copy, modify, merge, +.\" publish, distribute, sublicense, and/or sell copies of the Software, +.\" and to permit persons to whom the Software is furnished to do so, +.\" subject to the following conditions: +.\" +.\" The above copyright notice and this permission notice (including the +.\" next paragraph) shall be included in all copies or substantial +.\" portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +.\" NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS +.\" BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +.\" ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +.\" CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +.\" SOFTWARE. +.\" +.\" Authors: +.\" Rickard E. (Rik) Faith +.\" +.TH dmxtodmx 1 __vendorversion__ +.SH NAME +dmxtodmx - dmx configuration file parser and printer +.SH SYNOPSIS +.B dmxtodmx +.SH DESCRIPTION +.I dmxtodmx +reads the standard input, parsing a configuration file for the +.I Xdmx +distributed multi-head X server. After a successful parse, the file is +pretty-printed to standard output. +.SH "SEE ALSO" +Xdmx(1), vdltodmx(1), xdmxconfig(1) Index: xc/programs/Xserver/hw/dmx/config/parser.y diff -u /dev/null xc/programs/Xserver/hw/dmx/config/parser.y:1.1 --- /dev/null Wed Mar 16 21:06:45 2005 +++ xc/programs/Xserver/hw/dmx/config/parser.y Wed Jun 30 16:21:39 2004 @@ -0,0 +1,222 @@ +/* $XFree86: xc/programs/Xserver/hw/dmx/config/parser.y,v 1.1 2004/06/30 20:21:39 martin Exp $ */ +/* + * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith + * + */ + +%{ +#include "dmxparse.h" +#include +#include +#define YYDEBUG 1 +#define YYERROR_VERBOSE +#define YY_USE_PROTOS + +DMXConfigEntryPtr dmxConfigEntry = NULL; +#define APPEND(type, h, t) \ +{ \ + type pt; \ + for (pt = h; pt->next; pt = pt->next); \ + pt->next = t; \ +} +%} + +%union { + DMXConfigTokenPtr token; + DMXConfigStringPtr string; + DMXConfigNumberPtr number; + DMXConfigPairPtr pair; + DMXConfigFullDimPtr fdim; + DMXConfigPartDimPtr pdim; + DMXConfigDisplayPtr display; + DMXConfigWallPtr wall; + DMXConfigOptionPtr option; + DMXConfigParamPtr param; + DMXConfigCommentPtr comment; + DMXConfigSubPtr subentry; + DMXConfigVirtualPtr virtual; + DMXConfigEntryPtr entry; +} + + /* Terminals */ +%token '{' '}' ';' '/' T_VIRTUAL T_DISPLAY T_WALL T_OPTION T_PARAM +%token T_STRING +%token T_DIMENSION T_OFFSET T_ORIGIN +%token T_COMMENT T_LINE_COMMENT + + /* Non-termials */ +%type Display Wall Terminal Open Close +%type NameList Name +%type Dimension Offset Origin +%type PartialDim +%type FullDim +%type DisplayEntry +%type