From 4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05 Mon Sep 17 00:00:00 2001 From: marha Date: Sat, 25 Jul 2009 19:39:46 +0000 Subject: Added xorg-server-1.6.2.tar.gz --- xorg-server/hw/xwin/InitInput.c | 3 - xorg-server/hw/xwin/InitOutput.c | 5 - xorg-server/hw/xwin/Makefile.am | 8 +- xorg-server/hw/xwin/Makefile.in | 97 +- xorg-server/hw/xwin/glx/ChangeLog | 64 + xorg-server/hw/xwin/glx/glwindows.h | 64 + xorg-server/hw/xwin/glx/glwrap.c | 583 +++++++++ xorg-server/hw/xwin/glx/indirect.c | 1605 +++++++++++++++++++++++++ xorg-server/hw/xwin/win.h | 6 - xorg-server/hw/xwin/wincursor.c | 3 +- xorg-server/hw/xwin/wingc.c | 2 +- xorg-server/hw/xwin/winglobals.c | 15 +- xorg-server/hw/xwin/winmouse.c | 8 +- xorg-server/hw/xwin/winmultiwindowicons.c | 8 +- xorg-server/hw/xwin/winmultiwindowshape.c | 2 - xorg-server/hw/xwin/winmultiwindowwindow.c | 2 - xorg-server/hw/xwin/winprefslex.c | 30 +- xorg-server/hw/xwin/winprefsyacc.c | 385 +++--- xorg-server/hw/xwin/winprefsyacc.h | 44 +- xorg-server/hw/xwin/winpushpxl.c | 225 ---- xorg-server/hw/xwin/winscrinit.c | 8 - xorg-server/hw/xwin/winwin32rootlesswndproc.c | 8 +- xorg-server/hw/xwin/winwindow.c | 8 - xorg-server/hw/xwin/winwindowswm.c | 10 +- 24 files changed, 2649 insertions(+), 544 deletions(-) create mode 100644 xorg-server/hw/xwin/glx/ChangeLog create mode 100644 xorg-server/hw/xwin/glx/glwindows.h create mode 100644 xorg-server/hw/xwin/glx/glwrap.c create mode 100644 xorg-server/hw/xwin/glx/indirect.c delete mode 100644 xorg-server/hw/xwin/winpushpxl.c (limited to 'xorg-server/hw/xwin') diff --git a/xorg-server/hw/xwin/InitInput.c b/xorg-server/hw/xwin/InitInput.c index 6a850cd44..550c5a04e 100644 --- a/xorg-server/hw/xwin/InitInput.c +++ b/xorg-server/hw/xwin/InitInput.c @@ -30,9 +30,6 @@ #include #endif #include "win.h" -#ifdef XWIN_CLIPBOARD -# include "../../Xext/xf86miscproc.h" -#endif #include "dixstruct.h" diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c index d2159813c..abc35b943 100644 --- a/xorg-server/hw/xwin/InitOutput.c +++ b/xorg-server/hw/xwin/InitOutput.c @@ -920,11 +920,6 @@ ddxUseMsg(void) MB_ICONINFORMATION); } -/* ddxInitGlobals - called by |InitGlobals| from os/util.c */ -void ddxInitGlobals(void) -{ -} - /* See Porting Layer Definition - p. 20 */ /* * Do any global initialization, then initialize each screen. diff --git a/xorg-server/hw/xwin/Makefile.am b/xorg-server/hw/xwin/Makefile.am index 5ffba1274..00d425544 100644 --- a/xorg-server/hw/xwin/Makefile.am +++ b/xorg-server/hw/xwin/Makefile.am @@ -46,7 +46,6 @@ SRCS_NATIVEGDI = \ winnativegdi.c \ winpixmap.c \ winpolyline.c \ - winpushpxl.c \ winrop.c \ winsetsp.c DEFS_NATIVEGDI = -DXWIN_NATIVEGDI @@ -167,7 +166,14 @@ AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \ dist_man1_MANS = XWin.man XWinrc.man +GLX_EXTRAS = \ + glx/ChangeLog \ + glx/glwindows.h \ + glx/glwrap.c \ + glx/indirect.c + EXTRA_DIST = \ + $(GLX_EXTRAS) \ _usr_X11R6_lib_X11_system.XWinrc \ X-boxed.ico \ X.ico \ diff --git a/xorg-server/hw/xwin/Makefile.in b/xorg-server/hw/xwin/Makefile.in index 6fb30bafc..c168f5453 100644 --- a/xorg-server/hw/xwin/Makefile.in +++ b/xorg-server/hw/xwin/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -46,7 +46,6 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-server.h \ $(top_builddir)/include/dix-config.h \ - $(top_builddir)/include/xgl-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ @@ -75,9 +74,8 @@ am__XWin_SOURCES_DIST = InitInput.c InitOutput.c winallpriv.c \ winmultiwindowwm.c winmultiwindowwndproc.c winwin32rootless.c \ winwin32rootlesswindow.c winwin32rootlesswndproc.c \ winwindowswm.c winclip.c winfillsp.c winfont.c wingc.c \ - wingetsp.c winnativegdi.c winpixmap.c winpolyline.c \ - winpushpxl.c winrop.c winsetsp.c winpfbdd.c winrandr.c \ - winvideo.c + wingetsp.c winnativegdi.c winpixmap.c winpolyline.c winrop.c \ + winsetsp.c winpfbdd.c winrandr.c winvideo.c @XWIN_CLIPBOARD_TRUE@am__objects_1 = winclipboardinit.$(OBJEXT) \ @XWIN_CLIPBOARD_TRUE@ winclipboardtextconv.$(OBJEXT) \ @XWIN_CLIPBOARD_TRUE@ winclipboardthread.$(OBJEXT) \ @@ -100,8 +98,7 @@ am__XWin_SOURCES_DIST = InitInput.c InitOutput.c winallpriv.c \ @XWIN_NATIVEGDI_TRUE@ wingc.$(OBJEXT) wingetsp.$(OBJEXT) \ @XWIN_NATIVEGDI_TRUE@ winnativegdi.$(OBJEXT) \ @XWIN_NATIVEGDI_TRUE@ winpixmap.$(OBJEXT) winpolyline.$(OBJEXT) \ -@XWIN_NATIVEGDI_TRUE@ winpushpxl.$(OBJEXT) winrop.$(OBJEXT) \ -@XWIN_NATIVEGDI_TRUE@ winsetsp.$(OBJEXT) +@XWIN_NATIVEGDI_TRUE@ winrop.$(OBJEXT) winsetsp.$(OBJEXT) @XWIN_PRIMARYFB_TRUE@am__objects_6 = winpfbdd.$(OBJEXT) @XWIN_RANDR_TRUE@am__objects_7 = winrandr.$(OBJEXT) @XWIN_XV_TRUE@am__objects_8 = winvideo.$(OBJEXT) @@ -134,9 +131,6 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ @@ -163,8 +157,9 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ -APPDEFAULTDIR = @APPDEFAULTDIR@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@ +APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ @@ -185,10 +180,6 @@ CFLAGS = @CFLAGS@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DARWIN_LIBS = @DARWIN_LIBS@ DBUS_CFLAGS = @DBUS_CFLAGS@ @@ -218,6 +209,7 @@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DOLT_BASH = @DOLT_BASH@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ @@ -227,18 +219,15 @@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ -ECHO = @ECHO@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ -FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ -FREETYPE_LIBS = @FREETYPE_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GL_CFLAGS = @GL_CFLAGS@ @@ -257,7 +246,7 @@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ -LAUNCHD = @LAUNCHD@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LEX = @LEX@ @@ -271,7 +260,10 @@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LINUXDOC = @LINUXDOC@ +LIPO = @LIPO@ LN_S = @LN_S@ +LTCOMPILE = @LTCOMPILE@ +LTCXXCOMPILE = @LTCXXCOMPILE@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ @@ -283,8 +275,7 @@ MESA_SOURCE = @MESA_SOURCE@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MKDIR_P = @MKDIR_P@ -MKFONTDIR = @MKFONTDIR@ -MKFONTSCALE = @MKFONTSCALE@ +NM = @NM@ NMEDIT = @NMEDIT@ OBJC = @OBJC@ OBJCCLD = @OBJCCLD@ @@ -293,8 +284,8 @@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -327,7 +318,6 @@ VENDOR_NAME = @VENDOR_NAME@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VENDOR_RELEASE = @VENDOR_RELEASE@ VERSION = @VERSION@ -X11APP_ARCHS = @X11APP_ARCHS@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ @@ -337,27 +327,12 @@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ XDMX_CFLAGS = @XDMX_CFLAGS@ XDMX_LIBS = @XDMX_LIBS@ XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ -XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@ -XEGL_LIBS = @XEGL_LIBS@ -XEGL_SYS_LIBS = @XEGL_SYS_LIBS@ XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ -XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@ XEPHYR_INCS = @XEPHYR_INCS@ XEPHYR_LIBS = @XEPHYR_LIBS@ XF86CONFIGFILE = @XF86CONFIGFILE@ -XF86MISC_CFLAGS = @XF86MISC_CFLAGS@ -XF86MISC_LIBS = @XF86MISC_LIBS@ XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ -XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@ -XGLMODULES_LIBS = @XGLMODULES_LIBS@ -XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@ -XGLXMODULES_LIBS = @XGLXMODULES_LIBS@ -XGLX_LIBS = @XGLX_LIBS@ -XGLX_SYS_LIBS = @XGLX_SYS_LIBS@ -XGL_LIBS = @XGL_LIBS@ -XGL_MODULE_PATH = @XGL_MODULE_PATH@ -XGL_SYS_LIBS = @XGL_SYS_LIBS@ XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ @@ -368,10 +343,6 @@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ -XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@ -XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@ -XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@ -XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ @@ -380,13 +351,8 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ XORG_OS = @XORG_OS@ XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ XORG_SYS_LIBS = @XORG_SYS_LIBS@ -XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ -XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ -XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ -XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ -XPRINT_CFLAGS = @XPRINT_CFLAGS@ -XPRINT_LIBS = @XPRINT_LIBS@ -XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ +XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ +XPBPROXY_LIBS = @XPBPROXY_LIBS@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ XSDL_INCS = @XSDL_INCS@ @@ -422,8 +388,7 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -443,7 +408,6 @@ driverdir = @driverdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ extdir = @extdir@ -ft_config = @ft_config@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -453,12 +417,12 @@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ -launchagentsdir = @launchagentsdir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ logdir = @logdir@ +lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ @@ -476,8 +440,6 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -xglmoduledir = @xglmoduledir@ -xpconfigdir = @xpconfigdir@ @XWIN_CLIPBOARD_TRUE@SRCS_CLIPBOARD = \ @XWIN_CLIPBOARD_TRUE@ winclipboardinit.c \ @XWIN_CLIPBOARD_TRUE@ winclipboardtextconv.c \ @@ -515,7 +477,6 @@ xpconfigdir = @xpconfigdir@ @XWIN_NATIVEGDI_TRUE@ winnativegdi.c \ @XWIN_NATIVEGDI_TRUE@ winpixmap.c \ @XWIN_NATIVEGDI_TRUE@ winpolyline.c \ -@XWIN_NATIVEGDI_TRUE@ winpushpxl.c \ @XWIN_NATIVEGDI_TRUE@ winrop.c \ @XWIN_NATIVEGDI_TRUE@ winsetsp.c @@ -608,7 +569,14 @@ AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \ $(XWINMODULES_CFLAGS) dist_man1_MANS = XWin.man XWinrc.man +GLX_EXTRAS = \ + glx/ChangeLog \ + glx/glwindows.h \ + glx/glwrap.c \ + glx/indirect.c + EXTRA_DIST = \ + $(GLX_EXTRAS) \ _usr_X11R6_lib_X11_system.XWinrc \ X-boxed.ico \ X.ico \ @@ -643,8 +611,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ @@ -753,7 +721,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winprefsyacc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winpriv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winprocarg.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winpushpxl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winrandr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winregistry.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winrop.Po@am__quote@ @@ -844,8 +811,8 @@ install-man1: $(man1_MANS) $(man_MANS) esac; \ done; \ for i in $$list; do \ - if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ - else file=$$i; fi; \ + if test -f $$i; then file=$$i; \ + else file=$(srcdir)/$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 1*) ;; \ @@ -884,7 +851,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS diff --git a/xorg-server/hw/xwin/glx/ChangeLog b/xorg-server/hw/xwin/glx/ChangeLog new file mode 100644 index 000000000..43a817d6a --- /dev/null +++ b/xorg-server/hw/xwin/glx/ChangeLog @@ -0,0 +1,64 @@ +2005-09-27 Ian Romanick + + * indirect.c: + Remove __glEvalComputeK. It is no longer used. + + +2005-04-09 Alexander Gottwald + + * indirect.c: + Fix passing of non-RGB visuals. The old code did not initialize the + structure properly which lead to a crash in 8bpp mode + +2005-03-01 Alexander Gottwald + + * indirect.c: + * glwindows.h: + If a context is already attached copy it instead of reattaching to keep + displaylists and share displaylists + Enable tracing of often called functions with GLWIN_ENABLE_TRACE + ForceCurrent is a no-op now + +2005-02-02 Alexander Gottwald + + * Imakefile: + Bugzilla #1866 (https://bugs.freedesktop.org/show_bug.cgi?id=1866) + attachment #1819 (https://bugs.freedesktop.org/attachment.cgi?id=1819): + Define APIENTRY on windows to prevent from loading + +2005-02-02 Alexander Gottwald + + * glwrap.c: + * glwindows.h: + Bugzilla #1866 (https://bugs.freedesktop.org/show_bug.cgi?id=1866) + attachment #1818 (https://bugs.freedesktop.org/attachment.cgi?id=1818): + Include Xwindows.h before GL/gl.h to prevent loading windows.h which + pollutes our namespace with some symbols. + +2005-01-27 Alexander Gottwald + + * glwrap.c: + Functions like glGenTextures and glBindTexture are in OpenGL 1.1 + and can be resolved at linktime. + +2004-11-15 Alexander Gottwald + + * indirect.c: + Bugzilla #1802, http://freedesktop.org/bugzilla/show_bug.cgi?id=1802 + Added mingw (Win32) port + +2004-08-13 Alexander Gottwald + + * Imakefile: Added $(MESASRCDIR)/src/mesa/glapi to INCLUDES. + Removed $(SERVERSRC)/mi from INCLUDES. + Rearranged INCLUDES for better readability. + * glwindows.h: Removed mipointrst.h and miscstruct.h from #include + since they are not used anymore. + +2004-05-27 Alexander Gottwald + + * glwindows.h: write current function and line in debug output + * indirect.c: moved actual setup and creation of windows GL context to + glWinCreateContextReal. + * indirect.c (glWinCreateContext): Deferred context creation to attach. + * indirect.c (glWinMakeCurrent): Check if context is NULL. Fixes segfault. diff --git a/xorg-server/hw/xwin/glx/glwindows.h b/xorg-server/hw/xwin/glx/glwindows.h new file mode 100644 index 000000000..74e81f24f --- /dev/null +++ b/xorg-server/hw/xwin/glx/glwindows.h @@ -0,0 +1,64 @@ +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +typedef struct { + unsigned enableDebug : 1; + unsigned enableTrace : 1; + unsigned dumpPFD : 1; + unsigned dumpHWND : 1; + unsigned dumpDC : 1; +} glWinDebugSettingsRec, *glWinDebugSettingsPtr; +extern glWinDebugSettingsRec glWinDebugSettings; + +typedef struct { + int num_vis; + __GLcontextModes *modes; + void **priv; + + /* wrapped screen functions */ + RealizeWindowProcPtr RealizeWindow; + UnrealizeWindowProcPtr UnrealizeWindow; + CopyWindowProcPtr CopyWindow; +} glWinScreenRec; + +extern glWinScreenRec glWinScreens[MAXSCREENS]; + +#define glWinGetScreenPriv(pScreen) &glWinScreens[pScreen->myNum] +#define glWinScreenPriv(pScreen) glWinScreenRec *pScreenPriv = glWinGetScreenPriv(pScreen); + +#if 1 +#define GLWIN_TRACE() if (glWinDebugSettings.enableTrace) ErrorF("%s:%d: Trace\n", __FUNCTION__, __LINE__ ) +#define GLWIN_TRACE_MSG(msg, args...) if (glWinDebugSettings.enableTrace) ErrorF("%s:%d: " msg, __FUNCTION__, __LINE__, ##args ) +#define GLWIN_DEBUG_MSG(msg, args...) if (glWinDebugSettings.enableDebug) ErrorF("%s:%d: " msg, __FUNCTION__, __LINE__, ##args ) +#define GLWIN_DEBUG_MSG2(msg, args...) if (glWinDebugSettings.enableDebug) ErrorF(msg, ##args ) +#else +#define GLWIN_TRACE() +#define GLWIN_TRACE_MSG(a, ...) +#define GLWIN_DEBUG_MSG(a, ...) +#define GLWIN_DEBUG_MSG2(a, ...) +#endif + diff --git a/xorg-server/hw/xwin/glx/glwrap.c b/xorg-server/hw/xwin/glx/glwrap.c new file mode 100644 index 000000000..f0b38b228 --- /dev/null +++ b/xorg-server/hw/xwin/glx/glwrap.c @@ -0,0 +1,583 @@ +/* + * GLX implementation that uses Win32's OpenGL + * Wrapper functions for Win32's OpenGL + * + * Authors: Alexander Gottwald + */ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include + +#define RESOLVE_RET(procname, symbol, retval) \ + static Bool init = TRUE; \ + static procname proc = NULL; \ + if (init) { \ + proc = (procname)wglGetProcAddress(symbol); \ + init = FALSE; \ + if (proc == NULL) { \ + ErrorF("glwrap: Can't resolve \"%s\"\n", symbol); \ + } else \ + ErrorF("glwrap: resolved \"%s\"\n", symbol); \ + } \ + if (proc == NULL) { \ + __glXErrorCallBack(NULL, 0); \ + return retval; \ + } +#define RESOLVE(procname, symbol) RESOLVE_RET(procname, symbol,) + + +/* + * GL_ARB_imaging + */ + + +GLAPI void GLAPIENTRY glColorTable( GLenum target, GLenum internalformat, + GLsizei width, GLenum format, + GLenum type, const GLvoid *table ) +{ + RESOLVE(PFNGLCOLORTABLEPROC, "glColorTable"); + proc(target, internalformat, width, format, type, table); +} + +GLAPI void GLAPIENTRY glColorSubTable( GLenum target, + GLsizei start, GLsizei count, + GLenum format, GLenum type, + const GLvoid *data ) +{ + RESOLVE(PFNGLCOLORSUBTABLEPROC, "glColorSubTable"); + proc(target, start, count, format, type, data); +} + +GLAPI void GLAPIENTRY glColorTableParameteriv(GLenum target, GLenum pname, + const GLint *params) +{ + RESOLVE(PFNGLCOLORTABLEPARAMETERIVPROC, "glColorTableParameteriv"); + proc(target, pname, params); +} + +GLAPI void GLAPIENTRY glColorTableParameterfv(GLenum target, GLenum pname, + const GLfloat *params) +{ + RESOLVE(PFNGLCOLORTABLEPARAMETERFVPROC, "glColorTableParameterfv"); + proc(target, pname, params); +} + +GLAPI void GLAPIENTRY glCopyColorSubTable( GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width ) +{ + RESOLVE(PFNGLCOPYCOLORSUBTABLEPROC, "glCopyColorSubTable"); + proc(target, start, x, y, width); +} + +GLAPI void GLAPIENTRY glCopyColorTable( GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width ) +{ + RESOLVE(PFNGLCOPYCOLORTABLEPROC, "glCopyColorTable"); + proc(target, internalformat, x, y, width); +} + + +GLAPI void GLAPIENTRY glGetColorTable( GLenum target, GLenum format, + GLenum type, GLvoid *table ) +{ + RESOLVE(PFNGLGETCOLORTABLEPROC, "glGetColorTable"); + proc(target, format, type, table); +} + +GLAPI void GLAPIENTRY glGetColorTableParameterfv( GLenum target, GLenum pname, + GLfloat *params ) +{ + RESOLVE(PFNGLGETCOLORTABLEPARAMETERFVPROC, "glGetColorTableParameterfv"); + proc(target, pname, params); +} + +GLAPI void GLAPIENTRY glGetColorTableParameteriv( GLenum target, GLenum pname, + GLint *params ) +{ + RESOLVE(PFNGLGETCOLORTABLEPARAMETERIVPROC, "glGetColorTableParameteriv"); + proc(target, pname, params); +} + +GLAPI void GLAPIENTRY glBlendEquation( GLenum mode ) +{ + RESOLVE(PFNGLBLENDEQUATIONPROC, "glBlendEquation"); + proc(mode); +} + +GLAPI void GLAPIENTRY glBlendColor( GLclampf red, GLclampf green, + GLclampf blue, GLclampf alpha ) +{ + RESOLVE(PFNGLBLENDCOLORPROC, "glBlendColor"); + proc(red, green, blue, alpha); +} + +GLAPI void GLAPIENTRY glHistogram( GLenum target, GLsizei width, + GLenum internalformat, GLboolean sink ) +{ + RESOLVE(PFNGLHISTOGRAMPROC, "glHistogram"); + proc(target, width, internalformat, sink); +} + +GLAPI void GLAPIENTRY glResetHistogram( GLenum target ) +{ + RESOLVE(PFNGLRESETHISTOGRAMPROC, "glResetHistogram"); + proc(target); +} + +GLAPI void GLAPIENTRY glGetHistogram( GLenum target, GLboolean reset, + GLenum format, GLenum type, + GLvoid *values ) +{ + RESOLVE(PFNGLGETHISTOGRAMPROC, "glGetHistogram"); + proc(target, reset, format, type, values); +}; + +GLAPI void GLAPIENTRY glGetHistogramParameterfv( GLenum target, GLenum pname, + GLfloat *params ) +{ + RESOLVE(PFNGLGETHISTOGRAMPARAMETERFVPROC, "glGetHistogramParameterfv"); + proc(target, pname, params); +} + +GLAPI void GLAPIENTRY glGetHistogramParameteriv( GLenum target, GLenum pname, + GLint *params ) +{ + RESOLVE(PFNGLGETHISTOGRAMPARAMETERIVPROC, "glGetHistogramParameteriv"); + proc(target, pname, params); +} + +GLAPI void GLAPIENTRY glMinmax( GLenum target, GLenum internalformat, + GLboolean sink ) +{ + RESOLVE(PFNGLMINMAXPROC, "glMinmax"); + proc(target, internalformat, sink); +} + +GLAPI void GLAPIENTRY glResetMinmax( GLenum target ) +{ + RESOLVE(PFNGLRESETMINMAXPROC, "glResetMinmax"); + proc(target); +} + +GLAPI void GLAPIENTRY glGetMinmax( GLenum target, GLboolean reset, + GLenum format, GLenum types, + GLvoid *values ) +{ + RESOLVE(PFNGLGETMINMAXPROC, "glGetMinmax"); + proc(target, reset, format, types, values); +} + +GLAPI void GLAPIENTRY glGetMinmaxParameterfv( GLenum target, GLenum pname, + GLfloat *params ) +{ + RESOLVE(PFNGLGETMINMAXPARAMETERFVPROC, "glGetMinmaxParameterfv"); + proc(target, pname, params); +} + +GLAPI void GLAPIENTRY glGetMinmaxParameteriv( GLenum target, GLenum pname, + GLint *params ) +{ + RESOLVE(PFNGLGETMINMAXPARAMETERIVPROC, "glGetMinmaxParameteriv"); + proc(target, pname, params); +} + +GLAPI void GLAPIENTRY glConvolutionFilter1D( GLenum target, + GLenum internalformat, GLsizei width, GLenum format, GLenum type, + const GLvoid *image ) +{ + RESOLVE(PFNGLCONVOLUTIONFILTER1DPROC, "glConvolutionFilter1D"); + proc(target, internalformat, width, format, type, image); +} + +GLAPI void GLAPIENTRY glConvolutionFilter2D( GLenum target, + GLenum internalformat, GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *image ) +{ + RESOLVE(PFNGLCONVOLUTIONFILTER2DPROC, "glConvolutionFilter2D"); + proc(target, internalformat, width, height, format, type, image); +} + +GLAPI void GLAPIENTRY glConvolutionParameterf( GLenum target, GLenum pname, + GLfloat params ) +{ + RESOLVE(PFNGLCONVOLUTIONPARAMETERFPROC, "glConvolutionParameterf"); + proc(target, pname, params); +} + +GLAPI void GLAPIENTRY glConvolutionParameterfv( GLenum target, GLenum pname, + const GLfloat *params ) +{ + RESOLVE(PFNGLCONVOLUTIONPARAMETERFVPROC, "glConvolutionParameterfv"); + proc(target, pname, params); +} + +GLAPI void GLAPIENTRY glConvolutionParameteri( GLenum target, GLenum pname, + GLint params ) +{ + RESOLVE(PFNGLCONVOLUTIONPARAMETERIPROC, "glConvolutionParameteri"); + proc(target, pname, params); +} + +GLAPI void GLAPIENTRY glConvolutionParameteriv( GLenum target, GLenum pname, + const GLint *params ) +{ + RESOLVE(PFNGLCONVOLUTIONPARAMETERIVPROC, "glConvolutionParameteriv"); + proc(target, pname, params); +} + +GLAPI void GLAPIENTRY glCopyConvolutionFilter1D( GLenum target, + GLenum internalformat, GLint x, GLint y, GLsizei width ) +{ + RESOLVE(PFNGLCOPYCONVOLUTIONFILTER1DPROC, "glCopyConvolutionFilter1D"); + proc(target, internalformat, x, y, width); +} + +GLAPI void GLAPIENTRY glCopyConvolutionFilter2D( GLenum target, + GLenum internalformat, GLint x, GLint y, GLsizei width, + GLsizei height) +{ + RESOLVE(PFNGLCOPYCONVOLUTIONFILTER2DPROC, "glCopyConvolutionFilter2D"); + proc(target, internalformat, x, y, width, height); +} + +GLAPI void GLAPIENTRY glGetConvolutionFilter( GLenum target, GLenum format, + GLenum type, GLvoid *image ) +{ + RESOLVE(PFNGLGETCONVOLUTIONFILTERPROC, "glGetConvolutionFilter"); + proc(target, format, type, image); +} + +GLAPI void GLAPIENTRY glGetConvolutionParameterfv( GLenum target, GLenum pname, + GLfloat *params ) +{ + RESOLVE(PFNGLGETCONVOLUTIONPARAMETERFVPROC, "glGetConvolutionParameterfv"); + proc(target, pname, params); +} + +GLAPI void GLAPIENTRY glGetConvolutionParameteriv( GLenum target, GLenum pname, + GLint *params ) +{ + RESOLVE(PFNGLGETCONVOLUTIONPARAMETERIVPROC, "glGetConvolutionParameteriv"); + proc(target, pname, params); +} + +GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target, + GLenum internalformat, GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *row, const GLvoid *column ) +{ + RESOLVE(PFNGLSEPARABLEFILTER2DPROC, "glSeparableFilter2D"); + proc(target, internalformat, width, height, format, type, row, column); +} + +GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format, + GLenum type, GLvoid *row, GLvoid *column, GLvoid *span ) +{ + RESOLVE(PFNGLGETSEPARABLEFILTERPROC, "glGetSeparableFilter"); + proc(target, format, type, row, column, span); +} + +/* + * OpenGL 1.2 + */ + +GLAPI void GLAPIENTRY glTexImage3D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLsizei depth, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ) +{ + RESOLVE(PFNGLTEXIMAGE3DPROC, "glTexImage3D"); + proc(target, level, internalFormat, width, height, depth, border, format, type, pixels); +} + +GLAPI void GLAPIENTRY glTexSubImage3D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, + GLenum format, + GLenum type, const GLvoid *pixels) +{ + RESOLVE(PFNGLTEXSUBIMAGE3DPROC, "glTexSubImage3D"); + proc(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); +} + +GLAPI void GLAPIENTRY glCopyTexSubImage3D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLint x, + GLint y, GLsizei width, + GLsizei height ) +{ + RESOLVE(PFNGLCOPYTEXSUBIMAGE3DPROC, "glCopyTexSubImage3D"); + proc(target, level, xoffset, yoffset, zoffset, x, y, width, height); +} + + +/* + * 20. GL_EXT_texture_object + */ +GLAPI void GLAPIENTRY glGenTexturesEXT( GLsizei n, GLuint *textures ) +{ + glGenTextures(n, textures); +} + +GLAPI void GLAPIENTRY glDeleteTexturesEXT( GLsizei n, const GLuint *textures) +{ + glDeleteTextures(n, textures); +} + +GLAPI void GLAPIENTRY glBindTextureEXT( GLenum target, GLuint texture ) +{ + glBindTexture(target, target); +} + +GLAPI void GLAPIENTRY glPrioritizeTexturesEXT( GLsizei n, const GLuint *textures, const GLclampf *priorities ) +{ + glPrioritizeTextures(n, textures, priorities); +} + +GLAPI GLboolean GLAPIENTRY glAreTexturesResidentEXT( GLsizei n, const GLuint *textures, GLboolean *residences ) +{ + return glAreTexturesResident(n, textures, residences); +} + +GLAPI GLboolean GLAPIENTRY glIsTextureEXT( GLuint texture ) +{ + return glIsTexture(texture); +} + +/* + * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1) + */ + +GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture) +{ + RESOLVE(PFNGLACTIVETEXTUREARBPROC, "glActiveTextureARB"); + proc(texture); +} + +GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v) +{ + RESOLVE(PFNGLMULTITEXCOORD1DVARBPROC, "glMultiTexCoord1dvARB"); + proc(target, v); +} + +GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v) +{ + RESOLVE(PFNGLMULTITEXCOORD1FVARBPROC, "glMultiTexCoord1fvARB"); + proc(target, v); +} + +GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v) +{ + RESOLVE(PFNGLMULTITEXCOORD1IVARBPROC, "glMultiTexCoord1ivARB"); + proc(target, v); +} + +GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v) +{ + RESOLVE(PFNGLMULTITEXCOORD1SVARBPROC, "glMultiTexCoord1svARB"); + proc(target, v); +} +GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v) +{ + RESOLVE(PFNGLMULTITEXCOORD2DVARBPROC, "glMultiTexCoord2dvARB"); + proc(target, v); +} +GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v) +{ + RESOLVE(PFNGLMULTITEXCOORD2FVARBPROC, "glMultiTexCoord2fvARB"); + proc(target, v); +} +GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v) +{ + RESOLVE(PFNGLMULTITEXCOORD2IVARBPROC, "glMultiTexCoord2ivARB"); + proc(target, v); +} +GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v) +{ + RESOLVE(PFNGLMULTITEXCOORD1SVARBPROC, "glMultiTexCoord1svARB"); + proc(target, v); +} +GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v) +{ + RESOLVE(PFNGLMULTITEXCOORD3DVARBPROC, "glMultiTexCoord3dvARB"); + proc(target, v); +} +GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v) +{ + RESOLVE(PFNGLMULTITEXCOORD3FVARBPROC, "glMultiTexCoord3fvARB"); + proc(target, v); +} +GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v) +{ + RESOLVE(PFNGLMULTITEXCOORD3IVARBPROC, "glMultiTexCoord3ivARB"); + proc(target, v); +} +GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v) +{ + RESOLVE(PFNGLMULTITEXCOORD1SVARBPROC, "glMultiTexCoord1svARB"); + proc(target, v); +} +GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v) +{ + RESOLVE(PFNGLMULTITEXCOORD4DVARBPROC, "glMultiTexCoord4dvARB"); + proc(target, v); +} +GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v) +{ + RESOLVE(PFNGLMULTITEXCOORD4FVARBPROC, "glMultiTexCoord4fvARB"); + proc(target, v); +} +GLAPI void GLAPIENTRY glMultiTexCoord4ivARB(GLenum target, const GLint *v) +{ + RESOLVE(PFNGLMULTITEXCOORD4IVARBPROC, "glMultiTexCoord4ivARB"); + proc(target, v); +} +GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v) +{ + RESOLVE(PFNGLMULTITEXCOORD1SVARBPROC, "glMultiTexCoord1svARB"); + proc(target, v); +} + + +GLAPI void GLAPIENTRY glActiveStencilFaceEXT(GLenum face) +{ + RESOLVE(PFNGLACTIVESTENCILFACEEXTPROC, "glActiveStencilFaceEXT"); + proc(face); +} + +GLAPI void APIENTRY glPointParameterfARB(GLenum pname, GLfloat param) +{ + RESOLVE(PFNGLPOINTPARAMETERFARBPROC, "glPointParameterfARB"); + proc(pname, param); +} + +GLAPI void APIENTRY glPointParameterfvARB(GLenum pname, const GLfloat *params) +{ + RESOLVE(PFNGLPOINTPARAMETERFVARBPROC, "glPointParameterfvARB"); + proc(pname, params); +} + + +GLAPI void APIENTRY glWindowPos3fARB(GLfloat x, GLfloat y, GLfloat z) +{ + RESOLVE(PFNGLWINDOWPOS3FARBPROC, "glWindowPos3fARB"); + proc(x, y, z); +} + +GLAPI void APIENTRY glPointParameteri(GLenum pname, GLint param) +{ + RESOLVE(PFNGLPOINTPARAMETERIPROC, "glPointParameteri"); + proc(pname, param); +} + +GLAPI void APIENTRY glPointParameteriv(GLenum pname, const GLint *params) +{ + RESOLVE(PFNGLPOINTPARAMETERIVPROC, "glPointParameteriv"); + proc(pname, params); +} + +GLAPI void APIENTRY glPointParameteriNV(GLenum pname, GLint param) +{ + RESOLVE(PFNGLPOINTPARAMETERINVPROC, "glPointParameteriNV"); + proc(pname, param); +} + +GLAPI void APIENTRY glPointParameterivNV(GLenum pname, const GLint *params) +{ + RESOLVE(PFNGLPOINTPARAMETERIVNVPROC, "glPointParameterivNV"); + proc(pname, params); +} + +GLAPI void APIENTRY glSecondaryColor3bv(const GLbyte *v) +{ + RESOLVE(PFNGLSECONDARYCOLOR3BVPROC, "glSecondaryColor3bv"); + proc(v); +} +GLAPI void APIENTRY glSecondaryColor3dv(const GLdouble *v) +{ + RESOLVE(PFNGLSECONDARYCOLOR3DVPROC, "glSecondaryColor3dv"); + proc(v); +} +GLAPI void APIENTRY glSecondaryColor3fv(const GLfloat *v) +{ + RESOLVE(PFNGLSECONDARYCOLOR3FVPROC, "glSecondaryColor3fv"); + proc(v); +} +GLAPI void APIENTRY glSecondaryColor3iv(const GLint *v) +{ + RESOLVE(PFNGLSECONDARYCOLOR3IVPROC, "glSecondaryColor3iv"); + proc(v); +} +GLAPI void APIENTRY glSecondaryColor3sv(const GLshort *v) +{ + RESOLVE(PFNGLSECONDARYCOLOR3SVPROC, "glSecondaryColor3sv"); + proc(v); +} +GLAPI void APIENTRY glSecondaryColor3ubv(const GLubyte *v) +{ + RESOLVE(PFNGLSECONDARYCOLOR3UBVPROC, "glSecondaryColor3ubv"); + proc(v); +} +GLAPI void APIENTRY glSecondaryColor3uiv(const GLuint *v) +{ + RESOLVE(PFNGLSECONDARYCOLOR3UIVPROC, "glSecondaryColor3uiv"); + proc(v); +} +GLAPI void APIENTRY glSecondaryColor3usv(const GLushort *v) +{ + RESOLVE(PFNGLSECONDARYCOLOR3USVPROC, "glSecondaryColor3usv"); + proc(v); +} +GLAPI void APIENTRY glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) +{ + RESOLVE(PFNGLSECONDARYCOLORPOINTERPROC, "glSecondaryColorPointer"); + proc(size, type, stride, pointer); +} + + +GLAPI void APIENTRY glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) +{ + RESOLVE(PFNGLBLENDFUNCSEPARATEPROC, "glBlendFuncSeparate"); + proc(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha); +} +GLAPI void APIENTRY glFogCoordfv(const GLfloat *coord) +{ + RESOLVE(PFNGLFOGCOORDFVPROC, "glFogCoordfv"); + proc(coord); +} +GLAPI void APIENTRY glFogCoorddv(const GLdouble *coord) +{ + RESOLVE(PFNGLFOGCOORDDVPROC, "glFogCoorddv"); + proc(coord); +} +GLAPI void APIENTRY glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer) +{ + RESOLVE(PFNGLFOGCOORDPOINTERPROC, "glFogCoordPointer"); + proc(type, stride, pointer); +} + + +GLAPI void APIENTRY glSampleCoverageARB(GLclampf value, GLboolean invert) +{ + RESOLVE(PFNGLSAMPLECOVERAGEARBPROC, "glSampleCoverageARB"); + proc(value, invert); +} +GLAPI void APIENTRY glSampleMaskSGIS(GLclampf value, GLboolean invert) +{ + RESOLVE(PFNGLSAMPLEMASKSGISPROC, "glSampleMaskSGIS"); + proc(value, invert); +} +GLAPI void APIENTRY glSamplePatternSGIS(GLenum pattern) +{ + RESOLVE(PFNGLSAMPLEPATTERNSGISPROC, "glSamplePatternSGIS"); + proc(pattern); +} diff --git a/xorg-server/hw/xwin/glx/indirect.c b/xorg-server/hw/xwin/glx/indirect.c new file mode 100644 index 000000000..5e12022f4 --- /dev/null +++ b/xorg-server/hw/xwin/glx/indirect.c @@ -0,0 +1,1605 @@ +/* + * GLX implementation that uses Windows OpenGL library + * (Indirect rendering path) + * + * Authors: Alexander Gottwald + */ +/* + * Portions of this file are copied from GL/apple/indirect.c, + * which contains the following copyright: + * + * Copyright (c) 2002 Greg Parker. All Rights Reserved. + * Copyright (c) 2002 Apple Computer, Inc. + * + * Portions of this file are copied from xf86glx.c, + * which contains the following copyright: + * + * 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, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE ABOVE LISTED COPYRIGHT HOLDER(S) 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(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. + */ + + + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include "glwindows.h" +#include +#include + +#include + +#define GLWIN_DEBUG_HWND(hwnd) \ + if (glWinDebugSettings.dumpHWND) { \ + char buffer[1024]; \ + if (GetWindowText(hwnd, buffer, sizeof(buffer))==0) *buffer=0; \ + GLWIN_DEBUG_MSG("Got HWND %s (%p)\n", buffer, hwnd); \ + } + + +/* ggs: needed to call back to glx with visual configs */ +extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **configprivs); + +glWinDebugSettingsRec glWinDebugSettings = { 1, 0, 0, 0, 0}; + +static void glWinInitDebugSettings(void) +{ + char *envptr; + + envptr = getenv("GLWIN_ENABLE_DEBUG"); + if (envptr != NULL) + glWinDebugSettings.enableDebug = (atoi(envptr) == 1); + + envptr = getenv("GLWIN_ENABLE_TRACE"); + if (envptr != NULL) + glWinDebugSettings.enableTrace = (atoi(envptr) == 1); + + envptr = getenv("GLWIN_DUMP_PFD"); + if (envptr != NULL) + glWinDebugSettings.dumpPFD = (atoi(envptr) == 1); + + envptr = getenv("GLWIN_DUMP_HWND"); + if (envptr != NULL) + glWinDebugSettings.dumpHWND = (atoi(envptr) == 1); + + envptr = getenv("GLWIN_DUMP_DC"); + if (envptr != NULL) + glWinDebugSettings.dumpDC = (atoi(envptr) == 1); +} + +static char errorbuffer[1024]; +const char *glWinErrorMessage(void) +{ + if (!FormatMessage( + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &errorbuffer, + sizeof(errorbuffer), + NULL )) + { + snprintf(errorbuffer, sizeof(errorbuffer), "Unknown error in FormatMessage: %08x!\n", (unsigned)GetLastError()); + } + return errorbuffer; +} + +/* + * GLX implementation that uses Win32's OpenGL + */ + +/* + * Server-side GLX uses these functions which are normally defined + * in the OpenGL SI. + */ + +GLuint __glFloorLog2(GLuint val) +{ + int c = 0; + + while (val > 1) { + c++; + val >>= 1; + } + return c; +} + +/* some prototypes */ +static Bool glWinScreenProbe(int screen); +static Bool glWinInitVisuals(VisualPtr *visualp, DepthPtr *depthp, + int *nvisualp, int *ndepthp, + int *rootDepthp, VisualID *defaultVisp, + unsigned long sizes, int bitsPerRGB); +static void glWinSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, + void **privates); +static __GLinterface *glWinCreateContext(__GLimports *imports, + __GLcontextModes *mode, + __GLinterface *shareGC); +static void glWinCreateBuffer(__GLXdrawablePrivate *glxPriv); +static void glWinResetExtension(void); + +/* + * 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 = { + glWinScreenProbe, /* Must be generic and handle all screens */ + glWinCreateContext, /* Substitute screen's createContext routine */ + glWinCreateBuffer, /* 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 */ +}; + +void *__glXglDDXScreenInfo(void) { + return &__glDDXScreenInfo; +} + +static __GLXextensionInfo __glDDXExtensionInfo = { + GL_CORE_WINDOWS, + glWinResetExtension, + glWinInitVisuals, + glWinSetVisualConfigs +}; + +void *__glXglDDXExtensionInfo(void) { + return &__glDDXExtensionInfo; +} + +/* prototypes */ + +static GLboolean glWinDestroyContext(__GLcontext *gc); +static GLboolean glWinLoseCurrent(__GLcontext *gc); +static GLboolean glWinMakeCurrent(__GLcontext *gc); +static GLboolean glWinShareContext(__GLcontext *gc, __GLcontext *gcShare); +static GLboolean glWinCopyContext(__GLcontext *dst, const __GLcontext *src, + GLuint mask); +static GLboolean glWinForceCurrent(__GLcontext *gc); + +/* Drawing surface notification callbacks */ +static GLboolean glWinNotifyResize(__GLcontext *gc); +static void glWinNotifyDestroy(__GLcontext *gc); +static void glWinNotifySwapBuffers(__GLcontext *gc); + +/* Dispatch table override control for external agents like libGLS */ +static struct __GLdispatchStateRec* glWinDispatchExec(__GLcontext *gc); +static void glWinBeginDispatchOverride(__GLcontext *gc); +static void glWinEndDispatchOverride(__GLcontext *gc); + +/* Debug output */ +static void pfdOut(const PIXELFORMATDESCRIPTOR *pfd); + +static __GLexports glWinExports = { + glWinDestroyContext, + glWinLoseCurrent, + glWinMakeCurrent, + glWinShareContext, + glWinCopyContext, + glWinForceCurrent, + + glWinNotifyResize, + glWinNotifyDestroy, + glWinNotifySwapBuffers, + + glWinDispatchExec, + glWinBeginDispatchOverride, + glWinEndDispatchOverride +}; + +glWinScreenRec glWinScreens[MAXSCREENS]; + +/* __GLdrawablePrivate->private */ +typedef struct { + DrawablePtr pDraw; + /* xp_surface_id sid; */ +} GLWinDrawableRec; + +struct __GLcontextRec { + struct __GLinterfaceRec interface; /* required to be first */ + + HGLRC ctx; /* Windows GL Context */ + + HDC dc; /* Windows Device Context */ + winWindowInfoRec winInfo; /* Window info from XWin */ + + PIXELFORMATDESCRIPTOR pfd; /* Pixelformat flags */ + int pixelFormat; /* Pixelformat index */ + + unsigned isAttached :1; /* Flag to track if context is attached */ +}; + +static HDC glWinMakeDC(__GLcontext *gc) +{ + HDC dc; + + /*if (gc->winInfo.hrgn == NULL) + { + GLWIN_DEBUG_MSG("Creating region from RECT(%ld,%ld,%ld,%ld):", + gc->winInfo.rect.left, + gc->winInfo.rect.top, + gc->winInfo.rect.right, + gc->winInfo.rect.bottom); + gc->winInfo.hrgn = CreateRectRgnIndirect(&gc->winInfo.rect); + GLWIN_DEBUG_MSG2("%p\n", gc->winInfo.hrgn); + }*/ + + if (glWinDebugSettings.enableTrace) + GLWIN_DEBUG_HWND(gc->winInfo.hwnd); + + dc = GetDC(gc->winInfo.hwnd); + /*dc = GetDCEx(gc->winInfo.hwnd, gc->winInfo.hrgn, + DCX_WINDOW | DCX_NORESETATTRS ); */ + + if (dc == NULL) + ErrorF("GetDC error: %s\n", glWinErrorMessage()); + return dc; +} + +static void unattach(__GLcontext *gc) +{ + BOOL ret; + GLWIN_DEBUG_MSG("unattach (ctx %p)\n", gc->ctx); + if (!gc->isAttached) + { + ErrorF("called unattach on an unattached context\n"); + return; + } + + if (gc->ctx) + { + ret = wglDeleteContext(gc->ctx); + if (!ret) + ErrorF("wglDeleteContext error: %s\n", glWinErrorMessage()); + gc->ctx = NULL; + } + + if (gc->winInfo.hrgn) + { + ret = DeleteObject(gc->winInfo.hrgn); + if (!ret) + ErrorF("DeleteObject error: %s\n", glWinErrorMessage()); + gc->winInfo.hrgn = NULL; + } + + gc->isAttached = 0; +} + +static BOOL glWinAdjustHWND(__GLcontext *gc, WindowPtr pWin) +{ + HDC dc; + BOOL ret; + HGLRC newctx; + HWND oldhwnd; + + GLWIN_DEBUG_MSG("glWinAdjustHWND (ctx %p, pWin %p)\n", gc->ctx, pWin); + + if (pWin == NULL) + { + GLWIN_DEBUG_MSG("Deferring until window is created\n"); + return FALSE; + } + + oldhwnd = gc->winInfo.hwnd; + winGetWindowInfo(pWin, &gc->winInfo); + + GLWIN_DEBUG_HWND(gc->winInfo.hwnd); + if (gc->winInfo.hwnd == NULL) + { + GLWIN_DEBUG_MSG("Deferring until window is created\n"); + return FALSE; + } + + dc = glWinMakeDC(gc); + + if (glWinDebugSettings.dumpDC) + GLWIN_DEBUG_MSG("Got HDC %p\n", dc); + + gc->pixelFormat = ChoosePixelFormat(dc, &gc->pfd); + if (gc->pixelFormat == 0) + { + ErrorF("ChoosePixelFormat error: %s\n", glWinErrorMessage()); + ReleaseDC(gc->winInfo.hwnd, dc); + return FALSE; + } + + ret = SetPixelFormat(dc, gc->pixelFormat, &gc->pfd); + if (!ret) { + ErrorF("SetPixelFormat error: %s\n", glWinErrorMessage()); + ReleaseDC(gc->winInfo.hwnd, dc); + return FALSE; + } + + newctx = wglCreateContext(dc); + if (newctx == NULL) { + ErrorF("wglCreateContext error: %s\n", glWinErrorMessage()); + ReleaseDC(gc->winInfo.hwnd, dc); + return FALSE; + } + + GLWIN_DEBUG_MSG("wglCreateContext (ctx %p)\n", newctx); + + if (!wglShareLists(gc->ctx, newctx)) + { + ErrorF("wglShareLists error: %s\n", glWinErrorMessage()); + ReleaseDC(gc->winInfo.hwnd, dc); + return FALSE; + } + + if (oldhwnd != gc->winInfo.hwnd) + { + GLWIN_DEBUG_MSG("Trying wglCopyContext\n"); + if (!wglCopyContext(gc->ctx, newctx, GL_ALL_ATTRIB_BITS)) + { + ErrorF("wglCopyContext error: %s\n", glWinErrorMessage()); + ReleaseDC(gc->winInfo.hwnd, dc); + return FALSE; + } + } + + if (!wglDeleteContext(gc->ctx)) + { + ErrorF("wglDeleteContext error: %s\n", glWinErrorMessage()); + } + + gc->ctx = newctx; + + if (!wglMakeCurrent(dc, gc->ctx)) { + ErrorF("glMakeCurrent error: %s\n", glWinErrorMessage()); + ReleaseDC(gc->winInfo.hwnd, dc); + return FALSE; + } + + ReleaseDC(gc->winInfo.hwnd, dc); + + return TRUE; +} + +static BOOL glWinCreateContextReal(__GLcontext *gc, WindowPtr pWin) +{ + HDC dc; + BOOL ret; + + GLWIN_DEBUG_MSG("glWinCreateContextReal (pWin %p)\n", pWin); + + if (pWin == NULL) + { + GLWIN_DEBUG_MSG("Deferring until window is created\n"); + return FALSE; + } + + winGetWindowInfo(pWin, &gc->winInfo); + + GLWIN_DEBUG_HWND(gc->winInfo.hwnd); + if (gc->winInfo.hwnd == NULL) + { + GLWIN_DEBUG_MSG("Deferring until window is created\n"); + return FALSE; + } + + + dc = glWinMakeDC(gc); + + if (glWinDebugSettings.dumpDC) + GLWIN_DEBUG_MSG("Got HDC %p\n", dc); + + gc->pixelFormat = ChoosePixelFormat(dc, &gc->pfd); + if (gc->pixelFormat == 0) + { + ErrorF("ChoosePixelFormat error: %s\n", glWinErrorMessage()); + ReleaseDC(gc->winInfo.hwnd, dc); + return FALSE; + } + + ret = SetPixelFormat(dc, gc->pixelFormat, &gc->pfd); + if (!ret) { + ErrorF("SetPixelFormat error: %s\n", glWinErrorMessage()); + ReleaseDC(gc->winInfo.hwnd, dc); + return FALSE; + } + + gc->ctx = wglCreateContext(dc); + if (gc->ctx == NULL) { + ErrorF("wglCreateContext error: %s\n", glWinErrorMessage()); + ReleaseDC(gc->winInfo.hwnd, dc); + return FALSE; + } + + GLWIN_DEBUG_MSG("glWinCreateContextReal (ctx %p)\n", gc->ctx); + + if (!wglMakeCurrent(dc, gc->ctx)) { + ErrorF("glMakeCurrent error: %s\n", glWinErrorMessage()); + ReleaseDC(gc->winInfo.hwnd, dc); + return FALSE; + } + + ReleaseDC(gc->winInfo.hwnd, dc); + + return TRUE; +} + +static void attach(__GLcontext *gc, __GLdrawablePrivate *glPriv) +{ + __GLXdrawablePrivate *glxPriv = (__GLXdrawablePrivate *)glPriv->other; + + GLWIN_DEBUG_MSG("attach (ctx %p)\n", gc->ctx); + + if (gc->isAttached) + { + ErrorF("called attach on an attached context\n"); + return; + } + + if (glxPriv->type == DRAWABLE_WINDOW) + { + WindowPtr pWin = (WindowPtr) glxPriv->pDraw; + if (pWin == NULL) + { + GLWIN_DEBUG_MSG("Deferring ChoosePixelFormat until window is created\n"); + } else + { + if (glWinCreateContextReal(gc, pWin)) + { + gc->isAttached = TRUE; + GLWIN_DEBUG_MSG("attached\n"); + } + } + } +} + +static GLboolean glWinLoseCurrent(__GLcontext *gc) +{ + GLWIN_TRACE_MSG("glWinLoseCurrent (ctx %p)\n", gc->ctx); + + __glXLastContext = NULL; /* Mesa does this; why? */ + + return GL_TRUE; +} + +/* Context manipulation; return GL_FALSE on failure */ +static GLboolean glWinDestroyContext(__GLcontext *gc) +{ + GLWIN_DEBUG_MSG("glWinDestroyContext (ctx %p)\n", gc->ctx); + + if (gc != NULL) + { + if (gc->isAttached) + unattach(gc); + if (gc->dc != NULL) + DeleteDC(gc->dc); + free(gc); + } + + return GL_TRUE; +} + +static GLboolean glWinMakeCurrent(__GLcontext *gc) +{ + __GLdrawablePrivate *glPriv = gc->interface.imports.getDrawablePrivate(gc); + BOOL ret; + HDC dc; + + GLWIN_TRACE_MSG(" (ctx %p)\n", gc->ctx); + + if (!gc->isAttached) + attach(gc, glPriv); + + if (gc->ctx == NULL) { + ErrorF("Context is NULL\n"); + return GL_FALSE; + } + + dc = glWinMakeDC(gc); + ret = wglMakeCurrent(dc, gc->ctx); + if (!ret) + ErrorF("glMakeCurrent error: %s\n", glWinErrorMessage()); + ReleaseDC(gc->winInfo.hwnd, dc); + + return ret?GL_TRUE:GL_FALSE; +} + +static GLboolean glWinShareContext(__GLcontext *gc, __GLcontext *gcShare) +{ + GLWIN_DEBUG_MSG("glWinShareContext unimplemented\n"); + + return GL_TRUE; +} + +static GLboolean glWinCopyContext(__GLcontext *dst, const __GLcontext *src, + GLuint mask) +{ + BOOL ret; + + GLWIN_DEBUG_MSG("glWinCopyContext\n"); + + ret = wglCopyContext(src->ctx, dst->ctx, mask); + if (!ret) + { + ErrorF("wglCopyContext error: %s\n", glWinErrorMessage()); + return GL_FALSE; + } + + return GL_TRUE; +} + +static GLboolean glWinForceCurrent(__GLcontext *gc) +{ + GLWIN_TRACE_MSG(" (ctx %p)\n", gc->ctx); + + return GL_TRUE; +} + +/* Drawing surface notification callbacks */ + +static GLboolean glWinNotifyResize(__GLcontext *gc) +{ + GLWIN_DEBUG_MSG("unimplemented glWinNotifyResize"); + return GL_TRUE; +} + +static void glWinNotifyDestroy(__GLcontext *gc) +{ + GLWIN_DEBUG_MSG("unimplemented glWinNotifyDestroy"); +} + +static void glWinNotifySwapBuffers(__GLcontext *gc) +{ + GLWIN_DEBUG_MSG("unimplemented glWinNotifySwapBuffers"); +} + +/* Dispatch table override control for external agents like libGLS */ +static struct __GLdispatchStateRec* glWinDispatchExec(__GLcontext *gc) +{ + GLWIN_DEBUG_MSG("unimplemented glWinDispatchExec"); + return NULL; +} + +static void glWinBeginDispatchOverride(__GLcontext *gc) +{ + GLWIN_DEBUG_MSG("unimplemented glWinBeginDispatchOverride"); +} + +static void glWinEndDispatchOverride(__GLcontext *gc) +{ + GLWIN_DEBUG_MSG("unimplemented glWinEndDispatchOverride"); +} + +#define DUMP_PFD_FLAG(flag) \ + if (pfd->dwFlags & flag) { \ + ErrorF("%s%s", pipesym, #flag); \ + pipesym = " | "; \ + } + +static void pfdOut(const PIXELFORMATDESCRIPTOR *pfd) +{ + const char *pipesym = ""; /* will be set after first flag dump */ + ErrorF("PIXELFORMATDESCRIPTOR:\n"); + ErrorF("nSize = %u\n", pfd->nSize); + ErrorF("nVersion = %u\n", pfd->nVersion); + ErrorF("dwFlags = %lu = {", pfd->dwFlags); + DUMP_PFD_FLAG(PFD_MAIN_PLANE); + DUMP_PFD_FLAG(PFD_OVERLAY_PLANE); + DUMP_PFD_FLAG(PFD_UNDERLAY_PLANE); + DUMP_PFD_FLAG(PFD_DOUBLEBUFFER); + DUMP_PFD_FLAG(PFD_STEREO); + DUMP_PFD_FLAG(PFD_DRAW_TO_WINDOW); + DUMP_PFD_FLAG(PFD_DRAW_TO_BITMAP); + DUMP_PFD_FLAG(PFD_SUPPORT_GDI); + DUMP_PFD_FLAG(PFD_SUPPORT_OPENGL); + DUMP_PFD_FLAG(PFD_GENERIC_FORMAT); + DUMP_PFD_FLAG(PFD_NEED_PALETTE); + DUMP_PFD_FLAG(PFD_NEED_SYSTEM_PALETTE); + DUMP_PFD_FLAG(PFD_SWAP_EXCHANGE); + DUMP_PFD_FLAG(PFD_SWAP_COPY); + DUMP_PFD_FLAG(PFD_SWAP_LAYER_BUFFERS); + DUMP_PFD_FLAG(PFD_GENERIC_ACCELERATED); + DUMP_PFD_FLAG(PFD_DEPTH_DONTCARE); + DUMP_PFD_FLAG(PFD_DOUBLEBUFFER_DONTCARE); + DUMP_PFD_FLAG(PFD_STEREO_DONTCARE); + ErrorF("}\n"); + + ErrorF("iPixelType = %hu = %s\n", pfd->iPixelType, + (pfd->iPixelType == PFD_TYPE_RGBA ? "PFD_TYPE_RGBA" : "PFD_TYPE_COLORINDEX")); + ErrorF("cColorBits = %hhu\n", pfd->cColorBits); + ErrorF("cRedBits = %hhu\n", pfd->cRedBits); + ErrorF("cRedShift = %hhu\n", pfd->cRedShift); + ErrorF("cGreenBits = %hhu\n", pfd->cGreenBits); + ErrorF("cGreenShift = %hhu\n", pfd->cGreenShift); + ErrorF("cBlueBits = %hhu\n", pfd->cBlueBits); + ErrorF("cBlueShift = %hhu\n", pfd->cBlueShift); + ErrorF("cAlphaBits = %hhu\n", pfd->cAlphaBits); + ErrorF("cAlphaShift = %hhu\n", pfd->cAlphaShift); + ErrorF("cAccumBits = %hhu\n", pfd->cAccumBits); + ErrorF("cAccumRedBits = %hhu\n", pfd->cAccumRedBits); + ErrorF("cAccumGreenBits = %hhu\n", pfd->cAccumGreenBits); + ErrorF("cAccumBlueBits = %hhu\n", pfd->cAccumBlueBits); + ErrorF("cAccumAlphaBits = %hhu\n", pfd->cAccumAlphaBits); + ErrorF("cDepthBits = %hhu\n", pfd->cDepthBits); + ErrorF("cStencilBits = %hhu\n", pfd->cStencilBits); + ErrorF("cAuxBuffers = %hhu\n", pfd->cAuxBuffers); + ErrorF("iLayerType = %hhu\n", pfd->iLayerType); + ErrorF("bReserved = %hhu\n", pfd->bReserved); + ErrorF("dwLayerMask = %lu\n", pfd->dwLayerMask); + ErrorF("dwVisibleMask = %lu\n", pfd->dwVisibleMask); + ErrorF("dwDamageMask = %lu\n", pfd->dwDamageMask); + ErrorF("\n"); +} + +static int makeFormat(__GLcontextModes *mode, PIXELFORMATDESCRIPTOR *pfdret) +{ + PIXELFORMATDESCRIPTOR pfd = { + sizeof(PIXELFORMATDESCRIPTOR), /* size of this pfd */ + 1, /* version number */ + PFD_DRAW_TO_WINDOW | /* support window */ + PFD_SUPPORT_OPENGL, /* support OpenGL */ + PFD_TYPE_RGBA, /* RGBA type */ + 24, /* 24-bit color depth */ + 0, 0, 0, 0, 0, 0, /* color bits ignored */ + 0, /* no alpha buffer */ + 0, /* shift bit ignored */ + 0, /* no accumulation buffer */ + 0, 0, 0, 0, /* accum bits ignored */ + 0, /* 32-bit z-buffer */ + 0, /* no stencil buffer */ + 0, /* no auxiliary buffer */ + PFD_MAIN_PLANE, /* main layer */ + 0, /* reserved */ + 0, 0, 0 /* layer masks ignored */ + }, *result = &pfd; + + /* disable anything but rgba. must get rgba to work first */ + if (!mode->rgbMode) + return -1; + + if (mode->stereoMode) { + result->dwFlags |= PFD_STEREO; + } + if (mode->doubleBufferMode) { + result->dwFlags |= PFD_DOUBLEBUFFER; + } + + if (mode->colorIndexMode) { + /* ignored, see above */ + result->iPixelType = PFD_TYPE_COLORINDEX; + result->cColorBits = mode->redBits + mode->greenBits + mode->blueBits; + result->cRedBits = mode->redBits; + result->cRedShift = 0; /* FIXME */ + result->cGreenBits = mode->greenBits; + result->cGreenShift = 0; /* FIXME */ + result->cBlueBits = mode->blueBits; + result->cBlueShift = 0; /* FIXME */ + result->cAlphaBits = mode->alphaBits; + result->cAlphaShift = 0; /* FIXME */ + } + + if (mode->rgbMode) { + result->iPixelType = PFD_TYPE_RGBA; + result->cColorBits = mode->redBits + mode->greenBits + mode->blueBits; + result->cRedBits = mode->redBits; + result->cRedShift = 0; /* FIXME */ + result->cGreenBits = mode->greenBits; + result->cGreenShift = 0; /* FIXME */ + result->cBlueBits = mode->blueBits; + result->cBlueShift = 0; /* FIXME */ + result->cAlphaBits = mode->alphaBits; + result->cAlphaShift = 0; /* FIXME */ + } + + if (mode->haveAccumBuffer) { + result->cAccumBits = mode->accumRedBits + mode->accumGreenBits + + mode->accumBlueBits + mode->accumAlphaBits; + result->cAccumRedBits = mode->accumRedBits; + result->cAccumGreenBits = mode->accumGreenBits; + result->cAccumBlueBits = mode->accumBlueBits; + result->cAccumAlphaBits = mode->accumAlphaBits; + } + + if (mode->haveDepthBuffer) { + result->cDepthBits = mode->depthBits; + } + if (mode->haveStencilBuffer) { + result->cStencilBits = mode->stencilBits; + } + + /* result->cAuxBuffers = mode->numAuxBuffers; */ + + /* mode->level ignored */ + + /* mode->pixmapMode ? */ + + *pfdret = pfd; + + return 0; +} + +static __GLinterface *glWinCreateContext(__GLimports *imports, + __GLcontextModes *mode, + __GLinterface *shareGC) +{ + __GLcontext *result; + + GLWIN_DEBUG_MSG("glWinCreateContext\n"); + + result = (__GLcontext *)calloc(1, sizeof(__GLcontext)); + if (!result) + return NULL; + + result->interface.imports = *imports; + result->interface.exports = glWinExports; + + if (makeFormat(mode, &result->pfd)) + { + ErrorF("makeFormat failed\n"); + free(result); + return NULL; + } + + if (glWinDebugSettings.dumpPFD) + pfdOut(&result->pfd); + + GLWIN_DEBUG_MSG("glWinCreateContext done\n"); + return (__GLinterface *)result; +} + +Bool +glWinRealizeWindow(WindowPtr pWin) +{ + /* If this window has GL contexts, tell them to reattach */ + /* reattaching is bad: display lists and parameters get lost */ + Bool result; + ScreenPtr pScreen = pWin->drawable.pScreen; + glWinScreenRec *screenPriv = &glWinScreens[pScreen->myNum]; + __GLXdrawablePrivate *glxPriv; + + GLWIN_DEBUG_MSG("glWinRealizeWindow\n"); + + /* Allow the window to be created (RootlessRealizeWindow is inside our wrap) */ + pScreen->RealizeWindow = screenPriv->RealizeWindow; + result = pScreen->RealizeWindow(pWin); + pScreen->RealizeWindow = glWinRealizeWindow; + + /* Re-attach this window's GL contexts, if any. */ + glxPriv = __glXFindDrawablePrivate(pWin->drawable.id); + if (glxPriv) { + __GLXcontext *gx; + __GLcontext *gc; + __GLdrawablePrivate *glPriv = &glxPriv->glPriv; + GLWIN_DEBUG_MSG("glWinRealizeWindow is GL drawable!\n"); + + /* GL contexts bound to this window for drawing */ + for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->next) { + gc = (__GLcontext *)gx->gc; + if (gc->isAttached) +#if 1 + { + GLWIN_DEBUG_MSG("context is already bound! Adjusting HWND.\n"); + glWinAdjustHWND(gc, pWin); + continue; + } +#else + unattach(gc); +#endif + attach(gc, glPriv); + } + + /* GL contexts bound to this window for reading */ + for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->next) { + gc = (__GLcontext *)gx->gc; + if (gc->isAttached) +#if 1 + { + GLWIN_DEBUG_MSG("context is already bound! Adjusting HWND.\n"); + glWinAdjustHWND(gc, pWin); + continue; + } +#else + unattach(gc); +#endif + attach(gc, glPriv); + } + } + + return result; +} + + +void +glWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) +{ + ScreenPtr pScreen = pWindow->drawable.pScreen; + glWinScreenRec *screenPriv = &glWinScreens[pScreen->myNum]; + __GLXdrawablePrivate *glxPriv; + + GLWIN_TRACE_MSG(" (pWindow %p)\n", pWindow); + + /* Check if the window is attached and discard any drawing request */ + glxPriv = __glXFindDrawablePrivate(pWindow->drawable.id); + if (glxPriv) { + __GLXcontext *gx; + + /* GL contexts bound to this window for drawing */ + for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->next) { +/* + GLWIN_DEBUG_MSG("glWinCopyWindow - calling glDrawBuffer\n"); + glDrawBuffer(GL_FRONT); + */ + + return; + } + + /* GL contexts bound to this window for reading */ + for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->next) { + return; + } + } + + GLWIN_DEBUG_MSG("glWinCopyWindow - passing to hw layer\n"); + + pScreen->CopyWindow = screenPriv->CopyWindow; + pScreen->CopyWindow(pWindow, ptOldOrg, prgnSrc); + pScreen->CopyWindow = glWinCopyWindow; +} + +Bool +glWinUnrealizeWindow(WindowPtr pWin) +{ + /* If this window has GL contexts, tell them to unattach */ + Bool result; + ScreenPtr pScreen = pWin->drawable.pScreen; + glWinScreenRec *screenPriv = &glWinScreens[pScreen->myNum]; + __GLXdrawablePrivate *glxPriv; + + GLWIN_DEBUG_MSG("glWinUnrealizeWindow\n"); + + /* The Aqua window may have already been destroyed (windows + * are unrealized from top down) + */ + + /* Unattach this window's GL contexts, if any. */ + glxPriv = __glXFindDrawablePrivate(pWin->drawable.id); + if (glxPriv) { + __GLXcontext *gx; + __GLcontext *gc; + GLWIN_DEBUG_MSG("glWinUnealizeWindow is GL drawable!\n"); + + /* GL contexts bound to this window for drawing */ + for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->next) { + gc = (__GLcontext *)gx->gc; + unattach(gc); + } + + /* GL contexts bound to this window for reading */ + for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->next) { + gc = (__GLcontext *)gx->gc; + unattach(gc); + } + } + + pScreen->UnrealizeWindow = screenPriv->UnrealizeWindow; + result = pScreen->UnrealizeWindow(pWin); + pScreen->UnrealizeWindow = glWinUnrealizeWindow; + + 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 +static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { + { + -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_EXT, /* visualRating */ + 0, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + { + -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_EXT, /* visualRating */ + 0, /* 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 inline int count_bits(uint32_t x) +{ + x = x - ((x >> 1) & 0x55555555); + x = (x & 0x33333333) + ((x >> 2) & 0x33333333); + x = (x + (x >> 4)) & 0x0f0f0f0f; + x = x + (x >> 8); + x = x + (x >> 16); + 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) +{ + int numRGBconfigs; + int numCIconfigs; + int numVisuals = *nvisualp; + int numNewVisuals; + int numNewConfigs; + VisualPtr pVisual = *visualp; + VisualPtr pVisualNew = NULL; + VisualID *orig_vid = NULL; + __GLcontextModes *modes = NULL; + __GLXvisualConfig *pNewVisualConfigs = NULL; + void **glXVisualPriv; + void **pNewVisualPriv; + int found_default; + int i, j, k; + + GLWIN_DEBUG_MSG("init_visuals\n"); + + 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++) { + 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 */ + 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; + glWinScreens[screenInfo.numScreens-1].modes = modes; + for (i = j = 0; i < numVisuals; i++) { + int is_rgb = (pVisual[i].class == TrueColor || + 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; + + /* Initialize the glXVisual */ + _gl_copy_visual_to_context_mode( modes, & NullConfig ); + modes->visualID = pVisualNew[j].vid; + + 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 */ + glWinScreens[screenInfo.numScreens-1].num_vis = numNewVisuals; + glWinScreens[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; + } + + /* 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; +} + + +static void fixup_visuals(int screen) +{ + ScreenPtr pScreen = screenInfo.screens[screen]; + glWinScreenRec *pScr = &glWinScreens[screen]; + __GLcontextModes *modes; + int j; + + GLWIN_DEBUG_MSG("fixup_visuals\n"); + + 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); + 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; + int *used; + int i, j; + + GLWIN_DEBUG_MSG("init_screen_visuals\n"); + + used = (int *)__glXMalloc(pScreen->numVisuals * sizeof(int)); + __glXMemset(used, 0, pScreen->numVisuals * sizeof(int)); + + i = 0; + for ( modes = glWinScreens[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]) { + +#if 0 + /* 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); +#endif + + /* 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); + + /* glWinScreens[screen].xm_vis = pXMesaVisual; */ +} + +static Bool glWinScreenProbe(int screen) +{ + ScreenPtr pScreen; + glWinScreenRec *screenPriv; + + GLWIN_DEBUG_MSG("glWinScreenProbe\n"); + + /* + * Set up the current screen's visuals. + */ + __glDDXScreenInfo.modes = glWinScreens[screen].modes; + __glDDXScreenInfo.pVisualPriv = glWinScreens[screen].priv; + __glDDXScreenInfo.numVisuals = + __glDDXScreenInfo.numUsableVisuals = glWinScreens[screen].num_vis; + + /* + * Set the current screen's createContext routine. This could be + * wrapped by a DDX GLX context creation routine. + */ + __glDDXScreenInfo.createContext = glWinCreateContext; + + /* + * 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); + + /* Wrap RealizeWindow and UnrealizeWindow on this screen */ + pScreen = screenInfo.screens[screen]; + screenPriv = &glWinScreens[screen]; + screenPriv->RealizeWindow = pScreen->RealizeWindow; + pScreen->RealizeWindow = glWinRealizeWindow; + screenPriv->UnrealizeWindow = pScreen->UnrealizeWindow; + pScreen->UnrealizeWindow = glWinUnrealizeWindow; + screenPriv->CopyWindow = pScreen->CopyWindow; + pScreen->CopyWindow = glWinCopyWindow; + + return TRUE; +} + +static GLboolean glWinSwapBuffers(__GLXdrawablePrivate *glxPriv) +{ + /* swap buffers on only *one* of the contexts + * (e.g. the last one for drawing) + */ + __GLcontext *gc = (__GLcontext *)glxPriv->drawGlxc->gc; + HDC dc; + BOOL ret; + + GLWIN_TRACE_MSG("glWinSwapBuffers (ctx %p)\n", (gc!=NULL?gc->ctx:NULL)); + + if (gc != NULL && gc->ctx != NULL) + { + dc = glWinMakeDC(gc); + if (dc == NULL) + return GL_FALSE; + + ret = SwapBuffers(dc); + if (!ret) + ErrorF("SwapBuffers failed: %s\n", glWinErrorMessage()); + + ReleaseDC(gc->winInfo.hwnd, dc); + if (!ret) + return GL_FALSE; + } + + return GL_TRUE; +} + +static void glWinDestroyDrawablePrivate(__GLdrawablePrivate *glPriv) +{ + GLWIN_DEBUG_MSG("glWinDestroyDrawablePrivate\n"); + + /* It doesn't work to call DRIDestroySurface here, the drawable's + already gone.. But dri.c notices the window destruction and + frees the surface itself. */ + + free(glPriv->private); + glPriv->private = NULL; +} + + +static void glWinCreateBuffer(__GLXdrawablePrivate *glxPriv) +{ + GLWinDrawableRec *winPriv = malloc(sizeof(GLWinDrawableRec)); + __GLdrawablePrivate *glPriv = &glxPriv->glPriv; + + /*winPriv->sid = 0; */ + winPriv->pDraw = NULL; + + GLWIN_DEBUG_MSG("glWinCreateBuffer\n"); + + /* replace swapBuffers (original is never called) */ + glxPriv->swapBuffers = glWinSwapBuffers; + + /* stash private data */ + glPriv->private = winPriv; + glPriv->freePrivate = glWinDestroyDrawablePrivate; +} + +static void glWinResetExtension(void) +{ + GLWIN_DEBUG_MSG("glWinResetExtension\n"); +} + +/* based on code in apples/indirect.c which is based on i830_dri.c */ +static void +glWinInitVisualConfigs(void) +{ + int lclNumConfigs = 0; + __GLXvisualConfig *lclVisualConfigs = NULL; + void **lclVisualPrivates = NULL; + + int depth, aux, buffers, stencil, accum; + int i = 0; + + GLWIN_DEBUG_MSG("glWinInitVisualConfigs "); + + /* 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) + GLWIN_DEBUG_MSG("glWinInitVisualConfigs failed to alloc visual configs"); + + GlxSetVisualConfigs(lclNumConfigs, lclVisualConfigs, lclVisualPrivates); +} + +/* Copied from Mesa */ +static void glWinSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, + void **privates) +{ + GLWIN_DEBUG_MSG("glWinSetVisualConfigs\n"); + + numConfigs = nconfigs; + visualConfigs = configs; + visualPrivates = privates; +} + +/* Copied from Mesa */ +static Bool glWinInitVisuals(VisualPtr *visualp, DepthPtr *depthp, + int *nvisualp, int *ndepthp, + int *rootDepthp, VisualID *defaultVisp, + unsigned long sizes, int bitsPerRGB) +{ + glWinInitDebugSettings(); + + GLWIN_DEBUG_MSG("glWinInitVisuals\n"); + + if (0 == numConfigs) /* if no configs */ + glWinInitVisualConfigs(); /* ensure the visula configs are setup */ + + /* + * Setup the visuals supported by this particular screen. + */ + return init_visuals(nvisualp, visualp, defaultVisp, + *ndepthp, *depthp, *rootDepthp); +} diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h index 3ab324931..ea54b997c 100644 --- a/xorg-server/hw/xwin/win.h +++ b/xorg-server/hw/xwin/win.h @@ -586,9 +586,7 @@ typedef struct _winPrivScreenRec ReparentWindowProcPtr ReparentWindow; ResizeWindowProcPtr ResizeWindow; MoveWindowProcPtr MoveWindow; -#ifdef SHAPE SetShapeProcPtr SetShape; -#endif winCursorRec cursor; } winPrivScreenRec; @@ -1196,10 +1194,8 @@ winUnmapWindowRootless (WindowPtr pWindow); Bool winMapWindowRootless (WindowPtr pWindow); -#ifdef SHAPE void winSetShapeRootless (WindowPtr pWindow); -#endif /* @@ -1215,7 +1211,6 @@ winXIconToHICON (WindowPtr pWin, int iconSize); * winmultiwindowshape.c */ -# ifdef SHAPE void winReshapeMultiWindow (WindowPtr pWin); @@ -1224,7 +1219,6 @@ winSetShapeMultiWindow (WindowPtr pWindow); void winUpdateRgnMultiWindow (WindowPtr pWindow); -# endif #endif diff --git a/xorg-server/hw/xwin/wincursor.c b/xorg-server/hw/xwin/wincursor.c index 021b8b82c..92775e404 100644 --- a/xorg-server/hw/xwin/wincursor.c +++ b/xorg-server/hw/xwin/wincursor.c @@ -204,8 +204,7 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen) /* Allocate memory for the bitmaps */ pAnd = malloc (nBytes); memset (pAnd, 0xFF, nBytes); - pXor = malloc (nBytes); - memset (pXor, 0x00, nBytes); + pXor = calloc (1, nBytes); /* Convert the X11 bitmap to a win32 bitmap * The first is for an empty mask */ diff --git a/xorg-server/hw/xwin/wingc.c b/xorg-server/hw/xwin/wingc.c index 107d87aef..1f3775263 100644 --- a/xorg-server/hw/xwin/wingc.c +++ b/xorg-server/hw/xwin/wingc.c @@ -119,7 +119,7 @@ const GCOps winGCOps = { miImageGlyphBlt, miPolyGlyphBlt, #endif - winPushPixels + miPushPixels, }; diff --git a/xorg-server/hw/xwin/winglobals.c b/xorg-server/hw/xwin/winglobals.c index fddada39e..3eb6091e6 100644 --- a/xorg-server/hw/xwin/winglobals.c +++ b/xorg-server/hw/xwin/winglobals.c @@ -44,11 +44,16 @@ int g_iLastScreen = -1; #ifdef HAS_DEVWINDOWS int g_fdMessageQueue = WIN_FD_INVALID; #endif -DevPrivateKey g_iScreenPrivateKey = &g_iScreenPrivateKey; -DevPrivateKey g_iCmapPrivateKey = &g_iCmapPrivateKey; -DevPrivateKey g_iGCPrivateKey = &g_iGCPrivateKey; -DevPrivateKey g_iPixmapPrivateKey = &g_iPixmapPrivateKey; -DevPrivateKey g_iWindowPrivateKey = &g_iWindowPrivateKey; +static int g_iScreenPrivateKeyIndex; +DevPrivateKey g_iScreenPrivateKey = &g_iScreenPrivateKeyIndex; +static int g_iCmapPrivateKeyIndex; +DevPrivateKey g_iCmapPrivateKey = &g_iCmapPrivateKeyIndex; +static int g_iGCPrivateKeyIndex; +DevPrivateKey g_iGCPrivateKey = &g_iGCPrivateKeyIndex; +static int g_iPixmapPrivateKeyIndex; +DevPrivateKey g_iPixmapPrivateKey = &g_iPixmapPrivateKeyIndex; +static int g_iWindowPrivateKeyIndex; +DevPrivateKey g_iWindowPrivateKey = &g_iWindowPrivateKeyIndex; unsigned long g_ulServerGeneration = 0; Bool g_fInitializedDefaultScreens = FALSE; DWORD g_dwEnginesSupported = 0; diff --git a/xorg-server/hw/xwin/winmouse.c b/xorg-server/hw/xwin/winmouse.c index 1507dd34f..be2b66a08 100644 --- a/xorg-server/hw/xwin/winmouse.c +++ b/xorg-server/hw/xwin/winmouse.c @@ -36,7 +36,7 @@ #endif #include "win.h" -#if defined(XFree86Server) && defined(XINPUT) +#if defined(XFree86Server) #include "inputstr.h" /* Peek the internal button mapping */ @@ -106,7 +106,7 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState) 2); free(map); -#if defined(XFree86Server) && defined(XINPUT) +#if defined(XFree86Server) g_winMouseButtonMap = pDeviceInt->button->map; #endif break; @@ -116,7 +116,7 @@ winMouseProc (DeviceIntPtr pDeviceInt, int iState) break; case DEVICE_CLOSE: -#if defined(XFree86Server) && defined(XINPUT) +#if defined(XFree86Server) g_winMouseButtonMap = NULL; #endif case DEVICE_OFF: @@ -225,7 +225,7 @@ winMouseButtonsSendEvent (int iEventType, int iButton) /* Load an xEvent and enqueue the event */ xCurrentEvent.u.u.type = iEventType; -#if defined(XFree86Server) && defined(XINPUT) +#if defined(XFree86Server) if (g_winMouseButtonMap) xCurrentEvent.u.u.detail = g_winMouseButtonMap[iButton]; else diff --git a/xorg-server/hw/xwin/winmultiwindowicons.c b/xorg-server/hw/xwin/winmultiwindowicons.c index 45ed093ec..fbc516cde 100644 --- a/xorg-server/hw/xwin/winmultiwindowicons.c +++ b/xorg-server/hw/xwin/winmultiwindowicons.c @@ -302,12 +302,10 @@ winXIconToHICON (WindowPtr pWin, int iconSize) /* Mask is 1-bit deep */ maskStride = ((iconSize * 1 + 31) & (~31)) / 8; - image = (unsigned char * ) malloc (stride * iconSize); - imageMask = (unsigned char *) malloc (stride * iconSize); - mask = (unsigned char *) malloc (maskStride * iconSize); - + image = malloc (stride * iconSize); + imageMask = malloc (stride * iconSize); /* Default to a completely black mask */ - memset (mask, 0, maskStride * iconSize); + mask = calloc (maskStride, iconSize); winScaleXBitmapToWindows (iconSize, effBPP, iconPtr, image); maskPtr = (PixmapPtr) LookupIDByType (hints.icon_mask, RT_PIXMAP); diff --git a/xorg-server/hw/xwin/winmultiwindowshape.c b/xorg-server/hw/xwin/winmultiwindowshape.c index 33deae337..62cddd0a1 100644 --- a/xorg-server/hw/xwin/winmultiwindowshape.c +++ b/xorg-server/hw/xwin/winmultiwindowshape.c @@ -32,7 +32,6 @@ #ifdef HAVE_XWIN_CONFIG_H #include #endif -#ifdef SHAPE #include "win.h" @@ -208,4 +207,3 @@ winReshapeMultiWindow (WindowPtr pWin) return; } -#endif diff --git a/xorg-server/hw/xwin/winmultiwindowwindow.c b/xorg-server/hw/xwin/winmultiwindowwindow.c index 037c881b4..75bef9786 100644 --- a/xorg-server/hw/xwin/winmultiwindowwindow.c +++ b/xorg-server/hw/xwin/winmultiwindowwindow.c @@ -352,11 +352,9 @@ winMapWindowMultiWindow (WindowPtr pWin) /* Refresh/redisplay the Windows window associated with this X window */ winUpdateWindowsWindow (pWin); -#ifdef SHAPE /* Update the Windows window's shape */ winReshapeMultiWindow (pWin); winUpdateRgnMultiWindow (pWin); -#endif return fResult; } diff --git a/xorg-server/hw/xwin/winprefslex.c b/xorg-server/hw/xwin/winprefslex.c index ff7abc6d0..f75191886 100644 --- a/xorg-server/hw/xwin/winprefslex.c +++ b/xorg-server/hw/xwin/winprefslex.c @@ -53,7 +53,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -84,6 +83,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -140,7 +141,15 @@ typedef unsigned int flex_uint32_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -645,7 +654,7 @@ static char *makestr(char *str) return ptr; } -#line 649 "winprefslex.c" +#line 658 "winprefslex.c" #define INITIAL 0 @@ -726,7 +735,12 @@ static int input (void ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -734,7 +748,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -745,7 +759,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - int n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -829,7 +843,7 @@ YY_DECL #line 64 "winprefslex.l" -#line 833 "winprefslex.c" +#line 847 "winprefslex.c" if ( !(yy_init) ) { @@ -1053,7 +1067,7 @@ YY_RULE_SETUP #line 92 "winprefslex.l" ECHO; YY_BREAK -#line 1057 "winprefslex.c" +#line 1071 "winprefslex.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1820,8 +1834,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ diff --git a/xorg-server/hw/xwin/winprefsyacc.c b/xorg-server/hw/xwin/winprefsyacc.c index abdc681b6..d92dfdd8b 100644 --- a/xorg-server/hw/xwin/winprefsyacc.c +++ b/xorg-server/hw/xwin/winprefsyacc.c @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,65 +54,20 @@ /* Pure parsers. */ #define YYPURE 0 -/* Using locations. */ -#define YYLSP_NEEDED 0 - - +/* Push parsers. */ +#define YYPUSH 0 -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - NEWLINE = 258, - MENU = 259, - LB = 260, - RB = 261, - ICONDIRECTORY = 262, - DEFAULTICON = 263, - ICONS = 264, - DEFAULTSYSMENU = 265, - SYSMENU = 266, - ROOTMENU = 267, - SEPARATOR = 268, - ATSTART = 269, - ATEND = 270, - EXEC = 271, - ALWAYSONTOP = 272, - DEBUG = 273, - RELOAD = 274, - TRAYICON = 275, - SILENTEXIT = 276, - STRING = 277 - }; -#endif -/* Tokens. */ -#define NEWLINE 258 -#define MENU 259 -#define LB 260 -#define RB 261 -#define ICONDIRECTORY 262 -#define DEFAULTICON 263 -#define ICONS 264 -#define DEFAULTSYSMENU 265 -#define SYSMENU 266 -#define ROOTMENU 267 -#define SEPARATOR 268 -#define ATSTART 269 -#define ATEND 270 -#define EXEC 271 -#define ALWAYSONTOP 272 -#define DEBUG 273 -#define RELOAD 274 -#define TRAYICON 275 -#define SILENTEXIT 276 -#define STRING 277 +/* Pull parsers. */ +#define YYPULL 1 +/* Using locations. */ +#define YYLSP_NEEDED 0 /* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ #line 1 "winprefsyacc.y" /* @@ -193,6 +147,9 @@ extern int yylex(void); +/* Line 189 of yacc.c */ +#line 152 "winprefsyacc.c" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -211,28 +168,86 @@ extern int yylex(void); # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + NEWLINE = 258, + MENU = 259, + LB = 260, + RB = 261, + ICONDIRECTORY = 262, + DEFAULTICON = 263, + ICONS = 264, + DEFAULTSYSMENU = 265, + SYSMENU = 266, + ROOTMENU = 267, + SEPARATOR = 268, + ATSTART = 269, + ATEND = 270, + EXEC = 271, + ALWAYSONTOP = 272, + DEBUG = 273, + RELOAD = 274, + TRAYICON = 275, + SILENTEXIT = 276, + STRING = 277 + }; +#endif +/* Tokens. */ +#define NEWLINE 258 +#define MENU 259 +#define LB 260 +#define RB 261 +#define ICONDIRECTORY 262 +#define DEFAULTICON 263 +#define ICONS 264 +#define DEFAULTSYSMENU 265 +#define SYSMENU 266 +#define ROOTMENU 267 +#define SEPARATOR 268 +#define ATSTART 269 +#define ATEND 270 +#define EXEC 271 +#define ALWAYSONTOP 272 +#define DEBUG 273 +#define RELOAD 274 +#define TRAYICON 275 +#define SILENTEXIT 276 +#define STRING 277 + + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 79 "winprefsyacc.y" { + +/* Line 214 of yacc.c */ +#line 79 "winprefsyacc.y" + char *sVal; int iVal; -} -/* Line 187 of yacc.c. */ -#line 223 "winprefsyacc.c" - YYSTYPE; + + + +/* Line 214 of yacc.c */ +#line 239 "winprefsyacc.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif - /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 236 "winprefsyacc.c" +/* Line 264 of yacc.c */ +#line 251 "winprefsyacc.c" #ifdef short # undef short @@ -307,14 +322,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -395,9 +410,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -431,12 +446,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -552,8 +567,8 @@ static const char *const yytname[] = "DEBUG", "RELOAD", "TRAYICON", "SILENTEXIT", "STRING", "$accept", "input", "line", "newline_or_nada", "command", "trayicon", "rootmenu", "defaultsysmenu", "defaulticon", "icondirectory", "menuline", "menulist", - "menu", "@1", "iconline", "iconlist", "icons", "@2", "atspot", - "sysmenuline", "sysmenulist", "sysmenu", "@3", "silentexit", "debug", 0 + "menu", "$@1", "iconline", "iconlist", "icons", "$@2", "atspot", + "sysmenuline", "sysmenulist", "sysmenu", "$@3", "silentexit", "debug", 0 }; #endif @@ -863,17 +878,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -907,11 +925,11 @@ yy_reduce_print (yyvsp, yyrule) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1191,10 +1209,8 @@ yydestruct (yymsg, yytype, yyvaluep) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1210,11 +1226,10 @@ int yyparse (); #endif /* ! YYPARSE_PARAM */ - -/* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ @@ -1222,9 +1237,9 @@ int yynerrs; -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1248,66 +1263,68 @@ yyparse () #endif #endif { - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; @@ -1337,7 +1354,6 @@ yyparse () YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; - /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might @@ -1345,7 +1361,6 @@ yyparse () yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); yyss = yyss1; @@ -1368,9 +1383,8 @@ yyparse () (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1381,7 +1395,6 @@ yyparse () yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -1391,6 +1404,9 @@ yyparse () YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1399,16 +1415,16 @@ yyparse () yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1440,20 +1456,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -1493,123 +1505,170 @@ yyreduce: switch (yyn) { case 18: + +/* Line 1455 of yacc.c */ #line 118 "winprefsyacc.y" { SetTrayIcon((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); } break; case 19: + +/* Line 1455 of yacc.c */ #line 121 "winprefsyacc.y" { SetRootMenu((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); } break; case 20: + +/* Line 1455 of yacc.c */ #line 124 "winprefsyacc.y" { SetDefaultSysMenu((yyvsp[(2) - (4)].sVal), (yyvsp[(3) - (4)].iVal)); free((yyvsp[(2) - (4)].sVal)); } break; case 21: + +/* Line 1455 of yacc.c */ #line 127 "winprefsyacc.y" { SetDefaultIcon((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); } break; case 22: + +/* Line 1455 of yacc.c */ #line 130 "winprefsyacc.y" { SetIconDirectory((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); } break; case 23: + +/* Line 1455 of yacc.c */ #line 133 "winprefsyacc.y" { AddMenuLine("-", CMD_SEPARATOR, ""); } break; case 24: + +/* Line 1455 of yacc.c */ #line 134 "winprefsyacc.y" { AddMenuLine((yyvsp[(1) - (4)].sVal), CMD_ALWAYSONTOP, ""); free((yyvsp[(1) - (4)].sVal)); } break; case 25: + +/* Line 1455 of yacc.c */ #line 135 "winprefsyacc.y" { AddMenuLine((yyvsp[(1) - (5)].sVal), CMD_EXEC, (yyvsp[(3) - (5)].sVal)); free((yyvsp[(1) - (5)].sVal)); free((yyvsp[(3) - (5)].sVal)); } break; case 26: + +/* Line 1455 of yacc.c */ #line 136 "winprefsyacc.y" { AddMenuLine((yyvsp[(1) - (5)].sVal), CMD_MENU, (yyvsp[(3) - (5)].sVal)); free((yyvsp[(1) - (5)].sVal)); free((yyvsp[(3) - (5)].sVal)); } break; case 27: + +/* Line 1455 of yacc.c */ #line 137 "winprefsyacc.y" { AddMenuLine((yyvsp[(1) - (4)].sVal), CMD_RELOAD, ""); free((yyvsp[(1) - (4)].sVal)); } break; case 30: + +/* Line 1455 of yacc.c */ #line 144 "winprefsyacc.y" { OpenMenu((yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); } break; case 31: + +/* Line 1455 of yacc.c */ #line 144 "winprefsyacc.y" {CloseMenu();} break; case 32: + +/* Line 1455 of yacc.c */ #line 147 "winprefsyacc.y" { AddIconLine((yyvsp[(1) - (4)].sVal), (yyvsp[(2) - (4)].sVal)); free((yyvsp[(1) - (4)].sVal)); free((yyvsp[(2) - (4)].sVal)); } break; case 35: + +/* Line 1455 of yacc.c */ #line 154 "winprefsyacc.y" {OpenIcons();} break; case 36: + +/* Line 1455 of yacc.c */ #line 154 "winprefsyacc.y" {CloseIcons();} break; case 37: + +/* Line 1455 of yacc.c */ #line 157 "winprefsyacc.y" { (yyval.iVal)=AT_END; } break; case 38: + +/* Line 1455 of yacc.c */ #line 158 "winprefsyacc.y" { (yyval.iVal)=AT_START; } break; case 39: + +/* Line 1455 of yacc.c */ #line 159 "winprefsyacc.y" { (yyval.iVal)=AT_END; } break; case 40: + +/* Line 1455 of yacc.c */ #line 162 "winprefsyacc.y" { AddSysMenuLine((yyvsp[(1) - (5)].sVal), (yyvsp[(2) - (5)].sVal), (yyvsp[(3) - (5)].iVal)); free((yyvsp[(1) - (5)].sVal)); free((yyvsp[(2) - (5)].sVal)); } break; case 43: + +/* Line 1455 of yacc.c */ #line 169 "winprefsyacc.y" {OpenSysMenu();} break; case 44: + +/* Line 1455 of yacc.c */ #line 169 "winprefsyacc.y" {CloseSysMenu();} break; case 45: + +/* Line 1455 of yacc.c */ #line 172 "winprefsyacc.y" { pref.fSilentExit = TRUE; } break; case 46: + +/* Line 1455 of yacc.c */ #line 175 "winprefsyacc.y" { ErrorF("LoadPreferences: %s\n", (yyvsp[(2) - (3)].sVal)); free((yyvsp[(2) - (3)].sVal)); } break; -/* Line 1267 of yacc.c. */ -#line 1613 "winprefsyacc.c" + +/* Line 1455 of yacc.c */ +#line 1672 "winprefsyacc.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1620,7 +1679,6 @@ yyreduce: *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -1685,7 +1743,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -1702,7 +1760,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -1759,9 +1817,6 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; @@ -1786,7 +1841,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -1797,7 +1852,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered @@ -1823,6 +1878,8 @@ yyreturn: } + +/* Line 1675 of yacc.c */ #line 179 "winprefsyacc.y" /* diff --git a/xorg-server/hw/xwin/winprefsyacc.h b/xorg-server/hw/xwin/winprefsyacc.h index 60a879a4d..25f6e2ab5 100644 --- a/xorg-server/hw/xwin/winprefsyacc.h +++ b/xorg-server/hw/xwin/winprefsyacc.h @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +28,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -88,18 +88,24 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 79 "winprefsyacc.y" { + +/* Line 1676 of yacc.c */ +#line 79 "winprefsyacc.y" + char *sVal; int iVal; -} -/* Line 1489 of yacc.c. */ -#line 98 "winprefsyacc.h" - YYSTYPE; + + + +/* Line 1676 of yacc.c */ +#line 103 "winprefsyacc.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif extern YYSTYPE yylval; + diff --git a/xorg-server/hw/xwin/winpushpxl.c b/xorg-server/hw/xwin/winpushpxl.c deleted file mode 100644 index 72ef2d559..000000000 --- a/xorg-server/hw/xwin/winpushpxl.c +++ /dev/null @@ -1,225 +0,0 @@ -/*********************************************************** - -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 1987 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. - -******************************************************************/ -#ifdef HAVE_XWIN_CONFIG_H -#include -#endif -#include -#include "gcstruct.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "miscstruct.h" -#include "../mfb/maskbits.h" -#include "mi.h" - -#define NPT 128 - -/* winPushPixels -- squeegees the fill style of pGC through pBitMap - * into pDrawable. pBitMap is a stencil (dx by dy of it is used, it may - * be bigger) which is placed on the drawable at xOrg, yOrg. Where a 1 bit - * is set in the bitmap, the fill style is put onto the drawable using - * the GC's logical function. The drawable is not changed where the bitmap - * has a zero bit or outside the area covered by the stencil. - -WARNING: - this code works if the 1-bit deep pixmap format returned by GetSpans -is the same as the format defined by the mfb code (i.e. 32-bit padding -per scanline, scanline unit = 32 bits; later, this might mean -bitsizeof(int) padding and sacnline unit == bitsizeof(int).) - - */ - -/* - * in order to have both (MSB_FIRST and LSB_FIRST) versions of this - * in the server, we need to rename one of them - */ -void -winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, - int dx, int dy, int xOrg, int yOrg) -{ - int h, dxDivPPW, ibEnd; - MiBits *pwLineStart; - register MiBits *pw, *pwEnd; - register MiBits msk; - register int ib, w; - register int ipt; /* index into above arrays */ - Bool fInBox; - DDXPointRec pt[NPT], ptThisLine; - int width[NPT]; - PixelType startmask; - - - startmask = (MiBits)(-1) ^ - LONG2CHARSDIFFORDER((MiBits)(-1) >> 1); - - pwLineStart = (MiBits *)xalloc(BitmapBytePad(dx)); - if (!pwLineStart) - return; - ipt = 0; - dxDivPPW = dx/PPW; - - for(h = 0, ptThisLine.x = 0, ptThisLine.y = 0; - h < dy; - h++, ptThisLine.y++) - { - - (*pBitMap->drawable.pScreen->GetSpans)((DrawablePtr)pBitMap, dx, - &ptThisLine, &dx, 1, (char *)pwLineStart); - - pw = pwLineStart; - /* Process all words which are fully in the pixmap */ - - fInBox = FALSE; - pwEnd = pwLineStart + dxDivPPW; - while(pw < pwEnd) - { - w = *pw; -#ifdef XFree86Server - msk = startmask; -#else - msk = (MiBits)(-1) ^ SCRRIGHT((MiBits)(-1), 1); -#endif - for(ib = 0; ib < PPW; ib++) - { - if(w & msk) - { - if(!fInBox) - { - pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg; - pt[ipt].y = h + yOrg; - /* start new box */ - fInBox = TRUE; - } - } - else - { - if(fInBox) - { - width[ipt] = ((pw - pwLineStart) << PWSH) + - ib + xOrg - pt[ipt].x; - if (++ipt >= NPT) - { - (*pGC->ops->FillSpans)(pDrawable, pGC, - NPT, pt, width, TRUE); - ipt = 0; - } - /* end box */ - fInBox = FALSE; - } - } -#ifdef XFree86Server - /* This is not quite right, but it'll do for now */ - msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1); -#else - msk = SCRRIGHT(msk, 1); -#endif - } - pw++; - } - ibEnd = dx & PIM; - if(ibEnd) - { - /* Process final partial word on line */ - w = *pw; -#ifdef XFree86Server - msk = startmask; -#else - msk = (MiBits)(-1) ^ SCRRIGHT((MiBits)(-1), 1); -#endif - for(ib = 0; ib < ibEnd; ib++) - { - if(w & msk) - { - if(!fInBox) - { - /* start new box */ - pt[ipt].x = ((pw - pwLineStart) << PWSH) + ib + xOrg; - pt[ipt].y = h + yOrg; - fInBox = TRUE; - } - } - else - { - if(fInBox) - { - /* end box */ - width[ipt] = ((pw - pwLineStart) << PWSH) + - ib + xOrg - pt[ipt].x; - if (++ipt >= NPT) - { - (*pGC->ops->FillSpans)(pDrawable, - pGC, NPT, pt, width, TRUE); - ipt = 0; - } - fInBox = FALSE; - } - } -#ifdef XFree86Server - /* This is not quite right, but it'll do for now */ - msk = LONG2CHARSDIFFORDER(LONG2CHARSDIFFORDER(msk) >> 1); -#else - msk = SCRRIGHT(msk, 1); -#endif - } - } - /* If scanline ended with last bit set, end the box */ - if(fInBox) - { - width[ipt] = dx + xOrg - pt[ipt].x; - if (++ipt >= NPT) - { - (*pGC->ops->FillSpans)(pDrawable, pGC, NPT, pt, width, TRUE); - ipt = 0; - } - } - } - xfree(pwLineStart); - /* Flush any remaining spans */ - if (ipt) - { - (*pGC->ops->FillSpans)(pDrawable, pGC, ipt, pt, width, TRUE); - } -} diff --git a/xorg-server/hw/xwin/winscrinit.c b/xorg-server/hw/xwin/winscrinit.c index 9dc4c3da5..512109500 100644 --- a/xorg-server/hw/xwin/winscrinit.c +++ b/xorg-server/hw/xwin/winscrinit.c @@ -478,9 +478,7 @@ winFinishScreenInitFB (int index, WRAP(UnrealizeWindow); WRAP(PositionWindow); WRAP(ChangeWindowAttributes); -#ifdef SHAPE WRAP(SetShape); -#endif /* Assign rootless window procedures to be top level procedures */ pScreen->CreateWindow = winCreateWindowRootless; @@ -489,9 +487,7 @@ winFinishScreenInitFB (int index, /*pScreen->ChangeWindowAttributes = winChangeWindowAttributesRootless;*/ pScreen->RealizeWindow = winMapWindowRootless; pScreen->UnrealizeWindow = winUnmapWindowRootless; -#ifdef SHAPE pScreen->SetShape = winSetShapeRootless; -#endif /* Undefine the WRAP macro, as it is not needed elsewhere */ #undef WRAP @@ -523,9 +519,7 @@ winFinishScreenInitFB (int index, WRAP(ResizeWindow); WRAP(MoveWindow); WRAP(CopyWindow); -#ifdef SHAPE WRAP(SetShape); -#endif /* Assign multi-window window procedures to be top level procedures */ pScreen->CreateWindow = winCreateWindowMultiWindow; @@ -539,9 +533,7 @@ winFinishScreenInitFB (int index, pScreen->ResizeWindow = winResizeWindowMultiWindow; pScreen->MoveWindow = winMoveWindowMultiWindow; pScreen->CopyWindow = winCopyWindowMultiWindow; -#ifdef SHAPE pScreen->SetShape = winSetShapeMultiWindow; -#endif /* Undefine the WRAP macro, as it is not needed elsewhere */ #undef WRAP diff --git a/xorg-server/hw/xwin/winwin32rootlesswndproc.c b/xorg-server/hw/xwin/winwin32rootlesswndproc.c index 859aafd29..32db6621b 100644 --- a/xorg-server/hw/xwin/winwin32rootlesswndproc.c +++ b/xorg-server/hw/xwin/winwin32rootlesswndproc.c @@ -300,7 +300,9 @@ IsRaiseOnClick (WindowPtr pWin) struct _Window *pwin; struct _Property *prop; - WindowPtr pRoot = GetCurrentRootWindow (); + /* XXX We're getting inputInfo.poniter here, but this might be really wrong. + * Which pointer's current window do we want? */ + WindowPtr pRoot = GetCurrentRootWindow (inputInfo.pointer); if (!pWin) { @@ -353,7 +355,9 @@ IsMouseActive (WindowPtr pWin) struct _Window *pwin; struct _Property *prop; - WindowPtr pRoot = GetCurrentRootWindow (); + /* XXX We're getting inputInfo.poniter here, but this might be really wrong. + * Which pointer's current window do we want? */ + WindowPtr pRoot = GetCurrentRootWindow (inputInfo.pointer); if (!pWin) { diff --git a/xorg-server/hw/xwin/winwindow.c b/xorg-server/hw/xwin/winwindow.c index 1600996df..285a344f7 100644 --- a/xorg-server/hw/xwin/winwindow.c +++ b/xorg-server/hw/xwin/winwindow.c @@ -46,11 +46,9 @@ static void winUpdateRgnRootless (WindowPtr pWindow); -#ifdef SHAPE static void winReshapeRootless (WindowPtr pWin); -#endif #ifdef XWIN_NATIVEGDI @@ -447,9 +445,7 @@ winMapWindowRootless (WindowPtr pWin) fResult = (*pScreen->RealizeWindow)(pWin); WIN_WRAP(RealizeWindow, winMapWindowRootless); -#ifdef SHAPE winReshapeRootless (pWin); -#endif winUpdateRgnRootless (pWin); @@ -457,7 +453,6 @@ winMapWindowRootless (WindowPtr pWin) } -#ifdef SHAPE void winSetShapeRootless (WindowPtr pWin) { @@ -478,7 +473,6 @@ winSetShapeRootless (WindowPtr pWin) return; } -#endif /* @@ -569,7 +563,6 @@ winUpdateRgnRootless (WindowPtr pWin) } -#ifdef SHAPE static void winReshapeRootless (WindowPtr pWin) @@ -646,4 +639,3 @@ winReshapeRootless (WindowPtr pWin) return; } -#endif diff --git a/xorg-server/hw/xwin/winwindowswm.c b/xorg-server/hw/xwin/winwindowswm.c index e1994de84..28bcb64c8 100644 --- a/xorg-server/hw/xwin/winwindowswm.c +++ b/xorg-server/hw/xwin/winwindowswm.c @@ -49,8 +49,6 @@ static int WMErrorBase; static DISPATCH_PROC(ProcWindowsWMDispatch); static DISPATCH_PROC(SProcWindowsWMDispatch); -static void WindowsWMResetProc(ExtensionEntry* extEntry); - static unsigned char WMReqCode = 0; static int WMEventBase = 0; @@ -98,7 +96,7 @@ winWindowsWMExtensionInit () WindowsWMNumberErrors, ProcWindowsWMDispatch, SProcWindowsWMDispatch, - WindowsWMResetProc, + NULL, StandardMinorOpcode))) { WMReqCode = (unsigned char)extEntry->base; @@ -108,12 +106,6 @@ winWindowsWMExtensionInit () } } -/*ARGSUSED*/ -static void -WindowsWMResetProc (ExtensionEntry* extEntry) -{ -} - static int ProcWindowsWMQueryVersion(register ClientPtr client) { -- cgit v1.2.3